def cellUsed(self, cell):
     if self.manager.heldFromCell:
         self.heldItemOldCell = self.manager.heldFromCell
         if self.manager.testCanUse(
                 self.heldItemOldCell.inventoryItem.itemTuple):
             itemId = self.heldItemOldCell.inventoryItem.itemTuple.getType()
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if WeaponGlobals.getSkillEffectFlag(skillId):
                 drunk = localAvatar.guiMgr.combatTray.trySkill(
                     InventoryType.UsePotion, skillId, 0)
             else:
                 drunk = localAvatar.guiMgr.combatTray.trySkill(
                     InventoryType.UseItem, skillId, 0)
             if self.waitTime == None and drunk:
                 if WeaponGlobals.getSkillEffectFlag(skillId):
                     self.waitTime = base.cr.battleMgr.getModifiedRechargeTime(
                         localAvatar, InventoryType.UsePotion, skillId)
                 else:
                     self.waitTime = base.cr.battleMgr.getModifiedRechargeTime(
                         localAvatar, InventoryType.UseItem, skillId)
                 if self.waitTime:
                     self.drinkCell['text'] = PLocalizer.WaitPotion % int(
                         self.waitTime)
                     taskMgr.doMethodLater(1.0, self.handlePotionRecharge,
                                           'WaitDrinkPotion')
     else:
         localAvatar.guiMgr.createWarning(PLocalizer.HowToDrinkPotion,
                                          PiratesGuiGlobals.TextFG6)
     return
 def __init__(self, uid):
     SimpleEconomyItem.__init__(self, uid)
     skillId = WeaponGlobals.getSkillIdForAmmoSkillId(uid)
     if skillId:
         asset = WeaponGlobals.getSkillIcon(skillId)
         if asset:
             self.icon = self.Icons.find('**/%s' % asset)
             self.iconScale = 1.1000000000000001
             self.iconHpr = (0, 0, 45)
 def __init__(self, uid):
     SimpleEconomyItem.__init__(self, uid)
     skillId = WeaponGlobals.getSkillIdForAmmoSkillId(uid)
     if skillId:
         asset = WeaponGlobals.getSkillIcon(skillId)
         if asset:
             self.icon = self.Icons.find('**/%s' % asset)
             self.iconScale = 1.1000000000000001
             self.iconHpr = (0, 0, 45)
 def createGui(self):
     itemId = self.data[0]
     self.itemCount += 1
     self.itemQuantity = self.quantity
     self.itemCost = self.price
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, pos = (0.035000000000000003, 0, 0.025000000000000001))
     self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ARight, text_wordwrap = 11, pos = (0.1225, 0, 0.014999999999999999))
     if len(self.name) >= 39:
         textScale = PiratesGuiGlobals.TextScaleMicro * PLocalizer.getHeadingScale(2)
     elif len(self.name) >= 35:
         textScale = PiratesGuiGlobals.TextScaleTiny * PLocalizer.getHeadingScale(2)
     else:
         textScale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2)
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_fg = PiratesGuiGlobals.TextFG2, text_scale = textScale, text_align = TextNode.ALeft, pos = (0.13, 0, 0.014999999999999999))
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = InventoryListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.0050000000000000001, 0, 0.012500000000000001), text = str(self.price), text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.014999999999999999), text_font = PiratesGlobals.getInterfaceFont())
     itemClass = EconomyGlobals.getItemCategory(itemId)
     itemType = EconomyGlobals.getItemType(itemId)
     if itemType == ItemType.FISHING_ROD or itemType == ItemType.FISHING_LURE:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = PurchaseListItem.fishingIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.040000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     elif itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = InventoryListItem.weaponIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.040000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     elif itemClass == ItemType.CONSUMABLE:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.040000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     
     if not InventoryType.begin_WeaponCannonAmmo <= itemId or itemId <= InventoryType.end_WeaponCannonAmmo:
         if (InventoryType.begin_WeaponPistolAmmo <= itemId or itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId) and itemId <= InventoryType.end_WeaponDaggerAmmo:
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if skillId:
                 asset = WeaponGlobals.getSkillIcon(skillId)
                 if asset:
                     self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s' % asset)
                     self.picture['geom_scale'] = 0.059999999999999998
                     self.picture['geom_pos'] = (0, 0, 0)
                 
             
         elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
             self.picture['geom'] = self.topGui.find('**/main_gui_ship_bottle')
             self.picture['geom_scale'] = 0.10000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     self.flattenStrong()
