def __init__(self):
     prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
     self.__accounts_manager = os.path.join(os.path.dirname(prefsFilePath), 'accounts.manager')
     if not os.path.isfile(self.__accounts_manager):
         self.accounts = []
         self.write_accounts()
     self.renew_accounts()
Example #2
0
    def __init__(self, accountName, space, initRecords = None):
        p = os.path
        prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
        self.__cacheDir = p.join(p.dirname(prefsFilePath), 'tutorial_cache')
        self.__cacheFileName = p.join(self.__cacheDir, '{0:>s}.dat'.format(base64.b32encode('{0:>s};{1:>s}'.format(constants.AUTH_REALM, accountName))))
        self.__space = space
        self.__version = TUTORIAL_VERSION
        self.__wasReset = False
        self.__cache = {space: {'finished': False,
                 'refused': False,
                 'afterBattle': False,
                 'flags': {},
                 'currentChapter': None,
                 'localCtx': None,
                 'playerXPLevel': PLAYER_XP_LEVEL.NEWBIE,
                 'startOnNextLogin': True}}
        self.__read()
        cache = self.__current()
        if initRecords is None:
            initRecords = {}
        for flag, value in initRecords.iteritems():
            if flag in cache and not cache[flag]:
                cache[flag] = value

        return
Example #3
0
def makeFileLocalCachePath(space, tags, fileFormat='.dat'):
    p = os.path
    prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(),
                            'utf-8',
                            errors='ignore')
    dirPath = p.join(p.dirname(prefsFilePath), space)
    try:
        if not os.path.isdir(dirPath):
            os.makedirs(dirPath)
    except:
        LOG_CURRENT_EXCEPTION()
        return ''

    tagsType = type(tags)
    if tagsType is types.TupleType:
        fileName = ';'.join(map(lambda item: str(item), tags))
    elif tagsType in types.StringTypes:
        fileName = tags
    else:
        LOG_ERROR('Type of tags can be string, unicode or tuple', tagsType,
                  tags)
        return ''
    if fileFormat:
        fileFormat = '.{0:>s}'.format(fileFormat)
    else:
        fileFormat = ''
    return p.join(
        dirPath, '{0:>s}{1:>s}'.format(base64.b32encode(fileName), fileFormat))
Example #4
0
    def __init__(self, accountName, space, initRecords=None):
        p = os.path
        prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), "utf-8", errors="ignore")
        self.__cacheDir = p.join(p.dirname(prefsFilePath), "tutorial_cache")
        self.__cacheFileName = p.join(
            self.__cacheDir,
            "{0:>s}.dat".format(base64.b32encode("{0:>s};{1:>s}".format(constants.AUTH_REALM, accountName))),
        )
        self.__space = space
        self.__version = TUTORIAL_VERSION
        self.__wasReset = False
        self.__cache = {
            space: {
                "finished": False,
                "refused": False,
                "afterBattle": False,
                "flags": {},
                "currentChapter": None,
                "localCtx": None,
                "playerXPLevel": PLAYER_XP_LEVEL.NEWBIE,
                "startOnNextLogin": True,
            }
        }
        self.__read()
        cache = self.__current()
        if initRecords is None:
            initRecords = {}
        for flag, value in initRecords.iteritems():
            if flag in cache and not cache[flag]:
                cache[flag] = value

        return
Example #5
0
 def __init__(self, name, workersLimit, queueLimit=threads.INFINITE_QUEUE_SIZE):
     prefsPath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
     self._prefsDirPath = os.path.normpath(os.path.dirname(prefsPath))
     self.__cacheDir = os.path.normpath(os.path.join(self._prefsDirPath, name))
     _expectDir(self.__cacheDir)
     self.__worker = threads.ThreadPool(workersLimit, queueLimit)
     self.__worker.start()
     self.__db = {}
