Exemple #1
0
 def _formatMessage(self, message, doFormatting=True):
     dbID = message.accountDBID
     isCurrent = isCurrentPlayer(message.accountDBID)
     if not doFormatting:
         return (isCurrent, message.text)
     return (isCurrent, self._mBuilder.setColors(dbID).setName(
         dbID, message.accountName).setText(message.text).build())
Exemple #2
0
 def _formatMessage(self, message, doFormatting=True):
     avatarSessionID = message.avatarSessionID
     isCurrent = isCurrentPlayer(avatarSessionID)
     return (isCurrent, message.text) if not doFormatting else (
         isCurrent, self._mBuilder.setColors(avatarSessionID).setName(
             avatarSessionID, message.accountName).setText(
                 message.text).build())
 def addCommand(self, command):
     cmdData = command.getProtoData()
     isCurrent = isCurrentPlayer(cmdData.originator)
     text = self._format(cmdData, command.getCommandText())
     if BattleReplay.g_replayCtrl.isRecording:
         BattleReplay.g_replayCtrl.onBattleChatMessage(text, isCurrent)
     if self._view:
         self._view.addMessage(text, isCurrentPlayer=isCurrent)
Exemple #4
0
 def addCommand(self, command):
     cmdData = command.getProtoData()
     isCurrent = isCurrentPlayer(cmdData.originator)
     text = self._format(cmdData, command.getCommandText())
     if BattleReplay.g_replayCtrl.isRecording:
         BattleReplay.g_replayCtrl.onBattleChatMessage(text, isCurrent)
     if self._view:
         self._view.addMessage(text, isCurrentPlayer=isCurrent)
 def _format(self, message):
     group = message.group
     dbID = message.originator
     if CHAT_MEMBER_GROUP.member.index() == group or isCurrentPlayer(dbID):
         key = self.usersStorage.getUserGuiType(dbID)
     else:
         key = CHAT_MEMBER_GROUP[group].name()
     playerName = g_lobbyContext.getPlayerFullName(message.originatorNickName, pDBID=dbID)
     return g_settings.lobby.getMessageFormat(key).format(playerName, TimeFormatter.getMessageTimeFormat(message.time), message.data)
 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme('battle/message').getHexStr('squad')
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('squadman')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     elif g_battleContext.isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr('teamkiller')
     return (pColor, mColor)
Exemple #7
0
 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme('battle/message').getHexStr('squad')
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('squadman')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     elif g_sessionProvider.getCtx().isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr('teamkiller')
     return (pColor, mColor)
 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme("battle/message").getHexStr("squad")
     pColorScheme = g_settings.getColorScheme("battle/player")
     pColor = pColorScheme.getHexStr("squadman")
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr("himself")
     elif g_battleContext.isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr("teamkiller")
     return (pColor, mColor)
Exemple #9
0
 def setColors(self, dbID):
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('squadman')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     elif g_sessionProvider.getCtx().isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr('teamkiller')
     self._ctx['playerColor'] = pColor
     self._ctx['messageColor'] = g_settings.getColorScheme('battle/message').getHexStr('squad')
     return self
 def setColors(self, dbID):
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('squadman')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     elif g_sessionProvider.getCtx().isTeamKiller(accID=dbID):
         pColor = pColorScheme.getHexStr('teamkiller')
     self._ctx['playerColor'] = pColor
     self._ctx['messageColor'] = g_settings.getColorScheme('battle/message').getHexStr('squad')
     return self
 def addMessage(self, message, doFormatting=True):
     isCurrent = isCurrentPlayer(message.originator)
     if doFormatting:
         text = self._format(message, message.data)
     else:
         text = message.data
     if BattleReplay.g_replayCtrl.isRecording:
         BattleReplay.g_replayCtrl.onBattleChatMessage(text, isCurrent)
     if self._view:
         self._view.addMessage(text, isCurrentPlayer=isCurrent)
     return True
Exemple #12
0
 def addMessage(self, message, doFormatting = True):
     isCurrent = isCurrentPlayer(message.originator)
     if doFormatting:
         text = self._format(message, message.data)
     else:
         text = message.data
     if BattleReplay.g_replayCtrl.isRecording:
         BattleReplay.g_replayCtrl.onBattleChatMessage(text, isCurrent)
     if self._view:
         self._view.addMessage(text, isCurrentPlayer=isCurrent)
     return True
 def _format(self, message):
     group = message.group
     dbID = message.originator
     if CHAT_MEMBER_GROUP.member.index() == group or isCurrentPlayer(dbID):
         key = self.usersStorage.getUserGuiType(dbID)
     else:
         key = CHAT_MEMBER_GROUP[group].name()
     playerName = g_lobbyContext.getPlayerFullName(
         message.originatorNickName, pDBID=dbID)
     return g_settings.lobby.getMessageFormat(key).format(
         playerName, TimeFormatter.getMessageTimeFormat(message.time),
         message.data)
