def handleNewHeldItem(self, itemTuple, canUse):
     if itemTuple != None:
         itemCat = itemTuple[0]
         itemId = itemTuple[1]
         itemRanges = InventoryGlobals.getEquipRanges(itemCat, itemId)
         if not itemRanges:
             return None
         
         itemUseSlots = InventoryGlobals.expandRanges(itemRanges)
         for cell in self.cellList:
             if cell.slotId and cell.slotId in itemUseSlots:
                 cell.container.markCell(cell, MASK_ISDEST)
                 cell.container.unmarkCell(cell, MASK_NOTDEST)
                 if not canUse:
                     cell.container.markCell(cell, MASK_NOTMEETREQUIREMENTS)
                 
             cell.container.markCell(cell, MASK_NOTDEST)
             cell.container.unmarkCell(cell, MASK_ISDEST)
         
     else:
         for cell in self.cellList:
             cell.container.unmarkCell(cell, MASK_NOTDEST)
             cell.container.unmarkCell(cell, MASK_ISDEST)
             cell.container.unmarkCell(cell, MASK_NOTMEETREQUIREMENTS)
             self.checkReqsForCell(cell)
コード例 #2
0
 def stack(self, stackType, quantity):
     self.stacks[stackType] = quantity
     categoryId = InventoryId.getCategory(stackType)
     category = self.stacksInCategory.setdefault(categoryId, { })
     if quantity:
         category[stackType] = quantity
     else:
         category.pop(stackType, None)
     messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, stackType), [
         quantity])
     messenger.send(InventoryGlobals.getAnyChangeMsg(self.doId))
     if stackType == InventoryType.Vitae_Level and stackType == InventoryType.Vitae_Cost or stackType == InventoryType.Vitae_Left:
         localAvatar.guiMgr.gameGui.updateVitae(self.getStackQuantity(InventoryType.Vitae_Level), self.getStackQuantity(InventoryType.Vitae_Cost), self.getStackQuantity(InventoryType.Vitae_Left))
     
     if self.ownerId == localAvatar.getDoId():
         localAvatar.gotSpecialReward(stackType)
コード例 #3
0
 def stack(self, stackType, quantity):
     self.stacks[stackType] = quantity
     categoryId = InventoryId.getCategory(stackType)
     category = self.stacksInCategory.setdefault(categoryId, { })
     if quantity:
         category[stackType] = quantity
     else:
         category.pop(stackType, None)
     messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, stackType), [
         quantity])
     messenger.send(InventoryGlobals.getAnyChangeMsg(self.doId))
     if stackType == InventoryType.Vitae_Level and stackType == InventoryType.Vitae_Cost or stackType == InventoryType.Vitae_Left:
         localAvatar.guiMgr.gameGui.updateVitae(self.getStackQuantity(InventoryType.Vitae_Level), self.getStackQuantity(InventoryType.Vitae_Cost), self.getStackQuantity(InventoryType.Vitae_Left))
     
     if self.ownerId == localAvatar.getDoId():
         localAvatar.gotSpecialReward(stackType)
コード例 #4
0
 def __init__(self):
     DirectFrame.__init__(self, parent = base.a2dTopLeft, relief = None, pos = (1.0, 0, -0.34999999999999998))
     self.initialiseoptions(ClubheartsPortrait)
     portraitGui = loader.loadModel('models/props/portrait_clubhearts')
     detailGui = loader.loadModel('models/gui/gui_card_detail')
     maleItems = [
         ItemGlobals.STRAW_EXPLORER_HAT,
         ItemGlobals.FLAP_LONG_SLEEVE,
         ItemGlobals.F44_DUBLOON_BREECHES]
     femaleItems = [
         ItemGlobals.WOODLAND_TOP,
         ItemGlobals.CANDYBOX_SKIRT,
         ItemGlobals.FOREST_KNEE_BOOTS]
     if localAvatar.getStyle().getGender() == 'm':
         titleName = PLocalizer.NPCNames[NPCIds.BEN_CLUBHEART]
         self.items = maleItems
     else:
         titleName = PLocalizer.NPCNames[NPCIds.SANDIE_CLUBHEART]
         self.items = femaleItems
     panels = self.attachNewNode('panels')
     topPanel = panels.attachNewNode('topPanel')
     detailGui.find('**/top_panel').copyTo(topPanel)
     topPanel.setScale(0.059999999999999998)
     topPanel.reparentTo(self)
     topPanel.setZ(0.080000000000000002)
     middlePanel = panels.attachNewNode('middlePanel')
     detailGui.find('**/middle_panel').copyTo(middlePanel)
     middlePanel.setScale(0.059999999999999998)
     middlePanel.reparentTo(self)
     middlePanel.setZ(0.080000000000000002)
     for i in range(1, 6):
         middlePanel = panels.attachNewNode('middlePanel%s' % i)
         detailGui.find('**/middle_panel').copyTo(middlePanel)
         middlePanel.setScale(0.059999999999999998)
         middlePanel.reparentTo(self)
         middlePanel.setZ(0.080000000000000002 - i * 0.125)
     
     panels.flattenStrong()
     bottomPanel = panels.attachNewNode('bottomPanel')
     detailGui.find('**/bottom_panel').copyTo(bottomPanel)
     bottomPanel.reparentTo(self)
     bottomPanel.setScale(0.059999999999999998)
     bottomPanel.setZ(-0.5)
     self.bg = DirectFrame(parent = self, relief = None, text_scale = PiratesGuiGlobals.TextScaleTitleSmall, text_fg = PiratesGuiGlobals.TextFG26, text_align = TextNode.ACenter, text = titleName, text_pos = (0.0, 0.25), text_shadow = PiratesGuiGlobals.TextShadow, image = portraitGui.find('**/picture'), image_scale = 0.125, image_pos = (0.0, 0.0, -0.080000000000000002))
     portraitGui.removeNode()
     detailGui.removeNode()
     i = 0
     self.checkBoxes = []
     for item in self.items:
         self.checkBoxes.append(self.makeItem(item, i))
         i += 1
     
     self.accept(InventoryGlobals.getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeClothing), self.updateItems)
コード例 #5
0
    def setStacks(self, stackTypesAndQuantities):
        old = self.stacks
        self.stacks = dict(stackTypesAndQuantities)
        stacksInCategory = {}
        for t, q in stackTypesAndQuantities:
            if old.get(t, 0) != q:
                messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, t), [q])
            categoryId = InventoryId.getCategory(t)
            categoryList = stacksInCategory.setdefault(categoryId, {})
            categoryList[t] = self.stacks[t]

        self.stacksInCategory = stacksInCategory
 def postUpdate(self, cell):
     if cell and cell.slotId:
         equipLocation = InventoryGlobals.getClothingTypeBySlot(cell.slotId)
         gui = loader.loadModel('models/gui/gui_icons_weapon')
         if not cell.inventoryItem:
             self.wearItem(cell, equipLocation, remove=1)
             cell.container.markCell(cell, MASK_EMPTYEQUIP)
             cell.container.unmarkCell(cell, MASK_FULLEQUIP)
         else:
             cell.inventoryItem.refreshImageColor()
             self.wearItem(cell, equipLocation)
             cell.container.markCell(cell, MASK_FULLEQUIP)
             cell.container.unmarkCell(cell, MASK_EMPTYEQUIP)
