コード例 #1
0
 def __init__(self, manager, cardId, itemTuple, imageScaleFactor = 1.0, showMax = 0):
     amount = itemTuple[3]
     InventoryUIItem.InventoryUIItem.__init__(self, manager, itemTuple, imageScaleFactor = imageScaleFactor)
     self.initialiseoptions(InventoryUICardItem)
     self['relief'] = None
     gui = loader.loadModel('models/gui/suit_icons')
     if not amount:
         self['image'] = gui.find('**/PC_back_standard_dark')
     else:
         self['geom'] = gui.find('**/pir_t_gui_frm_goldCircle')
         self['geom_pos'] = (0.050000000000000003, 0, 0.050000000000000003)
         self['geom_scale'] = 0.0625
         suit = PlayingCardGlobals.getSuit(itemTuple[1], fromOffset = 0)
         rank = PlayingCardGlobals.getRank(itemTuple[1], fromOffset = 0)
         style = PlayingCardGlobals.Styles[0]
         self['image'] = PlayingCardGlobals.getImage(style, suit, rank)
     self.textScale = 1.5
     self.showMax = showMax
     self.itemType = ITEM_STACK
     self.amount = None
     self.localStore = 0
     self.cardId = cardId
     if amount == None:
         self.localStore = 1
         self.updateAmount()
         self.accept('inventoryQuantity-%s-%s' % (localAvatar.getInventory().doId, stackId), self.cardDirty)
     else:
         self.amount = amount
         self.updateAmountText()
     self.textOffset = 0.34999999999999998
コード例 #2
0
    def setupCells(self):
        self.figureOutStackTypes()
        self.computeCellSize()
        suitsAdded = []
        for Z in range(self.gridZ):
            for X in range(len(self.listOfItemLists[Z])):
                cardId = self.listOfItemLists[Z][X]
                cardValue = cardId - InventoryType.begin_Cards
                cardName = PlayingCardGlobals.getCardName(cardValue)
                suit = PlayingCardGlobals.getSuit(cardValue, fromOffset=0)
                rank = PlayingCardGlobals.getRank(cardValue, fromOffset=0)
                if suit not in suitsAdded:
                    suitsAdded.append(suit)
                    if self.seperatorOn:
                        self.seperatorCount += 1

                bottomCard = 0
                if rank == 0:
                    bottomCard = 1

                cardCell = self.getCell(bottomCard=bottomCard)
                cardCell.setPos(self.findGridPos(suit, rank))
                self.cardDict[cardId] = cardCell
                self.placeCardItem(cardId)

        self.accept('seachestOpened', self.updateBufferedCards)
 def setupCells(self):
     self.figureOutStackTypes()
     self.computeCellSize()
     suitsAdded = []
     for Z in range(self.gridZ):
         for X in range(len(self.listOfItemLists[Z])):
             cardId = self.listOfItemLists[Z][X]
             cardValue = cardId - InventoryType.begin_Cards
             cardName = PlayingCardGlobals.getCardName(cardValue)
             suit = PlayingCardGlobals.getSuit(cardValue, fromOffset = 0)
             rank = PlayingCardGlobals.getRank(cardValue, fromOffset = 0)
             if suit not in suitsAdded:
                 suitsAdded.append(suit)
                 if self.seperatorOn:
                     self.seperatorCount += 1
                 
             
             bottomCard = 0
             if rank == 0:
                 bottomCard = 1
             
             cardCell = self.getCell(bottomCard = bottomCard)
             cardCell.setPos(self.findGridPos(suit, rank))
             self.cardDict[cardId] = cardCell
             self.placeCardItem(cardId)
         
     
     self.accept('seachestOpened', self.updateBufferedCards)
 def cellClick(self, cell, mouseAction = MOUSE_CLICK, task = None):
     if mouseAction == MOUSE_PRESS and cell.inventoryItem:
         cardValue = cell.inventoryItem.itemTuple[1]
         suit = PlayingCardGlobals.getSuit(cardValue, fromOffset = 0)
         rank = PlayingCardGlobals.getRank(cardValue, fromOffset = 0)
         messenger.send('cardPicked', [
             suit,
             rank])
