norecha / pokubot

Clash of Clans bot
GNU General Public License v2.0
163 stars 83 forks source link

"SEVERE: de: ffc2b847" #61

Closed kaiziru closed 9 years ago

kaiziru commented 9 years ago

After it click find a match, the first base it happen. sever : de : ffc2b841.

[05.16.15 8:46:16 AM] aok.coc.controller.MainWindowController$9 handle WARNING: Setup is cancelled. [05.16.15 8:46:20 AM] aok.coc.launcher.Setup setup INFO: Setting up ConfigUtils... [05.16.15 8:46:20 AM] aok.coc.launcher.Setup setup INFO: Setting up ConfigUtils... [05.16.15 8:46:20 AM] aok.coc.launcher.Setup setup INFO: Make sure in-game language is English. [05.16.15 8:46:20 AM] aok.coc.launcher.Setup setup INFO: Make sure in-game language is English. [05.16.15 8:46:20 AM] aok.coc.util.ConfigUtils initialize INFO: Found barracks coordinates <403, 466> [05.16.15 8:46:20 AM] aok.coc.launcher.Setup setup INFO: Setting up BlueStacks App Player window... [05.16.15 8:46:20 AM] aok.coc.controller.MainWindowController$8 handle SEVERE: Setup is failed: ConfigUtils is already initialized. java.lang.IllegalStateException: ConfigUtils is already initialized. at aok.coc.util.ConfigUtils.initialize(ConfigUtils.java:115) at aok.coc.launcher.Setup.setup(Setup.java:50) at aok.coc.launcher.BotLauncher.setup(BotLauncher.java:52) at aok.coc.controller.MainWindowController$6$1.call(MainWindowController.java:189) at aok.coc.controller.MainWindowController$6$1.call(MainWindowController.java:184) at javafx.concurrent.Task$TaskCallable.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at javafx.concurrent.Service.lambda$null$488(Unknown Source) at javafx.concurrent.Service$$Lambda$269/1763894632.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at javafx.concurrent.Service.lambda$executeTask$489(Unknown Source) at javafx.concurrent.Service$$Lambda$267/1612857430.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

