예제 #1
0
 def __init__(self, section):
     self.section = section
     self.players = {}
     self.listLog = []
     self.countLines = 0
     self.maxCountLines = None
     self.numberLine = 0
     self.S_GROUP_HITS_PLAYER = section + GROUP_HITS_PLAYER
     self.S_ADD_TO_END = section + ADD_TO_END
     self.S_LINES = section + LINES
     self.S_FORMAT_HISTORY = section + FORMAT_HISTORY
     self.S_MOVE_IN_BATTLE = section + MOVE_IN_BATTLE
     self.S_X = section + 'x'
     self.S_Y = section + 'y'
     self._data = None
     if config.get(self.S_MOVE_IN_BATTLE, False):
         _data = userprefs.get('hitLog/log', {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)})
         if section == SECTION_LOG:
             as_callback("hitLog_mouseDown", self.mouse_down)
             as_callback("hitLog_mouseUp", self.mouse_up)
             as_callback("hitLog_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)}
     self.x = _data['x']
     self.y = _data['y']
 def __init__(self, section):
     self.section = section
     self.numberLine = {}
     self.listLog = []
     self.countLines = 0
     self.maxCountLines = None
     # self.numberLine = 0
     self.S_GROUP_HITS_PLAYER = section + GROUP_HITS_PLAYER
     self.S_ADD_TO_END = section + ADD_TO_END
     self.S_LINES = section + LINES
     self.S_FORMAT_HISTORY = section + FORMAT_HISTORY
     self.S_MOVE_IN_BATTLE = section + MOVE_IN_BATTLE
     self.S_X = section + 'x'
     self.S_Y = section + 'y'
     self._data = None
     if config.get(self.S_MOVE_IN_BATTLE, False):
         _data = userprefs.get('assistLog/log', {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)})
         if section == SECTION_LOG:
             as_callback("assistLog_mouseDown", self.mouse_down)
             as_callback("assistLog_mouseUp", self.mouse_up)
             as_callback("assistLog_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X, DEFAULT_X), 'y': config.get(self.S_Y, DEFAULT_Y)}
     self.x = _data['x']
     self.y = _data['y']
예제 #3
0
def get_settings():
    try:
        global last_vehicles_id_arr, equip_settings
        inventory_vehicles_dict = dict(
            g_itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY))
        last_vehicles_id_arr = inventory_vehicles_dict.keys()
        equip_settings = userprefs.get('auto_equip/%s' % player_name)
        if equip_settings is None or 'version' not in equip_settings or equip_settings[
                'version'] != PREF_VERSION:  # no prefs, or old version: get currently installed devices
            if equip_settings is None:
                debug(
                    'xvm_equip: no prefs for %s, get currently installed devices'
                    % player_name)
            else:
                debug(
                    'xvm_equip: old prefs for %s, get currently installed devices'
                    % player_name)
            equip_settings = {'version': PREF_VERSION}
            for vehicle in inventory_vehicles_dict.values():
                installed_devices(vehicle)
            save_settings()
        debug('xvm_equip: got settings: %s' % equip_settings)
        return True
    except Exception, ex:
        equip_settings = None
        err(traceback.format_exc())
        return False
예제 #4
0
def Servers_setServerList(base, self, baseServerList):
    if config.get('login/saveLastServer'):
        if 'server_name' not in self._loginPreferences:
            serverName = userprefs.get('autologin/server', 0)
            for idx, (hostName, friendlyName, csisStatus, peripheryID) in enumerate(baseServerList):
                if serverName == hostName:
                    self._loginPreferences['server_name'] = serverName
                    break
    base(self, baseServerList)
예제 #5
0
def Servers_setServerList(base, self, baseServerList):
    if config.get('login/saveLastServer'):
        if 'server_name' not in self._loginPreferences:
            serverName = userprefs.get('autologin/server', 0)
            for idx, (hostName, friendlyName, csisStatus, peripheryID) in enumerate(baseServerList):
                if serverName == hostName:
                    self._loginPreferences['server_name'] = serverName
                    break
    base(self, baseServerList)
