コード例 #1
0
    def getReplyStateForTargetIDAndMarkerType(self, targetID, targetMarkerType):
        if targetMarkerType in self._chatCommands and targetID in self._chatCommands[targetMarkerType]:
            commands = self._chatCommands[targetMarkerType][targetID]
            for commandID, commandData in ((k, commands[k]) for k in reversed(commands)):
                commandName = _ACTIONS.battleChatCommandFromActionID(commandID).name
                if commandName not in BATTLE_CHAT_COMMANDS_BY_NAMES:
                    continue
                hasRepliedTo = avatar_getter.getPlayerVehicleID() in commandData.owners
                if hasRepliedTo:
                    return (ReplyState.CAN_CANCEL_REPLY, commandName)
                if commandName in ONE_SHOT_COMMANDS_TO_REPLIES.keys():
                    return (ReplyState.CAN_CONFIRM, commandName)
                return (ReplyState.CAN_REPLY, commandName)

        playerVehicleID = avatar_getter.getPlayerVehicleID()
        if playerVehicleID in self._chatCommands[targetMarkerType]:
            commands = self._chatCommands[targetMarkerType][playerVehicleID]
            for commandID, commandData in ((k, commands[k]) for k in reversed(commands)):
                if targetID in commandData.owners and self.__delayer.hasDelayedCallbackID(commandData.callbackID):
                    commandName = _ACTIONS.battleChatCommandFromActionID(commandID).name
                    if commandName not in BATTLE_CHAT_COMMANDS_BY_NAMES:
                        continue
                    if commandName in ONE_SHOT_COMMANDS_TO_REPLIES.keys():
                        return (ReplyState.CAN_CONFIRM, commandName)
                    if commandName in COMMAND_RESPONDING_MAPPING.keys():
                        return (ReplyState.CAN_RESPOND, commandName)

        return (ReplyState.NO_REPLY, None)
コード例 #2
0
 def __onActionAddedToMarkerReceived(self, senderID, commandID, markerType, objectID):
     if _ACTIONS.battleChatCommandFromActionID(commandID).name not in BASE_CMD_NAMES:
         return
     if objectID not in self.__markerIDs:
         return
     model = self.__markerIDs[objectID]
     if model:
         if _ACTIONS.battleChatCommandFromActionID(commandID).name in [BATTLE_CHAT_COMMAND_NAMES.ATTACKING_BASE, BATTLE_CHAT_COMMAND_NAMES.DEFENDING_BASE]:
             self.__onReplyFeedbackReceived(objectID, senderID, MarkerType.BASE_MARKER_TYPE, 0, 1)
         else:
             self._invoke(model.getID(), BATTLE_MINIMAP_CONSTS.SET_STATE, BATTLE_MINIMAP_CONSTS.STATE_ATTACK)
コード例 #3
0
 def __skipReplayChat(self, actionID, reqID, args):
     replayCtrl = BattleReplay.g_replayCtrl
     reqVehID = args['int64Arg1']
     if actionID == _ACTIONS.ON_BATTLE_MESSAGE_BROADCAST and not replayCtrl.isAllyToObservedVehicle(reqVehID):
         return True
     else:
         if _ACTIONS.battleChatCommandFromActionID(actionID) is not None:
             if _ACTIONS.battleChatCommandFromActionID(actionID).name in (BATTLE_CHAT_COMMAND_NAMES.ATTACKING_ENEMY_WITH_SPG, BATTLE_CHAT_COMMAND_NAMES.ATTACK_ENEMY):
                 if replayCtrl.isAllyToObservedVehicle(reqVehID):
                     return True
             elif not replayCtrl.isAllyToObservedVehicle(reqVehID):
                 return True
         return False
