def enterFireCannon(self):
        localAvatar.guiMgr.combatTray.setLinkedCannon(self)
        self.enableCannonFireInput()
        base.localAvatar.guiMgr.setIgnoreEscapeHotKey(True)
        self.accept(InteractiveBase.END_INTERACT_EVENT, self.handleEndInteractKey)
        localAvatar.cameraFSM.request(self._cameraState, self.prop)
        self.setCannonGUI()
        taskMgr.add(self.updateReload, 'updateCannonReload')
        self.cgui.setAmmoId(self.getAmmoSkillId())
        
        def gotInventory(inv):
            if inv:
                ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(self.getAmmoSkillId())
                maxShots = inv.getStackLimit(ammoInvId)
                self.numShots = inv.getStackQuantity(ammoInvId)
                if WeaponGlobals.isInfiniteAmmo(self.getAmmoSkillId()) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), self.getAmmoSkillId()):
                    self.cgui.setAmmoLeft(-1, -1)
                else:
                    self.cgui.setAmmoLeft(self.numShots, maxShots)
                self.updateCannonItems()
                self.updateCannonDressing()
            

        if self._DistributedPCCannon__invRequest:
            DistributedInventoryBase.cancelGetInventory(self._DistributedPCCannon__invRequest)
        
        self._DistributedPCCannon__invRequest = DistributedInventoryBase.getInventory(localAvatar.getInventoryId(), gotInventory)
Пример #2
0
    def cancelGetInventory(self, requestId):
        if requestId in self.myInventoryRequests:
            self.myInventoryRequests.remove(requestId)
            DistributedInventoryBase.cancelGetInventory(requestId)
            return True

        return False
    def destroy(self):
        self.ignoreAll()
        taskMgr.remove('doThreatMessageQueue')
        if self.invReq:
            DistributedInventoryBase.cancelGetInventory(self.invReq)
            self.invReq = None

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

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

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

        self.hpMeterDownIval.pause()
        self.hpMeterUpGreenIval.pause()
        self.hpMeterUpRedIval.pause()
        self.hpMeterUpYellowIval.pause()
        del self.hpMeterDownIval
        del self.hpMeterUpGreenIval
        del self.hpMeterUpRedIval
        del self.hpMeterUpYellowIval
        self.timer = None
        self.anchorButton = None
        GuiTray.GuiTray.destroy(self)
        self.destroyBoardingPermissionPanel()
Пример #4
0
 def cancelGetInventory(self, requestId):
     if requestId in self.myInventoryRequests:
         self.myInventoryRequests.remove(requestId)
         DistributedInventoryBase.cancelGetInventory(requestId)
         return True
     
     return False
Пример #5
0
 def disable(self):
     DistributedInteractive.disable(self)
     if self.invReq:
         DistributedInventoryBase.cancelGetInventory(localAvatar.getInventoryId())
         self.invReq = None
     
     self.removeChildren()
Пример #6
0
 def disable(self):
     DistributedInteractive.disable(self)
     if self.invReq:
         DistributedInventoryBase.cancelGetInventory(localAvatar.getInventoryId())
         self.invReq = None
     
     self.removeChildren()
    def enterFireCannon(self):
        localAvatar.guiMgr.combatTray.setLinkedCannon(self)
        self.enableCannonFireInput()
        base.localAvatar.guiMgr.setIgnoreEscapeHotKey(True)
        self.accept(InteractiveBase.END_INTERACT_EVENT, self.handleEndInteractKey)
        localAvatar.cameraFSM.request(self._cameraState, self.prop)
        self.setCannonGUI()
        taskMgr.add(self.updateReload, 'updateCannonReload')
        self.cgui.setAmmoId(self.getAmmoSkillId())
        
        def gotInventory(inv):
            if inv:
                ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(self.getAmmoSkillId())
                maxShots = inv.getStackLimit(ammoInvId)
                self.numShots = inv.getStackQuantity(ammoInvId)
                if WeaponGlobals.isInfiniteAmmo(self.getAmmoSkillId()) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), self.getAmmoSkillId()):
                    self.cgui.setAmmoLeft(-1, -1)
                else:
                    self.cgui.setAmmoLeft(self.numShots, maxShots)
                self.updateCannonItems()
                self.updateCannonDressing()
            

        if self._DistributedPCCannon__invRequest:
            DistributedInventoryBase.cancelGetInventory(self._DistributedPCCannon__invRequest)
        
        self._DistributedPCCannon__invRequest = DistributedInventoryBase.getInventory(localAvatar.getInventoryId(), gotInventory)
Пример #8
0
    def destroy(self):
        self.ignoreAll()
        taskMgr.remove('doThreatMessageQueue')
        if self.invReq:
            DistributedInventoryBase.cancelGetInventory(self.invReq)
            self.invReq = None

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

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

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

        self.hpMeterDownIval.pause()
        self.hpMeterUpGreenIval.pause()
        self.hpMeterUpRedIval.pause()
        self.hpMeterUpYellowIval.pause()
        del self.hpMeterDownIval
        del self.hpMeterUpGreenIval
        del self.hpMeterUpRedIval
        del self.hpMeterUpYellowIval
        self.timer = None
        self.anchorButton = None
        GuiTray.GuiTray.destroy(self)
        self.destroyBoardingPermissionPanel()
Пример #9
0
    def cancelAllInventoryRequests(self):
        canceled = False
        for currRequest in self.myInventoryRequests:
            DistributedInventoryBase.cancelGetInventory(currRequest)
            canceled = True

        self.myInventoryRequests = []
        return canceled