コード例 #7
0
 def postUpdate(self, cell):
     if cell and cell.slotId:
         equipLocation = InventoryGlobals.getClothingTypeBySlot(cell.slotId)
         gui = loader.loadModel('models/gui/gui_icons_weapon')
         if not cell.inventoryItem:
             self.wearItem(cell, equipLocation, remove = 1)
             cell.container.markCell(cell, MASK_EMPTYEQUIP)
             cell.container.unmarkCell(cell, MASK_FULLEQUIP)
         else:
             cell.inventoryItem.refreshImageColor()
             self.wearItem(cell, equipLocation)
             cell.container.markCell(cell, MASK_FULLEQUIP)
             cell.container.unmarkCell(cell, MASK_EMPTYEQUIP)
    def setStacks(self, stackTypesAndQuantities):
        old = self.stacks
        self.stacks = dict(stackTypesAndQuantities)
        stacksInCategory = { }
        for (t, q) in stackTypesAndQuantities:
            if old.get(t, 0) != q:
                messenger.send(InventoryGlobals.getCategoryQuantChangeMsg(self.doId, t), [
                    q])

            categoryId = InventoryId.getCategory(t)
            categoryList = stacksInCategory.setdefault(categoryId, { })
            categoryList[t] = self.stacks[t]

        self.stacksInCategory = stacksInCategory
コード例 #9
0
    def discoverLocatableInventory(self,
                                   weaponBag,
                                   clothingBag=None,
                                   consumableBag=None):
        locatableItems = localAvatar.getInventory().getLocatables()
        misplacedSlots = []
        itemsToTrash = []
        base.localAvatar.lockRegen()
        for itemKey in locatableItems:
            if self.slotToCellMap.has_key(
                    itemKey) and self.slotToCellMap[itemKey]:
                itemTuple = locatableItems[itemKey]
                itemId = itemTuple[1]
                itemCategory = itemTuple[0]
                slotCell = self.slotToCellMap[itemKey]
                uiItem = self.makeLocatableItem(itemTuple)
                if uiItem:
                    self.putIntoCellSlot(itemKey, uiItem)
                    slotCell.container.postUpdate(slotCell)
                    uiItem.refreshImageColor()
                elif self.trashInvalidItems:
                    itemsToTrash.append(itemTuple)

            misplacedSlots.append(itemKey)

        if len(itemsToTrash) > 0:
            print 'trashing invalid items %s' % itemsToTrash
            import pdb
            pdb.set_trace()
            localAvatar.getInventory().trashItems(itemsToTrash)

        base.localAvatar.unlockAndRegen()
        self.discoveredInventory = 1
        messenger.send('Inventory_Discovered', [self])
        self.accept('inventoryLocation-%s' % localAvatar.getInventory().doId,
                    self.handleSlotUpdate)
        self.accept(
            InventoryGlobals.getOverflowChangeMsg(
                localAvatar.getInventory().doId), self.handleOverflow)
        if misplacedSlots:
            messenger.send('overflowChanged', [])
            runningList = []
            for slot in misplacedSlots:
                misplacedItemType = locatableItems[slot][0]
                newSlot = self.findOpenSlotForItemType(misplacedItemType,
                                                       runningList)
                if newSlot:
                    localAvatar.getInventory().swapItems(slot, newSlot)
                    continue
コード例 #10
0
 def postUpdate(self, cell):
     if cell and cell.slotId:
         location = InventoryGlobals.getTattooLocationBySlot(cell.slotId)
         gui = loader.loadModel('models/gui/gui_icons_weapon')
         if not cell.inventoryItem:
             self.wearTattoo(cell, location, remove=1)
             cell.container.markCell(cell, MASK_EMPTYEQUIP)
             cell.container.unmarkCell(cell, MASK_FULLEQUIP)
         else:
             cell.inventoryItem.refreshImageColor()
             self.wearTattoo(cell, location)
             cell.container.markCell(cell, MASK_FULLEQUIP)
             cell.container.unmarkCell(cell, MASK_EMPTYEQUIP)
     avInv = localAvatar.getInventory()
     if avInv and avInv.findAvailableLocation(InventoryType.ItemTypeTattoo) in [Locations.INVALID_LOCATION, Locations.NON_LOCATION]:
         localAvatar.sendRequestContext(InventoryType.InventoryFull)
コード例 #11
0
    def finishShopping(self):
        if self.storePush and self.storeMenuGUI:
            if self.confirmDialog:
                self.confirmDialog.destroy()
                self.confirmDialog = None

            if self.interactGUI:
                self.interactGUI.hide()

            self.storeMenuGUI.show()
            self.storePush = False
            return None

        self.ignore('exitStore')
        self.ignore('makeSale')
        self.ignore('makeShipSale')
        self.ignore('purchaseAccessories')
        self.ignore('requestMusic')
        self.ignore('requestStowaway')
        messenger.send('stoppedShopping')
        self.ignore(
            InventoryGlobals.getCategoryChangeMsg(localAvatar.getInventoryId(),
                                                  InventoryType.ItemTypeMoney))
        if self._DistributedShopKeeper__invRequest:
            DistributedInventoryBase.cancelGetInventory(
                self._DistributedShopKeeper__invRequest)
            self._DistributedShopKeeper__invRequest = None

        if self.storeMenuGUI:
            self.storeMenuGUI.destroy()
            self.storeMenuGUI = None

        if self.pickShipGUI:
            self.pickShipGUI.destroy()
            self.pickShipGUI = None

        if self.confirmDialog:
            self.confirmDialog.destroy()
            self.confirmDialog = None

        self.setColorScale(1, 1, 1, 1)
        self.setTransparency(0)
        self.show()
        if self.fadeIval:
            self.fadeIval.pause()
            self.fadeIval = None
コード例 #12
0
    def finishShopping(self):
        if self.storePush and self.storeMenuGUI:
            if self.confirmDialog:
                self.confirmDialog.destroy()
                self.confirmDialog = None

            if self.interactGUI:
                self.interactGUI.hide()

            self.storeMenuGUI.show()
            self.storePush = False
            return None

        self.ignore('exitStore')
        self.ignore('makeSale')
        self.ignore('makeShipSale')
        self.ignore('purchaseAccessories')
        self.ignore('requestMusic')
        self.ignore('requestStowaway')
        messenger.send('stoppedShopping')
        self.ignore(InventoryGlobals.getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney))
        if self._DistributedShopKeeper__invRequest:
            DistributedInventoryBase.cancelGetInventory(self._DistributedShopKeeper__invRequest)
            self._DistributedShopKeeper__invRequest = None

        if self.storeMenuGUI:
            self.storeMenuGUI.destroy()
            self.storeMenuGUI = None

        if self.pickShipGUI:
            self.pickShipGUI.destroy()
            self.pickShipGUI = None

        if self.confirmDialog:
            self.confirmDialog.destroy()
            self.confirmDialog = None

        self.setColorScale(1, 1, 1, 1)
        self.setTransparency(0)
        self.show()
        if self.fadeIval:
            self.fadeIval.pause()
            self.fadeIval = None
