class MinimapShop(MinimapObject):
    SORT = 2
    SIGN_DICT = {'blacksmith': '**/shopCoin_blacksmith','shipwright': '**/shopCoin_shipwright','gunsmith': '**/shopCoin_gunsmith','weapons': '**/shopCoin_gunsmith','tailor': '**/shopCoin_tailor','barber': '**/shopCoin_barber','jeweler': '**/shopCoin_jeweler','tattoo': '**/shopCoin_tattoo','voodoo': '**/shopCoin_voodoo','gypsy': '**/shopCoin_voodoo','tavern': '**/shopCoin_tavern','fishmaster': '**/shopCoin_fishing','cannonmaster': '**/shopCoin_cannon','stowaway': '**/shopCoin_stowaway','catalogrep': '**/shopCoin_catalog'}
    SIGNS = {}
    HELP_DICT = {'blacksmith': PLocalizer.ShopBlacksmith,'shipwright': PLocalizer.ShopShipwright,'gunsmith': PLocalizer.ShopGunsmith,'weapons': PLocalizer.ShopGunsmith,'tailor': PLocalizer.ShopTailor,'barber': PLocalizer.ShopBarber,'jeweler': PLocalizer.ShopJewelry,'tattoo': PLocalizer.ShopTattoo,'voodoo': PLocalizer.ShopGypsy,'gypsy': PLocalizer.ShopGypsy,'tavern': PLocalizer.ShopTavern,'fishmaster': PLocalizer.ShopFishmaster,'cannonmaster': PLocalizer.ShopCannoneer,'stowaway': PLocalizer.ShopStowaway,'catalogrep': PLocalizer.ShopCatalogRep}

    @classmethod
    def loadSigns(cls):
        if not MinimapShop.SIGNS:
            coins = loader.loadModel('models/textureCards/shopCoins')
            for coin in coins.findAllMatches('**/shopCoin_*'):
                coin.setP(-90)
                coin.flattenStrong()

            for pattern, signName in MinimapShop.SIGN_DICT.iteritems():
                MinimapShop.SIGNS[pattern] = coins.find(signName)

    @classmethod
    def getShopType(cls, shopString):
        for pattern in MinimapShop.SIGN_DICT:
            if pattern in shopString:
                return pattern

        return None

    def __init__(self, uid, worldNode, shopType):
        self.loadSigns()
        worldNode.setHpr(0, 0, 0)
        MinimapObject.__init__(self, uid, worldNode, MinimapShop.SIGNS[shopType])
        self.shopType = shopType
        self.button = None
        return

    def _addedToMap(self, map):
        self.mapGeom.setScale(aspect2d, 0.06)
        overlayNode = map.getOverlayNode()
        transform = self.mapGeom.getTransform(overlayNode)
        self.button = GuiButton(parent=overlayNode, state=DGG.NORMAL, image=self.mapGeom, pos=transform.getPos(), image_hpr=transform.getHpr(), image_scale=transform.getScale(), helpText=MinimapShop.HELP_DICT[self.shopType], helpPos=(-0.27, 0, 0.07), helpDelay=0, helpOpaque=True, sortOrder=MinimapShop.SORT)
        self.button.setAlphaScale(1, 1)
        self.mapGeom.detachNode()

    def _removedFromMap(self, map):
        if self.button:
            self.button.destroy()
            self.button = None
        return

    def _updateOnMap(self, map):
        MinimapObject._updateOnMap(self, map)
        if self.button:
            if base.localAvatar.guiMgr.invasionScoreboard or base.localAvatar.isInInvasion():
                self.button.hide()
            else:
                self.button.show()
Пример #2
0
 def initializeTableInterface(self):
     self.levelUpIval = None
     self.swapCard = False
     self.cardSwapIndex = 0
     self.swapDialog = None
     self.leaveDialog = None
     self.swapResultDialog = None
     self.timer = False
     self.timeout = False
     self.buttonArray = []
     self.suitGeomArray = []
     if not True:
         self.suitGeomArray.append(self.suitImage(0))
         self.suitGeomArray.append(self.suitImage(1))
         self.suitGeomArray.append(self.suitImage(2))
         self.suitGeomArray.append(self.suitImage(3))
     else:
         self.suitIcons = loader.loadModel('models/gui/suit_icons')
         if self.suitIcons:
             scale = 0.080000000000000002
             icon = self.suitIcons.find('**/suit_icon_h')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_d')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_c')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_s')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
         else:
             self.suitGeomArray = [None, None, None, None]
     x = -0.35999999999999999
     y = 0.070000000000000007
     x_increment = 0.23999999999999999
     text = PLocalizer.TableLeave
     button = GuiButton(parent=self.menu,
                        command=self.leaveAction,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text,
                            [PlayingCardGlobals.Leave])
     self.leaveButton = button
     self.buttonArray = self.buttonArray + [button]
     button.show()
     text = PLocalizer.TableCancel
     button = GuiButton(parent=self.menu,
                        command=self.cancelSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [0])
     self.cancelButton = button
     self.buttonArray = self.buttonArray + [button]
     button.hide()
     x = x + x_increment
     self.suit = 0
     self.rank = 0
     self.cardSwapIndex = 0
     self.suitButtonArray = []
     self.rankButtonArray = []
     x = -0.35999999999999999
     y = 0.17749999999999999
     x_increment = 0.23999999999999999
     suit = 0
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent=self.menu,
                        command=self.cardSuitSelection,
                        canReposition=True)
     self.setButtonSettings(button, (x, 0, y), text, [suit])
     self.suitButtonArray = self.suitButtonArray + [button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.17749999999999999
     x_increment = 0.12
     rank = 0
     text = PLocalizer.Card2
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card3
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card4
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card5
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card6
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card7
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card8
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card9
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.070000000000000007
     x_increment = 0.12
     x = x + x_increment
     x = x + x_increment
     x = x + x_increment
     text = PLocalizer.CardT
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardJ
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardQ
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardK
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardA
     button = GuiButton(parent=self.menu,
                        command=self.cardRankSelection,
                        canReposition=True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [rank])
     self.rankButtonArray = self.rankButtonArray + [button]
     x = x + x_increment
     rank = rank + 1
Пример #3
0
    def __init__(self, table):
        DirectFrame.__init__(self, relief=None)
        self.initialiseoptions(BlackjackTableGUI)
        self.table = table
        self.destroyed = False
        self.maxHandCards = 14
        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = BlackjackStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)

        self.localStatusPanel = self.playerStatusPanels[
            self.LocalAvatarGuiIndex]
        width = 1.0
        height = 0.25
        self.menu = BorderFrame(parent=base.a2dBottomCenter,
                                frameSize=(-width / 2.0, width / 2.0, 0,
                                           height),
                                pos=(0, 0, 0))
        self.width = width
        self.height = height
        self.initializeTableInterface()
        x = -0.36
        y = 0.1775
        x_increment = 0.24
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.24)
        text = PLocalizer.BlackjackCardSwap
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           helpText=helpText,
                           helpPos=helpPos,
                           pos=(x, 0, y),
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.CardSwap])
        button.show()
        self.cardSwapButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        text = PLocalizer.BlackjackDoubleDown
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.DoubleDown])
        button.show()
        self.doubleDownButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        text = PLocalizer.BlackjackStay
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Stay])
        button.show()
        self.stayButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        text = PLocalizer.BlackjackHit
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Hit])
        button.show()
        self.hitButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        x = -0.36
        y = 0.07
        x_increment = 0.24
        x += x_increment
        x += x_increment
        text = PLocalizer.BlackjackSplit
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Split])
        button.show()
        self.splitButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment
        bid = self.table.getTableBidAmount()
        text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Bid])
        button.show()
        self.bidButton = button
        self.buttonArray = self.buttonArray + [button]
        x += x_increment

        def bid_update_function(value):
            bid = self.sliderValueToBid(value)
            text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
            self.bidButton['text'] = text
            self.bidAmount = bid

        self.bidAmount = 2
        default_value = 0.0
        x = 0.0
        y = -0.25
        label = PLocalizer.BlackjackBid
        resolution = 1.0
        self.bidSlider = self.create_slider(bid_update_function, default_value,
                                            x, y, resolution, label, self.menu)
        x = -0.36
        y = 0.1775
        x_increment = 0.24
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent=self.menu,
                           command=self.cardSwapButtonSelection,
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat1])
        self.cheat1Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        text = PLocalizer.PokerCheat2
        button = GuiButton(parent=self.menu,
                           command=self.cardSwapButtonSelection,
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        self.hideCheatButtons()
        self.disableAllPlayButtons()
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32
        currentMoney = localAvatar.getInventory().getGoldInPocket()
        self.moneyDisplay = DirectLabel(
            parent=self.menu,
            relief=None,
            pos=(-0.3 + x_increment / 2.0, 0, 0.075),
            geom=goldCoin,
            geom_scale=(scale, scale, scale),
            geom_pos=(0, 0, 0),
            text='%s' % currentMoney,
            text_align=TextNode.ALeft,
            text_scale=0.035,
            text_pos=(0.045, -0.01),
            text_fg=PiratesGuiGlobals.TextFG1,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1,
            scale=1.1)
        self.accept(
            InventoryGlobals.getCategoryQuantChangeMsg(
                localAvatar.getInventoryId(), InventoryType.ItemTypeMoney),
            self.setMoney)
        this = self
        identifier = 0
        this.sfxArray = []
        this.hitIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_HIT)
        ]
        identifier = identifier + 1
        self.hands = []
        self.splitCardsArray = []
        self.canSplit = False
        self.canDoubleDown = False
        self.bid = False
        return