コード例 #4
0
 def __removeCommandMarkerCB(self, removeCommandID, removeCommandTargetID):
     if _ACTIONS.battleChatCommandFromActionID(removeCommandID) is None:
         _logger.warning('Command with ID %s was not found.', removeCommandID)
         return
     else:
         commandName = _ACTIONS.battleChatCommandFromActionID(removeCommandID).name
         markerType = _COMMAND_NAME_TRANSFORM_MARKER_TYPE[commandName]
         commandData = self._chatCommands.get(markerType, {}).get(removeCommandTargetID, {}).get(removeCommandID, None)
         if not commandData:
             return
         self.__delayer.stopCallback(commandData.callbackID)
         self.__checkTemporarySticky(removeCommandID, removeCommandTargetID)
         self.__tryRemovingCommandFromMarker(removeCommandID, removeCommandTargetID)
         return
コード例 #5
0
 def __notifyReplyCommandUpdate(self, targetID, replierVehicleID, commandID, oldReplyCount, newReplycount):
     commandDesr = _ACTIONS.battleChatCommandFromActionID(commandID)
     if commandDesr is None or commandDesr.name not in _COMMAND_NAME_TRANSFORM_MARKER_TYPE or not self.sessionProvider.shared.feedback:
         return
     else:
         self.sessionProvider.shared.feedback.onReplyToCommand(targetID, replierVehicleID, _COMMAND_NAME_TRANSFORM_MARKER_TYPE[commandDesr.name], oldReplyCount, newReplycount)
         return
コード例 #6
0
 def clearBattleActionCoolDown(self, requestID, actionID):
     command = _ACTIONS.battleChatCommandFromActionID(actionID)
     if command:
         removeList = [ cdData for cdData in self.__battleCmdCooldowns if cdData.reqID == requestID and cdData.cmdID == command.id ]
         if removeList:
             for dataForRemoval in removeList:
                 self.__battleCmdCooldowns.remove(dataForRemoval)
コード例 #7
0
 def __onReplyFeedbackReceived(self, targetID, replierID, markerType,
                               oldReplyCount, newReplyCount):
     if oldReplyCount > newReplyCount:
         return
     else:
         advancedChatCommandData = self.__getAdvancedChatCommandData(
             targetID, markerType)
         if advancedChatCommandData is None or advancedChatCommandData.command is None:
             return
         senderID = self.__getVehicleIDForCmdSender(
             advancedChatCommandData.command)
         if senderID != self.playerVehicleID:
             if self.playerVehicleID not in advancedChatCommandData.owners:
                 return
         commandID = advancedChatCommandData.command.getID()
         soundNotificationReply = _ACTIONS.battleChatCommandFromActionID(
             commandID).soundNotificationReply
         if soundNotificationReply is None or markerType not in self.__customMatrixProviderGetter:
             return
         if targetID == self.playerVehicleID:
             matrixProvider = self.__customMatrixProviderGetter[markerType](
                 None, replierID)
         else:
             matrixProvider = self.__customMatrixProviderGetter[markerType](
                 None, targetID)
         enableVoice = True
         if replierID != self.playerVehicleID and targetID != self.playerVehicleID:
             enableVoice = False
         sentByPlayer = True if replierID == self.playerVehicleID else False
         self.__playSoundNotification(soundNotificationReply,
                                      matrixProvider.translation,
                                      enableVoice, sentByPlayer)
         return