コード例 #13
0
ファイル: ShipStoreGUI.py プロジェクト: tiideinmaar/POTCO-PS
 def __init__(self, inventory, name):
     GuiPanel.GuiPanel.__init__(self, name, self.width, self.height, showClose = False)
     self.setPos(-1.25, 0, -0.66000000000000003)
     self.initialiseoptions(ShipStoreGUI)
     self.balance = 0
     self.purchaseInventory = [
         [
             ItemId.INTERCEPTOR_L1,
             1]]
     self.sellInventory = []
     self.statData = []
     self.namePanel = None
     self.updateStats()
     self.storeInventory = ShipItemList.ShipItemList(inventory, self.height - 0.10000000000000001, buy = PiratesGuiGlobals.InventoryAdd)
     self.storeInventory.reparentTo(self)
     self.storeInventory.setPos(0.02, 0, 0.02)
     self.purchaseTitle = DirectFrame(parent = self, relief = None, text = PLocalizer.InventoryTypeNames[self.purchaseInventory[0][0]], text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.029999999999999999, 0.01), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1)
     self.purchaseTitle.setPos(self.storeInventory.width, 0, 0.70699999999999996 + (self.height - 0.065000000000000002) / 2.5)
     self.card = loader.loadModel('models/textureCards/shipCatalog')
     self.shipImage = DirectFrame(parent = self, relief = DGG.FLAT, image_scale = 0.20000000000000001, frameColor = (0, 0, 0, 1.0), borderWidth = PiratesGuiGlobals.BorderWidthSmall, pad = (0.01, 0.01), frameSize = (-0.26000000000000001, 0.26000000000000001, -0.185, 0.185), textMayChange = 1, pos = (self.width * 0.71999999999999997, 0, 1))
     self.shipImage.setTransparency(1)
     barChartWidth = self.width - self.storeInventory.width + 0.040000000000000001
     self.shipStats = BarChart.BarChart(self.statData, 0.25, barChartWidth, PLocalizer.ShipProfile, PiratesGuiGlobals.TextFG1)
     self.shipStats.reparentTo(self)
     self.shipStats.setPos(self.storeInventory.width + 0.029999999999999999, 0, 0.12)
     self.descText = DirectFrame(parent = self, relief = None, text = PLocalizer.ShipDescriptions[self.purchaseInventory[0][0]], text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleMed, text_pos = (0.029999999999999999, 0.01), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, frameColor = (0, 0, 0, 0), frameSize = (0.02, self.width - self.storeInventory.width - 0.02, 0, 0.050000000000000003), textMayChange = 1, text_wordwrap = 18, pos = (self.storeInventory.width, 0, 0.75))
     self.balanceTitle = DirectFrame(parent = self, relief = None, text = PLocalizer.Cost, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.31, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, pos = (self.columnWidth, 0, -0.01))
     self.goldTitle = DirectFrame(parent = self, relief = None, text = '%s:' % PLocalizer.MoneyName, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.31, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, pos = (self.columnWidth, 0, 0.040000000000000001))
     coinImage = loader.loadModel('models/gui/toplevel_gui').find('**/treasure_w_coin*')
     self.balanceValue = DirectFrame(parent = self, relief = None, text = str(self.balance), text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.53000000000000003, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, image = coinImage, image_scale = 0.14999999999999999, image_pos = (0.56000000000000005, 0, 0.42499999999999999), pos = (self.columnWidth, 0, -0.01))
     self.goldValue = DirectFrame(parent = self, relief = None, text = str(localAvatar.getMoney()), text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.53000000000000003, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, image = coinImage, image_scale = 0.14999999999999999, image_pos = (0.56000000000000005, 0, 0.42499999999999999), pos = (self.columnWidth, 0, 0.040000000000000001))
     coinImage.removeNode()
     self.commitButton = DialogButton.DialogButton(command = self.handleCommitPurchase, buttonStyle = DialogButton.DialogButton.YES, parent = self, relief = None, text = PLocalizer.PurchaseCommit, text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleLarge, textMayChange = 0, pos = (self.width - 0.39000000000000001, 0, 0.070000000000000007), sortOrder = 0)
     lockImage = loader.loadModel('models/gui/toplevel_gui').find('**/pir_t_gui_gen_key_subscriber')
     self.lock = DirectFrame(parent = self.commitButton, relief = None, image = lockImage, image_scale = 0.14999999999999999, pos = (-0.059999999999999998, 0, 0))
     self.lock.hide()
     self.closeButton = DialogButton.DialogButton(command = self.closePanel, buttonStyle = DialogButton.DialogButton.NO, parent = self, relief = None, text = PLocalizer.lClose, text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleLarge, textMayChange = 0, pos = (self.width - 0.14499999999999999, 0, 0.070000000000000007))
     self.updateProfile()
     self.accept(InventoryGlobals.getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.updateBalance)
     self.accept(PiratesGuiGlobals.InventoryBuyEvent, self.handleBuyItem)
     self.accept(PiratesGuiGlobals.InventorySellEvent, self.handleSellItem)
     self.acceptOnce('escape', self.closePanel)
     base.ssg = self
コード例 #14
0
ファイル: ShipStoreGUI.py プロジェクト: TTGhost/POTCOR-src
 def __init__(self, inventory, name):
     GuiPanel.GuiPanel.__init__(self, name, self.width, self.height, showClose = False)
     self.setPos(-1.25, 0, -0.66000000000000003)
     self.initialiseoptions(ShipStoreGUI)
     self.balance = 0
     self.purchaseInventory = [
         [
             ItemId.INTERCEPTOR_L1,
             1]]
     self.sellInventory = []
     self.statData = []
     self.namePanel = None
     self.updateStats()
     self.storeInventory = ShipItemList.ShipItemList(inventory, self.height - 0.10000000000000001, buy = PiratesGuiGlobals.InventoryAdd)
     self.storeInventory.reparentTo(self)
     self.storeInventory.setPos(0.02, 0, 0.02)
     self.purchaseTitle = DirectFrame(parent = self, relief = None, text = PLocalizer.InventoryTypeNames[self.purchaseInventory[0][0]], text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.029999999999999999, 0.01), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1)
     self.purchaseTitle.setPos(self.storeInventory.width, 0, 0.70699999999999996 + (self.height - 0.065000000000000002) / 2.5)
     self.card = loader.loadModel('models/textureCards/shipCatalog')
     self.shipImage = DirectFrame(parent = self, relief = DGG.FLAT, image_scale = 0.20000000000000001, frameColor = (0, 0, 0, 1.0), borderWidth = PiratesGuiGlobals.BorderWidthSmall, pad = (0.01, 0.01), frameSize = (-0.26000000000000001, 0.26000000000000001, -0.185, 0.185), textMayChange = 1, pos = (self.width * 0.71999999999999997, 0, 1))
     self.shipImage.setTransparency(1)
     barChartWidth = self.width - self.storeInventory.width + 0.040000000000000001
     self.shipStats = BarChart.BarChart(self.statData, 0.25, barChartWidth, PLocalizer.ShipProfile, PiratesGuiGlobals.TextFG1)
     self.shipStats.reparentTo(self)
     self.shipStats.setPos(self.storeInventory.width + 0.029999999999999999, 0, 0.12)
     self.descText = DirectFrame(parent = self, relief = None, text = PLocalizer.ShipDescriptions[self.purchaseInventory[0][0]], text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleMed, text_pos = (0.029999999999999999, 0.01), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, frameColor = (0, 0, 0, 0), frameSize = (0.02, self.width - self.storeInventory.width - 0.02, 0, 0.050000000000000003), textMayChange = 1, text_wordwrap = 18, pos = (self.storeInventory.width, 0, 0.75))
     self.balanceTitle = DirectFrame(parent = self, relief = None, text = PLocalizer.Cost, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.31, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, pos = (self.columnWidth, 0, -0.01))
     self.goldTitle = DirectFrame(parent = self, relief = None, text = '%s:' % PLocalizer.MoneyName, text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.31, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, pos = (self.columnWidth, 0, 0.040000000000000001))
     coinImage = loader.loadModel('models/gui/toplevel_gui').find('**/treasure_w_coin*')
     self.balanceValue = DirectFrame(parent = self, relief = None, text = str(self.balance), text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.53000000000000003, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, image = coinImage, image_scale = 0.14999999999999999, image_pos = (0.56000000000000005, 0, 0.42499999999999999), pos = (self.columnWidth, 0, -0.01))
     self.goldValue = DirectFrame(parent = self, relief = None, text = str(localAvatar.getMoney()), text_align = TextNode.ARight, text_scale = PiratesGuiGlobals.TextScaleLarge, text_pos = (0.53000000000000003, 0.41099999999999998), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 0, image = coinImage, image_scale = 0.14999999999999999, image_pos = (0.56000000000000005, 0, 0.42499999999999999), pos = (self.columnWidth, 0, 0.040000000000000001))
     coinImage.removeNode()
     self.commitButton = DialogButton.DialogButton(command = self.handleCommitPurchase, buttonStyle = DialogButton.DialogButton.YES, parent = self, relief = None, text = PLocalizer.PurchaseCommit, text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleLarge, textMayChange = 0, pos = (self.width - 0.39000000000000001, 0, 0.070000000000000007), sortOrder = 0)
     lockImage = loader.loadModel('models/gui/toplevel_gui').find('**/pir_t_gui_gen_key_subscriber')
     self.lock = DirectFrame(parent = self.commitButton, relief = None, image = lockImage, image_scale = 0.14999999999999999, pos = (-0.059999999999999998, 0, 0))
     self.lock.hide()
     self.closeButton = DialogButton.DialogButton(command = self.closePanel, buttonStyle = DialogButton.DialogButton.NO, parent = self, relief = None, text = PLocalizer.lClose, text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleLarge, textMayChange = 0, pos = (self.width - 0.14499999999999999, 0, 0.070000000000000007))
     self.updateProfile()
     self.accept(InventoryGlobals.getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.updateBalance)
     self.accept(PiratesGuiGlobals.InventoryBuyEvent, self.handleBuyItem)
     self.accept(PiratesGuiGlobals.InventorySellEvent, self.handleSellItem)
     self.acceptOnce('escape', self.closePanel)
     base.ssg = self
 def postUpdate(self, cell):
     if cell and cell.slotId:
         location = InventoryGlobals.getJewelryLocationBySlot(cell.slotId)
         gui = loader.loadModel('models/gui/gui_icons_weapon')
         if not cell.inventoryItem:
             self.wearJewelry(cell, location, remove = 1)
             cell.container.markCell(cell, MASK_EMPTYEQUIP)
             cell.container.unmarkCell(cell, MASK_FULLEQUIP)
         else:
             cell.inventoryItem.refreshImageColor()
             self.wearJewelry(cell, location)
             cell.container.markCell(cell, MASK_FULLEQUIP)
             cell.container.unmarkCell(cell, MASK_EMPTYEQUIP)
     
     avInv = localAvatar.getInventory()
     if avInv and avInv.findAvailableLocation(InventoryType.ItemTypeJewelry) in [
         Locations.INVALID_LOCATION,
         Locations.NON_LOCATION]:
         localAvatar.sendRequestContext(InventoryType.InventoryFull)