def cacheFileName(accountName, cacheType, cacheName):
    p = os.path
    prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
    cacheDir = p.join(p.dirname(prefsFilePath), cacheType)
    if not os.path.isdir(cacheDir):
        os.makedirs(cacheDir)
    cacheFileName = p.join(cacheDir, base64.b32encode('%s:%s:%s' % (constants.AUTH_REALM, accountName, cacheName)) + '.dat')
    return cacheFileName
Example #7
0
 def __init__(self):
     try:
         self.cache_dir = os.path.join(
             os.path.dirname(unicode(BigWorld.wg_getPreferencesFilePath(), "utf-8", errors="ignore")), "xvm"
         )
         if not os.path.isdir(self.cache_dir):
             os.makedirs(self.cache_dir)
     except Exception:
         err(traceback.format_exc())
Example #8
0
 def __init__(self):
     prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(),
                             'utf-8',
                             errors='ignore')
     self.__accounts_manager = os.path.join(os.path.dirname(prefsFilePath),
                                            'accounts.manager')
     if not os.path.isfile(self.__accounts_manager):
         self.accounts = []
         self.write_accounts()
     self.renew_accounts()
Example #9
0
 def __init__(self):
     try:
         self.cache_dir = os.path.join(
             os.path.dirname(
                 unicode(BigWorld.wg_getPreferencesFilePath(),
                         'utf-8',
                         errors='ignore')), 'xvm')
         if not os.path.isdir(self.cache_dir):
             os.makedirs(self.cache_dir)
     except Exception:
         err(traceback.format_exc())
Example #10
0
def cacheFileName(account, cacheType, cacheName):
    p = os.path
    prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
    cacheDir = p.join(p.dirname(prefsFilePath), cacheType)
    if not os.path.isdir(cacheDir):
        os.makedirs(cacheDir)
    cacheFileName = p.join(cacheDir, base64.b32encode('%s_%s_%s_%s' % (constants.AUTH_REALM,
     account.name,
     account.__class__.__name__,
     cacheName)) + '.dat')
    return cacheFileName
Example #11
0
 def __init__(self):
     prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
     self.__cacheDir = os.path.join(os.path.dirname(prefsFilePath), 'custom_data')
     self.__cacheDir = os.path.normpath(self.__cacheDir)
     self.__mutex = threading.RLock()
     self.__cache = {}
     self.__accessedCache = {}
     self.__processedCache = {}
     self.__written_cache = set()
     self.__db = None
     self.__prepareCache()
     self.__worker = ThreadPool()
     self.__worker.start()
     self.__startTimer()
 def __init__(self):
     prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
     self.__cacheDir = os.path.join(os.path.dirname(prefsFilePath), 'custom_data')
     self.__cacheDir = os.path.normpath(self.__cacheDir)
     self.__mutex = threading.RLock()
     self.__cache = {}
     self.__accessedCache = {}
     self.__processedCache = {}
     self.__written_cache = set()
     self.__db = None
     self.__prepareCache()
     self.__worker = ThreadPool()
     self.__worker.start()
     self.__startTimer()
     return
Example #13
0
 def __init__(self, accountName):
     self.__account = None
     self.__syncController = None
     p = os.path
     prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
     self.__cacheDir = p.join(p.dirname(prefsFilePath), 'dossier_cache')
     self.__cacheFileName = p.join(self.__cacheDir, '%s.dat' % base64.b32encode('%s;%s' % (str(BigWorld.server()), accountName)))
     self.__cache = {}
     self.__maxChangeTime = 0
     self.__version = 0
     self.__ignore = True
     self.__isSynchronizing = False
     self.__syncID = 0
     self.__isFirstSync = True
     self.__readCache()
 def __init__(self, accountName):
     self.__account = None
     self.__syncController = None
     p = os.path
     prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
     self.__cacheDir = p.join(p.dirname(prefsFilePath), 'dossier_cache')
     self.__cacheFileName = p.join(self.__cacheDir, '%s.dat' % base64.b32encode('%s;%s' % (str(BigWorld.server()), accountName)))
     self.__cache = {}
     self.__maxChangeTime = 0
     self.__version = 0
     self.__ignore = True
     self.__isSynchronizing = False
     self.__syncID = 0
     self.__isFirstSync = True
     self.__readCache()
     return