コード例 #8
0
 def __onCommandReceived(self, cmd):
     if not self.__isCalloutEnabled or not self.__isIBCEnabled:
         return
     else:
         vehicleIDToAnswer = self.sessionProvider.getArenaDP(
         ).getVehIDBySessionID(cmd.getSenderID())
         commandName = _ACTIONS.battleChatCommandFromActionID(
             cmd.getID()).name
         if self.__isActive is True and vehicleIDToAnswer == avatar_getter.getPlayerVehicleID(
         ) and self.__commandReceivedData is not None and self.__commandReceivedData.name is not None and commandName == _CALLOUT_COMMANDS_TO_REPLY_COMMANDS[
                 self.__commandReceivedData.name]:
             self.__executeHide(True, self.__commandReceivedData.name)
         if commandName not in _CALLOUT_COMMANDS_TO_REPLY_COMMANDS.keys():
             return
         if cmd.isReceiver():
             currentTime = BigWorld.serverTime()
             isCalloutBlocked = currentTime < self.__lastCalloutTimestamp
             hasRecentPersonalMsg = currentTime < self.__lastPersonalMsgTimestamp
             if self.__isActive is False and not isCalloutBlocked and not hasRecentPersonalMsg:
                 self.__commandReceivedData = CommandReceivedData(
                     commandName, vehicleIDToAnswer)
                 if self.__ui:
                     self.__ui.setShowData(vehicleIDToAnswer, commandName)
                     self.__isActive = True
                     self.delayCallback(_HINT_TIMEOUT, self.__executeHide)
                 self.__lastCalloutTimestamp = currentTime + _CALLOUT_MESSAGES_BLOCK_DURATION
                 CalloutController.fireCalloutDisplayEvent(True)
             if cmd.isPrivate() and not hasRecentPersonalMsg:
                 self.__lastPersonalMsgTimestamp = currentTime + _PERSONAL_MESSAGE_MUTE_DURATION
         return
コード例 #9
0
def createCoolDownError(actionID):
    command = _ACTIONS.adminChatCommandFromActionID(actionID)
    if command:
        return _AdminCommandCoolDownError()
    command = _ACTIONS.battleChatCommandFromActionID(actionID)
    if command:
        return _BattleCommandCoolDownError(command)
    if _ACTIONS.isRateLimitedBroadcastFromClient(actionID):
        coolDown = _LIMITS.BROADCASTS_FROM_CLIENT_COOLDOWN_SEC
    elif actionID == _ACTIONS.FIND_USERS_BY_NAME:
        coolDown = _LIMITS.FIND_USERS_BY_NAME_REQUEST_COOLDOWN_SEC
    elif actionID == _ACTIONS.GET_VOIP_CREDENTIALS:
        coolDown = _LIMITS.VOIP_CREDENTIALS_REQUEST_COOLDOWN_SEC
    else:
        coolDown = None
    return _ActionCoolDownError(actionID, coolDown)
コード例 #10
0
 def __onStaticMarkerAdded(self,
                           areaID,
                           creatorID,
                           position,
                           markerSymbolName,
                           markerText='',
                           numberOfReplies=0,
                           isTargetForPlayer=False):
     originalCmdId = self.__getOriginalCommandID(
         areaID, MarkerType.LOCATION_MARKER_TYPE)
     if originalCmdId <= 0:
         return
     else:
         command = _ACTIONS.battleChatCommandFromActionID(originalCmdId)
         if not command:
             return
         notification = command.soundNotification
         if notification is None:
             return
         matrixProvider = self.__createMatrix(position)
         sentByPlayer = creatorID in (
             self.playerVehicleID,
             self.sessionProvider.arenaVisitor.getArenaUniqueID())
         self.__playSoundNotification(notification,
                                      matrixProvider.translation, True,
                                      sentByPlayer)
         return