コード例 #16
0
 def discoverLocatableInventory(self, weaponBag, clothingBag = None, consumableBag = None):
     locatableItems = localAvatar.getInventory().getLocatables()
     misplacedSlots = []
     itemsToTrash = []
     base.localAvatar.lockRegen()
     for itemKey in locatableItems:
         if self.slotToCellMap.has_key(itemKey) and self.slotToCellMap[itemKey]:
             itemTuple = locatableItems[itemKey]
             itemId = itemTuple[1]
             itemCategory = itemTuple[0]
             slotCell = self.slotToCellMap[itemKey]
             uiItem = self.makeLocatableItem(itemTuple)
             if uiItem:
                 self.putIntoCellSlot(itemKey, uiItem)
                 slotCell.container.postUpdate(slotCell)
                 uiItem.refreshImageColor()
             elif self.trashInvalidItems:
                 itemsToTrash.append(itemTuple)
             
         misplacedSlots.append(itemKey)
     
     if len(itemsToTrash) > 0:
         print 'trashing invalid items %s' % itemsToTrash
         import pdb
         pdb.set_trace()
         localAvatar.getInventory().trashItems(itemsToTrash)
     
     base.localAvatar.unlockAndRegen()
     self.discoveredInventory = 1
     messenger.send('Inventory_Discovered', [
         self])
     self.accept('inventoryLocation-%s' % localAvatar.getInventory().doId, self.handleSlotUpdate)
     self.accept(InventoryGlobals.getOverflowChangeMsg(localAvatar.getInventory().doId), self.handleOverflow)
     if misplacedSlots:
         messenger.send('overflowChanged', [])
         runningList = []
         for slot in misplacedSlots:
             misplacedItemType = locatableItems[slot][0]
             newSlot = self.findOpenSlotForItemType(misplacedItemType, runningList)
             if newSlot:
                 localAvatar.getInventory().swapItems(slot, newSlot)
                 continue