Exemple #14
0
 def _format(self, message, doFormatting = True):
     isString = type(message) is types.StringType
     if not doFormatting or isString:
         if isString:
             return message
         return message.data
     group = message.group
     dbID = message.originator
     if CHAT_MEMBER_GROUP.member.index() == group or isCurrentPlayer(dbID):
         self._mBuilder.setGuiType(dbID)
     else:
         self._mBuilder.setGroup(CHAT_MEMBER_GROUP[group].name())
     return self._mBuilder.setName(dbID, message.originatorNickName).setTime(message.time).setText(message.data).build()
 def _format(self, message, doFormatting = True):
     isString = type(message) is types.StringType
     if not doFormatting or isString:
         if isString:
             return message
         return message.data
     group = message.group
     dbID = message.originator
     if CHAT_MEMBER_GROUP.member.index() == group or isCurrentPlayer(dbID):
         self._mBuilder.setGuiType(dbID)
     else:
         self._mBuilder.setGroup(CHAT_MEMBER_GROUP[group].name())
     return self._mBuilder.setName(dbID, message.originatorNickName).setTime(message.time).setText(message.data).build()
 def setColors(self, avatarSessionID):
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('teammate')
     ctx = self.sessionProvider.getCtx()
     if isCurrentPlayer(avatarSessionID):
         pColor = pColorScheme.getHexStr('himself')
     elif ctx.isTeamKiller(avatarSessionID=avatarSessionID):
         pColor = pColorScheme.getHexStr('teamkiller')
     elif ctx.isSquadMan(avatarSessionID=avatarSessionID):
         pColor = pColorScheme.getHexStr('squadman')
     elif ctx.isEnemy(avatarSessionID=avatarSessionID):
         pColor = pColorScheme.getHexStr('enemy')
     self._ctx['playerColor'] = pColor
     self._ctx['messageColor'] = g_settings.getColorScheme(
         'battle/message').getHexStr('team')
     return self
 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme('battle/message').getHexStr('common')
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('unknown')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     else:
         channel = self.channelsStorage.getChannel(self._teamChannel)
         if channel and channel.hasMember(dbID):
             if g_battleContext.isTeamKiller(accID=dbID):
                 pColor = pColorScheme.getHexStr('teamkiller')
             elif g_battleContext.isSquadMan(accID=dbID):
                 pColor = pColorScheme.getHexStr('squadman')
             else:
                 pColor = pColorScheme.getHexStr('teammate')
         elif self._channel.hasMember(dbID):
             pColor = pColorScheme.getHexStr('enemy')
     return (pColor, mColor)
Exemple #18
0
 def setColors(self, dbID):
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('unknown')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     else:
         ctx = g_sessionProvider.getCtx()
         if ctx.isAlly(accID=dbID):
             if ctx.isTeamKiller(accID=dbID):
                 pColor = pColorScheme.getHexStr('teamkiller')
             elif ctx.isSquadMan(accID=dbID):
                 pColor = pColorScheme.getHexStr('squadman')
             else:
                 pColor = pColorScheme.getHexStr('teammate')
         elif ctx.isEnemy(accID=dbID):
             pColor = pColorScheme.getHexStr('enemy')
     self._ctx['playerColor'] = pColor
     self._ctx['messageColor'] = g_settings.getColorScheme('battle/message').getHexStr('common')
     return self
 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme("battle/message").getHexStr("common")
     pColorScheme = g_settings.getColorScheme("battle/player")
     pColor = pColorScheme.getHexStr("unknown")
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr("himself")
     else:
         channel = self.channelsStorage.getChannel(self._teamChannel)
         if channel and channel.hasMember(dbID):
             if g_battleContext.isTeamKiller(accID=dbID):
                 pColor = pColorScheme.getHexStr("teamkiller")
             elif g_battleContext.isSquadMan(accID=dbID):
                 pColor = pColorScheme.getHexStr("squadman")
             else:
                 pColor = pColorScheme.getHexStr("teammate")
         elif self._channel.hasMember(dbID):
             pColor = pColorScheme.getHexStr("enemy")
     return (pColor, mColor)
 def setColors(self, dbID):
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('unknown')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     else:
         ctx = g_sessionProvider.getCtx()
         if ctx.isAlly(accID=dbID):
             if ctx.isTeamKiller(accID=dbID):
                 pColor = pColorScheme.getHexStr('teamkiller')
             elif ctx.isSquadMan(accID=dbID):
                 pColor = pColorScheme.getHexStr('squadman')
             else:
                 pColor = pColorScheme.getHexStr('teammate')
         elif ctx.isEnemy(accID=dbID):
             pColor = pColorScheme.getHexStr('enemy')
     self._ctx['playerColor'] = pColor
     self._ctx['messageColor'] = g_settings.getColorScheme('battle/message').getHexStr('common')
     return self
