Ejemplo n.º 1
0
 def _showAward(self, ctx):
     _, message = ctx
     arenaTypeID = message.data.get('arenaTypeID', 0)
     arenaType = ArenaType.g_cache[arenaTypeID] if arenaTypeID > 0 else 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
Ejemplo n.º 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]
            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
Ejemplo n.º 3
0
 def getPenaltyName(self):
     return getFairPlayViolationName(self._penaltiesMask)
Ejemplo n.º 4
0
 def getWarningName(self):
     return getFairPlayViolationName(self._warningsMask)
Ejemplo n.º 5
0
 def getViolationName(self):
     return getFairPlayViolationName(self._violationsMask)
Ejemplo n.º 6
0
 def getViolationName(self):
     """Gets first name of violations.
     :return: string containing one of FAIRPLAY_VIOLATIONS_NAMES value or None.
     """
     return getFairPlayViolationName(self._violationsMask)
Ejemplo n.º 7
0
 def getPenaltyName(self):
     """Gets first name of penalty.
     :return: string containing one of FAIRPLAY_VIOLATIONS_NAMES value or None.
     """
     return getFairPlayViolationName(self._penaltiesMask)