Пример #4
0
class AmmoSkillButton(SkillButton.SkillButton):
    def __init__(self,
                 skillId,
                 slotId,
                 callback,
                 quantity=0,
                 skillRank=0,
                 showQuantity=False,
                 showHelp=False,
                 showRing=False,
                 hotkey=None,
                 name='',
                 showIcon=True,
                 showLock=False,
                 rechargeSkillId=False,
                 assocAmmo=[]):
        if skillId in [
                InventoryType.DefenseCannonRoundShot,
                InventoryType.DefenseCannonEmpty
        ]:
            showQuantity = False

        if not Freebooter.getPaidStatus(
                base.localAvatar.doId
        ) and slotId >= CannonDefenseGlobals.FREEBOOTER_MAX_AMMO_SLOTS:
            showLock = True

        SkillButton.SkillButton.__init__(self, skillId, callback, quantity,
                                         skillRank, showQuantity, showHelp,
                                         showRing, hotkey, name, showIcon,
                                         showLock, rechargeSkillId, assocAmmo)
        self.toggleFrame['image_scale'] = 0.55000000000000004
        self.toolTipBox = None
        self.slotId = slotId
        self._initButtons()
        self.updateSkillId(skillId)

    def _initButtons(self):
        self.sellButtonModel = loader.loadModel(
            'models/gui/pir_m_gui_can_buttonSell')
        self.sellButton = GuiButton(
            parent=self,
            image=(self.sellButtonModel.find('**/idle'),
                   self.sellButtonModel.find('**/idle'),
                   self.sellButtonModel.find('**/over')),
            image_scale=1,
            scale=0.40000000000000002,
            sortOrder=100,
            pos=(0, 0, -0.125),
            command=self.onSellClick)
        self.sellButton.bind(DGG.ENTER, self.showToolTip)
        self.sellButton.bind(DGG.EXIT, self.hideToolTip)

    def updateSkillId(self, skillId):
        SkillButton.SkillButton.updateSkillId(self, skillId)
        if not hasattr(self, 'sellButton'):
            return None

        if skillId == InventoryType.DefenseCannonEmpty:
            self.sellButton['state'] = DGG.DISABLED
            self.sellButton.hide()
            if skillId == InventoryType.DefenseCannonEmpty:
                self.setShowIcon(False)

        else:
            self.sellButton['state'] = DGG.NORMAL
            self.sellButton.show()
            self.setShowIcon(True)

    def createToolTip(self):
        if self.toolTipBox:
            return None

        self.label = DirectLabel(parent=None,
                                 relief=None,
                                 text=PLocalizer.SellButton,
                                 text_align=TextNode.ALeft,
                                 text_scale=PiratesGuiGlobals.TextScaleLarge,
                                 text_fg=PiratesGuiGlobals.TextFG2,
                                 text_wordwrap=12)
        height = -self.label.getHeight()
        width = self.label.getWidth()
        toolTipScale = 2.5
        self.toolTipBox = None
        self.toolTipBox = BorderFrame(parent=self.sellButton,
                                      frameSize=(-0.01, width, height,
                                                 0.050000000000000003),
                                      scale=toolTipScale,
                                      pos=(-(width * toolTipScale * 0.5), 0,
                                           height * toolTipScale * 2.25),
                                      state=DGG.DISABLED)
        self.label.reparentTo(self.toolTipBox)

    def showToolTip(self, event):
        self.createToolTip()

    def hideToolTip(self, event):
        if self.toolTipBox:
            self.toolTipBox.destroy()
            self.toolTipBox = None

    def onSellClick(self):
        messenger.send('onSellClick', [self.skillId])
