Esempio n. 1
0
def showTracer(base, avatar, shooterID, *args):
    try:
        if settings.zoom[SNIPER.DISABLE_SNIPER] and settings.zoom[
                GLOBAL.ENABLED] and not isReplay():
            if shooterID == avatar.playerVehicleID:
                callback(settings.zoom[SNIPER.DISABLE_LATENCY],
                         lambda: changeControlMode(avatar))
    except Exception as err:
        logError(
            "I can't get out of sniper mode. Error {0}.changeControlMode, {1}".
            format(__package__, err))
    finally:
        return base(avatar, shooterID, *args)
Esempio n. 2
0
 def addToExtendedLog(self, log_dict, settings, vehicle_id,
                      attack_reason_id, damage, shell_type, gold):
     """add or update log item"""
     is_dlog = log_dict is self.damage_log
     if vehicle_id not in log_dict[DAMAGE_LOG.SHOTS]:
         log_dict[DAMAGE_LOG.SHOTS].append(vehicle_id)
     gold, shell_icon_name, shell_type = self.checkShell(
         attack_reason_id, gold, is_dlog, shell_type)
     vehicle = log_dict.setdefault(vehicle_id,
                                   defaultdict(lambda: GLOBAL.CONFIG_ERROR))
     info = self._arenaDP.getVehicleInfo(vehicle_id)
     if vehicle:
         vehicle[DAMAGE_LOG.DAMAGE_LIST].append(damage)
         vehicle[DAMAGE_LOG.TANK_NAMES].add(info.vehicleType.shortName)
     else:
         vehicle[DAMAGE_LOG.INDEX] = len(log_dict[DAMAGE_LOG.SHOTS])
         vehicle[DAMAGE_LOG.DAMAGE_LIST] = [damage]
         vehicle[DAMAGE_LOG.VEHICLE_CLASS] = info.vehicleType.classTag
         vehicle[DAMAGE_LOG.TANK_NAMES] = {info.vehicleType.shortName}
         vehicle[DAMAGE_LOG.ICON_NAME] = info.vehicleType.iconName
         vehicle[DAMAGE_LOG.USER_NAME] = info.player.name
         vehicle[DAMAGE_LOG.TANK_LEVEL] = info.vehicleType.level
         vehicle[DAMAGE_LOG.KILLED_ICON] = GLOBAL.EMPTY_LINE
         vehicle[DAMAGE_LOG.CLASS_ICON] = self.vehicle_icons[
             info.vehicleType.classTag]
         vehicle[DAMAGE_LOG.CLASS_COLOR] = self.vehicle_colors[
             info.vehicleType.classTag]
         vehicle_id = self._player.playerVehicleID if not is_dlog else vehicle_id
         vehicle[DAMAGE_LOG.MAX_HEALTH] = self._arenaDP.getVehicleInfo(
             vehicle_id).vehicleType.maxHealth
     vehicle[DAMAGE_LOG.SHOTS] = len(vehicle[DAMAGE_LOG.DAMAGE_LIST])
     vehicle[DAMAGE_LOG.TOTAL_DAMAGE] = sum(vehicle[DAMAGE_LOG.DAMAGE_LIST])
     vehicle[DAMAGE_LOG.ALL_DAMAGES] = DAMAGE_LOG.COMMA.join(
         str(x) for x in vehicle[DAMAGE_LOG.DAMAGE_LIST])
     vehicle[DAMAGE_LOG.LAST_DAMAGE] = vehicle[DAMAGE_LOG.DAMAGE_LIST][
         GLOBAL.LAST]
     vehicle[DAMAGE_LOG.ATTACK_REASON] = self.settings.log_global[
         DAMAGE_LOG.ATTACK_REASON][ATTACK_REASONS[attack_reason_id]]
     vehicle[DAMAGE_LOG.SHELL_TYPE] = settings[
         DAMAGE_LOG.SHELL_TYPES][shell_type]
     vehicle[DAMAGE_LOG.SHELL_ICON] = settings[
         DAMAGE_LOG.SHELL_ICONS][shell_icon_name]
     vehicle[DAMAGE_LOG.SHELL_COLOR] = settings[DAMAGE_LOG.SHELL_COLOR][
         DAMAGE_LOG.SHELL[gold]]
     vehicle[DAMAGE_LOG.TANK_NAME] = DAMAGE_LOG.LIST_SEPARATOR.join(
         sorted(vehicle[DAMAGE_LOG.TANK_NAMES]))
     percent = float(
         vehicle[DAMAGE_LOG.TOTAL_DAMAGE]) / vehicle[DAMAGE_LOG.MAX_HEALTH]
     vehicle[DAMAGE_LOG.PERCENT_AVG_COLOR] = self.percentToRBG(
         percent, **settings[DAMAGE_LOG.AVG_COLOR])
     callback(0.1, lambda: self.updateExtendedLog(log_dict, settings))