コード例 #5
0
 def __init__(self,
              manager,
              cardId,
              itemTuple,
              imageScaleFactor=1.0,
              showMax=0):
     amount = itemTuple[3]
     InventoryUIItem.InventoryUIItem.__init__(
         self, manager, itemTuple, imageScaleFactor=imageScaleFactor)
     self.initialiseoptions(InventoryUICardItem)
     self['relief'] = None
     gui = loader.loadModel('models/gui/suit_icons')
     if not amount:
         self['image'] = gui.find('**/PC_back_standard_dark')
     else:
         self['geom'] = gui.find('**/pir_t_gui_frm_goldCircle')
         self['geom_pos'] = (0.05, 0, 0.05)
         self['geom_scale'] = 0.0625
         suit = PlayingCardGlobals.getSuit(itemTuple[1], fromOffset=0)
         rank = PlayingCardGlobals.getRank(itemTuple[1], fromOffset=0)
         style = PlayingCardGlobals.Styles[0]
         self['image'] = PlayingCardGlobals.getImage(style, suit, rank)
     self.textScale = 1.5
     self.showMax = showMax
     self.itemType = ITEM_STACK
     self.amount = None
     self.localStore = 0
     self.cardId = cardId
     if amount == None:
         self.localStore = 1
         self.updateAmount()
         self.accept(
             'inventoryQuantity-%s-%s' %
             (localAvatar.getInventory().doId, stackId), self.cardDirty)
     else:
         self.amount = amount
         self.updateAmountText()
     self.textOffset = 0.35
     return
