Kapany3uk 948 #400000 Posted August 6, 2017 (edited) winsEfficiency = itemsCache.items.getAccountDossier().getRandomStats().getWinsEfficiency() * 100 wrn = round(winsEfficiency, 2) + 0.005 - вероятно опечатка: если 'getWinsEfficiency() * 100', то почему во второй строке '+ 0.005'? (имхо надо писать 0.5) - и если просто округлять wrn то будут ситуации, когда winsEfficiency==wrn из-за особенностей округления 0.5 в питоне. Даже если по факту равенства не будет, то за счет округления до 2 знаков после запятой отображаться могут одинаковые числа... имхо нужно вставлять условие winsEfficiency = itemsCache.items.getAccountDossier().getRandomStats().getWinsEfficiency() * 100 f = winsEfficiency - int(winsEfficiency) if f < 0.5: wrn = int(winsEfficiency) + 0.5 else: wrn = int(winsEfficiency) + 1 Edited August 6, 2017 by Kapany3uk Quote Share this post Link to post Short link Share on other sites
CrazyST 35 #400005 Posted August 6, 2017 (edited) почему во второй строке '+ 0.005'? (имхо надо писать 0.5) потому что меня интересует увеличение отображаемого процента побед на 0,01. так что тут нет опечатки. а вот с округлением действительно беда была. я проверял округление только до целых чисел. и оно работает как математическое. а сейчас проверил для дробных и оказалось что round(x,2) - это уже банковское округление. переделал: ... # wrn = round(winsEfficiency,2) + 0.005 wrn = (round(winsEfficiency*100) + 0.5) / 100 ... # return '( {}{}{:0.2f}% )'.format(int(wn),header,round(wrn,2)) return '( {}{}{:0.2f}% )'.format(int(wn),header,(round(wrn*100))/100) теперь всегда правильно. спасибо. UPD: немного изменил. теперь так текущий процент побед и кол-во поражений/ничьих (4) и побед (9) до изменения процента на 0,01 wrn = (round(winsEfficiency*100) + 0.5) / 100 wn = math.ceil((100 * winsCount - wrn * battlesCount) / (wrn - 100)) wrp = wrn - 0.01 bn = math.ceil(winsCount*100 / wrp - battlesCount) return '( -{} ) {:0.2f}% ( +{} )'.format(int(bn),round(winsEfficiency*100)/100,int(wn)) вот теперь точно как я и хотел :) Edited August 6, 2017 by CrazyST 1 Quote Share this post Link to post Short link Share on other sites
Seki 0 #400091 Posted August 6, 2017 Hi, I'm trying to develop some macros in Python, for hangar and carousel, and i have a question. I read all this topic, very interesting indeed, without finding a solution. I search also in game code source, available on this forum, but this doesn't helped me a lot. How is it possible to access tank stats and data (xp, frags, damages,..) in Python, like in personal tab? Thanks. Quote Share this post Link to post Short link Share on other sites
ktulho 5,780 #400092 Posted August 6, 2017 Hi, I'm trying to develop some macros in Python, for hangar and carousel, and i have a question. I read all this topic, very interesting indeed, without finding a solution. I search also in game code source, available on this forum, but this doesn't helped me a lot. How is it possible to access tank stats and data (xp, frags, damages,..) in Python, like in personal tab? Thanks. Could it help? Quote Share this post Link to post Short link Share on other sites
Seki 0 #400103 Posted August 6, 2017 (edited) Yes, it helped me and i tested it this afertoon, but it's seem that's player stats, not tanks stats. Edit: I would like to retrieve this stats. Edited August 6, 2017 by Seki Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #400108 Posted August 6, 2017 на сколько я понял это данные с сервера XVM, а значит многие из них не актуальны. особенно {{mystat.b}} {{mystat.w}} и т.д. а значит на их основании нельзя посчитать корректное значение "осталось побед до". можно в ангаре как-то получить текущее количество боёв и побед? {{battles}} и {{wins}} в ангаре не работают :( Сделал из текущего досье 2 Quote Share this post Link to post Short link Share on other sites
Kapany3uk 948 #400109 Posted August 6, 2017 Сделал из текущего досье а что с динамической окраской, будет? Quote Share this post Link to post Short link Share on other sites
ktulho 5,780 #400124 Posted August 7, 2017 (edited) Yes, it helped me and i tested it this afertoon, but it's seem that's player stats, not tanks stats. Edit: I would like to retrieve this stats. Пример вывода количество боев для всей техники на которой вы играли: from helpers import dependency from skeletons.gui.shared import IItemsCache from gui.Scaleform.daapi.view.lobby.hangar.Hangar import Hangar from xvm_main.python.logger import * @registerEvent(Hangar, '_Hangar__updateParams') def Hangar__updateParams(self): itemsCache = dependency.instance(IItemsCache) for intCD, dossier in itemsCache.items.getVehicleDossiersIterator(): log('intCD = %s BattlesCount %s' % (intCD, itemsCache.items.getVehicleDossier(intCD).getRandomStats().getBattlesCount())) itemsCache.items.getVehicleDossier(intCD).getBlock() .getClanStats() .getCompactDescriptor() .getCompanyStats() .getDossierDescr() .getDossierType() .getFalloutStats() .getFortBattlesStats() .getFortSortiesStats() .getGlobalMapStats() .getGlobalStats() .getHistoricalStats() .getPlayerDBID() .getRandomStats() .getRankedCurrentSeason() .getRankedStats() .getRated7x7Stats() .getRecordValue() .getTeam7x7Stats() .getTotalStats() itemsCache.items.getVehicleDossier(intCD).getRandomStats().getAchievement() .getAchievements() .getArmorUsingEfficiency() .getAvgDamage() .getAvgDamageAssistedStun() .getAvgDamageBlocked() .getAvgDamageReceived() .getAvgEnemiesSpotted() .getAvgFrags() .getAvgStunNumber() .getAvgXP() .getBattlesCount() .getBattlesCountBefore8_8() .getBattlesCountBefore9_0() .getBattlesCountVer2() .getBattlesCountVer3() .getBattlesCountWithStun() .getCapturePoints() .getDamageAssistedEfficiency() .getDamageAssistedRadio() .getDamageAssistedStun() .getDamageAssistedTrack() .getDamageBlockedByArmor() .getDamageDealt() .getDamageEfficiency() .getDamageReceived() .getDeathsCount() .getDrawsCount() .getDroppedCapturePoints() .getFrags8p() .getFragsCount() .getFragsEfficiency() .getHeHits() .getHeHitsReceived() .getHitsCount() .getHitsEfficiency() .getLossesCount() .getLossesEfficiency() .getMaxDamage() .getMaxFrags() .getMaxXp() .getNearestAchievements() .getNoDamageShotsReceived() .getOriginalXP() .getPierced() .getPiercedReceived() .getPotentialDamageReceived() .getRecord() .getShotsCount() .getShotsReceived() .getSignificantAchievements() .getSpottedEnemiesCount() .getStunNumber() .getSurvivalEfficiency() .getSurvivedBattlesCount() .getTopAchievements() .getWinAndSurvived() .getWinsCount() .getWinsEfficiency() .getXP() .getXpBefore8_8() Edited August 7, 2017 by ktulho Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #400135 Posted August 7, 2017 а что с динамической окраской, будет? готово 1 Quote Share this post Link to post Short link Share on other sites
Seki 0 #400144 Posted August 7, 2017 Пример вывода количество боев для всей техники на которой вы играли: from helpers import dependency from skeletons.gui.shared import IItemsCache from gui.Scaleform.daapi.view.lobby.hangar.Hangar import Hangar from xvm_main.python.logger import * @registerEvent(Hangar, '_Hangar__updateParams') def Hangar__updateParams(self): itemsCache = dependency.instance(IItemsCache) for intCD, dossier in itemsCache.items.getVehicleDossiersIterator(): log('intCD = %s BattlesCount %s' % (intCD, itemsCache.items.getVehicleDossier(intCD).getRandomStats().getBattlesCount())) itemsCache.items.getVehicleDossier(intCD).getBlock() .getClanStats() .getCompactDescriptor() .getCompanyStats() .getDossierDescr() .getDossierType() .getFalloutStats() .getFortBattlesStats() .getFortSortiesStats() .getGlobalMapStats() .getGlobalStats() .getHistoricalStats() .getPlayerDBID() .getRandomStats() .getRankedCurrentSeason() .getRankedStats() .getRated7x7Stats() .getRecordValue() .getTeam7x7Stats() .getTotalStats() itemsCache.items.getVehicleDossier(intCD).getRandomStats().getAchievement() .getAchievements() .getArmorUsingEfficiency() .getAvgDamage() .getAvgDamageAssistedStun() .getAvgDamageBlocked() .getAvgDamageReceived() .getAvgEnemiesSpotted() .getAvgFrags() .getAvgStunNumber() .getAvgXP() .getBattlesCount() .getBattlesCountBefore8_8() .getBattlesCountBefore9_0() .getBattlesCountVer2() .getBattlesCountVer3() .getBattlesCountWithStun() .getCapturePoints() .getDamageAssistedEfficiency() .getDamageAssistedRadio() .getDamageAssistedStun() .getDamageAssistedTrack() .getDamageBlockedByArmor() .getDamageDealt() .getDamageEfficiency() .getDamageReceived() .getDeathsCount() .getDrawsCount() .getDroppedCapturePoints() .getFrags8p() .getFragsCount() .getFragsEfficiency() .getHeHits() .getHeHitsReceived() .getHitsCount() .getHitsEfficiency() .getLossesCount() .getLossesEfficiency() .getMaxDamage() .getMaxFrags() .getMaxXp() .getNearestAchievements() .getNoDamageShotsReceived() .getOriginalXP() .getPierced() .getPiercedReceived() .getPotentialDamageReceived() .getRecord() .getShotsCount() .getShotsReceived() .getSignificantAchievements() .getSpottedEnemiesCount() .getStunNumber() .getSurvivalEfficiency() .getSurvivedBattlesCount() .getTopAchievements() .getWinAndSurvived() .getWinsCount() .getWinsEfficiency() .getXP() .getXpBefore8_8() Thanks, that's what i need! Now, will trying to get stats by tank name or Id. Quote Share this post Link to post Short link Share on other sites
Seki 0 #400188 Posted August 7, 2017 (edited) I found how to get name or ID for tanks in the carousel, with this code: import BigWorld from Avatar import PlayerAvatar from helpers import dependency from skeletons.gui.shared import IItemsCache from gui.Scaleform.daapi.view.lobby.hangar.Hangar import Hangar from xvm_main.python.logger import * from debug_utils import LOG_ERROR from gui.Scaleform.daapi.view.lobby.vehicle_carousel.carousel_data_provider import CarouselDataProvider from gui.shared.utils.requesters import REQ_CRITERIA @registerEvent(Hangar, '_Hangar__updateParams') def Hangar__updateParams(self): itemsCache = dependency.instance(IItemsCache) inventory_vehicles_dict = dict(itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY)) for vehicle in inventory_vehicles_dict.values(): LOG_ERROR('vehicle name: %s' % vehicle.name) LOG_ERROR('vehicle intCD: %s' % vehicle.intCD) Now, how can i get a list of properties for vehicle (like vehicle.name, vehicle.intCD,...)? I tried to use night_dragon_on method https://koreanrandom.com/forum/topic/31856-динамические-макросы-в-python/?p=398696 but this doesn't work. Edit: found this. actionPrcaltPriceammoMaxSizebattleBoosterbattleBoosterLayoutbonusesbuyPricecanNotBeSoldcanSellcanTradeIncanTradeOffchassisclanLockclearCustomStatecrewcrewIndicesdailyXPFactordefaultAltPricedefaultPricedefaultSellPricedescriptorengineeqseqsLayouteventsCachefalloutCtrlfuelTankfullDescriptionfullyConfiguredgetAutoUnlockedItemsgetAutoUnlockedItemsMapgetBonusIcongetBuyPricegetBuyPriceCurrencygetConflictedEquipmentsgetCrewBySkillLevelsgetCrewWithoutSkillgetCustomStategetCustomizedDescriptorgetGUIEmblemIDgetInstalledVehiclesgetParamsgetPerfectCrewgetRentPackagegetRentPackageActionPrcgetSellPriceCurrencygetShortInfogetStategetTargetgetUnlockDescrByIntCDgetUnlocksDescrgetUnlocksDescrsgunhasBattleTurretshasCrewhasEquipmentshasLimitedRestorehasLockModehasModulesToSelecthasOptionalDeviceshasRentPackageshasRestoreCooldownhasShellshasTurretshealthiconiconContouriconSmalliconUniqueiconUniqueLightigrCtrligrCustomizationsLayoutinnationIDintCDintCompactDescrinvIDinventoryCountinventoryIDisAliveisAmmoFullisAutoBattleBoosterEquipisAutoEquipisAutoEquipFullisAutoLoadisAutoLoadFullisAutoRepairisAwaitingBattleisBoughtForCreditsisBrokenisCrewFullisCrewLockedisCustomStateSetisDisabledForBuyisDisabledInPremIGRisDisabledInRoamingisEliteisEventisExcludedFromSandboxisFalloutAvailableisFalloutOnlyisFalloutSelectedisFavoriteisFullyEliteisGroupReadyisHiddenisInBattleisInInventoryisInPrebattleisInUnitisInfiniteRotationGroupisInitiallyUnlockedisInstalledisLockedisObserverisOnlyForEventBattlesisPremiumisPremiumIGRisPreviewAllowedisPurchasedisReadyToFightisReadyToPrebattleisRecentlyRestoredisRemovableisRentAvailableisRentableisRentedisRestoreAvailableisRestorePossibleisRotationAppliedisRotationGroupLockedisSecretisSelectedisSpecialisTelecomisTelecomDealOverisUniqueisUnlockedisUnrecoverableisXPToTmanitemTypeIDitemTypeNameitemsFactorylastCrewlevellobbyContextlocklongUserNamemaxRentDurationmayInstallmayObtainForMoneymayObtainWithMoneyExchangemayPurchasemayPurchaseWithExchangemayRemovemayRentmayRestoremayRestoreWithExchangeminRentDurationminRentPricemodelStatenamenationIDnationNameoptDevicesradiorentCompensationrentExpiryStaterentExpiryTimerentInforentLeftBattlesrentLeftTimerentPackagesrentalIsActiverentalIsOverrepairCostrestoreInforestorePricerotationBattlesLeftrotationGroupIdxrotationGroupNumsearchableUserNamesellActionPrcsellForGoldsellPricesetCustomStatesettingsshellsshellsLayoutIdxshortDescriptionshortUserNamestrCDstrCompactDescrtagstradeOffPricetradeOffPriceFactorturrettypetypeOfLockingArenatypeUserNameuserNameuserTypexp Edited August 8, 2017 by Seki Quote Share this post Link to post Short link Share on other sites
Kapany3uk 948 #400388 Posted August 10, 2017 готово аналогично )) запилил тему "Виджет "Статистика игрока" в ангаре" 2 Quote Share this post Link to post Short link Share on other sites
HEKPOMAHT 2,158 #400533 Posted August 12, 2017 Всем привет. Подскажите, может кто знает: для получения "Основного калибра" нельзя задевать союзников прямыми выстрелами. Труп союзника тоже нельзя задевать? На данный момент при попадание в труп союзника mainGun в голубой цвет окрашивается. Quote Share this post Link to post Short link Share on other sites
ktulho 5,780 #400545 Posted August 12, 2017 Подскажите, может кто знает: для получения "Основного калибра" нельзя задевать союзников прямыми выстрелами. Труп союзника тоже нельзя задевать? На данный момент при попадание в труп союзника mainGun в голубой цвет окрашивается. , запулил исправление. 1 Quote Share this post Link to post Short link Share on other sites
night_dragon_on 5,601 #400626 Posted August 13, 2017 (edited) В 13.08.2017 в 17:25, Okxa сказал: Is there a way to make this per config, like use one config for videos and other for gameplay В 13.08.2017 в 15:36, Okxa сказал: What are the current ID:s for these: 1. The messages when module or crew takes damage, located over ammo and consumables. Old keys: vehicleErrorsPanel and vehicleMessagesPanel 2. Kill log, (frag log, kill feed?) -used to be: playerMessangersPanel I need to know them to set them invisible for videos. Script: setttingsForReplay.zip To run the script, you need to add the configuration to your config file "battle.xc": "battle": { "setttingsForReplay": true, Disabled: vehicleErrorsPanel vehicleMessagesPanel playerMessangersPanel Edited March 5, 2018 by night_dragon_on Quote Share this post Link to post Short link Share on other sites
CrazyST 35 #400953 Posted August 17, 2017 ребят, чего-то я совсем туплю... есть {{mystat.ts}}. он возвращает timestamp. а как из него получить нормальные дату и время? Quote Share this post Link to post Short link Share on other sites
HEKPOMAHT 2,158 #400970 Posted August 17, 2017 ребят, чего-то я совсем туплю... есть {{mystat.ts}}. он возвращает timestamp. а как из него получить нормальные дату и время? вот тема с датой Quote Share this post Link to post Short link Share on other sites
CrazyST 35 #400974 Posted August 17, 2017 вот тема с датой да, но там рассматривается формат текущей даты, а мне нужен именно перевод из timestamp Quote Share this post Link to post Short link Share on other sites
Seki 0 #401123 Posted August 18, 2017 (edited) I wrote this code for testing some stuff: #! /usr/bin/env Python # -*- coding: utf-8 -*- ############################# # Addons for XVM carousel by Ikes ############################# ############################# # Imports # Imports - WoT import BigWorld from helpers import dependency from skeletons.gui.shared import IItemsCache from gui.Scaleform.daapi.view.lobby.hangar.Hangar import Hangar from gui.shared.utils.requesters import REQ_CRITERIA # Imports - XVM from xfw import * from xvm_main.python.logger import * # Imports - Other import simplejson import traceback ############################# # Private class VehiclesList: def __init__(self): self.playerName = self.__getPlayerName() log('[TEST] {}'.format(self.playerName) def __getPlayerName(self): return BigWorld.player().name ### def __player_vehicles_list(): itemsCache = dependency.instance(IItemsCache) vehiclesList = dict(itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY)) log('[ADDONS] Vehicles list: {}'.format(vehiclesList.values())) return ############################# # Events # @registerEvent(Hangar, '_Hangar__updateParams') def Hangar__updateParams(self): __player_vehicles_list() log('[ADDONS] Hangar updated' ) vehiclesList2 = VehiclesList() But i have an error in xvm log, and i don't understand why. When i wrote class VehiclesList under Python shell, i have no error and code work fine. Why? 2017-08-18 23:55:34: [ERROR] Traceback (most recent call last): File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 127, in load_macros_lib code = load(file_name) File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 101, in load return parse(source, file_name) File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 91, in parse node = ast.parse(source) File "scripts/common/Lib/ast.py", line 37, in parse File "<unknown>", line 35 def __getPlayerName(self): ^ SyntaxError: invalid syntax Edited August 18, 2017 by Seki Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #401141 Posted August 19, 2017 Missed bracket in log() Quote Share this post Link to post Short link Share on other sites