[05.16.15 8:46:29 AM] aok.coc.launcher.Setup setupBsRect FINEST: The corner locations for the window "BlueStacks App Player" are [8, 4, 874, 753] [05.16.15 8:46:29 AM] aok.coc.launcher.Setup setup INFO: Setting up BlueStacks App Player resolution... [05.16.15 8:46:29 AM] aok.coc.launcher.Setup setup INFO: Setting up RobotUtils... [05.16.15 8:46:29 AM] aok.coc.launcher.Setup setup INFO: Setting up Barracks... [05.16.15 8:46:42 AM] aok.coc.launcher.Setup setup INFO: Setting up ConfigUtils... [05.16.15 8:46:42 AM] aok.coc.launcher.Setup setup INFO: Make sure in-game language is English. [05.16.15 8:46:42 AM] aok.coc.util.ConfigUtils initialize INFO: Found barracks coordinates <403, 466> [05.16.15 8:46:42 AM] aok.coc.launcher.Setup setup INFO: Setting up BlueStacks App Player window... [05.16.15 8:46:42 AM] aok.coc.launcher.Setup setupBsRect FINEST: The corner locations for the window "BlueStacks App Player" are [8, 4, 874, 753] [05.16.15 8:46:42 AM] aok.coc.launcher.Setup setup INFO: Setting up BlueStacks App Player resolution... [05.16.15 8:46:42 AM] aok.coc.launcher.Setup setup INFO: Setting up RobotUtils... [05.16.15 8:46:42 AM] aok.coc.launcher.Setup setup INFO: Setting up Barracks... [05.16.15 8:46:42 AM] aok.coc.controller.MainWindowController$7 handle INFO: Setup is successful. [05.16.15 8:46:42 AM] aok.coc.controller.MainWindowController$7 handle INFO: Click start to run. [05.16.15 8:46:53 AM] aok.coc.launcher.BotLauncher start INFO: Starting disconnect detector... [05.16.15 8:46:53 AM] aok.coc.launcher.DisconnectChecker run INFO: Running disconnect detector... [05.16.15 8:46:53 AM] aok.coc.state.Context setState FINEST: Setting next state to: StateIdle [05.16.15 8:46:53 AM] aok.coc.state.StateIdle handle INFO: StateIdle [05.16.15 8:46:54 AM] aok.coc.state.Context setState FINEST: Setting next state to: StateMainMenu [05.16.15 8:46:54 AM] aok.coc.state.StateMainMenu handle INFO: StateMainMenu [05.16.15 8:46:54 AM] aok.coc.util.RobotUtils zoomUp INFO: Zooming out... [05.16.15 8:47:08 AM] aok.coc.util.RobotUtils leftClickWin32 FINEST: clicking 403 466 [05.16.15 8:47:36 AM] aok.coc.util.RobotUtils leftClickWin32 FINEST: clicking 617 588 [05.16.15 8:47:37 AM] aok.coc.state.StateMainMenu handle INFO: Camp is full [05.16.15 8:47:37 AM] aok.coc.util.RobotUtils leftClickWin32 FINEST: clicking 729 146 [05.16.15 8:47:37 AM] aok.coc.util.RobotUtils leftClickWin32 FINEST: clicking 62 598 [05.16.15 8:47:39 AM] aok.coc.state.Context setState FINEST: Setting next state to: StateFindAMatch [05.16.15 8:47:39 AM] aok.coc.state.StateFindAMatch handle INFO: StateFindAMatch [05.16.15 8:47:39 AM] aok.coc.util.RobotUtils leftClickWin32 FINEST: clicking 147 529 [05.16.15 8:47:40 AM] aok.coc.util.RobotUtils leftClickWin32 FINEST: clicking 512 396 [05.16.15 8:47:45 AM] aok.coc.state.Context setState FINEST: Setting next state to: StateAttack [05.16.15 8:47:45 AM] aok.coc.state.StateAttack handle INFO: StateAttack [05.16.15 8:47:45 AM] aok.coc.launcher.BotLauncher loop SEVERE: de: ffc2b847 aok.coc.exception.BotBadBaseException: de: ffc2b847 at aok.coc.util.ImageParser.hasDE(ImageParser.java:171) at aok.coc.util.ImageParser.parseGold(ImageParser.java:176) at aok.coc.util.ImageParser.parseLoot(ImageParser.java:342) at aok.coc.util.ImageParser.parseLoot(ImageParser.java:354) at aok.coc.state.StateAttack.handle(StateAttack.java:46) at aok.coc.state.Context.handle(Context.java:20) at aok.coc.launcher.BotLauncher.loop(BotLauncher.java:86) at aok.coc.launcher.BotLauncher.start(BotLauncher.java:72) at aok.coc.controller.MainWindowController$3$1.call(MainWindowController.java:153) at aok.coc.controller.MainWindowController$3$1.call(MainWindowController.java:149) at javafx.concurrent.Task$TaskCallable.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at javafx.concurrent.Service.lambda$null$488(Unknown Source) at javafx.concurrent.Service$$Lambda$269/1763894632.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at javafx.concurrent.Service.lambda$executeTask$489(Unknown Source) at javafx.concurrent.Service$$Lambda$267/1612857430.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

[05.16.15 8:47:45 AM] aok.coc.launcher.BotLauncher loop INFO: Waiting for dc checker to wake me up...

bad_base_1431737265069 bug folder

how to fix it?

code-borker commented 9 years ago

Wow, so I started digging into the code, and I'm really not sure what's going on. I think to work around, for the time being, set the bot to attack only bases that have DE..

From my understanding, it takes the image you have above, and looks at the pixel at 20,0 (which is where the gold coin is to determine if the base has DE.. (I'd need to see the same image produced from a base with DE to see what is different that lets the bot know whether or not a base has DE or not)

Anyways, the bot is expecting 1 of 2 pixel colors under 20, 0 in the image with about a 2.7% accuracy in red, green, and blue values. Either #b1a841 or #80752b, which are oddly enough is a shade of bright gold, or dark gold. If it finds neither, then you get the exception.

Your image at 20,0 returns c2b847, which is still a shade of yellow, since you're still on that gold coin, but it's outside the bounds on the RGB values.

So for RGB values we have:

b1a841 = 177, 168, 65

80752b = 128, 117, 43

c2b847 = 194, 184, 71 (yours)

Basically you need to be within 7 on all 3 values, and you are not.

So either your bluestacks player is not in 860x720 (which is odd, because normally there's a different issue when that happens). Or for some reason something is shifting the available loot area out of where it would otherwise be expected.

That said, if you're not afraid of grabbing the source, and building it yourself, you can just change the RGB values to match what you're getting. Just add:

} else if (RobotUtils.compareColor(deCheck, 0xffc2b847, 7)) {
  return false;
}

You'll probably need to do something similar for bases containing DE, as I'm guessing you'll have a different color to match against, I'm not sure, so:

} else if (RobotUtils.compareColor(deCheck, 0xff<hex_color_here>, 7)) {
  return true;
}
norecha commented 9 years ago

@code-borker It could be one time thing, I'm not sure if he constantly gets same exception. Sometimes some stuff fly over the screen, like when it snowed during christmas, that was ruining pixel detection. Could be similar here