Aydomir Posted July 23, 2015 Share 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 Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share 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 Link to comment Short link Share on other sites More sharing options...
Kornet_WA Posted July 23, 2015 Share Posted July 23, 2015 (edited) Я тут смотрю программистов много стало. кто сможет сделать DebugPanel под мои хотелки? за вознаграждение. Edited July 23, 2015 by Kornet_WA @ Quote Link to comment Short link Share on other sites More sharing options...
Yusha Posted July 23, 2015 Share 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 Link to comment Short link Share on other sites More sharing options...
Kornet_WA Posted July 23, 2015 Share Posted July 23, 2015 @Yusha, может ты для модпака переделаешь DebugPanel. @ Quote Link to comment Short link Share on other sites More sharing options...
Aydomir Posted July 23, 2015 Author Share 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 Link to comment Short link Share on other sites More sharing options...
Yusha Posted July 23, 2015 Share Posted July 23, 2015 (edited) @Yusha, может ты для модпака переделаешь DebugPanel. Что она делает? Какая с нее польза? Если только изменение отображения пинга, то вообще не вижу смысла в таких модах. Отказался 2 патча назад. оооо... еще заметил что мы дико офтопим. Edited July 23, 2015 by Yusha @ Quote Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS @ Quote Link to comment Short link Share on other sites More sharing options...
Aydomir Posted July 23, 2015 Author Share 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 Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS @ Quote Link to comment Short link Share on other sites More sharing options...
Aydomir Posted July 23, 2015 Author Share 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 Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS @ Quote Link to comment Short link Share on other sites More sharing options...
Aydomir Posted July 23, 2015 Author Share 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 Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS @ Quote Link to comment Short link Share on other sites More sharing options...
Aydomir Posted July 23, 2015 Author Share 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 Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS @ Quote Link to comment Short link Share on other sites More sharing options...
Aydomir Posted July 23, 2015 Author Share Posted July 23, 2015 какие ошибки? Код нормально компилируется, но в клиенте не работает. @ Quote Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS @ Quote Link to comment Short link Share on other sites More sharing options...
Aydomir Posted July 23, 2015 Author Share 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 Link to comment Short link Share on other sites More sharing options...
SkepticalFox Posted July 23, 2015 Share Posted July 23, 2015 (edited) del Edited July 24, 2015 by ShadowHunterRUS @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.