本文整理汇总了Python中pirates.economy.EconomyGlobals.getItemQuantity方法的典型用法代码示例。如果您正苦于以下问题:Python EconomyGlobals.getItemQuantity方法的具体用法?Python EconomyGlobals.getItemQuantity怎么用?Python EconomyGlobals.getItemQuantity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.economy.EconomyGlobals
的用法示例。
在下文中一共展示了EconomyGlobals.getItemQuantity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadData
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemQuantity [as 别名]
def loadData(self):
itemId = self.data[0]
(item, quantity) = self.data
self.quantity = quantity
itemType = EconomyGlobals.getItemType(itemId)
if itemType <= ItemType.WAND:
itemTypeName = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
else:
itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType)
if itemType <= ItemType.WAND or itemType == ItemType.POTION:
name = PLocalizer.getItemName(itemId)
self.price = ItemGlobals.getGoldCost(itemId)
else:
name = PLocalizer.InventoryTypeNames.get(item)
self.price = EconomyGlobals.getItemCost(item)
if self.sell:
self.price /= 2
if self.buy:
if itemType > ItemType.WAND and itemType != ItemType.POTION:
self.quantity = EconomyGlobals.getItemQuantity(itemId)
self.price *= self.quantity
self.price = int(self.price)
self.name = PLocalizer.makeHeadingString(name, 2)
self.itemType = itemTypeName
if itemType != ItemType.FISHING_LURE:
if itemType != ItemType.POTION:
self.minLvl = ItemGlobals.getWeaponRequirement(itemId)
else:
self.minLvl = 0
else:
self.minLvl = EconomyGlobals.getItemMinLevel(self.data[0])
示例2: __init__
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemQuantity [as 别名]
def __init__(self, uid):
self.uid = uid
self.itemName = PLocalizer.getItemName(uid)
self.shortDesc = PLocalizer.getItemName(uid)
self.longDesc = PLocalizer.getItemFlavorText(uid)
self.text = None
self.modelId = None
self.texId = None
self.colorId = 0
self.holidayId = None
self.icon = None
self.iconScale = 1.0
self.iconHpr = (0, 0, 0)
if self.checkStackable():
self.quantity = EconomyGlobals.getItemQuantity(self.uid)
else:
self.quantity = 1
示例3: setupItems
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemQuantity [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()
示例4: handleBuyItem
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemQuantity [as 别名]
def handleBuyItem(self, data, useCode):
itemId = data[0]
if not itemId:
return None
itemType = EconomyGlobals.getItemType(itemId)
if itemType <= ItemType.WAND or itemType == ItemType.POTION:
data[1] = 1
else:
data[1] = EconomyGlobals.getItemQuantity(itemId)
inventory = base.localAvatar.getInventory()
if not inventory:
return None
itemQuantity = self.purchaseInventory.getItemQuantity(itemId)
currStock = inventory.getStackQuantity(itemId)
currStockLimit = inventory.getStackLimit(itemId)
if useCode == PiratesGuiGlobals.InventoryAdd:
itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType)
trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
if trainingReq:
amt = inventory.getStackQuantity(trainingReq)
if not amt:
base.localAvatar.guiMgr.createWarning(PLocalizer.NoTrainingWarning % itemTypeName, PiratesGuiGlobals.TextFG6)
return None
itemType = EconomyGlobals.getItemType(itemId)
if itemType != ItemType.POTION:
minLvl = ItemGlobals.getWeaponRequirement(itemId)
else:
minLvl = 0
repId = WeaponGlobals.getRepId(itemId)
repAmt = inventory.getAccumulator(repId)
if minLvl > ReputationGlobals.getLevelFromTotalReputation(repId, repAmt)[0]:
base.localAvatar.guiMgr.createWarning(PLocalizer.LevelReqWarning % (minLvl, itemTypeName), PiratesGuiGlobals.TextFG6)
return None
if itemId in ItemGlobals.getAllWeaponIds():
locatables = []
for dataInfo in self.purchaseInventory.inventory:
dataId = dataInfo[0]
if dataId in ItemGlobals.getAllWeaponIds():
locatables.append(InvItem([
InventoryType.ItemTypeWeapon,
dataId,
0]))
continue
locatables.append(InvItem([
InventoryType.ItemTypeWeapon,
itemId,
0]))
locationIds = inventory.canAddLocatables(locatables)
for locationId in locationIds:
if locationId in (Locations.INVALID_LOCATION, Locations.NON_LOCATION):
base.localAvatar.guiMgr.createWarning(PLocalizer.InventoryFullWarning, PiratesGuiGlobals.TextFG6)
return None
continue
elif itemId in ItemGlobals.getAllConsumableIds():
itemQuantity = self.purchaseInventory.getItemQuantity(itemId)
currStock = inventory.getItemQuantity(InventoryType.ItemTypeConsumable, itemId)
currStockLimit = inventory.getItemLimit(InventoryType.ItemTypeConsumable, itemId)
if currStock + itemQuantity >= currStockLimit:
base.localAvatar.guiMgr.createWarning(PLocalizer.TradeItemFullWarning, PiratesGuiGlobals.TextFG6)
return None
if currStock == 0:
locatables = []
dataIds = { }
for dataInfo in self.purchaseInventory.inventory:
dataId = dataInfo[0]
if dataId in ItemGlobals.getAllConsumableIds():
if dataIds.has_key(dataId):
dataIds[dataId] += 1
else:
dataIds[dataId] = 1
dataIds.has_key(dataId)
if dataIds.has_key(itemId):
dataIds[itemId] += 1
else:
dataIds[itemId] = 1
for dataId in dataIds:
locatables.append(InvItem([
InventoryType.ItemTypeConsumable,
dataId,
0,
dataIds[dataId]]))
locationIds = inventory.canAddLocatables(locatables)
for locationId in locationIds:
if locationId in (Locations.INVALID_LOCATION, Locations.NON_LOCATION):
base.localAvatar.guiMgr.createWarning(PLocalizer.InventoryFullWarning, PiratesGuiGlobals.TextFG6)
return None
continue
else:
#.........这里部分代码省略.........