Exemple #5
0
 def createGui(self):
     itemId = self.data[0]
     self.itemCount += 1
     self.itemQuantity = self.quantity
     self.itemCost = self.price
     self.picture = DirectFrame(parent=self, relief=None, state=DGG.DISABLED, pos=(0.035,
                                                                                   0,
                                                                                   0.025))
     self.quantityLabel = DirectLabel(parent=self, relief=None, state=DGG.DISABLED, text=str(self.quantity), text_fg=PiratesGuiGlobals.TextFG2, text_scale=PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align=TextNode.ARight, text_wordwrap=11, pos=(0.1225,
                                                                                                                                                                                                                                                                                0,
                                                                                                                                                                                                                                                                                0.015))
     if len(self.name) >= 39:
         textScale = PiratesGuiGlobals.TextScaleMicro * PLocalizer.getHeadingScale(2)
     else:
         if len(self.name) >= 35:
             textScale = PiratesGuiGlobals.TextScaleTiny * PLocalizer.getHeadingScale(2)
         else:
             textScale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2)
         self.nameTag = DirectLabel(parent=self, relief=None, state=DGG.DISABLED, text=self.name, text_fg=PiratesGuiGlobals.TextFG2, text_scale=textScale, text_align=TextNode.ALeft, pos=(0.13,
                                                                                                                                                                                           0,
                                                                                                                                                                                           0.015))
         self.costText = DirectLabel(parent=self, relief=None, state=DGG.DISABLED, image=InventoryListItem.coinImage, image_scale=0.12, image_pos=Vec3(-0.005, 0, 0.0125), text=str(self.price), text_fg=PiratesGuiGlobals.TextFG2, text_scale=PiratesGuiGlobals.TextScaleSmall, text_align=TextNode.ARight, text_wordwrap=11, text_pos=(-0.03, 0, 0), pos=(self.width - 0.035, 0, 0.015), text_font=PiratesGlobals.getInterfaceFont())
         itemClass = EconomyGlobals.getItemCategory(itemId)
         itemType = EconomyGlobals.getItemType(itemId)
         if itemType == ItemType.FISHING_ROD or itemType == ItemType.FISHING_LURE:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 self.picture['geom'] = PurchaseListItem.fishingIcons.find('**/%s*' % asset)
                 self.picture['geom_scale'] = 0.04
                 self.picture['geom_pos'] = (0, 0, 0)
         elif itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 self.picture['geom'] = InventoryListItem.weaponIcons.find('**/%s*' % asset)
                 self.picture['geom_scale'] = 0.04
                 self.picture['geom_pos'] = (0, 0, 0)
         elif itemClass == ItemType.CONSUMABLE:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s*' % asset)
                 self.picture['geom_scale'] = 0.04
                 self.picture['geom_pos'] = (0, 0, 0)
         if InventoryType.begin_WeaponCannonAmmo <= itemId and itemId <= InventoryType.end_WeaponCannonAmmo or InventoryType.begin_WeaponPistolAmmo <= itemId and itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId and itemId <= InventoryType.end_WeaponDaggerAmmo:
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if skillId:
                 asset = WeaponGlobals.getSkillIcon(skillId)
                 if asset:
                     self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s' % asset)
                     self.picture['geom_scale'] = 0.06
                     self.picture['geom_pos'] = (0, 0, 0)
         if InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
             self.picture['geom'] = self.topGui.find('**/main_gui_ship_bottle')
             self.picture['geom_scale'] = 0.1
             self.picture['geom_pos'] = (0, 0, 0)
     self.flattenStrong()
     return
 def figureOutStackTypes(self):
     self.listOfItemLists = []
     for pouchType in orderedPouchTypes:
         ammoList = EconomyGlobals.getPouchAmmoList(pouchType)
         continue
         itemList = [ WeaponGlobals.getSkillIdForAmmoSkillId(ammoId) for ammoId in ammoList ]
         itemList.insert(0, pouchType)
         self.listOfItemLists.append(itemList)
     
     self.discoverPouches()
 def getGeomParams(itemId):
     geomParams = { }
     itemType = EconomyGlobals.getItemType(itemId)
     if itemType <= ItemType.WAND or itemType == ItemType.POTION:
         if itemType == ItemType.POTION:
             geomParams['geom'] = InventoryItemGui.skillIcons.find('**/%s' % ItemGlobals.getIcon(itemId))
         else:
             itemType = ItemGlobals.getType(itemId)
             if ItemGlobals.getIcon(itemId):
                 geomParams['geom'] = InventoryItemGui.weaponIcons.find('**/%s' % ItemGlobals.getIcon(itemId))
             
         geomParams['geom_scale'] = 0.11
         geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
     else:
         itemClass = EconomyGlobals.getItemCategory(itemId)
         itemType = EconomyGlobals.getItemType(itemId)
         if itemType == ItemType.FISHING_ROD or itemType == ItemType.FISHING_LURE:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 geomParams['geom'] = InventoryItemGui.fishingIcons.find('**/%s*' % asset)
                 geomParams['geom_scale'] = 0.11
                 geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
             
         elif itemClass == ItemType.WEAPON and itemClass == ItemType.POUCH or itemClass == ItemType.AMMO:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 geomParams['geom'] = InventoryItemGui.weaponIcons.find('**/%s*' % asset)
                 geomParams['geom_scale'] = 0.11
                 geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
             
         elif itemClass == ItemType.CONSUMABLE:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 geomParams['geom'] = InventoryItemGui.skillIcons.find('**/%s*' % asset)
                 geomParams['geom_scale'] = 0.11
                 geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
             
         
     if not InventoryType.begin_WeaponCannonAmmo <= itemId or itemId <= InventoryType.end_WeaponCannonAmmo:
         if (InventoryType.begin_WeaponPistolAmmo <= itemId or itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId) and itemId <= InventoryType.end_WeaponDaggerAmmo:
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if skillId:
                 asset = WeaponGlobals.getSkillIcon(skillId)
                 if asset:
                     geomParams['geom'] = InventoryListItem.skillIcons.find('**/%s' % asset)
                     geomParams['geom_scale'] = 0.14999999999999999
                     geomParams['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
                 
             
         elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
             geomParams['geom'] = InventoryListItem.topGui.find('**/main_gui_ship_bottle')
             geomParams['geom_scale'] = 0.10000000000000001
             geomParams['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
         
     return geomParams
Exemple #8
0
 def cellRightClick(self, cell, mouseAction=MOUSE_CLICK, task=None):
     if mouseAction == MOUSE_PRESS:
         if cell.inventoryItem:
             if self.manager.localDrinkingPotion:
                 localAvatar.guiMgr.createWarning(PLocalizer.NoDoubleDrinkingItemsWarning, PiratesGuiGlobals.TextFG6)
                 return
             if self.manager.testCanUse(cell.inventoryItem.itemTuple):
                 itemId = cell.inventoryItem.itemTuple.getType()
                 skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
                 cell.inventoryItem.hasDrunk = WeaponGlobals.getSkillEffectFlag(skillId) and localAvatar.guiMgr.combatTray.trySkill(InventoryType.UsePotion, skillId, 0)
             else:
                 cell.inventoryItem.hasDrunk = localAvatar.guiMgr.combatTray.trySkill(InventoryType.UseItem, skillId, 0)
 def cellRightClick(self, cell, mouseAction = MOUSE_CLICK, task = None):
     if mouseAction == MOUSE_PRESS and cell.inventoryItem:
         if self.manager.localDrinkingPotion:
             localAvatar.guiMgr.createWarning(PLocalizer.NoDoubleDrinkingItemsWarning, PiratesGuiGlobals.TextFG6)
             return None
         
         if self.manager.testCanUse(cell.inventoryItem.itemTuple):
             itemId = cell.inventoryItem.itemTuple.getType()
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if WeaponGlobals.getSkillEffectFlag(skillId):
                 cell.inventoryItem.hasDrunk = localAvatar.guiMgr.combatTray.trySkill(InventoryType.UsePotion, skillId, 0)
             else:
                 cell.inventoryItem.hasDrunk = localAvatar.guiMgr.combatTray.trySkill(InventoryType.UseItem, skillId, 0)
 def createGui(self):
     itemId = self.data[0]
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.16, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())
     if itemId in range(InventoryType.begin_PistolPouches, InventoryType.end_PistolPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1)
     elif itemId in range(InventoryType.begin_DaggerPouches, InventoryType.end_DaggerPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1)
     elif itemId in range(InventoryType.begin_GrenadePouches, InventoryType.end_GrenadePouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.GrenadeShort, 1)
     elif itemId in range(InventoryType.begin_CannonPouches, InventoryType.end_CannonPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.ShipCannonShort, 1)
     else:
         self.itemTypeFormatted = PLocalizer.makeHeadingString(self.itemType, 1)
     self.itemTypeName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.itemTypeFormatted, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.16, 0, 0.065000000000000002))
     self.miscText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.16, 0, 0.025000000000000001))
     if self.minLvl > 0:
         repId = WeaponGlobals.getRepId(itemId)
         if repId:
             self.checkLevel(repId, self.minLvl)
         
     
     self.checkFreebooter(itemId, base.localAvatar.getDoId())
     trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
     if trainingReq:
         self.checkTrainingReq(trainingReq)
     
     if EconomyGlobals.getItemCategory(itemId) == ItemType.AMMO:
         skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
         self.checkSkillReq(skillId)
     
     self.checkInfamyReq(itemId)
     if self.buy:
         self.checkPlayerInventory(itemId)
     
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = InventoryListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.065000000000000002), text_font = PiratesGlobals.getInterfaceFont())
     if self.quantity and self.quantity > 1:
         self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), frameColor = (0, 0, 0, 1), frameSize = (-0.01, 0.02, -0.01, 0.025000000000000001), text_scale = 0.0275, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.02, 0, 0.025000000000000001), text_font = PiratesGlobals.getPirateBoldOutlineFont())
     
     geomParams = InventoryItemGui.getGeomParams(itemId)
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, geom = geomParams['geom'], geom_pos = geomParams['geom_pos'], geom_scale = geomParams['geom_scale'], pos = (0.01, 0, 0.01))
     self.flattenStrong()
 def cellUsed(self, cell):
     if self.manager.heldFromCell:
         self.heldItemOldCell = self.manager.heldFromCell
         if self.manager.testCanUse(self.heldItemOldCell.inventoryItem.itemTuple):
             itemId = self.heldItemOldCell.inventoryItem.itemTuple.getType()
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if WeaponGlobals.getSkillEffectFlag(skillId):
                 drunk = localAvatar.guiMgr.combatTray.trySkill(InventoryType.UsePotion, skillId, 0)
             else:
                 drunk = localAvatar.guiMgr.combatTray.trySkill(InventoryType.UseItem, skillId, 0)
             if self.waitTime == None and drunk:
                 if WeaponGlobals.getSkillEffectFlag(skillId):
                     self.waitTime = base.cr.battleMgr.getModifiedRechargeTime(localAvatar, InventoryType.UsePotion, skillId)
                 else:
                     self.waitTime = base.cr.battleMgr.getModifiedRechargeTime(localAvatar, InventoryType.UseItem, skillId)
                 if self.waitTime:
                     self.drinkCell['text'] = PLocalizer.WaitPotion % int(self.waitTime)
                     taskMgr.doMethodLater(1.0, self.handlePotionRecharge, 'WaitDrinkPotion')
                 
             
         
     else:
         localAvatar.guiMgr.createWarning(PLocalizer.HowToDrinkPotion, PiratesGuiGlobals.TextFG6)
 def setupItems(self, itemList):
     for itemId in itemList:
         itemClass = ItemGlobals.getClass(itemId)
         itemType = EconomyGlobals.getItemType(itemId)
         itemTuple = [
             itemClass,
             itemId,
             0,
             0]
         item = None
         if itemClass == InventoryType.ItemTypeWeapon:
             item = self.manager.makeWeaponItem(itemTuple)
         elif itemClass == InventoryType.ItemTypeCharm:
             item = self.manager.makeCharmItem(itemTuple)
         elif itemClass == InventoryType.ItemTypeConsumable:
             itemTuple[3] = 1
             item = self.manager.makeConsumableItem(itemTuple, showMax = 0)
         elif itemClass == InventoryType.ItemTypeClothing:
             item = self.manager.makeClothingItem(itemTuple)
         elif itemClass == InventoryType.ItemTypeMoney:
             item = self.manager.makeGoldItem(itemTuple)
         elif itemClass == InventoryType.TreasureCollection:
             item = self.manager.makeTreasureItem(itemTuple)
         elif itemClass == InventoryType.ItemTypeJewelry:
             item = self.manager.makeJewelryItem(itemTuple)
         elif itemClass == InventoryType.ItemTypeTattoo:
             item = self.manager.makeTattooItem(itemTuple)
         elif itemClass == InventoryCategory.CARDS:
             cardId = itemId
             itemTuple[1] -= InventoryType.begin_Cards
             item = self.manager.makeCardItem(cardId, itemTuple, imageScaleFactor = 1.8999999999999999)
         elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
             itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
             item = self.manager.makeAmmoItem(itemId, itemTuple, showMax = 0)
         elif itemType in [
             EconomyGlobals.ItemType.DAGGERAMMO,
             EconomyGlobals.ItemType.PISTOLAMMO,
             EconomyGlobals.ItemType.GRENADEAMMO,
             EconomyGlobals.ItemType.CANNONAMMO]:
             itemTuple = [
                 0,
                 itemId,
                 0,
                 EconomyGlobals.getItemQuantity(itemId)]
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             item = self.manager.makeAmmoItem(skillId, itemTuple, showMax = 0)
         elif itemType in [
             EconomyGlobals.ItemType.PISTOL_POUCH,
             EconomyGlobals.ItemType.DAGGER_POUCH,
             EconomyGlobals.ItemType.GRENADE_POUCH,
             EconomyGlobals.ItemType.CANNON_POUCH,
             EconomyGlobals.ItemType.FISHING_POUCH]:
             item = self.manager.makePouchItem(itemTuple)
         elif itemType in (EconomyGlobals.ItemType.FISHING_LURE,):
             itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
             itemTuple[3] = EconomyGlobals.getItemQuantity(itemId)
             item = self.manager.makeFishingItem(itemId, itemTuple, showMax = 0)
         
         if itemClass in (InventoryType.ItemTypeMoney, InventoryCategory.CARDS, InventoryType.TreasureCollection):
             self.addGridCell(self.stackImage, 1.0)
         elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
             self.addGridCell(self.stackImage2, 1.0)
         elif itemType in (EconomyGlobals.ItemType.FISHING_LURE,):
             self.addGridCell(self.stackImage, 1.0)
         else:
             self.addGridCell()
         if item:
             self.tryPutIntoFirstOpenCell(item)
         
         item.showResaleValue = False
         if self.zCount == self.gridZ:
             break
             
     
     while self.zCount < self.gridZ:
         self.addGridCell()
