def _isRoleAvailableToChange(tankman, role):
    td = tankman.descriptor
    if td.role == role:
        return False
    if not tankmen.tankmenGroupHasRole(td.nationID, td.gid, td.isPremium, role):
        return False
    return True
def _getTooltip(tankman, role):
    """Return empty string '' - if role available, else clarify why role not available for change
    """
    td = tankman.descriptor
    if not tankmen.tankmenGroupHasRole(td.nationID, td.gid, td.isPremium, role):
        return makeTooltip(TOOLTIPS.ROLECHANGE_ROLECHANGEFORBIDDEN_HEADER, _ms(TOOLTIPS.ROLECHANGE_ROLECHANGEFORBIDDEN_BODY, role=_ms(TOOLTIPS.roleForSkill(role))))
    if td.role == role:
        return makeTooltip(TOOLTIPS.ROLECHANGE_CURRENTROLEWARNING_HEADER, TOOLTIPS.ROLECHANGE_CURRENTROLEWARNING_BODY)
    return ''
Beispiel #3
0
def _getTooltip(tankman, role):
    td = tankman.descriptor
    if not tankmen.tankmenGroupHasRole(td.nationID, td.gid, td.isPremium,
                                       role):
        return makeTooltip(
            TOOLTIPS.ROLECHANGE_ROLECHANGEFORBIDDEN_HEADER,
            _ms(TOOLTIPS.ROLECHANGE_ROLECHANGEFORBIDDEN_BODY,
                role=_ms(TOOLTIPS.roleForSkill(role))))
    return makeTooltip(
        TOOLTIPS.ROLECHANGE_CURRENTROLEWARNING_HEADER,
        TOOLTIPS.ROLECHANGE_CURRENTROLEWARNING_BODY) if td.role == role else ''
 def _validate(self):
     if self.vehicle is None:
         return makeError('invalid_vehicle')
     else:
         if self.vehicle is not None:
             mainRoles = set((r[0] for r in self.vehicle.descriptor.type.crewRoles))
             if self.role not in mainRoles:
                 return makeError('invalid_role')
             td = self.tankman.descriptor
             if not tankmen.tankmenGroupHasRole(td.nationID, td.gid, td.isPremium, self.role):
                 return makeError('invalid_role')
         return makeSuccess()