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])
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])
def getName(self): itemTypeName = PLocalizer.getItemName(self.getId()) clothingName = PLocalizer.TailorColorStrings.get(self.getColorId()) if ItemGlobals.canDyeItem(self.getId()): return clothingName + ' ' + itemTypeName else: return itemTypeName
def __init__(self, uid): self.uid = uid self.itemName = PLocalizer.getItemName(uid) self.shortDesc = PLocalizer.getItemName(uid) self.longDesc = PLocalizer.getItemFlavorText(uid) self.text = None self.modelId = None self.texId = None self.colorId = 0 self.holidayId = None self.icon = None self.iconScale = 1.0 self.iconHpr = (0, 0, 0) if self.checkStackable(): self.quantity = EconomyGlobals.getItemQuantity(self.uid) else: self.quantity = 1
def getName(self): return PLocalizer.getItemName(self.itemTuple[1])
def getName(self): return PLocalizer.getItemName(self.getId())
def showLoot(self, plunder=[], gold=0, collect=0, card=0, cloth=0, color=0, jewel=None, tattoo=None, weapon=None, bounty=0): for loot in self.loot: loot.destroy() del loot self.loot = [] gender = localAvatar.style.getGender() self.show() self.setAlphaScale(1.0) treasure = [] for itemId in self.icons.iterkeys(): count = 0 for item in plunder: if item == itemId: count += 1 continue if count > 0: treasure.append([itemId, count]) continue plunder = treasure if gold: plunder.append([ItemId.GOLD, gold]) LootPopupPanel.lootSfx.play() if bounty: plunder.append([ItemId.BOUNTY, bounty]) LootPopupPanel.lootSfx.play() if collect: plunder.append([ItemId.COLLECT, collect]) LootPopupPanel.lootSfx.play() if card: plunder.append([ItemId.CARD, card]) LootPopupPanel.lootSfx.play() if cloth: plunder.append([ItemId.CLOTHING, (cloth, color)]) LootPopupPanel.lootSfx.play() if jewel is not None: plunder.append([ItemId.QUEST_DROP_JEWEL, jewel]) LootPopupPanel.lootSfx.play() if tattoo is not None: plunder.append([ItemId.QUEST_DROP_TATTOO, tattoo]) LootPopupPanel.lootSfx.play() if weapon is not None: plunder.append([ItemId.QUEST_DROP_WEAPON, weapon]) LootPopupPanel.lootSfx.play() for item in plunder: (itemType, quantity) = item if itemType == ItemId.COLLECT: itemId = quantity howRare = CollectionMap.Collection_Rarity.get(itemId, 0) rarityText = PLocalizer.CollectionRarities.get(howRare) value = CollectionValues.get(howRare, 0) itemName = PLocalizer.Collections[itemId] howManyDoIHave = localAvatar.getInventory().getStackQuantity( itemId) howManyINeed = CollectionMap.Collection_Needed.get(itemId, 1) if howManyDoIHave < howManyINeed: textInfo = PLocalizer.CollectionPopupNewText % ( itemName, rarityText, value) else: textInfo = PLocalizer.CollectionPopupDuplicateText % ( itemName, rarityText, value) pic_name = CollectionMap.Assets[itemId] lootIcon = LootPopupPanel.TreasureGui.find('**/%s*' % pic_name) iconScale = 0.34999999999999998 elif itemType == ItemId.CLOTHING: (clothingId, colorId) = quantity if clothingId in ClothingGlobals.quest_items: textInfo = PLocalizer.getItemName(clothingId) else: textInfo = PLocalizer.TailorColorStrings.get(colorId) textInfo = textInfo + ' ' + ClothingGlobals.getClothingTypeName( ItemGlobals.getType(clothingId)) clothingType = ItemGlobals.getType(clothingId) iconScale = 0.13 if clothingType == 0: lootIcon = LootPopupPanel.TailorGui.find( '**/icon_shop_tailor_hat') elif clothingType == 1: lootIcon = loader.loadModel('models/gui/char_gui').find( '**/chargui_cloth') iconScale = 0.29999999999999999 elif clothingType == 2: lootIcon = LootPopupPanel.TailorGui.find( '**/icon_shop_tailor_vest') elif clothingType == 3: lootIcon = LootPopupPanel.TailorGui.find( '**/icon_shop_tailor_coat') elif clothingType == 4: lootIcon = LootPopupPanel.TailorGui.find( '**/icon_shop_tailor_pants') elif clothingType == 5: lootIcon = LootPopupPanel.TailorGui.find( '**/icon_shop_tailor_belt') elif clothingType == 6: lootIcon = LootPopupPanel.TailorGui.find( '**/icon_shop_tailor_sock') else: lootIcon = LootPopupPanel.TailorGui.find( '**/icon_shop_tailor_booths') elif itemType == ItemId.CARD: textInfo = PLocalizer.InventoryTypeNames.get(quantity) pic_name = '' lootIcon = PlayingCardGlobals.getImage( 'standard', PlayingCardGlobals.getSuit(quantity), PlayingCardGlobals.getRank(quantity)) iconScale = 0.20000000000000001 elif itemType == ItemId.GOLD: textInfo = PLocalizer.LootGold % str(quantity) potionPercent = PotionGlobals.getGoldBoostEffectPercent( localAvatar) potionGold = 0 textInfo = PLocalizer.LootGold % str(quantity) if base.cr.newsManager: if base.cr.newsManager.getHoliday( HolidayGlobals.DOUBLEGOLDHOLIDAYPAID ) or Freebooter.getPaidStatus(base.localAvatar.getDoId( )) or base.cr.newsManager.getHoliday( HolidayGlobals.DOUBLEGOLDHOLIDAY): textInfo = PLocalizer.LootGold % str( quantity / 2) + '\n + ' + PLocalizer.LootGoldDouble % str( quantity / 2) if potionGold > 0: textInfo += '\n + ' + PLocalizer.LootGoldPotionBoost % str( potionGold) lootIcon = self.icons.get(itemType)[0] iconScale = 0.27000000000000002 elif itemType == ItemId.BOUNTY: textInfo = PLocalizer.LootBounty % str(quantity) lootIcon = self.icons.get(itemType)[0] iconScale = 0.27000000000000002 elif itemType == ItemId.CARGO_CRATE: if quantity == 1: textInfo = PLocalizer.CargoCrate % quantity else: textInfo = PLocalizer.CargoCrateP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_CHEST: if quantity == 1: textInfo = PLocalizer.CargoChest % quantity else: textInfo = PLocalizer.CargoChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_SKCHEST: if quantity == 1: textInfo = PLocalizer.CargoSkChest % quantity else: textInfo = PLocalizer.CargoSkChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_LOOTSAC: if quantity == 1: textInfo = PLocalizer.LootSac % quantity else: textInfo = PLocalizer.LootSacP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_LOOTCHEST: if quantity == 1: textInfo = PLocalizer.LootChest % quantity else: textInfo = PLocalizer.LootChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_LOOTSKCHEST: if quantity == 1: textInfo = PLocalizer.LootSkChest % quantity else: textInfo = PLocalizer.LootSkChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_SHIPUPGRADECHEST: if quantity == 1: textInfo = PLocalizer.LootUpgradeChest % quantity else: textInfo = PLocalizer.LootUpgradeChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_SHIPUPGRADESKCHEST: if quantity == 1: textInfo = PLocalizer.LootRareUpgradeChest % quantity else: textInfo = PLocalizer.LootRareUpgradeChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.QUEST_DROP_JEWEL: textInfo = None type = None lootIcon = None iconScale = 1.0 type = ItemGlobals.getType(quantity) textInfo = PLocalizer.getItemName(quantity) if type == ItemGlobals.BROW: lootIcon = LootPopupPanel.JewelerIconsB.find( '**/icon_shop_tailor_brow') iconScale = (-0.14000000000000001, 0.14000000000000001, 0.14000000000000001) elif type == ItemGlobals.EAR: lootIcon = LootPopupPanel.JewelerIconsA.find( '**/chargui_ears') iconScale = (-0.34999999999999998, 0.34999999999999998, 0.34999999999999998) elif type == ItemGlobals.NOSE: lootIcon = LootPopupPanel.JewelerIconsA.find( '**/chargui_nose') iconScale = (0.34999999999999998, 0.34999999999999998, 0.34999999999999998) elif type == ItemGlobals.MOUTH: lootIcon = LootPopupPanel.JewelerIconsA.find( '**/chargui_mouth') iconScale = (0.32500000000000001, 0.32500000000000001, 0.32500000000000001) elif type == ItemGlobals.HAND: lootIcon = LootPopupPanel.JewelerIconsB.find( '**/icon_shop_tailor_hand') iconScale = (0.125, 0.125, 0.125) else: lootIcon = None elif itemType == ItemId.QUEST_DROP_TATTOO: textInfo = None type = None lootIcon = None iconScale = 1.0 type = ItemGlobals.getType(quantity) textInfo = PLocalizer.getItemName(quantity) if type == ItemGlobals.CHEST: lootIcon = LootPopupPanel.TattooIcons.find( '**/icon_shop_tailor_chest_male') iconScale = 0.10000000000000001 elif type == ItemGlobals.ARM: lootIcon = LootPopupPanel.TattooIcons.find( '**/icon_shop_tailor_arm') iconScale = 0.10000000000000001 elif type == ItemGlobals.FACE: lootIcon = LootPopupPanel.TattooIcons.find( '**/icon_shop_tailor_face_male') iconScale = 0.10000000000000001 else: lootIcon = None elif itemType == ItemId.QUEST_DROP_WEAPON: weaponId = quantity iconScale = 0.10000000000000001 textInfo = None lootIcon = None iconName = getItemIcons(weaponId) if iconName is not None: lootIcon = LootPopupPanel.WeaponIcons.find('**/' + iconName) textInfo = PLocalizer.InventoryTypeNames.get(weaponId) entry = DirectFrame(parent=self, relief=None, geom=lootIcon, geom_scale=iconScale, text=textInfo, text_scale=PiratesGuiGlobals.TextScaleSmall, text_align=TextNode.ALeft, text_fg=PiratesGuiGlobals.TextFG0, text_pos=(0.070000000000000007, 0.01), text_font=PiratesGlobals.getInterfaceFont()) entry.setTransparency(1) self.loot.append(entry) self.repackPanels()
def showLoot(self, plunder = [], gold = 0, collect = 0, card = 0, cloth = 0, color = 0, jewel = None, tattoo = None, weapon = None, bounty = 0): for loot in self.loot: loot.destroy() del loot self.loot = [] gender = localAvatar.style.getGender() self.show() self.setAlphaScale(1.0) treasure = [] for itemId in self.icons.iterkeys(): count = 0 for item in plunder: if item == itemId: count += 1 continue if count > 0: treasure.append([ itemId, count]) continue plunder = treasure if gold: plunder.append([ ItemId.GOLD, gold]) LootPopupPanel.lootSfx.play() if bounty: plunder.append([ ItemId.BOUNTY, bounty]) LootPopupPanel.lootSfx.play() if collect: plunder.append([ ItemId.COLLECT, collect]) LootPopupPanel.lootSfx.play() if card: plunder.append([ ItemId.CARD, card]) LootPopupPanel.lootSfx.play() if cloth: plunder.append([ ItemId.CLOTHING, (cloth, color)]) LootPopupPanel.lootSfx.play() if jewel is not None: plunder.append([ ItemId.QUEST_DROP_JEWEL, jewel]) LootPopupPanel.lootSfx.play() if tattoo is not None: plunder.append([ ItemId.QUEST_DROP_TATTOO, tattoo]) LootPopupPanel.lootSfx.play() if weapon is not None: plunder.append([ ItemId.QUEST_DROP_WEAPON, weapon]) LootPopupPanel.lootSfx.play() for item in plunder: (itemType, quantity) = item if itemType == ItemId.COLLECT: itemId = quantity howRare = CollectionMap.Collection_Rarity.get(itemId, 0) rarityText = PLocalizer.CollectionRarities.get(howRare) value = CollectionValues.get(howRare, 0) itemName = PLocalizer.Collections[itemId] howManyDoIHave = localAvatar.getInventory().getStackQuantity(itemId) howManyINeed = CollectionMap.Collection_Needed.get(itemId, 1) if howManyDoIHave < howManyINeed: textInfo = PLocalizer.CollectionPopupNewText % (itemName, rarityText, value) else: textInfo = PLocalizer.CollectionPopupDuplicateText % (itemName, rarityText, value) pic_name = CollectionMap.Assets[itemId] lootIcon = LootPopupPanel.TreasureGui.find('**/%s*' % pic_name) iconScale = 0.34999999999999998 elif itemType == ItemId.CLOTHING: (clothingId, colorId) = quantity if clothingId in ClothingGlobals.quest_items: textInfo = PLocalizer.getItemName(clothingId) else: textInfo = PLocalizer.TailorColorStrings.get(colorId) textInfo = textInfo + ' ' + ClothingGlobals.getClothingTypeName(ItemGlobals.getType(clothingId)) clothingType = ItemGlobals.getType(clothingId) iconScale = 0.13 if clothingType == 0: lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_hat') elif clothingType == 1: lootIcon = loader.loadModel('models/gui/char_gui').find('**/chargui_cloth') iconScale = 0.29999999999999999 elif clothingType == 2: lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_vest') elif clothingType == 3: lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_coat') elif clothingType == 4: lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_pants') elif clothingType == 5: lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_belt') elif clothingType == 6: lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_sock') else: lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_booths') elif itemType == ItemId.CARD: textInfo = PLocalizer.InventoryTypeNames.get(quantity) pic_name = '' lootIcon = PlayingCardGlobals.getImage('standard', PlayingCardGlobals.getSuit(quantity), PlayingCardGlobals.getRank(quantity)) iconScale = 0.20000000000000001 elif itemType == ItemId.GOLD: textInfo = PLocalizer.LootGold % str(quantity) potionPercent = PotionGlobals.getGoldBoostEffectPercent(localAvatar) potionGold = 0 textInfo = PLocalizer.LootGold % str(quantity) if base.cr.newsManager: if base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAYPAID) or Freebooter.getPaidStatus(base.localAvatar.getDoId()) or base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAY): textInfo = PLocalizer.LootGold % str(quantity / 2) + '\n + ' + PLocalizer.LootGoldDouble % str(quantity / 2) if potionGold > 0: textInfo += '\n + ' + PLocalizer.LootGoldPotionBoost % str(potionGold) lootIcon = self.icons.get(itemType)[0] iconScale = 0.27000000000000002 elif itemType == ItemId.BOUNTY: textInfo = PLocalizer.LootBounty % str(quantity) lootIcon = self.icons.get(itemType)[0] iconScale = 0.27000000000000002 elif itemType == ItemId.CARGO_CRATE: if quantity == 1: textInfo = PLocalizer.CargoCrate % quantity else: textInfo = PLocalizer.CargoCrateP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_CHEST: if quantity == 1: textInfo = PLocalizer.CargoChest % quantity else: textInfo = PLocalizer.CargoChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_SKCHEST: if quantity == 1: textInfo = PLocalizer.CargoSkChest % quantity else: textInfo = PLocalizer.CargoSkChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_LOOTSAC: if quantity == 1: textInfo = PLocalizer.LootSac % quantity else: textInfo = PLocalizer.LootSacP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_LOOTCHEST: if quantity == 1: textInfo = PLocalizer.LootChest % quantity else: textInfo = PLocalizer.LootChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.CARGO_LOOTSKCHEST: if quantity == 1: textInfo = PLocalizer.LootSkChest % quantity else: textInfo = PLocalizer.LootSkChestP % quantity lootIcon = self.icons.get(itemType)[0] iconScale = 0.089999999999999997 elif itemType == ItemId.QUEST_DROP_JEWEL: textInfo = None type = None lootIcon = None iconScale = 1.0 type = ItemGlobals.getType(quantity) textInfo = PLocalizer.getItemName(quantity) if type == ItemGlobals.BROW: lootIcon = LootPopupPanel.JewelerIconsB.find('**/icon_shop_tailor_brow') iconScale = (-0.14000000000000001, 0.14000000000000001, 0.14000000000000001) elif type == ItemGlobals.EAR: lootIcon = LootPopupPanel.JewelerIconsA.find('**/chargui_ears') iconScale = (-0.34999999999999998, 0.34999999999999998, 0.34999999999999998) elif type == ItemGlobals.NOSE: lootIcon = LootPopupPanel.JewelerIconsA.find('**/chargui_nose') iconScale = (0.34999999999999998, 0.34999999999999998, 0.34999999999999998) elif type == ItemGlobals.MOUTH: lootIcon = LootPopupPanel.JewelerIconsA.find('**/chargui_mouth') iconScale = (0.32500000000000001, 0.32500000000000001, 0.32500000000000001) elif type == ItemGlobals.LHAND: lootIcon = LootPopupPanel.JewelerIconsB.find('**/icon_shop_tailor_hand') iconScale = (0.125, 0.125, 0.125) else: lootIcon = None elif itemType == ItemId.QUEST_DROP_TATTOO: textInfo = None type = None lootIcon = None iconScale = 1.0 type = ItemGlobals.getType(quantity) textInfo = PLocalizer.getItemName(quantity) if type == ItemGlobals.CHEST: lootIcon = LootPopupPanel.TattooIcons.find('**/icon_shop_tailor_chest_male') iconScale = 0.10000000000000001 elif type == ItemGlobals.ARM: lootIcon = LootPopupPanel.TattooIcons.find('**/icon_shop_tailor_arm') iconScale = 0.10000000000000001 elif type == ItemGlobals.FACE: lootIcon = LootPopupPanel.TattooIcons.find('**/icon_shop_tailor_face_male') iconScale = 0.10000000000000001 else: lootIcon = None elif itemType == ItemId.QUEST_DROP_WEAPON: weaponId = quantity iconScale = 0.10000000000000001 textInfo = None lootIcon = None iconName = getItemIcons(weaponId) if iconName is not None: lootIcon = LootPopupPanel.WeaponIcons.find('**/' + iconName) textInfo = PLocalizer.InventoryTypeNames.get(weaponId) entry = DirectFrame(parent = self, relief = None, geom = lootIcon, geom_scale = iconScale, text = textInfo, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG0, text_pos = (0.070000000000000007, 0.01), text_font = PiratesGlobals.getInterfaceFont()) entry.setTransparency(1) self.loot.append(entry) self.repackPanels()
def createHelpbox(self, args = None): if self.helpFrame: return None itemType = EconomyGlobals.getItemType(self.data[0]) if itemType <= ItemType.WAND or itemType == ItemType.POTION: itemId = self.data[0] self.helpFrame = DirectFrame(parent = aspect2d, relief = None, state = DGG.DISABLED, sortOrder = 1) 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 textScale = PiratesGuiGlobals.TextScaleMed titleScale = PiratesGuiGlobals.TextScaleTitleSmall 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 itemColor = 'itemRed' rarity = ItemGlobals.getRarity(itemId) rarityText = PLocalizer.getItemRarityName(rarity) subtypeText = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId)) if rarity == ItemGlobals.CRUDE: titleColor = PiratesGuiGlobals.TextFG24 itemColor = 'itemBrown' elif rarity == ItemGlobals.COMMON: titleColor = PiratesGuiGlobals.TextFG13 itemColor = 'itemYellow' elif rarity == ItemGlobals.RARE: titleColor = PiratesGuiGlobals.TextFG4 itemColor = 'itemGreen' elif rarity == ItemGlobals.FAMED: titleColor = PiratesGuiGlobals.TextFG5 itemColor = 'itemBlue' titleLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemName(itemId), 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 = '\x01slant\x01%s %s\x02' % (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: if itemType == ItemGlobals.GRENADE: self.realItem = loader.loadModel('models/ammunition/' + model) elif itemType == ItemGlobals.POTION: self.realItem = loader.loadModel('models/inventory/' + model) else: self.realItem = loader.loadModel('models/handheld/' + model) if self.realItem: spinBlur = self.realItem.find('**/motion_blur') if spinBlur: spinBlur.hide() if itemSubtype == ItemGlobals.MUSKET: bayonetPart = self.realItem.find('**/bayonet') if bayonetPart: bayonetPart.stash() 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 itemType == ItemGlobals.SWORD: self.realItem.setPos(-1.5, 3.0, -0.29999999999999999) self.realItem.setHpr(90, 170, -90) elif itemSubtype in (ItemGlobals.MUSKET, ItemGlobals.BAYONET): self.realItem.setPos(-1.2, 3.0, -0.10000000000000001) self.realItem.setHpr(0, 135, 10) elif itemSubtype == ItemGlobals.BLUNDERBUSS: self.realItem.setPos(-0.29999999999999999, 2.0, 0.0) self.realItem.setHpr(0, 90, 0) 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)) saHeight = specialAttackNameLabel.getHeight() + specialAttackTypeLabel.getHeight() + specialAttackDescriptionLabel.getHeight() - 0.040000000000000001 runningVertPosition -= saHeight runningSize += saHeight labels.append(specialAttackNameLabel) labels.append(specialAttackRankLabel) labels.append(specialAttackTypeLabel) labels.append(specialAttackDescriptionLabel) attributes = ItemGlobals.getAttributes(itemId) for i in range(0, len(attributes)): attributeIcon = self.SkillIcons.find('**/%s' % ItemGlobals.getAttributeIcon(attributes[i][0])) if not attributeIcon: attributeIcon = self.BuffIcons.find('**/%s' % ItemGlobals.getAttributeIcon(attributes[i][0])) attributeNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.050000000000000003, geom = attributeIcon, geom_scale = 0.050000000000000003, image_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), geom_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), text = PLocalizer.getItemAttributeName(attributes[i][0]), 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)) attributeRankLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.ItemRank % attributes[i][1], 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)) if attributeNameLabel.getHeight() > 0.074999999999999997: attributeNameSpace = 0.080000000000000002 else: attributeNameSpace = PiratesGuiGlobals.TextScaleLarge attributeDescriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemAttributeDescription(attributes[i][0]), 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 - attributeNameSpace), text_pos = (0.0, -textScale)) aHeight = attributeNameLabel.getHeight() + attributeDescriptionLabel.getHeight() runningVertPosition -= aHeight + splitHeight runningSize += aHeight + splitHeight labels.append(attributeNameLabel) labels.append(attributeRankLabel) labels.append(attributeDescriptionLabel) skillBoosts = ItemGlobals.getSkillBoosts(itemId) for i in range(0, len(skillBoosts)): boostIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(skillBoosts[i][0])) boostNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.050000000000000003, geom = boostIcon, geom_scale = 0.050000000000000003, image_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), geom_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), text = PLocalizer.ItemBoost % PLocalizer.getInventoryTypeName(skillBoosts[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale)) boostRankLabel = DirectLabel(parent = self, relief = None, text = '+%s' % str(skillBoosts[i][1]), 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)) bHeight = boostNameLabel.getHeight() runningVertPosition -= bHeight + splitHeight runningSize += bHeight + splitHeight labels.append(boostNameLabel) labels.append(boostRankLabel) description = PLocalizer.getItemFlavorText(itemId) if description != '': descriptionLabel = DirectLabel(parent = self, relief = None, text = description, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), 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) inv = localAvatar.getInventory() weaponLevel = 0 weaponRepId = WeaponGlobals.getRepId(itemId) weaponRep = inv.getReputation(weaponRepId) weaponReq = ItemGlobals.getWeaponRequirement(itemId) weaponText = None trainingToken = EconomyGlobals.getItemTrainingReq(itemId) trainingAmt = inv.getItemQuantity(trainingToken) if weaponReq: weaponLevel = ReputationGlobals.getLevelFromTotalReputation(weaponRepId, weaponRep)[0] if weaponLevel < weaponReq: weaponColor = PiratesGuiGlobals.TextFG6 else: weaponColor = (0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0) weaponText = PLocalizer.ItemLevelRequirement % (weaponReq, PLocalizer.getItemTypeName(itemType)) elif trainingAmt == 0: weaponColor = PiratesGuiGlobals.TextFG6 weaponText = PLocalizer.ItemTrainingRequirement % PLocalizer.getItemTypeName(itemType) if trainingAmt == 0: if itemType == ItemGlobals.GUN: base.localAvatar.sendRequestContext(InventoryType.GunTrainingRequired) elif itemType == ItemGlobals.DOLL: base.localAvatar.sendRequestContext(InventoryType.DollTrainingRequired) elif itemType == ItemGlobals.DAGGER: base.localAvatar.sendRequestContext(InventoryType.DaggerTrainingRequired) elif itemType == ItemGlobals.STAFF: base.localAvatar.sendRequestContext(InventoryType.StaffTrainingRequired) if weaponText: weaponReqLabel = DirectLabel(parent = self, relief = None, text = weaponText, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = weaponColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale)) wHeight = weaponReqLabel.getHeight() runningVertPosition -= wHeight runningSize += wHeight labels.append(weaponReqLabel) 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 while currentHeight < heightMax: middlePanel = panels.attachNewNode('middlePanel%s' % 1) detailGui.find('**/middle_panel').copyTo(middlePanel) middlePanel.setScale(0.080000000000000002) middlePanel.reparentTo(self.helpFrame) if currentHeight + 0.20000000000000001 >= heightMax: difference = heightMax - currentHeight placement += (0.16800000000000001 / 0.20000000000000001) * difference currentHeight += difference else: placement += 0.16800000000000001 currentHeight += 0.20000000000000001 middlePanel.setZ(-placement) i += 1 bottomPanel = panels.attachNewNode('bottomPanel') detailGui.find('**/bottom_panel').copyTo(bottomPanel) bottomPanel.setScale(0.080000000000000002) bottomPanel.setZ(-placement) bottomPanel.reparentTo(self.helpFrame) colorPanel = panels.attachNewNode('colorPanel') detailGui.find('**/color').copyTo(colorPanel) colorPanel.setScale(0.080000000000000002) colorPanel.setColor(titleColor) colorPanel.reparentTo(self.helpFrame) lineBreakTopPanel = panels.attachNewNode('lineBreakTopPanel') detailGui.find('**/line_break_top').copyTo(lineBreakTopPanel) lineBreakTopPanel.setScale(0.080000000000000002, 0.080000000000000002, 0.070000000000000007) lineBreakTopPanel.setZ(0.0080000000000000002) lineBreakTopPanel.reparentTo(self.helpFrame) if itemType != ItemGlobals.POTION: lineBreakBottomPanel = panels.attachNewNode('lineBreakBottomPanel') detailGui.find('**/line_break_bottom').copyTo(lineBreakBottomPanel) lineBreakBottomPanel.setScale(0.080000000000000002, 0.080000000000000002, 0.070000000000000007) lineBreakBottomPanel.setZ(-0.014999999999999999) lineBreakBottomPanel.reparentTo(self.helpFrame) panels.flattenStrong() self.helpFrame['frameSize'] = (-halfWidth, halfWidth, -(runningSize + vMargin), vMargin) totalHeight = self.helpFrame.getHeight() - 0.10000000000000001 for label in labels: label.reparentTo(self.helpFrame) self.helpFrame.setBin('gui-popup', 0) self.helpFrame.setPos(self, 0.55000000000000004, 0, -0.29999999999999999) zOffset = -0.5 - self.helpFrame.getPos(aspect2d)[2] if zOffset >= 0.0: self.helpFrame.setPos(self, 0.55000000000000004, 0, zOffset - 0.29999999999999999) else: weaponInfo = PLocalizer.WeaponDescriptions.get(self.data[0]) weaponDesc = weaponInfo self.helpText = DirectFrame(parent = self, relief = None, text = weaponDesc, state = DGG.DISABLED, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleSmall, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 13, textMayChange = 0, sortOrder = 91) height = -self.helpText.getHeight() self.helpFrame = BorderFrame(parent = aspect2d, state = DGG.DISABLED, frameSize = (-0.029999999999999999, 0.42999999999999999, height, 0.050000000000000003), sortOrder = 90, borderScale = 0.20000000000000001) self.helpText.reparentTo(self.helpFrame) self.helpFrame.setBin('gui-popup', 0) self.helpFrame.setPos(self, 0.25, 0, -0.035000000000000003)