コード例 #6
0
ファイル: MessageStackPanel.py プロジェクト: Kealigal/POS2013
 def setIcon(self):
     if self.circle:
         self.circle.destroy()
         self.circle = None
     
     if self.icon:
         self.icon.destroy()
         self.icon = None
     
     if self.icon2:
         self.icon2.destroy()
         self.icon2 = None
     
     icon = self['icon']
     if icon:
         (category, detail) = icon
         imagePos = (0.10000000000000001, 0, -0.080000000000000002)
         extraArgs = []
         if category == 'gold':
             image = StackMessage.CoinTex
             imageScale = 0.27000000000000002
             command = localAvatar.guiMgr.showCollectionMain
         elif category == 'skills':
             image = StackMessage.SkillTex
             imageScale = 0.27000000000000002
             command = localAvatar.guiMgr.showSkillPage
         elif category == 'reputation':
             repId = detail
             if repId == InventoryType.OverallRep:
                 model = StackMessage.TopLevel
                 imageScale = 0.089999999999999997
             elif repId == InventoryType.SailingRep:
                 model = StackMessage.SkillIcons
                 imageScale = 0.12
             else:
                 model = StackMessage.WeaponIcons
                 imageScale = 0.12
             asset = ReputationGlobals.RepIcons.get(repId)
             image = model.find('**/%s' % asset)
             command = localAvatar.guiMgr.showSkillPage
         elif category == 'card':
             suit = PlayingCardGlobals.getSuit(detail)
             rank = PlayingCardGlobals.getRank(detail)
             image = PlayingCardGlobals.getImage('standard', suit, rank)
             imageScale = 0.20000000000000001
             command = localAvatar.guiMgr.showCollectionMain
         elif category == 'collect':
             name = CollectionMap.Assets[detail]
             image = StackMessage.TreasureGui.find('**/%s*' % name)
             imageScale = 0.34999999999999998
             command = localAvatar.guiMgr.showCollectionMain
         elif category == 'quests':
             image = StackMessage.QuestTex
             imageScale = 0.17999999999999999
             command = localAvatar.guiMgr.showQuestPanel
         elif category == 'crew':
             image = StackMessage.CrewTex
             imageScale = 0.10000000000000001
             command = localAvatar.guiMgr.socialPanel.show
         elif category == 'friends':
             image = StackMessage.FriendTex
             imageScale = (0.059999999999999998, 0, 0.070000000000000007)
             command = localAvatar.guiMgr.socialPanel.show
         elif category == 'guild':
             image = StackMessage.GuildTex
             imageScale = 0.080000000000000002
             command = localAvatar.guiMgr.socialPanel.show
         elif category == 'lookout':
             image = StackMessage.LookoutTex
             imageScale = 0.17999999999999999
             command = localAvatar.guiMgr.showLookoutPanel
         elif category == 'weapon':
             image = StackMessage.WeaponTex
             imageScale = 0.12
             command = localAvatar.guiMgr.showWeaponPanel
         elif category == 'loot':
             if detail == ItemId.CARGO_CRATE:
                 image = StackMessage.CrateTex
             elif detail == ItemId.CARGO_CHEST:
                 image = StackMessage.ChestTex
             elif detail == ItemId.CARGO_SKCHEST:
                 image = StackMessage.RoyalChestTex
             elif detail == ItemId.GOLD:
                 pass
             
             imageScale = 0.34999999999999998
             command = localAvatar.guiMgr.showShipPanel
         elif category == 'admin':
             image = StackMessage.AdminTex
             imageScale = 0.29999999999999999
             command = None
         elif category == 'hat':
             image = StackMessage.HatTex
             imageScale = 0.16
             imagePos = (0.10000000000000001, 0, -0.12)
             command = localAvatar.guiMgr.showNonPayer
             extraArgs = [
                 'Restricted_Message_Stack_Panel',
                 10]
         elif category == 'tattoo':
             image = StackMessage.TattooTex
             imageScale = 0.12
             imagePos = (0.10000000000000001, 0, -0.10000000000000001)
             command = localAvatar.guiMgr.showNonPayer
             extraArgs = [
                 None,
                 10]
         elif category == 'pork':
             image = StackMessage.PorkChunkTex
             imageScale = 0.10000000000000001
             imagePos = (0.10000000000000001, 0, -0.080000000000000002)
             command = localAvatar.guiMgr.showNonPayer
         elif category == 'ship':
             image = StackMessage.ShipTex
             imageScale = 0.17999999999999999
             command = None
         elif category == 'jolly':
             image = StackMessage.JollyTex
             imageScale = 0.12
             command = None
         
         self.circle = DirectButton(parent = self, relief = None, image = StackMessage.CircleTex, image_scale = 0.5, pos = imagePos, command = command, extraArgs = extraArgs)
         if category == 'friends':
             self.icon = OnscreenImage(parent = self.circle, image = image, scale = imageScale, pos = (0.028000000000000001, 0, 0))
             self.icon2 = OnscreenImage(parent = self.circle, image = image, scale = imageScale, pos = (-0.028000000000000001, 0, 0))
         else:
             self.icon = OnscreenImage(parent = self.circle, image = image, scale = imageScale)
コード例 #7
0
    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()
コード例 #8
0
 def cellClick(self, cell, mouseAction=MOUSE_CLICK, task=None):
     if mouseAction == MOUSE_PRESS and cell.inventoryItem:
         cardValue = cell.inventoryItem.itemTuple[1]
         suit = PlayingCardGlobals.getSuit(cardValue, fromOffset=0)
         rank = PlayingCardGlobals.getRank(cardValue, fromOffset=0)
         messenger.send('cardPicked', [suit, rank])
コード例 #9
0
 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()