Пример #10
0
 def disable(self):
     DistributedInteractive.disable(self)
     if self.invReq:
         DistributedInventoryBase.cancelGetInventory(
             localAvatar.getInventoryId())
         self.invReq = None
     self.get_children().detach()
     return
Пример #11
0
 def cancelAllInventoryRequests(self):
     canceled = False
     for currRequest in self.myInventoryRequests:
         DistributedInventoryBase.cancelGetInventory(currRequest)
         canceled = True
     
     self.myInventoryRequests = []
     return canceled
Пример #12
0
 def exitWaiting(self):
     DistributedInteractive.exitWaiting(self)
     if (self.newState != 'Use' and self).avGameState:
         if localAvatar.getGameState() == 'DinghyInteract':
             localAvatar.b_setGameState(self.avGameState)
             if self.avGameState in ['WaterRoam', 'BattleWaterRoam']:
                 localAvatar.motionFSM.setWaterState(True, True)
                 base.cr.interactionMgr.start()
         self.avGameState = None
     if self.invReq:
         DistributedInventoryBase.cancelGetInventory(localAvatar.getInventoryId())
         self.invReq = None
     return
    def startSellShip(self, storeType):
        self.pickShipGUI = ShipShoppingPanel(PLocalizer.SellShip, doneCallback = self.confirmSellShip, mode = 'sell')

        def inventoryHere(inv):
            self._DistributedShopKeeper__invRequest = None
            if inv:
                for shipId in inv.getShipDoIdList():
                    self.pickShipGUI.addOwnShip(shipId, self.confirmSellShip)

            else:
                self.finishShopping()

        if self._DistributedShopKeeper__invRequest:
            DistributedInventoryBase.cancelGetInventory(self._DistributedShopKeeper__invRequest)

        self._DistributedShopKeeper__invRequest = DistributedInventoryBase.getInventory(localAvatar.getInventoryId(), inventoryHere)
    def startSellShip(self, storeType):
        self.pickShipGUI = ShipShoppingPanel(PLocalizer.SellShip, doneCallback = self.confirmSellShip, mode = 'sell')
        
        def inventoryHere(inv):
            self._DistributedShopKeeper__invRequest = None
            if inv:
                for shipId in inv.getShipDoIdList():
                    self.pickShipGUI.addOwnShip(shipId, self.confirmSellShip)
                
            else:
                self.finishShopping()

        if self._DistributedShopKeeper__invRequest:
            DistributedInventoryBase.cancelGetInventory(self._DistributedShopKeeper__invRequest)
        
        self._DistributedShopKeeper__invRequest = DistributedInventoryBase.getInventory(localAvatar.getInventoryId(), inventoryHere)
Пример #15
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
Пример #16
0
 def exitWaiting(self):
     DistributedInteractive.exitWaiting(self)
     if self.newState != 'Use' and self.avGameState:
         if localAvatar.getGameState() == 'DinghyInteract':
             localAvatar.b_setGameState(self.avGameState)
             if self.avGameState in [
                 'WaterRoam',
                 'BattleWaterRoam']:
                 localAvatar.motionFSM.setWaterState(True, True)
                 base.cr.interactionMgr.start()
             
         
         self.avGameState = None
     
     if self.invReq:
         DistributedInventoryBase.cancelGetInventory(localAvatar.getInventoryId())
         self.invReq = None
Пример #17
0
    def postUpdate(self, cell):
        if (cell and cell).slotId:

            def invArrived(inventory):
                itemData = inventory.getLocatable(cell.slotId)
                if itemData:
                    cell.inventoryItem.amount = itemData.getCount()
                    cell.inventoryItem.updateAmountText()
                self.invReq = None
                return

            if self.invReq:
                DistributedInventoryBase.cancelGetInventory(self.invReq)
            self.invReq = DistributedInventoryBase.getInventory(localAvatar.getInventoryId(), invArrived)
            self.checkReqsForCell(cell)
        avInv = localAvatar.getInventory()
        if avInv and avInv.findAvailableLocation(InventoryType.ItemTypeConsumable) in [Locations.INVALID_LOCATION, Locations.NON_LOCATION]:
            localAvatar.sendRequestContext(InventoryType.InventoryFull)
    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
    def postUpdate(self, cell):
        if cell and cell.slotId:
            
            def invArrived(inventory):
                itemData = inventory.getLocatable(cell.slotId)
                if itemData:
                    cell.inventoryItem.amount = itemData.getCount()
                    cell.inventoryItem.updateAmountText()
                
                self.invReq = None

            if self.invReq:
                DistributedInventoryBase.cancelGetInventory(self.invReq)
            
            self.invReq = DistributedInventoryBase.getInventory(localAvatar.getInventoryId(), invArrived)
            self.checkReqsForCell(cell)
        
        avInv = localAvatar.getInventory()
        if avInv and avInv.findAvailableLocation(InventoryType.ItemTypeConsumable) in [
            Locations.INVALID_LOCATION,
            Locations.NON_LOCATION]:
            localAvatar.sendRequestContext(InventoryType.InventoryFull)
 def destroy(self):
     if self.invReq:
         DistributedInventoryBase.cancelGetInventory(self.invReq)
         self.invReq = None
     
     InventoryUISlotContainer.InventoryUISlotContainer.destroy(self)
Пример #21
0
 def destroy(self):
     if self.invReq:
         DistributedInventoryBase.cancelGetInventory(self.invReq)
         self.invReq = None
     InventoryUISlotContainer.InventoryUISlotContainer.destroy(self)
     return