Aydomir 1 Posted July 23, 2015 (edited) import BigWorld from notification.NotificationListView import NotificationListView old_populate = NotificationListView._populate def new_populate(self): avgdmg = !!!!!!!! ЗДЕСЬ !!!!!!!! message = { 'typeID': 2, 'message': { 'bgIcon': '', 'defaultIcon': '', 'savedData': 0, 'timestamp': -1, 'filters': [], 'message': 'AvgDmg '+avgdmg, 'type': 'black', 'icon': '', }, 'entityID': 9999, 'auxData': ['GameGreeting'] } old_populate(self) self.as_appendMessageS(message) NotificationListView._populate = new_populate Как вывести средний дамаг аккаунта? avgdmg = !!!!!!!! ЗДЕСЬ !!!!!!!! Edited July 23, 2015 by Aydomir Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284153 Posted July 23, 2015 (edited) avgdmg from gui.shared import g_itemsCache import BigWorld from json import load from urllib import urlopen def getCurrentPlayerId(): # return 2178413 # DEBUG player = BigWorld.player() if hasattr(player, 'databaseID'): return player.databaseID arena = getattr(player, 'arena', None) if arena is not None: vehID = getattr(player, 'playerVehicleID', None) if vehID is not None and vehID in arena.vehicles: return arena.vehicles[vehID]['accountDBID'] return None playerId = getCurrentPlayerId() obj = load(urlopen('http://api.worldoftanks.ru/wot/account/info/?application_id=demo&account_id={0}'.format(playerId))) obj = obj['data'][str(playerId)]['statistics']['all'] avgdmg = round(obj['damage_dealt']/obj['battles'], 1) Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites
Kornet_WA 138 #284160 Posted July 23, 2015 (edited) Я тут смотрю программистов много стало. кто сможет сделать DebugPanel под мои хотелки? за вознаграждение. Edited July 23, 2015 by Kornet_WA Quote Share this post Link to post Short link Share on other sites
Yusha 8 #284185 Posted July 23, 2015 Я тут смотрю программистов много стало. кто сможет сделать DebugPanel под мои хотелки? за вознаграждение. http://www.koreanrandom.com/forum/forum/62-%D0%BE%D0%BF%D0%BB%D0%B0%D1%87%D0%B8%D0%B2%D0%B0%D0%B5%D0%BC%D1%8B%D0%B5-%D0%B7%D0%B0%D0%BA%D0%B0%D0%B7%D1%8B/ 1 Quote Share this post Link to post Short link Share on other sites
Kornet_WA 138 #284210 Posted July 23, 2015 @Yusha, может ты для модпака переделаешь DebugPanel. Quote Share this post Link to post Short link Share on other sites
Aydomir 1 #284213 Posted July 23, 2015 from gui.shared import g_itemsCache import BigWorld from json import load from urllib import urlopen def getPlayerId(): plId = g_itemsCache.items.getAccountDossier().getPlayerDBID() if not plId: plId = BigWorld.player().id return plId playerId = getPlayerId() obj = load(urlopen('http://api.worldoftanks.ru/wot/account/info/?application_id=demo&account_id={0}'.format(playerId))) obj = obj['data'][str(playerId)]['statistics']['all'] avgdmg = round(obj['damage_dealt']/obj['battles'], 1) Не могу делить BTS = str(data['battles']) DMG = round(data['damage_dealt']/BTS, 1) Quote Share this post Link to post Short link Share on other sites
Yusha 8 #284216 Posted July 23, 2015 (edited) @Yusha, может ты для модпака переделаешь DebugPanel. Что она делает? Какая с нее польза? Если только изменение отображения пинга, то вообще не вижу смысла в таких модах. Отказался 2 патча назад. оооо... еще заметил что мы дико офтопим. Edited July 23, 2015 by Yusha Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284222 Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites
Aydomir 1 #284224 Posted July 23, 2015 (edited) вместо str нужно float BTS = float(data['battles']) D = float(data['damage_dealt']) DMG = round(D/BTS, 1) Сейчас делится, но что-то не так. BTS = data['battles'] DMG = data['damage_dealt']/BTS DES = data['frags']/BTS DET = data['spotted']/BTS CAP = data['capture_points']/BTS DEP = data['dropped_capture_points']/BTS WNS = data['wins'] EFF = str((DMG*(10/(6.99+2))*(0.23+2*6.99/100)+DES*250+DET*150+log(CAP+1)/log(1.732)*150+DEF*150)) Edited July 23, 2015 by Aydomir Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284226 Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites
Aydomir 1 #284229 Posted July 23, 2015 int/int=int float/float = float ненавижу за это python2k оберни все в float() Так? BTS = float(data['battles']) DMG = float(data['damage_dealt']/BTS) DES = float(data['frags']/BTS) DET = float(data['spotted']/BTS) CAP = float(data['capture_points']/BTS) DEP = float(data['dropped_capture_points']/BTS) WNS = float(data['wins']) EFF = float((DMG*(10/(6.99+2))*(0.23+2*6.99/100)+DES*250+DET*150+log(CAP+1)/log(1.732)*150+DEF*150)) Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284230 Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites
Aydomir 1 #284232 Posted July 23, 2015 нет. каждую отдельно EFF = (float(DMG)*(10/(6.99+2))*(0.23+2*6.99/100)+float(DES)*250+float(DET)*150+log(float(CAP)+1)/log(1.732)*150+float(DEF)*150) Так? нет. каждую отдельно BTS нужно один раз привести к float BTS = float(data['battles']) DMG = float(data['damage_dealt'])/BTS DES = float(data['frags'])/BTS DET = float(data['spotted'])/BTS CAP = float(data['capture_points'])/BTS DEP = float(data['dropped_capture_points'])/BTS WNS = float(data['wins']) EFF = float((DMG*(10/(6.99+2))*(0.23+2*6.99/100)+DES*250+DET*150+log(CAP+1)/log(1.732)*150+DEF*150)) Ааа точно! А теперь что не так? Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284235 Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites
Aydomir 1 #284236 Posted July 23, 2015 Так BTS = float(data['battles']) DMG = float(data['damage_dealt'])/BTS DES = float(data['frags'])/BTS DET = float(data['spotted'])/BTS CAP = float(data['capture_points'])/BTS DEP = float(data['dropped_capture_points'])/BTS WNS = float(data['wins']) EFF = (DMG*(10/(6.99+2))*(0.23+2*6.99/100)+DES*250+DET*150+log(CAP+1)/log(1.732)*150+DEF*150) Не получается. BTS = float(data['battles']) DMG = float(data['damage_dealt'])/BTS DES = float(data['frags'])/BTS DET = float(data['spotted'])/BTS CAP = float(data['capture_points'])/BTS DEP = float(data['dropped_capture_points'])/BTS WNS = float(data['wins']) EFF = (DMG*(10/(6.99+2))*(0.23+2*6.99/100)+DES*250+DET*150+log(CAP+1)/log(1.732)*150+DEF*150) Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284238 Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites
Aydomir 1 #284239 Posted July 23, 2015 какие ошибки? Код нормально компилируется, но в клиенте не работает. Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284241 Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites
Aydomir 1 #284245 Posted July 23, 2015 (edited) В python.log глянь from math import log BTS = float(data['battles']) D = float(data['damage_dealt'])/BTS FRAGS = float(data['frags'])/BTS SPOT = float(data['spotted'])/BTS CAP = float(data['capture_points'])/BTS DEF = float(data['dropped_capture_points'])/BTS WNS = float(data['wins']) MID = 6.99 EFF = round((D*(10.0/(MID+2))*(0.23+2*MID/100) + (FRAGS*250) + (SPOT*150) + log(CAP+1, 1.732)*150+DEF*150.0), 1)У тебя кривой MID и ошибочный DEF Может в проблема в log? ...+log(CAP+1)/log(1.732)*... Может в проблема в log? ...+log(CAP+1)/log(1.732)*... СПАСИБО! :D ВСЕ ПОЛУЧИЛОСЬ! У меня не было from math import log и DEF не правильный, вы правы. Edited July 23, 2015 by Aydomir Quote Share this post Link to post Short link Share on other sites
SkepticalFox 1,445 #284249 Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS Quote Share this post Link to post Short link Share on other sites