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
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
def getPenaltyName(self): return getFairPlayViolationName(self._penaltiesMask)
def getWarningName(self): return getFairPlayViolationName(self._warningsMask)
def getViolationName(self): return getFairPlayViolationName(self._violationsMask)
def getViolationName(self): """Gets first name of violations. :return: string containing one of FAIRPLAY_VIOLATIONS_NAMES value or None. """ return getFairPlayViolationName(self._violationsMask)
def getPenaltyName(self): """Gets first name of penalty. :return: string containing one of FAIRPLAY_VIOLATIONS_NAMES value or None. """ return getFairPlayViolationName(self._penaltiesMask)