-
Posts
170 -
Joined
-
Last visited
-
Days Won
1
DKRUBEN last won the day on April 30 2019
DKRUBEN had the most liked content!
Reputation
19 NoobAbout DKRUBEN
- Birthday 06/01/1988
Basic information
-
Gender
Не определилось ;)
Contacts
-
Nick
Drift King's
Recent Profile Visitors
-
"Калькулятор эффективности" средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
@Kurzdor can you help to fix battle statistics? no show bugs in log, but don't work @overrideMethod(BattleResultsWindow, 'as_setDataS') def as_setDataS(base, self, data): if not (battleEfficiencyConfig['enabled'] and battleEfficiencyConfig['battleResultsWindow']['enabled']): return base(self, data) def _normalizeString(s): return sub('<.*?>', '', s.replace('\xc2\xa0', '').replace('.', '').replace(',', '')) def _splitArenaStr(s): _s = s.replace(u'\xa0\u2014', '-').replace(u'\u2013', '-') _s = _s.split('-') return _s if (len(_s) == 2) else (s, '') try: common = data['common'] if common['bonusType'] in (ARENA_BONUS_TYPE.EVENT_BATTLES, ARENA_BONUS_TYPE.EPIC_RANDOM, ARENA_BONUS_TYPE.EPIC_RANDOM_TRAINING, ARENA_BONUS_TYPE.EPIC_BATTLE): return base(self, data) offset = 0 if common['bonusType'] != ARENA_BONUS_TYPE.RANKED else RANKED_OFFSET teamDict = data['team1'] statValues = data['personal']['statValues'][0] stunStatus = 'vehWStun' if (len(statValues) > (DEF_RESULTS_LEN + offset)) else 'vehWOStun' #it is complicated to get stun info for vehicle not in battle isWin = common['resultShortStr'] == 'win' arenaStr = _splitArenaStr(common['arenaStr']) mapName = arenaStr[0].strip() battleType = arenaStr[1].strip() for playerDict in teamDict: if playerDict['isSelf']: efficiencyCalculator.registerVInfoData(playerDict['vehicleCD']) break dataIDs = getDataIDs(offset) damageDealt = _normalizeString(statValues[dataIDs['damageDealt']]['value']) spotted = _normalizeString(statValues[dataIDs['spotted']]['value']) kills = _normalizeString(statValues[dataIDs['kills']]['value']).split('/') kills = kills[1] defAndCap = _normalizeString(statValues[dataIDs['defAndCap_' + stunStatus]]['value']).split('/') capture = defAndCap[0] defence = defAndCap[1] calcResult = efficiencyCalculator.calc(int(damageDealt), int(spotted), int(kills), int(defence), int(capture), isWin) WN8, XWN8, EFF, XEFF, XTE, _ = calcResult textFormat = _getL10n(battleEfficiencyConfig['battleResultsWindow']['textFormat']) textFormat = textFormat.replace('{{mapName}}', mapName) textFormat = textFormat.replace('{{battleType}}', battleType) textFormat = textFormat.replace('{{wn8}}', str(WN8)) textFormat = textFormat.replace('{{xwn8}}', str(XWN8)) textFormat = textFormat.replace('{{eff}}', str(EFF)) textFormat = textFormat.replace('{{xeff}}', str(XEFF)) textFormat = textFormat.replace('{{xte}}', str(XTE)) textFormat = textFormat.replace('{{c:wn8}}', _getScaledDynamicColorValue('wn8', XWN8)) textFormat = textFormat.replace('{{c:eff}}', _getScaledDynamicColorValue('eff', XEFF)) textFormat = textFormat.replace('{{c:xte}}', _getScaledDynamicColorValue('x', XTE)) data['common']['arenaStr'] = textFormat except: traceback.print_exc() data['common']['arenaStr'] += ' <font color="#FE0E00">efficiency error!</font>' efficiencyCalculator.reset() return base(self, data) -
battleMessages средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
Updated, if it's possible test the mod. battleMessages.py -
"Калькулятор эффективности" средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
No, but the mistake is that it is unnecessary. That's it. -
"Калькулятор эффективности" средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
-
infoPanel средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
@Kurzdor, thx man. ;) -
infoPanel средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
Same in CT -
infoPanel средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
@ktulho can you help!? After the last update to the EU server (1.24.0.1), it stopped working. ------------------------------------------------------------------------------------------------------- target__blur and target_focus in error! -
infoPanel средствами XVM.
DKRUBEN replied to Kotyarko_O's topic in Components of XVM and Addons (py_macro)
Error in target__blur and target focus -
Now i will be try circles color on minimap. all credits go to PolyacovYury for the core
-
fixed thx... Now i will be try circles color on minimap.
-
# -*- coding: utf-8 -*- from math import degrees import Event import Keys from Avatar import PlayerAvatar from constants import ARENA_GUI_TYPE from constants import VISIBILITY from frameworks.wulf import WindowLayer from gui import InputHandler from gui.Scaleform.daapi.view.battle.shared.minimap.component import MinimapComponent from gui.Scaleform.daapi.view.battle.shared.minimap.plugins import PersonalEntriesPlugin, ArenaVehiclesPlugin from gui.Scaleform.daapi.view.battle.shared.minimap.settings import CONTAINER_NAME from gui.Scaleform.framework import g_entitiesFactories, ViewSettings, ScopeTemplates from gui.Scaleform.framework.entities.BaseDAAPIComponent import BaseDAAPIComponent from gui.Scaleform.framework.entities.DisposableEntity import EntityState from gui.Scaleform.framework.entities.View import View from gui.Scaleform.framework.managers.loaders import SFViewLoadParams from gui.app_loader.settings import APP_NAME_SPACE from gui.shared.personality import ServicesLocator from helpers import dependency from skeletons.gui.battle_session import IBattleSessionProvider from DriftkingsCore import DriftkingsInterface, Analytics, override, checkKeys BATTLES_RANGE = {ARENA_GUI_TYPE.RANDOM, ARENA_GUI_TYPE.UNKNOWN, ARENA_GUI_TYPE.TRAINING, ARENA_GUI_TYPE.RANKED, ARENA_GUI_TYPE.EPIC_RANDOM, ARENA_GUI_TYPE.EPIC_RANDOM_TRAINING, ARENA_GUI_TYPE.SORTIE_2, ARENA_GUI_TYPE.FORT_BATTLE_2, ARENA_GUI_TYPE.TUTORIAL, ARENA_GUI_TYPE.EPIC_BATTLE, ARENA_GUI_TYPE.MAPBOX} class FlashMinimap(object): def __init__(self): self.setMinimap = Event.Event() self.onUpdate = Event.Event() self.onBattleClosed = Event.Event() self.onBattleLoaded = Event.Event() g_events = FlashMinimap() class MinimapCentredInjector(View): def _populate(self): # noinspection PyProtectedMember super(MinimapCentredInjector, self)._populate() g_events.onBattleClosed += self.destroy def _dispose(self): g_events.onBattleClosed -= self.destroy # noinspection PyProtectedMember super(MinimapCentredInjector, self)._dispose() def destroy(self): if self.getState() != EntityState.CREATED: return super(MinimapCentredInjector, self).destroy() class MinimapCentredView(BaseDAAPIComponent): def _populate(self): # noinspection PyProtectedMember super(MinimapCentredView, self)._populate() g_events.onBattleClosed += self.destroy # g_events.setMinimap += self.as_minimapCenteredS g_events.onUpdate += self._onUpdate def _dispose(self): g_events.onBattleClosed -= self.destroy g_events.onUpdate -= self._onUpdate # g_events.setMinimap -= self.as_minimapCenteredS # noinspection PyProtectedMember super(MinimapCentredView, self)._dispose() def _onUpdate(self, conf): self.as_minimapCenteredS(conf['minimapZoom'], conf['zoomFactor']) def destroy(self): if self.getState() != EntityState.CREATED: return super(MinimapCentredView, self).destroy() def as_minimapCenteredS(self, enabled, scale): if self._isDAAPIInited(): self.flashObject.as_minimapCentered(enabled, scale) class ConfigInterface(DriftkingsInterface): sessionProvider = dependency.descriptor(IBattleSessionProvider) def __init__(self): self.minimapZoom = False super(ConfigInterface, self).__init__() def init(self): self.ID = '%(mod_ID)s' self.version = '1.1.0 (%(file_compile_date)s)' self.author += '_DKRuben__EU' self.defaultKeys = {'button': [Keys.KEY_LCONTROL]} self.data = { 'enabled': True, 'minimapZoom': True, 'permanentMinimapDeath': False, 'yaw': True, 'showNames': True, 'viewRadius': True, 'zoomFactor': 1.3, 'button': self.defaultKeys['button'] } self.i18n = { 'UI_description': self.ID, 'UI_setting_permanentMinimapDeath_text': 'Permanent Minimap Death', 'UI_setting_permanentMinimapDeath_tooltip': 'Always show the destroyed on the map', 'UI_setting_showNames_text': 'Show Names', 'UI_setting_showNames_tooltip': 'Display the names of destroyed tanks', 'UI_setting_yaw_text': 'Show Hover Angles', 'UI_setting_yaw_tooltip': 'Show Hover Angles on all vehicles where they are', 'UI_setting_viewRadius_text': 'Real View', 'UI_setting_viewRadius_tooltip': 'Remove the limitation of the circle of vision 445m', 'UI_setting_button_text': 'Zoom Button', 'UI_setting_button_tooltip': 'Hot key for zoom.', 'UI_setting_minimapZoom_text': 'Minimap Zoom', 'UI_setting_minimapZoom_tooltip': 'Enlarges the minimap when the key is pressed', } super(ConfigInterface, self).init() def createTemplate(self): return { 'modDisplayName': self.i18n['UI_description'], 'enabled': self.data['enabled'], 'column1': [ self.tb.createControl('permanentMinimapDeath'), self.tb.createControl('showNames'), self.tb.createControl('minimapZoom'), self.tb.createHotKey('button') ], 'column2': [ self.tb.createControl('viewRadius'), self.tb.createControl('yaw') ]} def startBattle(self): InputHandler.g_instance.onKeyDown += self.keyPressed InputHandler.g_instance.onKeyUp += self.keyPressed def endBattle(self): InputHandler.g_instance.onKeyDown -= self.keyPressed InputHandler.g_instance.onKeyUp -= self.keyPressed @property def notEpicBattle(self): return not self.sessionProvider.arenaVisitor.gui.isInEpicRange() @property def xvmInstalled(self): try: import xvm_main return True except ImportError: return False def keyPressed(self, event): if not self.data['enabled']: return isKeyDownTrigger = event.isKeyDown() if event.key in [Keys.KEY_LALT, Keys.KEY_RALT]: if isKeyDownTrigger: self.minimapZoom = True if event.isKeyUp(): self.minimapZoom = False if checkKeys(self.data['button']) and isKeyDownTrigger: g_events.onUpdate(self.data['minimapZoom'], self.data['zoomFactor']) config = ConfigInterface() analytics = Analytics(config.ID, config.version, 'UA-121940539-1') class _PersonalEntriesPlugin(PersonalEntriesPlugin): def start(self): super(_PersonalEntriesPlugin, self).start() if config.data['yaw'] and self.__yawLimits is None: vInfo = self._arenaDP.getVehicleInfo() yawLimits = vInfo.vehicleType.turretYawLimits if yawLimits is not None: self.__yawLimits = (degrees(yawLimits[0]), degrees(yawLimits[1])) def _calcCircularVisionRadius(self): if config.data['viewRadius']: vehAttrs = self.sessionProvider.shared.feedback.getVehicleAttrs() return vehAttrs.get('circularVisionRadius', VISIBILITY.MIN_RADIUS) # noinspection PyProtectedMember return super(_PersonalEntriesPlugin, self)._calcCircularVisionRadius() class _ArenaVehiclesPlugin(ArenaVehiclesPlugin): def __init__(self, *args, **kwargs): super(_ArenaVehiclesPlugin, self).__init__(*args, **kwargs) self.__showDestroyEntries = config.data['permanentMinimapDeath'] self.__isDestroyImmediately = config.data['permanentMinimapDeath'] def _showVehicle(self, vehicleID, location): entry = self._entries[vehicleID] if entry.isAlive(): # noinspection PyProtectedMember super(_ArenaVehiclesPlugin, self)._showVehicle(vehicleID, location) def _hideVehicle(self, entry): if entry.isAlive() and entry.isActive(): # noinspection PyProtectedMember super(_ArenaVehiclesPlugin, self)._hideVehicle(entry) def __setDestroyed(self, vehicleID, entry): self.__clearAoIToFarCallback(vehicleID) if entry.setAlive(False) and not entry.wasSpotted(): entryID = entry.getID() self._setInAoI(entry, True) self.__setActive(entry, True) self._move(entryID, CONTAINER_NAME.DEAD_VEHICLES) self._invoke(entryID, 'setDead', True) self._invoke(entryID, self._showNames) else: self.__setActive(entry, False) @property def _showNames(self): if self.__showDestroyEntries and config.data['showNames']: return 'showVehicleName' return 'hideVehicleName' @override(MinimapComponent, '_setupPlugins') def new_setupPlugins(func, self, arenaVisitor): res = func(self, arenaVisitor) if config.data['showNames'] and config.notEpicBattle and not config.xvmInstalled: if config.data['permanentMinimapDeath']: res['vehicles'] = _ArenaVehiclesPlugin res['personal'] = _PersonalEntriesPlugin return res @override(PlayerAvatar, '_PlayerAvatar__startGUI') def new_startGUI(func, *args): func(*args) config.startBattle() @override(PlayerAvatar, '_PlayerAvatar__destroyGUI') def new_destroyGUI(func, *args): config.endBattle() func(*args) def getViewSettings(): view_settings = [] view_settings.append(ViewSettings('MinimapCentredViewInjector', MinimapCentredInjector, 'MinimapCentred.swf', WindowLayer.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE)) view_settings.append(ViewSettings('MinimapCentredView', MinimapCentredView, None, WindowLayer.UNDEFINED, None, ScopeTemplates.DEFAULT_SCOPE)) return view_settings for item in getViewSettings(): g_entitiesFactories.addSettings(item) def onBattleLoaded(): app = ServicesLocator.appLoader.getApp(APP_NAME_SPACE.SF_BATTLE) if app is None: return app.loadView(SFViewLoadParams('MinimapCentredViewInjector')) g_events.onBattleLoaded += onBattleLoaded what am i doing wrong? I'm lost. please a tip. the flash file is just fine, in python I can't call it.
-
when I try of tanks do not have battles, I get the message in the log saying stats.battleCount does not exist.
-
how to find value 0 in tank stats. python code. def __getAccountDossier(self): dossier = self.itemsCache.items.getAccountDossier().getRandomStats() return dossier def _setValue(itemCD): stats = self.__getAccountDossier().getVehicles().get(intCD) result = float(100.0 * stats.wins / stats.battlesCount if stats.battlesCount else 0) # value sup 0 don't return battlesCount = 0 if stats.battlesCount != 0: return value = '%.2f' % result if result < 100 else '100' value = '%s' % value.rjust(5) self.macro['win'] = '%s%%' % str(value) # internal self.macro['c:win'] = self.getColor('winRate', result) # internal
-
how to get current value, mark on the gun. code. lock here. g_currentVehicle.itemsCache.items.getVehicleDossier(item.intCD)
-
from skeletons.gui.battle_session import IBattleSessionProvider from helpers import dependency def getState(): guiSessionProvider = dependency.descriptor(IBattleSessionProvider) guiSessionProvider.shared.ammo.getGunReloadingState().getTimeLeft()