Пример #5
0
class ChestTray(GuiTray.GuiTray):
    __module__ = __name__
    WantClothingPage = base.config.GetBool('want-clothing-page', 0)
    WantTitlesPage = base.config.GetBool(
        'want-land-infamy', 0) or base.config.GetBool('want-sea-infamy', 0)

    def __init__(self, parent, parentMgr, **kw):
        GuiTray.GuiTray.__init__(self, parent, 0.6, 0.12, **kw)
        self.initialiseoptions(ChestTray)
        self.setBin('gui-fixed', 0)
        self.state = 0
        self.buttonsParent = self.attachNewNode(
            ModelNode('ChestTray.buttonsParent'), sort=1)
        self.stickyButtonsParent = self.attachNewNode(
            ModelNode('ChestTray.stickyButtonsParent'), sort=1)
        self.stickyButtonsParent.setPos(0, 0, 0.02)
        self.buttons = {}
        self.buildShowHideButtonsIvals()
        self.openSfx = loadSfx(SoundGlobals.SFX_GUI_OPEN_SEACHEST)
        self.openSfx.setVolume(0.4)
        self.closeSfx = loadSfx(SoundGlobals.SFX_GUI_CLOSE_SEACHEST)
        self.closeSfx.setVolume(0.4)
        gui = loader.loadModel('models/gui/toplevel_gui')
        gui_main = loader.loadModel('models/gui/gui_main')
        helpPos = (-0.26, 0, 0.06)
        helpDelay = 0
        self.buttonImage = gui.find('**/topgui_icon_box')
        self.buttonImageIn = gui.find('**/topgui_icon_box_in')
        self.buttonColors = (VBase4(0.7, 0.7, 0.7,
                                    1), VBase4(0.8, 0.8, 0.8,
                                               1), VBase4(1.0, 1.0, 1.0, 1),
                             VBase4(0.6, 0.6, 0.6, 1))
        self.currentButtonIn = None
        self.highlightButtons = [
            'guiMgrToggleMap', 'guiMgrToggleWeapons', 'guiMgrToggleQuest',
            'guiMgrToggleLevels', 'guiMgrToggleShips', 'guiMgrToggleTreasures',
            'guiMgrToggleLookout', 'guiMgrToggleInventory',
            'guiMgrToggleTitles'
        ]
        buttonOptions = {
            'image': self.buttonImage,
            'geom': None,
            'relief': None,
            'frameSize': (0, 0.12, 0, 0.12),
            'image_scale': 0.47,
            'image_pos': (0.06, 0, 0.06),
            'image0_color': self.buttonColors[0],
            'image1_color': self.buttonColors[1],
            'image2_color': self.buttonColors[2],
            'image3_color': self.buttonColors[3],
            'geom_scale': 0.12,
            'geom_pos': (0.06, 0, 0.06),
            'command': self.togglePanel
        }
        extraHeight = 0
        if self.WantTitlesPage:
            extraHeight = 0.12
        buttonOptions['geom'] = gui.find('**/friend_button_over')
        buttonOptions['geom_scale'] = 0.12
        self.socialButton = GuiButton(parent=self.buttonsParent,
                                      hotkeys=['f', 'shift-f'],
                                      hotkeyLabel='F',
                                      helpText=PLocalizer.SocialButtonHelp,
                                      helpPos=helpPos,
                                      helpDelay=helpDelay,
                                      extraArgs=['guiMgrToggleSocial'],
                                      pos=(0.01, 0, 1.16 + extraHeight),
                                      **buttonOptions)
        self.buttons['guiMgrToggleSocial'] = self.socialButton
        buttonOptions['geom'] = gui.find('**/compass_small_button_open_over')
        buttonOptions['geom_scale'] = 0.09
        self.radarButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['c', 'shift-c'],
                                     hotkeyLabel='C',
                                     helpText=PLocalizer.RadarButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleRadar'],
                                     pos=(0.01, 0, 1.04 + extraHeight),
                                     **buttonOptions)
        self.buttons['guiMgrToggleRadar'] = self.radarButton
        buttonPosZ = 0.88
        buttonHeight = 0.12
        if self.WantTitlesPage:
            buttonPosZ += buttonHeight
        buttonOptions['geom'] = gui_main.find('**/world_map_icon')
        buttonOptions['geom_scale'] = 0.095
        self.mapButton = GuiButton(parent=self.buttonsParent,
                                   hotkeys=['m', 'shift-m'],
                                   hotkeyLabel='M',
                                   helpText=PLocalizer.MapButtonHelp,
                                   helpPos=helpPos,
                                   helpDelay=helpDelay,
                                   extraArgs=['guiMgrToggleMap'],
                                   pos=(0.01, 0, buttonPosZ),
                                   **buttonOptions)
        self.buttons['guiMgrToggleMap'] = self.mapButton
        buttonPosZ -= buttonHeight
        self.highlightButton('guiMgrToggleMap')
        buttonOptions['geom'] = (gui.find('**/treasure_chest_closed_over'), )
        buttonOptions['geom_scale'] = 0.12
        self.bagButton = GuiButton(parent=self.buttonsParent,
                                   hotkeys=['i', 'shift-i'],
                                   hotkeyLabel='I',
                                   helpText=PLocalizer.SocialButtonHelp,
                                   helpPos=helpPos,
                                   helpDelay=helpDelay,
                                   extraArgs=['guiMgrToggleInventory'],
                                   pos=(0.01, 0, buttonPosZ),
                                   **buttonOptions)
        self.buttons['guiMgrToggleInventory'] = self.bagButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_weapons')
        buttonOptions['geom_scale'] = 0.18
        self.weaponButton = GuiButton(parent=self.buttonsParent,
                                      hotkeys=['y', 'shift-y'],
                                      hotkeyLabel='Y',
                                      helpText=PLocalizer.WeaponButtonHelp,
                                      helpPos=helpPos,
                                      helpDelay=helpDelay,
                                      extraArgs=['guiMgrToggleWeapons'],
                                      pos=(0.01, 0, buttonPosZ),
                                      **buttonOptions)
        self.buttons['guiMgrToggleWeapons'] = self.weaponButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_skills')
        buttonOptions['geom_scale'] = 0.18
        self.levelButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['k', 'shift-k'],
                                     hotkeyLabel='K',
                                     helpText=PLocalizer.SkillButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleLevels'],
                                     pos=(0.01, 0, buttonPosZ),
                                     **buttonOptions)
        self.buttons['guiMgrToggleLevels'] = self.levelButton
        buttonPosZ -= buttonHeight
        if self.WantClothingPage:
            buttonOptions['geom'] = gui.find('**/topgui_icon_clothing')
            buttonOptions['geom_scale'] = 0.17
            self.clothingButton = GuiButton(
                parent=self.buttonsParent,
                helpText=PLocalizer.ClothingButtonHelp,
                helpPos=helpPos,
                helpDelay=helpDelay,
                extraArgs=['guiMgrToggleClothing'],
                pos=(0.01, 0, buttonPosZ),
                **buttonOptions)
            self.buttons['guiMgrToggleClothing'] = self.clothingButton
            buttonPosZ -= buttonHeight
        if self.WantTitlesPage:
            buttonOptions['geom'] = gui.find('**/topgui_infamy_frame')
            buttonOptions['geom_scale'] = 0.2
            self.titlesButton = GuiButton(parent=self.buttonsParent,
                                          hotkeys=['b', 'shift-b'],
                                          hotkeyLabel='B',
                                          helpText=PLocalizer.TitlesButtonHelp,
                                          helpPos=helpPos,
                                          helpDelay=helpDelay,
                                          extraArgs=['guiMgrToggleTitles'],
                                          pos=(0.01, 0, buttonPosZ),
                                          **buttonOptions)
            self.buttons['guiMgrToggleTitles'] = self.titlesButton
            buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_ship')
        buttonOptions['geom_scale'] = 0.2
        self.shipsButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['h', 'shift-h'],
                                     hotkeyLabel='H',
                                     helpText=PLocalizer.ShipsButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleShips'],
                                     pos=(0.01, 0, buttonPosZ),
                                     **buttonOptions)
        self.buttons['guiMgrToggleShips'] = self.shipsButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_journal')
        buttonOptions['geom_scale'] = 0.18
        self.questButton = GuiButton(parent=self.buttonsParent,
                                     hotkeys=['j', 'shift-j'],
                                     hotkeyLabel='J',
                                     helpText=PLocalizer.QuestButtonHelp,
                                     helpPos=helpPos,
                                     helpDelay=helpDelay,
                                     extraArgs=['guiMgrToggleQuest'],
                                     pos=(0.01, 0, buttonPosZ),
                                     **buttonOptions)
        self.buttons['guiMgrToggleQuest'] = self.questButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonNormal = gui.find('**/telescope_button')
        self.lookoutButtonLight = gui.find('**/telescope_button_over')
        self.lookoutButtonSearch3o = gui.find('**/lookout_icon_over_03')
        buttonOptions['geom'] = None
        self.lookoutButton = GuiButton(parent=self.buttonsParent,
                                       hotkeys=['l', 'shift-l'],
                                       hotkeyLabel='L',
                                       helpText=PLocalizer.LookoutButtonHelp,
                                       helpPos=helpPos,
                                       helpDelay=helpDelay,
                                       extraArgs=['guiMgrToggleLookout'],
                                       pos=(0.01, 0, buttonPosZ),
                                       **buttonOptions)
        self.buttons['guiMgrToggleLookout'] = self.lookoutButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonImage = OnscreenImage(
            parent=self.stickyButtonsParent,
            image=self.lookoutButtonLight,
            scale=0.3,
            pos=(0.065, 0.0, 0.215))
        self.lookoutButtonImage.sourceImage = self.lookoutButtonLight
        buttonOptions['geom'] = gui.find('**/topgui_icon_main_menu')
        buttonOptions['geom_scale'] = 0.18
        self.mainMenuButton = GuiButton(
            parent=self.buttonsParent,
            hotkeys=[PiratesGlobals.OptionsHotkey, 'escape'],
            hotkeyLabel='F7',
            helpText=PLocalizer.QuestButtonHelp,
            helpPos=helpPos,
            helpDelay=helpDelay,
            extraArgs=['guiMgrToggleMainMenu'],
            pos=(0.01, 0, buttonPosZ),
            **buttonOptions)
        self.buttons['guiMgrToggleMainMenu'] = self.mainMenuButton
        buttonPosZ -= buttonHeight
        self.chestButtonClosed = (gui.find('**/treasure_chest_closed'),
                                  gui.find('**/treasure_chest_closed'),
                                  gui.find('**/treasure_chest_closed_over'))
        self.chestButtonOpen = gui.find('**/treasure_chest_open_over')
        self.chestButton = GuiButton(command=self.toggle,
                                     parent=self,
                                     relief=None,
                                     image=self.chestButtonClosed,
                                     image_scale=0.15,
                                     image_pos=(0.05, 0, 0.06),
                                     scale=1.2)
        self.chestHotkeyText = DirectLabel(
            parent=self.chestButton,
            relief=None,
            text='Tab',
            text_align=TextNode.ARight,
            text_scale=PiratesGuiGlobals.TextScaleSmall,
            text_pos=(0.11, 0.0),
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            text_font=PiratesGlobals.getPirateBoldOutlineFont(),
            textMayChange=1)
        self.buttonsParent.hide()
        self.buttonsParent.setPos(0.2, 0, 0.14)
        self.stickyButtonsParent.hide()
        self.stickyButtonsParent.setPos(0.2, 0, 0.14)
        gui.removeNode()
        return

    def destroy(self):
        self.showButtonsIval.pause()
        del self.showButtonsIval
        self.hideButtonsIval.pause()
        del self.hideButtonsIval
        self.buttonsParent.removeNode()
        del self.buttonsParent
        self.stickyButtonsParent.removeNode()
        del self.stickyButtonsParent
        for button in self.buttons:
            self.buttons[button].destroy()
            self.buttons[button] = None

        del self.buttons
        self.bagButton = None
        self.radarButton = None
        self.lookoutButton = None
        self.mapButton = None
        self.shipsButton = None
        self.titlesButton = None
        self.mainMenuButton = None
        self.socialButton = None
        self.levelButton = None
        self.chestButton = None
        self.questButton = None
        self.weaponButton = None
        loader.unloadSfx(self.openSfx)
        loader.unloadSfx(self.closeSfx)
        del self.openSfx
        del self.closeSfx
        GuiTray.GuiTray.destroy(self)
        return

    def highlightButton(self, button):
        def changeButtonImage(button, image):
            button['image'] = image
            button['image0_color'] = self.buttonColors[0]
            button['image1_color'] = self.buttonColors[1]
            button['image2_color'] = self.buttonColors[2]
            button['image3_color'] = self.buttonColors[3]

        if self.currentButtonIn:
            changeButtonImage(self.buttons[self.currentButtonIn],
                              self.buttonImage)
        self.currentButtonIn = button
        changeButtonImage(self.buttons[self.currentButtonIn],
                          self.buttonImageIn)

    def togglePanel(self, message, args=None):
        if localAvatar.getInventory() == None:
            return
        if message in self.highlightButtons:
            self.highlightButton(message)
        messenger.send(message, [args])
        return

    def toggle(self):
        if not self.isHidden():
            messenger.send(PiratesGlobals.SeaChestHotkey)
            if localAvatar.guiMgr.questPage:
                chestPanel = localAvatar.guiMgr.chestPanel
                if chestPanel.currPageIndex:
                    currPage = chestPanel.pages[chestPanel.currPageIndex]

    def isOpen(self):
        return self.state

    def showButtons(self):
        if self.hideButtonsIval.isPlaying():
            self.hideButtonsIval.finish()
        self.showButtonsIval.start()

    def hideButtons(self):
        if self.showButtonsIval.isPlaying():
            self.showButtonsIval.finish()
        for button in self.buttons:
            self.buttons[button].hideDetails()

        self.hideButtonsIval.start()

    def slideOpen(self):
        if not self.state:
            self.openSfx.play()
        self.state = 1
        self.chestButton['image'] = self.chestButtonOpen
        self.showButtons()
        if localAvatar.guiMgr.questPage:
            chestPanel = localAvatar.guiMgr.chestPanel
            if chestPanel.currPageIndex:
                currPage = chestPanel.pages[chestPanel.currPageIndex]

    def slideClose(self):
        if self.state:
            self.closeSfx.play()
        self.state = 0
        self.chestButton['image'] = self.chestButtonClosed
        self.hideButtons()

    def buildShowHideButtonsIvals(self, includeSticky=True):
        showSequence = Sequence(Func(self.buttonsParent.show))
        showParallel = Parallel(
            LerpPosInterval(self.buttonsParent,
                            0.2,
                            pos=Point3(0, 0, 0.14),
                            startPos=self.buttonsParent.getPos,
                            blendType='easeOut'))
        if includeSticky:
            showSequence.append(Func(self.stickyButtonsParent.show))
            showParallel.append(
                LerpPosInterval(self.stickyButtonsParent,
                                0.2,
                                pos=Point3(0, 0, 0.14),
                                startPos=self.stickyButtonsParent.getPos,
                                blendType='easeOut'))
        showSequence.append(showParallel)
        self.showButtonsIval = showSequence
        hideParallel = Parallel(
            LerpPosInterval(self.buttonsParent,
                            0.2,
                            pos=Point3(0.2, 0, 0.14),
                            startPos=self.buttonsParent.getPos,
                            blendType='easeIn'))
        hideSequence = Sequence(hideParallel, Func(self.buttonsParent.hide))
        if includeSticky:
            hideSequence.append(Func(self.stickyButtonsParent.hide))
            hideParallel.append(
                LerpPosInterval(self.stickyButtonsParent,
                                0.2,
                                pos=Point3(0.2, 0, 0.14),
                                startPos=self.stickyButtonsParent.getPos,
                                blendType='easeIn'))
        hideSequence.append(hideParallel)
        self.hideButtonsIval = hideSequence

    def hideChestButton(self):
        self.chestButton.hide()

    def showChestButton(self):
        self.chestButton.show()
    def __init__(self, table):
        DirectFrame.__init__(self, relief = None)
        self.initialiseoptions(BlackjackTableGUI)
        self.table = table
        self.destroyed = False
        self.maxHandCards = 14
        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = BlackjackStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)
        
        self.localStatusPanel = self.playerStatusPanels[self.LocalAvatarGuiIndex]
        width = 1.0
        height = 0.25
        self.menu = BorderFrame(parent = base.a2dBottomCenter, frameSize = (-width / 2.0, width / 2.0, 0, height), pos = (0, 0, 0))
        self.width = width
        self.height = height
        self.initializeTableInterface()
        x = -0.35999999999999999
        y = 0.17749999999999999
        x_increment = 0.23999999999999999
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.23999999999999999)
        text = PLocalizer.BlackjackCardSwap
        button = GuiButton(parent = self.menu, command = self.playerAction, helpText = helpText, helpPos = helpPos, pos = (x, 0, y), canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.CardSwap])
        button.show()
        self.cardSwapButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackDoubleDown
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.DoubleDown])
        button.show()
        self.doubleDownButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackStay
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Stay])
        button.show()
        self.stayButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        text = PLocalizer.BlackjackHit
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Hit])
        button.show()
        self.hitButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        x = -0.35999999999999999
        y = 0.070000000000000007
        x_increment = 0.23999999999999999
        x += x_increment
        x += x_increment
        text = PLocalizer.BlackjackSplit
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Split])
        button.show()
        self.splitButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        bid = self.table.getTableBidAmount()
        text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
        button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
        self.setButtonSettings(button, (x, 0, y), text, [
            PlayingCardGlobals.Bid])
        button.show()
        self.bidButton = button
        self.buttonArray = self.buttonArray + [
            button]
        x += x_increment
        
        def bid_update_function(value):
            bid = self.sliderValueToBid(value)
            text = PLocalizer.BlackjackBid + ' ' + bid.__repr__()
            self.bidButton['text'] = text
            self.bidAmount = bid

        self.bidAmount = 2
        default_value = 0.0
        x = 0.0
        y = -0.25
        label = PLocalizer.BlackjackBid
        resolution = 1.0
        self.bidSlider = self.create_slider(bid_update_function, default_value, x, y, resolution, label, self.menu)
        x = -0.35999999999999999
        y = 0.17749999999999999
        x_increment = 0.23999999999999999
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent = self.menu, command = self.cardSwapButtonSelection, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.Cheat1])
        self.cheat1Button = button
        self.buttonArray = self.buttonArray + [
            button]
        x = x + x_increment
        text = PLocalizer.PokerCheat2
        button = GuiButton(parent = self.menu, command = self.cardSwapButtonSelection, canReposition = True)
        self.setButtonSettings2Lines(button, (x, 0, y), text, [
            PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [
            button]
        x = x + x_increment
        self.hideCheatButtons()
        self.disableAllPlayButtons()
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32000000000000001
        currentMoney = localAvatar.getInventory().getGoldInPocket()
        self.moneyDisplay = DirectLabel(parent = self.menu, relief = None, pos = (-0.29999999999999999 + x_increment / 2.0, 0, 0.074999999999999997), geom = goldCoin, geom_scale = (scale, scale, scale), geom_pos = (0, 0, 0), text = '%s' % currentMoney, text_align = TextNode.ALeft, text_scale = 0.035000000000000003, text_pos = (0.044999999999999998, -0.01), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, scale = 1.1000000000000001)
        self.accept(InventoryGlobals.getCategoryQuantChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.setMoney)
        this = self
        identifier = 0
        this.sfxArray = []
        this.hitIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_HIT)]
        identifier = identifier + 1
        self.hands = []
        self.splitCardsArray = []
        self.canSplit = False
        self.canDoubleDown = False
        self.bid = False
