def addChatMessage(msg):
    global lastChatMessageTime
    if len(msg) == 0:
        return
    msg = _getL10n(msg)
    if lastChatMessageTime is None:
        player().guiSessionProvider.shared.chatCommands.proto.arenaChat.broadcast(msg, 0)
    elif (serverTime() - lastChatMessageTime) > 2:
        player().guiSessionProvider.shared.chatCommands.proto.arenaChat.broadcast(msg, 0)
    lastChatMessageTime = serverTime()
def addClientMessage(msg, timeout):
    global lastClientMessageTime
    if len(msg) == 0:
        return
    msg = _getL10n(msg)
    if (lastClientMessageTime is None) or (timeout == 0):
        MessengerEntry.g_instance.gui.addClientMessage(msg)
    elif (serverTime() - lastClientMessageTime) > timeout:
        MessengerEntry.g_instance.gui.addClientMessage(msg)
    lastClientMessageTime = serverTime()
Ejemplo n.º 3
0
def addClientMessage(msg):
    global lastClientMessageTime
    if len(msg) == 0:
        return
    if lastClientMessageTime is None:
        MessengerEntry.g_instance.gui.addClientMessage(msg)
    else:
        if serverTime() - lastClientMessageTime > 3:
            MessengerEntry.g_instance.gui.addClientMessage(msg)
    lastClientMessageTime = serverTime()
    return
Ejemplo n.º 4
0
def addChatMessage(msg):
    global lastChatMessageTime
    if len(msg) == 0:
        return
    if lastChatMessageTime is None:
        player(
        ).guiSessionProvider.shared.chatCommands.proto.arenaChat.broadcast(
            msg, 0)
    else:
        if serverTime() - lastChatMessageTime > 3:
            player(
            ).guiSessionProvider.shared.chatCommands.proto.arenaChat.broadcast(
                msg, 0)
    lastChatMessageTime = serverTime()
    return
Ejemplo n.º 5
0
def shoot(base, self, isRepeat=False):
    global deadBlockTimeOut
    if not (safeShotConfig['enabled'] and safeShotEnabled):
        return base(self, isRepeat)
    if target() is None:
        if safeShotConfig['wasteShotBlock']:
            addClientMessage(
                safeShotConfig['clientMessages']['wasteShotBlockedMessage'])
            return
    else:
        if hasattr(target().publicInfo, 'team'):
            if safeShotConfig['teamShotBlock'] and player().team is target(
            ).publicInfo.team and target().isAlive():
                if not (safeShotConfig['teamKillerShotUnblock'] and
                        player().guiSessionProvider.getArenaDP().isTeamKiller(
                            target().id)):
                    addChatMessage(
                        safeShotConfig['chatMessages']
                        ['teamShotBlockedMessage'].replace(
                            '{{target-name}}',
                            target().publicInfo.name).replace(
                                '{{target-vehicle}}',
                                target().typeDescriptor.type.shortUserString))
                    addClientMessage(safeShotConfig['clientMessages']
                                     ['teamShotBlockedMessage'])
                    return
            else:
                if deadBlockEnabled and not target().isAlive() and (
                        deadBlockTimeOut == 0 or serverTime() -
                        deadDict.get(target().id, 0) < deadBlockTimeOut):
                    addClientMessage(safeShotConfig['clientMessages']
                                     ['deadShotBlockedMessage'])
                    return
    return base(self, isRepeat)
def isShotAllowed():
    if not (safeShotConfig['enabled'] and safeShotEnabled and not isEventBattle):
        return True
    if target() is None:
        if safeShotConfig['wasteShotBlock']:
            addClientMessage(safeShotConfig['clientMessages']['wasteShotBlockedMessage'], 2)
            return False
    elif hasattr(target().publicInfo, 'team'):
        if safeShotConfig['teamShotBlock'] and (player().team is target().publicInfo.team) and target().isAlive():
            if not (safeShotConfig['teamKillerShotUnblock'] and player().guiSessionProvider.getArenaDP().isTeamKiller(target().id)):
                addChatMessage(safeShotConfig['chatMessages']['teamShotBlockedMessage'].replace('{{target-name}}', target().publicInfo.name).replace('{{target-vehicle}}', target().typeDescriptor.type.shortUserString))
                addClientMessage(safeShotConfig['clientMessages']['teamShotBlockedMessage'], 2)
                return False
        elif deadBlockEnabled and (not target().isAlive()) and ((deadBlockTimeOut == 0) or ((serverTime() - deadDict.get(target().id, 0)) < deadBlockTimeOut)):
            addClientMessage(safeShotConfig['clientMessages']['deadShotBlockedMessage'], 2)
            return False
    return True
def FragsCollectableStats_addVehicleStatusUpdate(self, vInfoVO):
    global deadDict
    if not vInfoVO.isAlive() and safeShotEnabled and deadBlockEnabled:
        deadDict.update({vInfoVO.vehicleID: serverTime()})