Exemple #13
0
    def createGui(self):
        itemId = self.data[0]
        self.picture = DirectFrame(parent=self,
                                   relief=None,
                                   state=DGG.DISABLED,
                                   pos=(0.01, 0, 0.01))
        self.nameTag = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text=self.name,
            text_scale=PiratesGuiGlobals.TextScaleSmall *
            PLocalizer.getHeadingScale(2),
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            pos=(0.050000000000000003, 0, 0.105),
            text_font=PiratesGlobals.getInterfaceFont())
        itemTypeFormatted = ''
        self.itemTypeName = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text=itemTypeFormatted,
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_font=PiratesGlobals.getInterfaceFont(),
            pos=(0.050000000000000003, 0, 0.065000000000000002))
        self.miscText = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text='',
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_wordwrap=11,
            pos=(0.050000000000000003, 0, 0.025000000000000001))
        if self.minLvl > 0:
            repId = WeaponGlobals.getRepId(itemId)
            if repId:
                self.checkLevel(repId, self.minLvl)

        trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
        if trainingReq:
            self.checkTrainingReq(trainingReq)

        if EconomyGlobals.getItemCategory(itemId) == ItemType.AMMO:
            skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
            self.checkSkillReq(skillId)

        if self.buy:
            self.checkPlayerInventory(itemId)

        self.costText = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            image=SongListItem.coinImage,
            image_scale=0.12,
            image_pos=Vec3(-0.01, 0, 0.01),
            text=str(self.price),
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_align=TextNode.ARight,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_wordwrap=11,
            text_pos=(-0.029999999999999999, 0, 0),
            pos=(self.width - 0.035000000000000003, 0, 0.105),
            text_font=PiratesGlobals.getInterfaceFont())
        if self.quantity and self.quantity > 1:
            self.quantityLabel = DirectLabel(
                parent=self,
                relief=None,
                state=DGG.DISABLED,
                text=str(self.quantity),
                frameColor=(0, 0, 0, 1),
                frameSize=(-0.01, 0.02, -0.01, 0.025000000000000001),
                text_scale=0.0275,
                text_align=TextNode.ACenter,
                text_fg=PiratesGuiGlobals.TextFG2,
                text_shadow=PiratesGuiGlobals.TextShadow,
                text_wordwrap=11,
                pos=(0.02, 0, 0.025000000000000001),
                text_font=PiratesGlobals.getPirateBoldOutlineFont())

        itemClass = EconomyGlobals.getItemCategory(itemId)
        if itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
            asset = EconomyGlobals.getItemIcons(itemId)
            if asset:
                self.picture['geom'] = SongItemGui.weaponIcons.find('**/%s*' %
                                                                    asset)
                self.picture['geom_scale'] = 0.11
                self.picture['geom_pos'] = (0.080000000000000002, 0,
                                            0.068000000000000005)

        elif itemClass == ItemType.CONSUMABLE:
            asset = EconomyGlobals.getItemIcons(itemId)
            if asset:
                self.picture['geom'] = SongItemGui.skillIcons.find('**/%s*' %
                                                                   asset)
                self.picture['geom_scale'] = 0.11
                self.picture['geom_pos'] = (0.080000000000000002, 0,
                                            0.068000000000000005)

        if not InventoryType.begin_WeaponCannonAmmo <= itemId or itemId <= InventoryType.end_WeaponCannonAmmo:
            if (InventoryType.begin_WeaponPistolAmmo <= itemId
                    or itemId <= InventoryType.end_WeaponGrenadeAmmo
                    or InventoryType.begin_WeaponDaggerAmmo <= itemId
                ) and itemId <= InventoryType.end_WeaponDaggerAmmo:
                skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
                if skillId:
                    asset = WeaponGlobals.getSkillIcon(skillId)
                    if asset:
                        self.picture['geom'] = SongListItem.skillIcons.find(
                            '**/%s' % asset)
                        self.picture['geom_scale'] = 0.14999999999999999
                        self.picture['geom_pos'] = (0.069000000000000006, 0,
                                                    0.069000000000000006)

            elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
                self.picture['geom'] = SongListItem.topGui.find(
                    '**/main_gui_ship_bottle')
                self.picture['geom_scale'] = 0.10000000000000001
                self.picture['geom_pos'] = (0.069000000000000006, 0,
                                            0.069000000000000006)

        self.flattenStrong()