예제 #6
0
def VehicleSelectorPopup_onSelectVehicles(self, items):
    try:
        if len(items) == 1:
            cd = int(items[0])
            vehicle = g_itemsCache.items.getItemByCD(cd)
            if vehicle and vehicle.isInInventory and not (vehicle.isCrewFull or vehicle.isInBattle or vehicle.isLocked):
                if config.get('hangar/enableCrewAutoReturn') and userprefs.get('xvm_crew/auto_prev_crew/%s' % vehicle.invID, True):
                    wg_compat.g_instance.processReturnCrewForVehicleSelectorPopup(vehicle)
    except Exception, ex:
        err(traceback.format_exc())
예제 #7
0
def _ServerSettingsManager_getSection(base, self, section, defaults = None):
    res = base(self, section, defaults)
    if section in (CAROUSEL_FILTER_2, FALLOUT_CAROUSEL_FILTER_2, RANKED_CAROUSEL_FILTER_2):
        try:
            filterData = simplejson.loads(userprefs.get(USERPREFS_CAROUSEL_FILTERS_KEY, '{}'))
            prefs = filterData.get('prefs', [])
        except Exception as ex:
            prefs = []
        res.update({x:int(x in prefs) for x in PREFS.XVM_KEYS})
    return res
예제 #8
0
def VehicleSelectorPopup_onSelectVehicles(self, items):
    try:
        if len(items) == 1:
            cd = int(items[0])
            vehicle = g_itemsCache.items.getItemByCD(cd)
            if vehicle and vehicle.isInInventory and not (vehicle.isCrewFull or vehicle.isInBattle or vehicle.isLocked):
                if config.get('hangar/enableCrewAutoReturn') and userprefs.get('xvm_crew/auto_prev_crew/%s' % vehicle.invID, True):
                    wg_compat.g_instance.processReturnCrewForVehicleSelectorPopup(vehicle)
    except Exception, ex:
        err(traceback.format_exc())
예제 #9
0
def _LobbyHeader__handleFightButtonUpdated(base, self, _):
    base(self, _)
    global _populated
    if _populated:
        if config.get('hangar/restoreBattleType', False):
            if self.prbDispatcher:
                selected = battle_selector_items.getItems().update(self.prbDispatcher.getFunctionalState())
                actionName = selected.getData()
                if actionName != userprefs.get(USERPREFS.BATTLE_TYPE, None):
                    debug('save battle type: ' + actionName)
                    userprefs.set(USERPREFS.BATTLE_TYPE, actionName)
예제 #10
0
def _ServerSettingsManager_getSection(base, self, section, defaults = None):
    res = base(self, section, defaults)
    if section in _SUPPORTED_SECTIONS:
        try:
            filterData = simplejson.loads(userprefs.get(USERPREFS.CAROUSEL_FILTERS, '{}'))
            prefs = filterData.get('prefs', [])
        except Exception as ex:
            err(traceback.format_exc())
            prefs = []
        res.update({x: int(x in prefs) for x in PREFS.XVM_KEYS})
    return res
예제 #11
0
def _ServerSettingsManager_getSection(base, self, section, defaults=None):
    res = base(self, section, defaults)
    if section in (CAROUSEL_FILTER_2, FALLOUT_CAROUSEL_FILTER_2):
        try:
            filterData = simplejson.loads(
                userprefs.get(USERPREFS_CAROUSEL_FILTERS_KEY, '{}'))
            prefs = filterData.get('prefs', [])
        except Exception as ex:
            prefs = []
        res.update({x: int(x in prefs) for x in PREFS.XVM_KEYS})
    return res
예제 #12
0
def VehicleSelectorPopup_onSelectVehicles(self, items):
    try:
        if len(items) == 1:
            cd = int(items[0])
            itemsCache = dependency.instance(IItemsCache)
            vehicle = itemsCache.items.getItemByCD(cd)
            if vehicle and vehicle.isInInventory and not (vehicle.isCrewFull or vehicle.isInBattle or vehicle.isLocked):
                if config.get('hangar/enableCrewAutoReturn'):
                    if userprefs.get(USERPREFS.AUTO_PREV_CREW + str(vehicle.invID), True):
                        wg_compat.g_instance.processReturnCrewForVehicleSelectorPopup(vehicle)
    except Exception, ex:
        err(traceback.format_exc())
