コード例 #1
0
 def cardRankSelection(self, rank):
     self.rank = rank
     card_id = self.suit * 13 + self.rank
     self.hideButtonArray(self.suitButtonArray)
     self.hideButtonArray(self.rankButtonArray)
     self.cancelButton.hide()
     self.table.card_id = card_id
     suit = card_id / 13
     rank = card_id % 13
     card = -1
     hand = self.table.getLocalAvatarHand()
     if hand:
         if self.cardSwapIndex == PlayingCardGlobals.Cheat1:
             if len(hand) >= 1:
                 card = hand[0]
         if self.cardSwapIndex == PlayingCardGlobals.Cheat2:
             if len(hand) >= 2:
                 card = hand[1]
         if self.cardSwapIndex == PlayingCardGlobals.Cheat7:
             if len(hand) >= 7:
                 card = hand[6]
     if card >= 0 and card < 52:
         original_suit = card / 13
         original_rank = card % 13
         string = PLocalizer.PokerSwapConfirmMessage % (
             PLocalizer.getPlayingCardName(original_suit, original_rank),
             PLocalizer.getPlayingCardName(suit, rank))
         self.swapDialog = PDialog.PDialog(text=string,
                                           style=OTPDialog.YesNo,
                                           giveMouse=False,
                                           command=self.swapCallback)
         self.table.setDialogBin(self.swapDialog)
         position = self.swapDialog.getPos()
         position.setZ(position[2] + 0.35)
         self.swapDialog.setPos(position)
コード例 #2
0
 def loadData(self):
     itemId = self.data[0]
     item, quantity = self.data
     self.quantity = quantity
     itemType = EconomyGlobals.getItemType(itemId)
     if itemType <= ItemType.WAND:
         itemTypeName = PLocalizer.getItemSubtypeName(
             ItemGlobals.getSubtype(itemId))
     else:
         itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType)
     if itemType <= ItemType.WAND or itemType == ItemType.POTION:
         name = PLocalizer.getItemName(itemId)
         self.price = ItemGlobals.getGoldCost(itemId)
     else:
         name = PLocalizer.InventoryTypeNames.get(item)
         self.price = EconomyGlobals.getItemCost(item)
     if self.sell:
         self.price /= 2
     if self.buy:
         if itemType > ItemType.WAND and itemType != ItemType.POTION:
             self.quantity = EconomyGlobals.getItemQuantity(itemId)
         self.price *= self.quantity
         self.price = int(self.price)
     self.name = PLocalizer.makeHeadingString(name, 2)
     self.itemType = itemTypeName
     if itemType != ItemType.FISHING_LURE:
         if itemType != ItemType.POTION:
             self.minLvl = ItemGlobals.getWeaponRequirement(itemId)
         else:
             self.minLvl = 0
     else:
         self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
コード例 #3
0
 def __init__(self, uid):
     SimpleEconomyItem.__init__(self, uid)
     self.icon = self.Icons.find('**/%s' % EconomyGlobals.getItemIcons(uid))
     if uid in range(InventoryType.begin_PistolPouches,
                     InventoryType.end_PistolPouches):
         self.shortDesc = PLocalizer.makeHeadingString(
             PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1)
     else:
         if uid in range(InventoryType.begin_DaggerPouches,
                         InventoryType.end_DaggerPouches):
             self.shortDesc = PLocalizer.makeHeadingString(
                 PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1)
         else:
             if uid in range(InventoryType.begin_GrenadePouches,
                             InventoryType.end_GrenadePouches):
                 self.shortDesc = PLocalizer.makeHeadingString(
                     PLocalizer.GrenadeShort, 1)
             else:
                 if uid in range(InventoryType.begin_CannonPouches,
                                 InventoryType.end_CannonPouches):
                     self.shortDesc = PLocalizer.makeHeadingString(
                         PLocalizer.ShipCannonShort, 1)
                 else:
                     self.shortDesc = PLocalizer.makeHeadingString(
                         self.itemType, 1)
     self.itemName = self.shortDesc
     self.longDesc = self.shortDesc
コード例 #4
0
 def loadData(self):
     itemId = self.data[0]
     (item, quantity) = self.data
     self.quantity = quantity
     itemType = EconomyGlobals.getItemType(itemId)
     if itemType <= ItemType.WAND:
         itemTypeName = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
     else:
         itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType)
     if itemType <= ItemType.WAND or itemType == ItemType.POTION:
         name = PLocalizer.getItemName(itemId)
         self.price = ItemGlobals.getGoldCost(itemId)
     else:
         name = PLocalizer.InventoryTypeNames.get(item)
         self.price = EconomyGlobals.getItemCost(item)
     if self.sell:
         self.price /= 2
     
     if self.buy:
         if itemType > ItemType.WAND and itemType != ItemType.POTION:
             self.quantity = EconomyGlobals.getItemQuantity(itemId)
         
         self.price *= self.quantity
         self.price = int(self.price)
     
     self.name = PLocalizer.makeHeadingString(name, 2)
     self.itemType = itemTypeName
     if itemType != ItemType.FISHING_LURE:
         if itemType != ItemType.POTION:
             self.minLvl = ItemGlobals.getWeaponRequirement(itemId)
         else:
             self.minLvl = 0
     else:
         self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
コード例 #5
0
 def createGui(self):
     itemId = self.data[0]
     self.itemCount += 1
     self.itemQuantity = self.quantity
     self.itemCost = self.price
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, pos = (0.035000000000000003, 0, 0.025000000000000001))
     self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ARight, text_wordwrap = 11, pos = (0.1225, 0, 0.014999999999999999))
     if len(self.name) >= 39:
         textScale = PiratesGuiGlobals.TextScaleMicro * PLocalizer.getHeadingScale(2)
     elif len(self.name) >= 35:
         textScale = PiratesGuiGlobals.TextScaleTiny * PLocalizer.getHeadingScale(2)
     else:
         textScale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2)
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_fg = PiratesGuiGlobals.TextFG2, text_scale = textScale, text_align = TextNode.ALeft, pos = (0.13, 0, 0.014999999999999999))
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = InventoryListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.0050000000000000001, 0, 0.012500000000000001), text = str(self.price), text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.014999999999999999), text_font = PiratesGlobals.getInterfaceFont())
     itemClass = EconomyGlobals.getItemCategory(itemId)
     itemType = EconomyGlobals.getItemType(itemId)
     if itemType == ItemType.FISHING_ROD or itemType == ItemType.FISHING_LURE:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = PurchaseListItem.fishingIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.040000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     elif itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = InventoryListItem.weaponIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.040000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     elif itemClass == ItemType.CONSUMABLE:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.040000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     
     if not InventoryType.begin_WeaponCannonAmmo <= itemId or itemId <= InventoryType.end_WeaponCannonAmmo:
         if (InventoryType.begin_WeaponPistolAmmo <= itemId or itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId) and itemId <= InventoryType.end_WeaponDaggerAmmo:
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if skillId:
                 asset = WeaponGlobals.getSkillIcon(skillId)
                 if asset:
                     self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s' % asset)
                     self.picture['geom_scale'] = 0.059999999999999998
                     self.picture['geom_pos'] = (0, 0, 0)
                 
             
         elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
             self.picture['geom'] = self.topGui.find('**/main_gui_ship_bottle')
             self.picture['geom_scale'] = 0.10000000000000001
             self.picture['geom_pos'] = (0, 0, 0)
         
     self.flattenStrong()
コード例 #6
0
 def createGui(self):
     itemId = self.data[0]
     self.itemCount += 1
     self.itemQuantity = self.quantity
     self.itemCost = self.price
     self.picture = DirectFrame(parent=self, relief=None, state=DGG.DISABLED, pos=(0.035,
                                                                                   0,
                                                                                   0.025))
     self.quantityLabel = DirectLabel(parent=self, relief=None, state=DGG.DISABLED, text=str(self.quantity), text_fg=PiratesGuiGlobals.TextFG2, text_scale=PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align=TextNode.ARight, text_wordwrap=11, pos=(0.1225,
                                                                                                                                                                                                                                                                                0,
                                                                                                                                                                                                                                                                                0.015))
     if len(self.name) >= 39:
         textScale = PiratesGuiGlobals.TextScaleMicro * PLocalizer.getHeadingScale(2)
     else:
         if len(self.name) >= 35:
             textScale = PiratesGuiGlobals.TextScaleTiny * PLocalizer.getHeadingScale(2)
         else:
             textScale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2)
         self.nameTag = DirectLabel(parent=self, relief=None, state=DGG.DISABLED, text=self.name, text_fg=PiratesGuiGlobals.TextFG2, text_scale=textScale, text_align=TextNode.ALeft, pos=(0.13,
                                                                                                                                                                                           0,
                                                                                                                                                                                           0.015))
         self.costText = DirectLabel(parent=self, relief=None, state=DGG.DISABLED, image=InventoryListItem.coinImage, image_scale=0.12, image_pos=Vec3(-0.005, 0, 0.0125), text=str(self.price), text_fg=PiratesGuiGlobals.TextFG2, text_scale=PiratesGuiGlobals.TextScaleSmall, text_align=TextNode.ARight, text_wordwrap=11, text_pos=(-0.03, 0, 0), pos=(self.width - 0.035, 0, 0.015), text_font=PiratesGlobals.getInterfaceFont())
         itemClass = EconomyGlobals.getItemCategory(itemId)
         itemType = EconomyGlobals.getItemType(itemId)
         if itemType == ItemType.FISHING_ROD or itemType == ItemType.FISHING_LURE:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 self.picture['geom'] = PurchaseListItem.fishingIcons.find('**/%s*' % asset)
                 self.picture['geom_scale'] = 0.04
                 self.picture['geom_pos'] = (0, 0, 0)
         elif itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 self.picture['geom'] = InventoryListItem.weaponIcons.find('**/%s*' % asset)
                 self.picture['geom_scale'] = 0.04
                 self.picture['geom_pos'] = (0, 0, 0)
         elif itemClass == ItemType.CONSUMABLE:
             asset = EconomyGlobals.getItemIcons(itemId)
             if asset:
                 self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s*' % asset)
                 self.picture['geom_scale'] = 0.04
                 self.picture['geom_pos'] = (0, 0, 0)
         if InventoryType.begin_WeaponCannonAmmo <= itemId and itemId <= InventoryType.end_WeaponCannonAmmo or InventoryType.begin_WeaponPistolAmmo <= itemId and itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId and itemId <= InventoryType.end_WeaponDaggerAmmo:
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if skillId:
                 asset = WeaponGlobals.getSkillIcon(skillId)
                 if asset:
                     self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s' % asset)
                     self.picture['geom_scale'] = 0.06
                     self.picture['geom_pos'] = (0, 0, 0)
         if InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
             self.picture['geom'] = self.topGui.find('**/main_gui_ship_bottle')
             self.picture['geom_scale'] = 0.1
             self.picture['geom_pos'] = (0, 0, 0)
     self.flattenStrong()
     return
コード例 #7
0
ファイル: SongItemGui.py プロジェクト: TTGhost/POTCOR-src
 def checkPlayerInventory(self, itemId, extraQty = 0):
     if self.available:
         inventory = base.localAvatar.getInventory()
         currStock = inventory.getStackQuantity(itemId)
         currStockLimit = inventory.getStackLimit(itemId)
         if currStock == 0:
             if base.cr.newsManager.getHoliday(21):
                 pass
             if not (itemId in InventoryType.WinterHolidaySongs):
                 self.name = PLocalizer.makeHeadingString(PLocalizer.SongTitleUnknown, 2)
                 self.nameTag['text'] = PLocalizer.makeHeadingString(PLocalizer.SongTitleUnknown, 2)
                 self.itemTypeName['text'] = PLocalizer.makeHeadingString(PLocalizer.SongComingSoon, 1)
                 self.disable()
             
         not (itemId in InventoryType.WinterHolidaySongs)
コード例 #8
0
 def checkPlayerInventory(self, itemId, extraQty=0):
     if self.available:
         inventory = base.localAvatar.getInventory()
         currStock = inventory.getStackQuantity(itemId)
         currStockLimit = inventory.getStackLimit(itemId)
         if currStock == 0 and not (base.cr.newsManager.getHoliday(21)
                                    and itemId
                                    in InventoryType.WinterHolidaySongs):
             self.name = PLocalizer.makeHeadingString(
                 PLocalizer.SongTitleUnknown, 2)
             self.nameTag['text'] = PLocalizer.makeHeadingString(
                 PLocalizer.SongTitleUnknown, 2)
             self.itemTypeName['text'] = PLocalizer.makeHeadingString(
                 PLocalizer.SongComingSoon, 1)
             self.disable()
コード例 #9
0
ファイル: SimpleStoreItem.py プロジェクト: TTGhost/POTCOR-src
 def __init__(self, uid):
     SimpleEconomyItem.__init__(self, uid)
     self.icon = self.Icons.find('**/%s' % EconomyGlobals.getItemIcons(uid))
     if uid in range(InventoryType.begin_PistolPouches, InventoryType.end_PistolPouches):
         self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1)
     elif uid in range(InventoryType.begin_DaggerPouches, InventoryType.end_DaggerPouches):
         self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1)
     elif uid in range(InventoryType.begin_GrenadePouches, InventoryType.end_GrenadePouches):
         self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.GrenadeShort, 1)
     elif uid in range(InventoryType.begin_CannonPouches, InventoryType.end_CannonPouches):
         self.shortDesc = PLocalizer.makeHeadingString(PLocalizer.ShipCannonShort, 1)
     else:
         self.shortDesc = PLocalizer.makeHeadingString(self.itemType, 1)
     self.itemName = self.shortDesc
     self.longDesc = self.shortDesc
コード例 #10
0
def getCardName(value):
    if value == Unknown:
        return PLocalizer.PlayingCardUnknown
    else:
        rank = value % 13
        suit = value / 13
        return PLocalizer.getPlayingCardName(suit, rank)
コード例 #11
0
 def getName(self):
     itemTypeName = PLocalizer.getItemName(self.getId())
     clothingName = PLocalizer.TailorColorStrings.get(self.getColorId())
     if ItemGlobals.canDyeItem(self.getId()):
         return clothingName + ' ' + itemTypeName
     else:
         return itemTypeName
コード例 #12
0
 def getName(self):
     itemTypeName = PLocalizer.getItemName(self.getId())
     clothingName = PLocalizer.TailorColorStrings.get(self.getColorId())
     if ItemGlobals.canDyeItem(self.getId()):
         return clothingName + ' ' + itemTypeName
     else:
         return itemTypeName