コード例 #10
0
 def setIcon(self):
     if self.circle:
         self.circle.destroy()
         self.circle = None
     
     if self.icon:
         self.icon.destroy()
         self.icon = None
     
     if self.icon2:
         self.icon2.destroy()
         self.icon2 = None
     
     icon = self['icon']
     if icon:
         (category, detail) = icon
         imagePos = (0.10000000000000001, 0, -0.080000000000000002)
         extraArgs = []
         if category == 'gold':
             image = StackMessage.CoinTex
             imageScale = 0.27000000000000002
             command = localAvatar.guiMgr.showCollectionMain
         elif category == 'skills':
             image = StackMessage.SkillTex
             imageScale = 0.27000000000000002
             command = localAvatar.guiMgr.showSkillPage
         elif category == 'reputation':
             repId = detail
             if repId == InventoryType.OverallRep:
                 model = StackMessage.TopLevel
                 imageScale = 0.089999999999999997
             elif repId == InventoryType.SailingRep:
                 model = StackMessage.SkillIcons
                 imageScale = 0.12
             else:
                 model = StackMessage.WeaponIcons
                 imageScale = 0.12
             asset = ReputationGlobals.RepIcons.get(repId)
             image = model.find('**/%s' % asset)
             command = localAvatar.guiMgr.showSkillPage
         elif category == 'card':
             suit = PlayingCardGlobals.getSuit(detail)
             rank = PlayingCardGlobals.getRank(detail)
             image = PlayingCardGlobals.getImage('standard', suit, rank)
             imageScale = 0.20000000000000001
             command = localAvatar.guiMgr.showCollectionMain
         elif category == 'collect':
             name = CollectionMap.Assets[detail]
             image = StackMessage.TreasureGui.find('**/%s*' % name)
             imageScale = 0.34999999999999998
             command = localAvatar.guiMgr.showCollectionMain
         elif category == 'quests':
             image = StackMessage.QuestTex
             imageScale = 0.17999999999999999
             command = localAvatar.guiMgr.showQuestPanel
         elif category == 'crew':
             image = StackMessage.CrewTex
             imageScale = 0.10000000000000001
             command = localAvatar.guiMgr.socialPanel.show
         elif category == 'friends':
             image = StackMessage.FriendTex
             imageScale = (0.059999999999999998, 0, 0.070000000000000007)
             command = localAvatar.guiMgr.socialPanel.show
         elif category == 'guild':
             image = StackMessage.GuildTex
             imageScale = 0.080000000000000002
             command = localAvatar.guiMgr.socialPanel.show
         elif category == 'lookout':
             image = StackMessage.LookoutTex
             imageScale = 0.17999999999999999
             command = localAvatar.guiMgr.showLookoutPanel
         elif category == 'weapon':
             image = StackMessage.WeaponTex
             imageScale = 0.12
             command = localAvatar.guiMgr.showWeaponPanel
         elif category == 'loot':
             if detail == ItemId.CARGO_CRATE:
                 image = StackMessage.CrateTex
             elif detail == ItemId.CARGO_CHEST:
                 image = StackMessage.ChestTex
             elif detail == ItemId.CARGO_SKCHEST:
                 image = StackMessage.RoyalChestTex
             elif detail == ItemId.GOLD:
                 pass
             
             imageScale = 0.34999999999999998
             command = localAvatar.guiMgr.showShipPanel
         elif category == 'admin':
             image = StackMessage.AdminTex
             imageScale = 0.29999999999999999
             command = None
         elif category == 'hat':
             image = StackMessage.HatTex
             imageScale = 0.16
             imagePos = (0.10000000000000001, 0, -0.12)
             command = localAvatar.guiMgr.showNonPayer
             extraArgs = [
                 'Restricted_Message_Stack_Panel',
                 10]
         elif category == 'tattoo':
             image = StackMessage.TattooTex
             imageScale = 0.12
             imagePos = (0.10000000000000001, 0, -0.10000000000000001)
             command = localAvatar.guiMgr.showNonPayer
             extraArgs = [
                 None,
                 10]
         elif category == 'pork':
             image = StackMessage.PorkChunkTex
             imageScale = 0.10000000000000001
             imagePos = (0.10000000000000001, 0, -0.080000000000000002)
             command = localAvatar.guiMgr.showNonPayer
         elif category == 'ship':
             image = StackMessage.ShipTex
             imageScale = 0.17999999999999999
             command = None
         elif category == 'jolly':
             image = StackMessage.JollyTex
             imageScale = 0.12
             command = None
         
         self.circle = DirectButton(parent = self, relief = None, image = StackMessage.CircleTex, image_scale = 0.5, pos = imagePos, command = command, extraArgs = extraArgs)
         if category == 'friends':
             self.icon = OnscreenImage(parent = self.circle, image = image, scale = imageScale, pos = (0.028000000000000001, 0, 0))
             self.icon2 = OnscreenImage(parent = self.circle, image = image, scale = imageScale, pos = (-0.028000000000000001, 0, 0))
         else:
             self.icon = OnscreenImage(parent = self.circle, image = image, scale = imageScale)