def new__init__(self):
    try:
        Preferences = BigWorld.wg_getPreferencesFilePath()
        if path.isfile(Preferences):
            Custom_data = path.dirname(Preferences) + '/custom_data'
            if path.isdir(Custom_data):
                for name in next(walk(Custom_data))[2]:
                    name = Custom_data + '/' + name
                    if path.isfile(name):
                        if 'icons.bak' in name or 'icons.dir' in name or 'icons.dat' in name:
                            try:
                                remove(name)
                            except:
                                pass
                            else:
                                print '[%s] "emblems_off": cache of icons was deleted successfully!' % __author__
    finally:
        old__init__(self)
Example #16
0
def new_CustomFilesCache__init__(self, *a, **k):
    try:
        Preferences = BigWorld.wg_getPreferencesFilePath()
        if path.isfile(Preferences):
            Custom_data = path.dirname(Preferences) + '/custom_data'
            if path.isdir(Custom_data):
                for name in next(walk(Custom_data))[2]:
                    name = Custom_data + '/' + name
                    if path.isfile(name):
                        for icons_file in ICONS_FILES:
                            if icons_file in name:
                                try:
                                    remove(name)
                                except:
                                    pass
                                else:
                                    print '[%s] "emblems_off": %s was deleted successfully!' % (
                                        __author__, icons_file)
    finally:
        old_CustomFilesCache__init__(self, *a, **k)
Example #17
0
def makeFileLocalCachePath(space, tags):
    p = os.path
    prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
    dirPath = p.join(p.dirname(prefsFilePath), space)
    try:
        if not os.path.isdir(dirPath):
            os.makedirs(dirPath)
    except:
        LOG_CURRENT_EXCEPTION()
        return ''

    tagsType = type(tags)
    if tagsType is types.TupleType:
        fileName = ';'.join(map(lambda item: str(item), tags))
    elif tagsType in types.StringTypes:
        fileName = tags
    else:
        LOG_ERROR('Type of tags can be string, unicode or tuple', tagsType, tags)
        return ''
    return p.join(dirPath, '{0:>s}.dat'.format(base64.b32encode(fileName)))
Example #18
0
    def __init__(self, accountName, space, initRecords = None):
        p = os.path
        prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')
        self.__cacheDir = p.join(p.dirname(prefsFilePath), 'tutorial_cache')
        self.__cacheFileName = p.join(self.__cacheDir, '{0:>s}.dat'.format(base64.b32encode('{0:>s};{1:>s}'.format(str(BigWorld.server()), accountName))))
        self.__space = space
        self.__version = TUTORIAL_VERSION
        self.__cache = {space: {'finished': False,
                 'refused': False,
                 'afterBattle': False,
                 'flags': {},
                 'currentChapter': None,
                 'localCtx': None,
                 'playerXPLevel': PLAYER_XP_LEVEL.NEWBIE}}
        self.__read()
        cache = self.__current()
        if initRecords is None:
            initRecords = {}
        for flag, value in initRecords.iteritems():
            if flag in cache and not cache[flag]:
                cache[flag] = value

        return
Example #19
0
def makeFileLocalCachePath(space, tags, fileFormat=".dat"):
    p = os.path
    prefsFilePath = unicode(BigWorld.wg_getPreferencesFilePath(), "utf-8", errors="ignore")
    dirPath = p.join(p.dirname(prefsFilePath), space)
    try:
        if not os.path.isdir(dirPath):
            os.makedirs(dirPath)
    except:
        LOG_CURRENT_EXCEPTION()
        return ""

    tagsType = type(tags)
    if tagsType is types.TupleType:
        fileName = ";".join(map(lambda item: str(item), tags))
    elif tagsType in types.StringTypes:
        fileName = tags
    else:
        LOG_ERROR("Type of tags can be string, unicode or tuple", tagsType, tags)
        return ""
    if fileFormat:
        fileFormat = ".{0:>s}".format(fileFormat)
    else:
        fileFormat = ""
    return p.join(dirPath, "{0:>s}{1:>s}".format(base64.b32encode(fileName), fileFormat))
