本文整理汇总了Python中pirates.inventory.ItemGlobals.getClass方法的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals.getClass方法的具体用法?Python ItemGlobals.getClass怎么用?Python ItemGlobals.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.inventory.ItemGlobals
的用法示例。
在下文中一共展示了ItemGlobals.getClass方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addTab
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def addTab(self, itemGroup, item):
newTab = self.tabBar.addTab(itemGroup, command = self.setPage, extraArgs = [
itemGroup])
repId = WeaponGlobals.getRepId(item)
if repId:
iconName = ReputationGlobals.RepIcons.get(repId)
if repId == InventoryType.FishingRep:
icon = StoreGUI.FishingIcons.find('**/%s' % iconName)
else:
icon = StoreGUI.WeaponIcons.find('**/%s' % iconName)
elif InventoryType.begin_Consumables <= item:
pass
elif repId or ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
iconName = EconomyGlobals.getItemIcons(item)
icon = StoreGUI.SkillIcons.find('**/%s' % iconName)
elif InventoryType.begin_WeaponCannonAmmo <= item:
pass
elif ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
iconName = EconomyGlobals.getItemIcons(InventoryType.CannonL1)
icon = StoreGUI.WeaponIcons.find('**/%s' % iconName)
elif InventoryType.begin_WeaponGrenadeAmmo <= item:
pass
elif ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
itemId = InventoryType.GrenadeWeaponL1
iconName = EconomyGlobals.getItemIcons(itemId)
icon = StoreGUI.WeaponIcons.find('**/%s' % iconName)
elif InventoryType.begin_FishingLures <= item:
pass
elif ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
icon = StoreGUI.FishingIcons.find('**/pir_t_gui_gen_fish_lure')
else:
icon = None
newTab.nameTag = DirectLabel(parent = newTab, relief = None, state = DGG.DISABLED, image = icon, image_scale = 0.40000000000000002, image_pos = (0, 0, 0.040000000000000001), pos = (0.059999999999999998, 0, -0.035000000000000003))
self.pageNames.append(itemGroup)
示例2: avIsReady
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def avIsReady(self, av):
Locations = Locations
import pirates.inventory.InventoryGlobals
inv = av.getInventory()
if not inv:
return False
categoryId = ItemGlobals.getClass(self.itemId)
if inv.getItemQuantity(categoryId, self.itemId) > 0:
if categoryId == InventoryType.ItemTypeWeapon:
if av.currentWeaponId == itemId:
return True
else:
return False
elif categoryId == InventoryType.ItemTypeCharm:
if av.getCurrentCharm() == self.itemId:
return True
else:
return False
elif categoryId == InventoryType.ItemTypeClothing:
locationRange = Locations.RANGE_EQUIP_CLOTHES
elif categoryId == InventoryType.ItemTypeJewelry:
locationRange = Locations.RANGE_EQUIP_JEWELRY
elif categoryId == InventoryType.ItemTypeTattoo:
locationRange = Locations.RANGE_EQUIP_TATTOO
else:
locationRange = (0, 0)
for location in range(locationRange[0], locationRange[1] + 1):
locatable = inv.getLocatables().get(location)
if locatable and locatable[1] == self.itemId:
return True
continue
return False
示例3: __init__
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def __init__(self, uid):
self.itemClass = ItemGlobals.getClass(uid)
self.itemType = ItemGlobals.getType(uid)
self.cost = ItemGlobals.getGoldCost(uid)
SimpleItem.__init__(self, uid)
self.holidayId = ItemGlobals.getHoliday(uid)
if self.Icons:
self.icon = self.Icons.find('**/%s' % ItemGlobals.getIcon(uid))
示例4: _TradableInventoryBase__runSelfTest_limits
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [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
示例5: getStackQuantity
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def getStackQuantity(self, stackType):
itemClass = None
if isLocatable(stackType):
itemClass = ItemGlobals.getClass(stackType)
if itemClass:
return self.getItemQuantity(itemClass, stackType)
else:
return self.getItemQuantity(stackType)
示例6: cellUsed
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def cellUsed(self, cell):
if self.manager.heldFromCell:
itemId = self.manager.heldFromCell.inventoryItem.getId()
itemInfo = (ItemGlobals.getClass(itemId), itemId, 0, 0)
item = self.manager.makeLocatableItem(itemInfo)
item.inventoryCell = self.manager.heldFromCell
item.amount = 1
self.manager.heldFromCell['state'] = DGG.DISABLED
self.manager.heldFromCell.setColorScale(0.5, 0.5, 0.5, 1)
self.putIntoCell(item, cell)
self.callback(self.manager.heldFromCell)
示例7: getItemRequirements
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def getItemRequirements(self, itemType, otherAdds = []):
if not itemType:
return None
results = { }
if game.process == 'client':
paidStatus = Freebooter.getPaidStatus(self.ownerId)
else:
paidStatus = Freebooter.getPaidStatusAI(self.ownerId)
rarity = ItemGlobals.getRarity(itemType)
if rarity != ItemConstants.CRUDE and not paidStatus:
results['paidStatus'] = (rarity != ItemConstants.CRUDE, False)
itemClass = ItemGlobals.getClass(itemType)
if itemClass == InventoryType.ItemTypeWeapon or itemClass == InventoryType.ItemTypeCharm:
itemRepId = ItemGlobals.getItemRepId(itemType)
itemRep = self.getReputation(itemRepId)
itemLevel = ReputationGlobals.getLevelFromTotalReputation(itemRepId, itemRep)[0]
weaponReq = ItemGlobals.getWeaponRequirement(itemType)
trainingToken = EconomyGlobals.getItemTrainingReq(itemType)
trainingAmt = self.getItemQuantity(trainingToken)
for currAdd in otherAdds:
otherAdd = InvItem(currAdd)
if otherAdd.getCat() == trainingToken and otherAdd.getCount() > 0:
trainingAmt += otherAdd.getCount()
continue
if not weaponReq == None:
pass
weaponLevelPass = itemLevel >= weaponReq
if not trainingToken == 0 and trainingToken == None:
pass
weaponTrainPass = trainingAmt > 0
if weaponLevelPass:
pass
results['itemLevel'] = (weaponReq, weaponTrainPass)
else:
results['itemLevel'] = (0, True)
return results
示例8: setupItems
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def setupItems(self, itemList):
for itemId in itemList:
itemClass = ItemGlobals.getClass(itemId)
itemType = EconomyGlobals.getItemType(itemId)
itemTuple = [
itemClass,
itemId,
0,
0]
item = None
if itemClass == InventoryType.ItemTypeWeapon:
item = self.manager.makeWeaponItem(itemTuple)
elif itemClass == InventoryType.ItemTypeCharm:
item = self.manager.makeCharmItem(itemTuple)
elif itemClass == InventoryType.ItemTypeConsumable:
itemTuple[3] = 1
item = self.manager.makeConsumableItem(itemTuple, showMax = 0)
elif itemClass == InventoryType.ItemTypeClothing:
item = self.manager.makeClothingItem(itemTuple)
elif itemClass == InventoryType.ItemTypeMoney:
item = self.manager.makeGoldItem(itemTuple)
elif itemClass == InventoryType.TreasureCollection:
item = self.manager.makeTreasureItem(itemTuple)
elif itemClass == InventoryType.ItemTypeJewelry:
item = self.manager.makeJewelryItem(itemTuple)
elif itemClass == InventoryType.ItemTypeTattoo:
item = self.manager.makeTattooItem(itemTuple)
elif itemClass == InventoryCategory.CARDS:
cardId = itemId
itemTuple[1] -= InventoryType.begin_Cards
item = self.manager.makeCardItem(cardId, itemTuple, imageScaleFactor = 1.8999999999999999)
elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
item = self.manager.makeAmmoItem(itemId, itemTuple, showMax = 0)
elif itemType in [
EconomyGlobals.ItemType.DAGGERAMMO,
EconomyGlobals.ItemType.PISTOLAMMO,
EconomyGlobals.ItemType.GRENADEAMMO,
EconomyGlobals.ItemType.CANNONAMMO]:
itemTuple = [
0,
itemId,
0,
EconomyGlobals.getItemQuantity(itemId)]
skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
item = self.manager.makeAmmoItem(skillId, itemTuple, showMax = 0)
elif itemType in [
EconomyGlobals.ItemType.PISTOL_POUCH,
EconomyGlobals.ItemType.DAGGER_POUCH,
EconomyGlobals.ItemType.GRENADE_POUCH,
EconomyGlobals.ItemType.CANNON_POUCH,
EconomyGlobals.ItemType.FISHING_POUCH]:
item = self.manager.makePouchItem(itemTuple)
elif itemType in (EconomyGlobals.ItemType.FISHING_LURE,):
itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
itemTuple[3] = EconomyGlobals.getItemQuantity(itemId)
item = self.manager.makeFishingItem(itemId, itemTuple, showMax = 0)
if itemClass in (InventoryType.ItemTypeMoney, InventoryCategory.CARDS, InventoryType.TreasureCollection):
self.addGridCell(self.stackImage, 1.0)
elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
self.addGridCell(self.stackImage2, 1.0)
elif itemType in (EconomyGlobals.ItemType.FISHING_LURE,):
self.addGridCell(self.stackImage, 1.0)
else:
self.addGridCell()
if item:
self.tryPutIntoFirstOpenCell(item)
item.showResaleValue = False
if self.zCount == self.gridZ:
break
while self.zCount < self.gridZ:
self.addGridCell()
示例9: addRewardIntoGrid
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [as 别名]
def addRewardIntoGrid(self, itemId, x, z):
itemInfo = (ItemGlobals.getClass(itemId), itemId, 0, 0)
item = self.manager.makeLocatableItem(itemInfo)
self.putIntoGrid(item, x, z)
示例10: _TradableInventoryBase__runSelfTest_giving
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getClass [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