当前位置: 首页>>代码示例>>Python>>正文


Python ItemGlobals.getStackLimit方法代码示例

本文整理汇总了Python中pirates.inventory.ItemGlobals.getStackLimit方法的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals.getStackLimit方法的具体用法?Python ItemGlobals.getStackLimit怎么用?Python ItemGlobals.getStackLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pirates.inventory.ItemGlobals的用法示例。


在下文中一共展示了ItemGlobals.getStackLimit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getItemLimit

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getStackLimit [as 别名]
def getItemLimit(category, type = None):
    if category == InventoryType.ItemTypeMoney or category == InventoryType.ItemTypeMoneyWagered:
        return GOLD_CAP
    elif itemStoresLocation(category) and type:
        return ItemGlobals.getStackLimit(type)
    else:
        return None
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:9,代码来源:InventoryGlobals.py

示例2: updateAmountText

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getStackLimit [as 别名]
 def updateAmountText(self):
     inv = localAvatar.getInventory()
     if not inv:
         return None
     
     limit = ItemGlobals.getStackLimit(self.getId())
     if not limit:
         limit = inv.getStackLimit(self.getId())
     
     if self.showMax:
         self['text'] = '%s/%s' % (self.amount, limit)
     else:
         self['text'] = '%s' % self.amount
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:15,代码来源:InventoryUIStackItem.py

示例3: _TradableInventoryBase__runSelfTest_limits

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getStackLimit [as 别名]
    def _TradableInventoryBase__runSelfTest_limits(self, itemCatFilter, verbose):
        itemIds = ItemGlobals.getAllItemIds()
        for currItemId in itemIds:
            if itemCatFilter != None and itemCatFilter != ItemGlobals.getClass(currItemId):
                continue

            itemIds = ItemGlobals.getAllConsumableIds()
            itemLimit = ItemGlobals.getStackLimit(currItemId)
            itemCat = ItemGlobals.getClass(currItemId)
            quantity = self.getItemQuantity(itemCat, currItemId)
            if isStackableType(itemCat):
                pass
            1
            if verbose:
                if not itemLimit:
                    pass
                print 'item limit for item %s:%s passed (quantity: %s limit:%s)' % (itemCat, currItemId, quantity, 1)
                continue
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:20,代码来源:TradableInventoryBase.py

示例4: _TradableInventoryBase__runSelfTest_giving

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getStackLimit [as 别名]
    def _TradableInventoryBase__runSelfTest_giving(self, itemCatFilter, itemTypeFilter = None, count = None, verbose = None):
        itemIds = ItemGlobals.getAllItemIds()
        for currItemId in itemIds:
            itemCat = ItemGlobals.getClass(currItemId)
            if itemCatFilter != None and itemCat != itemCatFilter:
                continue

            if not count and ItemGlobals.getStackLimit(currItemId):
                pass
            actualCount = None
            testItem = self.getTestItem(itemCat, currItemId, count = actualCount)
            if game.process == 'ai':

                def tradeSuccess(tradeObj):
                    if verbose:
                        print '  trade success'

                    self.testPending = False


                def tradeFail(tradeObj, reason):
                    reasonStr = reason
                    RejectCode = RejectCode
                    import otp.uberdog.RejectCode
                    for currCode in RejectCode.__dict__.keys():
                        if reason == RejectCode.__dict__[currCode]:
                            reasonStr = currCode
                            continue

                    if verbose:
                        print '  trade fail %s (%s)' % (reasonStr, tradeObj)

                    if reason == RejectCode.OVERFLOW:
                        for currGiving in tradeObj.giving:
                            checkItem = InvItem(currGiving)
                            itemCat = checkItem.getCat()
                            if not itemCat == InventoryType.ItemTypeWeapon:
                                pass
                            ranges = self.getPossibleLocations(itemCat, checkItem.getType(), itemCat == InventoryType.ItemTypeCharm)
                            for currRange in ranges:
                                minVal = currRange[0]
                                if len(currRange) > 1:
                                    maxVal = currRange[1]
                                else:
                                    maxVal = minVal
                                for currLocation in range(minVal, maxVal + 1):
                                    if not self._locatableItems.has_key(currLocation):
                                        print '    WARNING: trade %s failed with overflow when it should not have %s' % (tradeObj, currLocation)
                                        continue



                    elif reason == RejectCode.UNDERFLOW:
                        print '    WARNING: trade %s failed with underflow when it should not have' % tradeObj

                    self.testPending = False


                def tradeTimeout(tradeObj):
                    if verbose:
                        print '  trade timeout'

                    self.testPending = False

                AIMagicWordTrade = AIMagicWordTrade
                import pirates.uberdog.AIMagicWordTrade
                trade = AIMagicWordTrade(self, self.doId, self.ownerId)

                def removeSetup(tradeObj, removeCat, removeType):
                    ranges = self.getPossibleLocations(removeCat, removeType, False)
                    itemToRemove = self._locatableItems.get(ranges[0][0])
                    tradeObj.takeItem(itemToRemove)

                trade.setSuccessCallback(tradeSuccess)
                trade.setFailureCallback(tradeFail)
                trade.setTimeoutCallback(tradeTimeout)
                self.selfTestTrades.insert(0, (lambda param1 = trade, param2 = itemCat, param3 = testItem.getType(): removeSetup(param1, param2, param3), trade))
                AIGift = AIGift
                import pirates.uberdog.AIGift
                trade = AIGift(self, GiftOrigin.MAGIC_WORD, self.doId, self.ownerId)
                trade.giveItem(testItem)
                trade.setSuccessCallback(tradeSuccess)
                trade.setFailureCallback(tradeFail)
                trade.setTimeoutCallback(tradeTimeout)
                self.selfTestTrades.insert(1, (None, trade))
                continue
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:88,代码来源:TradableInventoryBase.py


注:本文中的pirates.inventory.ItemGlobals.getStackLimit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。