コード例 #13
0
def getCardName(value):
    if value == Unknown:
        return PLocalizer.PlayingCardUnknown
    else:
        rank = value % 13
        suit = value / 13
        return PLocalizer.getPlayingCardName(suit, rank)
コード例 #14
0
    def createTextBox(self):
        if self.infoBox:
            return None

        globalPos = self.getPos(base.a2dLeftCenter)
        self.infoBox = None
        self.infoBox = BorderFrame(parent=base.a2dLeftCenter,
                                   frameSize=(-0.040000000000000001, 0.5,
                                              -0.25, 0.050000000000000003),
                                   pos=(globalPos.getX() + 0.12, 0,
                                        globalPos.getZ()),
                                   state=DGG.DISABLED)
        self.label = DirectLabel(
            parent=self.infoBox,
            relief=None,
            text=PLocalizer.CannonDefenseAmmoDesc %
            (PLocalizer.makeHeadingString(
                PLocalizer.InventoryTypeNames[self.skillId], 2), self.cost,
             self.amount, PLocalizer.CannonDefenseAmmoTypeDesc[self.skillId]),
            text_align=TextNode.ALeft,
            text_scale=PiratesGuiGlobals.TextScaleLarge,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_wordwrap=12,
            textMayChange=1)
        if self.locked:
            memberText = ''
            if self.skillId > CannonDefenseGlobals.FREEBOOTER_LAST_AMMO_AVAILABLE:
                memberText = PLocalizer.VR_AuthAccess

            self.label['text'] = PLocalizer.CannonDefenseAmmoUnlockedAt % (
                CannonDefenseGlobals.getLevelUnlockedAt(
                    self.skillId), memberText)

        self.infoBox.setBin('gui-cannonDefense', 4)
コード例 #15
0
    def setLocalAvatarHand(self, cardValues):
        map(lambda card: card.hide(), self.localStatusPanel.hand)
        self.localStatusPanel.cardScaler.setScale(0.5)
        for card, newValue in zip(self.localStatusPanel.hand, cardValues):
            card.show()
            card.setValue(newValue)
            if newValue != PlayingCardGlobals.Unknown:
                card.turnUp()

        handNameLabel = self.localStatusPanel.handNameLabel
        communityCardValues = map(lambda card: card.getValue(),
                                  self.communityCards)
        if cardValues:
            if PlayingCardGlobals.Unknown not in cardValues and (
                    self.handId == PlayingCardGlobals.Nothing
                    or self.sortedCards == None):
                handNameLabel.hide()
            else:
                handName = PLocalizer.getHandNameFull(
                    self.table.handIdToHandCode(self.handId), self.sortedCards)
                handNameLabel['text'] = handName
                handNameLabel.show()
        else:
            handNameLabel.hide()
        return
コード例 #16
0
ファイル: SimpleStoreItem.py プロジェクト: TTGhost/POTCOR-src
 def __init__(self, uid):
     self.uid = uid
     self.itemName = PLocalizer.getItemName(uid)
     self.shortDesc = PLocalizer.getItemName(uid)
     self.longDesc = PLocalizer.getItemFlavorText(uid)
     self.text = None
     self.modelId = None
     self.texId = None
     self.colorId = 0
     self.holidayId = None
     self.icon = None
     self.iconScale = 1.0
     self.iconHpr = (0, 0, 0)
     if self.checkStackable():
         self.quantity = EconomyGlobals.getItemQuantity(self.uid)
     else:
         self.quantity = 1
コード例 #17
0
 def __init__(self, uid):
     self.uid = uid
     self.itemName = PLocalizer.getItemName(uid)
     self.shortDesc = PLocalizer.getItemName(uid)
     self.longDesc = PLocalizer.getItemFlavorText(uid)
     self.text = None
     self.modelId = None
     self.texId = None
     self.colorId = 0
     self.holidayId = None
     self.icon = None
     self.iconScale = 1.0
     self.iconHpr = (0, 0, 0)
     if self.checkStackable():
         self.quantity = EconomyGlobals.getItemQuantity(self.uid)
     else:
         self.quantity = 1
コード例 #18
0
 def checkSkillReq(self, skillId):
     if skillId in range(InventoryType.begin_FishingLures, InventoryType.end_FishingLures):
         return None
     
     if skillId:
         if base.localAvatar.getSkillQuantity(skillId) < 2:
             skillName = PLocalizer.getInventoryTypeName(skillId)
             self.highlightRed(PLocalizer.SkillRequirement % skillName)
コード例 #19
0
ファイル: ShipItemGUI.py プロジェクト: TTGhost/POTCOR-src
    def createGui(self):
        (item, quantity) = self.data
        name = PLocalizer.InventoryTypeNames[item]
        self.price = EconomyGlobals.getItemCost(item)
        repId = InventoryType.SailingRep
        itemTypeName = PLocalizer.InventoryTypeNames.get(repId)
        self.itemType = itemTypeName
        if self.sell:
            self.price /= 2

        card = loader.loadModel("models/textureCards/shipCatalog")
        renderName = self.shipImageDict.get(item, "Catalog_War_Brig")
        myTexCard = card.find("**/%s*" % renderName)
        myTex = myTexCard.findAllTextures()[0]
        card.removeNode()
        del card
        self.minLvl = EconomyGlobals.getItemMinLevel(item)
        self.miscText = None
        self.picture = DirectFrame(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            image=myTex,
            image_scale=(0.070000000000000007, 1.0, 0.059999999999999998),
        )
        self.picture.setPos(0.10000000000000001, 0, 0.080000000000000002)
        self.picture.setTransparency(1)
        self.nameTag = DirectLabel(
            parent=self,
            state=DGG.DISABLED,
            relief=None,
            text=name,
            text_scale=PiratesGuiGlobals.TextScaleMed * PLocalizer.getHeadingScale(2),
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=0,
        )
        self.nameTag.setPos(0.20000000000000001, 0, 0.10000000000000001)
        self.costText = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=self.coinImage,
            geom_scale=0.12,
            geom_pos=Vec3(-0.01, 0, 0.01),
            text=str(self.price),
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_align=TextNode.ARight,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_wordwrap=11,
            text_pos=(-0.029999999999999999, 0, 0),
            text_font=PiratesGlobals.getInterfaceFont(),
        )
        self.costText.setPos(0.47999999999999998, 0, 0.040000000000000001)
 def sendBossMessage(self, message, good):
     if good:
         (text, sfx) = self.goodBossMessages[message]
     else:
         (text, sfx) = self.badBossMessages[message]
     text = PLocalizer.JollySays % text
     base.localAvatar.guiMgr.messageStack.addModalTextMessage(text, seconds = 8, priority = 0, color = PiratesGuiGlobals.TextFG14, icon = ('jolly', ''), modelName = 'general_frame_f')
     if self.canPlaySfx:
         base.playSfx(sfx)
     
     localAvatar.guiMgr.createProgressMsg(PLocalizer.InvasionJollyRogerComing % PLocalizer.getInvasionMainZoneName(self.holidayName), PiratesGuiGlobals.TextFG2)
コード例 #21
0
 def createGui(self):
     itemId = self.data[0]
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.16, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())
     if itemId in range(InventoryType.begin_PistolPouches, InventoryType.end_PistolPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1)
     elif itemId in range(InventoryType.begin_DaggerPouches, InventoryType.end_DaggerPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1)
     elif itemId in range(InventoryType.begin_GrenadePouches, InventoryType.end_GrenadePouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.GrenadeShort, 1)
     elif itemId in range(InventoryType.begin_CannonPouches, InventoryType.end_CannonPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.ShipCannonShort, 1)
     else:
         self.itemTypeFormatted = PLocalizer.makeHeadingString(self.itemType, 1)
     self.itemTypeName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.itemTypeFormatted, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.16, 0, 0.065000000000000002))
     self.miscText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.16, 0, 0.025000000000000001))
     if self.minLvl > 0:
         repId = WeaponGlobals.getRepId(itemId)
         if repId:
             self.checkLevel(repId, self.minLvl)
         
     
     self.checkFreebooter(itemId, base.localAvatar.getDoId())
     trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
     if trainingReq:
         self.checkTrainingReq(trainingReq)
     
     if EconomyGlobals.getItemCategory(itemId) == ItemType.AMMO:
         skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
         self.checkSkillReq(skillId)
     
     self.checkInfamyReq(itemId)
     if self.buy:
         self.checkPlayerInventory(itemId)
     
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = InventoryListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.065000000000000002), text_font = PiratesGlobals.getInterfaceFont())
     if self.quantity and self.quantity > 1:
         self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), frameColor = (0, 0, 0, 1), frameSize = (-0.01, 0.02, -0.01, 0.025000000000000001), text_scale = 0.0275, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.02, 0, 0.025000000000000001), text_font = PiratesGlobals.getPirateBoldOutlineFont())
     
     geomParams = InventoryItemGui.getGeomParams(itemId)
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, geom = geomParams['geom'], geom_pos = geomParams['geom_pos'], geom_scale = geomParams['geom_scale'], pos = (0.01, 0, 0.01))
     self.flattenStrong()
コード例 #22
0
    def createGui(self):
        (item, quantity) = self.data
        name = PLocalizer.InventoryTypeNames[item]
        self.price = EconomyGlobals.getItemCost(item)
        repId = InventoryType.SailingRep
        itemTypeName = PLocalizer.InventoryTypeNames.get(repId)
        self.itemType = itemTypeName
        if self.sell:
            self.price /= 2

        card = loader.loadModel('models/textureCards/shipCatalog')
        renderName = self.shipImageDict.get(item, 'Catalog_War_Brig')
        myTexCard = card.find('**/%s*' % renderName)
        myTex = myTexCard.findAllTextures()[0]
        card.removeNode()
        del card
        self.minLvl = EconomyGlobals.getItemMinLevel(item)
        self.miscText = None
        self.picture = DirectFrame(parent=self,
                                   relief=None,
                                   state=DGG.DISABLED,
                                   image=myTex,
                                   image_scale=(0.070000000000000007, 1.0,
                                                0.059999999999999998))
        self.picture.setPos(0.10000000000000001, 0, 0.080000000000000002)
        self.picture.setTransparency(1)
        self.nameTag = DirectLabel(parent=self,
                                   state=DGG.DISABLED,
                                   relief=None,
                                   text=name,
                                   text_scale=PiratesGuiGlobals.TextScaleMed *
                                   PLocalizer.getHeadingScale(2),
                                   text_align=TextNode.ALeft,
                                   text_fg=PiratesGuiGlobals.TextFG1,
                                   text_shadow=PiratesGuiGlobals.TextShadow,
                                   textMayChange=0)
        self.nameTag.setPos(0.20000000000000001, 0, 0.10000000000000001)
        self.costText = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=self.coinImage,
            geom_scale=0.12,
            geom_pos=Vec3(-0.01, 0, 0.01),
            text=str(self.price),
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_align=TextNode.ARight,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_wordwrap=11,
            text_pos=(-0.029999999999999999, 0, 0),
            text_font=PiratesGlobals.getInterfaceFont())
        self.costText.setPos(0.47999999999999998, 0, 0.040000000000000001)
コード例 #23
0
 def _getActor(self, type = PiratesGlobals.VILLAGER_TEAM):
     if type == PiratesGlobals.VILLAGER_TEAM:
         return Townfolk.Townfolk()
     else:
         actor = Skeleton.Skeleton()
         (chosenType, self.possibleUndeadTypes) = AvatarTypes.pickPokerUndead(self.possibleUndeadTypes)
         self.possibleUndeadTypes.remove(chosenType)
         actor.setAvatarType(chosenType)
         (actor.name, self.possibleUndeadNames) = PLocalizer.pickPokerUndeadName(self.possibleUndeadNames)
         self.possibleUndeadNames.remove(actor.name)
         actor.addActive()
         actor.nametag3d.setPos(0, 0, 0)
     return actor
コード例 #24
0
 def _getActor(self, type=PiratesGlobals.VILLAGER_TEAM):
     if type == PiratesGlobals.VILLAGER_TEAM:
         return Townfolk.Townfolk()
     else:
         actor = Skeleton.Skeleton()
         chosenType, self.possibleUndeadTypes = AvatarTypes.pickPokerUndead(
             self.possibleUndeadTypes)
         self.possibleUndeadTypes.remove(chosenType)
         actor.setAvatarType(chosenType)
         actor.name, self.possibleUndeadNames = PLocalizer.pickPokerUndeadName(
             self.possibleUndeadNames)
         self.possibleUndeadNames.remove(actor.name)
         actor.addActive()
         actor.nametag3d.setPos(0, 0, 0)
     return actor
コード例 #25
0
 def sendBossMessage(self, message, good):
     if good:
         text, sfx = self.goodBossMessages[message]
     else:
         text, sfx = self.badBossMessages[message]
     text = PLocalizer.JollySays % text
     base.localAvatar.guiMgr.messageStack.addModalTextMessage(
         text,
         seconds=8,
         priority=0,
         color=PiratesGuiGlobals.TextFG14,
         icon=('jolly', ''),
         modelName='general_frame_f')
     if self.canPlaySfx:
         base.playSfx(sfx)
     localAvatar.guiMgr.createProgressMsg(
         PLocalizer.InvasionJollyRogerComing %
         PLocalizer.getInvasionMainZoneName(self.holidayName),
         PiratesGuiGlobals.TextFG2)
コード例 #26
0
 def setLocalAvatarHand(self, cardValues):
     map(lambda card: card.hide(), self.localStatusPanel.hand)
     self.localStatusPanel.cardScaler.setScale(0.5)
     for (card, newValue) in zip(self.localStatusPanel.hand, cardValues):
         card.show()
         card.setValue(newValue)
         if newValue != PlayingCardGlobals.Unknown:
             card.turnUp()
             continue
     
     handNameLabel = self.localStatusPanel.handNameLabel
     communityCardValues = map(lambda card: card.getValue(), self.communityCards)
     if cardValues and PlayingCardGlobals.Unknown not in cardValues:
         if self.handId == PlayingCardGlobals.Nothing or self.sortedCards == None:
             handNameLabel.hide()
         else:
             handName = PLocalizer.getHandNameFull(self.table.handIdToHandCode(self.handId), self.sortedCards)
             handNameLabel['text'] = handName
             handNameLabel.show()
     else:
         handNameLabel.hide()
