norecha / pokubot

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

NullPointerException on changing elixir collector images #63

Closed ashishmverma1 closed 9 years ago

ashishmverma1 commented 9 years ago

I tried updating the collector images (to check empty collectors) by replacing "full_xx.png" images by my own images of similar resolutions. Now on running the bot, whenever bot has to check for empty collectors, it throws NULL exception.

How to correctly update the collector images?

Log:

[05.30.15 3:25:51 AM] aok.coc.state.StateAttack handle INFO: StateAttack 
[05.30.15 3:25:51 AM] aok.coc.util.ImageParser parseLoot INFO: [gold: 320232, elixir: 241258, de: 144] 
[05.30.15 3:25:51 AM] aok.coc.util.ImageParser parseTroopCount INFO: [Troop count: [137, 103, 0]] 
[05.30.15 3:25:51 AM] aok.coc.launcher.BotLauncher loop SEVERE: null 
aok.coc.exception.BotException
    at aok.coc.util.ImageParser.isCollectorFullBase(ImageParser.java:424)
    at aok.coc.util.ImageParser.isCollectorFullBase(ImageParser.java:358)
    at aok.coc.state.StateAttack.handle(StateAttack.java:62)
    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$265/766372587.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javafx.concurrent.Service.lambda$executeTask$489(Unknown Source)
    at javafx.concurrent.Service$$Lambda$263/1292364633.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)
Caused by: java.lang.NullPointerException
    at aok.coc.util.ImageParser.isCollectorFullBase(ImageParser.java:367)
    ... 17 more

Steps I followed:

I'm new to JAVA, not sure if its the correct way to do it. Or do we have to re compile the whole source after image updates?

norecha commented 9 years ago

Yes you need to compile

ashishmverma1 commented 9 years ago

Can you just write the command (or procedure) to compile from source code? It would be really helpfull. I can code in Java, but not sure how to compile the repository into a JAR file.

norecha commented 9 years ago

It is a maven project so easiest way is just add the project to your IDE, install maven plugin and run mvn package.

Or you can just use terminal(or cmd for windows) and browse into project folder and run "mvn package"

On 7/1/2015 10:08 AM, Ashish Verma wrote:

Can you just write the command (or procedure) to compile from source code? It would be really helpfull. I can code in Java, but not sure how to compile the repository into a JAR file.

— Reply to this email directly or view it on GitHub https://github.com/norecha/pokubot/issues/63#issuecomment-117688072.

ashishmverma1 commented 9 years ago

Yay it worked! Thanks a lot! You the man! :) I've made all the updates to the coordinates other than loot parsing and have tested them too. Will drop in a pull request.