コード例 #17
0
 def rePanel(self, inventory):
     if not self.showing:
         self.needRefresh = 1
         return None
     
     skillTokens = {
         InventoryType.CutlassToken: (ItemGlobals.RUSTY_CUTLASS,),
         InventoryType.PistolToken: (ItemGlobals.FLINTLOCK_PISTOL,),
         InventoryType.DollToken: (ItemGlobals.VOODOO_DOLL,),
         InventoryType.DaggerToken: (ItemGlobals.BASIC_DAGGER,),
         InventoryType.GrenadeToken: (ItemGlobals.GRENADE_POUCH,),
         InventoryType.WandToken: (ItemGlobals.CURSED_STAFF,) }
     zIndex = 1
     for skillTokenKey in TOKEN_LIST:
         quantity = 0
         if localAvatar.getInventory().stacks.get(skillTokenKey):
             quantity = 1
         
         skillData = skillTokens[skillTokenKey]
         weaponId = skillData[0]
         key = None
         panel = WeaponPanel.WeaponPanel((weaponId, quantity), key)
         panel.reparentTo(self)
         panel.setZ(PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999 - zIndex * panel.height)
         zIndex += 1
         repCat = WeaponGlobals.getRepId(weaponId)
         self.weaponPanels[repCat] = panel
         self.ignore('inventoryQuantity-%s' % inventory.getDoId())
         self.acceptOnce('inventoryQuantity-%s-%s' % (inventory.getDoId(), skillTokenKey), self.refreshList)
     
     repIcon_gui = loader.loadModel('models/textureCards/skillIcons')
     repIcon = repIcon_gui.find('**/box_base')
     if config.GetBool('want-fishing-game', 0):
         self.fishingIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.FishingRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
         fishIconCard = loader.loadModel('models/textureCards/fishing_icons')
         inv = localAvatar.getInventory()
         fishingChangeMsg = InventoryGlobals.getCategoryQuantChangeMsg(inv.doId, InventoryType.FishingRod)
         if self.fishingChangeMsg:
             self.ignore(fishingChangeMsg)
         
         self.fishingChangeMsg = fishingChangeMsg
         self.acceptOnce(fishingChangeMsg, self.refreshList)
         rodIcons = [
             'pir_t_gui_fsh_smRodIcon',
             'pir_t_gui_fsh_mdRodIcon',
             'pir_t_gui_fsh_lgRodIcon']
         rodLvl = inv.getStackQuantity(InventoryType.FishingRod)
         rodIcon = rodIcons[rodLvl - 1]
         rodText = PLocalizer.FishingRodNames[rodLvl]
         if rodLvl >= 1:
             self.fishingIcon['geom'] = fishIconCard.find('**/' + rodIcon)
         
         self.fishingIcon['geom_scale'] = 0.10000000000000001
         self.fishingIcon['geom_pos'] = (0, 0, 0)
         self.fishingIcon.reparentTo(self)
         fishingRepValue = localAvatar.getInventory().getReputation(InventoryType.FishingRep)
         self.fishingRepMeter = ReputationMeter(InventoryType.FishingRep, width = 0.66000000000000003)
         self.fishingRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
         self.fishingRepMeter.update(fishingRepValue)
         self.fishingRepMeter.reparentTo(self)
         self.fishingRepMeter.flattenLight()
         self.fishingPoleName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = rodText, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - 7 * panel.height), text_font = PiratesGlobals.getInterfaceFont())
         self.fishingPoleName.reparentTo(self)
         zIndex += 1
     
     iconCard = loader.loadModel('models/textureCards/skillIcons')
     if config.GetBool('want-potion-game', 0):
         self.potionIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.PotionRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
         self.potionIcon['geom'] = iconCard.find('**/pir_t_gui_pot_base')
         self.potionIcon['geom_scale'] = 0.10000000000000001
         self.potionIcon['geom_pos'] = (0, 0, 0)
         self.potionIcon.reparentTo(self)
         potionRepValue = localAvatar.getInventory().getReputation(InventoryType.PotionsRep)
         self.potionRepMeter = ReputationMeter(InventoryType.PotionsRep, width = 0.66000000000000003)
         self.potionRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
         self.potionRepMeter.update(potionRepValue)
         self.potionRepMeter.reparentTo(self)
         self.potionRepMeter.flattenLight()
         zIndex += 1
     
     items = dict(map(lambda x: (x.getType(), x.getCount()), inventory.getConsumables().values()))
     possibleItems = ItemGlobals.getAllHealthIds()
     havePorky = items.get(ItemGlobals.ROAST_PORK)
     if not havePorky and ItemGlobals.ROAST_PORK in possibleItems:
         possibleItems.remove(ItemGlobals.ROAST_PORK)
     
     offset = 0
     if base.config.GetBool('want-potion-game', 0):
         items = inventory.getConsumables()
         listLength = len(InventoryType.PotionMinigamePotions)
         count = 0
         for i in range(listLength):
             tonicId = InventoryType.PotionMinigamePotions[i]
             if items.get(tonicId):
                 button = SkillButton(tonicId, self.tonicCallback, items.get(tonicId), showQuantity = True, showHelp = True, showRing = True)
                 button.skillButton['geom_scale'] = 0.080000000000000002
                 x = 0.16 * (count % 6) + -1.2
                 z = 1.0 - int(count / 6) * 0.16
                 button.setPos(x, 0, z)
                 button.reparentTo(self)
                 self.tonicButtons[tonicId] = button
                 count += 1
                 continue
コード例 #18
0
    def __init__(self, table, maxCommunityCards, maxHandCards):
        DirectFrame.__init__(self, parent=base.a2dBackground, relief=None)
        self.initialiseoptions(PokerTableGUI)
        self.maxCommunityCards = maxCommunityCards
        self.maxHandCards = maxHandCards
        self.maxBet = 0
        self.numberOfTimeouts = 0
        self.table = table
        self.destroyed = False
        self.playerActions = []
        width = 1.0
        self.menu = BorderFrame(parent=base.a2dBottomCenter,
                                frameSize=(-width / 2.0, width / 2.0, 0, 0.25),
                                pos=(0, 0, 0))
        self.disableReason = DirectLabel(
            parent=self.menu,
            text='',
            text_align=TextNode.ACenter,
            text_scale=0.04,
            pos=(0, 0, 0.175),
            text_fg=PiratesGuiGlobals.TextFG2,
            text_shadow=PiratesGuiGlobals.TextShadow,
            textMayChange=1)
        self.disableReason.hide()
        self.initializeTableInterface()
        x = -0.36
        y = 0.1775
        x_increment = 0.24
        helpText = PLocalizer.TableCardsHelp
        helpPos = (0.0, 0.0, 0.24)
        text = PLocalizer.PokerCheat1
        button = GuiButton(parent=self.menu,
                           command=self.cardIndexSelection,
                           helpText=helpText,
                           helpPos=helpPos,
                           pos=(x, 0, y),
                           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.cardIndexSelection,
                           helpText=helpText,
                           helpPos=helpPos,
                           pos=(x, 0, y),
                           canReposition=True)
        self.setButtonSettings2Lines(button, (x, 0, y), text,
                                     [PlayingCardGlobals.Cheat2])
        self.cheat2Button = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        text = PLocalizer.PokerCheck
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.CheckCall])
        self.passButton = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        text = PLocalizer.PokerBet
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.BetRaise])
        self.betButton = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        x = -0.36
        y = 0.07
        x_increment = 0.24
        x = x + x_increment
        x = x + x_increment
        x = x + x_increment
        text = PLocalizer.PokerFold
        button = GuiButton(parent=self.menu,
                           command=self.playerAction,
                           canReposition=True)
        self.setButtonSettings(button, (x, 0, y), text,
                               [PlayingCardGlobals.Fold])
        self.foldButton = button
        self.buttonArray = self.buttonArray + [button]
        x = x + x_increment
        self.potSizeLabel = DirectLabel(parent=self,
                                        relief=None,
                                        text='',
                                        text_align=TextNode.ACenter,
                                        text_scale=0.05,
                                        pos=(-0.15, 0.0, 0.17),
                                        text_fg=(1, 0.9, 0.6, 1),
                                        text_shadow=(0, 0, 0, 1))
        if table.wantMeter == 1:
            cardMaker = CardMaker('tellMeter')
            cardMaker.setFrame(-1, 1, -1, 1)
            self.meterMax = 0.2
            self.meterBorder = NodePath(cardMaker.generate())
            self.meterBorder.setColor(1, 1, 0, 1)
            self.meterBorder.setScale(0.2, 1, 0.02)
            self.meterBorder.reparentTo(aspect2d)
            self.meter = NodePath(cardMaker.generate())
            self.meter.setColor(1, 0, 0, 1)
            self.meter.setScale(0.2, 1, 0.05)
            self.meter.reparentTo(aspect2d)
        if table.wantMeter == 2:
            cardMaker = CardMaker('tellMeter')
            cardMaker.setFrame(-1, 1, -1, 1)
            self.balance = NodePath('Balance')
            self.balance.reparentTo(aspect2d)
            self.balanceL = NodePath(cardMaker.generate())
            self.balanceL.setColor(1, 0, 0, 1)
            self.balanceL.setScale(0.125, 1, 0.01)
            self.balanceL.setPos(-0.125, 0, 0)
            self.balanceL.reparentTo(self.balance)
            self.balanceR = NodePath(cardMaker.generate())
            self.balanceR.setColor(0, 1, 0, 1)
            self.balanceR.setScale(0.125, 1, 0.01)
            self.balanceR.setPos(0.125, 0, 0)
            self.balanceR.reparentTo(self.balance)
            self.fulcrum = loader.loadModel('models/props/winebottle_B')
            self.fulcrum.setScale(0.2)
            self.fulcrum.setZ(-0.21)
            self.fulcrum.reparentTo(aspect2d)
            self.weightR = NodePath(cardMaker.generate())
            self.weightR.setColor(0, 0, 1, 1)
            self.weightR.setScale(0.03, 1, 0.05)
            self.weightR.setPos(0.22, 0, 0.06)
            self.weightR.reparentTo(self.balance)
            self.weightL = NodePath(cardMaker.generate())
            self.weightL.setColor(0, 0, 1, 1)
            self.weightL.setScale(0.03, 1, 0.05)
            self.weightL.setPos(-0.22, 0, 0.06)
            self.weightL.reparentTo(self.balance)
            self.balance.hide()
            self.fulcrum.hide()
        self.communityCardNode = NodePath('communityCards')
        self.communityCardNode.reparentTo(self)
        self.communityCardNode.setScale(0.5)
        self.communityCardNode.setPos(0, 0, 0.04)
        self.communityCards = []
        for i in range(self.maxCommunityCards):
            card = PlayingCard.PlayingCardNodePath('standard',
                                                   PlayingCardGlobals.Unknown)
            card.reparentTo(self.communityCardNode)
            card.setPos(i * 0.3 - 0.6, 0, 0)
            card.hide()
            self.communityCards.append(card)

        self.playerStatusPanels = []
        for i in range(self.table.NumSeats + 1):
            statusPanel = PokerStatusPanel(self.maxHandCards)
            statusPanel.setName('playerHand-%s' % i)
            pos = self.HandPos[i]
            statusPanel.setPos(pos)
            self.playerStatusPanels.append(statusPanel)

        self.localStatusPanel = self.playerStatusPanels[
            self.LocalAvatarGuiIndex]
        gui = loader.loadModel('models/gui/toplevel_gui')
        goldCoin = gui.find('**/treasure_w_coin*')
        scale = 0.32
        currentMoney = self.table.getPlayerChips()
        x_increment = 0.24
        self.moneyDisplay = DirectLabel(
            parent=self.menu,
            relief=None,
            pos=(-0.3 + x_increment, 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.04,
            text_pos=(0.05, -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.shuffleIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_SHUFFLE)
        ]
        identifier += 1
        this.startDealIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_01)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_02)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_03)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_04)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_05)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_06)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_07)
        ]
        identifier += 1
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_08)
        ]
        identifier += 1
        this.totalDealIdentifiers = identifier - this.startDealIdentifier
        this.foldIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FOLD)
        ]
        identifier += 1
        this.flipIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FLIP)
        ]
        identifier += 1
        this.pickupIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_PICKUP)
        ]
        identifier += 1
        this.checkIdentifier = identifier
        check = loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHECK)
        check.setVolume(0.5)
        this.sfxArray = this.sfxArray + [check]
        identifier += 1
        this.betIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_BET)
        ]
        identifier += 1
        this.collectIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_COLLECT)
        ]
        identifier += 1
        this.allInIdentifier = identifier
        this.sfxArray = this.sfxArray + [
            loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_ALL)
        ]
        identifier += 1
        return