Exemple #14
0
 def createGui(self):
     itemId = self.data[0]
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, pos = (0.01, 0, 0.01))
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.050000000000000003, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())
     itemTypeFormatted = ''
     self.itemTypeName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = itemTypeFormatted, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.050000000000000003, 0, 0.065000000000000002))
     self.miscText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.050000000000000003, 0, 0.025000000000000001))
     if self.minLvl > 0:
         repId = WeaponGlobals.getRepId(itemId)
         if repId:
             self.checkLevel(repId, self.minLvl)
         
     
     trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
     if trainingReq:
         self.checkTrainingReq(trainingReq)
     
     if EconomyGlobals.getItemCategory(itemId) == ItemType.AMMO:
         skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
         self.checkSkillReq(skillId)
     
     if self.buy:
         self.checkPlayerInventory(itemId)
     
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = SongListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())
     if self.quantity and self.quantity > 1:
         self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), frameColor = (0, 0, 0, 1), frameSize = (-0.01, 0.02, -0.01, 0.025000000000000001), text_scale = 0.0275, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.02, 0, 0.025000000000000001), text_font = PiratesGlobals.getPirateBoldOutlineFont())
     
     itemClass = EconomyGlobals.getItemCategory(itemId)
     if itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = SongItemGui.weaponIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.11
             self.picture['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
         
     elif itemClass == ItemType.CONSUMABLE:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = SongItemGui.skillIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.11
             self.picture['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
         
     
     if not InventoryType.begin_WeaponCannonAmmo <= itemId or itemId <= InventoryType.end_WeaponCannonAmmo:
         if (InventoryType.begin_WeaponPistolAmmo <= itemId or itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId) and itemId <= InventoryType.end_WeaponDaggerAmmo:
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if skillId:
                 asset = WeaponGlobals.getSkillIcon(skillId)
                 if asset:
                     self.picture['geom'] = SongListItem.skillIcons.find('**/%s' % asset)
                     self.picture['geom_scale'] = 0.14999999999999999
                     self.picture['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
                 
             
         elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
             self.picture['geom'] = SongListItem.topGui.find('**/main_gui_ship_bottle')
             self.picture['geom_scale'] = 0.10000000000000001
             self.picture['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
         
     self.flattenStrong()