Example #20
0
import os
import BigWorld
import Keys

from constants import DEFAULT_LANGUAGE

VIEW_ALIAS = 'modsSettingsApiWindow'
VIEW_SWF = 'modsSettingsWindow.swf'

USER_SETTINGS_PATH = os.path.join('mods', 'configs', 'modsSettingsApi.json')

_preferences_path = os.path.dirname(
    unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore'))
if not os.path.exists(_preferences_path):
    os.makedirs(_preferences_path)

CONFIG_PATH = os.path.join(_preferences_path, 'modsettings.dat')
del _preferences_path

MOD_ICON = 'gui/maps/icons/modsSettingsApi/icon.png'
if DEFAULT_LANGUAGE == 'ru':
    MOD_NAME = 'Настройка модификаций'
    MOD_DESCRIPTION = 'Данная модификация позволяет легко и просто изменять настройки установленных модов.'
    STATE_TOOLTIP = '{HEADER}Включить / Отключить мод{/HEADER}{BODY}Красный индикатор - мод отключен<br>Зелёный индикатор - мод включен{/BODY}'
    POPUP_COLOR = 'ЦВЕТ'
else:
    MOD_NAME = 'Mod configurator'
    MOD_DESCRIPTION = 'This mod allows you to easily configure installed mods.'
    STATE_TOOLTIP = '{HEADER}Enable / Disable mod {/HEADER}{BODY} Red indicator - mod disabled <br> Green indicator - mod enabled{/BODY}'
    POPUP_COLOR = 'COLOR'
import os
import BigWorld
import cPickle
import AccountCommands
import zlib
import base64
from functools import partial
from battle_results_shared import *
from debug_utils import *
BATTLE_RESULTS_VERSION = 1
CACHE_DIR = os.path.join(
    os.path.dirname(
        unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8',
                errors='ignore')), 'battle_results')


class BattleResultsCache(object):
    def __init__(self):
        self.__account = None
        self.__ignore = True
        self.__waiting = False
        clean()
        return

    def onAccountBecomePlayer(self):
        self.__ignore = False
        self.__waiting = False

    def onAccountBecomeNonPlayer(self):
        self.__ignore = True
from account_helpers import BattleResultsCache
from battle_results_shared import *
from debug_utils import *
from threading import Thread
from urlparse import urlparse
from gui.shared.utils.requesters import StatsRequester
from messenger.proto.bw import ServiceChannelManager
from functools import partial
from gui import ClientHangarSpace
from PlayerEvents import g_playerEvents

BATTLE_RESULTS_VERSION = 1
logging = True
CACHE_DIR = os.path.join(
    os.path.dirname(unicode(BigWorld.wg_getPreferencesFilePath(), "utf-8", errors="ignore")), "battle_results"
)
todolist = []


def fetchresult(arenaUniqueID):
    if logging:
        LOG_NOTE("fetchresult:", arenaUniqueID)
    if arenaUniqueID:
        battleResults = load(BigWorld.player().name, arenaUniqueID)
        if battleResults is not None and logging:
            LOG_NOTE("Record found")

        proxy = partial(__onGetResponse, None)
        BigWorld.player()._doCmdInt3(AccountCommands.CMD_REQ_BATTLE_RESULTS, arenaUniqueID, 0, 0, proxy)
    else:
