833 | 834 | ||
---|---|---|---|
36 | import java.util.concurrent.locks.ReentrantLock; | 36 | import java.util.concurrent.locks.ReentrantLock; |
37 | import java.util.logging.Level; | 37 | import java.util.logging.Level; |
38 | 38 | ||
39 | import org.apache.commons.lang.RandomStringUtils; | ||
40 | |||
39 | import javolution.text.TextBuilder; | 41 | import javolution.text.TextBuilder; |
40 | import javolution.util.FastList; | 42 | import javolution.util.FastList; |
41 | import javolution.util.FastMap; | 43 | import javolution.util.FastMap; |
... | ... | ||
11242 | String word = Config.QUESTION_LIST.get(Rnd.get(Config.QUESTION_LIST.size())); | 11244 | String word = Config.QUESTION_LIST.get(Rnd.get(Config.QUESTION_LIST.size())); |
11243 | String output; | 11245 | String output; |
11244 | _correctWord = Rnd.get(5)+1; | 11246 | _correctWord = Rnd.get(5)+1; |
11245 | byte[] temp; | 11247 | |
11246 | byte tmp; | ||
11247 | |||
11248 | text = text.replace("%Time%", Integer.toString(Config.BOT_PROTECTOR_WAIT_ANSVER)); | 11248 | text = text.replace("%Time%", Integer.toString(Config.BOT_PROTECTOR_WAIT_ANSVER)); |
11249 | for(int i = 1; i <= 5; i++) | 11249 | for(int i = 1; i <= 5; i++) |
11250 | { | 11250 | { |
11251 | temp = word.getBytes(); | ||
11252 | if(i != _correctWord) | 11251 | if(i != _correctWord) |
11253 | { | 11252 | { |
11254 | tmp = temp[i*4-4]; | 11253 | output = RandomStringUtils.random(word.length(), word); |
11255 | temp[i*4-4] = temp[i*4-2]; | 11254 | }else{ |
11256 | temp[i*4-2] = tmp; | 11255 | output = word; |
11257 | tmp = temp[i*4-3]; | ||
11258 | temp[i*4-3] = temp[i*4-1]; | ||
11259 | temp[i*4-1] = tmp; | ||
11260 | } | 11256 | } |
11261 | 11257 | ||
11262 | output = new String(temp); | ||
11263 | text = text.replace("%Word"+i+"%", output); | 11258 | text = text.replace("%Word"+i+"%", output); |
11264 | if(i == 3) | 11259 | if(i == 3) |
11265 | { | 11260 | { |
11266 | text = text.replace("%Word%", output); | 11261 | text = text.replace("%Word%", output); |
11267 | } | 11262 | } |
11268 | temp = null; | 11263 | |
11269 | } | 11264 | } |
11270 | 11265 | ||
11271 | L2PcInstance.this.sendPacket(new TutorialShowHtml(text)); | 11266 | L2PcInstance.this.sendPacket(new TutorialShowHtml(text)); |
... | ... | ||
11278 | } | 11273 | } |
11279 | catch(Exception e) | 11274 | catch(Exception e) |
11280 | { | 11275 | { |
11281 | if(Config.ENABLE_ALL_EXCEPTIONS) | 11276 | e.printStackTrace(); |
11282 | e.printStackTrace(); | ||
11283 | } | 11277 | } |
11284 | } | 11278 | } |
11285 | else | 11279 | else |
... | ... | ||
12766 | { | 12760 | { |
12767 | if(_taskBotChecker == null) | 12761 | if(_taskBotChecker == null) |
12768 | { | 12762 | { |
12769 | _taskBotChecker = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new botChecker(), Config.BOT_PROTECTOR_FIRST_CHECK * 60000, Config.BOT_PROTECTOR_NEXT_CHECK * 60000); | 12763 | if(Config.QUESTION_LIST.size() != 0){ |
12764 | _taskBotChecker = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new botChecker(), Config.BOT_PROTECTOR_FIRST_CHECK * 60000, Config.BOT_PROTECTOR_NEXT_CHECK * 60000); | ||
12765 | }else{ | ||
12766 | _log.warning("ATTENTION: Bot Checker is bad configured because config/questionwords.txt has 0 words of 6 to 15 keys"); | ||
12767 | } | ||
12770 | } | 12768 | } |
12771 | } | 12769 | } |
12772 | 12770 |