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. 😎