コード例 #19
0
ファイル: SimpleStoreItem.py プロジェクト: TTGhost/POTCOR-src
 def checkStackable(self):
     return InventoryGlobals.isStackableType(self.itemClass)
コード例 #20
0
 def startShopping(self, storeType):
     self.accept('makeSale', self.sendRequestMakeSale)
     self.acceptOnce('exitStore', self.finishShopping)
     self.acceptOnce('makeShipSale', self.sendRequestMakeShipSale)
     self.acceptOnce('purchaseAccessories', self.sendRequestAccessories)
     self.acceptOnce('requestMusic', self.sendRequestMusic)
     self.acceptOnce('requestStowaway', self.sendRequestStowaway)
     self.storeType = storeType
     simpleStoreList = getBase().config.GetString('want-simple-stores', '').lower()
     useSimpleStore = 1
     if storeType == InteractGlobals.STORE:
         storeItems = DropGlobals.getStoreItems(self.uniqueId)
         inventory = ItemGlobals.getLegalStoreItems(storeItems)
         if not inventory:
             inventory = self.shopInventory[:]
         elif self.avatarType.isA(AvatarTypes.Blacksmith):
             inventory += DAGGER_AMMO_SHELF_L1 + DAGGER_AMMO_SHELF_L2 + DAGGER_POUCH_SHELF
         elif self.avatarType.isA(AvatarTypes.Gunsmith):
             inventory += PISTOL_AMMO_SHELF_L1 + PISTOL_AMMO_SHELF_L2 + PISTOL_POUCH_SHELF + BOMB_AMMO_SHELF_L1 + BOMB_AMMO_SHELF_L2 + GRENADE_POUCH_SHELF + CANNON_AMMO_SHELF_L1 + CANNON_AMMO_SHELF_L2 + CANNON_POUCH_SHELF
         elif self.avatarType.isA(AvatarTypes.Grenadier):
             inventory += BOMB_AMMO_SHELF_L1 + BOMB_AMMO_SHELF_L2 + GRENADE_POUCH_SHELF
         elif self.avatarType.isA(AvatarTypes.Merchant):
             inventory += PISTOL_AMMO_SHELF_L1
         
         if hasattr(self.cr.distributedDistrict, 'siegeManager') and self.cr.distributedDistrict.siegeManager.getPvpEnabled() and self.cr.distributedDistrict.siegeManager.getUseRepairKit() and self.avatarType.isA(AvatarTypes.Gunsmith):
             inventory += SIEGE_SHELF
         
         if useSimpleStore:
             self.storeMenuGUI = SimpleStoreGUI.MerchantStoreGUI(inventory, PLocalizer.MerchantStore, self)
         else:
             self.storeMenuGUI = StoreGUI.StoreGUI(inventory, PLocalizer.MerchantStore)
     elif storeType == InteractGlobals.MUSICIAN:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         inventory = self.shopInventory[:]
         self.storeMenuGUI = MusicianGUI.MusicianGUI(inventory, PLocalizer.InteractMusician)
     elif storeType == InteractGlobals.STOWAWAY:
         inventory = self.shopInventory[:]
         self.storeMenuGUI = StowawayGUI.StowawayGUI(inventory, PLocalizer.StowawayMenuTitle)
     elif storeType == InteractGlobals.SHIPS:
         self.storeMenuGUI = ShipStoreGUI.ShipStoreGUI(SHIP_SHELF, PLocalizer.Shipyard)
     elif storeType == InteractGlobals.TRAIN:
         pass
     elif storeType == InteractGlobals.UPGRADE:
         pass
     elif storeType == InteractGlobals.ACCESSORIES_STORE:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         if useSimpleStore:
             self.storeMenuGUI = SimpleStoreGUI.AccessoriesStoreGUI(npc = self, shopId = self.getShopId())
         else:
             self.storeMenuGUI = AccessoriesStoreGUI.AccessoriesStoreGUI(npc = self, shopId = self.getShopId())
     elif storeType == InteractGlobals.TATTOO_STORE:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         if useSimpleStore:
             self.storeMenuGUI = SimpleStoreGUI.TattooStoreGUI(npc = self, shopId = self.getShopId())
         else:
             self.storeMenuGUI = TattooStoreGUI.TattooStoreGUI(npc = self, shopId = self.getShopId())
     elif storeType == InteractGlobals.JEWELRY_STORE:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         if useSimpleStore:
             self.storeMenuGUI = SimpleStoreGUI.JewelryStoreGUI(npc = self, shopId = self.getShopId())
         else:
             self.storeMenuGUI = JewelryStoreGUI.JewelryStoreGUI(npc = self, shopId = self.getShopId())
     elif storeType == InteractGlobals.BARBER_STORE:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         self.storeMenuGUI = BarberStoreGUI.BarberStoreGUI(npc = self, shopId = self.getShopId())
     elif storeType == InteractGlobals.PVP_REWARDS_TATTOO:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         self.storeMenuGUI = TattooStoreGUI.TattooStoreGUI(npc = self, shopId = PiratesGlobals.PRIVATEER_TATTOOS)
     elif storeType == InteractGlobals.PVP_REWARDS_HATS:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         self.storeMenuGUI = AccessoriesStoreGUI.AccessoriesStoreGUI(npc = self, shopId = PiratesGlobals.PRIVATEER_HATS)
     elif storeType == InteractGlobals.PVP_REWARDS_COATS:
         self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
         self.fadeIval.start()
         self.storeMenuGUI = AccessoriesStoreGUI.AccessoriesStoreGUI(npc = self, shopId = PiratesGlobals.PRIVATEER_COATS)
     elif storeType == InteractGlobals.CATALOG_STORE:
         self.storeMenuGUI = SimpleStoreGUI.CatalogStoreGUI(npc = self, shopId = self.getShopId())
     
     self.accept(InventoryGlobals.getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.saleFinishedResponse)
