本文整理汇总了Python中pirates.inventory.ItemGlobals.getAllHealthIds方法的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals.getAllHealthIds方法的具体用法?Python ItemGlobals.getAllHealthIds怎么用?Python ItemGlobals.getAllHealthIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.inventory.ItemGlobals
的用法示例。
在下文中一共展示了ItemGlobals.getAllHealthIds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateTonics
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getAllHealthIds [as 别名]
def updateTonics(self):
if not hasattr(base, 'localAvatar'):
return None
inv = localAvatar.getInventory()
if not inv:
return None
possibleTonics = ItemGlobals.getAllHealthIds()
for tonicId in possibleTonics:
tonicAmt = inv.getItemQuantity(InventoryType.ItemTypeConsumable, tonicId)
if self.tonicButtons.has_key(tonicId):
self.tonicButtons[tonicId].updateQuantity(tonicAmt)
self.tonicButtons[tonicId].checkAmount()
continue
示例2: rePanel
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getAllHealthIds [as 别名]
def rePanel(self, inventory):
if not self.showing:
self.needRefresh = 1
return None
skillTokens = {
InventoryType.CutlassToken: (ItemGlobals.RUSTY_CUTLASS,),
InventoryType.PistolToken: (ItemGlobals.FLINTLOCK_PISTOL,),
InventoryType.DollToken: (ItemGlobals.VOODOO_DOLL,),
InventoryType.DaggerToken: (ItemGlobals.BASIC_DAGGER,),
InventoryType.GrenadeToken: (ItemGlobals.GRENADE_POUCH,),
InventoryType.WandToken: (ItemGlobals.CURSED_STAFF,) }
zIndex = 1
for skillTokenKey in TOKEN_LIST:
quantity = 0
if localAvatar.getInventory().stacks.get(skillTokenKey):
quantity = 1
skillData = skillTokens[skillTokenKey]
weaponId = skillData[0]
key = None
panel = WeaponPanel.WeaponPanel((weaponId, quantity), key)
panel.reparentTo(self)
panel.setZ(PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999 - zIndex * panel.height)
zIndex += 1
repCat = WeaponGlobals.getRepId(weaponId)
self.weaponPanels[repCat] = panel
self.ignore('inventoryQuantity-%s' % inventory.getDoId())
self.acceptOnce('inventoryQuantity-%s-%s' % (inventory.getDoId(), skillTokenKey), self.refreshList)
repIcon_gui = loader.loadModel('models/textureCards/skillIcons')
repIcon = repIcon_gui.find('**/box_base')
if config.GetBool('want-fishing-game', 0):
self.fishingIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.FishingRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
fishIconCard = loader.loadModel('models/textureCards/fishing_icons')
inv = localAvatar.getInventory()
fishingChangeMsg = InventoryGlobals.getCategoryQuantChangeMsg(inv.doId, InventoryType.FishingRod)
if self.fishingChangeMsg:
self.ignore(fishingChangeMsg)
self.fishingChangeMsg = fishingChangeMsg
self.acceptOnce(fishingChangeMsg, self.refreshList)
rodIcons = [
'pir_t_gui_fsh_smRodIcon',
'pir_t_gui_fsh_mdRodIcon',
'pir_t_gui_fsh_lgRodIcon']
rodLvl = inv.getStackQuantity(InventoryType.FishingRod)
rodIcon = rodIcons[rodLvl - 1]
rodText = PLocalizer.FishingRodNames[rodLvl]
if rodLvl >= 1:
self.fishingIcon['geom'] = fishIconCard.find('**/' + rodIcon)
self.fishingIcon['geom_scale'] = 0.10000000000000001
self.fishingIcon['geom_pos'] = (0, 0, 0)
self.fishingIcon.reparentTo(self)
fishingRepValue = localAvatar.getInventory().getReputation(InventoryType.FishingRep)
self.fishingRepMeter = ReputationMeter(InventoryType.FishingRep, width = 0.66000000000000003)
self.fishingRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
self.fishingRepMeter.update(fishingRepValue)
self.fishingRepMeter.reparentTo(self)
self.fishingRepMeter.flattenLight()
self.fishingPoleName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = rodText, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - 7 * panel.height), text_font = PiratesGlobals.getInterfaceFont())
self.fishingPoleName.reparentTo(self)
zIndex += 1
iconCard = loader.loadModel('models/textureCards/skillIcons')
if config.GetBool('want-potion-game', 0):
self.potionIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.PotionRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
self.potionIcon['geom'] = iconCard.find('**/pir_t_gui_pot_base')
self.potionIcon['geom_scale'] = 0.10000000000000001
self.potionIcon['geom_pos'] = (0, 0, 0)
self.potionIcon.reparentTo(self)
potionRepValue = localAvatar.getInventory().getReputation(InventoryType.PotionsRep)
self.potionRepMeter = ReputationMeter(InventoryType.PotionsRep, width = 0.66000000000000003)
self.potionRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
self.potionRepMeter.update(potionRepValue)
self.potionRepMeter.reparentTo(self)
self.potionRepMeter.flattenLight()
zIndex += 1
items = dict(map(lambda x: (x.getType(), x.getCount()), inventory.getConsumables().values()))
possibleItems = ItemGlobals.getAllHealthIds()
havePorky = items.get(ItemGlobals.ROAST_PORK)
if not havePorky and ItemGlobals.ROAST_PORK in possibleItems:
possibleItems.remove(ItemGlobals.ROAST_PORK)
offset = 0
if base.config.GetBool('want-potion-game', 0):
items = inventory.getConsumables()
listLength = len(InventoryType.PotionMinigamePotions)
count = 0
for i in range(listLength):
tonicId = InventoryType.PotionMinigamePotions[i]
if items.get(tonicId):
button = SkillButton(tonicId, self.tonicCallback, items.get(tonicId), showQuantity = True, showHelp = True, showRing = True)
button.skillButton['geom_scale'] = 0.080000000000000002
x = 0.16 * (count % 6) + -1.2
z = 1.0 - int(count / 6) * 0.16
button.setPos(x, 0, z)
button.reparentTo(self)
#.........这里部分代码省略.........