Wanket 3 Posted June 28, 2016 Как узнать, сколько и каких снарядов в боекомплекте танка во время боя? Облазил все исходники WoT, но не нашел. Наверное плохо искал Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #334792 Posted June 28, 2016 (edited) @Wanket, from gui.battle_control import g_sessionProvider g_sessionProvider.getAmmoCtrl()._AmmoController__ammo # 0.9.15.1: # g_sessionProvider.shared.ammo._AmmoController__ammo Edited June 28, 2016 by ShadowHunterRUS 1 Share this post Link to post Short link Share on other sites
Wanket 3 #334794 Posted June 28, 2016 , AttributeError: 'BattleSessionProvider' object has no attribute 'shared' Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #334795 Posted June 28, 2016 @Wanket, это для 0.9.15.1 Share this post Link to post Short link Share on other sites
Wanket 3 #334800 Posted June 28, 2016 , В итоге вот такой словарь {15402: (25, 0)} Хотя снарядов 25, 15, 2. Мне бы как нибудь получить список всех снарядов Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #334803 Posted June 28, 2016 @Wanket, довольно странно. У меня словарь на 3 элемента. Share this post Link to post Short link Share on other sites
Wanket 3 #334808 Posted June 28, 2016 , Исправил {15402: (25, 0), 15146: (2, 0), 15658: (15, 0)} Тк я пытался получить _AmmoController__ammo когда он только создавался, я получал неполный словарь. time.sleep(5) помог, хоть это немного и костыльно. 2 1 Share this post Link to post Short link Share on other sites
Ekspoint 2,122 #334809 Posted June 28, 2016 (edited) 0.9.15.1 from gui.battle_control import g_sessionProvider totalShots, shotsInClip = g_sessionProvider.shared.ammo.getCurrentShells() 0.9.15.0.1 from gui.battle_control import g_sessionProvider totalShots, shotsInClip = g_sessionProvider.getAmmoCtrl().getCurrentShells() Edited June 28, 2016 by Ekspoint 2 Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #334811 Posted June 28, 2016 (edited) Тк я пытался получить _AmmoController__ammo когда он только создавался, я получал неполный словарь. time.sleep(5) помог, хоть это немного и костыльно.там есть специальные события на обновление этих цифер onShellsAdded, onShellsUpdated, onNextShellChanged, onCurrentShellChanged, onGunReloadTimeSet, onGunReloadTimeSetInPercent from gui.battle_control import g_sessionProvider ammoCtrl = g_sessionProvider.getAmmoCtrl() def _onShellsAdded(intCD, descriptor, quantity, _, gunSettings): print quantity ammoCtrl.onShellsAdded += _onShellsAdded Edited June 28, 2016 by ShadowHunterRUS 1 Share this post Link to post Short link Share on other sites
Wanket 3 #334812 Posted June 28, 2016 (edited) , Правда я так и не понял как подписываться на Events , ammoCtrl.onShellsAdded += _onShellsAdded AttributeError: 'NoneType' object has no attribute 'onShellsAdded' Делаю подписку после загрузки боя UPD: проверяю все в реплеях Edited June 28, 2016 by Wanket Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #334817 Posted June 28, 2016 Делаю подписку после загрузки боярано Share this post Link to post Short link Share on other sites
Wanket 3 #334819 Posted June 28, 2016 (edited) , А когда не рано? Не нашел, где и когда идет присвоение onShellsAdded UPD: Нашел когда. После создания AmmoController Edited June 29, 2016 by Wanket Share this post Link to post Short link Share on other sites