本文整理汇总了Python中gui.shared.gui_items.Tankman类的典型用法代码示例。如果您正苦于以下问题:Python Tankman类的具体用法?Python Tankman怎么用?Python Tankman使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tankman类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __paramsChangeHandler
def __paramsChangeHandler(self, selectedNationID, selectedVehClass, selectedVehicle, selectedTmanRole):
selectedNationID = int(selectedNationID)
nationName = nations.NAMES[selectedNationID]
if self.__currentSelectedNationID != selectedNationID:
firstNameID, lastNameID, iconID = g_eventsCache.potapov.getNextTankwomanIDs(selectedNationID, self.__isPremium, int(self.__fnGroup), int(self.__lnGroup), int(self.__iGroupID))
rankID = Tankman.calculateRankID(tankmen.MAX_SKILL_LEVEL, self.__freeXpValue)
self.as_setInitDataS({'name': Tankman.getFullUserName(selectedNationID, firstNameID, lastNameID),
'nation': nationName,
'rank': Tankman.getRankUserName(selectedNationID, rankID),
'vehicle': '',
'faceIcon': Tankman.getBigIconPath(selectedNationID, iconID),
'rankIcon': Tankman.getRankBigIconPath(selectedNationID, rankID)})
self.__currentSelectedNationID = selectedNationID
示例2: packTankman
def packTankman(tankman, isCountPermanentSkills=True):
def vehicleIcon(vDescr, subtype=""):
return _ICONS_MASK % {"type": "vehicle", "subtype": subtype, "unicName": vDescr.name.replace(":", "-")}
nativeVehicleData = {
"typeCompDescr": tankman.vehicleNativeDescr.type.compactDescr,
"userName": Vehicle.getShortUserName(tankman.vehicleNativeDescr.type),
"icon": vehicleIcon(tankman.vehicleNativeDescr),
"iconContour": vehicleIcon(tankman.vehicleNativeDescr, "contour/"),
}
currentVehicleData = None
if tankman.isInTank:
currentVehicleData = {
"inventoryID": tankman.vehicleInvID,
"typeCompDescr": tankman.vehicleDescr.type.compactDescr,
"userName": Vehicle.getShortUserName(tankman.vehicleDescr.type),
"icon": vehicleIcon(tankman.vehicleDescr),
"iconContour": vehicleIcon(tankman.vehicleDescr, "contour/"),
}
skills = []
tManFreeSkillsNum = tankman.descriptor.freeSkillsNumber
startSkillNumber = 0 if isCountPermanentSkills else tManFreeSkillsNum
tManSkills = tankman.skills
for i in range(startSkillNumber, len(tManSkills)):
skills.append(packTankmanSkill(tManSkills[i], isPermanent=True if i < tManFreeSkillsNum else False))
return {
"strCD": cPickle.dumps(tankman.strCD),
"inventoryID": tankman.invID,
"nationID": tankman.nationID,
"firstUserName": tankman.firstUserName,
"lastUserName": tankman.lastUserName,
"roleName": tankman.descriptor.role,
"rankUserName": tankman.rankUserName,
"roleUserName": tankman.roleUserName,
"skills": skills,
"efficiencyRoleLevel": tankman.efficiencyRoleLevel,
"realRoleLevel": tankman.realRoleLevel,
"roleLevel": tankman.roleLevel,
"icon": {
"big": Tankman.getBigIconPath(tankman.nationID, tankman.descriptor.iconID),
"small": Tankman.getSmallIconPath(tankman.nationID, tankman.descriptor.iconID),
"barracks": Tankman.getBarracksIconPath(tankman.nationID, tankman.descriptor.iconID),
},
"iconRole": {
"big": Tankman.getRoleBigIconPath(tankman.descriptor.role),
"medium": Tankman.getRoleMediumIconPath(tankman.descriptor.role),
"small": Tankman.getRoleSmallIconPath(tankman.descriptor.role),
},
"iconRank": {
"big": Tankman.getRankBigIconPath(tankman.nationID, tankman.descriptor.rankID),
"small": Tankman.getRankSmallIconPath(tankman.nationID, tankman.descriptor.rankID),
},
"isInTank": tankman.isInTank,
"newSkillsCount": tankman.newSkillCount,
"nativeVehicle": nativeVehicleData,
"currentVehicle": currentVehicleData,
}
示例3: packTankmanSkill
def packTankmanSkill(skill):
if skill.roleType in tankmen.getSkillsConfig():
roleIconPath = Tankman.getRoleSmallIconPath(skill.roleType)
else:
roleIconPath = ''
return {'name': skill.name,
'level': skill.level,
'userName': skill.userName,
'description': skill.description,
'shortDescription': skill.shortDescription,
'icon': {'big': Tankman.getSkillBigIconPath(skill.name),
'small': Tankman.getSkillSmallIconPath(skill.name),
'role': roleIconPath},
'isActive': skill.isActive,
'isEnable': skill.isEnable,
'roleType': skill.roleType,
'isPerk': skill.isPerk}
示例4: __makeTankmanVO
def __makeTankmanVO(self, tman, avgBattles2NewSkill):
prediction = ''
if avgBattles2NewSkill > 0:
prediction = _ms(BATTLE_RESULTS.COMMON_NEWSKILLPREDICTION, battles=BigWorld.wg_getIntegralFormat(avgBattles2NewSkill))
return {'title': _ms(BATTLE_RESULTS.COMMON_CREWMEMBER_NEWSKILL),
'description': self.__makeTankmanDescription(tman),
'tankmenIcon': Tankman.getSmallIconPath(tman.nationID, tman.descriptor.iconID),
'prediction': prediction,
'linkEvent': PROGRESS_ACTION.NEW_SKILL_UNLOCK_TYPE,
'linkId': tman.invID}
示例5: _successHandler
def _successHandler(self, code, ctx = None):
msgType = SM_TYPE.FinancialTransactionWithGold
vehicle = g_itemsCache.items.getItemByCD(self.__vehTypeCompDescr)
if ctx == EQUIP_TMAN_CODE.OK:
auxData = makeI18nSuccess('change_tankman_role/installed', vehicle=vehicle.shortUserName)
elif ctx == EQUIP_TMAN_CODE.NO_FREE_SLOT:
roleStr = Tankman.getRoleUserName(SKILL_NAMES[self.__roleIdx])
auxData = makeI18nSuccess('change_tankman_role/slot_is_taken', vehicle=vehicle.shortUserName, role=roleStr)
else:
auxData = makeI18nSuccess('change_tankman_role/no_vehicle')
return makeI18nSuccess('change_tankman_role/success', money=formatPrice((0, self.__changeRoleCost)), type=msgType, auxData=auxData)
示例6: onVehicleSelected
def onVehicleSelected(self, vehTypeCompDescr):
self.__selectedVehicleCD = int(vehTypeCompDescr)
selectedVehicle = self.__items.getItemByCD(self.__selectedVehicleCD)
data = []
for role in selectedVehicle.descriptor.type.crewRoles:
mainRole = role[0]
criteria = REQ_CRITERIA.TANKMAN.NATIVE_TANKS([self.__selectedVehicleCD]) | REQ_CRITERIA.TANKMAN.ROLES([mainRole])
roleTankmen = self.__items.getTankmen(criteria).values()
sameTankmen = len(roleTankmen)
roleSlotIsTaken = _isRoleSlotTaken(roleTankmen, selectedVehicle, mainRole)
roleStr = Tankman.getRoleUserName(mainRole)
isAvailable = self.__tankman.descriptor.role != mainRole
data.append({'id': mainRole,
'name': roleStr,
'icon': Tankman.getRoleMediumIconPath(mainRole),
'available': isAvailable,
'warningHeader': _getTooltipHeader(sameTankmen, isAvailable),
'warningBody': _getTooltipBody(sameTankmen, isAvailable, roleSlotIsTaken, roleStr, selectedVehicle)})
self.as_setRolesS(data)
示例7: packTankman
def packTankman(tankman, isCountPermanentSkills = True):
def vehicleIcon(vDescr, subtype = ''):
return _ICONS_MASK % {'type': 'vehicle',
'subtype': subtype,
'unicName': vDescr.name.replace(':', '-')}
nativeVehicleData = {'typeCompDescr': tankman.vehicleNativeDescr.type.compactDescr,
'userName': Vehicle.getShortUserName(tankman.vehicleNativeDescr.type),
'icon': vehicleIcon(tankman.vehicleNativeDescr),
'iconContour': vehicleIcon(tankman.vehicleNativeDescr, 'contour/')}
currentVehicleData = None
if tankman.isInTank:
currentVehicleData = {'inventoryID': tankman.vehicleInvID,
'typeCompDescr': tankman.vehicleDescr.type.compactDescr,
'userName': Vehicle.getShortUserName(tankman.vehicleDescr.type),
'icon': vehicleIcon(tankman.vehicleDescr),
'iconContour': vehicleIcon(tankman.vehicleDescr, 'contour/')}
skills = []
tManFreeSkillsNum = tankman.descriptor.freeSkillsNumber
startSkillNumber = 0 if isCountPermanentSkills else tManFreeSkillsNum
tManSkills = tankman.skills
for i in range(startSkillNumber, len(tManSkills)):
skills.append(packTankmanSkill(tManSkills[i], isPermanent=True if i < tManFreeSkillsNum else False))
return {'strCD': cPickle.dumps(tankman.strCD),
'inventoryID': tankman.invID,
'nationID': tankman.nationID,
'firstUserName': tankman.firstUserName,
'lastUserName': tankman.lastUserName,
'roleName': tankman.descriptor.role,
'rankUserName': tankman.rankUserName,
'roleUserName': tankman.roleUserName,
'skills': skills,
'efficiencyRoleLevel': tankman.efficiencyRoleLevel,
'realRoleLevel': tankman.realRoleLevel,
'roleLevel': tankman.roleLevel,
'icon': {'big': Tankman.getBigIconPath(tankman.nationID, tankman.descriptor.iconID),
'small': Tankman.getSmallIconPath(tankman.nationID, tankman.descriptor.iconID),
'barracks': Tankman.getBarracksIconPath(tankman.nationID, tankman.descriptor.iconID)},
'iconRole': {'big': Tankman.getRoleBigIconPath(tankman.descriptor.role),
'medium': Tankman.getRoleMediumIconPath(tankman.descriptor.role),
'small': Tankman.getRoleSmallIconPath(tankman.descriptor.role)},
'iconRank': {'big': Tankman.getRankBigIconPath(tankman.nationID, tankman.descriptor.rankID),
'small': Tankman.getRankSmallIconPath(tankman.nationID, tankman.descriptor.rankID)},
'isInTank': tankman.isInTank,
'newSkillsCount': tankman.newSkillCount,
'nativeVehicle': nativeVehicleData,
'currentVehicle': currentVehicleData}
示例8: packTankmanSkill
def packTankmanSkill(skill, isPermanent=False):
if skill.roleType in tankmen.getSkillsConfig():
roleIconPath = Tankman.getRoleSmallIconPath(skill.roleType)
else:
roleIconPath = ""
return {
"name": skill.name,
"level": skill.level,
"userName": skill.userName,
"description": skill.description,
"shortDescription": skill.shortDescription,
"icon": {
"big": Tankman.getSkillBigIconPath(skill.name),
"small": Tankman.getSkillSmallIconPath(skill.name),
"role": roleIconPath,
},
"isActive": skill.isActive,
"isEnable": skill.isEnable,
"roleType": skill.roleType,
"isPerk": skill.isPerk,
"isPermanent": isPermanent,
}
示例9: packTankman
def packTankman(tankman, isCountPermanentSkills = True):
def vehicleIcon(vDescr, subtype = ''):
return _ICONS_MASK % {'type': 'vehicle',
'subtype': subtype,
'unicName': vDescr.name.replace(':', '-')}
nativeVehicleData = {'typeCompDescr': tankman.vehicleNativeDescr.type.compactDescr,
'userName': tankman.vehicleNativeDescr.type.shortUserString,
'icon': vehicleIcon(tankman.vehicleNativeDescr),
'iconContour': vehicleIcon(tankman.vehicleNativeDescr, 'contour/')}
currentVehicleData = None
if tankman.isInTank:
currentVehicleData = {'inventoryID': tankman.vehicleInvID,
'typeCompDescr': tankman.vehicleDescr.type.compactDescr,
'userName': tankman.vehicleDescr.type.shortUserString,
'icon': vehicleIcon(tankman.vehicleDescr),
'iconContour': vehicleIcon(tankman.vehicleDescr, 'contour/')}
skills = []
for skill in tankman.skills:
if not (skill.name == 'brotherhood' and tankman.descriptor.isFemale and not isCountPermanentSkills):
skills.append(packTankmanSkill(skill))
return {'strCD': cPickle.dumps(tankman.strCD),
'inventoryID': tankman.invID,
'nationID': tankman.nationID,
'firstUserName': tankman.firstUserName,
'lastUserName': tankman.lastUserName,
'roleName': tankman.descriptor.role,
'rankUserName': tankman.rankUserName,
'roleUserName': tankman.roleUserName,
'skills': skills,
'efficiencyRoleLevel': tankman.efficiencyRoleLevel,
'realRoleLevel': tankman.realRoleLevel,
'roleLevel': tankman.roleLevel,
'icon': {'big': Tankman.getBigIconPath(tankman.nationID, tankman.descriptor.iconID),
'small': Tankman.getSmallIconPath(tankman.nationID, tankman.descriptor.iconID),
'barracks': Tankman.getBarracksIconPath(tankman.nationID, tankman.descriptor.iconID)},
'iconRole': {'big': Tankman.getRoleBigIconPath(tankman.descriptor.role),
'medium': Tankman.getRoleMediumIconPath(tankman.descriptor.role),
'small': Tankman.getRoleSmallIconPath(tankman.descriptor.role)},
'iconRank': {'big': Tankman.getRankBigIconPath(tankman.nationID, tankman.descriptor.rankID),
'small': Tankman.getRankSmallIconPath(tankman.nationID, tankman.descriptor.rankID)},
'isInTank': tankman.isInTank,
'newSkillsCount': tankman.newSkillCount,
'nativeVehicle': nativeVehicleData,
'currentVehicle': currentVehicleData}
示例10: _packTankmanData
def _packTankmanData(tankman):
tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
if tankman.isInTank:
vehicle = g_itemsCache.items.getVehicle(tankman.vehicleInvID)
if vehicle is None:
LOG_ERROR('Cannot find vehicle for tankman: ', tankman, tankman.descriptor.role, tankman.vehicle.name, tankman.firstname, tankman.lastname)
return
vehicleID = vehicle.invID
slot = tankman.vehicleSlotIdx
isLocked, msg = _getTankmanLockMessage(vehicle)
actionBtnEnabled = not isLocked
isInCurrentTank = g_currentVehicle.isPresent() and tankmanVehicle.invID == g_currentVehicle.invID
isInSelfVehicle = vehicle.shortUserName == tankmanVehicle.shortUserName
isInSelfVehicleType = vehicle.type == tankmanVehicle.type
else:
isLocked, msg = False, ''
actionBtnEnabled = True
isInCurrentTank = False
vehicleID = None
slot = None
isInSelfVehicle = True
isInSelfVehicleType = True
data = {'firstName': tankman.firstUserName,
'lastName': tankman.lastUserName,
'rank': tankman.rankUserName,
'specializationLevel': tankman.realRoleLevel[0],
'role': tankman.roleUserName,
'vehicleType': tankmanVehicle.shortUserName,
'iconFile': tankman.icon,
'rankIconFile': tankman.iconRank,
'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role),
'contourIconFile': tankmanVehicle.iconContour,
'tankmanID': tankman.invID,
'nationID': tankman.nationID,
'typeID': tankmanVehicle.innationID,
'roleType': tankman.descriptor.role,
'tankType': tankmanVehicle.type,
'inTank': tankman.isInTank,
'compact': str(tankman.invID),
'lastSkillLevel': tankman.descriptor.lastSkillLevel,
'actionBtnEnabled': actionBtnEnabled,
'inCurrentTank': isInCurrentTank,
'vehicleID': vehicleID,
'slot': slot,
'locked': isLocked,
'lockMessage': msg,
'isInSelfVehicleClass': isInSelfVehicleType,
'isInSelfVehicleType': isInSelfVehicle}
return data
示例11: updateTankmen
def updateTankmen(self):
Waiting.show('updateTankmen')
if g_currentVehicle.isPresent():
tankmen = g_itemsCache.items.getTankmen()
vehicle = g_currentVehicle.item
commander_bonus = vehicle.bonuses['commander']
roles = []
lessMastered = 0
tankmenDescrs = dict(vehicle.crew)
for slotIdx, tman in vehicle.crew:
if slotIdx > 0 and tman is not None and (tankmenDescrs[lessMastered] is None or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0):
lessMastered = slotIdx
role = vehicle.descriptor.type.crewRoles[slotIdx][0]
roles.append({'tankmanID': tman.invID if tman is not None else None,
'roleType': role,
'role': convert(getSkillsConfig()[role]['userString']),
'roleIcon': Tankman.getRoleBigIconPath(role),
'nationID': vehicle.nationID,
'typeID': vehicle.innationID,
'slot': slotIdx,
'vehicleType': vehicle.shortUserName,
'tankType': vehicle.type,
'vehicleElite': vehicle.isPremium or vehicle.isPremiumIGR,
'roles': list(vehicle.descriptor.type.crewRoles[slotIdx])})
tankmenData = []
for tankman in tankmen.itervalues():
if tankman.isInTank and tankman.vehicleInvID != vehicle.invID:
continue
tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
bonus_role_level = commander_bonus if tankman.descriptor.role != 'commander' else 0.0
skills_count = len(list(ACTIVE_SKILLS))
skillsList = []
for skill in tankman.skills:
skillsList.append({'tankmanID': tankman.invID,
'id': str(tankman.skills.index(skill)),
'name': skill.userName,
'desc': skill.description,
'icon': skill.icon,
'level': skill.level,
'active': skill.isEnable and skill.isActive})
newSkillsCount, lastNewSkillLvl = tankman.newSkillCount
if newSkillsCount > 0:
skillsList.append({'buy': True,
'tankmanID': tankman.invID,
'level': lastNewSkillLvl})
tankmanData = {'firstName': tankman.firstUserName,
'lastName': tankman.lastUserName,
'rank': tankman.rankUserName,
'specializationLevel': tankman.realRoleLevel[0],
'role': tankman.roleUserName,
'vehicleType': tankmanVehicle.shortUserName,
'iconFile': tankman.icon,
'rankIconFile': tankman.iconRank,
'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role),
'contourIconFile': tankmanVehicle.iconContour,
'tankmanID': tankman.invID,
'nationID': tankman.nationID,
'typeID': tankmanVehicle.innationID,
'inTank': tankman.isInTank,
'roleType': tankman.descriptor.role,
'tankType': tankmanVehicle.type,
'efficiencyLevel': tankman.efficiencyRoleLevel,
'bonus': bonus_role_level,
'lastSkillLevel': tankman.descriptor.lastSkillLevel,
'isLessMastered': vehicle.crewIndices.get(tankman.invID) == lessMastered and vehicle.isXPToTman,
'compact': tankman.strCD,
'availableSkillsCount': skills_count,
'skills': skillsList}
tankmenData.append(tankmanData)
self.as_tankmenResponseS({'roles': roles,
'tankmen': tankmenData})
dogName = ''
if 'dog' in g_itemsCache.items.getItemByCD(g_currentVehicle.item.intCD).tags:
dogName = MENU.HANGAR_CREW_RODY_DOG_NAME
self.as_dogResponseS(dogName)
Waiting.hide('updateTankmen')
return
示例12: __updateTankmen
def __updateTankmen(self, *args):
tankmen = g_itemsCache.items.getTankmen().values()
slots = g_itemsCache.items.stats.tankmenBerthsCount
berths = g_itemsCache.items.stats.tankmenBerthsCount
berthPrice = g_itemsCache.items.shop.getTankmanBerthPrice(berths)
defaultBerthPrice = g_itemsCache.items.shop.defaults.getTankmanBerthPrice(berths)
tankmenList = list()
tankmenInBarracks = 0
tankmenInSlots = 0
action = None
if berthPrice[0] != defaultBerthPrice[0]:
action = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
'key': 'berthsPrices',
'isBuying': True,
'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
'newPrice': (0, berthPrice[0]),
'oldPrice': (0, defaultBerthPrice[0])}
tankmenList.append({'buy': True,
'price': BigWorld.wg_getGoldFormat(berthPrice[0]),
'actionPriceData': action,
'count': berthPrice[1]})
for tankman in sorted(tankmen, TankmenComparator(g_itemsCache.items.getVehicle)):
if not tankman.isInTank:
tankmenInBarracks += 1
slot, vehicleID, vehicleInnationID, vehicle = (None, None, None, None)
if tankman.isInTank:
vehicle = g_itemsCache.items.getVehicle(tankman.vehicleInvID)
vehicleID = vehicle.invID
vehicleInnationID = vehicle.innationID
if vehicle is None:
LOG_ERROR('Cannot find vehicle for tankman: ', tankman, tankman.descriptor.role, tankman.vehicle.name, tankman.firstname, tankman.lastname)
continue
slot = tankman.vehicleSlotIdx
if self.filter['nation'] != -1 and tankman.nationID != self.filter['nation'] or self.filter['role'] != 'None' and tankman.descriptor.role != self.filter['role'] or self.filter['tankType'] != 'None' and tankman.vehicleNativeType != self.filter['tankType'] or self.filter['location'] == 'tanks' and tankman.isInTank != True or self.filter['location'] == 'barracks' and tankman.isInTank == True or self.filter['nationID'] is not None and (self.filter['location'] != str(vehicleInnationID) or self.filter['nationID'] != str(tankman.nationID)):
continue
isLocked, msg = self.getTankmanLockMessage(vehicle) if tankman.isInTank else (False, '')
tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
isInCurrentTank = tankmanVehicle.invID == g_currentVehicle.invID if tankman.isInTank and g_currentVehicle.isPresent() else False
tankmenList.append({'firstname': tankman.firstUserName,
'lastname': tankman.lastUserName,
'rank': tankman.rankUserName,
'specializationLevel': tankman.realRoleLevel[0],
'role': tankman.roleUserName,
'vehicleType': tankmanVehicle.shortUserName,
'iconFile': tankman.icon,
'rankIconFile': tankman.iconRank,
'roleIconFile': Tankman.getRoleBigIconPath(tankman.descriptor.role),
'contourIconFile': tankmanVehicle.iconContour,
'tankmanID': tankman.invID,
'nationID': tankman.nationID,
'typeID': tankmanVehicle.innationID,
'slot': slot,
'roleType': tankman.descriptor.role,
'tankType': tankmanVehicle.type,
'inTank': tankman.isInTank,
'inCurrentTank': isInCurrentTank,
'vehicleID': vehicleID,
'compact': str(tankman.invID),
'locked': isLocked,
'lockMessage': msg,
'vehicleBroken': vehicle.repairCost > 0 if tankman.isInTank else None,
'isInSelfVehicleClass': vehicle.type == tankmanVehicle.type if tankman.isInTank else True,
'isInSelfVehicleType': vehicle.shortUserName == tankmanVehicle.shortUserName if tankman.isInTank else True})
tankmenInSlots = len(tankmenList) - 1
if tankmenInBarracks < slots:
tankmenList.insert(1, {'empty': True,
'freePlaces': slots - tankmenInBarracks})
self.as_setTankmenS(len(tankmen), tankmenInSlots, slots, tankmenInBarracks, tankmenList)
return
示例13: __updateTankmen
def __updateTankmen(self, *args):
tankmen = g_itemsCache.items.getTankmen().values()
slots = g_itemsCache.items.stats.tankmenBerthsCount
berths = g_itemsCache.items.stats.tankmenBerthsCount
berthPrice = g_itemsCache.items.shop.getTankmanBerthPrice(berths)
defaultBerthPrice = g_itemsCache.items.shop.defaults.getTankmanBerthPrice(berths)
tankmenList = list()
tankmenInBarracks = 0
tankmenInSlots = 0
action = None
if berthPrice[0] != defaultBerthPrice[0]:
action = {
"type": ACTION_TOOLTIPS_TYPE.ECONOMICS,
"key": "berthsPrices",
"isBuying": True,
"state": (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
"newPrice": (0, berthPrice[0]),
"oldPrice": (0, defaultBerthPrice[0]),
}
tankmenList.append(
{
"buy": True,
"price": BigWorld.wg_getGoldFormat(berthPrice[0]),
"actionPriceData": action,
"count": berthPrice[1],
}
)
for tankman in sorted(tankmen, TankmenComparator(g_itemsCache.items.getVehicle)):
if not tankman.isInTank:
tankmenInBarracks += 1
slot, vehicleID, vehicleInnationID, vehicle = (None, None, None, None)
if tankman.isInTank:
vehicle = g_itemsCache.items.getVehicle(tankman.vehicleInvID)
vehicleID = vehicle.invID
vehicleInnationID = vehicle.innationID
if vehicle is None:
LOG_ERROR(
"Cannot find vehicle for tankman: ",
tankman,
tankman.descriptor.role,
tankman.vehicle.name,
tankman.firstname,
tankman.lastname,
)
continue
slot = tankman.vehicleSlotIdx
if (
self.filter["nation"] != -1
and tankman.nationID != self.filter["nation"]
or self.filter["role"] != "None"
and tankman.descriptor.role != self.filter["role"]
or self.filter["tankType"] != "None"
and tankman.vehicleNativeType != self.filter["tankType"]
or self.filter["location"] == "tanks"
and tankman.isInTank != True
or self.filter["location"] == "barracks"
and tankman.isInTank == True
or self.filter["nationID"] is not None
and (
self.filter["location"] != str(vehicleInnationID)
or self.filter["nationID"] != str(tankman.nationID)
)
):
continue
isLocked, msg = self.getTankmanLockMessage(vehicle) if tankman.isInTank else (False, "")
tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
isInCurrentTank = (
tankmanVehicle.invID == g_currentVehicle.invID
if tankman.isInTank and g_currentVehicle.isPresent()
else False
)
tankmenList.append(
{
"firstname": tankman.firstUserName,
"lastname": tankman.lastUserName,
"rank": tankman.rankUserName,
"specializationLevel": tankman.realRoleLevel[0],
"role": tankman.roleUserName,
"vehicleType": tankmanVehicle.shortUserName,
"iconFile": tankman.icon,
"rankIconFile": tankman.iconRank,
"roleIconFile": Tankman.getRoleBigIconPath(tankman.descriptor.role),
"contourIconFile": tankmanVehicle.iconContour,
"tankmanID": tankman.invID,
"nationID": tankman.nationID,
"typeID": tankmanVehicle.innationID,
"slot": slot,
"roleType": tankman.descriptor.role,
"tankType": tankmanVehicle.type,
"inTank": tankman.isInTank,
"inCurrentTank": isInCurrentTank,
"vehicleID": vehicleID,
"compact": str(tankman.invID),
"locked": isLocked,
"lockMessage": msg,
"vehicleBroken": vehicle.repairCost > 0 if tankman.isInTank else None,
"isInSelfVehicleClass": vehicle.type == tankmanVehicle.type if tankman.isInTank else True,
"isInSelfVehicleType": vehicle.shortUserName == tankmanVehicle.shortUserName
if tankman.isInTank
else True,
#.........这里部分代码省略.........
示例14: updateTankmen
def updateTankmen(self):
Waiting.show("updateTankmen")
if g_currentVehicle.isPresent():
tankmen = g_itemsCache.items.getTankmen()
vehicle = g_currentVehicle.item
commander_bonus = vehicle.bonuses["commander"]
roles = []
lessMastered = 0
tankmenDescrs = dict(vehicle.crew)
for slotIdx, tman in vehicle.crew:
if (
slotIdx > 0
and tman is not None
and (
tankmenDescrs[lessMastered] is None
or compareMastery(tankmenDescrs[lessMastered].descriptor, tman.descriptor) > 0
)
):
lessMastered = slotIdx
role = vehicle.descriptor.type.crewRoles[slotIdx][0]
roles.append(
{
"tankmanID": tman.invID if tman is not None else None,
"roleType": role,
"role": convert(getSkillsConfig()[role]["userString"]),
"roleIcon": Tankman.getRoleBigIconPath(role),
"nationID": vehicle.nationID,
"typeID": vehicle.innationID,
"slot": slotIdx,
"vehicleType": vehicle.shortUserName,
"tankType": vehicle.type,
"vehicleElite": vehicle.isPremium or vehicle.isPremiumIGR,
"roles": list(vehicle.descriptor.type.crewRoles[slotIdx]),
}
)
tankmenData = []
for tankman in tankmen.itervalues():
if tankman.isInTank and tankman.vehicleInvID != vehicle.invID:
continue
tankmanVehicle = g_itemsCache.items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
bonus_role_level = commander_bonus if tankman.descriptor.role != "commander" else 0.0
skills_count = len(list(ACTIVE_SKILLS))
skillsList = []
for skill in tankman.skills:
skillsList.append(
{
"tankmanID": tankman.invID,
"id": str(tankman.skills.index(skill)),
"name": skill.userName,
"desc": skill.description,
"icon": skill.icon,
"level": skill.level,
"active": skill.isEnable and skill.isActive,
}
)
newSkillsCount, lastNewSkillLvl = tankman.newSkillCount
if newSkillsCount > 0:
skillsList.append({"buy": True, "tankmanID": tankman.invID, "level": lastNewSkillLvl})
tankmanData = {
"firstName": tankman.firstUserName,
"lastName": tankman.lastUserName,
"rank": tankman.rankUserName,
"specializationLevel": tankman.realRoleLevel[0],
"role": tankman.roleUserName,
"vehicleType": tankmanVehicle.shortUserName,
"iconFile": tankman.icon,
"rankIconFile": tankman.iconRank,
"roleIconFile": Tankman.getRoleBigIconPath(tankman.descriptor.role),
"contourIconFile": tankmanVehicle.iconContour,
"tankmanID": tankman.invID,
"nationID": tankman.nationID,
"typeID": tankmanVehicle.innationID,
"inTank": tankman.isInTank,
"roleType": tankman.descriptor.role,
"tankType": tankmanVehicle.type,
"efficiencyLevel": tankman.efficiencyRoleLevel,
"bonus": bonus_role_level,
"lastSkillLevel": tankman.descriptor.lastSkillLevel,
"isLessMastered": vehicle.crewIndices.get(tankman.invID) == lessMastered and vehicle.isXPToTman,
"compact": tankman.strCD,
"availableSkillsCount": skills_count,
"skills": skillsList,
}
tankmenData.append(tankmanData)
self.as_tankmenResponseS({"roles": roles, "tankmen": tankmenData})
dogName = ""
if "dog" in g_itemsCache.items.getItemByCD(g_currentVehicle.item.intCD).tags:
dogName = MENU.HANGAR_CREW_RODY_DOG_NAME
self.as_dogResponseS(dogName)
Waiting.hide("updateTankmen")
return