コード例 #11
0
    def __removeReplyContributionFromPlayer(self, replierVehID, newTargetType, newTargetID):
        updatedCommand = None
        checkForRemovalOfCommandFromMarker = False
        for markerType in self._chatCommands:
            for targetID in self._chatCommands[markerType]:
                for commandID, commandData in self._chatCommands[markerType][targetID].iteritems():
                    isSameCommand = targetID == newTargetID and newTargetType == markerType
                    if not isSameCommand and replierVehID in commandData.owners:
                        oldOwnerCount = len(commandData.owners)
                        self.__chatCommandsUpdated(markerType, targetID, commandID, replierVehID, ChatCommandChange.CHAT_CMD_WAS_REMOVED)
                        commandData.owners.remove(replierVehID)
                        updatedCommand = (commandID, targetID)
                        self.__notifyReplyCommandUpdate(targetID, replierVehID, commandID, oldOwnerCount, len(commandData.owners))
                        if not commandData.owners and not commandData.command.isServerCommand():
                            checkForRemovalOfCommandFromMarker = True
                        break

        if updatedCommand is not None:
            cmdID, cmdTargetID = updatedCommand
            commandName = _ACTIONS.battleChatCommandFromActionID(cmdID).name
            if replierVehID == avatar_getter.getPlayerVehicleID() and self.__markerInFocus and self.__markerInFocus.isFocused(cmdTargetID, _COMMAND_NAME_TRANSFORM_MARKER_TYPE[commandName]):
                self.__setFocusedOnMarker(-1, MarkerType.INVALID_MARKER_TYPE, -1)
            if checkForRemovalOfCommandFromMarker:
                self.__tryRemovingCommandFromMarker(cmdID, cmdTargetID, commandName in AUTOCOMMIT_COMMAND_NAMES)
        return
コード例 #12
0
 def __onStaticMarkerAdded(self,
                           areaID,
                           creatorID,
                           position,
                           markerSymbolName,
                           show3DMarker=False,
                           markerText='',
                           numberOfReplies=0,
                           isTargetForPlayer=False):
     originalCmdId = self.__getOriginalCommandID(
         areaID, MarkerType.LOCATION_MARKER_TYPE)
     if originalCmdId <= 0:
         return
     else:
         command = _ACTIONS.battleChatCommandFromActionID(originalCmdId)
         if not command:
             return
         notification = command.soundNotification
         if notification is None:
             return
         matrixProvider = self.__getMatrixProvider(position)
         sentByPlayer = True if creatorID == self.playerVehicleID else False
         self.__playSoundNotification(notification, None, None,
                                      matrixProvider, True, sentByPlayer)
         return
コード例 #13
0
ファイル: errors.py プロジェクト: Infernux/Projects
def createCoolDownError(actionID):
    command = _ACTIONS.adminChatCommandFromActionID(actionID)
    if command:
        return _AdminCommandCoolDownError()
    command = _ACTIONS.battleChatCommandFromActionID(actionID)
    if command:
        return _BattleCommandCoolDownError(command)
    if _ACTIONS.isRateLimitedBroadcastFromClient(actionID):
        coolDown = _LIMITS.BROADCASTS_FROM_CLIENT_COOLDOWN_SEC
    elif actionID == _ACTIONS.FIND_USERS_BY_NAME:
        coolDown = _LIMITS.FIND_USERS_BY_NAME_REQUEST_COOLDOWN_SEC
    elif actionID == _ACTIONS.GET_VOIP_CREDENTIALS:
        coolDown = _LIMITS.VOIP_CREDENTIALS_REQUEST_COOLDOWN_SEC
    else:
        coolDown = None
    return _ActionCoolDownError(actionID, coolDown)