コード例 #27
0
 def loadData(self):
     itemId = self.data[0]
     if UberDogGlobals.InventoryId.isStackable(itemId):
         (item, quantity) = self.data
         name = PLocalizer.InventoryTypeNames.get(item)
         self.quantity = 1
         itemType = None
         itemTypeName = None
         self.price = 5
     else:
         (category, doId) = self.data
         name = PLocalizer.InventoryCategoryNames.get(category)
         self.quantity = 1
         itemTypeName = 'Object'
         self.price = 5
     if self.buy:
         self.price *= self.quantity
         self.price = int(self.price)
     
     self.name = PLocalizer.makeHeadingString(name, 2)
     self.itemType = itemTypeName
     self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
コード例 #28
0
 def __init__(self, category, width = 0.40000000000000002):
     DirectFrame.__init__(self, parent = NodePath(), relief = None)
     self.initialiseoptions(ReputationMeter)
     self.category = category
     self.level = 0
     self.value = 0
     self.max = 0
     self.masteredIval = None
     name = PLocalizer.makeHeadingString(self.getCategoryName(), 2)
     self.categoryLabel = DirectLabel(parent = self, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = (-width * 0.5, 0, 0.02), textMayChange = 1)
     self.levelLabel = DirectLabel(parent = self, relief = None, text = '', text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (width * 0.5, 0, 0.02), textMayChange = 1)
     gui = loader.loadModel('models/gui/ship_battle')
     guiModel = loader.loadModel('models/gui/toplevel_gui')
     self.meter = DirectWaitBar(parent = self, relief = DGG.FLAT, state = DGG.DISABLED, range = self.max, value = self.value, frameSize = (-width * 0.5, width * 0.5, -0.01, 0.01), frameColor = (65 / 255.0, 40 / 255.0, 8 / 255.0, 1), barColor = (223 / 255.0, 137 / 255.0, 28 / 255.0, 1), pos = (0, 0, 0.0))
     self.meterFrame = DirectFrame(parent = self.meter, relief = None, image = gui.find('**/ship_battle_speed_bar*'), image_scale = (width * 0.75, 1.0, 0.59999999999999998), pos = (0, 0, 0.0))
     self.clamp1 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (-width * 0.33300000000000002, 0, 0))
     self.clamp2 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (-width * 0.16700000000000001, 0, 0))
     self.clamp3 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (0, 0, 0))
     self.clamp4 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (width * 0.16700000000000001, 0, 0))
     self.clamp5 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (width * 0.33300000000000002, 0, 0))
     self.valueLabel = DirectLabel(parent = self.meter, relief = None, text = '', text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0, 0.032000000000000001), pos = (0, 0, -0.01), textMayChange = 1)
     logoModel = loader.loadModel('models/gui/potcLogo')
     self.levelCapScroll = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/main_gui_quest_scroll'))
     self.levelCapScroll.setPos(0.0, 0.0, 0.01)
     self.levelCapScroll.setScale(0.115, 1.0, 0.050000000000000003)
     self.levelCapScroll.hide()
     self.levelCapIcon = DirectFrame(parent = self.meter, relief = None, image = logoModel.find('**/skull'))
     self.levelCapIcon.setPos(0.0, 0.0, 0.025000000000000001)
     self.levelCapIcon.setScale(0.40000000000000002)
     self.levelCapIcon.setBin('gui-popup', 0)
     self.levelCapIcon.hide()
     self.masteredLabel = DirectLabel(parent = self.meter, relief = None, text = PLocalizer.RepCapText_Skill, text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont())
     self.masteredLabel.setPos(0.0, 0.0, -0.01)
     self.masteredLabel.hide()
     self.levelCapScroll.setTransparency(1)
     self.levelCapIcon.setTransparency(1)
     self.masteredLabel.setTransparency(1)
     self.update(self.value)
     self.flattenStrong()
コード例 #29
0
    def loadData(self):
        itemId = self.data[0]
        if UberDogGlobals.InventoryId.isStackable(itemId):
            (item, quantity) = self.data
            name = PLocalizer.InventoryTypeNames.get(item)
            self.quantity = 1
            itemType = None
            itemTypeName = None
            self.price = 5
        else:
            (category, doId) = self.data
            name = PLocalizer.InventoryCategoryNames.get(category)
            self.quantity = 1
            itemTypeName = 'Object'
            self.price = 5
        if self.buy:
            self.price *= self.quantity
            self.price = int(self.price)

        self.name = PLocalizer.makeHeadingString(name, 2)
        self.itemType = itemTypeName
        self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
コード例 #30
0
ファイル: ReputationMeter.py プロジェクト: TTGhost/POTCOR-src
 def __init__(self, category, width = 0.40000000000000002):
     DirectFrame.__init__(self, parent = NodePath(), relief = None)
     self.initialiseoptions(ReputationMeter)
     self.category = category
     self.level = 0
     self.value = 0
     self.max = 0
     self.masteredIval = None
     name = PLocalizer.makeHeadingString(self.getCategoryName(), 2)
     self.categoryLabel = DirectLabel(parent = self, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = (-width * 0.5, 0, 0.02), textMayChange = 1)
     self.levelLabel = DirectLabel(parent = self, relief = None, text = '', text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (width * 0.5, 0, 0.02), textMayChange = 1)
     gui = loader.loadModel('models/gui/ship_battle')
     guiModel = loader.loadModel('models/gui/toplevel_gui')
     self.meter = DirectWaitBar(parent = self, relief = DGG.FLAT, state = DGG.DISABLED, range = self.max, value = self.value, frameSize = (-width * 0.5, width * 0.5, -0.01, 0.01), frameColor = (65 / 255.0, 40 / 255.0, 8 / 255.0, 1), barColor = (223 / 255.0, 137 / 255.0, 28 / 255.0, 1), pos = (0, 0, 0.0))
     self.meterFrame = DirectFrame(parent = self.meter, relief = None, image = gui.find('**/ship_battle_speed_bar*'), image_scale = (width * 0.75, 1.0, 0.59999999999999998), pos = (0, 0, 0.0))
     self.clamp1 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (-width * 0.33300000000000002, 0, 0))
     self.clamp2 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (-width * 0.16700000000000001, 0, 0))
     self.clamp3 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (0, 0, 0))
     self.clamp4 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (width * 0.16700000000000001, 0, 0))
     self.clamp5 = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/groggy_clamp'), image_scale = (0.14999999999999999, 1.0, 0.40000000000000002), image_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1.0), pos = (width * 0.33300000000000002, 0, 0))
     self.valueLabel = DirectLabel(parent = self.meter, relief = None, text = '', text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0, 0.032000000000000001), pos = (0, 0, -0.01), textMayChange = 1)
     logoModel = loader.loadModel('models/gui/potcLogo')
     self.levelCapScroll = DirectFrame(parent = self.meter, relief = None, image = guiModel.find('**/main_gui_quest_scroll'))
     self.levelCapScroll.setPos(0.0, 0.0, 0.01)
     self.levelCapScroll.setScale(0.115, 1.0, 0.050000000000000003)
     self.levelCapScroll.hide()
     self.levelCapIcon = DirectFrame(parent = self.meter, relief = None, image = logoModel.find('**/skull'))
     self.levelCapIcon.setPos(0.0, 0.0, 0.025000000000000001)
     self.levelCapIcon.setScale(0.40000000000000002)
     self.levelCapIcon.setBin('gui-popup', 0)
     self.levelCapIcon.hide()
     self.masteredLabel = DirectLabel(parent = self.meter, relief = None, text = PLocalizer.RepCapText_Skill, text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont())
     self.masteredLabel.setPos(0.0, 0.0, -0.01)
     self.masteredLabel.hide()
     self.levelCapScroll.setTransparency(1)
     self.levelCapIcon.setTransparency(1)
     self.masteredLabel.setTransparency(1)
     self.update(self.value)
     self.flattenStrong()
コード例 #31
0
 def createGui(self):
     itemId = self.data[0]
     (item, quantity) = self.data
     name = ItemGlobals.getName(item)
     itemType = ItemGlobals.getType(item)
     itemTypeName = name
     repCategory = ItemGlobals.getItemRepId(itemId)
     if quantity:
         repValue = localAvatar.getInventory().getReputation(repCategory)
         self.repMeter = ReputationMeter(repCategory, width = 0.66000000000000003)
         self.repMeter.setPos(0.62, 0, 0.041000000000000002)
         self.repMeter.update(repValue)
         self.repMeter.reparentTo(self)
         self.repMeter.flattenLight()
         hotkeyLabel = ''
         hotkeys = ()
         desc = PLocalizer.WeaponDescriptions.get(itemId)
         helpText = PLocalizer.InventoryTypeNames[repCategory]
         self.weaponButton = CombatTray.WeaponButton(hotkeys = hotkeys, hotkeyLabel = hotkeyLabel, helpOpaque = True, helpText = helpText, parent = self, showQuant = 0, pos = (0.10000000000000001, 0, -0.02), scale = 1.1000000000000001)
         self.weaponButton.ignoreHotkeys()
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton['extraArgs'] = [
             itemId]
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.WeaponAlreadyUnlocked, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001), text_font = PiratesGlobals.getInterfaceFont())
     else:
         self.repMeter = None
         name = PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames[repCategory], 2)
         self.categoryLabel = DirectLabel(parent = self, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.059999999999999998), textMayChange = 0)
         self.weaponButton = CombatTray.WeaponButton(parent = self, state = DGG.DISABLED, showQuant = 0, scale = 1.1000000000000001)
         self.weaponButton.setPos(0.10000000000000001, 0, -0.02)
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         unlockDesc = PLocalizer.WeaponUnlockText[repCategory]
         self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = unlockDesc, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.025000000000000001), text_font = PiratesGlobals.getInterfaceFont())
         self.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1, 1)
コード例 #32
0
 def cardRankSelection(self, rank):
     self.rank = rank
     card_id = self.suit * 13 + self.rank
     self.hideButtonArray(self.suitButtonArray)
     self.hideButtonArray(self.rankButtonArray)
     self.cancelButton.hide()
     self.table.card_id = card_id
     suit = card_id / 13
     rank = card_id % 13
     card = -1
     hand = self.table.getLocalAvatarHand()
     if hand:
         if self.cardSwapIndex == PlayingCardGlobals.Cheat1:
             if len(hand) >= 1:
                 card = hand[0]
             
         
         if self.cardSwapIndex == PlayingCardGlobals.Cheat2:
             if len(hand) >= 2:
                 card = hand[1]
             
         
         if self.cardSwapIndex == PlayingCardGlobals.Cheat7:
             if len(hand) >= 7:
                 card = hand[6]
             
         
     
     if card >= 0 and card < 52:
         original_suit = card / 13
         original_rank = card % 13
         string = PLocalizer.PokerSwapConfirmMessage % (PLocalizer.getPlayingCardName(original_suit, original_rank), PLocalizer.getPlayingCardName(suit, rank))
         self.swapDialog = PDialog.PDialog(text = string, style = OTPDialog.YesNo, giveMouse = False, command = self.swapCallback)
         self.table.setDialogBin(self.swapDialog)
         position = self.swapDialog.getPos()
         position.setZ(position[2] + 0.34999999999999998)
         self.swapDialog.setPos(position)
コード例 #33
0
 def getInvasionResults(self):
     self.results = []
     mainZoneBonus = int(self.reputationEarned * InvasionGlobals.MAIN_ZONE_BONUS)
     enemyBonus = int(self.reputationEarned * InvasionGlobals.ENEMY_BONUS)
     waveBonus = self.wavesCleared * InvasionGlobals.WAVE_BONUS
     barricadeBonus = int(self.reputationEarned * self.barricadesSaved * InvasionGlobals.BARRICADE_BONUS)
     if self.wonInvasion:
         totalBonus = int((mainZoneBonus + enemyBonus + barricadeBonus) * (waveBonus + 1.0))
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.InvasionMainZoneSaved % PLocalizer.getInvasionMainZoneName(HolidayGlobals.getHolidayName(self.holidayId)),
             'Value1': PLocalizer.InvasionNotoriety % mainZoneBonus })
     else:
         totalBonus = int((enemyBonus + barricadeBonus) * (waveBonus + 1.0))
     self.results.append({
         'Type': 'Entry',
         'Text': PLocalizer.InvasionBarricadesSaved % self.barricadesSaved,
         'Value1': PLocalizer.InvasionNotoriety % barricadeBonus })
     if self.enemiesKilled == 1:
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.InvasionEnemyKilled,
             'Value1': PLocalizer.InvasionNotoriety % enemyBonus })
     else:
         self.results.append({
             'Type': 'Entry',
             'Text': PLocalizer.InvasionEnemiesKilled % self.enemiesKilled,
             'Value1': PLocalizer.InvasionNotoriety % enemyBonus })
     self.results.append({
         'Type': 'Entry',
         'Text': PLocalizer.InvasionWavesCleared % self.wavesCleared,
         'Value1': PLocalizer.InvasionNotorietyBonus % int(waveBonus * 100) })
     self.results.append({
         'Type': 'Entry',
         'Text': PLocalizer.InvasionTotalBonus,
         'Value1': PLocalizer.InvasionNotoriety % totalBonus })
     return self.results
コード例 #34
0
 def createGui(self):
     itemId = self.data[0]
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, pos = (0.01, 0, 0.01))
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.050000000000000003, 0, 0.089999999999999997), text_font = PiratesGlobals.getInterfaceFont())
     itemTypeFormatted = ''
     self.itemTypeName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = itemTypeFormatted, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.050000000000000003, 0, 0.065000000000000002))
     self.miscText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.050000000000000003, 0, 0.025000000000000001))
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = StowawayListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.089999999999999997), text_font = PiratesGlobals.getInterfaceFont())
     self.picture['geom'] = loader.loadModel(StowawayItemGui.islandModelLookup[itemId])
     self.picture['geom_scale'] = StowawayItemGui.islandScaleLookup[itemId]
     self.picture['geom_pos'] = StowawayItemGui.islandPosLookup[itemId]
     self.picture['geom_hpr'] = StowawayItemGui.islandHprLookup[itemId]
     self.picture['geom_color'] = StowawayItemGui.islandColorScaleLookup[itemId]
     self.flattenStrong()
