本文整理汇总了Python中pirates.battle.WeaponGlobals.getSkillReputationCategoryId方法的典型用法代码示例。如果您正苦于以下问题:Python WeaponGlobals.getSkillReputationCategoryId方法的具体用法?Python WeaponGlobals.getSkillReputationCategoryId怎么用?Python WeaponGlobals.getSkillReputationCategoryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.battle.WeaponGlobals
的用法示例。
在下文中一共展示了WeaponGlobals.getSkillReputationCategoryId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verifyCombo
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def verifyCombo(self, avId, weaponId, skillId, timestamp):
if skillId in self.EXCLUDED_SKILLS:
return 0
combo = self.timers.get(avId)
if not combo:
return 0
comboLength = len(combo)
lastEntry = combo[comboLength - 1]
lastSkillId = lastEntry[self.SKILLID_INDEX]
lastTimestamp = lastEntry[self.TIMESTAMP_INDEX]
subtypeId = ItemGlobals.getSubtype(weaponId)
if not subtypeId:
return 0
comboChain = self.COMBO_ORDER.get(subtypeId)
if not comboChain:
return 0
repId = WeaponGlobals.getSkillReputationCategoryId(skillId)
if not repId:
return 0
if skillId in comboChain:
index = comboChain.index(skillId)
requisiteAttack = comboChain[index - 1]
currentAttack = comboChain[index]
if lastSkillId != requisiteAttack and lastSkillId != currentAttack and lastSkillId not in self.SPECIAL_SKILLS.get(repId, []):
return 0
return 1
示例2: updateSkillId
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def updateSkillId(self, skillId):
self.skillId = skillId
if self.skillButton:
if self.quantityLabel:
self.quantityLabel.detachNode()
self.skillButton.destroy()
if self.showQuantity and not (self.quantity):
geomColor = Vec4(0.5, 0.5, 0.5, 1.0)
else:
geomColor = Vec4(1.0, 1.0, 1.0, 1.0)
if self.showIcon:
asset = WeaponGlobals.getSkillIcon(skillId)
if hasattr(self, '_skillIconName'):
asset = self._skillIconName
geom = SkillButton.SkillIcons.find('**/%s' % asset)
if geom.isEmpty():
geom = SkillButton.SkillIcons.find('**/base')
repId = WeaponGlobals.getSkillReputationCategoryId(self.skillId)
geom_scale = getGeomScale(repId, skillId)
image_color = (1, 1, 1, 1)
else:
geom = (None,)
geom_scale = 0.12
image_color = (0.5, 0.5, 0.5, 0.5)
specialIconId = 0
if self.isBreakAttackSkill:
specialIconId = 1
elif self.isDefenseSkill:
specialIconId = 2
elif skillId == ItemGlobals.getSpecialAttack(localAvatar.currentWeaponId):
specialIconId = 3
if specialIconId:
something = SkillButton.SpecialIcons[specialIconId][0]
if self.skillRing:
self.skillRing.setupFace(something)
self['image'] = None
elif self.skillRing:
self.skillRing.setupFace()
if self.showRing:
image = None
else:
image = SkillButton.Image
self.skillButton = DirectButton(parent = self, relief = None, pos = (0, 0, 0), text = ('', '', self.name), text_align = TextNode.ACenter, text_shadow = Vec4(0, 0, 0, 1), text_scale = 0.040000000000000001, text_fg = Vec4(1, 1, 1, 1), text_pos = (0.0, 0.089999999999999997), image = image, image_scale = 0.14999999999999999, image_color = image_color, geom = geom, geom_scale = geom_scale, geom_color = geomColor, command = self.callback, sortOrder = 50, extraArgs = [
skillId])
self.skillButton.bind(DGG.ENTER, self.showDetails)
self.skillButton.bind(DGG.EXIT, self.hideDetails)
if self.quantityLabel and not self.quantityLabel.isEmpty():
self.quantityLabel.reparentTo(self.skillButton)
示例3: isSkillValid
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def isSkillValid(self, skillId):
ammoId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoName = PLocalizer.InventoryTypeNames.get(ammoId)
ammoDescription = PLocalizer.WeaponDescriptions.get(ammoId)
ammoIconName = WeaponGlobals.getSkillIcon(skillId)
ammoIcon = self.SkillIcons.find("**/%s" % ammoIconName)
skillRepId = WeaponGlobals.getSkillReputationCategoryId(skillId)
stackLimit = localAvatar.getInventory().getStackLimit(ammoId)
if ammoName and ammoDescription and ammoIcon and stackLimit:
return 1
else:
return 0
示例4: isSkillValid
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def isSkillValid(self, skillId):
return WeaponGlobals.getSkillAmmoInventoryId(skillId) in InventoryGlobals.AmmoInGUI
SkillIcons = loader.loadModel('models/textureCards/skillIcons')
ammoId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoName = PLocalizer.InventoryTypeNames.get(ammoId)
ammoDescription = PLocalizer.WeaponDescriptions.get(ammoId)
ammoIconName = WeaponGlobals.getSkillIcon(skillId)
ammoIcon = SkillIcons.find('**/%s' % ammoIconName)
skillRepId = WeaponGlobals.getSkillReputationCategoryId(skillId)
if ammoName and ammoDescription and ammoIcon and skillRepId:
return 1
else:
return 0
示例5: checkComboExpired
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def checkComboExpired(self, avId, weaponId, skillId, skillResult):
barTime = 3.0
curTime = globalClock.getFrameTime()
for attackerId in self.timers:
comboLength = len(self.timers[attackerId])
lastEntry = self.timers[attackerId][comboLength - 1]
lastSkillId = lastEntry[self.SKILLID_INDEX]
timestamp = lastEntry[self.TIMESTAMP_INDEX]
if (barTime + timestamp - curTime) + self.TOLERANCE > 0:
if attackerId != avId:
return 0
subtypeId = ItemGlobals.getSubtype(weaponId)
if not subtypeId:
return 0
repId = WeaponGlobals.getSkillReputationCategoryId(skillId)
if not repId:
return 0
if repId != WeaponGlobals.getRepId(weaponId):
return 0
comboChain = self.COMBO_ORDER.get(subtypeId)
if comboChain:
if not self.SPECIAL_SKILLS.get(repId, []):
self.notify.warning('No special skills for weapon %s with skill %s, subtype %s, rep %s' % (weaponId, skillId, subtypeId, repId))
if skillId in self.SPECIAL_SKILLS.get(repId, []):
if lastSkillId not in self.SPECIAL_SKILLS.get(repId, []):
return 0
elif skillId in comboChain:
index = comboChain.index(skillId)
if index > 0:
requisiteAttack = comboChain[index - 1]
if lastSkillId == requisiteAttack:
return 0
elif not comboLength:
return 0
return 1
示例6: figureOutStackTypes
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def figureOutStackTypes(self):
repCategoryDict = {}
for itemId in self.itemList:
skillRepId = WeaponGlobals.getSkillReputationCategoryId(itemId)
if self.isSkillValid(itemId):
if not repCategoryDict.has_key(skillRepId):
repCategoryDict[skillRepId] = []
repCategoryDict[skillRepId].append(itemId)
continue
self.listOfItemLists = []
for key in repCategoryDict:
itemList = repCategoryDict[key]
while len(itemList) > self.maxCountX:
frontList = itemList[: self.maxCountX]
backList = itemList[self.maxCountX :]
self.listOfItemLists.append(frontList)
itemList = backList
self.listOfItemLists.append(itemList)
示例7: updateSkillTrayStates
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def updateSkillTrayStates(self):
if not self.traySkillMap:
return None
if not hasattr(base, 'localAvatar'):
return None
inv = localAvatar.getInventory()
if not inv:
return None
self.numberOfItems = len(self.traySkillMap)
for i in range(self.numberOfItems):
skillId = self.traySkillMap[i]
greyOut = 0
if self.tray[i + 1].greyOut == -1:
continue
if self.tray[i + 1].showQuantity:
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
quantity = WeaponGlobals.INF_QUANT
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
quantity = inv.getStackQuantity(ammoInvId)
if quantity == 0:
greyOut = 1
if localAvatar.mojo < -1 * WeaponGlobals.getMojoCost(skillId):
greyOut = 1
if localAvatar.ship:
if (skillId == InventoryType.SailBroadsideLeft or skillId == InventoryType.SailBroadsideRight) and not (localAvatar.ship.broadside):
greyOut = 1
elif localAvatar.guiMgr.combatTray.skillDisabled(skillId):
greyOut = 1
rep = WeaponGlobals.getSkillReputationCategoryId(skillId)
if rep == InventoryType.DollRep:
haveFriendly = localAvatar.getFriendlyStickyTargets()
haveHostile = localAvatar.getHostileStickyTargets()
if haveFriendly and not haveHostile:
if not WeaponGlobals.isFriendlyFire(skillId):
greyOut = 1
elif not haveFriendly and haveHostile:
if WeaponGlobals.isFriendlyFire(skillId):
greyOut = 1
if self.tray[i + 1].greyOut != greyOut:
if hasattr(self.tray[i + 1], 'skillButton'):
self.tray[i + 1].greyOut = greyOut
if greyOut == 1:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
if self.tray[i + 1].showRing:
self.tray[i + 1].skillRing.meterFaceHalf1.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
self.tray[i + 1].skillRing.meterFaceHalf2.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
elif greyOut == 2:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
elif greyOut == 3:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
else:
self.tray[i + 1].setGeomColor(1, 1, 1, 1)
if self.tray[i + 1].showRing:
self.tray[i + 1].skillRing.meterFaceHalf1.clearColorScale()
self.tray[i + 1].skillRing.meterFaceHalf2.clearColorScale()
if self.isPowerRecharged:
self.continuePowerRechargeEffect()
continue
示例8: updateSkillTray
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def updateSkillTray(self, rep, weaponMode, callback = None, hideFirst = True):
if rep == InventoryType.MeleeRep:
return None
if not callback:
callback = localAvatar.guiMgr.combatTray.triggerSkillTraySkill
if taskMgr.hasTaskNamed('updateSkillTray'):
taskMgr.remove('updateSkillTray')
if self.skillTrayState and hideFirst:
self.hideSkillTray()
taskMgr.doMethodLater(0.75, self.updateSkillTray, 'updateSkillTray', extraArgs = [
rep,
weaponMode,
callback])
return None
text = PLocalizer.InventoryTypeNames.get(rep, 'Unknown')
for i in range(self.numberOfItems):
self.tray[i + 1].destroy()
self.tray = { }
if self.repMeter:
self.repMeter.destroy()
self.rep = rep
self.weaponMode = weaponMode
self.callback = callback
linkedSkillIds = { }
linkedSkills = ItemGlobals.getLinkedSkills(localAvatar.currentWeaponId)
for skillId in linkedSkills:
realSkillId = WeaponGlobals.getLinkedSkillId(skillId)
linkedSkillIds[realSkillId] = skillId
skillMap = []
self.origMap = getAllSkills(self.rep, 2, wantWeaponSkill = 1)
for i in range(len(self.origMap)):
skillMap.append(self.origMap[i][0])
self.traySkillMap = skillMap
self.numberOfItems = len(self.traySkillMap)
self.skillTray.setX(0)
if self.rep != InventoryType.DefenseCannonRep:
self.repMeter = ReputationMeter(self.rep, width = 0.69999999999999996)
self.repMeter.setScale(1.1499999999999999, 1.1499999999999999, 1.1499999999999999)
self.repMeter.reparentTo(self.skillTray)
self.repMeter.setCategory(self.rep)
inv = base.localAvatar.getInventory()
if inv is None:
return None
if self.repMeter:
self.repMeter.update(inv.getReputation(self.rep))
x = 0.0
offset = 0.0
for i in range(self.numberOfItems):
if self.origMap[i][1] == False:
locked = False
if locked:
image = (self.SkillIcons.find('**/base'), self.SkillIcons.find('**/base_down'), self.SkillIcons.find('**/base_over'))
else:
image = self.SkillIcons.find('**/base')
button = DirectButton(parent = self.skillTray, relief = None, state = DGG.DISABLED, image = image, image_pos = (0.0, 0.0, 0.059999999999999998), image_scale = 0.12, image_color = (0.20000000000000001, 0.20000000000000001, 0.20000000000000001, 0.55000000000000004), sortOrder = 100, pos = (x, 0, -0.0))
button.setTransparency(1)
button.showQuantity = False
button.greyOut = -1
button.showRing = False
button.skillStatus = False
if locked:
lock = DirectFrame(parent = button, relief = None, image = self.lockArt, image_scale = 0.14000000000000001, image_pos = (0.050000000000000003, 0, 0.035000000000000003))
button['state'] = DGG.NORMAL
button['command'] = base.localAvatar.guiMgr.showNonPayer
button['extraArgs'] = [
'Restricted_Radial_Menu',
5]
self.tray[i + 1] = button
x = x + 0.14999999999999999
if i < self.numberOfItems - 1:
offset = offset + 0.01
self.skillTray.setX(self.skillTray.getX() - 0.074999999999999997)
i < self.numberOfItems - 1
if self.origMap[i][1] == True:
skillId = self.traySkillMap[i]
if linkedSkillIds.has_key(skillId):
skillId = linkedSkillIds[skillId]
name = PLocalizer.InventoryTypeNames[skillId]
hotkey = str(i + 1)
totalRechargeTime = base.cr.battleMgr.getModifiedRechargeTime(localAvatar, skillId)
timeSpentRecharging = localAvatar.skillDiary.getTimeSpentRecharging(skillId)
if not timeSpentRecharging:
timeSpentRecharging = 0
if weaponMode not in (WeaponGlobals.CANNON, WeaponGlobals.FIREARM, WeaponGlobals.GRENADE, WeaponGlobals.STAFF, WeaponGlobals.DEFENSE_CANNON) and skillId in WeaponGlobals.SpecialSkills or WeaponGlobals.getSkillReputationCategoryId(skillId) not in (InventoryType.PistolRep, InventoryType.WandRep, InventoryType.CannonRep, InventoryType.GrenadeRep, InventoryType.DefenseCannonRep):
showRing = True
#.........这里部分代码省略.........
示例9: checkComboExpired
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillReputationCategoryId [as 别名]
def checkComboExpired(self, avId, weaponId, skillId, skillResult):
attacker = base.cr.doId2do.get(avId)
if not attacker:
return 0
if skillId in self.EXCLUDED_SKILLS:
return 0
skillInfo = WeaponGlobals.getSkillAnimInfo(skillId)
if not skillInfo:
return 0
barTime = self.TimingCache.get(skillId, None)
if barTime is None:
anim = skillInfo[WeaponGlobals.PLAYABLE_INDEX]
skillAnim = getattr(base.cr.combatAnims, anim)(attacker, skillId, 0, 0, None, skillResult)
if skillAnim == None:
return 1
barTime = skillAnim.getDuration()
self.TimingCache[skillId] = barTime
curTime = globalClock.getFrameTime()
for attackerId in self.timers:
comboLength = len(self.timers[attackerId])
lastEntry = self.timers[attackerId][comboLength - 1]
lastSkillId = lastEntry[self.SKILLID_INDEX]
timestamp = lastEntry[self.TIMESTAMP_INDEX]
if (barTime + timestamp - curTime) + self.TOLERANCE > 0:
if attackerId != avId:
return 0
subtypeId = ItemGlobals.getSubtype(weaponId)
if not subtypeId:
return 0
repId = WeaponGlobals.getSkillReputationCategoryId(skillId)
if not repId:
return 0
if repId != WeaponGlobals.getRepId(weaponId):
return 0
comboChain = self.COMBO_ORDER.get(subtypeId)
if comboChain:
if skillId in self.SPECIAL_SKILLS.get(repId, []):
if lastSkillId not in self.SPECIAL_SKILLS.get(repId, []):
return 0
elif lastSkillId == skillId:
numHits = WeaponGlobals.getNumHits(skillId)
if comboLength < numHits:
return 0
elif comboLength >= numHits:
preMultihitEntry = self.timers[attackerId][comboLength - numHits]
preMultihitSkillId = preMultihitEntry[self.SKILLID_INDEX]
if preMultihitSkillId != skillId:
return 0
elif skillId in comboChain:
index = comboChain.index(skillId)
if index > 0:
requisiteAttack = comboChain[index - 1]
if lastSkillId == requisiteAttack:
return 0
currentAttack = comboChain[index]
if lastSkillId == skillId:
return 0
elif not comboLength:
return 0
return 1