Jump to content

mod_wb_pm_autoreset.wotmod the "279e mission auto reset mod" reset after finishing primary condition


Recommended Posts

Posted

If I want to do coalition-15 mission with honor,

and I got 2 ace and 1 first class already,

I expect the mod to not reset, until I fail all 20 games.

 

observation:

It reset, even when I still have 12 games left.

  • Administrator
Posted

That's second report about problems with this mod recenly, which I cannot check at all, maybe I will just remove it from the modpack.

  • 4 weeks later...
Posted (edited)

Your mod is very helpful, for people doing 279e missions. I hope more people can find it.

 

I am newbie at WOT mod programming, because of the lack of English documentation.

 

I decompiled your code here: 

https://pastebin.com/hdPJXAGS

 

original snippet: 

if 'state' in questKeys and quest['battlesSeries']['state'] >= 5:
    if len(quest['battlesSeries']['battles']) == 0 and len(quest['battlesSeriesAdv']['battles']) > 0:
        for battle in quest['battlesSeriesAdv']['battles']:
            if battle:
                advConditionFailed = False
                break

should be changed to:

#...
#init value of advConditionFailed should be False
advConditionFailed = False
#...
if 'state' in questKeys and quest['battlesSeries']['state'] >= 5:
    if len(quest['battlesSeries']['battles']) == 0 and len(quest['battlesSeriesAdv']['battles']) > 0:
        #only set advConditionFailed  to true, before the for loop
        advConditionFailed = True
        for battle in quest['battlesSeriesAdv']['battles']:
            if battle:
                advConditionFailed = False
                break

 

The reason: 

right after I finish the first part of the mission and before I finish the honor/advanced part, both list for battles are not empty.

Then without enter the for loop, advConditionFailed keep the init value of True, and cause the reset.

 

Also using a different event listener, save me some manuel reset, while waiting in garage until the battle finishes.

 

from gui.ClientUpdateManager import g_clientUpdateManager

_STAT_DIFF_FORMAT = STAT_DIFF_KEY + '.{0:>s}'
CREDITS_DIFF_KEY = _STAT_DIFF_FORMAT.format('credits')

#check when credit changes
def _onCreditsUpdate(self, _):
    self.canReset = True
    self._checkQuestState()
    
def _initListeners(self):
    self.itemsCache.onSyncCompleted += self._onSyncCompleted
    g_playerEvents.onBattleResultsReceived += self._onBattleResultsReceived
    #add the credit change event listener
    g_clientUpdateManager.addCallbacks({CREDITS_DIFF_KEY: self._onCreditsUpdate})

 

Thank you. 😎

 

 

Edited by avogatro
  • Administrator
Posted

Thanks 🙂 Well, compiled with your changes, play with it for a bit, and let me know if this is working correctly, I have no way to verify it. So I need a feedback before re-adding it.

 

mod_wb_pm_autoreset.pyc

 

edit: well I checked it by just loading to garage, game client is crashing instantly.

 

2023-04-10 19:44:28.140: ERROR: [EXCEPTION] (scripts/client/game.py, 183):
Traceback (most recent call last):
  File "scripts/client/game.py", line 150, in init
  File "scripts/client/gui/shared/personality.py", line 388, in init
  File "scripts/client/gui/mods/__init__.py", line 19, in init
  File "scripts/client/gui/mods/__init__.py", line 67, in _findValidMODs
  File "scripts/common/Lib/importlib/__init__.py", line 37, in import_module
  File "mod_wb_pm_autoreset.py", line 15, in <module>
NameError: name 'STAT_DIFF_KEY' is not defined
 

Here version without your changed listener thing. Too bad you didn't post whole code with applies changes, would be easier 😉

 

mod_wb_pm_autoreset.pyc

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.