コード例 #35
0
    def __init__(self, shipPage, shipId, **kwargs):
        self.shipPage = shipPage
        self.setShipId(shipId)
        self.timer = None
        self.crewDots = []
        self.lBroadsideLimit = 0
        self.rBroadsideLimit = 0
        kwargs.setdefault('relief', None)
        kwargs.setdefault('frameSize', (0, self.Width, 0, self.Height))
        DirectFrame.__init__(self)
        self.initialiseoptions(ShipPanel)
        gui = loader.loadModel('models/gui/toplevel_gui')
        chestIcon = gui.find('**/icon_crate')
        cannonIcon = gui.find('**/topgui_icon_ship_cannon_single')
        broadsideIcon = gui.find('**/topgui_icon_ship_cannon_multiple')
        self.bottleFrame = ShipFrameBottle(parent = self, shipId = shipId, relief = None, state = DGG.DISABLED, pos = (0.074999999999999997, 0, 0.75), scale = 0.83499999999999996)
        ornament = loader.loadModel('models/gui/gui_ship_window')
        ornament.reparentTo(self)
        ornament.setScale(0.29999999999999999)
        ornament.setPos(0.54000000000000004, 0, 0.72999999999999998)
        ornament.flattenStrong()
        self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2), text_fg = PiratesGuiGlobals.TextFG1, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_align = TextNode.ACenter, text_shadow = (0, 0, 0, 1), text_wordwrap = 30, textMayChange = 1, text_font = PiratesGlobals.getPirateFont(), pos = (0.55000000000000004, 0, 1.22))
        self.classLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), text_wordwrap = 30, textMayChange = 1, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.55000000000000004, 0, 1.1799999999999999))
        self.timer = PiratesTimer.PiratesTimer(showMinutes = True, mode = None, titleText = '', titleFg = '', infoText = '', cancelText = '', cancelCallback = None)
        self.timer.setFontColor(PiratesGuiGlobals.TextFG2)
        self.timer.reparentTo(self)
        self.timer.setPos(0.45000000000000001, 0, 0.93999999999999995)
        self.timer.setScale(0.59999999999999998)
        self.timer.stash()
        self.hpMeter = DirectWaitBar(parent = self, relief = DGG.RAISED, state = DGG.DISABLED, range = 1, value = 0, frameColor = (0.0, 0.0, 0.0, 0.0), barColor = (0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (0, 0.31, 0, 0.018599999999999998), text = '', text_align = TextNode.ARight, text_scale = 0.029999999999999999, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_pos = (0.29999999999999999, 0.029999999999999999), pos = (0.36099999999999999, 0.0, 0.621), scale = 1.2)
        hpLabel = DirectLabel(parent = self.hpMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.HP, text_scale = 0.029999999999999999, text_align = TextNode.ALeft, text_pos = (0.014999999999999999, 0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
        self.speedMeter = DirectWaitBar(parent = self, relief = DGG.RAISED, state = DGG.DISABLED, range = 1, value = 0, frameColor = (0.0, 0.0, 0.0, 0.0), barColor = (0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1), frameSize = (0, 0.31, 0, 0.018599999999999998), text = '', text_align = TextNode.ARight, text_scale = 0.029999999999999999, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_pos = (0.29999999999999999, 0.029999999999999999), pos = (0.36099999999999999, 0.0, 0.55000000000000004), scale = 1.2)
        speedLabel = DirectLabel(parent = self.speedMeter, relief = None, state = DGG.DISABLED, text = PLocalizer.Speed, text_scale = 0.029999999999999999, text_align = TextNode.ALeft, text_pos = (0.014999999999999999, 0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
        textPos = (0.0, -0.16)
        self.plunderLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = chestIcon, geom_scale = 0.10000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.20000000000000001, 0, 0.31))
        plunderLabel = DirectLabel(parent = self.plunderLimit, relief = None, state = DGG.DISABLED, text = PLocalizer.Cargo, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_pos = (0, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
        self.cannonLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = cannonIcon, geom_scale = 0.45000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.37, 0, 0.31))
        cannonLabel = DirectLabel(parent = self.cannonLimit, relief = None, state = DGG.DISABLED, text = PLocalizer.Cannon, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_pos = (0, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
        self.broadsideLeftLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = broadsideIcon, geom_scale = (-0.45000000000000001, 0.45000000000000001, 0.45000000000000001), text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.73999999999999999, 0, 0.31))
        self.broadsideRightLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, geom = broadsideIcon, geom_scale = 0.45000000000000001, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = textPos, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (0.88500000000000001, 0, 0.31))
        broadsideLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.Broadsides, text_scale = 0.035999999999999997, text_align = TextNode.ACenter, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), pos = (0.81000000000000005, 0, 0.46000000000000002))
        crewLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.Crew, text_scale = 0.035999999999999997, text_align = TextNode.ALeft, text_pos = (0.47499999999999998, 0.46000000000000002), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
        self.crewLimit = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = 0.044999999999999998, text_align = TextNode.ACenter, text_pos = (0.56000000000000005, 0.14999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), textMayChange = 1, text_font = PiratesGlobals.getInterfaceOutlineFont())
        shipOV = base.cr.getOwnerView(self.shipId)
        if shipOV:
            self.setShipName(shipOV.name)
            self.setShipClass(shipOV.shipClass)
            self.setShipHp(shipOV.Hp, shipOV.maxHp)
            self.setShipSp(shipOV.Sp, shipOV.maxSp)
            self.setShipCrew(shipOV.crew, shipOV.maxCrew)
            self.setShipCargo([], shipOV.maxCargo)
            if hasattr(shipOV, 'cannonConfig'):
                self.setShipMaxCannons(shipOV.cannonConfig)
                self.setShipMaxLeftBroadside(shipOV.lBroadsideConfig)
                self.setShipMaxRightBroadside(shipOV.rBroadsideConfig)


        self.accept('setName-%s' % self.shipId, self.setShipName)
        self.accept('setShipClass-%s' % self.shipId, self.setShipClass)
        self.accept('setShipHp-%s' % self.shipId, self.setShipHp)
        self.accept('setShipSp-%s' % self.shipId, self.setShipSp)
        self.accept('setShipCargo-%s' % self.shipId, self.setShipCargo)
        self.accept('setShipCrew-%s' % self.shipId, self.setShipCrew)
        self.accept('setShipTimer-%s' % self.shipId, self.setShipTimer)
        self.accept('setHullCannonConfig-%s' % self.shipId, self.setShipMaxCannons)
        self.accept('setHullLeftBroadsideConfig-%s' % self.shipId, self.setShipMaxLeftBroadside)
        self.accept('setHullRightBroadsideConfig-%s' % self.shipId, self.setShipMaxRightBroadside)
        if base.config.GetBool('want-deploy-button', 0):
            pass
        1