コード例 #14
0
 def __handleRegularCommand(self, cmd):
     cmdID = cmd.getID()
     cmdName = _ACTIONS.battleChatCommandFromActionID(cmdID).name
     cmdCreatorID = self.__getCommandCreatorVehID(cmd)
     cmdTargetID = self.__getTargetIDForCommandName(cmdName, cmd)
     cmdDuration = _DEFAULT_ACTIVE_COMMAND_TIME if cmdName != BATTLE_CHAT_COMMAND_NAMES.SPG_AIM_AREA else _DEFAULT_SPG_AREA_COMMAND_TIME
     markerType = _COMMAND_NAME_TRANSFORM_MARKER_TYPE[cmdName]
     if markerType in self._chatCommands and cmdTargetID in self._chatCommands[markerType] and cmdID in self._chatCommands[markerType][cmdTargetID]:
         if cmdName in AUTOCOMMIT_COMMAND_NAMES:
             self.__addReplyToCommandList(cmdCreatorID, cmdTargetID, cmdID)
         return
     if cmdName == BATTLE_CHAT_COMMAND_NAMES.SUPPORTING_ALLY and MarkerType.VEHICLE_MARKER_TYPE in self._chatCommands and cmdTargetID in self._chatCommands[MarkerType.VEHICLE_MARKER_TYPE]:
         activeCommandIDOnTarget = self._chatCommands[MarkerType.VEHICLE_MARKER_TYPE][cmdTargetID].keys()
         helpCommandID = BATTLE_CHAT_COMMANDS_BY_NAMES[BATTLE_CHAT_COMMAND_NAMES.HELPME].id
         sosCommandID = BATTLE_CHAT_COMMANDS_BY_NAMES[BATTLE_CHAT_COMMAND_NAMES.SOS].id
         if helpCommandID in activeCommandIDOnTarget or sosCommandID in activeCommandIDOnTarget:
             activeHelpID = helpCommandID if helpCommandID in activeCommandIDOnTarget else sosCommandID
             self.__tryRemovingCommandFromMarker(activeHelpID, cmdTargetID)
             self.__addCommandToList(cmdID, cmdName, cmdCreatorID, cmdTargetID, cmd, cmdDuration)
         elif cmdID in activeCommandIDOnTarget:
             self.__addReplyToCommandList(cmdCreatorID, cmdTargetID, cmdID)
     elif cmdName not in (BATTLE_CHAT_COMMAND_NAMES.CONFIRM, BATTLE_CHAT_COMMAND_NAMES.POSITIVE):
         self.__addCommandToList(cmdID, cmdName, cmdCreatorID, cmdTargetID, cmd, cmdDuration)
     if cmd.isLocationRelatedCommand():
         self.__handleMark3DPosition(cmdTargetID, cmdCreatorID, cmdID, cmdName, cmdDuration, cmd)
     elif cmd.isBaseRelatedCommand():
         self.__handleBaseCommand(cmdName, cmdCreatorID, cmdID, cmdTargetID)
     elif cmd.isVehicleRelatedCommand():
         self.__handleVehicleCommand(cmdTargetID, cmdCreatorID, cmdID, cmd)
     elif cmd.isMarkedObjective():
         self.__handleObjectiveCommand(cmdName, cmdCreatorID, cmd)
コード例 #15
0
 def getCommandText(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     if not command:
         LOG_ERROR('Command is not found', self._commandID)
         return u''
     else:
         i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgText)
         i18nArguments = {}
         if i18nKey is not None:
             if self.isOnMinimap():
                 if self.isSPGAimCommand():
                     reloadTime = self._protoData['floatArg1']
                     if reloadTime > 0:
                         i18nArguments['reloadTime'] = reloadTime
                         i18nKey += '_reloading'
             elif self.hasTarget():
                 i18nArguments['target'] = self._getTarget()
                 if self.isSPGAimCommand():
                     reloadTime = self._protoData['floatArg1']
                     if reloadTime > 0:
                         i18nArguments['reloadTime'] = reloadTime
                         i18nKey += '_reloading'
             elif self.isBaseRelatedCommand():
                 strArg = self._protoData['strArg1']
                 if strArg != '':
                     i18nArguments['strArg1'] = strArg
                     i18nKey += '_numbered'
             else:
                 i18nArguments = self._protoData
             text = i18n.makeString(i18nKey, **i18nArguments)
         else:
             text = command.msgText
         return unicode(text, 'utf-8', errors='ignore')
コード例 #16
0
 def __onVehicleMarkerRemoved(self, vehicleID):
     if self.__markerInFocus is None or not self.sessionProvider.shared.chatCommands:
         return
     else:
         commands = self.sessionProvider.shared.chatCommands
         if self.__markerInFocus.isFocused(vehicleID, MarkerType.VEHICLE_MARKER_TYPE):
             commands.sendCancelReplyChatCommand(self.__markerInFocus.targetID, _ACTIONS.battleChatCommandFromActionID(self.__markerInFocus.commandID).name)
         return
