maptool
maptool copied to clipboard
[Bug]: Load campaign, start server, and token imported from Hero Lab loses binding (Hero Lab not needed to investigate this issue)
Describe the Bug
My "Melee Attack" macro for the "Galirex Hellbane" token works until you start the server at which point the token appears to lose a binding that causing the Hero Lab part of the API to break (the Hero Lab MapTool macros).
You do NOT need Hero Lab to investigate this issue. Everything you need is included in this issue posting.
See reproduction steps.
To Reproduce
- Start MapTool 1.12.0 Beta 2.
- Load the "test.cmpgn" (you must unzip "test.zip"):
- Go to the Campaign window.
- Select the "Galirex Hellbane" token on the "Grasslands" map.
- Click "Melee Attack".
- Choose "No" (so that as GM you do not do this in secret).
- Choose "bite (kitsune) (melee)".
- Click "Okay".
- Leave the default "No" selected for "Is this a coup de grace?".
- Click "Okay & Include Temporary Changes" (yes, there's multiple buttons like this and it doesn't matter which one you click).
- Notice in the Chat window that it worked.
- Now, start the server with the options illustrated in the attachment:
- Repeat steps 2 through 4 and notice that now you get the following error:
java.lang.NullPointerException: Cannot invoke "java.io.File.getAbsolutePath()" because the return value of "net.rptools.maptool.model.HeroLabData.getPortfolioFile()" is null error executing expression heroLabInfo = herolab.getInfo(). Error trace : TokenHeroLabSync@Lib:CharacterSheet <<< TokenUpdateToLatestMacroVersion@Lib:CharacterSheet <<< Melee Attack@campaign
- The "maptool.log" created from the point where MapTool 1.12.0 Beta 2 is started till the above error is attached below:
Expected Behaviour
Clicking the "Melee Attack" macro with the "Galirex Hellbane" token selected should still work. You should not get an error.
Screenshots
No response
MapTool Info
MapTool 1.12.0 Beta 2
Desktop
Windows 10
Additional Context
This issue might be related to an issue reported in #3280.
test.cmpgn is inside test.zip. Unzip test.zip.
Just like in #3280, if you start the server BEFORE loading "test.cmpgn" everything works as expected -- there is no error.
However, if you encounter the problem as described by this bug and you save "test.cmpgn", the issue will be persisted to "test.cmpgn", so if you load it again with a freshly started MapTool application you will continue to see the issue whether or not the server is started.
If you do the "To reproduce" steps AND replace step 5 with doing a double click on the token to open the "Edit Token" dialog, you get a stack trace:
java.lang.NullPointerException: Cannot invoke "net.rptools.maptool.model.Token.getOwners()" because the return value of "net.rptools.maptool.client.ui.token.EditTokenDialog.getModel()" is null
at net.rptools.maptool.client.ui.token.EditTokenDialog$OwnerListModel.
The "maptool.log" created from the point where MapTool 1.12.0 Beta 2 is started till the above error is attached below:
Work-around: I'll stress that the current work-around is to start the server BEFORE loading campaign files and everything is okay.
"test.cmpgn" is virgin MapTool 1.12.0 Beta 2. In other words, while all the macros and the campaign properties were created in MapTool 1.11.5 (and have a lineage all the way back to MapTool 1.4.x), "test.cmpgn" was created directly in MapTool 1.12.0 Beta 2.
You should not need the Hero Lab file NOR Hero Lab, but I've attached the Hero Lab file. Unzip "Galirex_Hellbane.zip", which contains "Galirex_Hellbane.por". You might have trouble using it in your Hero Lab because it requires a beefy license (but again, you should NOT need Hero Lab for this issue).
If you decide to import your own Hero Lab PC or NPC (such as "Galirex_Hellbane.por"), you'll need to select it and click the "Sync & Optimize Token With Hero Lab(R) POR File" macro on the GM window to make it work with the "Melee Attack" macro on the Campaign window (as described in my steps-to-reproduce) -- but all of this is unnecessary, I think.
I can reproduce this in the beta build, but not with the current code in the dev branch, so hopefully, this is already fixed.
Thank you. Will retest in next beta release.
I'm able to reproduce this issue with MapTool 1.12.0 Beta 3.
I think the problem is that somehow the fix for this issue and #3280 exists in the DEV branch but is not being included in the releases. No idea why.
These problems do NOT exist in MapTool 1.10.4.
@Phergus are you able to try this? I am not able to reproduce with code in develop branch of 1.12 beta 3. Starting to wonder what I am doing wrong :)
@cwisniew Nope. Tried with the campaign file originally provided and with the standalone .por file in both beta 3 and with current dev code. No errors seen running melee attack macro. No problems opening edit token dialog.
It's critical that you load the campaign BEFORE starting the server -- then start the server otherwise you won't see a problem.
Once you start the server with the campaign already loaded, you'll have problems running the melee attack macro and opening the edit token dialog. Worse is that if you save the campaign like this, it will be permanently messed up.
Here I am reproducing the problem with the "Edit Token" dialog and MapTool 1.12.0 Beta 3:
Yes. I loaded the campaign before starting the server.
Very puzzling. I can reproduce this everytime on different PCs. I wonder if having Hero Lab installed makes a difference. I'll try this tomorrow on a laptop where I don't have Hero Lab.
I don't know what the difference is between the environments on your PCs versus mine -- but I can reproduce this issue every time on 3 of my PCs with or without Hero Lab installed using MapTool 1.12.0 Beta 3.
One improvement, though, since I first started seeing this issue in MapTool 1.11.X is that at least MapTool no longer suffers a fatal exception where the whole application aborts (where it exits) as reported in #3280.
This issue does NOT exist at all in MapTool 1.10.4.
@Phergus, I just had a thought. The most likely environment difference between my PCs and yours are the server start and preferences menu item settings. The problem must be burried in one of those options.
I'll do some testing to see if I can find it.
These are the preferences I'm using on a PC where I am able to reproduce this problem (the server start options can be found above):
This is a big problem because I can reproduce it everytime also when I have a campaign loaded and stop the server. If I forget to save my campaign before stopping the server, after the server is stopped, all of my Hero Lab tokens throw the exception I provided above and in the same way. Effectively, my campaign is lost.
This is un MapTool 1.11.X through 1.12.X (the current version as of this writing).
Just to be clear. The work-around for this problem goes like this:
-
If you're planning on starting the server, load the campaign AFTER the server is started.
-
If you're planning on shutting down the server, save your campaign FIRST -- if you do it after all your Hero Lab tokens will be messed up as described above.
-
If you're simply developing a campaign and have no plans to start or shutdown the server, then there is no problem.