コード例 #36
0
 def showDetails(self, cell, detailsPos, detailsHeight, event = None):
     self.notify.debug('Item showDetails')
     if self.manager.heldItem and self.manager.locked and cell.isEmpty() and self.isEmpty() or not (self.itemTuple):
         self.notify.debug(' early exit')
         return None
     
     inv = localAvatar.getInventory()
     if not inv:
         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*')
     self.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
     self.BuffIcons = loader.loadModel('models/textureCards/buff_icons')
     border = self.SkillIcons.find('**/base')
     halfWidth = 0.29999999999999999
     halfHeight = 0.20000000000000001
     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)
     subtypeText = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(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, subtypeText), text_scale = subtitleScale, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
     subtHeight = 0.050000000000000003
     subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
     runningVertPosition -= subtHeight
     runningSize += subtHeight
     labels.append(subtitleLabel)
     itemType = ItemGlobals.getType(itemId)
     itemSubtype = ItemGlobals.getSubtype(itemId)
     model = ItemGlobals.getModel(itemId)
     if model:
         self.realItem = loader.loadModel('models/inventory/' + model)
         if self.realItem:
             posHpr = ItemGlobals.getModelPosHpr(model)
             if posHpr:
                 self.realItem.setPos(posHpr[0], posHpr[1], posHpr[2])
                 self.realItem.setHpr(posHpr[3], posHpr[4], posHpr[5])
             elif itemSubtype == ItemGlobals.RAM:
                 self.realItem.setPos(-1.5, 1.5, -0.59999999999999998)
                 self.realItem.setHpr(70, 160, -90)
             else:
                 self.realItem.setPos(0.0, 1.5, -0.059999999999999998)
                 self.realItem.setHpr(0, 90, 0)
             self.realItem.reparentTo(self.portraitSceneGraph)
         
     
     iHeight = 0.17999999999999999
     self.createBuffer()
     self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
     runningVertPosition -= iHeight
     runningSize += iHeight
     labels.append(self.itemCard)
     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)
     specialAttack = ItemGlobals.getSpecialAttack(itemId)
     if specialAttack:
         attackIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(specialAttack))
         specialAttackNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.10000000000000001, geom = attackIcon, geom_scale = 0.10000000000000001, image_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), geom_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), text = PLocalizer.getInventoryTypeName(specialAttack), text_scale = PiratesGuiGlobals.TextScaleLarge, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, text_fg = titleColor, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         specialAttackRankLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.ItemRank % ItemGlobals.getSpecialAttackRank(itemId), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ARight, pos = (halfWidth - textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         specialAttackType = WeaponGlobals.getSkillTrack(specialAttack)
         if specialAttackType == WeaponGlobals.BREAK_ATTACK_SKILL_INDEX:
             specialAttackTypeText = PLocalizer.BreakAttackSkill
         elif specialAttackType == WeaponGlobals.DEFENSE_SKILL_INDEX:
             specialAttackTypeText = PLocalizer.DefenseSkill
         else:
             specialAttackTypeText = PLocalizer.WeaponSkill
         specialAttackTypeLabel = DirectLabel(parent = self, relief = None, text = specialAttackTypeText, text_scale = PiratesGuiGlobals.TextScaleLarge, text_wordwrap = halfWidth * 2.7999999999999998 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition - PiratesGuiGlobals.TextScaleLarge), text_pos = (0.0, -textScale))
         specialAttackInfo = PLocalizer.SkillDescriptions.get(specialAttack)
         specialAttackDescriptionText = specialAttackInfo[1]
         specialAttackDescriptionLabel = DirectLabel(parent = self, relief = None, text = specialAttackDescriptionText, text_scale = textScale, text_wordwrap = halfWidth * 2.7999999999999998 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition - specialAttackNameLabel.getHeight() + specialAttackTypeLabel.getHeight() - 0.059999999999999998), text_pos = (0.0, -textScale))
         saHeight = specialAttackNameLabel.getHeight() + specialAttackTypeLabel.getHeight() + specialAttackDescriptionLabel.getHeight() - 0.040000000000000001
         runningVertPosition -= saHeight
         runningSize += saHeight
         labels.append(specialAttackNameLabel)
         labels.append(specialAttackRankLabel)
         labels.append(specialAttackTypeLabel)
         labels.append(specialAttackDescriptionLabel)
     
     attributes = ItemGlobals.getAttributes(itemId)
     for i in range(0, len(attributes)):
         attributeIcon = self.SkillIcons.find('**/%s' % ItemGlobals.getAttributeIcon(attributes[i][0]))
         if not attributeIcon:
             attributeIcon = self.BuffIcons.find('**/%s' % ItemGlobals.getAttributeIcon(attributes[i][0]))
         
         attributeNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.050000000000000003, geom = attributeIcon, geom_scale = 0.050000000000000003, image_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), geom_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), text = PLocalizer.getItemAttributeName(attributes[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, text_fg = titleColor, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         attributeRankLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.ItemRank % attributes[i][1], text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ARight, pos = (halfWidth - textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         if attributeNameLabel.getHeight() > 0.074999999999999997:
             attributeNameSpace = 0.080000000000000002
         else:
             attributeNameSpace = PiratesGuiGlobals.TextScaleLarge
         attributeDescriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemAttributeDescription(attributes[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.7999999999999998 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition - attributeNameSpace), text_pos = (0.0, -textScale))
         aHeight = attributeNameLabel.getHeight() + attributeDescriptionLabel.getHeight()
         runningVertPosition -= aHeight + splitHeight
         runningSize += aHeight + splitHeight
         labels.append(attributeNameLabel)
         labels.append(attributeRankLabel)
         labels.append(attributeDescriptionLabel)
     
     skillBoosts = ItemGlobals.getSkillBoosts(itemId)
     for i in range(0, len(skillBoosts)):
         boostIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(skillBoosts[i][0]))
         boostNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.050000000000000003, geom = boostIcon, geom_scale = 0.050000000000000003, image_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), geom_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), text = PLocalizer.ItemBoost % PLocalizer.getInventoryTypeName(skillBoosts[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         boostRankLabel = DirectLabel(parent = self, relief = None, text = '+%s' % str(skillBoosts[i][1]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ARight, pos = (halfWidth - textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         bHeight = boostNameLabel.getHeight()
         runningVertPosition -= bHeight + splitHeight
         runningSize += bHeight + splitHeight
         labels.append(boostNameLabel)
         labels.append(boostRankLabel)
     
     description = PLocalizer.getItemFlavorText(itemId)
     if description != '':
         descriptionLabel = DirectLabel(parent = self, relief = None, text = description, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         dHeight = descriptionLabel.getHeight() + 0.02
         runningVertPosition -= dHeight
         runningSize += dHeight
         labels.append(descriptionLabel)
     
     weaponLevel = 0
     weaponRepId = WeaponGlobals.getRepId(itemId)
     weaponRep = inv.getReputation(weaponRepId)
     weaponReq = ItemGlobals.getWeaponRequirement(itemId)
     weaponText = None
     if weaponReq:
         weaponLevel = ReputationGlobals.getLevelFromTotalReputation(weaponRepId, weaponRep)[0]
         if weaponLevel < weaponReq:
             weaponColor = PiratesGuiGlobals.TextFG6
         else:
             weaponColor = (0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
         weaponText = PLocalizer.ItemLevelRequirement % (weaponReq, PLocalizer.getItemTypeName(itemType))
     else:
         trainingToken = EconomyGlobals.getItemTrainingReq(itemId)
         trainingAmt = inv.getItemQuantity(trainingToken)
         if trainingAmt == 0:
             weaponColor = PiratesGuiGlobals.TextFG6
             weaponText = PLocalizer.ItemTrainingRequirement % PLocalizer.getItemTypeName(itemType)
         
     if weaponText:
         weaponReqLabel = DirectLabel(parent = self, relief = None, text = weaponText, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = weaponColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         wHeight = weaponReqLabel.getHeight()
         runningVertPosition -= wHeight
         runningSize += wHeight
         labels.append(weaponReqLabel)
     
     if not Freebooter.getPaidStatus(localAvatar.getDoId()):
         if rarity != ItemGlobals.CRUDE:
             unlimitedLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.UnlimitedAccessRequirement, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = PiratesGuiGlobals.TextFG6, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
             uHeight = unlimitedLabel.getHeight()
             runningVertPosition -= uHeight
             runningSize += uHeight
             labels.append(unlimitedLabel)
         
     
     runningVertPosition -= 0.02
     runningSize += 0.02
     panels = self.helpFrame.attachNewNode('panels')
     topPanel = panels.attachNewNode('middlePanel')
     detailGui.find('**/top_panel').copyTo(topPanel)
     topPanel.setScale(0.080000000000000002)
     topPanel.reparentTo(self.helpFrame)
     middlePanel = panels.attachNewNode('middlePanel')
     detailGui.find('**/middle_panel').copyTo(middlePanel)
     middlePanel.setScale(0.080000000000000002)
     middlePanel.reparentTo(self.helpFrame)
     placement = 0
     i = 0
     heightMax = -0.080000000000000002
     currentHeight = runningVertPosition
     while currentHeight < heightMax:
         middlePanel = panels.attachNewNode('middlePanel%s' % 1)
         detailGui.find('**/middle_panel').copyTo(middlePanel)
         middlePanel.setScale(0.080000000000000002)
         middlePanel.reparentTo(self.helpFrame)
         if currentHeight + 0.20000000000000001 >= heightMax:
             difference = heightMax - currentHeight
             placement += (0.16800000000000001 / 0.20000000000000001) * difference
             currentHeight += difference
         else:
             placement += 0.16800000000000001
             currentHeight += 0.20000000000000001
         middlePanel.setZ(-placement)
         i += 1
     bottomPanel = panels.attachNewNode('bottomPanel')
     detailGui.find('**/bottom_panel').copyTo(bottomPanel)
     bottomPanel.setScale(0.080000000000000002)
     bottomPanel.setZ(-placement)
     bottomPanel.reparentTo(self.helpFrame)
     colorPanel = panels.attachNewNode('colorPanel')
     detailGui.find('**/color').copyTo(colorPanel)
     colorPanel.setScale(0.080000000000000002)
     colorPanel.setColor(titleColor)
     colorPanel.reparentTo(self.helpFrame)
     lineBreakTopPanel = panels.attachNewNode('lineBreakTopPanel')
     detailGui.find('**/line_break_top').copyTo(lineBreakTopPanel)
     lineBreakTopPanel.setScale(0.080000000000000002, 0.080000000000000002, 0.070000000000000007)
     lineBreakTopPanel.setZ(0.0080000000000000002)
     lineBreakTopPanel.reparentTo(self.helpFrame)
     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)
コード例 #37
0
 def setCategory(self, category):
     self.category = category
     name = PLocalizer.makeHeadingString(self.getCategoryName(), 2)
     self.categoryLabel['text'] = name
コード例 #38
0
    def createGui(self):
        itemId = self.data[0]
        self.picture = DirectFrame(parent=self,
                                   relief=None,
                                   state=DGG.DISABLED,
                                   pos=(0.01, 0, 0.01))
        self.nameTag = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text=self.name,
            text_scale=PiratesGuiGlobals.TextScaleSmall *
            PLocalizer.getHeadingScale(2),
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            pos=(0.050000000000000003, 0, 0.105),
            text_font=PiratesGlobals.getInterfaceFont())
        itemTypeFormatted = ''
        self.itemTypeName = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text=itemTypeFormatted,
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_font=PiratesGlobals.getInterfaceFont(),
            pos=(0.050000000000000003, 0, 0.065000000000000002))
        self.miscText = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text='',
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_align=TextNode.ALeft,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_wordwrap=11,
            pos=(0.050000000000000003, 0, 0.025000000000000001))
        if self.minLvl > 0:
            repId = WeaponGlobals.getRepId(itemId)
            if repId:
                self.checkLevel(repId, self.minLvl)

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

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

        if self.buy:
            self.checkPlayerInventory(itemId)

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

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

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

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

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

        self.flattenStrong()
コード例 #39
0
 def createGui(self):
     itemId = self.data[0]
     (item, quantity) = self.data
     name = ItemGlobals.getName(item)
     itemType = ItemGlobals.getType(item)
     itemTypeName = name
     repCategory = ItemGlobals.getItemRepId(itemId)
     if quantity:
         repValue = localAvatar.getInventory().getReputation(repCategory)
         self.repMeter = ReputationMeter(repCategory,
                                         width=0.66000000000000003)
         self.repMeter.setPos(0.62, 0, 0.041000000000000002)
         self.repMeter.update(repValue)
         self.repMeter.reparentTo(self)
         self.repMeter.flattenLight()
         hotkeyLabel = ''
         hotkeys = ()
         desc = PLocalizer.WeaponDescriptions.get(itemId)
         helpText = PLocalizer.InventoryTypeNames[repCategory]
         self.weaponButton = CombatTray.WeaponButton(
             hotkeys=hotkeys,
             hotkeyLabel=hotkeyLabel,
             helpOpaque=True,
             helpText=helpText,
             parent=self,
             showQuant=0,
             pos=(0.10000000000000001, 0, -0.02),
             scale=1.1000000000000001)
         self.weaponButton.ignoreHotkeys()
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton['extraArgs'] = [itemId]
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         self.desc = DirectLabel(
             parent=self,
             relief=None,
             state=DGG.DISABLED,
             text=PLocalizer.WeaponAlreadyUnlocked,
             text_scale=PiratesGuiGlobals.TextScaleSmall,
             text_align=TextNode.ALeft,
             text_fg=PiratesGuiGlobals.TextFG2,
             text_shadow=PiratesGuiGlobals.TextShadow,
             pos=(0.28999999999999998, 0, -0.0050000000000000001),
             text_font=PiratesGlobals.getInterfaceFont())
     else:
         self.repMeter = None
         name = PLocalizer.makeHeadingString(
             PLocalizer.InventoryTypeNames[repCategory], 2)
         self.categoryLabel = DirectLabel(
             parent=self,
             relief=None,
             text=name,
             text_scale=PiratesGuiGlobals.TextScaleLarge,
             text_align=TextNode.ALeft,
             text_shadow=PiratesGuiGlobals.TextShadow,
             pos=(0.28999999999999998, 0, 0.059999999999999998),
             textMayChange=0)
         self.weaponButton = CombatTray.WeaponButton(
             parent=self,
             state=DGG.DISABLED,
             showQuant=0,
             scale=1.1000000000000001)
         self.weaponButton.setPos(0.10000000000000001, 0, -0.02)
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         unlockDesc = PLocalizer.WeaponUnlockText[repCategory]
         self.desc = DirectLabel(
             parent=self,
             relief=None,
             state=DGG.DISABLED,
             text=unlockDesc,
             text_scale=PiratesGuiGlobals.TextScaleSmall,
             text_align=TextNode.ALeft,
             text_fg=PiratesGuiGlobals.TextFG2,
             text_shadow=PiratesGuiGlobals.TextShadow,
             pos=(0.28999999999999998, 0, 0.025000000000000001),
             text_font=PiratesGlobals.getInterfaceFont())
         self.setColorScale(0.40000000000000002, 0.40000000000000002,
                            0.40000000000000002, 1, 1)
コード例 #40
0
 def checkSkillReq(self, skillId):
     if skillId:
         if base.localAvatar.getSkillQuantity(skillId) < 2:
             skillName = PLocalizer.getInventoryTypeName(skillId)
             self.highlightRed(PLocalizer.SkillRequirement % skillName)
コード例 #41
0
 def loadData(self):
     itemId = self.data[0]
     name = PLocalizer.LocationNames[itemId]
     self.price = EconomyGlobals.StowawayCost[itemId]
     self.name = PLocalizer.makeHeadingString(name, 2)
     self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
コード例 #42
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()
コード例 #43
0
 def createGui(self):
     ShipFrame.createGui(self)
     self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(self['shipName'], 2), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_pos = (0.059999999999999998, 0.014999999999999999), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, frameColor = PiratesGuiGlobals.ButtonColor1[3], frameSize = (self['frameSize'][0] + 0.040000000000000001, self['frameSize'][1] - 0.029999999999999999, -0.0, 0.050000000000000003), pos = (0, 0, self['frameSize'][3] - 0.089999999999999997))
     self.classLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font = PiratesGlobals.getInterfaceFont(), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_pos = (self.nameLabel['frameSize'][0] + 0.02, -0.029999999999999999))
     self.timer = PiratesTimer.PiratesTimer(showMinutes = True, mode = None, titleText = '', titleFg = '', infoText = '', cancelText = '', cancelCallback = None)
     self.timer.setFontColor(PiratesGuiGlobals.TextFG2)
     self.timer.reparentTo(self)
     self.timer.setScale(0.55000000000000004)
     self.timer.setPos(0.62, 0, 0.315)
     self.timer.unstash()
     self.timer.countdown(self['time'])
     self.mainText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = 'How will you lead your crew?', text_pos = (0.62, 0.20000000000000001), text_font = PiratesGlobals.getInterfaceFont(), text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 10, text_shadow = (0, 0, 0, 1), textMayChange = 1)
     gui = loader.loadModel('models/gui/toplevel_gui')
     geomCheck = gui.find('**/generic_check')
     self.yesButton = DialogButton(parent = self, buttonStyle = DialogButton.YES, pos = (0.5, 0, 0.080000000000000002), text = PLocalizer.BoardShip, text_scale = PiratesGuiGlobals.TextScaleLarge, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0.035000000000000003, -0.014), geom = (geomCheck,) * 4, geom_pos = (-0.059999999999999998, 0, 0), geom_scale = 0.5, geom0_color = PiratesGuiGlobals.ButtonColor6[0], geom1_color = PiratesGuiGlobals.ButtonColor6[1], geom2_color = PiratesGuiGlobals.ButtonColor6[2], geom3_color = PiratesGuiGlobals.ButtonColor6[3], image3_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), helpPos = (0, 0, -0.12), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = [
         True])
     self.noButton = DialogButton(parent = self, buttonStyle = DialogButton.NO, pos = (0.73999999999999999, 0, 0.080000000000000002), text = PLocalizer.ParlayShip, text_scale = PiratesGuiGlobals.TextScaleLarge, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0.035000000000000003, -0.014), helpPos = (0, 0, -0.12), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = [
         False])
     self.noButton.hide()
コード例 #44
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()
コード例 #45
0
 def getName(self):
     return PLocalizer.getItemName(self.getId())
コード例 #46
0
    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)
コード例 #47
0
ファイル: ShipFrameSelect.py プロジェクト: TTGhost/POTCOR-src
 def createGui(self):
     ShipFrame.createGui(self)
     self.nameLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(self['shipName'], 2), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_pos = (0.059999999999999998, 0.014999999999999999), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, frameColor = PiratesGuiGlobals.ButtonColor1[3], frameSize = (self['frameSize'][0] + 0.040000000000000001, self['frameSize'][1] - 0.029999999999999999, -0.0, 0.050000000000000003), pos = (0, 0, self['frameSize'][3] - 0.089999999999999997))
     self.classLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(self['shipClass']), 1), text_font = PiratesGlobals.getInterfaceFont(), text_scale = PiratesGuiGlobals.TextScaleMed, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 1, text_pos = (self.nameLabel['frameSize'][0] + 0.02, -0.029999999999999999))
     self.typeLabel = DirectLabel(parent = self.nameLabel, relief = None, state = DGG.DISABLED, text = '', text_pos = (0.59999999999999998, -0.029999999999999999), text_font = PiratesGlobals.getInterfaceFont(), text_scale = 0.032000000000000001, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), textMayChange = 0)
     self.stateLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_font = PiratesGlobals.getInterfaceFont(), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = (0, 0, 0, 1), text_pos = (0.19, 0.070000000000000007), text_scale = PiratesGuiGlobals.TextScaleLarge, textMayChange = 0)
     gui = loader.loadModel('models/gui/toplevel_gui')
     geomCheck = gui.find('**/generic_check')
     self.button = GuiButton(parent = self, pos = (0.73999999999999999, 0, 0.080000000000000002), text = PLocalizer.SelectShip, text_scale = PiratesGuiGlobals.TextScaleLarge, text_font = PiratesGlobals.getInterfaceFont(), text_pos = (0.035000000000000003, -0.014), geom = (geomCheck,) * 4, geom_pos = (-0.059999999999999998, 0, 0), geom_scale = 0.5, geom0_color = PiratesGuiGlobals.ButtonColor6[0], geom1_color = PiratesGuiGlobals.ButtonColor6[1], geom2_color = PiratesGuiGlobals.ButtonColor6[2], geom3_color = PiratesGuiGlobals.ButtonColor6[3], image3_color = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), helpPos = (-0.40000000000000002, 0, 0.029999999999999999), helpDelay = 0.29999999999999999, command = self['command'], extraArgs = self['extraArgs'])
コード例 #48
0
 def createGui(self):
     itemId = self.data[0]
     self.picture = DirectFrame(parent=self,
                                relief=None,
                                state=DGG.DISABLED,
                                pos=(0.01, 0, 0.01))
     self.nameTag = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         text=self.name,
         text_scale=PiratesGuiGlobals.TextScaleSmall *
         PLocalizer.getHeadingScale(2),
         text_align=TextNode.ALeft,
         text_fg=PiratesGuiGlobals.TextFG1,
         text_shadow=PiratesGuiGlobals.TextShadow,
         pos=(0.05, 0, 0.09),
         text_font=PiratesGlobals.getInterfaceFont())
     itemTypeFormatted = ''
     self.itemTypeName = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         text=itemTypeFormatted,
         text_scale=PiratesGuiGlobals.TextScaleSmall,
         text_align=TextNode.ALeft,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text_font=PiratesGlobals.getInterfaceFont(),
         pos=(0.05, 0, 0.065))
     self.miscText = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         text='',
         text_scale=PiratesGuiGlobals.TextScaleSmall,
         text_align=TextNode.ALeft,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text_wordwrap=11,
         pos=(0.05, 0, 0.025))
     self.costText = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         image=StowawayListItem.coinImage,
         image_scale=0.12,
         image_pos=Vec3(-0.01, 0, 0.01),
         text=str(self.price),
         text_scale=PiratesGuiGlobals.TextScaleSmall,
         text_align=TextNode.ARight,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=PiratesGuiGlobals.TextShadow,
         text_wordwrap=11,
         text_pos=(-0.03, 0, 0),
         pos=(self.width - 0.035, 0, 0.09),
         text_font=PiratesGlobals.getInterfaceFont())
     self.picture['geom'] = loader.loadModel(
         StowawayItemGui.islandModelLookup[itemId])
     self.picture['geom_scale'] = StowawayItemGui.islandScaleLookup[itemId]
     self.picture['geom_pos'] = StowawayItemGui.islandPosLookup[itemId]
     self.picture['geom_hpr'] = StowawayItemGui.islandHprLookup[itemId]
     self.picture['geom_color'] = StowawayItemGui.islandColorScaleLookup[
         itemId]
     self.flattenStrong()
     return