예제 #13
0
def _LobbyHeader__handleFightButtonUpdated(base, self, _):
    base(self, _)
    global _populated
    if _populated:
        if config.get('hangar/restoreBattleType', False):
            if self.prbDispatcher:
                selected = battle_selector_items.getItems().update(
                    self.prbDispatcher.getFunctionalState())
                actionName = selected.getData()
                if actionName != userprefs.get(USERPREFS.BATTLE_TYPE, None):
                    debug('save battle type: ' + actionName)
                    userprefs.set(USERPREFS.BATTLE_TYPE, actionName)
예제 #14
0
 def __init__(self, section):
     _Base.__init__(self, section)
     self.strLastHit = ''
     if config.get(self.section + 'moveInBattle'):
         _data = userprefs.get('DamageLog/lastHit', {'x': config.get(section + 'x'), 'y': config.get(section + 'y')})
         as_callback("lastHit_mouseDown", self.mouse_down)
         as_callback("lastHit_mouseUp", self.mouse_up)
         as_callback("lastHit_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(section + 'x'), 'y': config.get(section + 'y')}
     self.x = _data['x']
     self.y = _data['y']
     self.timerLastHit = None
예제 #15
0
 def __init__(self, section):
     _Base.__init__(self, section)
     self.strLastHit = ''
     self.S_FORMAT_LAST_HIT = section + FORMAT_LAST_HIT
     self.S_TIME_DISPLAY_LAST_HIT = section + TIME_DISPLAY_LAST_HIT
     if config.get(self.S_MOVE_IN_BATTLE):
         _data = userprefs.get('damageLog/lastHit', {'x': config.get(self.S_X), 'y': config.get(self.S_Y)})
         as_callback("lastHit_mouseDown", self.mouse_down)
         as_callback("lastHit_mouseUp", self.mouse_up)
         as_callback("lastHit_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X), 'y': config.get(self.S_Y)}
     self.x = _data['x']
     self.y = _data['y']
     self.timerLastHit = None
예제 #16
0
 def __init__(self, section):
     _Base.__init__(self, section)
     self.strLastHit = ''
     self.S_FORMAT_LAST_HIT = section + FORMAT_LAST_HIT
     self.S_TIME_DISPLAY_LAST_HIT = section + TIME_DISPLAY_LAST_HIT
     if config.get(self.S_MOVE_IN_BATTLE):
         _data = userprefs.get('DamageLog/lastHit', {'x': config.get(self.S_X), 'y': config.get(self.S_Y)})
         as_callback("lastHit_mouseDown", self.mouse_down)
         as_callback("lastHit_mouseUp", self.mouse_up)
         as_callback("lastHit_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X), 'y': config.get(self.S_Y)}
     self.x = _data['x']
     self.y = _data['y']
     self.timerLastHit = None
예제 #17
0
 def __init__(self, section):
     _Base.__init__(self, section)
     self.listLog = []
     self.dataLog = {}
     if config.get(section + 'moveInBattle'):
         _data = userprefs.get('DamageLog/dlog', {'x': config.get(section + 'x'), 'y': config.get(section + 'y')})
         if section == 'damageLog/log/':
             as_callback("dLog_mouseDown", self.mouse_down)
             as_callback("dLog_mouseUp", self.mouse_up)
             as_callback("dLog_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(section + 'x'), 'y': config.get(section + 'y')}
     self.x = _data['x']
     self.y = _data['y']
     self.callEvent = True
예제 #18
0
 def __init__(self, section):
     self.dataFire = None
     self.section = section
     self.strLastHit = ''
     self.timerLastHit = None
     self.dictVehicle = {}
     self.shadow = {}
     self._data = None
     _data = userprefs.get('DamageLog/lastHit', {'x': config.get(section + 'x'), 'y': config.get(section + 'y')})
     self.x = _data['x']
     self.y = _data['y']
     as_callback("lastHit_mouseDown", self.mouse_down)
     as_callback("lastHit_mouseUp", self.mouse_up)
     as_callback("lastHit_mouseMove", self.mouse_move)
     if (self.timerLastHit is not None) and self.timerLastHit.isStarted:
         self.timerLastHit.stop()
예제 #19
0
 def setPosition(self, battleType):
     self._data = None
     positon = {
         'x': _config.get(self.S_X, self.DEFAULT_X),
         'y': _config.get(self.S_Y, self.DEFAULT_Y)
     }
     if _config.get(self.S_MOVE_IN_BATTLE, False):
         _data = userprefs.get(
             HIT_LOG_SECTIONS.LOG + '{}'.format(battleType), positon)
         as_callback("hitLog_mouseDown", self.mouse_down)
         as_callback("hitLog_mouseUp", self.mouse_up)
         as_callback("hitLog_mouseMove", self.mouse_move)
     else:
         _data = positon
     self.x = _data['x']
     self.y = _data['y']
예제 #20
0
 def __init__(self, section):
     self.section = section
     self.strLastHit = ''
     self.dictVehicle = {}
     self.shadow = {}
     self._data = None
     if config.get('damageLog/saveLocationInBattle'):
         _data = userprefs.get('DamageLog/lastHit', {'x': config.get(section + 'x'), 'y': config.get(section + 'y')})
     else:
         _data = {'x': config.get(section + 'x'), 'y': config.get(section + 'y')}
     self.x = _data['x']
     self.y = _data['y']
     as_callback("lastHit_mouseDown", self.mouse_down)
     as_callback("lastHit_mouseUp", self.mouse_up)
     as_callback("lastHit_mouseMove", self.mouse_move)
     self.timerLastHit = None
예제 #21
0
 def __init__(self, section):
     self.listLog = []
     self.section = section
     self.sumFireDmg = 0
     self.dataLogFire = None
     self.numberLine = 0
     self.dictVehicle = {}
     self.dataLog = {}
     self.shadow = {}
     self._data = None
     _data = userprefs.get('DamageLog/dLog', {'x': config.get(section + 'x'), 'y': config.get(section + 'y')})
     self.x = _data['x']
     self.y = _data['y']
     as_callback("dLog_mouseDown", self.mouse_down)
     as_callback("dLog_mouseUp", self.mouse_up)
     as_callback("dLog_mouseMove", self.mouse_move)
예제 #22
0
 def __init__(self, section):
     _Base.__init__(self, section)
     self.S_FORMAT_HISTORY = section + FORMAT_HISTORY
     self.listLog = []
     self.dataLog = {}
     if config.get(self.S_MOVE_IN_BATTLE):
         _data = userprefs.get('DamageLog/dlog', {'x': config.get(self.S_X), 'y': config.get(self.S_Y)})
         if section == SECTION_LOG:
             as_callback("dLog_mouseDown", self.mouse_down)
             as_callback("dLog_mouseUp", self.mouse_up)
             as_callback("dLog_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X), 'y': config.get(self.S_Y)}
     self.x = _data['x']
     self.y = _data['y']
     self.section = section
     self.callEvent = True
예제 #23
0
def VehicleSelectorPopup_onSelectVehicles(self, items):
    try:
        if len(items) == 1:
            cd = int(items[0])
            itemsCache = dependency.instance(IItemsCache)
            vehicle = itemsCache.items.getItemByCD(cd)
            if vehicle and vehicle.isInInventory and not (vehicle.isCrewFull
                                                          or vehicle.isInBattle
                                                          or vehicle.isLocked):
                if config.get('hangar/enableCrewAutoReturn'):
                    if userprefs.get(
                            USERPREFS.AUTO_PREV_CREW + str(vehicle.invID),
                            True):
                        wg_compat.g_instance.processReturnCrewForVehicleSelectorPopup(
                            vehicle)
    except Exception, ex:
        err(traceback.format_exc())
예제 #24
0
 def __init__(self, section):
     self.listLog = []
     self.section = section
     self.numberLine = 0
     self.dictVehicle = {}
     self.dataLog = {}
     self.shadow = {}
     self._data = None
     if config.get('damageLog/saveLocationInBattle'):
         _data = userprefs.get('DamageLog/dLog', {'x': config.get(section + 'x'), 'y': config.get(section + 'y')})
     else:
         _data = {'x': config.get(section + 'x'), 'y': config.get(section + 'y')}
     self.x = _data['x']
     self.y = _data['y']
     as_callback("dLog_mouseDown", self.mouse_down)
     as_callback("dLog_mouseUp", self.mouse_up)
     as_callback("dLog_mouseMove", self.mouse_move)
예제 #25
0
def _GetSettings():
    try:
        settings = userprefs.get(_PREFS_NAME(), None)
        if settings is None:
            return {}
        else:
            if not isinstance(settings, dict) or 'ver' not in settings:
                raise Exception('Bad settings format')

            # # snippet for format fixing
            # ver = settings['ver']
            # if ver == '3.x.y':
            #     ver = '3.x.z'

            return settings
    except Exception:
        warn(traceback.format_exc())
        _SaveSettings()
    return {}
예제 #26
0
def _GetSettings():
    try:
        settings = userprefs.get(_PREFS_NAME(), None)
        if settings is None:
            return {}
        else:
            if not isinstance(settings, dict) or 'ver' not in settings:
                raise Exception('Bad settings format')

            # # snippet for format fixing
            # ver = settings['ver']
            # if ver == '3.x.y':
            #     ver = '3.x.z'

            return settings
    except Exception:
        warn(traceback.format_exc())
        _SaveSettings()
    return {}
예제 #27
0
 def __init__(self, section):
     _Base.__init__(self, section)
     self.S_FORMAT_HISTORY = section + FORMAT_HISTORY
     self.listLog = []
     self.dataLog = {}
     self.scrollList = []
     if config.get(self.S_MOVE_IN_BATTLE):
         _data = userprefs.get('damageLog/log', {'x': config.get(self.S_X), 'y': config.get(self.S_Y)})
         if section == SECTION_LOG:
             as_callback("damageLog_mouseDown", self.mouse_down)
             as_callback("damageLog_mouseUp", self.mouse_up)
             as_callback("damageLog_mouseMove", self.mouse_move)
     else:
         _data = {'x': config.get(self.S_X), 'y': config.get(self.S_Y)}
     as_callback("damageLog_mouseWheel", self.mouse_wheel)
     self.x = _data['x']
     self.y = _data['y']
     self.section = section
     self.callEvent = True
예제 #28
0
def get_settings():
    try:
        global last_vehicles_id_arr, equip_settings
        inventory_vehicles_dict = dict(g_itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY))
        last_vehicles_id_arr = inventory_vehicles_dict.keys()
        equip_settings = userprefs.get('auto_equip/%s' % player_name)
        if equip_settings is None or 'version' not in equip_settings or equip_settings['version'] != PREF_VERSION: # no prefs, or old version: get currently installed devices
            if equip_settings is None:
                debug('xvm_equip: no prefs for %s, get currently installed devices' % player_name)
            else:
                debug('xvm_equip: old prefs for %s, get currently installed devices' % player_name)
            equip_settings = {'version': PREF_VERSION}
            for vehicle in inventory_vehicles_dict.values():
                installed_devices(vehicle)
            save_settings()
        debug('xvm_equip: got settings: %s' % equip_settings)
        return True
    except Exception, ex:
        equip_settings = None
        err(traceback.format_exc())
        return False
예제 #29
0
def _LobbyHeader_populate(base, self):
    def _restore_battle_type(item):
        if not item.isDisabled() and not item.isSelected():
            debug('restore battle type: ' + item.getData())
            item.select()
        global _populated
        _populated = True

    base(self)

    if config.get('hangar/restoreBattleType', False):
        self._updatePrebattleControls()
        actionName = userprefs.get(USERPREFS.BATTLE_TYPE, None)
        if actionName and actionName in XVM_RESTORE_BATTLE_TYPES:
            items = battle_selector_items.getItems().getItems()
            if actionName in items:
                item = items[actionName]
                BigWorld.callback(0, lambda: _restore_battle_type(item))
                return

    global _populated
    _populated = True
예제 #30
0
def LoginView_populate(base, self):
    # log('LoginView_populate')

    if isReplay():
        base(self)
        return

    if config.get('login/saveLastServer'):
        if self._servers.selectedServerIdx == 0:
            serverName = userprefs.get('autologin/server', 0)
            for idx, value in enumerate(self._servers.serverList):
                if serverName == value['data']:
                    self._servers._selectedServerIdx = idx
                    break

    base(self)

    global firsttime
    if firsttime:
        firsttime = False
        if config.get('login/autologin'):
            BigWorld.callback(0, self.as_doAutoLoginS)
예제 #31
0
def LoginView_populate(base, self):
    # log('LoginView_populate')

    if isReplay():
        base(self)
        return

    if config.get('login/saveLastServer'):
        if self._servers.selectedServerIdx == 0:
            serverName = userprefs.get('autologin/server', 0)

        for idx, value in enumerate(self._servers.serverList):
            if serverName == value['data']:
                self._servers._selectedServerIdx = idx
                break

    base(self)

    global firsttime
    if firsttime:
        firsttime = False
        if config.get('login/autologin'):
            BigWorld.callback(0, self.as_doAutoLoginS)
예제 #32
0
def _LobbyHeader_populate(base, self):

    def _restore_battle_type(item):
        if not item.isDisabled() and not item.isSelected():
            debug('restore battle type: ' + item.getData())
            item.select()
        global _populated
        _populated = True

    base(self)

    if config.get('hangar/restoreBattleType', False):
        self._updatePrebattleControls()
        actionName = userprefs.get(USERPREFS.BATTLE_TYPE, None)
        if actionName and actionName in XVM_RESTORE_BATTLE_TYPES:
            items = battle_selector_items.getItems().getItems()
            if actionName in items:
                item = items[actionName]
                BigWorld.callback(0, lambda:_restore_battle_type(item))
                return

    global _populated
    _populated = True
예제 #33
0
 def changeMode(self, *a, **kw):
     if config.get('hangar/restoreBattleType', False):
         actionName = userprefs.get(self._userpref, None)
         if actionName is not None:
             battle_selector_items.getItems().select(actionName)
예제 #34
0
 def __init__(self):
     self.reserve_cache = userprefs.get('tankcarousel/reserve', [])
예제 #35
0
 def __init__(self):
     self.reserve_cache = userprefs.get("tcarousel.reserve", [])
예제 #36
0
 def __init__(self):
     self.reserve_cache = userprefs.get('tankcarousel/reserve', [])
from xvm_main.python.logger import *
from messenger.proto.bw.ServiceChannelManager import ServiceChannelManager
from connection_mgr import ConnectionManager

startTimeSession = time.time()
countBattle = 0
countFinishedBattle = 0
isReplay = False
winsSession = 0
lossSession = 0
currentServer = None
data = userprefs.get(
    'statistics/data', {
        'countBattleDay': 0,
        'timeDay': 0.0,
        'arenaUniqueID': None,
        'winsSessionDay': 0,
        'lossSessionDay': 0,
        'countFinishedBattleDay': 0,
        'date': 0
    })

REGION_RESET = {'NA': 11, 'EU': 5}

timeRealm = datetime.utcnow() - timedelta(
    hours=REGION_RESET.get(constants.CURRENT_REALM, 0))
if timeRealm.toordinal() == data['date']:
    countBattleDay = data.get('countBattleDay', 0)
    timeDay = data.get('timeDay', 0.0)
    arenaUniqueID = data.get('arenaUniqueID', None)
    winsSessionDay = data.get('winsSessionDay', 0)
    lossSessionDay = data.get('lossSessionDay', 0)