コード例 #21
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
コード例 #22
0
 def checkStackable(self):
     return InventoryGlobals.isStackableType(self.itemClass)
コード例 #23
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.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
コード例 #24
0
    def startShopping(self, storeType):
        self.accept('makeSale', self.sendRequestMakeSale)
        self.acceptOnce('exitStore', self.finishShopping)
        self.acceptOnce('makeShipSale', self.sendRequestMakeShipSale)
        self.acceptOnce('purchaseAccessories', self.sendRequestAccessories)
        self.acceptOnce('requestMusic', self.sendRequestMusic)
        self.acceptOnce('requestStowaway', self.sendRequestStowaway)
        self.storeType = storeType
        simpleStoreList = getBase().config.GetString('want-simple-stores', '').lower()
        useSimpleStore = 1
        if storeType == InteractGlobals.STORE:
            storeItems = DropGlobals.getStoreItems(self.uniqueId)
            inventory = ItemGlobals.getLegalStoreItems(storeItems)
            if not inventory:
                inventory = self.shopInventory[:]
            elif self.avatarType.isA(AvatarTypes.Blacksmith):
                inventory += DAGGER_AMMO_SHELF_L1 + DAGGER_AMMO_SHELF_L2 + DAGGER_POUCH_SHELF
            elif self.avatarType.isA(AvatarTypes.Gunsmith):
                inventory += PISTOL_AMMO_SHELF_L1 + PISTOL_AMMO_SHELF_L2 + PISTOL_POUCH_SHELF + BOMB_AMMO_SHELF_L1 + BOMB_AMMO_SHELF_L2 + GRENADE_POUCH_SHELF + CANNON_AMMO_SHELF_L1 + CANNON_AMMO_SHELF_L2 + CANNON_POUCH_SHELF
            elif self.avatarType.isA(AvatarTypes.Grenadier):
                inventory += BOMB_AMMO_SHELF_L1 + BOMB_AMMO_SHELF_L2 + GRENADE_POUCH_SHELF
            elif self.avatarType.isA(AvatarTypes.Merchant):
                inventory += PISTOL_AMMO_SHELF_L1

            if hasattr(self.cr.distributedDistrict, 'siegeManager') and self.cr.distributedDistrict.siegeManager.getPvpEnabled() and self.cr.distributedDistrict.siegeManager.getUseRepairKit() and self.avatarType.isA(AvatarTypes.Gunsmith):
                inventory += SIEGE_SHELF

            if useSimpleStore:
                self.storeMenuGUI = SimpleStoreGUI.MerchantStoreGUI(inventory, PLocalizer.MerchantStore, self)
            else:
                self.storeMenuGUI = StoreGUI.StoreGUI(inventory, PLocalizer.MerchantStore)
        elif storeType == InteractGlobals.MUSICIAN:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            inventory = self.shopInventory[:]
            self.storeMenuGUI = MusicianGUI.MusicianGUI(inventory, PLocalizer.InteractMusician)
        elif storeType == InteractGlobals.STOWAWAY:
            inventory = self.shopInventory[:]
            self.storeMenuGUI = StowawayGUI.StowawayGUI(inventory, PLocalizer.StowawayMenuTitle)
        elif storeType == InteractGlobals.SHIPS:
            self.storeMenuGUI = ShipStoreGUI.ShipStoreGUI(SHIP_SHELF, PLocalizer.Shipyard)
        elif storeType == InteractGlobals.TRAIN:
            pass
        elif storeType == InteractGlobals.UPGRADE:
            pass
        elif storeType == InteractGlobals.ACCESSORIES_STORE:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            if useSimpleStore:
                self.storeMenuGUI = SimpleStoreGUI.AccessoriesStoreGUI(npc = self, shopId = self.getShopId())
            else:
                self.storeMenuGUI = AccessoriesStoreGUI.AccessoriesStoreGUI(npc = self, shopId = self.getShopId())
        elif storeType == InteractGlobals.TATTOO_STORE:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            if useSimpleStore:
                self.storeMenuGUI = SimpleStoreGUI.TattooStoreGUI(npc = self, shopId = self.getShopId())
            else:
                self.storeMenuGUI = TattooStoreGUI.TattooStoreGUI(npc = self, shopId = self.getShopId())
        elif storeType == InteractGlobals.JEWELRY_STORE:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            if useSimpleStore:
                self.storeMenuGUI = SimpleStoreGUI.JewelryStoreGUI(npc = self, shopId = self.getShopId())
            else:
                self.storeMenuGUI = JewelryStoreGUI.JewelryStoreGUI(npc = self, shopId = self.getShopId())
        elif storeType == InteractGlobals.BARBER_STORE:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            self.storeMenuGUI = BarberStoreGUI.BarberStoreGUI(npc = self, shopId = self.getShopId())
        elif storeType == InteractGlobals.PVP_REWARDS_TATTOO:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            self.storeMenuGUI = TattooStoreGUI.TattooStoreGUI(npc = self, shopId = PiratesGlobals.PRIVATEER_TATTOOS)
        elif storeType == InteractGlobals.PVP_REWARDS_HATS:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            self.storeMenuGUI = AccessoriesStoreGUI.AccessoriesStoreGUI(npc = self, shopId = PiratesGlobals.PRIVATEER_HATS)
        elif storeType == InteractGlobals.PVP_REWARDS_COATS:
            self.fadeIval = Sequence(Func(self.setTransparency, 1.0), self.colorScaleInterval(1.0, VBase4(1.0, 1.0, 1.0, 0.0)), Func(self.hide))
            self.fadeIval.start()
            self.storeMenuGUI = AccessoriesStoreGUI.AccessoriesStoreGUI(npc = self, shopId = PiratesGlobals.PRIVATEER_COATS)
        elif storeType == InteractGlobals.CATALOG_STORE:
            self.storeMenuGUI = SimpleStoreGUI.CatalogStoreGUI(npc = self, shopId = self.getShopId())

        self.accept(InventoryGlobals.getCategoryChangeMsg(localAvatar.getInventoryId(), InventoryType.ItemTypeMoney), self.saleFinishedResponse)
