Exemple #1
0
 def getClothingIcon(self, clothingId):
     card = loader.loadModel('models/textureCards/tailorIcons')
     clothingType = ClothingGlobals.getItemType(clothingId)
     if clothingType == 0:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_hat')
     else:
         if clothingType == 1:
             clothingIcon = loader.loadModel('models/gui/char_gui').find(
                 '**/chargui_cloth')
         else:
             if clothingType == 2:
                 clothingIcon = self.tailorGui.find(
                     '**/icon_shop_tailor_vest')
             else:
                 if clothingType == 3:
                     clothingIcon = self.tailorGui.find(
                         '**/icon_shop_tailor_coat')
                 else:
                     if clothingType == 4:
                         clothingIcon = self.tailorGui.find(
                             '**/icon_shop_tailor_pants')
                     else:
                         if clothingType == 5:
                             clothingIcon = self.tailorGui.find(
                                 '**/icon_shop_tailor_belt')
                         else:
                             if clothingType == 6:
                                 clothingIcon = self.tailorGui.find(
                                     '**/icon_shop_tailor_sock')
                             else:
                                 clothingIcon = self.tailorGui.find(
                                     '**/icon_shop_tailor_booths')
     card.removeNode()
     del card
     return clothingIcon
 def makeItem(self, itemId, index):
     checkBox = CheckButton(parent=self,
                            relief=None,
                            scale=0.35,
                            value=self.isItemEquipped(itemId),
                            pos=(-0.17, 0, -0.42 - index * 0.075),
                            state=DGG.DISABLED)
     typeText = ClothingGlobals.getClothingTypeName(
         ItemGlobals.getType(itemId))
     label = DirectLabel(parent=self,
                         relief=None,
                         text_scale=PiratesGuiGlobals.TextScaleLarge,
                         text_fg=PiratesGuiGlobals.TextFG0,
                         text_align=TextNode.ALeft,
                         text=typeText,
                         pos=(-0.12, 0, -0.43 - index * 0.075))
     return (checkBox, label)
 def getClothingIcon(self, clothingId):
     card = loader.loadModel('models/textureCards/tailorIcons')
     clothingType = ClothingGlobals.getItemType(clothingId)
     if clothingType == 0:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_hat')
     elif clothingType == 1:
         clothingIcon = loader.loadModel('models/gui/char_gui').find('**/chargui_cloth')
     elif clothingType == 2:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_vest')
     elif clothingType == 3:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_coat')
     elif clothingType == 4:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_pants')
     elif clothingType == 5:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_belt')
     elif clothingType == 6:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_sock')
     else:
         clothingIcon = self.tailorGui.find('**/icon_shop_tailor_booths')
     card.removeNode()
     del card
     return clothingIcon
    def showDetails(self, cell, detailsPos, detailsHeight, event=None):
        self.notify.debug('Item showDetails')
        if self.manager.heldItem and self.manager.locked and cell.isEmpty(
        ) or not (self.itemTuple):
            self.notify.debug(' early exit')
            return None

        itemId = self.getId()
        self.helpFrame = DirectFrame(parent=self.manager,
                                     relief=None,
                                     state=DGG.DISABLED,
                                     sortOrder=1)
        self.helpFrame.setBin('gui-popup', -5)
        detailGui = loader.loadModel('models/gui/gui_card_detail')
        topGui = loader.loadModel('models/gui/toplevel_gui')
        coinImage = topGui.find('**/treasure_w_coin*')
        halfWidth = 0.29999999999999999
        halfHeight = 0.20000000000000001
        basePosX = cell.getX(aspect2d)
        basePosZ = cell.getZ(aspect2d)
        cellSizeX = 0.0
        cellSizeZ = 0.0
        if cell:
            cellSizeX = cell.cellSizeX
            cellSizeZ = cell.cellSizeZ

        textScale = PiratesGuiGlobals.TextScaleMed
        titleScale = PiratesGuiGlobals.TextScaleTitleSmall
        if len(self.getName()) >= 30:
            titleNameScale = PiratesGuiGlobals.TextScaleLarge
        else:
            titleNameScale = PiratesGuiGlobals.TextScaleExtraLarge
        subtitleScale = PiratesGuiGlobals.TextScaleMed
        iconScalar = 1.5
        borderScaler = 0.25
        splitHeight = 0.01
        vMargin = 0.029999999999999999
        runningVertPosition = 0.29999999999999999
        runningSize = 0.0
        labels = []
        titleColor = PiratesGuiGlobals.TextFG6
        rarity = ItemGlobals.getRarity(itemId)
        rarityText = PLocalizer.getItemRarityName(rarity)
        typeText = ClothingGlobals.getClothingTypeName(
            ItemGlobals.getType(itemId))
        if rarity == ItemGlobals.CRUDE:
            titleColor = PiratesGuiGlobals.TextFG24
        elif rarity == ItemGlobals.COMMON:
            titleColor = PiratesGuiGlobals.TextFG13
        elif rarity == ItemGlobals.RARE:
            titleColor = PiratesGuiGlobals.TextFG4
        elif rarity == ItemGlobals.FAMED:
            titleColor = PiratesGuiGlobals.TextFG5

        titleLabel = DirectLabel(parent=self,
                                 relief=None,
                                 text=self.getName(),
                                 text_scale=titleNameScale,
                                 text_fg=titleColor,
                                 text_shadow=PiratesGuiGlobals.TextShadow,
                                 text_align=TextNode.ACenter,
                                 pos=(0.0, 0.0, runningVertPosition),
                                 text_pos=(0.0, -textScale))
        self.bg.setColor(titleColor)
        tHeight = 0.070000000000000007
        titleLabel.setZ(runningVertPosition)
        runningVertPosition -= tHeight
        runningSize += tHeight
        labels.append(titleLabel)
        subtitleLabel = DirectLabel(parent=self,
                                    relief=None,
                                    text='\x001slant\x001%s %s\x002' %
                                    (rarityText, typeText),
                                    text_scale=subtitleScale,
                                    text_fg=PiratesGuiGlobals.TextFG2,
                                    text_shadow=PiratesGuiGlobals.TextShadow,
                                    text_align=TextNode.ACenter,
                                    pos=(0.0, 0.0, runningVertPosition),
                                    text_pos=(0.0, -textScale))
        subtHeight = 0.050000000000000003
        subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
        runningVertPosition -= subtHeight
        runningSize += subtHeight
        labels.append(subtitleLabel)
        clothingType = ItemGlobals.getType(itemId)
        if localAvatar.style.getGender() == 'm':
            maleModelId = ItemGlobals.getMaleModelId(itemId)
            if maleModelId != -1:
                modelId = maleModelId
                texId = ItemGlobals.getMaleTextureId(itemId)
                dna = HumanDNA.HumanDNA(localAvatar.style.gender)
                dna.copy(localAvatar.style)
                gender = 'm'
            else:
                modelId = ItemGlobals.getFemaleModelId(itemId)
                texId = ItemGlobals.getFemaleTextureId(itemId)
                dna = HumanDNA.HumanDNA('f')
                gender = 'f'
        else:
            femaleModelId = ItemGlobals.getFemaleModelId(itemId)
            if femaleModelId != -1:
                modelId = femaleModelId
                texId = ItemGlobals.getFemaleTextureId(itemId)
                dna = HumanDNA.HumanDNA(localAvatar.style.gender)
                dna.copy(localAvatar.style)
                gender = 'f'
            else:
                modelId = ItemGlobals.getMaleModelId(itemId)
                texId = ItemGlobals.getMaleTextureId(itemId)
                dna = HumanDNA.HumanDNA('m')
                gender = 'm'
        bodyShape = localAvatar.style.getBodyShape()
        bodyHeight = localAvatar.style.getBodyHeight()
        bodyOffset = 0.5
        headOffset = 0
        topOffset = 0
        pantOffset = 0
        beltOffset = 0
        shoeOffset = 0
        if bodyShape == 0:
            bodyOffset = 1
            headOffset = 0.69999999999999996
            topOffset = 0.69999999999999996
            pantOffset = 0.20000000000000001
            beltOffset = 0.5
        elif bodyShape == 1:
            bodyOffset = 0
            if gender == 'm':
                headOffset = -0.10000000000000001
                beltOffset = 0.10000000000000001
                shoeOffset = 0.10000000000000001
            elif gender == 'f':
                headOffset = 0.59999999999999998
                topOffset = 0.40000000000000002
                beltOffset = 0.40000000000000002
                shoeOffset = 0.10000000000000001

        elif bodyShape == 2:
            bodyOffset = 0.5
        elif bodyShape == 3:
            bodyOffset = 1
            if gender == 'm':
                topOffset = 0.10000000000000001
                beltOffset = 0.10000000000000001
            elif gender == 'f':
                headOffset = -0.40000000000000002
                topOffset = -0.10000000000000001
                beltOffset = -0.10000000000000001
                pantOffset = -0.10000000000000001

        elif bodyShape == 4:
            bodyOffset = 0.5
            if gender == 'm':
                headOffset = -0.20000000000000001
                topOffset = -0.29999999999999999
            elif gender == 'f':
                headOffset = 0.10000000000000001
                beltOffset = 0.10000000000000001

        elif bodyShape == 5:
            bodyOffset = 0.5
        elif bodyShape == 6:
            bodyOffset = 0.5
            if gender == 'f':
                headOffset = 0.40000000000000002
                topOffset = 0.40000000000000002
                beltOffset = 0.29999999999999999

        elif bodyShape == 7:
            bodyOffset = 0.5
        elif bodyShape == 8:
            bodyOffset = 0.5
            headOffset = -0.20000000000000001
            topOffset = -0.20000000000000001
        elif bodyShape == 9:
            bodyOffset = 0.5
            headOffset = -0.20000000000000001
            topOffset = -0.20000000000000001

        m = Mat4(Mat4.identMat())
        topColor = localAvatar.style.getClothesBotColor()
        botColor = localAvatar.style.getClothesTopColor()
        hatColor = localAvatar.style.getHatColor()
        (shirtIdx, shirtTex) = localAvatar.style.getClothesShirt()
        (hatIdx, hatTex) = localAvatar.style.getClothesHat()
        (coatIdx, coatTex) = localAvatar.style.getClothesCoat()
        (beltIdx, beltTex) = localAvatar.style.getClothesBelt()
        (shoeIdx, shoeTex) = localAvatar.style.getClothesShoe()
        (vestIdx, vestTex) = localAvatar.style.getClothesVest()
        (pantIdx, pantTex) = localAvatar.style.getClothesPant()
        dna.setClothesBotColor(topColor[0], topColor[1], topColor[2])
        dna.setClothesTopColor(botColor[0], botColor[1], botColor[2])
        dna.setHatColor(hatColor)
        dna.setClothesShirt(shirtIdx, shirtTex)
        dna.setClothesHat(hatIdx, hatTex)
        dna.setClothesBelt(beltIdx, beltTex)
        dna.setClothesPant(pantIdx, pantTex)
        dna.setClothesShoe(shoeIdx, shoeTex)
        if clothingType == ClothingGlobals.SHIRT:
            dna.setClothesVest(0)
            dna.setClothesCoat(0)
        elif clothingType == ClothingGlobals.VEST:
            dna.setClothesCoat(0)
        elif clothingType == ClothingGlobals.BELT:
            dna.setClothesCoat(0)
            dna.setClothesVest(0)
        else:
            dna.setClothesVest(vestIdx, vestTex)
            dna.setClothesCoat(coatIdx, coatTex)
        dna.setClothesByType(ClothingGlobals.CLOTHING_STRING[clothingType],
                             modelId, texId, self.itemTuple[3])
        self.displayHuman.setDNAString(dna)
        self.displayHuman.generateHuman(gender, self.masterHuman)
        self.displayHuman.stopBlink()
        self.displayHuman.pose('idle', 1)
        lodNode = self.displayHuman.find('**/+LODNode').node()
        lodNode.forceSwitch(lodNode.getHighestSwitch())
        if clothingType == ClothingGlobals.HAT:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_head01').getNetTransform(m)
            headHeight = TransformState.makeMat(m).getPos().getZ()
            offsetZ = (-headHeight -
                       0.40000000000000002) + headOffset - bodyHeight * 1.0
            offsetY = 2.0 + bodyOffset
            offsetH = 200
        elif clothingType == ClothingGlobals.SHIRT:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_spine03').getNetTransform(m)
            spine3Height = TransformState.makeMat(m).getPos().getZ()
            offsetZ = -spine3Height + topOffset - bodyHeight * 1.3999999999999999
            offsetY = 3.25 + bodyOffset
            offsetH = 200
        elif clothingType == ClothingGlobals.VEST:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_spine03').getNetTransform(m)
            spine3Height = TransformState.makeMat(m).getPos().getZ()
            offsetZ = -spine3Height + topOffset - bodyHeight * 1.3999999999999999
            offsetY = 3.5 + bodyOffset
            offsetH = 200
        elif clothingType == ClothingGlobals.COAT:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_spine02').getNetTransform(m)
            spine2Height = TransformState.makeMat(m).getPos().getZ()
            offsetZ = -spine2Height + topOffset - bodyHeight * 1.3999999999999999
            offsetY = 4.5 + bodyOffset
            offsetH = 200
        elif clothingType == ClothingGlobals.PANT:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_right_knee').getNetTransform(m)
            kneeHeight = TransformState.makeMat(m).getPos().getZ()
            offsetZ = -kneeHeight + pantOffset - 0.5 - bodyHeight * 0.29999999999999999
            offsetY = 4.5 + bodyOffset
            offsetH = 200
        elif clothingType == ClothingGlobals.BELT:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_hips').getNetTransform(m)
            hipHeight = TransformState.makeMat(m).getPos().getZ()
            offsetZ = -hipHeight + beltOffset - bodyHeight * 0.5
            offsetY = 1.7 + bodyOffset
            offsetH = 180
        elif clothingType == ClothingGlobals.SHOE:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_right_ankle').getNetTransform(m)
            ankleHeight = TransformState.makeMat(m).getPos().getZ()
            offsetZ = -ankleHeight + shoeOffset - 0.14999999999999999 - bodyHeight * -0.10000000000000001
            offsetY = 3.25 + bodyOffset
            offsetH = 200
        else:
            offsetZ = 0
            offsetY = 0
            offsetH = 0
        offsetX = 0
        self.displayHuman.setY(offsetY)
        self.displayHuman.setZ(offsetZ)
        self.displayHuman.setX(offsetX)
        self.displayHuman.setH(offsetH)
        self.displayHuman.reparentTo(self.portraitSceneGraph)
        iHeight = 0.17999999999999999
        self.createBuffer()
        self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
        runningVertPosition -= iHeight
        runningSize += iHeight
        labels.append(self.itemCard)
        if self.showResaleValue:
            value = int(
                ItemGlobals.getGoldCost(itemId) *
                ItemGlobals.GOLD_SALE_MULTIPLIER)
        else:
            value = ItemGlobals.getGoldCost(itemId)
        itemCost = int(ItemGlobals.getGoldCost(itemId))
        if self.cell and self.cell.container:
            itemCost = int(itemCost * self.cell.container.getItemPriceMult())

        goldLabel = DirectLabel(
            parent=self,
            relief=None,
            image=coinImage,
            image_scale=0.12,
            image_pos=Vec3(0.025000000000000001, 0, -0.02),
            text=str(itemCost),
            text_scale=subtitleScale,
            text_align=TextNode.ARight,
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            pos=(halfWidth - 0.050000000000000003, 0.0,
                 runningVertPosition + 0.080000000000000002),
            text_pos=(0.0, -textScale))
        labels.append(goldLabel)
        descriptionLabel = DirectLabel(
            parent=self,
            relief=None,
            text=PLocalizer.getItemFlavorText(itemId),
            text_scale=textScale,
            text_wordwrap=halfWidth * 2.0 * (0.94999999999999996 / textScale),
            text_fg=PiratesGuiGlobals.TextFG0,
            text_align=TextNode.ALeft,
            pos=(-halfWidth + textScale * 0.5, 0.0, runningVertPosition),
            text_pos=(0.0, -textScale))
        dHeight = descriptionLabel.getHeight() + 0.02
        runningVertPosition -= dHeight
        runningSize += dHeight
        labels.append(descriptionLabel)
        if not Freebooter.getPaidStatus(localAvatar.getDoId()):
            if rarity != ItemGlobals.CRUDE:
                unlimitedLabel = DirectLabel(
                    parent=self,
                    relief=None,
                    text=PLocalizer.UnlimitedAccessRequirement,
                    text_scale=textScale,
                    text_wordwrap=halfWidth * 2.0 * (1.5 / titleScale),
                    text_fg=PiratesGuiGlobals.TextFG6,
                    text_shadow=PiratesGuiGlobals.TextShadow,
                    text_align=TextNode.ACenter,
                    pos=(0.0, 0.0, runningVertPosition),
                    text_pos=(0.0, -textScale))
                uHeight = unlimitedLabel.getHeight()
                runningVertPosition -= uHeight
                runningSize += uHeight
                labels.append(unlimitedLabel)

        runningVertPosition -= 0.02
        runningSize += 0.02
        panels = self.helpFrame.attachNewNode('panels')
        topPanel = panels.attachNewNode('middlePanel')
        detailGui.find('**/top_panel').copyTo(topPanel)
        topPanel.setScale(0.080000000000000002)
        topPanel.reparentTo(self.helpFrame)
        middlePanel = panels.attachNewNode('middlePanel')
        detailGui.find('**/middle_panel').copyTo(middlePanel)
        middlePanel.setScale(0.080000000000000002)
        middlePanel.reparentTo(self.helpFrame)
        placement = 0
        i = 0
        heightMax = -0.080000000000000002
        currentHeight = runningVertPosition
        if detailsHeight:
            currentHeight = -detailsHeight

        while currentHeight < heightMax:
            middlePanel = panels.attachNewNode('middlePanel%s' % 1)
            detailGui.find('**/middle_panel').copyTo(middlePanel)
            middlePanel.setScale(0.080000000000000002)
            middlePanel.reparentTo(self.helpFrame)
            if currentHeight + 0.20000000000000001 >= heightMax:
                difference = heightMax - currentHeight
                placement += (0.16800000000000001 /
                              0.20000000000000001) * difference
                currentHeight += difference
            else:
                placement += 0.16800000000000001
                currentHeight += 0.20000000000000001
            middlePanel.setZ(-placement)
            i += 1
        bottomPanel = panels.attachNewNode('bottomPanel')
        detailGui.find('**/bottom_panel').copyTo(bottomPanel)
        bottomPanel.setScale(0.080000000000000002)
        bottomPanel.setZ(-placement)
        bottomPanel.reparentTo(self.helpFrame)
        colorPanel = self.helpFrame.attachNewNode('colorPanel')
        detailGui.find('**/color').copyTo(colorPanel)
        colorPanel.setScale(0.080000000000000002)
        colorPanel.setColor(titleColor)
        colorPanel.reparentTo(self.helpFrame)
        lineBreakTopPanel = panels.attachNewNode('lineBreakTopPanel')
        detailGui.find('**/line_break_top').copyTo(lineBreakTopPanel)
        lineBreakTopPanel.setScale(0.080000000000000002, 0.080000000000000002,
                                   0.070000000000000007)
        lineBreakTopPanel.setZ(0.0080000000000000002)
        lineBreakTopPanel.reparentTo(self.helpFrame)
        panels.flattenStrong()
        self.helpFrame['frameSize'] = (-halfWidth, halfWidth,
                                       -(runningSize + vMargin), vMargin)
        totalHeight = self.helpFrame.getHeight() - 0.10000000000000001
        for label in labels:
            label.reparentTo(self.helpFrame)

        if basePosX > 0.0:
            newPosX = basePosX - halfWidth + cellSizeX * 0.45000000000000001
        else:
            newPosX = basePosX + halfWidth + cellSizeX * 0.45000000000000001
        if basePosZ > 0.0:
            newPosZ = basePosZ + cellSizeZ * 0.45000000000000001
        else:
            newPosZ = basePosZ + totalHeight - cellSizeZ * 0.75
        if detailsPos:
            (newPosX, newPosZ) = detailsPos

        self.helpFrame.setPos(newPosX, 0, newPosZ)
    def showLoot(self,
                 plunder=[],
                 gold=0,
                 collect=0,
                 card=0,
                 cloth=0,
                 color=0,
                 jewel=None,
                 tattoo=None,
                 weapon=None,
                 bounty=0):
        for loot in self.loot:
            loot.destroy()
            del loot

        self.loot = []
        gender = localAvatar.style.getGender()
        self.show()
        self.setAlphaScale(1.0)
        treasure = []
        for itemId in self.icons.iterkeys():
            count = 0
            for item in plunder:
                if item == itemId:
                    count += 1
                    continue

            if count > 0:
                treasure.append([itemId, count])
                continue

        plunder = treasure
        if gold:
            plunder.append([ItemId.GOLD, gold])
            LootPopupPanel.lootSfx.play()

        if bounty:
            plunder.append([ItemId.BOUNTY, bounty])
            LootPopupPanel.lootSfx.play()

        if collect:
            plunder.append([ItemId.COLLECT, collect])
            LootPopupPanel.lootSfx.play()

        if card:
            plunder.append([ItemId.CARD, card])
            LootPopupPanel.lootSfx.play()

        if cloth:
            plunder.append([ItemId.CLOTHING, (cloth, color)])
            LootPopupPanel.lootSfx.play()

        if jewel is not None:
            plunder.append([ItemId.QUEST_DROP_JEWEL, jewel])
            LootPopupPanel.lootSfx.play()

        if tattoo is not None:
            plunder.append([ItemId.QUEST_DROP_TATTOO, tattoo])
            LootPopupPanel.lootSfx.play()

        if weapon is not None:
            plunder.append([ItemId.QUEST_DROP_WEAPON, weapon])
            LootPopupPanel.lootSfx.play()

        for item in plunder:
            (itemType, quantity) = item
            if itemType == ItemId.COLLECT:
                itemId = quantity
                howRare = CollectionMap.Collection_Rarity.get(itemId, 0)
                rarityText = PLocalizer.CollectionRarities.get(howRare)
                value = CollectionValues.get(howRare, 0)
                itemName = PLocalizer.Collections[itemId]
                howManyDoIHave = localAvatar.getInventory().getStackQuantity(
                    itemId)
                howManyINeed = CollectionMap.Collection_Needed.get(itemId, 1)
                if howManyDoIHave < howManyINeed:
                    textInfo = PLocalizer.CollectionPopupNewText % (
                        itemName, rarityText, value)
                else:
                    textInfo = PLocalizer.CollectionPopupDuplicateText % (
                        itemName, rarityText, value)
                pic_name = CollectionMap.Assets[itemId]
                lootIcon = LootPopupPanel.TreasureGui.find('**/%s*' % pic_name)
                iconScale = 0.34999999999999998
            elif itemType == ItemId.CLOTHING:
                (clothingId, colorId) = quantity
                if clothingId in ClothingGlobals.quest_items:
                    textInfo = PLocalizer.getItemName(clothingId)
                else:
                    textInfo = PLocalizer.TailorColorStrings.get(colorId)
                    textInfo = textInfo + ' ' + ClothingGlobals.getClothingTypeName(
                        ItemGlobals.getType(clothingId))
                clothingType = ItemGlobals.getType(clothingId)
                iconScale = 0.13
                if clothingType == 0:
                    lootIcon = LootPopupPanel.TailorGui.find(
                        '**/icon_shop_tailor_hat')
                elif clothingType == 1:
                    lootIcon = loader.loadModel('models/gui/char_gui').find(
                        '**/chargui_cloth')
                    iconScale = 0.29999999999999999
                elif clothingType == 2:
                    lootIcon = LootPopupPanel.TailorGui.find(
                        '**/icon_shop_tailor_vest')
                elif clothingType == 3:
                    lootIcon = LootPopupPanel.TailorGui.find(
                        '**/icon_shop_tailor_coat')
                elif clothingType == 4:
                    lootIcon = LootPopupPanel.TailorGui.find(
                        '**/icon_shop_tailor_pants')
                elif clothingType == 5:
                    lootIcon = LootPopupPanel.TailorGui.find(
                        '**/icon_shop_tailor_belt')
                elif clothingType == 6:
                    lootIcon = LootPopupPanel.TailorGui.find(
                        '**/icon_shop_tailor_sock')
                else:
                    lootIcon = LootPopupPanel.TailorGui.find(
                        '**/icon_shop_tailor_booths')
            elif itemType == ItemId.CARD:
                textInfo = PLocalizer.InventoryTypeNames.get(quantity)
                pic_name = ''
                lootIcon = PlayingCardGlobals.getImage(
                    'standard', PlayingCardGlobals.getSuit(quantity),
                    PlayingCardGlobals.getRank(quantity))
                iconScale = 0.20000000000000001
            elif itemType == ItemId.GOLD:
                textInfo = PLocalizer.LootGold % str(quantity)
                potionPercent = PotionGlobals.getGoldBoostEffectPercent(
                    localAvatar)
                potionGold = 0
                textInfo = PLocalizer.LootGold % str(quantity)
                if base.cr.newsManager:
                    if base.cr.newsManager.getHoliday(
                            HolidayGlobals.DOUBLEGOLDHOLIDAYPAID
                    ) or Freebooter.getPaidStatus(base.localAvatar.getDoId(
                    )) or base.cr.newsManager.getHoliday(
                            HolidayGlobals.DOUBLEGOLDHOLIDAY):
                        textInfo = PLocalizer.LootGold % str(
                            quantity /
                            2) + '\n + ' + PLocalizer.LootGoldDouble % str(
                                quantity / 2)

                if potionGold > 0:
                    textInfo += '\n + ' + PLocalizer.LootGoldPotionBoost % str(
                        potionGold)

                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.27000000000000002
            elif itemType == ItemId.BOUNTY:
                textInfo = PLocalizer.LootBounty % str(quantity)
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.27000000000000002
            elif itemType == ItemId.CARGO_CRATE:
                if quantity == 1:
                    textInfo = PLocalizer.CargoCrate % quantity
                else:
                    textInfo = PLocalizer.CargoCrateP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.CARGO_CHEST:
                if quantity == 1:
                    textInfo = PLocalizer.CargoChest % quantity
                else:
                    textInfo = PLocalizer.CargoChestP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.CARGO_SKCHEST:
                if quantity == 1:
                    textInfo = PLocalizer.CargoSkChest % quantity
                else:
                    textInfo = PLocalizer.CargoSkChestP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.CARGO_LOOTSAC:
                if quantity == 1:
                    textInfo = PLocalizer.LootSac % quantity
                else:
                    textInfo = PLocalizer.LootSacP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.CARGO_LOOTCHEST:
                if quantity == 1:
                    textInfo = PLocalizer.LootChest % quantity
                else:
                    textInfo = PLocalizer.LootChestP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.CARGO_LOOTSKCHEST:
                if quantity == 1:
                    textInfo = PLocalizer.LootSkChest % quantity
                else:
                    textInfo = PLocalizer.LootSkChestP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.CARGO_SHIPUPGRADECHEST:
                if quantity == 1:
                    textInfo = PLocalizer.LootUpgradeChest % quantity
                else:
                    textInfo = PLocalizer.LootUpgradeChestP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.CARGO_SHIPUPGRADESKCHEST:
                if quantity == 1:
                    textInfo = PLocalizer.LootRareUpgradeChest % quantity
                else:
                    textInfo = PLocalizer.LootRareUpgradeChestP % quantity
                lootIcon = self.icons.get(itemType)[0]
                iconScale = 0.089999999999999997
            elif itemType == ItemId.QUEST_DROP_JEWEL:
                textInfo = None
                type = None
                lootIcon = None
                iconScale = 1.0
                type = ItemGlobals.getType(quantity)
                textInfo = PLocalizer.getItemName(quantity)
                if type == ItemGlobals.BROW:
                    lootIcon = LootPopupPanel.JewelerIconsB.find(
                        '**/icon_shop_tailor_brow')
                    iconScale = (-0.14000000000000001, 0.14000000000000001,
                                 0.14000000000000001)
                elif type == ItemGlobals.EAR:
                    lootIcon = LootPopupPanel.JewelerIconsA.find(
                        '**/chargui_ears')
                    iconScale = (-0.34999999999999998, 0.34999999999999998,
                                 0.34999999999999998)
                elif type == ItemGlobals.NOSE:
                    lootIcon = LootPopupPanel.JewelerIconsA.find(
                        '**/chargui_nose')
                    iconScale = (0.34999999999999998, 0.34999999999999998,
                                 0.34999999999999998)
                elif type == ItemGlobals.MOUTH:
                    lootIcon = LootPopupPanel.JewelerIconsA.find(
                        '**/chargui_mouth')
                    iconScale = (0.32500000000000001, 0.32500000000000001,
                                 0.32500000000000001)
                elif type == ItemGlobals.HAND:
                    lootIcon = LootPopupPanel.JewelerIconsB.find(
                        '**/icon_shop_tailor_hand')
                    iconScale = (0.125, 0.125, 0.125)
                else:
                    lootIcon = None
            elif itemType == ItemId.QUEST_DROP_TATTOO:
                textInfo = None
                type = None
                lootIcon = None
                iconScale = 1.0
                type = ItemGlobals.getType(quantity)
                textInfo = PLocalizer.getItemName(quantity)
                if type == ItemGlobals.CHEST:
                    lootIcon = LootPopupPanel.TattooIcons.find(
                        '**/icon_shop_tailor_chest_male')
                    iconScale = 0.10000000000000001
                elif type == ItemGlobals.ARM:
                    lootIcon = LootPopupPanel.TattooIcons.find(
                        '**/icon_shop_tailor_arm')
                    iconScale = 0.10000000000000001
                elif type == ItemGlobals.FACE:
                    lootIcon = LootPopupPanel.TattooIcons.find(
                        '**/icon_shop_tailor_face_male')
                    iconScale = 0.10000000000000001
                else:
                    lootIcon = None
            elif itemType == ItemId.QUEST_DROP_WEAPON:
                weaponId = quantity
                iconScale = 0.10000000000000001
                textInfo = None
                lootIcon = None
                iconName = getItemIcons(weaponId)
                if iconName is not None:
                    lootIcon = LootPopupPanel.WeaponIcons.find('**/' +
                                                               iconName)
                    textInfo = PLocalizer.InventoryTypeNames.get(weaponId)

            entry = DirectFrame(parent=self,
                                relief=None,
                                geom=lootIcon,
                                geom_scale=iconScale,
                                text=textInfo,
                                text_scale=PiratesGuiGlobals.TextScaleSmall,
                                text_align=TextNode.ALeft,
                                text_fg=PiratesGuiGlobals.TextFG0,
                                text_pos=(0.070000000000000007, 0.01),
                                text_font=PiratesGlobals.getInterfaceFont())
            entry.setTransparency(1)
            self.loot.append(entry)

        self.repackPanels()
 def showLoot(self, plunder = [], gold = 0, collect = 0, card = 0, cloth = 0, color = 0, jewel = None, tattoo = None, weapon = None, bounty = 0):
     for loot in self.loot:
         loot.destroy()
         del loot
     
     self.loot = []
     gender = localAvatar.style.getGender()
     self.show()
     self.setAlphaScale(1.0)
     treasure = []
     for itemId in self.icons.iterkeys():
         count = 0
         for item in plunder:
             if item == itemId:
                 count += 1
                 continue
         
         if count > 0:
             treasure.append([
                 itemId,
                 count])
             continue
     
     plunder = treasure
     if gold:
         plunder.append([
             ItemId.GOLD,
             gold])
         LootPopupPanel.lootSfx.play()
     
     if bounty:
         plunder.append([
             ItemId.BOUNTY,
             bounty])
         LootPopupPanel.lootSfx.play()
     
     if collect:
         plunder.append([
             ItemId.COLLECT,
             collect])
         LootPopupPanel.lootSfx.play()
     
     if card:
         plunder.append([
             ItemId.CARD,
             card])
         LootPopupPanel.lootSfx.play()
     
     if cloth:
         plunder.append([
             ItemId.CLOTHING,
             (cloth, color)])
         LootPopupPanel.lootSfx.play()
     
     if jewel is not None:
         plunder.append([
             ItemId.QUEST_DROP_JEWEL,
             jewel])
         LootPopupPanel.lootSfx.play()
     
     if tattoo is not None:
         plunder.append([
             ItemId.QUEST_DROP_TATTOO,
             tattoo])
         LootPopupPanel.lootSfx.play()
     
     if weapon is not None:
         plunder.append([
             ItemId.QUEST_DROP_WEAPON,
             weapon])
         LootPopupPanel.lootSfx.play()
     
     for item in plunder:
         (itemType, quantity) = item
         if itemType == ItemId.COLLECT:
             itemId = quantity
             howRare = CollectionMap.Collection_Rarity.get(itemId, 0)
             rarityText = PLocalizer.CollectionRarities.get(howRare)
             value = CollectionValues.get(howRare, 0)
             itemName = PLocalizer.Collections[itemId]
             howManyDoIHave = localAvatar.getInventory().getStackQuantity(itemId)
             howManyINeed = CollectionMap.Collection_Needed.get(itemId, 1)
             if howManyDoIHave < howManyINeed:
                 textInfo = PLocalizer.CollectionPopupNewText % (itemName, rarityText, value)
             else:
                 textInfo = PLocalizer.CollectionPopupDuplicateText % (itemName, rarityText, value)
             pic_name = CollectionMap.Assets[itemId]
             lootIcon = LootPopupPanel.TreasureGui.find('**/%s*' % pic_name)
             iconScale = 0.34999999999999998
         elif itemType == ItemId.CLOTHING:
             (clothingId, colorId) = quantity
             if clothingId in ClothingGlobals.quest_items:
                 textInfo = PLocalizer.getItemName(clothingId)
             else:
                 textInfo = PLocalizer.TailorColorStrings.get(colorId)
                 textInfo = textInfo + ' ' + ClothingGlobals.getClothingTypeName(ItemGlobals.getType(clothingId))
             clothingType = ItemGlobals.getType(clothingId)
             iconScale = 0.13
             if clothingType == 0:
                 lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_hat')
             elif clothingType == 1:
                 lootIcon = loader.loadModel('models/gui/char_gui').find('**/chargui_cloth')
                 iconScale = 0.29999999999999999
             elif clothingType == 2:
                 lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_vest')
             elif clothingType == 3:
                 lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_coat')
             elif clothingType == 4:
                 lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_pants')
             elif clothingType == 5:
                 lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_belt')
             elif clothingType == 6:
                 lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_sock')
             else:
                 lootIcon = LootPopupPanel.TailorGui.find('**/icon_shop_tailor_booths')
         elif itemType == ItemId.CARD:
             textInfo = PLocalizer.InventoryTypeNames.get(quantity)
             pic_name = ''
             lootIcon = PlayingCardGlobals.getImage('standard', PlayingCardGlobals.getSuit(quantity), PlayingCardGlobals.getRank(quantity))
             iconScale = 0.20000000000000001
         elif itemType == ItemId.GOLD:
             textInfo = PLocalizer.LootGold % str(quantity)
             potionPercent = PotionGlobals.getGoldBoostEffectPercent(localAvatar)
             potionGold = 0
             textInfo = PLocalizer.LootGold % str(quantity)
             if base.cr.newsManager:
                 if base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAYPAID) or Freebooter.getPaidStatus(base.localAvatar.getDoId()) or base.cr.newsManager.getHoliday(HolidayGlobals.DOUBLEGOLDHOLIDAY):
                     textInfo = PLocalizer.LootGold % str(quantity / 2) + '\n + ' + PLocalizer.LootGoldDouble % str(quantity / 2)
                 
             if potionGold > 0:
                 textInfo += '\n + ' + PLocalizer.LootGoldPotionBoost % str(potionGold)
             
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.27000000000000002
         elif itemType == ItemId.BOUNTY:
             textInfo = PLocalizer.LootBounty % str(quantity)
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.27000000000000002
         elif itemType == ItemId.CARGO_CRATE:
             if quantity == 1:
                 textInfo = PLocalizer.CargoCrate % quantity
             else:
                 textInfo = PLocalizer.CargoCrateP % quantity
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.089999999999999997
         elif itemType == ItemId.CARGO_CHEST:
             if quantity == 1:
                 textInfo = PLocalizer.CargoChest % quantity
             else:
                 textInfo = PLocalizer.CargoChestP % quantity
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.089999999999999997
         elif itemType == ItemId.CARGO_SKCHEST:
             if quantity == 1:
                 textInfo = PLocalizer.CargoSkChest % quantity
             else:
                 textInfo = PLocalizer.CargoSkChestP % quantity
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.089999999999999997
         elif itemType == ItemId.CARGO_LOOTSAC:
             if quantity == 1:
                 textInfo = PLocalizer.LootSac % quantity
             else:
                 textInfo = PLocalizer.LootSacP % quantity
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.089999999999999997
         elif itemType == ItemId.CARGO_LOOTCHEST:
             if quantity == 1:
                 textInfo = PLocalizer.LootChest % quantity
             else:
                 textInfo = PLocalizer.LootChestP % quantity
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.089999999999999997
         elif itemType == ItemId.CARGO_LOOTSKCHEST:
             if quantity == 1:
                 textInfo = PLocalizer.LootSkChest % quantity
             else:
                 textInfo = PLocalizer.LootSkChestP % quantity
             lootIcon = self.icons.get(itemType)[0]
             iconScale = 0.089999999999999997
         elif itemType == ItemId.QUEST_DROP_JEWEL:
             textInfo = None
             type = None
             lootIcon = None
             iconScale = 1.0
             type = ItemGlobals.getType(quantity)
             textInfo = PLocalizer.getItemName(quantity)
             if type == ItemGlobals.BROW:
                 lootIcon = LootPopupPanel.JewelerIconsB.find('**/icon_shop_tailor_brow')
                 iconScale = (-0.14000000000000001, 0.14000000000000001, 0.14000000000000001)
             elif type == ItemGlobals.EAR:
                 lootIcon = LootPopupPanel.JewelerIconsA.find('**/chargui_ears')
                 iconScale = (-0.34999999999999998, 0.34999999999999998, 0.34999999999999998)
             elif type == ItemGlobals.NOSE:
                 lootIcon = LootPopupPanel.JewelerIconsA.find('**/chargui_nose')
                 iconScale = (0.34999999999999998, 0.34999999999999998, 0.34999999999999998)
             elif type == ItemGlobals.MOUTH:
                 lootIcon = LootPopupPanel.JewelerIconsA.find('**/chargui_mouth')
                 iconScale = (0.32500000000000001, 0.32500000000000001, 0.32500000000000001)
             elif type == ItemGlobals.LHAND:
                 lootIcon = LootPopupPanel.JewelerIconsB.find('**/icon_shop_tailor_hand')
                 iconScale = (0.125, 0.125, 0.125)
             else:
                 lootIcon = None
         elif itemType == ItemId.QUEST_DROP_TATTOO:
             textInfo = None
             type = None
             lootIcon = None
             iconScale = 1.0
             type = ItemGlobals.getType(quantity)
             textInfo = PLocalizer.getItemName(quantity)
             if type == ItemGlobals.CHEST:
                 lootIcon = LootPopupPanel.TattooIcons.find('**/icon_shop_tailor_chest_male')
                 iconScale = 0.10000000000000001
             elif type == ItemGlobals.ARM:
                 lootIcon = LootPopupPanel.TattooIcons.find('**/icon_shop_tailor_arm')
                 iconScale = 0.10000000000000001
             elif type == ItemGlobals.FACE:
                 lootIcon = LootPopupPanel.TattooIcons.find('**/icon_shop_tailor_face_male')
                 iconScale = 0.10000000000000001
             else:
                 lootIcon = None
         elif itemType == ItemId.QUEST_DROP_WEAPON:
             weaponId = quantity
             iconScale = 0.10000000000000001
             textInfo = None
             lootIcon = None
             iconName = getItemIcons(weaponId)
             if iconName is not None:
                 lootIcon = LootPopupPanel.WeaponIcons.find('**/' + iconName)
                 textInfo = PLocalizer.InventoryTypeNames.get(weaponId)
             
         
         entry = DirectFrame(parent = self, relief = None, geom = lootIcon, geom_scale = iconScale, text = textInfo, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG0, text_pos = (0.070000000000000007, 0.01), text_font = PiratesGlobals.getInterfaceFont())
         entry.setTransparency(1)
         self.loot.append(entry)
     
     self.repackPanels()
 def showDetails(self, cell, detailsPos, detailsHeight, event = None):
     self.notify.debug('Item showDetails')
     if self.manager.heldItem and self.manager.locked and cell.isEmpty() or not (self.itemTuple):
         self.notify.debug(' early exit')
         return None
     
     itemId = self.getId()
     self.helpFrame = DirectFrame(parent = self.manager, relief = None, state = DGG.DISABLED, sortOrder = 1)
     self.helpFrame.setBin('gui-popup', -5)
     detailGui = loader.loadModel('models/gui/gui_card_detail')
     topGui = loader.loadModel('models/gui/toplevel_gui')
     coinImage = topGui.find('**/treasure_w_coin*')
     halfWidth = 0.29999999999999999
     halfHeight = 0.20000000000000001
     basePosX = cell.getX(aspect2d)
     basePosZ = cell.getZ(aspect2d)
     cellSizeX = 0.0
     cellSizeZ = 0.0
     if cell:
         cellSizeX = cell.cellSizeX
         cellSizeZ = cell.cellSizeZ
     
     textScale = PiratesGuiGlobals.TextScaleMed
     titleScale = PiratesGuiGlobals.TextScaleTitleSmall
     if len(self.getName()) >= 30:
         titleNameScale = PiratesGuiGlobals.TextScaleLarge
     else:
         titleNameScale = PiratesGuiGlobals.TextScaleExtraLarge
     subtitleScale = PiratesGuiGlobals.TextScaleMed
     iconScalar = 1.5
     borderScaler = 0.25
     splitHeight = 0.01
     vMargin = 0.029999999999999999
     runningVertPosition = 0.29999999999999999
     runningSize = 0.0
     labels = []
     titleColor = PiratesGuiGlobals.TextFG6
     rarity = ItemGlobals.getRarity(itemId)
     rarityText = PLocalizer.getItemRarityName(rarity)
     typeText = ClothingGlobals.getClothingTypeName(ItemGlobals.getType(itemId))
     if rarity == ItemGlobals.CRUDE:
         titleColor = PiratesGuiGlobals.TextFG24
     elif rarity == ItemGlobals.COMMON:
         titleColor = PiratesGuiGlobals.TextFG13
     elif rarity == ItemGlobals.RARE:
         titleColor = PiratesGuiGlobals.TextFG4
     elif rarity == ItemGlobals.FAMED:
         titleColor = PiratesGuiGlobals.TextFG5
     
     titleLabel = DirectLabel(parent = self, relief = None, text = self.getName(), text_scale = titleNameScale, text_fg = titleColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
     self.bg.setColor(titleColor)
     tHeight = 0.070000000000000007
     titleLabel.setZ(runningVertPosition)
     runningVertPosition -= tHeight
     runningSize += tHeight
     labels.append(titleLabel)
     subtitleLabel = DirectLabel(parent = self, relief = None, text = '\x001slant\x001%s %s\x002' % (rarityText, typeText), text_scale = subtitleScale, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
     subtHeight = 0.050000000000000003
     subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
     runningVertPosition -= subtHeight
     runningSize += subtHeight
     labels.append(subtitleLabel)
     clothingType = ItemGlobals.getType(itemId)
     if localAvatar.style.getGender() == 'm':
         maleModelId = ItemGlobals.getMaleModelId(itemId)
         if maleModelId != -1:
             modelId = maleModelId
             texId = ItemGlobals.getMaleTextureId(itemId)
             dna = HumanDNA.HumanDNA(localAvatar.style.gender)
             dna.copy(localAvatar.style)
             gender = 'm'
         else:
             modelId = ItemGlobals.getFemaleModelId(itemId)
             texId = ItemGlobals.getFemaleTextureId(itemId)
             dna = HumanDNA.HumanDNA('f')
             gender = 'f'
     else:
         femaleModelId = ItemGlobals.getFemaleModelId(itemId)
         if femaleModelId != -1:
             modelId = femaleModelId
             texId = ItemGlobals.getFemaleTextureId(itemId)
             dna = HumanDNA.HumanDNA(localAvatar.style.gender)
             dna.copy(localAvatar.style)
             gender = 'f'
         else:
             modelId = ItemGlobals.getMaleModelId(itemId)
             texId = ItemGlobals.getMaleTextureId(itemId)
             dna = HumanDNA.HumanDNA('m')
             gender = 'm'
     bodyShape = localAvatar.style.getBodyShape()
     bodyHeight = localAvatar.style.getBodyHeight()
     bodyOffset = 0.5
     headOffset = 0
     topOffset = 0
     pantOffset = 0
     beltOffset = 0
     shoeOffset = 0
     if bodyShape == 0:
         bodyOffset = 1
         headOffset = 0.69999999999999996
         topOffset = 0.69999999999999996
         pantOffset = 0.20000000000000001
         beltOffset = 0.5
     elif bodyShape == 1:
         bodyOffset = 0
         if gender == 'm':
             headOffset = -0.10000000000000001
             beltOffset = 0.10000000000000001
             shoeOffset = 0.10000000000000001
         elif gender == 'f':
             headOffset = 0.59999999999999998
             topOffset = 0.40000000000000002
             beltOffset = 0.40000000000000002
             shoeOffset = 0.10000000000000001
         
     elif bodyShape == 2:
         bodyOffset = 0.5
     elif bodyShape == 3:
         bodyOffset = 1
         if gender == 'm':
             topOffset = 0.10000000000000001
             beltOffset = 0.10000000000000001
         elif gender == 'f':
             headOffset = -0.40000000000000002
             topOffset = -0.10000000000000001
             beltOffset = -0.10000000000000001
             pantOffset = -0.10000000000000001
         
     elif bodyShape == 4:
         bodyOffset = 0.5
         if gender == 'm':
             headOffset = -0.20000000000000001
             topOffset = -0.29999999999999999
         elif gender == 'f':
             headOffset = 0.10000000000000001
             beltOffset = 0.10000000000000001
         
     elif bodyShape == 5:
         bodyOffset = 0.5
     elif bodyShape == 6:
         bodyOffset = 0.5
         if gender == 'f':
             headOffset = 0.40000000000000002
             topOffset = 0.40000000000000002
             beltOffset = 0.29999999999999999
         
     elif bodyShape == 7:
         bodyOffset = 0.5
     elif bodyShape == 8:
         bodyOffset = 0.5
         headOffset = -0.20000000000000001
         topOffset = -0.20000000000000001
     elif bodyShape == 9:
         bodyOffset = 0.5
         headOffset = -0.20000000000000001
         topOffset = -0.20000000000000001
     
     m = Mat4(Mat4.identMat())
     topColor = localAvatar.style.getClothesBotColor()
     botColor = localAvatar.style.getClothesTopColor()
     hatColor = localAvatar.style.getHatColor()
     (shirtIdx, shirtTex) = localAvatar.style.getClothesShirt()
     (hatIdx, hatTex) = localAvatar.style.getClothesHat()
     (coatIdx, coatTex) = localAvatar.style.getClothesCoat()
     (beltIdx, beltTex) = localAvatar.style.getClothesBelt()
     (shoeIdx, shoeTex) = localAvatar.style.getClothesShoe()
     (vestIdx, vestTex) = localAvatar.style.getClothesVest()
     (pantIdx, pantTex) = localAvatar.style.getClothesPant()
     dna.setClothesBotColor(topColor[0], topColor[1], topColor[2])
     dna.setClothesTopColor(botColor[0], botColor[1], botColor[2])
     dna.setHatColor(hatColor)
     dna.setClothesShirt(shirtIdx, shirtTex)
     dna.setClothesHat(hatIdx, hatTex)
     dna.setClothesBelt(beltIdx, beltTex)
     dna.setClothesPant(pantIdx, pantTex)
     dna.setClothesShoe(shoeIdx, shoeTex)
     if clothingType == ClothingGlobals.SHIRT:
         dna.setClothesVest(0)
         dna.setClothesCoat(0)
     elif clothingType == ClothingGlobals.VEST:
         dna.setClothesCoat(0)
     elif clothingType == ClothingGlobals.BELT:
         dna.setClothesCoat(0)
         dna.setClothesVest(0)
     else:
         dna.setClothesVest(vestIdx, vestTex)
         dna.setClothesCoat(coatIdx, coatTex)
     dna.setClothesByType(ClothingGlobals.CLOTHING_STRING[clothingType], modelId, texId, self.itemTuple[3])
     self.displayHuman.setDNAString(dna)
     self.displayHuman.generateHuman(gender, self.masterHuman)
     self.displayHuman.stopBlink()
     self.displayHuman.pose('idle', 1)
     lodNode = self.displayHuman.find('**/+LODNode').node()
     lodNode.forceSwitch(lodNode.getHighestSwitch())
     if clothingType == ClothingGlobals.HAT:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_head01').getNetTransform(m)
         headHeight = TransformState.makeMat(m).getPos().getZ()
         offsetZ = (-headHeight - 0.40000000000000002) + headOffset - bodyHeight * 1.0
         offsetY = 2.0 + bodyOffset
         offsetH = 200
     elif clothingType == ClothingGlobals.SHIRT:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_spine03').getNetTransform(m)
         spine3Height = TransformState.makeMat(m).getPos().getZ()
         offsetZ = -spine3Height + topOffset - bodyHeight * 1.3999999999999999
         offsetY = 3.25 + bodyOffset
         offsetH = 200
     elif clothingType == ClothingGlobals.VEST:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_spine03').getNetTransform(m)
         spine3Height = TransformState.makeMat(m).getPos().getZ()
         offsetZ = -spine3Height + topOffset - bodyHeight * 1.3999999999999999
         offsetY = 3.5 + bodyOffset
         offsetH = 200
     elif clothingType == ClothingGlobals.COAT:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_spine02').getNetTransform(m)
         spine2Height = TransformState.makeMat(m).getPos().getZ()
         offsetZ = -spine2Height + topOffset - bodyHeight * 1.3999999999999999
         offsetY = 4.5 + bodyOffset
         offsetH = 200
     elif clothingType == ClothingGlobals.PANT:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_right_knee').getNetTransform(m)
         kneeHeight = TransformState.makeMat(m).getPos().getZ()
         offsetZ = -kneeHeight + pantOffset - 0.5 - bodyHeight * 0.29999999999999999
         offsetY = 4.5 + bodyOffset
         offsetH = 200
     elif clothingType == ClothingGlobals.BELT:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_hips').getNetTransform(m)
         hipHeight = TransformState.makeMat(m).getPos().getZ()
         offsetZ = -hipHeight + beltOffset - bodyHeight * 0.5
         offsetY = 1.7 + bodyOffset
         offsetH = 180
     elif clothingType == ClothingGlobals.SHOE:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_right_ankle').getNetTransform(m)
         ankleHeight = TransformState.makeMat(m).getPos().getZ()
         offsetZ = -ankleHeight + shoeOffset - 0.14999999999999999 - bodyHeight * -0.10000000000000001
         offsetY = 3.25 + bodyOffset
         offsetH = 200
     else:
         offsetZ = 0
         offsetY = 0
         offsetH = 0
     offsetX = 0
     self.displayHuman.setY(offsetY)
     self.displayHuman.setZ(offsetZ)
     self.displayHuman.setX(offsetX)
     self.displayHuman.setH(offsetH)
     self.displayHuman.reparentTo(self.portraitSceneGraph)
     iHeight = 0.17999999999999999
     self.createBuffer()
     self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
     runningVertPosition -= iHeight
     runningSize += iHeight
     labels.append(self.itemCard)
     if self.showResaleValue:
         value = int(ItemGlobals.getGoldCost(itemId) * ItemGlobals.GOLD_SALE_MULTIPLIER)
     else:
         value = ItemGlobals.getGoldCost(itemId)
     itemCost = int(ItemGlobals.getGoldCost(itemId))
     if self.cell and self.cell.container:
         itemCost = int(itemCost * self.cell.container.getItemPriceMult())
     
     goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(itemCost), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
     labels.append(goldLabel)
     descriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemFlavorText(itemId), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_fg = PiratesGuiGlobals.TextFG0, text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
     dHeight = descriptionLabel.getHeight() + 0.02
     runningVertPosition -= dHeight
     runningSize += dHeight
     labels.append(descriptionLabel)
     if not Freebooter.getPaidStatus(localAvatar.getDoId()):
         if rarity != ItemGlobals.CRUDE:
             unlimitedLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.UnlimitedAccessRequirement, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = PiratesGuiGlobals.TextFG6, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
             uHeight = unlimitedLabel.getHeight()
             runningVertPosition -= uHeight
             runningSize += uHeight
             labels.append(unlimitedLabel)
         
     
     runningVertPosition -= 0.02
     runningSize += 0.02
     panels = self.helpFrame.attachNewNode('panels')
     topPanel = panels.attachNewNode('middlePanel')
     detailGui.find('**/top_panel').copyTo(topPanel)
     topPanel.setScale(0.080000000000000002)
     topPanel.reparentTo(self.helpFrame)
     middlePanel = panels.attachNewNode('middlePanel')
     detailGui.find('**/middle_panel').copyTo(middlePanel)
     middlePanel.setScale(0.080000000000000002)
     middlePanel.reparentTo(self.helpFrame)
     placement = 0
     i = 0
     heightMax = -0.080000000000000002
     currentHeight = runningVertPosition
     if detailsHeight:
         currentHeight = -detailsHeight
     
     while currentHeight < heightMax:
         middlePanel = panels.attachNewNode('middlePanel%s' % 1)
         detailGui.find('**/middle_panel').copyTo(middlePanel)
         middlePanel.setScale(0.080000000000000002)
         middlePanel.reparentTo(self.helpFrame)
         if currentHeight + 0.20000000000000001 >= heightMax:
             difference = heightMax - currentHeight
             placement += (0.16800000000000001 / 0.20000000000000001) * difference
             currentHeight += difference
         else:
             placement += 0.16800000000000001
             currentHeight += 0.20000000000000001
         middlePanel.setZ(-placement)
         i += 1
     bottomPanel = panels.attachNewNode('bottomPanel')
     detailGui.find('**/bottom_panel').copyTo(bottomPanel)
     bottomPanel.setScale(0.080000000000000002)
     bottomPanel.setZ(-placement)
     bottomPanel.reparentTo(self.helpFrame)
     colorPanel = self.helpFrame.attachNewNode('colorPanel')
     detailGui.find('**/color').copyTo(colorPanel)
     colorPanel.setScale(0.080000000000000002)
     colorPanel.setColor(titleColor)
     colorPanel.reparentTo(self.helpFrame)
     lineBreakTopPanel = panels.attachNewNode('lineBreakTopPanel')
     detailGui.find('**/line_break_top').copyTo(lineBreakTopPanel)
     lineBreakTopPanel.setScale(0.080000000000000002, 0.080000000000000002, 0.070000000000000007)
     lineBreakTopPanel.setZ(0.0080000000000000002)
     lineBreakTopPanel.reparentTo(self.helpFrame)
     panels.flattenStrong()
     self.helpFrame['frameSize'] = (-halfWidth, halfWidth, -(runningSize + vMargin), vMargin)
     totalHeight = self.helpFrame.getHeight() - 0.10000000000000001
     for label in labels:
         label.reparentTo(self.helpFrame)
     
     if basePosX > 0.0:
         newPosX = basePosX - halfWidth + cellSizeX * 0.45000000000000001
     else:
         newPosX = basePosX + halfWidth + cellSizeX * 0.45000000000000001
     if basePosZ > 0.0:
         newPosZ = basePosZ + cellSizeZ * 0.45000000000000001
     else:
         newPosZ = basePosZ + totalHeight - cellSizeZ * 0.75
     if detailsPos:
         (newPosX, newPosZ) = detailsPos
     
     self.helpFrame.setPos(newPosX, 0, newPosZ)
 def makeItem(self, itemId, index):
     checkBox = CheckButton(parent = self, relief = None, scale = 0.34999999999999998, value = self.isItemEquipped(itemId), pos = (-0.17000000000000001, 0, -0.41999999999999998 - index * 0.074999999999999997), state = DGG.DISABLED)
     typeText = ClothingGlobals.getClothingTypeName(ItemGlobals.getType(itemId))
     label = DirectLabel(parent = self, relief = None, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG0, text_align = TextNode.ALeft, text = typeText, pos = (-0.12, 0, -0.42999999999999999 - index * 0.074999999999999997))
     return (checkBox, label)