コード例 #49
0
 def createGui(self):
     ShipFrame.createGui(self)
     self.nameLabel = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         text=PLocalizer.makeHeadingString(self['shipName'], 2),
         text_align=TextNode.ALeft,
         text_scale=0.05,
         text_pos=(0.06, 0.015),
         text_fg=PiratesGuiGlobals.TextFG1,
         text_shadow=PiratesGuiGlobals.TextShadow,
         textMayChange=1,
         frameColor=PiratesGuiGlobals.ButtonColor1[3],
         frameSize=(self['frameSize'][0] + 0.04,
                    self['frameSize'][1] - 0.03, -0.0, 0.05),
         pos=(0, 0, self['frameSize'][3] - 0.09))
     self.classLabel = DirectLabel(
         parent=self.nameLabel,
         relief=None,
         state=DGG.DISABLED,
         text=PLocalizer.makeHeadingString(
             PLocalizer.ShipClassNames.get(self['shipClass']), 1),
         text_font=PiratesGlobals.getInterfaceFont(),
         text_scale=PiratesGuiGlobals.TextScaleMed,
         text_align=TextNode.ALeft,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=(0, 0, 0, 1),
         textMayChange=1,
         text_pos=(self.nameLabel['frameSize'][0] + 0.02, -0.03))
     self.timer = PiratesTimer.PiratesTimer(showMinutes=True,
                                            mode=None,
                                            titleText='',
                                            titleFg='',
                                            infoText='',
                                            cancelText='',
                                            cancelCallback=None)
     self.timer.setFontColor(PiratesGuiGlobals.TextFG2)
     self.timer.reparentTo(self)
     self.timer.setScale(0.55)
     self.timer.setPos(0.62, 0, 0.315)
     self.timer.unstash()
     self.timer.countdown(self['time'])
     self.mainText = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         text='How will you lead your crew?',
         text_pos=(0.62, 0.2),
         text_font=PiratesGlobals.getInterfaceFont(),
         text_scale=PiratesGuiGlobals.TextScaleLarge,
         text_align=TextNode.ACenter,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_wordwrap=10,
         text_shadow=(0, 0, 0, 1),
         textMayChange=1)
     gui = loader.loadModel('models/gui/toplevel_gui')
     geomCheck = gui.find('**/generic_check')
     self.yesButton = DialogButton(
         parent=self,
         buttonStyle=DialogButton.YES,
         pos=(0.5, 0, 0.08),
         text=PLocalizer.BoardShip,
         text_scale=PiratesGuiGlobals.TextScaleLarge,
         text_font=PiratesGlobals.getInterfaceFont(),
         text_pos=(0.035, -0.014),
         geom=(geomCheck, ) * 4,
         geom_pos=(-0.06, 0, 0),
         geom_scale=0.5,
         geom0_color=PiratesGuiGlobals.ButtonColor6[0],
         geom1_color=PiratesGuiGlobals.ButtonColor6[1],
         geom2_color=PiratesGuiGlobals.ButtonColor6[2],
         geom3_color=PiratesGuiGlobals.ButtonColor6[3],
         image3_color=(0.8, 0.8, 0.8, 1),
         helpPos=(0, 0, -0.12),
         helpDelay=0.3,
         command=self['command'],
         extraArgs=[True])
     self.noButton = DialogButton(
         parent=self,
         buttonStyle=DialogButton.NO,
         pos=(0.74, 0, 0.08),
         text=PLocalizer.ParlayShip,
         text_scale=PiratesGuiGlobals.TextScaleLarge,
         text_font=PiratesGlobals.getInterfaceFont(),
         text_pos=(0.035, -0.014),
         helpPos=(0, 0, -0.12),
         helpDelay=0.3,
         command=self['command'],
         extraArgs=[False])
     return
コード例 #50
0
 def showDetails(self, cell, detailsPos, detailsHeight, event = None):
     self.notify.debug('Item showDetails')
     if self.manager.heldItem and self.manager.locked and cell.isEmpty() and self.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*')
     self.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
     self.BuffIcons = loader.loadModel('models/textureCards/buff_icons')
     border = self.SkillIcons.find('**/base')
     halfWidth = 0.29999999999999999
     halfHeight = 0.20000000000000001
     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)
     subtypeText = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(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 = '\x01slant\x01%s %s\x02' % (rarityText, subtypeText), text_scale = subtitleScale, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
     subtHeight = 0.050000000000000003
     subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
     runningVertPosition -= subtHeight
     runningSize += subtHeight
     labels.append(subtitleLabel)
     itemType = ItemGlobals.getType(itemId)
     itemSubtype = ItemGlobals.getSubtype(itemId)
     model = ItemGlobals.getModel(itemId)
     skillIcons = loader.loadModel('models/textureCards/skillIcons')
     if itemSubtype == ItemGlobals.POTION_BUFF:
         self.iconLabel = DirectLabel(parent = self.portraitSceneGraph, relief = None, image = skillIcons.find('**/%s' % ItemGlobals.getIcon(itemId)), pos = (0.0, 2.5, 0.0))
     elif model:
         self.realItem = loader.loadModel('models/inventory/' + model, okMissing = True)
         if not self.realItem:
             self.realItem = loader.loadModel('models/handheld/' + model)
         
         if self.realItem:
             posHpr = ItemGlobals.getModelPosHpr(model)
             if posHpr:
                 self.realItem.setPos(posHpr[0], posHpr[1], posHpr[2])
                 self.realItem.setHpr(posHpr[3], posHpr[4], posHpr[5])
             else:
                 self.realItem.setPos(0.0, 2.5, -0.40000000000000002)
                 self.realItem.setHpr(45, 0, 0)
             self.realItem.reparentTo(self.portraitSceneGraph)
         
     
     iHeight = 0.17999999999999999
     self.createBuffer()
     self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
     runningVertPosition -= iHeight
     runningSize += iHeight
     labels.append(self.itemCard)
     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)
     if ItemGlobals.getSubtype(itemId) == 30:
         duration = PotionGlobals.getPotionBuffDuration(WeaponGlobals.getSkillEffectFlag(ItemGlobals.getUseSkill(itemId)))
         if duration >= 3600:
             duration = duration / 3600
             if duration == 1:
                 units = PLocalizer.Hour
             else:
                 units = PLocalizer.Hours
         elif duration >= 60:
             duration = duration / 60
             if duration == 1:
                 units = PLocalizer.Minute
             else:
                 units = PLocalizer.Minutes
         else:
             units = PLocalizer.Seconds
         potency = PotionGlobals.getPotionPotency(WeaponGlobals.getSkillEffectFlag(ItemGlobals.getUseSkill(itemId)))
         data = {
             'pot': int(potency * 100),
             'dur': int(duration),
             'unit': units }
         description = PLocalizer.PotionDescs[ItemGlobals.getUseSkill(itemId)].safe_substitute(data)
     else:
         description = PLocalizer.getItemFlavorText(itemId)
     if description != '':
         descriptionLabel = DirectLabel(parent = self, relief = None, text = description, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
         dHeight = descriptionLabel.getHeight() + 0.02
         runningVertPosition -= dHeight
         runningSize += dHeight
         labels.append(descriptionLabel)
     
     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
     useLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.RightClickPotion, 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 = useLabel.getHeight()
     runningVertPosition -= uHeight
     runningSize += uHeight
     labels.append(useLabel)
     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 = panels.attachNewNode('colorPanel')
     detailGui.find('**/color').copyTo(colorPanel)
     colorPanel.setScale(0.080000000000000002)
     colorPanel.setColor(titleColor)
     colorPanel.reparentTo(self.helpFrame)
     lineBreakTopPanel = panels.attachNewNode('lineBreakTopPanel')
     detailGui.find('**/line_break_top').copyTo(lineBreakTopPanel)
     lineBreakTopPanel.setScale(0.080000000000000002, 0.080000000000000002, 0.070000000000000007)
     lineBreakTopPanel.setZ(0.0080000000000000002)
     lineBreakTopPanel.reparentTo(self.helpFrame)
     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)
コード例 #51
0
ファイル: ShipPanel.py プロジェクト: TTGhost/POTCOR-src
    def __init__(self, shipPage, shipId, **kwargs):
        self.shipPage = shipPage
        self.emptyBottle = True
        self.setShipId(shipId)
        self.timer = None
        self.lBroadsideLimit = 0
        self.rBroadsideLimit = 0
        kwargs.setdefault("relief", None)
        kwargs.setdefault("frameSize", (0, self.Width, 0, self.Height))
        DirectFrame.__init__(self, **None)
        self.initialiseoptions(ShipPanel)
        gui = loader.loadModel("models/gui/toplevel_gui")
        inventoryGui = loader.loadModel("models/gui/gui_icons_inventory")
        chestIcon = inventoryGui.find("**/pir_t_ico_trs_chest_01*")
        cannonIcon = gui.find("**/topgui_icon_ship_cannon_single")
        skillIcons = loader.loadModel("models/textureCards/skillIcons")
        broadsideId = InventoryType.CannonRoundShot
        ammoIconName = WeaponGlobals.getSkillIcon(broadsideId)
        broadsideIcon = skillIcons.find("**/%s" % ammoIconName)
        crewIcon = (gui.find("**/pir_t_gui_gen_friends_pirates"),)
        self.bottleFrame = ShipFrameBottle(
            parent=self,
            shipId=shipId,
            relief=None,
            state=DGG.DISABLED,
            pos=(0.074999999999999997, 0, 0.75),
            scale=0.83499999999999996,
        )
        gui = loader.loadModel("models/gui/gui_ship_window")
        bottleImage = gui.find("**/ship_bottle")
        self.shipBottle = DirectLabel(
            parent=self.bottleFrame,
            relief=None,
            state=DGG.DISABLED,
            geom=bottleImage,
            geom_scale=0.29999999999999999,
            geom_pos=(0, 0, 0),
            pos=(0.5, 0, -0.0),
        )
        self.nameLabel = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottle, 2),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_scale=PiratesGuiGlobals.TextScaleTitleSmall,
            text_align=TextNode.ACenter,
            text_shadow=(0, 0, 0, 1),
            text_wordwrap=30,
            textMayChange=1,
            text_font=PiratesGlobals.getPirateFont(),
            pos=(0.55000000000000004, 0, 1.22),
        )
        self.classLabel = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.makeHeadingString(PLocalizer.EmptyBottleDesc, 1),
            text_scale=PiratesGuiGlobals.TextScaleMed,
            text_align=TextNode.ACenter,
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=(0, 0, 0, 1),
            text_wordwrap=30,
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceFont(),
            pos=(0.55000000000000004, 0, 1.1799999999999999),
        )
        self.timer = PiratesTimer.PiratesTimer(
            showMinutes=True, mode=None, titleText="", titleFg="", infoText="", cancelText="", cancelCallback=None
        )
        self.timer.setFontColor(PiratesGuiGlobals.TextFG2)
        self.timer.reparentTo(self)
        self.timer.setPos(0.45000000000000001, 0, 0.93999999999999995)
        self.timer.setScale(0.59999999999999998)
        self.timer.stash()
        self.hpMeter = DirectWaitBar(
            parent=self,
            relief=DGG.RAISED,
            state=DGG.DISABLED,
            range=1,
            value=0,
            frameColor=(0.0, 0.0, 0.0, 0.0),
            barColor=(0.10000000000000001, 0.69999999999999996, 0.10000000000000001, 1),
            frameSize=(0, 0.31, 0, 0.018599999999999998),
            text="",
            text_align=TextNode.ARight,
            text_scale=0.029999999999999999,
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            text_pos=(0.29999999999999999, 0.029999999999999999),
            pos=(0.55000000000000004, 0.0, 0.45000000000000001),
            scale=1.2,
        )
        hpLabel = DirectLabel(
            parent=self.hpMeter,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.HP,
            text_scale=0.029999999999999999,
            text_align=TextNode.ALeft,
            text_pos=(0.014999999999999999, 0.029999999999999999),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
        )
        self.speedMeter = DirectWaitBar(
            parent=self,
            relief=DGG.RAISED,
            state=DGG.DISABLED,
            range=1,
            value=0,
            frameColor=(0.0, 0.0, 0.0, 0.0),
            barColor=(0.69999999999999996, 0.69999999999999996, 0.10000000000000001, 1),
            frameSize=(0, 0.31, 0, 0.018599999999999998),
            text="",
            text_align=TextNode.ARight,
            text_scale=0.029999999999999999,
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            text_pos=(0.29999999999999999, 0.029999999999999999),
            pos=(0.55000000000000004, 0.0, 0.34999999999999998),
            scale=1.2,
        )
        speedLabel = DirectLabel(
            parent=self.speedMeter,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.Sails,
            text_scale=0.029999999999999999,
            text_align=TextNode.ALeft,
            text_pos=(0.014999999999999999, 0.029999999999999999),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
        )
        self.customHullLabel = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=chestIcon,
            geom_scale=0.14999999999999999,
            geom_pos=(0, 0, 0),
            text="",
            text_scale=0.044999999999999998,
            text_align=TextNode.ACenter,
            text_pos=(0, -0.070000000000000007),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            pos=(0.34999999999999998, 0, 0.68000000000000005),
        )
        self.customHullLabel.hide()
        self.customRiggingLabel = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=chestIcon,
            geom_scale=0.14999999999999999,
            geom_pos=(0, 0, 0),
            text="",
            text_scale=0.044999999999999998,
            text_align=TextNode.ACenter,
            text_pos=(0, -0.070000000000000007),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            pos=(0.75, 0, 0.68000000000000005),
        )
        self.customRiggingLabel.hide()
        textPos = (0.0, -0.16)
        self.plunderLimit = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=chestIcon,
            geom_scale=0.10000000000000001,
            geom_pos=(0, 0, -0.050000000000000003),
            text="",
            text_scale=0.044999999999999998,
            text_align=TextNode.ACenter,
            text_pos=textPos,
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            pos=(0.20000000000000001, 0, 0.20000000000000001),
        )
        plunderLabel = DirectLabel(
            parent=self.plunderLimit,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.Cargo,
            text_scale=0.035999999999999997,
            text_align=TextNode.ACenter,
            text_pos=(0, 0.040000000000000001),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
        )
        self.cannonLimit = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=cannonIcon,
            geom_scale=0.45000000000000001,
            geom_pos=(0, 0, -0.050000000000000003),
            text="",
            text_scale=0.044999999999999998,
            text_align=TextNode.ACenter,
            text_pos=textPos,
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            pos=(0.37, 0, 0.20000000000000001),
        )
        cannonLabel = DirectLabel(
            parent=self.cannonLimit,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.Cannon,
            text_scale=0.035999999999999997,
            text_align=TextNode.ACenter,
            text_pos=(0, 0.040000000000000001),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
        )
        self.cannonLabel = cannonLabel
        self.broadsideLimit = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=broadsideIcon,
            geom_scale=0.14999999999999999,
            geom_pos=(0, 0, -0.050000000000000003),
            text="",
            text_scale=0.044999999999999998,
            text_align=TextNode.ACenter,
            text_pos=textPos,
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            pos=(0.81000000000000005, 0, 0.20000000000000001),
        )
        broadsideLabel = DirectLabel(
            parent=self.broadsideLimit,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.Broadsides,
            text_scale=0.035999999999999997,
            text_align=TextNode.ACenter,
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            text_pos=(0.0, 0.040000000000000001),
        )
        self.broadsideLabel = broadsideLabel
        self.crewLimit = DirectLabel(
            parent=self,
            relief=None,
            state=DGG.DISABLED,
            geom=crewIcon,
            geom_scale=0.40000000000000002,
            geom_pos=(0, 0, 0.10000000000000001),
            text="",
            text_scale=0.044999999999999998,
            text_align=TextNode.ACenter,
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
            textMayChange=1,
            text_font=PiratesGlobals.getInterfaceOutlineFont(),
            pos=(0.56000000000000005, 0, 0.040000000000000001),
        )
        crewLabel = DirectLabel(
            parent=self.crewLimit,
            relief=None,
            state=DGG.DISABLED,
            text=PLocalizer.Crew,
            text_scale=0.035999999999999997,
            text_align=TextNode.ACenter,
            text_pos=(0.0, 0.20000000000000001),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1),
        )
        self.crewLabel = crewLabel
        shipOV = base.cr.getOwnerView(self.shipId)
        if shipOV:
            self.setShipName(shipOV.name)
            self.setShipClass(shipOV.shipClass)
            self.setShipHp(shipOV.Hp, shipOV.maxHp)
            self.setShipSp(shipOV.Sp, shipOV.maxSp)
            self.setShipCrew(shipOV.crew, shipOV.maxCrew)
            self.setShipCargo([], shipOV.maxCargo)
            if hasattr(shipOV, "cannonConfig"):
                self.setShipMaxCannons(shipOV.cannonConfig)
                self.setShipMaxBroadside(shipOV.lBroadsideConfig, shipOV.rBroadsideConfig)

            self.updateIcons()

        if self.emptyBottle:
            self.hpMeter.hide()
            self.speedMeter.hide()
            self.plunderLimit.hide()
            self.cannonLimit.hide()
            self.broadsideLimit.hide()
            self.crewLimit.hide()

        self.accept("setName-%s" % self.shipId, self.setShipName)
        self.accept("setShipClass-%s" % self.shipId, self.setShipClass)
        self.accept("setShipHp-%s" % self.shipId, self.setShipHp)
        self.accept("setShipSp-%s" % self.shipId, self.setShipSp)
        self.accept("setShipCargo-%s" % self.shipId, self.setShipCargo)
        self.accept("setShipCrew-%s" % self.shipId, self.setShipCrew)
        self.accept("setShipTimer-%s" % self.shipId, self.setShipTimer)
        self.accept("setHullCannonConfig-%s" % self.shipId, self.setShipMaxCannons)
        self.accept("setHullLeftBroadsideConfig-%s" % self.shipId, self.setShipMaxLeftBroadside)
        self.accept("setHullRightBroadsideConfig-%s" % self.shipId, self.setShipMaxRightBroadside)
        self.accept("ShipChanged-%s" % self.shipId, self.handleShipChanged)
        if base.config.GetBool("want-deploy-button", 0):
            pass
        1
