Пример #1
0
    def _showAward(self, ctx):
        _, message = ctx
        for dataForVehicle in message.data.values():
            arenaTypeID = dataForVehicle.get('arenaTypeID', 0)
            if arenaTypeID > 0 and arenaTypeID in ArenaType.g_cache:
                arenaType = ArenaType.g_cache[arenaTypeID]
            else:
                arenaType = None
            arenaCreateTime = dataForVehicle.get('arenaCreateTime', None)
            fairplayViolations = dataForVehicle.get('fairplayViolations', None)
            if arenaCreateTime and arenaType and fairplayViolations is not None and fairplayViolations[:2] != (0, 0):
                penaltyType = None
                violation = None
                if fairplayViolations[1] != 0:
                    penaltyType = 'penalty'
                    violation = fairplayViolations[1]
                elif fairplayViolations[0] != 0:
                    penaltyType = 'warning'
                    violation = fairplayViolations[0]
                from gui.DialogsInterface import showDialog
                showDialog(I18PunishmentDialogMeta('punishmentWindow', None, {'penaltyType': penaltyType,
                 'arenaName': i18n.makeString(arenaType.name),
                 'time': TimeFormatter.getActualMsgTimeStr(arenaCreateTime),
                 'reason': i18n.makeString(DIALOGS.all('punishmentWindow/reason/%s' % getFairPlayViolationName(violation)))}), lambda *args: None)

        return
Пример #2
0
 def _showAward(self, ctx):
     _, message = ctx
     arenaTypeID = message.data.get('arenaTypeID', 0)
     if arenaTypeID > 0 and arenaTypeID in ArenaType.g_cache:
         arenaType = ArenaType.g_cache[arenaTypeID]
     else:
         arenaType = None
     arenaCreateTime = message.data.get('arenaCreateTime', None)
     fairplayViolations = message.data.get('fairplayViolations', None)
     if arenaCreateTime and arenaType and fairplayViolations is not None and fairplayViolations[:2] != (
             0, 0):
         penaltyType = None
         violation = None
         if fairplayViolations[1] != 0:
             penaltyType = 'penalty'
             violation = fairplayViolations[1]
         elif fairplayViolations[0] != 0:
             penaltyType = 'warning'
             violation = fairplayViolations[0]
         showDialog(
             I18PunishmentDialogMeta(
                 'punishmentWindow', None, {
                     'penaltyType':
                     penaltyType,
                     'arenaName':
                     i18n.makeString(arenaType.name),
                     'time':
                     TimeFormatter.getActualMsgTimeStr(arenaCreateTime),
                     'reason':
                     i18n.makeString(
                         DIALOGS.all('punishmentWindow/reason/%s' %
                                     getFairPlayViolationName(violation)))
                 }), lambda *args: None)
     return
Пример #3
0
    def _showAward(self, ctx):
        _, message = ctx
        arenaTypeID = message.data.get("arenaTypeID", 0)
        if arenaTypeID > 0 and arenaTypeID in ArenaType.g_cache:
            arenaType = ArenaType.g_cache[arenaTypeID]
        else:
            arenaType = None
        arenaCreateTime = message.data.get("arenaCreateTime", None)
        fairplayViolations = message.data.get("fairplayViolations", None)
        if arenaCreateTime and arenaType and fairplayViolations is not None and fairplayViolations[:2] != (0, 0):
            penaltyType = None
            violation = None
            if fairplayViolations[1] != 0:
                penaltyType = "penalty"
                violation = fairplayViolations[1]
            elif fairplayViolations[0] != 0:
                penaltyType = "warning"
                violation = fairplayViolations[0]
            from gui.DialogsInterface import showDialog

            showDialog(
                I18PunishmentDialogMeta(
                    "punishmentWindow",
                    None,
                    {
                        "penaltyType": penaltyType,
                        "arenaName": i18n.makeString(arenaType.name),
                        "time": TimeFormatter.getActualMsgTimeStr(arenaCreateTime),
                        "reason": i18n.makeString(
                            DIALOGS.all("punishmentWindow/reason/%s" % getFairPlayViolationName(violation))
                        ),
                    },
                ),
                lambda *args: None,
            )
        return
Пример #4
0
 def getMessageActualTime(self, msTime):
     return TimeFormatter.getActualMsgTimeStr(msTime)
 def getMessageActualTime(self, msTime):
     """
     Is called from AS.
     Gets formatted actual message time.
     """
     return TimeFormatter.getActualMsgTimeStr(msTime)
Пример #6
0
 def getMessageActualTime(self, msTime):
     return TimeFormatter.getActualMsgTimeStr(msTime)
 def getMessageActualTime(self, msTime):
     """
     Is called from AS.
     Gets formatted actual message time.
     """
     return TimeFormatter.getActualMsgTimeStr(msTime)