class AmmoSkillButton(SkillButton.SkillButton):
    
    def __init__(self, skillId, slotId, callback, quantity = 0, skillRank = 0, showQuantity = False, showHelp = False, showRing = False, hotkey = None, name = '', showIcon = True, showLock = False, rechargeSkillId = False, assocAmmo = []):
        if skillId in [
            InventoryType.DefenseCannonRoundShot,
            InventoryType.DefenseCannonEmpty]:
            showQuantity = False
        
        if not Freebooter.getPaidStatus(base.localAvatar.doId) and slotId >= CannonDefenseGlobals.FREEBOOTER_MAX_AMMO_SLOTS:
            showLock = True
        
        SkillButton.SkillButton.__init__(self, skillId, callback, quantity, skillRank, showQuantity, showHelp, showRing, hotkey, name, showIcon, showLock, rechargeSkillId, assocAmmo)
        self.toggleFrame['image_scale'] = 0.55000000000000004
        self.toolTipBox = None
        self.slotId = slotId
        self._initButtons()
        self.updateSkillId(skillId)

    
    def _initButtons(self):
        self.sellButtonModel = loader.loadModel('models/gui/pir_m_gui_can_buttonSell')
        self.sellButton = GuiButton(parent = self, image = (self.sellButtonModel.find('**/idle'), self.sellButtonModel.find('**/idle'), self.sellButtonModel.find('**/over')), image_scale = 1, scale = 0.40000000000000002, sortOrder = 100, pos = (0, 0, -0.125), command = self.onSellClick)
        self.sellButton.bind(DGG.ENTER, self.showToolTip)
        self.sellButton.bind(DGG.EXIT, self.hideToolTip)

    
    def updateSkillId(self, skillId):
        SkillButton.SkillButton.updateSkillId(self, skillId)
        if not hasattr(self, 'sellButton'):
            return None
        
        if skillId == InventoryType.DefenseCannonEmpty:
            self.sellButton['state'] = DGG.DISABLED
            self.sellButton.hide()
            if skillId == InventoryType.DefenseCannonEmpty:
                self.setShowIcon(False)
            
        else:
            self.sellButton['state'] = DGG.NORMAL
            self.sellButton.show()
            self.setShowIcon(True)

    
    def createToolTip(self):
        if self.toolTipBox:
            return None
        
        self.label = DirectLabel(parent = None, relief = None, text = PLocalizer.SellButton, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG2, text_wordwrap = 12)
        height = -self.label.getHeight()
        width = self.label.getWidth()
        toolTipScale = 2.5
        self.toolTipBox = None
        self.toolTipBox = BorderFrame(parent = self.sellButton, frameSize = (-0.01, width, height, 0.050000000000000003), scale = toolTipScale, pos = (-(width * toolTipScale * 0.5), 0, height * toolTipScale * 2.25), state = DGG.DISABLED)
        self.label.reparentTo(self.toolTipBox)

    
    def showToolTip(self, event):
        self.createToolTip()

    
    def hideToolTip(self, event):
        if self.toolTipBox:
            self.toolTipBox.destroy()
            self.toolTipBox = None
        

    
    def onSellClick(self):
        messenger.send('onSellClick', [
            self.skillId])
 def initializeTableInterface(self):
     self.levelUpIval = None
     self.swapCard = False
     self.cardSwapIndex = 0
     self.swapDialog = None
     self.leaveDialog = None
     self.swapResultDialog = None
     self.timer = False
     self.timeout = False
     self.buttonArray = []
     self.suitGeomArray = []
     if not True:
         self.suitGeomArray.append(self.suitImage(0))
         self.suitGeomArray.append(self.suitImage(1))
         self.suitGeomArray.append(self.suitImage(2))
         self.suitGeomArray.append(self.suitImage(3))
     else:
         self.suitIcons = loader.loadModel('models/gui/suit_icons')
         if self.suitIcons:
             scale = 0.080000000000000002
             icon = self.suitIcons.find('**/suit_icon_h')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_d')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_c')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
             icon = self.suitIcons.find('**/suit_icon_s')
             icon.setScale(scale)
             self.suitGeomArray.append(icon)
         else:
             self.suitGeomArray = [
                 None,
                 None,
                 None,
                 None]
     x = -0.35999999999999999
     y = 0.070000000000000007
     x_increment = 0.23999999999999999
     text = PLocalizer.TableLeave
     button = GuiButton(parent = self.menu, command = self.leaveAction, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         PlayingCardGlobals.Leave])
     self.leaveButton = button
     self.buttonArray = self.buttonArray + [
         button]
     button.show()
     text = PLocalizer.TableCancel
     button = GuiButton(parent = self.menu, command = self.cancelSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         0])
     self.cancelButton = button
     self.buttonArray = self.buttonArray + [
         button]
     button.hide()
     x = x + x_increment
     self.suit = 0
     self.rank = 0
     self.cardSwapIndex = 0
     self.suitButtonArray = []
     self.rankButtonArray = []
     x = -0.35999999999999999
     y = 0.17749999999999999
     x_increment = 0.23999999999999999
     suit = 0
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     text = PLocalizer.PlayingCardSuits[suit]
     button = GuiButton(parent = self.menu, command = self.cardSuitSelection, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         suit])
     self.suitButtonArray = self.suitButtonArray + [
         button]
     geom = self.suitGeomArray[suit]
     button['geom'] = geom
     button.setGeom()
     x = x + x_increment
     suit = suit + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.17749999999999999
     x_increment = 0.12
     rank = 0
     text = PLocalizer.Card2
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card3
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card4
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card5
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card6
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card7
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card8
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.Card9
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     x = -0.35999999999999999 - 0.059999999999999998
     y = 0.070000000000000007
     x_increment = 0.12
     x = x + x_increment
     x = x + x_increment
     x = x + x_increment
     text = PLocalizer.CardT
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardJ
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardQ
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardK
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
     text = PLocalizer.CardA
     button = GuiButton(parent = self.menu, command = self.cardRankSelection, canReposition = True)
     self.setButtonSettingsHalfWidth(button, (x, 0, y), text, [
         rank])
     self.rankButtonArray = self.rankButtonArray + [
         button]
     x = x + x_increment
     rank = rank + 1