コード例 #17
0
 def messageOnMarker(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgOnMarker)
     if i18nKey is not None:
         text = i18n.makeString(i18nKey)
     else:
         text = command.msgOnMarker
     return unicode(text, 'utf-8', errors='ignore')
コード例 #18
0
ファイル: bw_chat2errors.py プロジェクト: aevitas/wotsdk
def getChatActionName(actionID):
    actionName = _ACTIONS.getActionName(actionID)
    i18nKey = I18N_MESSENGER.chat_action(actionName)
    if i18nKey is not None:
        i18nName = i18n.makeString(i18nKey)
    else:
        i18nName = actionName
    return i18nName
コード例 #19
0
 def _getCommandVehMarker(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     result = ""
     if not command:
         LOG_ERROR("Command is not found", self._commandID)
     elif command.vehMarker is not None:
         result = command.vehMarker
     return result
コード例 #20
0
 def getActionCooldownData(self, actionID):
     command = _ACTIONS.battleChatCommandFromActionID(actionID)
     if command:
         return [
             cdData for cdData in self.__battleCmdCooldowns
             if cdData.cmdID == actionID
         ]
     return []
コード例 #21
0
 def _getCommandVehMarker(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     result = ''
     if not command:
         LOG_ERROR('Command is not found', self._commandID)
     else:
         result = command.vehMarker
     return result
コード例 #22
0
def getChatActionName(actionID):
    actionName = _ACTIONS.getActionName(actionID)
    i18nKey = I18N_MESSENGER.chat_action(actionName)
    if i18nKey is not None:
        i18nName = i18n.makeString(i18nKey)
    else:
        i18nName = actionName
    return i18nName
コード例 #23
0
 def _getCommandSenderVehMarker(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     result = ''
     if not command:
         LOG_ERROR('Command is not found', self._commandID)
     elif command.senderVehMarker is not None:
         result = command.senderVehMarker
     return result
コード例 #24
0
 def setActionCoolDown(self, actionID, coolDown, targetID=0):
     command = _ACTIONS.battleChatCommandFromActionID(actionID)
     if command and command.name not in CHAT_COMMANDS_THAT_IGNORE_COOLDOWNS:
         currTime = BigWorld.time()
         addCoolDowns(currTime, self.__battleCmdCooldowns, command.id,
                      command.name, command.cooldownPeriod, targetID)
     else:
         self.__coolDown.process(actionID, coolDown)
コード例 #25
0
 def isActionInCoolDown(self, actionID):
     command = _ACTIONS.battleChatCommandFromActionID(actionID)
     if command:
         return [
             cdData for cdData in self.__battleCmdCooldowns
             if cdData.cmdID == actionID
         ]
     return self.__coolDown.isInProcess(actionID)
コード例 #26
0
 def __onCommandReceivedAttentionToPositionReply(self, replyToActionName, cmd):
     repliedToActionID = BATTLE_CHAT_COMMANDS_BY_NAMES[replyToActionName].id
     notificationReply = _ACTIONS.battleChatCommandFromActionID(repliedToActionID).soundNotificationReply
     if notificationReply is None:
         _logger.warning('soundNotificationReply is None for replyToActionName %s! - Take a look at messenger_common_chat2.py', replyToActionName)
         return
     else:
         self.__playSoundNotificationOnCommandReceived(cmd, MarkerType.VEHICLE_MARKER_TYPE, True, notificationReply)
         return
コード例 #27
0
 def __isCooldownInProcess(self, actionID, args=None):
     command = _ACTIONS.battleChatCommandFromActionID(actionID)
     if command:
         currTime = BigWorld.time()
         targetID = args['int32Arg1']
         sndrBlockReason = areSenderCooldownsActive(currTime, self.__battleCmdCooldowns, actionID, targetID)
         return command.name not in CHAT_COMMANDS_THAT_IGNORE_COOLDOWNS and sndrBlockReason is not None
     else:
         return self.__coolDown.isInProcess(actionID)
コード例 #28
0
 def __shouldShowErrorMessage(self, actionID, args=None):
     command = _ACTIONS.battleChatCommandFromActionID(actionID)
     if command is None:
         return False
     else:
         currTime = BigWorld.time()
         targetID = args['int32Arg1']
         sndrBlockReason = areSenderCooldownsActive(currTime, self.__battleCmdCooldowns, actionID, targetID)
         return sndrBlockReason.cooldownType != CHAT_COMMAND_COOLDOWN_TYPE_IDS.TIMEFRAME_DATA_COOLDOWN if sndrBlockReason is not None else False
コード例 #29
0
 def __tryRemovingCommandFromMarker(self, commandID, targetID, forceRemove=False):
     if _ACTIONS.battleChatCommandFromActionID(commandID) is None:
         return
     else:
         commandName = _ACTIONS.battleChatCommandFromActionID(commandID).name
         markerType = _COMMAND_NAME_TRANSFORM_MARKER_TYPE[commandName]
         commandData = self._chatCommands[markerType][targetID][commandID]
         if forceRemove or not self.__delayer.hasDelayedCallbackID(commandData.callbackID) and not commandData.owners:
             self.__delayer.stopCallback(commandData.callbackID)
             self._chatCommands[markerType][targetID].pop(commandID)
             wasLastCommandForTarget = not self._chatCommands[markerType][targetID]
             if wasLastCommandForTarget:
                 self._chatCommands[markerType].pop(targetID)
             if wasLastCommandForTarget:
                 feedbackCtrl = self.sessionProvider.shared.feedback
                 if feedbackCtrl:
                     feedbackCtrl.onCommandRemoved(targetID, markerType)
         return
コード例 #30
0
 def TeamChannelController_formatCommand(self, command):
     fmt = ChatColor._TeamChannelController_formatCommand(self, command)
     # LOG_DEBUG('TeamChannelController_formatCommand(%s) using %s => %s' % (command, self._mBuilder, fmt))
     cmd = MESSENGER_ACTION_IDS.battleChatCommandFromActionID(
         command.getID())
     if cmd is not None:
         cmd = dict(cmd_name=cmd.msgText, cmd_id=command.getID())
         # LOG_DEBUG(cmd)
     return (fmt[0], ChatColor.colorize(fmt[1], cmd))
コード例 #31
0
ファイル: errors.py プロジェクト: Infernux/Projects
def createBroadcastError(args, broadcastID):
    errorID = args['int32Arg1']
    assert _ACTIONS.isRateLimitedBroadcastFromClient(broadcastID)
    if errorID == _ERRORS.IN_CHAT_BAN:
        error = _ChatBanError(args['floatArg1'], args['strArg1'])
    elif errorID == _ERRORS.IN_COOLDOWN:
        error = _ActionCoolDownError(broadcastID, _LIMITS.BROADCASTS_FROM_CLIENT_COOLDOWN_SEC)
    else:
        error = _SimpleActionError(broadcastID, errorID)
    return error
コード例 #32
0
def createBroadcastError(args, broadcastID):
    errorID = args['int32Arg1']
    assert _ACTIONS.isRateLimitedBroadcastFromClient(broadcastID)
    if errorID == _ERRORS.IN_CHAT_BAN:
        error = ChatBanError(makeLocalServerTime(args['floatArg1']), args['strArg1'])
    elif errorID == _ERRORS.IN_COOLDOWN:
        error = _ActionCoolDownError(broadcastID, _LIMITS.BROADCASTS_FROM_CLIENT_COOLDOWN_SEC)
    else:
        error = _SimpleActionError(broadcastID, errorID)
    return error
コード例 #33
0
ファイル: bw_chat2errors.py プロジェクト: aevitas/wotsdk
def createBroadcastError(args, broadcastID):
    errorID = args['int32Arg1']
    if not _ACTIONS.isRateLimitedBroadcastFromClient(broadcastID):
        raise AssertionError
        error = errorID == _ERRORS.IN_CHAT_BAN and ChatBanError(makeLocalServerTime(args['floatArg1']), args['strArg1'])
    elif errorID == _ERRORS.IN_COOLDOWN:
        error = _ActionCoolDownError(broadcastID, _LIMITS.BROADCASTS_FROM_CLIENT_COOLDOWN_SEC)
    else:
        error = _SimpleActionError(broadcastID, errorID)
    return error
コード例 #34
0
 def hasNoChatMessage(self):
     if self._commandID == _SUPPORTING_ALLY_ID and (self.isSender()
                                                    or self.isReceiver()):
         return False
     else:
         command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
         if not command:
             LOG_ERROR('Command is not found', self._commandID)
             return False
         return command.msgText is None or self._commandID == _SUPPORTING_ALLY_ID
コード例 #35
0
 def getCommandText(self):
     cmd = _ACTIONS.adminChatCommandFromActionID(self._actionID)
     if not cmd:
         LOG_WARNING('Command is not found', self._actionID)
         return str(self._actionID)
     key = I18N_MESSENGER.command_success(cmd.name)
     if key:
         msg = i18n.makeString(key, **self._protoData)
     else:
         msg = cmd.name
     return unicode(msg, 'utf-8', errors='ignore')
コード例 #36
0
 def __onCommandReceived(self, cmd):
     commandName = _ACTIONS.battleChatCommandFromActionID(cmd.getID()).name
     if commandName in _SKIP_ON_COMMAND_RECEIVED:
         return
     if commandName in self.__customSoundHandler:
         self.__customSoundHandler[commandName](commandName, cmd)
     else:
         markerType = _COMMAND_NAME_TRANSFORM_MARKER_TYPE.get(
             commandName, MarkerType.VEHICLE_MARKER_TYPE)
         self.__playSoundNotificationOnCommandReceived(
             cmd, markerType, True)
コード例 #37
0
 def getCommandText(self):
     cmd = _ACTIONS.adminChatCommandFromActionID(self._actionID)
     if not cmd:
         LOG_WARNING('Command is not found', self._actionID)
         return str(self._actionID)
     key = I18N_MESSENGER.command_success(cmd.name)
     if key:
         msg = i18n.makeString(key, **self._protoData)
     else:
         msg = cmd.name
     return msg
コード例 #38
0
ファイル: battle_chat_cmd.py プロジェクト: kblw/wot_client
 def getCommandText(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     if not command:
         LOG_ERROR('Command is not found', self._commandID)
         return ''
     i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgText)
     if i18nKey is not None:
         if self.isOnMinimap():
             text = i18n.makeString(i18nKey, cellName=self._getCellName())
         elif self.hasTarget():
             text = i18n.makeString(i18nKey, target=self._getTarget())
         else:
             text = i18n.makeString(i18nKey, **self._protoData)
     else:
         text = command.msgText
     return text
コード例 #39
0
ファイル: account.py プロジェクト: webiumsk/WOT0.10.0
 def messenger_onActionByServer_chat2(self, actionID, reqID, args):
     from messenger_common_chat2 import MESSENGER_ACTION_IDS as actions
     LOG_DEBUG('messenger_onActionByServer', actions.getActionName(actionID), reqID, args)
     MessengerEntry.g_instance.protos.BW_CHAT2.onActionReceived(actionID, reqID, args)
コード例 #40
0
ファイル: bw_chat2errors.py プロジェクト: aevitas/wotsdk
 def getName(self):
     return _ACTIONS.getActionName(self.actionID)
コード例 #41
0
ファイル: provider.py プロジェクト: webiumsk/WOT-0.9.15-CT
 def lookupName(self, rqTypeID):
     return _ACTIONS.getActionName(rqTypeID)