本文整理汇总了Python中pirates.inventory.ItemGlobals.getGoldCost方法的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals.getGoldCost方法的具体用法?Python ItemGlobals.getGoldCost怎么用?Python ItemGlobals.getGoldCost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.inventory.ItemGlobals
的用法示例。
在下文中一共展示了ItemGlobals.getGoldCost方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cmp
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
def cmp(item1, item2):
goldCost1 = ItemGlobals.getGoldCost(item1[1])
if not goldCost1:
goldCost1 = item1[1]
goldCost2 = ItemGlobals.getGoldCost(item2[1])
if not goldCost2:
goldCost2 = item2[1]
return int(goldCost2 - goldCost1)
示例2: __init__
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
def __init__(self, uid):
SimpleItem.__init__(self, uid)
self.itemClass = EconomyGlobals.getItemCategory(uid)
self.itemType = EconomyGlobals.getItemType(uid)
self.cost = EconomyGlobals.getItemCost(uid)
if not self.cost:
self.cost = ItemGlobals.getGoldCost(uid)
示例3: loadData
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
def loadData(self):
itemId = self.data[0]
(item, quantity) = self.data
self.quantity = quantity
itemType = EconomyGlobals.getItemType(itemId)
if itemType <= ItemType.WAND:
itemTypeName = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
else:
itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType)
if itemType <= ItemType.WAND or itemType == ItemType.POTION:
name = PLocalizer.getItemName(itemId)
self.price = ItemGlobals.getGoldCost(itemId)
else:
name = PLocalizer.InventoryTypeNames.get(item)
self.price = EconomyGlobals.getItemCost(item)
if self.sell:
self.price /= 2
if self.buy:
if itemType > ItemType.WAND and itemType != ItemType.POTION:
self.quantity = EconomyGlobals.getItemQuantity(itemId)
self.price *= self.quantity
self.price = int(self.price)
self.name = PLocalizer.makeHeadingString(name, 2)
self.itemType = itemTypeName
if itemType != ItemType.FISHING_LURE:
if itemType != ItemType.POTION:
self.minLvl = ItemGlobals.getWeaponRequirement(itemId)
else:
self.minLvl = 0
else:
self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
示例4: calculateTotalGoldValue
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
def calculateTotalGoldValue(self):
totalCost = 0
for cell in self.gridDict.values():
if cell.inventoryItem:
totalCost += ItemGlobals.getGoldCost(cell.inventoryItem.getId()) * cell.inventoryItem.amount
return totalCost
示例5: getGivingItems
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
def getGivingItems(self, items):
weapons = []
clothes = []
consumables = []
givingItems = []
extraItems = []
inventory = base.localAvatar.getInventory()
if inventory:
for item in items:
if item[0] in (InventoryType.ItemTypeWeapon, InventoryType.ItemTypeCharm):
weapons.append([
ItemGlobals.getGoldCost(item[0]),
item])
if item[0] == InventoryType.ItemTypeClothing:
clothes.append([
ItemGlobals.getGoldCost(item[0]),
item])
if item[0] == InventoryType.ItemTypeConsumable:
consumables.append([
ItemGlobals.getGoldCost(item[0]),
item])
givingItems.append(item)
weapons.sort()
clothes.sort()
consumables.sort()
locatables = []
for weapon in weapons:
locatables.append(InvItem([
weapon[1][0],
weapon[1][1],
0]))
invalidLocations = 0
locationIds = inventory.canAddLocatables(locatables)
for locationId in locationIds:
if locationId in (Locations.INVALID_LOCATION, Locations.NON_LOCATION):
invalidLocations += 1
for i in range(0, invalidLocations):
extraItems.append(weapons[i][1])
for i in range(invalidLocations, len(weapons)):
givingItems.append(weapons[i][1])
locatables = []
for cloth in clothes:
locatables.append(InvItem([
cloth[1][0],
cloth[1][1],
0,
0]))
invalidLocations = 0
locationIds = inventory.canAddLocatables(locatables)
for locationId in locationIds:
if locationId in (Locations.INVALID_LOCATION, Locations.NON_LOCATION):
invalidLocations += 1
for i in range(0, invalidLocations):
extraItems.append(clothes[i][1])
for i in range(invalidLocations, len(clothes)):
givingItems.append(clothes[i][1])
locatables = []
for consumable in consumables:
locatables.append(InvItem([
consumable[1][0],
consumable[1][1],
0,
0]))
invalidLocations = 0
locationIds = inventory.canAddLocatables(locatables)
for locationId in locationIds:
if locationId in (Locations.INVALID_LOCATION, Locations.NON_LOCATION):
invalidLocations += 1
for i in range(0, invalidLocations):
extraItems.append(consumables[i][1])
for i in range(invalidLocations, len(consumables)):
givingItems.append(consumables[i][1])
return (givingItems, extraItems)
示例6: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
#.........这里部分代码省略.........
offsetZ = -leftIndexHeight + handOffset - bodyHeight * 0.5
if bodyShape == 4:
offsetX = -1.0
offsetY = 1.75 + bodyOffset
elif bodyShape == 3:
offsetX = -0.69999999999999996
offsetY = 1.25 + bodyOffset
elif bodyShape == 1:
offsetX = -0.69999999999999996
offsetY = 1.25 + bodyOffset
elif bodyShape == 0:
offsetX = -0.69999999999999996
offsetY = 1.25 + bodyOffset
else:
offsetX = -0.80000000000000004
offsetY = 1.25 + bodyOffset
offsetH = 160
else:
offsetZ = 0.0
offsetY = 0.0
offsetX = 0.0
offsetH = 0
self.displayHuman.setY(offsetY)
self.displayHuman.setZ(offsetZ)
self.displayHuman.setX(offsetX)
self.displayHuman.setH(offsetH)
self.displayHuman.reparentTo(self.portraitSceneGraph)
iHeight = 0.17999999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
itemCost = int(ItemGlobals.getGoldCost(itemId))
if self.cell and self.cell.container:
itemCost = int(itemCost * self.cell.container.getItemPriceMult())
goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(itemCost), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
labels.append(goldLabel)
descriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemFlavorText(itemId), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_fg = PiratesGuiGlobals.TextFG0, text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
dHeight = descriptionLabel.getHeight() + 0.02
runningVertPosition -= dHeight
runningSize += dHeight
labels.append(descriptionLabel)
if not Freebooter.getPaidStatus(localAvatar.getDoId()):
if rarity != ItemGlobals.CRUDE:
unlimitedLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.UnlimitedAccessRequirement, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = PiratesGuiGlobals.TextFG6, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
uHeight = unlimitedLabel.getHeight()
runningVertPosition -= uHeight
runningSize += uHeight
labels.append(unlimitedLabel)
runningVertPosition -= 0.02
runningSize += 0.02
panels = self.helpFrame.attachNewNode('panels')
topPanel = panels.attachNewNode('middlePanel')
detailGui.find('**/top_panel').copyTo(topPanel)
topPanel.setScale(0.080000000000000002)
topPanel.reparentTo(self.helpFrame)
middlePanel = panels.attachNewNode('middlePanel')
detailGui.find('**/middle_panel').copyTo(middlePanel)
middlePanel.setScale(0.080000000000000002)
middlePanel.reparentTo(self.helpFrame)
placement = 0
i = 0
示例7: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
#.........这里部分代码省略.........
offsetZ = -leftShoulderHeight + 1.2 + armOffset - bodyHeight * 0.80000000000000004
offsetX = 0.0
offsetY = 2.0 + bodyOffset
else:
offsetZ = -leftShoulderHeight + 0.45000000000000001 + armOffset - bodyHeight * 0.80000000000000004
if bodyShape == 4:
offsetY = 2.5 + bodyOffset
else:
offsetY = 2.0 + bodyOffset
offsetX = -0.20000000000000001
offsetH = 105
elif tattooType == TattooGlobals.ZONE4:
self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_head01').getNetTransform(m)
headHeight = TransformState.makeMat(m).getPos().getZ()
offsetZ = (-headHeight - 0.10000000000000001) + headOffset - bodyHeight * 1.1000000000000001
offsetX = 0.0
offsetY = 1.5 + bodyOffset
offsetH = 180
else:
offsetZ = 0
offsetY = 0
offsetX = 0
offsetH = 0
self.displayHuman.setY(offsetY)
self.displayHuman.setZ(offsetZ)
self.displayHuman.setX(offsetX)
self.displayHuman.setH(offsetH)
iHeight = 0.17999999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(int(ItemGlobals.getGoldCost(itemId) * ItemGlobals.GOLD_SALE_MULTIPLIER)), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
labels.append(goldLabel)
descriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemFlavorText(itemId), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_fg = PiratesGuiGlobals.TextFG0, text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
dHeight = descriptionLabel.getHeight() + 0.02
runningVertPosition -= dHeight
runningSize += dHeight
labels.append(descriptionLabel)
if not Freebooter.getPaidStatus(localAvatar.getDoId()):
if rarity != ItemGlobals.CRUDE:
unlimitedLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.UnlimitedAccessRequirement, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = PiratesGuiGlobals.TextFG6, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
uHeight = unlimitedLabel.getHeight()
runningVertPosition -= uHeight
runningSize += uHeight
labels.append(unlimitedLabel)
runningVertPosition -= 0.02
runningSize += 0.02
panels = self.helpFrame.attachNewNode('panels')
topPanel = panels.attachNewNode('middlePanel')
detailGui.find('**/top_panel').copyTo(topPanel)
topPanel.setScale(0.080000000000000002)
topPanel.reparentTo(self.helpFrame)
middlePanel = panels.attachNewNode('middlePanel')
detailGui.find('**/middle_panel').copyTo(middlePanel)
middlePanel.setScale(0.080000000000000002)
middlePanel.reparentTo(self.helpFrame)
placement = 0
i = 0
heightMax = -0.080000000000000002
currentHeight = runningVertPosition
if detailsHeight:
currentHeight = -detailsHeight
示例8: createHelpbox
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
#.........这里部分代码省略.........
elif itemType == ItemGlobals.GUN:
self.realItem.setPos(-0.5, 2.0, -0.20000000000000001)
self.realItem.setHpr(0, 90, 0)
elif itemType == ItemGlobals.DOLL:
self.realItem.setPos(0.0, 1.8999999999999999, -0.10000000000000001)
self.realItem.setHpr(0, 90, 180)
elif itemType == ItemGlobals.DAGGER:
self.realItem.setPos(-1.0, 2.0, -0.29999999999999999)
self.realItem.setHpr(90, 170, -90)
elif itemType == ItemGlobals.GRENADE:
self.realItem.setPos(0.0, 3.5, -0.20000000000000001)
self.realItem.setHpr(0, 0, 0)
elif itemType == ItemGlobals.STAFF:
self.realItem.setPos(-0.40000000000000002, 3.0, -0.29999999999999999)
self.realItem.setHpr(-90, 15, -90)
elif itemSubtype == ItemGlobals.RAM:
self.realItem.setPos(-1.5, 1.5, -0.59999999999999998)
self.realItem.setHpr(70, 160, -90)
elif itemType == ItemGlobals.POTION:
self.realItem.setPos(0.0, 2.5, -0.40000000000000002)
self.realItem.setHpr(45, 0, 0)
else:
self.realItem.setPos(0.0, 1.5, -0.059999999999999998)
self.realItem.setHpr(0, 90, 0)
self.realItem.reparentTo(self.portraitSceneGraph)
iHeight = 0.17499999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(int(ItemGlobals.getGoldCost(itemId) * ItemGlobals.GOLD_SALE_MULTIPLIER)), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
labels.append(goldLabel)
infoText = PLocalizer.ItemAttackStrength % '\x01%s\x01%s\x02' % (itemColor, ItemGlobals.getPower(itemId))
if itemType == ItemGlobals.GUN:
infoText += ' %s' % PLocalizer.ItemBarrels % '\x01%s\x01%s\x02' % (itemColor, ItemGlobals.getBarrels(itemId))
infoText += ' %s' % PLocalizer.ItemRangeStrength % '\x01%s\x01%s\x02' % (itemColor, PLocalizer.getItemRangeName(WeaponGlobals.getRange(itemId)))
if itemType != ItemGlobals.POTION:
infoLabel = DirectLabel(parent = self, relief = None, text = infoText, text_scale = textScale, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
iHeight = 0.080000000000000002
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(infoLabel)
specialAttack = None
if itemType != ItemGlobals.POTION:
specialAttack = ItemGlobals.getSpecialAttack(itemId)
if specialAttack:
attackIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(specialAttack))
specialAttackNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.10000000000000001, geom = attackIcon, geom_scale = 0.10000000000000001, image_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), geom_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), text = PLocalizer.getInventoryTypeName(specialAttack), text_scale = PiratesGuiGlobals.TextScaleLarge, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, text_fg = titleColor, text_font = PiratesGlobals.getInterfaceOutlineFont(), text_shadow = PiratesGuiGlobals.TextShadow, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
specialAttackRankLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.ItemRank % ItemGlobals.getSpecialAttackRank(itemId), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ARight, pos = (halfWidth - textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
specialAttackType = WeaponGlobals.getSkillTrack(specialAttack)
if specialAttackType == WeaponGlobals.BREAK_ATTACK_SKILL_INDEX:
specialAttackTypeText = PLocalizer.BreakAttackSkill
elif specialAttackType == WeaponGlobals.DEFENSE_SKILL_INDEX:
specialAttackTypeText = PLocalizer.DefenseSkill
else:
specialAttackTypeText = PLocalizer.WeaponSkill
specialAttackTypeLabel = DirectLabel(parent = self, relief = None, text = specialAttackTypeText, text_scale = 0.033500000000000002, text_wordwrap = halfWidth * 2.7999999999999998 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition - PiratesGuiGlobals.TextScaleLarge), text_pos = (0.0, -textScale))
specialAttackInfo = PLocalizer.SkillDescriptions.get(specialAttack)
specialAttackDescriptionText = specialAttackInfo[1]
specialAttackDescriptionLabel = DirectLabel(parent = self, relief = None, text = specialAttackDescriptionText, text_scale = textScale, text_wordwrap = halfWidth * 2.7999999999999998 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition - specialAttackNameLabel.getHeight() + specialAttackTypeLabel.getHeight() - 0.059999999999999998), text_pos = (0.0, -textScale))
示例9: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
def showDetails(self, cell, detailsPos, detailsHeight, event = None):
self.notify.debug('Item showDetails')
if self.manager.heldItem and self.manager.locked and cell.isEmpty() and self.isEmpty() or not (self.itemTuple):
self.notify.debug(' early exit')
return None
itemId = self.getId()
self.helpFrame = DirectFrame(parent = self.manager, relief = None, state = DGG.DISABLED, sortOrder = 1)
self.helpFrame.setBin('gui-popup', -5)
detailGui = loader.loadModel('models/gui/gui_card_detail')
topGui = loader.loadModel('models/gui/toplevel_gui')
coinImage = topGui.find('**/treasure_w_coin*')
self.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
self.BuffIcons = loader.loadModel('models/textureCards/buff_icons')
border = self.SkillIcons.find('**/base')
halfWidth = 0.29999999999999999
halfHeight = 0.20000000000000001
basePosX = cell.getX(aspect2d)
basePosZ = cell.getZ(aspect2d)
cellSizeX = 0.0
cellSizeZ = 0.0
if cell:
cellSizeX = cell.cellSizeX
cellSizeZ = cell.cellSizeZ
textScale = PiratesGuiGlobals.TextScaleMed
titleScale = PiratesGuiGlobals.TextScaleTitleSmall
if len(self.getName()) >= 30:
titleNameScale = PiratesGuiGlobals.TextScaleLarge
else:
titleNameScale = PiratesGuiGlobals.TextScaleExtraLarge
subtitleScale = PiratesGuiGlobals.TextScaleMed
iconScalar = 1.5
borderScaler = 0.25
splitHeight = 0.01
vMargin = 0.029999999999999999
runningVertPosition = 0.29999999999999999
runningSize = 0.0
labels = []
titleColor = PiratesGuiGlobals.TextFG6
rarity = ItemGlobals.getRarity(itemId)
rarityText = PLocalizer.getItemRarityName(rarity)
subtypeText = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
if rarity == ItemGlobals.CRUDE:
titleColor = PiratesGuiGlobals.TextFG24
elif rarity == ItemGlobals.COMMON:
titleColor = PiratesGuiGlobals.TextFG13
elif rarity == ItemGlobals.RARE:
titleColor = PiratesGuiGlobals.TextFG4
elif rarity == ItemGlobals.FAMED:
titleColor = PiratesGuiGlobals.TextFG5
titleLabel = DirectLabel(parent = self, relief = None, text = self.getName(), text_scale = titleNameScale, text_fg = titleColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
self.bg.setColor(titleColor)
tHeight = 0.070000000000000007
titleLabel.setZ(runningVertPosition)
runningVertPosition -= tHeight
runningSize += tHeight
labels.append(titleLabel)
subtitleLabel = DirectLabel(parent = self, relief = None, text = 'slant%s %s' % (rarityText, subtypeText), text_scale = subtitleScale, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
subtHeight = 0.050000000000000003
subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
runningVertPosition -= subtHeight
runningSize += subtHeight
labels.append(subtitleLabel)
itemType = ItemGlobals.getType(itemId)
itemSubtype = ItemGlobals.getSubtype(itemId)
model = ItemGlobals.getModel(itemId)
skillIcons = loader.loadModel('models/textureCards/skillIcons')
if itemSubtype == ItemGlobals.POTION_BUFF:
self.iconLabel = DirectLabel(parent = self.portraitSceneGraph, relief = None, image = skillIcons.find('**/%s' % ItemGlobals.getIcon(itemId)), pos = (0.0, 2.5, 0.0))
elif model:
self.realItem = loader.loadModel('models/inventory/' + model, okMissing = True)
if not self.realItem:
self.realItem = loader.loadModel('models/handheld/' + model)
if self.realItem:
posHpr = ItemGlobals.getModelPosHpr(model)
if posHpr:
self.realItem.setPos(posHpr[0], posHpr[1], posHpr[2])
self.realItem.setHpr(posHpr[3], posHpr[4], posHpr[5])
else:
self.realItem.setPos(0.0, 2.5, -0.40000000000000002)
self.realItem.setHpr(45, 0, 0)
self.realItem.reparentTo(self.portraitSceneGraph)
iHeight = 0.17999999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(int(ItemGlobals.getGoldCost(itemId) * ItemGlobals.GOLD_SALE_MULTIPLIER)), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
labels.append(goldLabel)
if ItemGlobals.getSubtype(itemId) == 30:
duration = PotionGlobals.getPotionBuffDuration(WeaponGlobals.getSkillEffectFlag(ItemGlobals.getUseSkill(itemId)))
if duration >= 3600:
duration = duration / 3600
if duration == 1:
#.........这里部分代码省略.........
示例10: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
#.........这里部分代码省略.........
kneeHeight = TransformState.makeMat(m).getPos().getZ()
offsetZ = -kneeHeight + pantOffset - 0.5 - bodyHeight * 0.29999999999999999
offsetY = 4.5 + bodyOffset
offsetH = 200
elif clothingType == ClothingGlobals.BELT:
self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_hips').getNetTransform(m)
hipHeight = TransformState.makeMat(m).getPos().getZ()
offsetZ = -hipHeight + beltOffset - bodyHeight * 0.5
offsetY = 1.7 + bodyOffset
offsetH = 180
elif clothingType == ClothingGlobals.SHOE:
self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_right_ankle').getNetTransform(m)
ankleHeight = TransformState.makeMat(m).getPos().getZ()
offsetZ = -ankleHeight + shoeOffset - 0.14999999999999999 - bodyHeight * -0.10000000000000001
offsetY = 3.25 + bodyOffset
offsetH = 200
else:
offsetZ = 0
offsetY = 0
offsetH = 0
offsetX = 0
self.displayHuman.setY(offsetY)
self.displayHuman.setZ(offsetZ)
self.displayHuman.setX(offsetX)
self.displayHuman.setH(offsetH)
self.displayHuman.reparentTo(self.portraitSceneGraph)
iHeight = 0.17999999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
if self.showResaleValue:
value = int(ItemGlobals.getGoldCost(itemId) * ItemGlobals.GOLD_SALE_MULTIPLIER)
else:
value = ItemGlobals.getGoldCost(itemId)
itemCost = int(ItemGlobals.getGoldCost(itemId))
if self.cell and self.cell.container:
itemCost = int(itemCost * self.cell.container.getItemPriceMult())
goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(itemCost), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
labels.append(goldLabel)
descriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemFlavorText(itemId), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_fg = PiratesGuiGlobals.TextFG0, text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
dHeight = descriptionLabel.getHeight() + 0.02
runningVertPosition -= dHeight
runningSize += dHeight
labels.append(descriptionLabel)
if not Freebooter.getPaidStatus(localAvatar.getDoId()):
if rarity != ItemGlobals.CRUDE:
unlimitedLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.UnlimitedAccessRequirement, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = PiratesGuiGlobals.TextFG6, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
uHeight = unlimitedLabel.getHeight()
runningVertPosition -= uHeight
runningSize += uHeight
labels.append(unlimitedLabel)
runningVertPosition -= 0.02
runningSize += 0.02
panels = self.helpFrame.attachNewNode('panels')
topPanel = panels.attachNewNode('middlePanel')
detailGui.find('**/top_panel').copyTo(topPanel)
topPanel.setScale(0.080000000000000002)
topPanel.reparentTo(self.helpFrame)
middlePanel = panels.attachNewNode('middlePanel')
detailGui.find('**/middle_panel').copyTo(middlePanel)
middlePanel.setScale(0.080000000000000002)
示例11: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getGoldCost [as 别名]
def showDetails(self, cell, detailsPos, detailsHeight, event = None):
self.notify.debug('Item showDetails')
if self.manager.heldItem and self.manager.locked and cell.isEmpty() and self.isEmpty() or not (self.itemTuple):
self.notify.debug(' early exit')
return None
inv = localAvatar.getInventory()
if not inv:
return None
itemId = self.getId()
self.helpFrame = DirectFrame(parent = self.manager, relief = None, state = DGG.DISABLED, sortOrder = 1)
self.helpFrame.setBin('gui-popup', -5)
detailGui = loader.loadModel('models/gui/gui_card_detail')
topGui = loader.loadModel('models/gui/toplevel_gui')
coinImage = topGui.find('**/treasure_w_coin*')
self.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
self.BuffIcons = loader.loadModel('models/textureCards/buff_icons')
border = self.SkillIcons.find('**/base')
halfWidth = 0.29999999999999999
halfHeight = 0.20000000000000001
basePosX = cell.getX(aspect2d)
basePosZ = cell.getZ(aspect2d)
cellSizeX = 0.0
cellSizeZ = 0.0
if cell:
cellSizeX = cell.cellSizeX
cellSizeZ = cell.cellSizeZ
textScale = PiratesGuiGlobals.TextScaleMed
titleScale = PiratesGuiGlobals.TextScaleTitleSmall
if len(self.getName()) >= 30:
titleNameScale = PiratesGuiGlobals.TextScaleLarge
else:
titleNameScale = PiratesGuiGlobals.TextScaleExtraLarge
subtitleScale = PiratesGuiGlobals.TextScaleMed
iconScalar = 1.5
borderScaler = 0.25
splitHeight = 0.01
vMargin = 0.029999999999999999
runningVertPosition = 0.29999999999999999
runningSize = 0.0
labels = []
titleColor = PiratesGuiGlobals.TextFG6
rarity = ItemGlobals.getRarity(itemId)
rarityText = PLocalizer.getItemRarityName(rarity)
subtypeText = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
if rarity == ItemGlobals.CRUDE:
titleColor = PiratesGuiGlobals.TextFG24
elif rarity == ItemGlobals.COMMON:
titleColor = PiratesGuiGlobals.TextFG13
elif rarity == ItemGlobals.RARE:
titleColor = PiratesGuiGlobals.TextFG4
elif rarity == ItemGlobals.FAMED:
titleColor = PiratesGuiGlobals.TextFG5
titleLabel = DirectLabel(parent = self, relief = None, text = self.getName(), text_scale = titleNameScale, text_fg = titleColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
self.bg.setColor(titleColor)
tHeight = 0.070000000000000007
titleLabel.setZ(runningVertPosition)
runningVertPosition -= tHeight
runningSize += tHeight
labels.append(titleLabel)
subtitleLabel = DirectLabel(parent = self, relief = None, text = 'slant%s %s' % (rarityText, subtypeText), text_scale = subtitleScale, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
subtHeight = 0.050000000000000003
subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
runningVertPosition -= subtHeight
runningSize += subtHeight
labels.append(subtitleLabel)
itemType = ItemGlobals.getType(itemId)
itemSubtype = ItemGlobals.getSubtype(itemId)
model = ItemGlobals.getModel(itemId)
if model:
self.realItem = loader.loadModel('models/inventory/' + model)
if self.realItem:
posHpr = ItemGlobals.getModelPosHpr(model)
if posHpr:
self.realItem.setPos(posHpr[0], posHpr[1], posHpr[2])
self.realItem.setHpr(posHpr[3], posHpr[4], posHpr[5])
elif itemSubtype == ItemGlobals.RAM:
self.realItem.setPos(-1.5, 1.5, -0.59999999999999998)
self.realItem.setHpr(70, 160, -90)
else:
self.realItem.setPos(0.0, 1.5, -0.059999999999999998)
self.realItem.setHpr(0, 90, 0)
self.realItem.reparentTo(self.portraitSceneGraph)
iHeight = 0.17999999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(int(ItemGlobals.getGoldCost(itemId) * ItemGlobals.GOLD_SALE_MULTIPLIER)), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
labels.append(goldLabel)
specialAttack = ItemGlobals.getSpecialAttack(itemId)
if specialAttack:
attackIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(specialAttack))
specialAttackNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.10000000000000001, geom = attackIcon, geom_scale = 0.10000000000000001, image_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), geom_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), text = PLocalizer.getInventoryTypeName(specialAttack), text_scale = PiratesGuiGlobals.TextScaleLarge, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, text_fg = titleColor, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
#.........这里部分代码省略.........