Ejemplo n.º 1
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()
 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()