Пример #9
0
class ChestTray(GuiTray.GuiTray):
    WantClothingPage = base.config.GetBool('want-clothing-page', 0)
    if not base.config.GetBool('want-land-infamy', 0):
        pass
    WantTitlesPage = base.config.GetBool('want-sea-infamy', 0)
    
    def __init__(self, parent, parentMgr, pos = None, sortOrder = 0):
        GuiTray.GuiTray.__init__(self, parent, 0.59999999999999998, 0.12)
        self.initialiseoptions(ChestTray)
        self.setBin('gui-fixed', 0)
        self.state = 0
        self.buttonsParent = self.attachNewNode(PandaNode('ChestTray.buttonsParent'), sortOrder)
        self.stickyButtonsParent = self.attachNewNode(PandaNode('ChestTray.stickyButtonsParent'), sortOrder)
        self.stickyButtonsParent.setPos(0, 0, 0.02)
        self.buttons = { }
        self.buildShowHideButtonsIvals()
        self.openSfx = loadSfx(SoundGlobals.SFX_GUI_OPEN_SEACHEST)
        self.openSfx.setVolume(0.40000000000000002)
        self.closeSfx = loadSfx(SoundGlobals.SFX_GUI_CLOSE_SEACHEST)
        self.closeSfx.setVolume(0.40000000000000002)
        gui = loader.loadModel('models/gui/toplevel_gui')
        gui_main = loader.loadModel('models/gui/gui_main')
        helpPos = (-0.26000000000000001, 0, 0.059999999999999998)
        helpDelay = 0
        self.buttonImage = gui.find('**/topgui_icon_box')
        self.buttonImageIn = gui.find('**/topgui_icon_box_in')
        self.buttonColors = (VBase4(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1), VBase4(0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), VBase4(1.0, 1.0, 1.0, 1), VBase4(0.59999999999999998, 0.59999999999999998, 0.59999999999999998, 1))
        self.currentButtonIn = None
        self.highlightButtons = [
            'guiMgrToggleMap',
            'guiMgrToggleWeapons',
            'guiMgrToggleQuest',
            'guiMgrToggleLevels',
            'guiMgrToggleShips',
            'guiMgrToggleTreasures',
            'guiMgrToggleLookout',
            'guiMgrToggleInventory',
            'guiMgrToggleTitles']
        buttonOptions = {
            'image': self.buttonImage,
            'geom': None,
            'relief': None,
            'frameSize': (0, 0.12, 0, 0.12),
            'image_scale': 0.46999999999999997,
            'image_pos': (0.059999999999999998, 0, 0.059999999999999998),
            'image0_color': self.buttonColors[0],
            'image1_color': self.buttonColors[1],
            'image2_color': self.buttonColors[2],
            'image3_color': self.buttonColors[3],
            'geom_scale': 0.12,
            'geom_pos': (0.059999999999999998, 0, 0.059999999999999998),
            'command': self.togglePanel }
        extraHeight = 0
        if self.WantTitlesPage:
            extraHeight = 0.12
        
        buttonOptions['geom'] = gui.find('**/friend_button_over')
        buttonOptions['geom_scale'] = 0.12
        self.socialButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'f',
            'shift-f'], hotkeyLabel = 'F', helpText = PLocalizer.SocialButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleSocial'], pos = (0.01, 0, 1.1599999999999999 + extraHeight))
        self.buttons['guiMgrToggleSocial'] = self.socialButton
        buttonOptions['geom'] = gui.find('**/compass_small_button_open_over')
        buttonOptions['geom_scale'] = 0.089999999999999997
        self.radarButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'c',
            'shift-c'], hotkeyLabel = 'C', helpText = PLocalizer.RadarButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleRadar'], pos = (0.01, 0, 1.04 + extraHeight))
        self.buttons['guiMgrToggleRadar'] = self.radarButton
        buttonPosZ = 0.88
        buttonHeight = 0.12
        if self.WantTitlesPage:
            buttonPosZ += buttonHeight
        
        buttonOptions['geom'] = gui_main.find('**/world_map_icon')
        buttonOptions['geom_scale'] = 0.095000000000000001
        self.mapButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'm',
            'shift-m'], hotkeyLabel = 'M', helpText = PLocalizer.MapButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleMap'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleMap'] = self.mapButton
        buttonPosZ -= buttonHeight
        self.highlightButton('guiMgrToggleMap')
        buttonOptions['geom'] = (gui.find('**/treasure_chest_closed_over'),)
        buttonOptions['geom_scale'] = 0.12
        self.bagButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'i',
            'shift-i'], hotkeyLabel = 'I', helpText = PLocalizer.SocialButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleInventory'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleInventory'] = self.bagButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_weapons')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.weaponButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'y',
            'shift-y'], hotkeyLabel = 'Y', helpText = PLocalizer.WeaponButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleWeapons'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleWeapons'] = self.weaponButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_skills')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.levelButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'k',
            'shift-k'], hotkeyLabel = 'K', helpText = PLocalizer.SkillButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleLevels'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleLevels'] = self.levelButton
        buttonPosZ -= buttonHeight
        if self.WantClothingPage:
            buttonOptions['geom'] = gui.find('**/topgui_icon_clothing')
            buttonOptions['geom_scale'] = 0.17000000000000001
            self.clothingButton = GuiButton(parent = self.buttonsParent, helpText = PLocalizer.ClothingButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
                'guiMgrToggleClothing'], pos = (0.01, 0, buttonPosZ))
            self.buttons['guiMgrToggleClothing'] = self.clothingButton
            buttonPosZ -= buttonHeight
        
        if self.WantTitlesPage:
            buttonOptions['geom'] = gui.find('**/topgui_infamy_frame')
            buttonOptions['geom_scale'] = 0.20000000000000001
            self.titlesButton = GuiButton(parent = self.buttonsParent, hotkeys = [
                'b',
                'shift-b'], hotkeyLabel = 'B', helpText = PLocalizer.TitlesButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
                'guiMgrToggleTitles'], pos = (0.01, 0, buttonPosZ))
            self.buttons['guiMgrToggleTitles'] = self.titlesButton
            buttonPosZ -= buttonHeight
        
        buttonOptions['geom'] = gui.find('**/topgui_icon_ship')
        buttonOptions['geom_scale'] = 0.20000000000000001
        self.shipsButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'h',
            'shift-h'], hotkeyLabel = 'H', helpText = PLocalizer.ShipsButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleShips'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleShips'] = self.shipsButton
        buttonPosZ -= buttonHeight
        buttonOptions['geom'] = gui.find('**/topgui_icon_journal')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.questButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'j',
            'shift-j'], hotkeyLabel = 'J', helpText = PLocalizer.QuestButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleQuest'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleQuest'] = self.questButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonNormal = gui.find('**/telescope_button')
        self.lookoutButtonLight = gui.find('**/telescope_button_over')
        self.lookoutButtonSearch3o = gui.find('**/lookout_icon_over_03')
        buttonOptions['geom'] = None
        self.lookoutButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            'l',
            'shift-l'], hotkeyLabel = 'L', helpText = PLocalizer.LookoutButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleLookout'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleLookout'] = self.lookoutButton
        buttonPosZ -= buttonHeight
        self.lookoutButtonImage = OnscreenImage(parent = self.stickyButtonsParent, image = self.lookoutButtonLight, scale = 0.29999999999999999, pos = (0.065000000000000002, 0.0, 0.215))
        self.lookoutButtonImage.sourceImage = self.lookoutButtonLight
        buttonOptions['geom'] = gui.find('**/topgui_icon_main_menu')
        buttonOptions['geom_scale'] = 0.17999999999999999
        self.mainMenuButton = GuiButton(parent = self.buttonsParent, hotkeys = [
            PiratesGlobals.OptionsHotkey,
            'escape'], hotkeyLabel = 'F7', helpText = PLocalizer.QuestButtonHelp, helpPos = helpPos, helpDelay = helpDelay, extraArgs = [
            'guiMgrToggleMainMenu'], pos = (0.01, 0, buttonPosZ))
        self.buttons['guiMgrToggleMainMenu'] = self.mainMenuButton
        buttonPosZ -= buttonHeight
        self.chestButtonClosed = (gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed'), gui.find('**/treasure_chest_closed_over'))
        self.chestButtonOpen = gui.find('**/treasure_chest_open_over')
        self.chestButton = GuiButton(command = self.toggle, parent = self, relief = None, image = self.chestButtonClosed, image_scale = 0.14999999999999999, image_pos = (0.050000000000000003, 0, 0.059999999999999998), scale = 1.2)
        self.chestHotkeyText = DirectLabel(parent = self.chestButton, relief = None, text = 'Tab', text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleSmall, text_pos = (0.11, 0.0), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getPirateBoldOutlineFont(), textMayChange = 1)
        self.buttonsParent.hide()
        self.buttonsParent.setPos(0.20000000000000001, 0, 0.14000000000000001)
        self.stickyButtonsParent.hide()
        self.stickyButtonsParent.setPos(0.20000000000000001, 0, 0.14000000000000001)
        gui.removeNode()

    
    def destroy(self):
        self.showButtonsIval.pause()
        del self.showButtonsIval
        self.hideButtonsIval.pause()
        del self.hideButtonsIval
        self.buttonsParent.removeNode()
        del self.buttonsParent
        self.stickyButtonsParent.removeNode()
        del self.stickyButtonsParent
        for button in self.buttons:
            self.buttons[button].destroy()
            self.buttons[button] = None
        
        del self.buttons
        self.bagButton = None
        self.radarButton = None
        self.lookoutButton = None
        self.mapButton = None
        self.shipsButton = None
        self.titlesButton = None
        self.mainMenuButton = None
        self.socialButton = None
        self.levelButton = None
        self.chestButton = None
        self.questButton = None
        self.weaponButton = None
        loader.unloadSfx(self.openSfx)
        loader.unloadSfx(self.closeSfx)
        del self.openSfx
        del self.closeSfx
        GuiTray.GuiTray.destroy(self)

    
    def highlightButton(self, button):
        
        def changeButtonImage(button, image):
            button['image'] = image
            button['image0_color'] = self.buttonColors[0]
            button['image1_color'] = self.buttonColors[1]
            button['image2_color'] = self.buttonColors[2]
            button['image3_color'] = self.buttonColors[3]

        if self.currentButtonIn:
            changeButtonImage(self.buttons[self.currentButtonIn], self.buttonImage)
        
        self.currentButtonIn = button
        changeButtonImage(self.buttons[self.currentButtonIn], self.buttonImageIn)

    
    def togglePanel(self, message, args = None):
        if localAvatar.getInventory() == None:
            return None
        
        if message in self.highlightButtons:
            self.highlightButton(message)
        
        messenger.send(message, [
            args])

    
    def toggle(self):
        if not self.isHidden():
            messenger.send(PiratesGlobals.SeaChestHotkey)
            if localAvatar.guiMgr.questPage:
                chestPanel = localAvatar.guiMgr.chestPanel
                if chestPanel.currPageIndex:
                    currPage = chestPanel.pages[chestPanel.currPageIndex]
                
            
        

    
    def isOpen(self):
        return self.state

    
    def showButtons(self):
        if self.hideButtonsIval.isPlaying():
            self.hideButtonsIval.finish()
        
        self.showButtonsIval.start()

    
    def hideButtons(self):
        if self.showButtonsIval.isPlaying():
            self.showButtonsIval.finish()
        
        for button in self.buttons:
            self.buttons[button].hideDetails()
        
        self.hideButtonsIval.start()

    
    def slideOpen(self):
        if not self.state:
            self.openSfx.play()
        
        self.state = 1
        self.chestButton['image'] = self.chestButtonOpen
        self.showButtons()
        if localAvatar.guiMgr.questPage:
            chestPanel = localAvatar.guiMgr.chestPanel
            if chestPanel.currPageIndex:
                currPage = chestPanel.pages[chestPanel.currPageIndex]
            
        

    
    def slideClose(self):
        if self.state:
            self.closeSfx.play()
        
        self.state = 0
        self.chestButton['image'] = self.chestButtonClosed
        self.hideButtons()

    
    def buildShowHideButtonsIvals(self, includeSticky = True):
        showSequence = Sequence(Func(self.buttonsParent.show))
        showParallel = Parallel(LerpPosInterval(self.buttonsParent, 0.20000000000000001, pos = Point3(0, 0, 0.14000000000000001), startPos = self.buttonsParent.getPos, blendType = 'easeOut'))
        if includeSticky:
            showSequence.append(Func(self.stickyButtonsParent.show))
            showParallel.append(LerpPosInterval(self.stickyButtonsParent, 0.20000000000000001, pos = Point3(0, 0, 0.14000000000000001), startPos = self.stickyButtonsParent.getPos, blendType = 'easeOut'))
        
        showSequence.append(showParallel)
        self.showButtonsIval = showSequence
        hideParallel = Parallel(LerpPosInterval(self.buttonsParent, 0.20000000000000001, pos = Point3(0.20000000000000001, 0, 0.14000000000000001), startPos = self.buttonsParent.getPos, blendType = 'easeIn'))
        hideSequence = Sequence(hideParallel, Func(self.buttonsParent.hide))
        if includeSticky:
            hideSequence.append(Func(self.stickyButtonsParent.hide))
            hideParallel.append(LerpPosInterval(self.stickyButtonsParent, 0.20000000000000001, pos = Point3(0.20000000000000001, 0, 0.14000000000000001), startPos = self.stickyButtonsParent.getPos, blendType = 'easeIn'))
        
        hideSequence.append(hideParallel)
        self.hideButtonsIval = hideSequence

    
    def hideChestButton(self):
        self.chestButton.hide()

    
    def showChestButton(self):
        self.chestButton.show()
class MinimapShop(MinimapObject):
    SORT = 2
    SIGN_DICT = {
        'blacksmith': '**/shopCoin_blacksmith',
        'shipwright': '**/shopCoin_shipwright',
        'gunsmith': '**/shopCoin_gunsmith',
        'weapons': '**/shopCoin_gunsmith',
        'tailor': '**/shopCoin_tailor',
        'barber': '**/shopCoin_barber',
        'jeweler': '**/shopCoin_jeweler',
        'tattoo': '**/shopCoin_tattoo',
        'voodoo': '**/shopCoin_voodoo',
        'gypsy': '**/shopCoin_voodoo',
        'tavern': '**/shopCoin_tavern',
        'fishmaster': '**/shopCoin_fishing',
        'cannonmaster': '**/shopCoin_cannon',
        'stowaway': '**/shopCoin_stowaway',
        'catalogrep': '**/shopCoin_catalog' }
    SIGNS = { }
    HELP_DICT = {
        'blacksmith': PLocalizer.ShopBlacksmith,
        'shipwright': PLocalizer.ShopShipwright,
        'gunsmith': PLocalizer.ShopGunsmith,
        'weapons': PLocalizer.ShopGunsmith,
        'tailor': PLocalizer.ShopTailor,
        'barber': PLocalizer.ShopBarber,
        'jeweler': PLocalizer.ShopJewelry,
        'tattoo': PLocalizer.ShopTattoo,
        'voodoo': PLocalizer.ShopGypsy,
        'gypsy': PLocalizer.ShopGypsy,
        'tavern': PLocalizer.ShopTavern,
        'fishmaster': PLocalizer.ShopFishmaster,
        'cannonmaster': PLocalizer.ShopCannoneer,
        'stowaway': PLocalizer.ShopStowaway,
        'catalogrep': PLocalizer.ShopCatalogRep }
    
    def loadSigns(cls):
        if not MinimapShop.SIGNS:
            coins = loader.loadModel('models/textureCards/shopCoins')
            for coin in coins.findAllMatches('**/shopCoin_*'):
                coin.setP(-90)
                coin.flattenStrong()
            
            for (pattern, signName) in MinimapShop.SIGN_DICT.iteritems():
                MinimapShop.SIGNS[pattern] = coins.find(signName)
            
        

    loadSigns = classmethod(loadSigns)
    
    def getShopType(cls, shopString):
        for pattern in MinimapShop.SIGN_DICT:
            if pattern in shopString:
                return pattern
                continue
        

    getShopType = classmethod(getShopType)
    
    def __init__(self, uid, worldNode, shopType):
        self.loadSigns()
        worldNode.setHpr(0, 0, 0)
        MinimapObject.__init__(self, uid, worldNode, MinimapShop.SIGNS[shopType])
        self.shopType = shopType
        self.button = None

    
    def _addedToMap(self, map):
        self.mapGeom.setScale(aspect2d, 0.059999999999999998)
        overlayNode = map.getOverlayNode()
        transform = self.mapGeom.getTransform(overlayNode)
        self.button = GuiButton(parent = overlayNode, state = DGG.NORMAL, image = self.mapGeom, pos = transform.getPos(), image_hpr = transform.getHpr(), image_scale = transform.getScale(), helpText = MinimapShop.HELP_DICT[self.shopType], helpPos = (-0.27000000000000002, 0, 0.070000000000000007), helpDelay = 0, helpOpaque = True, sortOrder = MinimapShop.SORT)
        self.button.setAlphaScale(1, 1)
        self.mapGeom.detachNode()

    
    def _removedFromMap(self, map):
        if self.button:
            self.button.destroy()
            self.button = None
        

    
    def _updateOnMap(self, map):
        MinimapObject._updateOnMap(self, map)
        if self.button:
            if base.localAvatar.guiMgr.invasionScoreboard or base.localAvatar.isInInvasion():
                self.button.hide()
            else:
                self.button.show()