コード例 #52
0
 def getName(self):
     return PLocalizer.getItemName(self.itemTuple[1])
コード例 #53
0
ファイル: ShipPanel.py プロジェクト: TTGhost/POTCOR-src
 def setShipName(self, name, team=None):
     self.nameLabel["text"] = PLocalizer.makeHeadingString(name, 2)
コード例 #54
0
 def createGui(self):
     ShipFrame.createGui(self)
     self.nameLabel = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         text=PLocalizer.makeHeadingString(self['shipName'], 2),
         text_align=TextNode.ALeft,
         text_scale=0.050000000000000003,
         text_pos=(0.059999999999999998, 0.014999999999999999),
         text_fg=PiratesGuiGlobals.TextFG1,
         text_shadow=PiratesGuiGlobals.TextShadow,
         textMayChange=1,
         frameColor=PiratesGuiGlobals.ButtonColor1[3],
         frameSize=(self['frameSize'][0] + 0.040000000000000001,
                    self['frameSize'][1] - 0.029999999999999999, -0.0,
                    0.050000000000000003),
         pos=(0, 0, self['frameSize'][3] - 0.089999999999999997))
     self.classLabel = DirectLabel(
         parent=self.nameLabel,
         relief=None,
         state=DGG.DISABLED,
         text=PLocalizer.makeHeadingString(
             PLocalizer.ShipClassNames.get(self['shipClass']), 1),
         text_font=PiratesGlobals.getInterfaceFont(),
         text_scale=PiratesGuiGlobals.TextScaleMed,
         text_align=TextNode.ALeft,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=(0, 0, 0, 1),
         textMayChange=1,
         text_pos=(self.nameLabel['frameSize'][0] + 0.02,
                   -0.029999999999999999))
     self.typeLabel = DirectLabel(
         parent=self.nameLabel,
         relief=None,
         state=DGG.DISABLED,
         text='',
         text_pos=(0.59999999999999998, -0.029999999999999999),
         text_font=PiratesGlobals.getInterfaceFont(),
         text_scale=0.032000000000000001,
         text_align=TextNode.ARight,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=(0, 0, 0, 1),
         textMayChange=0)
     self.stateLabel = DirectLabel(
         parent=self,
         relief=None,
         state=DGG.DISABLED,
         text='',
         text_font=PiratesGlobals.getInterfaceFont(),
         text_align=TextNode.ALeft,
         text_fg=PiratesGuiGlobals.TextFG2,
         text_shadow=(0, 0, 0, 1),
         text_pos=(0.19, 0.070000000000000007),
         text_scale=PiratesGuiGlobals.TextScaleLarge,
         textMayChange=0)
     gui = loader.loadModel('models/gui/toplevel_gui')
     geomCheck = gui.find('**/generic_check')
     self.button = GuiButton(
         parent=self,
         pos=(0.73999999999999999, 0, 0.080000000000000002),
         text=PLocalizer.SelectShip,
         text_scale=PiratesGuiGlobals.TextScaleLarge,
         text_font=PiratesGlobals.getInterfaceFont(),
         text_pos=(0.035000000000000003, -0.014),
         geom=(geomCheck, ) * 4,
         geom_pos=(-0.059999999999999998, 0, 0),
         geom_scale=0.5,
         geom0_color=PiratesGuiGlobals.ButtonColor6[0],
         geom1_color=PiratesGuiGlobals.ButtonColor6[1],
         geom2_color=PiratesGuiGlobals.ButtonColor6[2],
         geom3_color=PiratesGuiGlobals.ButtonColor6[3],
         image3_color=(0.80000000000000004, 0.80000000000000004,
                       0.80000000000000004, 1),
         helpPos=(-0.40000000000000002, 0, 0.029999999999999999),
         helpDelay=0.29999999999999999,
         command=self['command'],
         extraArgs=self['extraArgs'])
コード例 #55
0
 def createTextBox(self):
     if self.infoBox:
         return None
     
     globalPos = self.getPos(base.a2dLeftCenter)
     self.infoBox = None
     self.infoBox = BorderFrame(parent = base.a2dLeftCenter, frameSize = (-0.040000000000000001, 0.5, -0.25, 0.050000000000000003), pos = (globalPos.getX() + 0.12, 0, globalPos.getZ()), state = DGG.DISABLED)
     self.label = DirectLabel(parent = self.infoBox, relief = None, text = PLocalizer.CannonDefenseAmmoDesc % (PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames[self.skillId], 2), self.cost, self.amount, PLocalizer.CannonDefenseAmmoTypeDesc[self.skillId]), text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 12, textMayChange = 1)
     if self.locked:
         memberText = ''
         if self.skillId > CannonDefenseGlobals.FREEBOOTER_LAST_AMMO_AVAILABLE:
             memberText = PLocalizer.VR_AuthAccess
         
         self.label['text'] = PLocalizer.CannonDefenseAmmoUnlockedAt % (CannonDefenseGlobals.getLevelUnlockedAt(self.skillId), memberText)
     
     self.infoBox.setBin('gui-cannonDefense', 4)
コード例 #56
0
ファイル: ShipPanel.py プロジェクト: TTGhost/POTCOR-src
 def setShipClass(self, shipClass):
     self.classLabel["text"] = PLocalizer.makeHeadingString(PLocalizer.ShipClassNames.get(shipClass), 1)
コード例 #57
0
 def getName(self):
     return PLocalizer.getItemName(self.itemTuple[1])
コード例 #58
0
    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 = PLocalizer.getTattooTypeName(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)
        gender = localAvatar.style.gender
        dna = HumanDNA.HumanDNA(gender)
        dna.copy(localAvatar.style)
        bodyShape = localAvatar.style.getBodyShape()
        bodyHeight = localAvatar.style.getBodyHeight()
        bodyOffset = 0.5
        headOffset = 0
        armOffset = 0
        chestOffset = 0
        if bodyShape == 0:
            bodyOffset = 0.5
            if gender == 'm':
                headOffset = 0.69999999999999996
                armOffset = 0.59999999999999998
                chestOffset = 0.5
            elif gender == 'f':
                headOffset = 0.55000000000000004
                armOffset = 0.5
                chestOffset = 0.5

        elif bodyShape == 1:
            bodyOffset = 0.5
            if gender == 'm':
                headOffset = 0.10000000000000001
                armOffset = 0.14999999999999999
            elif gender == 'f':
                headOffset = 0.40000000000000002
                armOffset = 0.40000000000000002
                chestOffset = 0.29999999999999999

        elif bodyShape == 2:
            bodyOffset = 0.5
            if gender == 'f':
                headOffset = -0.10000000000000001

        elif bodyShape == 3:
            bodyOffset = 0.5
            if gender == 'm':
                headOffset = 0.10000000000000001
                armOffset = 0.14999999999999999
            elif gender == 'f':
                headOffset = -0.40000000000000002
                armOffset = -0.20000000000000001
                chestOffset = -0.29999999999999999

        elif bodyShape == 4:
            bodyOffset = 0.5
            if gender == 'm':
                headOffset = -0.25
                armOffset = -0.14999999999999999
                chestOffset = -0.25
            elif gender == 'f':
                headOffset = 0.050000000000000003
                armOffset = 0.10000000000000001

        elif bodyShape == 5:
            bodyOffset = 0.5
            if gender == 'f':
                headOffset = -0.10000000000000001

        elif bodyShape == 6:
            bodyOffset = 0.5
            if gender == 'f':
                headOffset = 0.29999999999999999
                armOffset = 0.29999999999999999
                chestOffset = 0.29999999999999999

        elif bodyShape == 7:
            bodyOffset = 0.5
            if gender == 'f':
                headOffset = -0.10000000000000001

        elif bodyShape == 8:
            bodyOffset = 0.5
            if gender == 'm':
                headOffset = -0.14999999999999999
                armOffset = -0.10000000000000001
                chestOffset = -0.20000000000000001
            elif gender == 'f':
                headOffset = -0.20000000000000001
                armOffset = -0.10000000000000001
                chestOffset = -0.20000000000000001

        elif bodyShape == 9:
            bodyOffset = 0.5
            if gender == 'm':
                headOffset = -0.29999999999999999
                armOffset = -0.20000000000000001
                chestOffset = -0.29999999999999999
            elif gender == 'f':
                headOffset = -0.40000000000000002
                armOffset = -0.20000000000000001
                chestOffset = -0.29999999999999999

        m = Mat4(Mat4.identMat())
        itemType = ItemGlobals.getType(itemId)
        if itemType == ItemGlobals.CHEST:
            tattooType = TattooGlobals.ZONE1
        elif itemType == ItemGlobals.ARM:
            tattooType = TattooGlobals.ZONE2
        elif itemType == ItemGlobals.FACE:
            tattooType = TattooGlobals.ZONE4

        if localAvatar.style.gender == 'm':
            maleModelId = ItemGlobals.getMaleModelId(itemId)
            if maleModelId:
                tattooId = maleModelId
                tattooOrientation = ItemGlobals.getOrientation(
                    ItemGlobals.getMaleOrientation(itemId))
                dna = HumanDNA.HumanDNA(localAvatar.style.gender)
                dna.copy(localAvatar.style)
                gender = 'm'
            else:
                tattooId = ItemGlobals.getFemaleModelId(itemId)
                tattooOrientation = ItemGlobals.getOrientation(
                    ItemGlobals.getFemaleOrientation(itemId))
                dna = HumanDNA.HumanDNA('f')
                gender = 'f'
        else:
            femaleModelId = ItemGlobals.getFemaleModelId(itemId)
            if femaleModelId:
                tattooId = femaleModelId
                tattooOrientation = ItemGlobals.getOrientation(
                    ItemGlobals.getFemaleOrientation(itemId))
                dna = HumanDNA.HumanDNA(localAvatar.style.gender)
                dna.copy(localAvatar.style)
                gender = 'f'
            else:
                tattooId = ItemGlobals.getMaleModelId(itemId)
                tattooOrientation = ItemGlobals.getOrientation(
                    ItemGlobals.getMaleOrientation(itemId))
                dna = HumanDNA.HumanDNA('m')
                gender = 'm'
        offsetx = tattooOrientation[0]
        offsety = tattooOrientation[1]
        scale = tattooOrientation[2]
        rotate = tattooOrientation[3]
        color = 0
        S = Vec2(1 / float(scale), 1 / float(scale))
        Iv = Vec2(offsetx, offsety)
        Vm = Vec2(sin(rotate * pi / 180.0), cos(rotate * pi / 180.0))
        Vms = Vec2(Vm[0] * S[0], Vm[1] * S[1])
        Vn = Vec2(Vm[1], -Vm[0])
        Vns = Vec2(Vn[0] * S[0], Vn[1] * S[1])
        F = Vec2(-Vns.dot(Iv) + 0.5, -Vms.dot(Iv) + 0.5)
        if tattooType == 0:
            dna.setClothesShirt(0)
            dna.setClothesVest(0)
            dna.setClothesCoat(0)
            dna.setTattooChest(tattooId, F[0], F[1], S[0], rotate, color)
        elif tattooType == 1:
            dna.setClothesShirt(0)
            dna.setClothesCoat(0)
            dna.setTattooZone2(tattooId, F[0], F[1], S[0], rotate, color)
        elif tattooType == 2:
            dna.setClothesShirt(0)
            dna.setClothesCoat(0)
            dna.setTattooZone3(tattooId, F[0], F[1], S[0], rotate, color)
        elif tattooType == 3:
            dna.setTattooZone4(tattooId, F[0], F[1], S[0], rotate, color)
        elif tattooType == 4:
            dna.setTattooZone5(tattooId, F[0], F[1], S[0], rotate, color)
        elif tattooType == 5:
            dna.setTattooZone6(tattooId, F[0], F[1], S[0], rotate, color)
        elif tattooType == 6:
            dna.setTattooZone7(tattooId, F[0], F[1], S[0], rotate, color)
        elif tattooType == 7:
            dna.setTattooZone8(tattooId, F[0], F[1], S[0], rotate, color)

        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())
        self.displayHuman.reparentTo(self.portraitSceneGraph)
        if tattooType == TattooGlobals.ZONE1:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_spine03').getNetTransform(m)
            spine3Height = TransformState.makeMat(m).getPos().getZ()
            offsetZ = -spine3Height + chestOffset - bodyHeight * 1.2
            offsetX = 0.0
            offsetY = 3.25 + bodyOffset
            offsetH = 180
        elif tattooType == TattooGlobals.ZONE2:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_left_shoulder').getNetTransform(m)
            leftShoulderHeight = TransformState.makeMat(m).getPos().getZ()
            if gender == 'f':
                offsetZ = -leftShoulderHeight + 1.2 + armOffset - bodyHeight * 0.80000000000000004
                offsetX = 0.0
                offsetY = 2.0 + bodyOffset
            else:
                offsetZ = -leftShoulderHeight + 0.45000000000000001 + armOffset - bodyHeight * 0.80000000000000004
                if bodyShape == 4:
                    offsetY = 2.5 + bodyOffset
                else:
                    offsetY = 2.0 + bodyOffset
                offsetX = -0.20000000000000001
            offsetH = 105
        elif tattooType == TattooGlobals.ZONE4:
            self.displayHuman.getLOD('2000').getChild(0).node().findJoint(
                'def_head01').getNetTransform(m)
            headHeight = TransformState.makeMat(m).getPos().getZ()
            offsetZ = (-headHeight - 0.10000000000000001
                       ) + headOffset - bodyHeight * 1.1000000000000001
            offsetX = 0.0
            offsetY = 1.5 + bodyOffset
            offsetH = 180
        else:
            offsetZ = 0
            offsetY = 0
            offsetX = 0
            offsetH = 0
        self.displayHuman.setY(offsetY)
        self.displayHuman.setZ(offsetZ)
        self.displayHuman.setX(offsetX)
        self.displayHuman.setH(offsetH)
        iHeight = 0.17999999999999999
        self.createBuffer()
        self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
        runningVertPosition -= iHeight
        runningSize += iHeight
        labels.append(self.itemCard)
        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)