# 2015.11.10 21:31:19 Støední Evropa (bìžný èas)
# Embedded file name: scripts/client_common/shared_utils/account_helpers/BattleResultsCache.py
import os
import BigWorld
import cPickle
import AccountCommands
import zlib
import base64
from functools import partial
from battle_results_shared import *
from constants import IS_DEVELOPMENT
from debug_utils import *
import constants
BATTLE_RESULTS_VERSION = 1
CACHE_DIR = os.path.join(os.path.dirname(unicode(BigWorld.wg_getPreferencesFilePath() if not constants.IS_BOT else '.', 'utf-8', errors='ignore')), 'battle_results')

class BattleResultsCache(object):

    def __init__(self):
        self.__account = None
        self.__ignore = True
        self.__waiting = False
        clean()
        return

    def onAccountBecomePlayer(self):
        self.__ignore = False
        self.__waiting = False

    def onAccountBecomeNonPlayer(self):
        self.__ignore = True
Example #24
0
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client_common/shared_utils/account_helpers/BattleResultsCache.py
import os
import cPickle
import zlib
import base64
from functools import partial
import BigWorld
import AccountCommands
from battle_results_shared import AVATAR_FULL_RESULTS, VEH_PUBLIC_RESULTS, AVATAR_PUBLIC_RESULTS, VEH_FULL_RESULTS, COMMON_RESULTS, VehicleInteractionDetails, PLAYER_INFO
from debug_utils import LOG_CURRENT_EXCEPTION
import constants
BATTLE_RESULTS_VERSION = 1
CACHE_DIR = os.path.join(os.path.dirname(unicode(BigWorld.wg_getPreferencesFilePath() if not constants.IS_BOT else '.', 'utf-8', errors='ignore')), 'battle_results')

class BattleResultsCache(object):

    def __init__(self):
        self.__account = None
        self.__ignore = True
        self.__waiting = False
        clean()
        return

    def onAccountBecomePlayer(self):
        self.__ignore = False
        self.__waiting = False

    def onAccountBecomeNonPlayer(self):
        self.__ignore = True
import os
import BigWorld
import cPickle
import AccountCommands
import zlib
import base64
from functools import partial
from battle_results_shared import *
from debug_utils import *
BATTLE_RESULTS_VERSION = 1
CACHE_DIR = os.path.join(os.path.dirname(unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')), 'battle_results')

class BattleResultsCache(object):

    def __init__(self):
        self.__account = None
        self.__ignore = True
        self.__waiting = False
        clean()
        return

    def onAccountBecomePlayer(self):
        self.__ignore = False
        self.__waiting = False

    def onAccountBecomeNonPlayer(self):
        self.__ignore = True

    def setAccount(self, account):
        self.__account = account
Example #26
0
def getPreferencesFilePath():
    return BigWorld.wg_getPreferencesFilePath()
Example #27
0
                                        XVM_STATS.format(TOKEN=g_UserToken.userToken, DICT=ids), onAsyncReport)
        elif onAsyncReport:
            onAsyncReport(None)
        else:
            self.OnAsyncReports(None)

class _XVMStatisticsEvents(object):
    def __init__(self):
        self.OnStatsAccountBecomePlayer = Event()
        self.OnStatsBattleLoaded        = Event()
        self.OnStatsFullBattleLoaded    = Event()

# Vars .......................................................................

#This is "Wargaming.net\WorldOfTanks\xvm\"-dir from the '_UserPrefs' in "xvm_main\python\userprefs.py"-module
CACHE_PATH = path.dirname(unicode(BigWorld.wg_getPreferencesFilePath(), 'utf-8', errors='ignore')) + '/xvm/' 

g_HomeRegion          = _HomeRegion()
#'token' in "<token>.dat"-file from the cache-folder
g_UserToken           = _UserToken()
g_XVMConsole          = _XVMConsole()
g_XVMStatisticsEvents = _XVMStatisticsEvents()

# Hooks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

from hook_methods import g_overrideLib

@g_overrideLib.registerEvent(PlayerAvatar, '_PlayerAvatar__startGUI')
def new__startGUI(self):
    g_HomeRegion.setAccountDBID(getAvatarDatabaseID())
    IDs = {}