Esempio n. 3
0
def enablePostMortem(base, mode, **kwargs):
    if POSTMORTEM.PARAMS in kwargs:
        kwargs[POSTMORTEM.PARAMS] = (
            mode.camera.angles, settings.arcade_camera[ARCADE.START_DEAD_DIST])
    kwargs[POSTMORTEM.CAM_MATRIX] = mode.camera.camera.matrix
    kwargs[POSTMORTEM.DURATION] = GLOBAL.ONE_SECOND
    if not ((mode._isPostmortemDelayEnabled()
             or bool(kwargs.get('respawn', False)))
            and bool(kwargs.get('bPostmortemDelay'))):
        mode._PostMortemControlMode__postmortemDelay = PostmortemDelay()

        def setDelayDisabled():
            mode._PostMortemControlMode__postmortemDelay = None

        callback(GLOBAL.ONE_SECOND, setDelayDisabled)
    return base(mode, **kwargs)
Esempio n. 4
0
 def eventListener(self, event):
     if event.name == VIEW_ALIAS.LOBBY_HANGAR:
         lobby_page = self._app.containerManager.getContainer(
             WindowLayer.VIEW).getView()
         if lobby_page is not None and lobby_page._isDAAPIInited():
             flash = lobby_page.flashObject
             if hasattr(flash, SWF.ATTRIBUTE_NAME):
                 for comp, enabled in getComponents():
                     if enabled and not lobby_page.isFlashComponentRegistered(
                             comp):
                         flash.as_createBattleObserverComp(comp)
             else:
                 to_format_str = "lobby_page {}, has ho attribute {}"
                 logError(
                     to_format_str.format(repr(flash), SWF.ATTRIBUTE_NAME))
         else:
             callback(0.2, lambda: self.eventListener(event))
Esempio n. 5
0
 def eventListener(self, event):
     battle_page = self._app.containerManager.getViewByKey(
         event.loadParams.viewKey)
     if battle_page is not None and battle_page._isDAAPIInited():
         flash = battle_page.flashObject
         if hasattr(flash, SWF.ATTRIBUTE_NAME):
             for comp in SORTED_ALIASES:
                 if view_settings.getSetting(
                         comp
                 ) and not battle_page.isFlashComponentRegistered(comp):
                     flash.as_createBattleObserverComp(comp)
             flash.as_updateBattleObserverChildIndexes()
         else:
             to_format_str = "battle_page {}, has ho attribute {}"
             logError(to_format_str.format(repr(flash), SWF.ATTRIBUTE_NAME))
     else:
         callback(0.2, lambda: self.eventListener(event))
Esempio n. 6
0
 def startCallback(self, base, header, data):
     self.stopCallback()
     if settings.main[
             PREMIUM.
             PREMIUM_TIME] and header.itemsCache.items.stats.isPremium:
         self.callback = callback(
             1.0, lambda: self.startCallback(base, header, data))
         data["doLabel"] = self._getPremiumLabelText(
             header.itemsCache.items.stats.activePremiumExpiryTime)
     base(header, data)
Esempio n. 7
0
 def timeTicking(self, seconds):
     if seconds > CONSTANTS.ZERO:
         self._callback = callback(
             CONSTANTS.ONE_SECOND,
             lambda: self.timeTicking(seconds - CONSTANTS.ONE))
         self._func_update(seconds)
         if self._play_sound:
             self.callWWISE(self.__soundID)
     else:
         self.stop()
Esempio n. 8
0
 def callbackListener(self, event):
     self._app.as_loadLibrariesS([SWF.LOBBY])
     callback(1.0, lambda: self.eventListener(event))
Esempio n. 9
0
 def update(self):
     self._callback = callback(self._interval, self.update)
     self._function()
Esempio n. 10
0
 def show(self):
     self.as_showS()
     if self.showTimer:
         self._timer.start(self.settings[SIXTH_SENSE.TIME])
     else:
         callback(float(self.settings[SIXTH_SENSE.TIME]), self.as_hideS)
Esempio n. 11
0
 def setTeamBaseCaptured(self, clientID, playerTeam):
     item = self.basesDict.get(clientID, None)
     if item:
         self.as_updateCaptureTextS(item.getColor(),
                                    item.getCapturedString())
         callback(4.0, lambda: self.removeTeamBase(clientID))