コード例 #59
0
 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 = PLocalizer.getJewelryTypeName(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)
     gender = localAvatar.style.gender
     dna = HumanDNA.HumanDNA(gender)
     dna.copy(localAvatar.style)
     bodyShape = localAvatar.style.getBodyShape()
     bodyHeight = localAvatar.style.getBodyHeight()
     bodyOffset = 0.5
     browOffset = 0
     earOffset = 0
     noseOffset = 0
     mouthOffset = 0
     handOffset = 0
     if bodyShape == 0:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = 0.75
             earOffset = 0.65000000000000002
             noseOffset = 0.69999999999999996
             mouthOffset = 0.75
             handOffset = 0.40000000000000002
         elif gender == 'f':
             browOffset = 0.55000000000000004
             earOffset = 0.55000000000000004
             noseOffset = 0.45000000000000001
             mouthOffset = 0.65000000000000002
             handOffset = 0.29999999999999999
         
     elif bodyShape == 1:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = 0.20000000000000001
             earOffset = 0.20000000000000001
             noseOffset = 0.10000000000000001
             mouthOffset = 0.20000000000000001
             handOffset = 0.20000000000000001
         elif gender == 'f':
             browOffset = 0.5
             earOffset = 0.5
             noseOffset = 0.40000000000000002
             mouthOffset = 0.5
             handOffset = 0.20000000000000001
         
     elif bodyShape == 2:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = 0.10000000000000001
             earOffset = 0.10000000000000001
             noseOffset = -0.050000000000000003
             mouthOffset = 0.10000000000000001
             handOffset = 0.10000000000000001
         elif gender == 'f':
             browOffset = -0.10000000000000001
             earOffset = -0.10000000000000001
             noseOffset = -0.20000000000000001
             mouthOffset = -0.10000000000000001
             handOffset = -0.10000000000000001
         
     elif bodyShape == 3:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = 0.20000000000000001
             earOffset = 0.20000000000000001
             noseOffset = 0.050000000000000003
             mouthOffset = 0.20000000000000001
             handOffset = 0.20000000000000001
         elif gender == 'f':
             browOffset = -0.40000000000000002
             earOffset = -0.40000000000000002
             noseOffset = -0.45000000000000001
             mouthOffset = -0.29999999999999999
             handOffset = -0.20000000000000001
         
     elif bodyShape == 4:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = -0.20000000000000001
             earOffset = -0.20000000000000001
             noseOffset = -0.29999999999999999
             mouthOffset = -0.14999999999999999
             handOffset = -0.050000000000000003
         elif gender == 'f':
             browOffset = 0.10000000000000001
             earOffset = 0.10000000000000001
             noseOffset = 0.0
             mouthOffset = 0.10000000000000001
             handOffset = 0.0
         
     elif bodyShape == 5:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = 0.10000000000000001
             earOffset = 0.10000000000000001
             noseOffset = -0.050000000000000003
             mouthOffset = 0.10000000000000001
             handOffset = 0.10000000000000001
         elif gender == 'f':
             browOffset = -0.050000000000000003
             earOffset = -0.10000000000000001
             noseOffset = -0.14999999999999999
             mouthOffset = -0.050000000000000003
             handOffset = -0.10000000000000001
         
     elif bodyShape == 6:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = 0.10000000000000001
             earOffset = 0.10000000000000001
             noseOffset = -0.050000000000000003
             mouthOffset = 0.10000000000000001
             handOffset = 0.10000000000000001
         elif gender == 'f':
             browOffset = 0.40000000000000002
             earOffset = 0.40000000000000002
             noseOffset = 0.25
             mouthOffset = 0.40000000000000002
             handOffset = 0.10000000000000001
         
     elif bodyShape == 7:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = 0.10000000000000001
             earOffset = 0.10000000000000001
             noseOffset = -0.050000000000000003
             mouthOffset = 0.10000000000000001
             handOffset = 0.10000000000000001
         elif gender == 'f':
             browOffset = 0.0
             earOffset = -0.050000000000000003
             noseOffset = -0.10000000000000001
             mouthOffset = 0.0
             handOffset = -0.050000000000000003
         
     elif bodyShape == 8:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = -0.10000000000000001
             earOffset = -0.10000000000000001
             noseOffset = -0.20000000000000001
             mouthOffset = -0.050000000000000003
             handOffset = -0.050000000000000003
         elif gender == 'f':
             browOffset = -0.14999999999999999
             earOffset = -0.14999999999999999
             noseOffset = -0.25
             mouthOffset = -0.14999999999999999
             handOffset = -0.10000000000000001
         
     elif bodyShape == 9:
         bodyOffset = 0.5
         if gender == 'm':
             browOffset = -0.20000000000000001
             earOffset = -0.20000000000000001
             noseOffset = -0.29999999999999999
             mouthOffset = -0.10000000000000001
             handOffset = -0.050000000000000003
         elif gender == 'f':
             browOffset = -0.34999999999999998
             earOffset = -0.34999999999999998
             noseOffset = -0.45000000000000001
             mouthOffset = -0.34999999999999998
             handOffset = -0.20000000000000001
         
     
     m = Mat4(Mat4.identMat())
     itemType = ItemGlobals.getType(itemId)
     if itemType == ItemGlobals.BROW:
         jewelType = JewelryGlobals.LBROW
     elif itemType == ItemGlobals.EAR:
         jewelType = JewelryGlobals.LEAR
     elif itemType == ItemGlobals.NOSE:
         jewelType = JewelryGlobals.NOSE
     elif itemType == ItemGlobals.MOUTH:
         jewelType = JewelryGlobals.MOUTH
     elif itemType == ItemGlobals.HAND:
         jewelType = JewelryGlobals.LHAND
     
     primaryColor = ItemGlobals.getPrimaryColor(itemId)
     secondaryColor = ItemGlobals.getSecondaryColor(itemId)
     if localAvatar.style.gender == 'm':
         maleModelId = ItemGlobals.getMaleModelId(itemId)
         if maleModelId:
             jewelId = maleModelId
             dna = HumanDNA.HumanDNA(localAvatar.style.gender)
             dna.copy(localAvatar.style)
             gender = 'm'
         else:
             jewelId = ItemGlobals.getFemaleModelId(itemId)
             dna = HumanDNA.HumanDNA('f')
             gender = 'f'
     else:
         femaleModelId = ItemGlobals.getFemaleModelId(itemId)
         if femaleModelId:
             jewelId = femaleModelId
             dna = HumanDNA.HumanDNA(localAvatar.style.gender)
             dna.copy(localAvatar.style)
             gender = 'f'
         else:
             jewelId = ItemGlobals.getMaleModelId(itemId)
             dna = HumanDNA.HumanDNA('m')
             gender = 'm'
     if jewelType == JewelryGlobals.LBROW:
         dna.setJewelryZone3(jewelId, primaryColor, secondaryColor)
     elif jewelType == JewelryGlobals.LEAR:
         dna.setJewelryZone1(jewelId, primaryColor, secondaryColor)
     elif jewelType == JewelryGlobals.NOSE:
         dna.setJewelryZone5(jewelId, primaryColor, secondaryColor)
     elif jewelType == JewelryGlobals.MOUTH:
         dna.setJewelryZone6(jewelId, primaryColor, secondaryColor)
     elif jewelType == JewelryGlobals.LHAND:
         dna.setJewelryZone7(jewelId, primaryColor, secondaryColor)
     
     dna.setClothesHat(0, 0)
     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 jewelType == JewelryGlobals.LBROW:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('trs_right_eyebrow').getNetTransform(m)
         rightEyeHeight = TransformState.makeMat(m).getPos().getZ()
         if gender == 'f':
             offsetX = 0.40000000000000002
             offsetZ = -rightEyeHeight + browOffset - bodyHeight * 1.0
             offsetY = 0.25 + bodyOffset
         else:
             offsetX = 0.29999999999999999
             offsetZ = -rightEyeHeight * 0.98999999999999999 + browOffset - bodyHeight * 1.0
             offsetY = 0.14999999999999999 + bodyOffset
         offsetH = -240
     elif jewelType == JewelryGlobals.LEAR:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_trs_left_ear').getNetTransform(m)
         leftEarHeight = TransformState.makeMat(m).getPos().getZ()
         if gender == 'f':
             offsetZ = -leftEarHeight + earOffset - bodyHeight * 1.0
             offsetY = 0.40000000000000002 + bodyOffset
             offsetX = 0.14999999999999999
         else:
             offsetZ = -leftEarHeight * 0.98999999999999999 + earOffset - bodyHeight * 1.0
             offsetY = 0.29999999999999999 + bodyOffset
             offsetX = 0.040000000000000001
         offsetH = -250
     elif jewelType == JewelryGlobals.NOSE:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_trs_mid_nose_bot').getNetTransform(m)
         noseHeight = TransformState.makeMat(m).getPos().getZ()
         if gender == 'f':
             offsetZ = -noseHeight + 0.089999999999999997 + noseOffset - bodyHeight * 0.80000000000000004
             offsetY = 0.45000000000000001 + bodyOffset
         else:
             offsetZ = -noseHeight + 0.10000000000000001 + noseOffset - bodyHeight * 0.80000000000000004
             offsetY = 0.40000000000000002 + bodyOffset
         offsetX = 0.059999999999999998
         offsetH = 180
     elif jewelType == JewelryGlobals.MOUTH:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('trs_lips_top').getNetTransform(m)
         mouthHeight = TransformState.makeMat(m).getPos().getZ()
         offsetZ = -mouthHeight + 0.02 + mouthOffset - bodyHeight * 1.1000000000000001
         offsetY = 0.59999999999999998 + bodyOffset
         offsetX = 0.080000000000000002
         offsetH = 180
     elif jewelType == JewelryGlobals.LHAND:
         self.displayHuman.getLOD('2000').getChild(0).node().findJoint('def_left_index01').getNetTransform(m)
         leftIndexHeight = TransformState.makeMat(m).getPos().getZ()
         if gender == 'f':
             offsetZ = -leftIndexHeight + 0.050000000000000003 + handOffset - bodyHeight * 0.5
             offsetX = -0.69999999999999996
             offsetY = 1.25 + bodyOffset
         else:
             offsetZ = -leftIndexHeight + handOffset - bodyHeight * 0.5
             if bodyShape == 4:
                 offsetX = -1.0
                 offsetY = 1.75 + bodyOffset
             elif bodyShape == 3:
                 offsetX = -0.69999999999999996
                 offsetY = 1.25 + bodyOffset
             elif bodyShape == 1:
                 offsetX = -0.69999999999999996
                 offsetY = 1.25 + bodyOffset
             elif bodyShape == 0:
                 offsetX = -0.69999999999999996
                 offsetY = 1.25 + bodyOffset
             else:
                 offsetX = -0.80000000000000004
                 offsetY = 1.25 + bodyOffset
         offsetH = 160
     else:
         offsetZ = 0.0
         offsetY = 0.0
         offsetX = 0.0
         offsetH = 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)
     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)