コード例 #25
0
 def __init__(self, table, maxCommunityCards, maxHandCards):
     DirectFrame.__init__(self, parent = base.a2dBackground, relief = None)
     self.initialiseoptions(PokerTableGUI)
     self.maxCommunityCards = maxCommunityCards
     self.maxHandCards = maxHandCards
     self.maxBet = 0
     self.numberOfTimeouts = 0
     self.table = table
     self.destroyed = False
     self.playerActions = []
     width = 1.0
     self.menu = BorderFrame(parent = base.a2dBottomCenter, frameSize = (-width / 2.0, width / 2.0, 0, 0.25), pos = (0, 0, 0))
     self.disableReason = DirectLabel(parent = self.menu, text = '', text_align = TextNode.ACenter, text_scale = 0.040000000000000001, pos = (0, 0, 0.17499999999999999), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1)
     self.disableReason.hide()
     self.initializeTableInterface()
     x = -0.35999999999999999
     y = 0.17749999999999999
     x_increment = 0.23999999999999999
     helpText = PLocalizer.TableCardsHelp
     helpPos = (0.0, 0.0, 0.23999999999999999)
     text = PLocalizer.PokerCheat1
     button = GuiButton(parent = self.menu, command = self.cardIndexSelection, helpText = helpText, helpPos = helpPos, pos = (x, 0, y), 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.cardIndexSelection, helpText = helpText, helpPos = helpPos, pos = (x, 0, y), canReposition = True)
     self.setButtonSettings2Lines(button, (x, 0, y), text, [
         PlayingCardGlobals.Cheat2])
     self.cheat2Button = button
     self.buttonArray = self.buttonArray + [
         button]
     x = x + x_increment
     text = PLocalizer.PokerCheck
     button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         PlayingCardGlobals.CheckCall])
     self.passButton = button
     self.buttonArray = self.buttonArray + [
         button]
     x = x + x_increment
     text = PLocalizer.PokerBet
     button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         PlayingCardGlobals.BetRaise])
     self.betButton = button
     self.buttonArray = self.buttonArray + [
         button]
     x = x + x_increment
     x = -0.35999999999999999
     y = 0.070000000000000007
     x_increment = 0.23999999999999999
     x = x + x_increment
     x = x + x_increment
     x = x + x_increment
     text = PLocalizer.PokerFold
     button = GuiButton(parent = self.menu, command = self.playerAction, canReposition = True)
     self.setButtonSettings(button, (x, 0, y), text, [
         PlayingCardGlobals.Fold])
     self.foldButton = button
     self.buttonArray = self.buttonArray + [
         button]
     x = x + x_increment
     self.potSizeLabel = DirectLabel(parent = self, relief = None, text = '', text_align = TextNode.ACenter, text_scale = 0.050000000000000003, pos = (-0.14999999999999999, 0.0, 0.17000000000000001), text_fg = (1, 0.90000000000000002, 0.59999999999999998, 1), text_shadow = (0, 0, 0, 1))
     if table.wantMeter == 1:
         cardMaker = CardMaker('tellMeter')
         cardMaker.setFrame(-1, 1, -1, 1)
         self.meterMax = 0.20000000000000001
         self.meterBorder = NodePath(cardMaker.generate())
         self.meterBorder.setColor(1, 1, 0, 1)
         self.meterBorder.setScale(0.20000000000000001, 1, 0.02)
         self.meterBorder.reparentTo(aspect2d)
         self.meter = NodePath(cardMaker.generate())
         self.meter.setColor(1, 0, 0, 1)
         self.meter.setScale(0.20000000000000001, 1, 0.050000000000000003)
         self.meter.reparentTo(aspect2d)
     
     if table.wantMeter == 2:
         cardMaker = CardMaker('tellMeter')
         cardMaker.setFrame(-1, 1, -1, 1)
         self.balance = NodePath('Balance')
         self.balance.reparentTo(aspect2d)
         self.balanceL = NodePath(cardMaker.generate())
         self.balanceL.setColor(1, 0, 0, 1)
         self.balanceL.setScale(0.125, 1, 0.01)
         self.balanceL.setPos(-0.125, 0, 0)
         self.balanceL.reparentTo(self.balance)
         self.balanceR = NodePath(cardMaker.generate())
         self.balanceR.setColor(0, 1, 0, 1)
         self.balanceR.setScale(0.125, 1, 0.01)
         self.balanceR.setPos(0.125, 0, 0)
         self.balanceR.reparentTo(self.balance)
         self.fulcrum = loader.loadModel('models/props/winebottle_B')
         self.fulcrum.setScale(0.20000000000000001)
         self.fulcrum.setZ(-0.20999999999999999)
         self.fulcrum.reparentTo(aspect2d)
         self.weightR = NodePath(cardMaker.generate())
         self.weightR.setColor(0, 0, 1, 1)
         self.weightR.setScale(0.029999999999999999, 1, 0.050000000000000003)
         self.weightR.setPos(0.22, 0, 0.059999999999999998)
         self.weightR.reparentTo(self.balance)
         self.weightL = NodePath(cardMaker.generate())
         self.weightL.setColor(0, 0, 1, 1)
         self.weightL.setScale(0.029999999999999999, 1, 0.050000000000000003)
         self.weightL.setPos(-0.22, 0, 0.059999999999999998)
         self.weightL.reparentTo(self.balance)
         self.balance.hide()
         self.fulcrum.hide()
     
     self.communityCardNode = NodePath('communityCards')
     self.communityCardNode.reparentTo(self)
     self.communityCardNode.setScale(0.5)
     self.communityCardNode.setPos(0, 0, 0.040000000000000001)
     self.communityCards = []
     for i in range(self.maxCommunityCards):
         card = PlayingCard.PlayingCardNodePath('standard', PlayingCardGlobals.Unknown)
         card.reparentTo(self.communityCardNode)
         card.setPos(i * 0.29999999999999999 - 0.59999999999999998, 0, 0)
         card.hide()
         self.communityCards.append(card)
     
     self.playerStatusPanels = []
     for i in range(self.table.NumSeats + 1):
         statusPanel = PokerStatusPanel(self.maxHandCards)
         statusPanel.setName('playerHand-%s' % i)
         pos = self.HandPos[i]
         statusPanel.setPos(pos)
         self.playerStatusPanels.append(statusPanel)
     
     self.localStatusPanel = self.playerStatusPanels[self.LocalAvatarGuiIndex]
     gui = loader.loadModel('models/gui/toplevel_gui')
     goldCoin = gui.find('**/treasure_w_coin*')
     scale = 0.32000000000000001
     currentMoney = self.table.getPlayerChips()
     x_increment = 0.23999999999999999
     self.moneyDisplay = DirectLabel(parent = self.menu, relief = None, pos = (-0.29999999999999999 + x_increment, 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.040000000000000001, text_pos = (0.050000000000000003, -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.shuffleIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_SHUFFLE)]
     identifier += 1
     this.startDealIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_01)]
     identifier += 1
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_02)]
     identifier += 1
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_03)]
     identifier += 1
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_04)]
     identifier += 1
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_05)]
     identifier += 1
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_06)]
     identifier += 1
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_07)]
     identifier += 1
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_DEAL_08)]
     identifier += 1
     this.totalDealIdentifiers = identifier - this.startDealIdentifier
     this.foldIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FOLD)]
     identifier += 1
     this.flipIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_FLIP)]
     identifier += 1
     this.pickupIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_PICKUP)]
     identifier += 1
     this.checkIdentifier = identifier
     check = loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHECK)
     check.setVolume(0.5)
     this.sfxArray = this.sfxArray + [
         check]
     identifier += 1
     this.betIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_BET)]
     identifier += 1
     this.collectIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_COLLECT)]
     identifier += 1
     this.allInIdentifier = identifier
     this.sfxArray = this.sfxArray + [
         loadSfx(SoundGlobals.SFX_MINIGAME_CARDS_CHIPS_ALL)]
     identifier += 1