Exemple #21
0
    def filter(self, senderID, text):
        if isCurrentPlayer(senderID):
            return text
        userHistory = self.__history.get(senderID)
        if userHistory is None:
            userHistory = self.__history[senderID] = []
        currTime = BigWorld.time()
        recentCount = len(userHistory) + 1
        for msgTime, msgText in userHistory:
            if currTime - msgTime > MESSAGE_FLOOD_COOLDOWN:
                recentCount -= 1
            elif text == msgText:
                text = ''
                break

        userHistory.append((currTime, text))
        if recentCount < len(userHistory):
            self.__history[senderID] = userHistory[-recentCount:]
        return text
 def getMessageColors(self, message):
     dbID = message.originator
     mColor = g_settings.getColorScheme('battle/message').getHexStr(
         'common')
     pColorScheme = g_settings.getColorScheme('battle/player')
     pColor = pColorScheme.getHexStr('unknown')
     if isCurrentPlayer(dbID):
         pColor = pColorScheme.getHexStr('himself')
     else:
         channel = self.channelsStorage.getChannel(self._teamChannel)
         if channel and channel.hasMember(dbID):
             if g_battleContext.isTeamKiller(accID=dbID):
                 pColor = pColorScheme.getHexStr('teamkiller')
             elif g_battleContext.isSquadMan(accID=dbID):
                 pColor = pColorScheme.getHexStr('squadman')
             else:
                 pColor = pColorScheme.getHexStr('teammate')
         elif self._channel.hasMember(dbID):
             pColor = pColorScheme.getHexStr('enemy')
     return (pColor, mColor)
    def addMessage(self, message, doFormatting = True):
        isCurrent = isCurrentPlayer(message.originator)
        
        if doFormatting:
            text = self._format(message, message.data)
        else:
            text = message.data

        """
        if testIfEnglish(message.data):
            text = text + " en"
        else:
            text = text + " nonEn"
        """
        
        if testIfEnglish(message.data):
            self._channel.addMessage(text)
            if self._view:
                self._view.addMessage(text, isCurrentPlayer=isCurrent)
            
        if BattleReplay.g_replayCtrl.isRecording:
            BattleReplay.g_replayCtrl.onBattleChatMessage(text, isCurrent)
  
        return True
 def canRevokeInvite(self, invite):
     result = False
     if invite.clientID in self.__invites:
         result = invite.clientID > 0 and invite.isActive() and isCurrentPlayer(invite.creatorID)
     return result
 def isIncoming(self):
     return not isCurrentPlayer(self.ownerID)
Exemple #26
0
 def filter(self, senderID, text):
     self.__currentID = senderID
     self.usersStorage._markAsBreaker(self.__currentID, False)
     if isCurrentPlayer(senderID):
         return text
     return g_olDictionary.searchAndReplace(text)
 def _formatMessage(self, message, doFormatting = True):
     dbID = message.accountDBID
     isCurrent = isCurrentPlayer(message.accountDBID)
     if not doFormatting:
         return (isCurrent, message.text)
     return (isCurrent, self._mBuilder.setColors(dbID).setName(dbID, message.accountName).setText(message.text).build())
Exemple #28
0
 def filter(self, senderID, text):
     self.__currentID = senderID
     self.usersStorage._markAsBreaker(self.__currentID, False)
     if isCurrentPlayer(senderID):
         return text
     return g_olDictionary.searchAndReplace(text)
 def __onConnectStateChanged(self, channel):
     if channel.isJoined() and channel.getProtoType() is PROTO_TYPE.BW:
         data = channel.getProtoData()
         if not isCurrentPlayer(data.owner) and channel.isPrivate():
             g_instance.startLightEffect(GameLights.CHAT_CHANNEL_OPENED_EFFECT)
Exemple #30
0
 def filter(self, senderID, text):
     if isCurrentPlayer(senderID):
         return text
     return self._filter.removeSpam(text)
Exemple #31
0
 def __onConnectStateChanged(self, channel):
     if channel.isJoined() and channel.getProtoType() is PROTO_TYPE.BW:
         data = channel.getProtoData()
         if not isCurrentPlayer(data.owner) and channel.isPrivate():
             g_instance.startLightEffect(GameLights.CHAT_CHANNEL_OPENED_EFFECT)
Exemple #32
0
 def __onConnectStateChanged(self, channel):
     if channel.isJoined() and channel.getProtoType() is PROTO_TYPE.BW:
         data = channel.getProtoData()
         if not isCurrentPlayer(data.owner) and channel.isPrivate():
             g_instance.execEffect('channelOpenedEffect')
Exemple #33
0
 def __onConnectStateChanged(self, channel):
     if channel.isJoined() and channel.getProtoType() is PROTO_TYPE.BW:
         data = channel.getProtoData()
         if not isCurrentPlayer(data.owner) and channel.isPrivate():
             g_instance.execEffect('channelOpenedEffect')
Exemple #34
0
 def filter(self, senderID, text):
     if isCurrentPlayer(senderID):
         return text
     return g_olDictionary.searchAndReplace(text)
 def filter(self, senderID, text):
     return text if isCurrentPlayer(senderID) else g_dnDictionary.searchAndReplace(text)
Exemple #36
0
 def filter(self, senderID, text):
     if isCurrentPlayer(senderID):
         return text
     return self._filter.removeSpam(text)
Exemple #37
0
 def filter(self, senderID, text):
     if isCurrentPlayer(senderID):
         return text
     return g_olDictionary.searchAndReplace(text)