本文整理汇总了Python中pirates.inventory.ItemGlobals类的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals类的具体用法?Python ItemGlobals怎么用?Python ItemGlobals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ItemGlobals类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadData
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: apply
def apply(self, pirate):
gender = localAvatar.style.getGender()
if gender == 'm':
idx = ItemGlobals.getMaleModelId(self.uid)
else:
idx = ItemGlobals.getFemaleModelId(self.uid)
primaryColor = ItemGlobals.getPrimaryColor(self.uid)
secondaryColor = ItemGlobals.getSecondaryColor(self.uid)
if self.jewelryType == JewelryGlobals.LBROW:
pirate.setJewelryZone3(idx, primaryColor, secondaryColor)
elif self.jewelryType == JewelryGlobals.RBROW:
pirate.setJewelryZone4(idx, primaryColor, secondaryColor)
elif self.jewelryType == JewelryGlobals.LEAR:
pirate.setJewelryZone1(idx, primaryColor, secondaryColor)
elif self.jewelryType == JewelryGlobals.REAR:
pirate.setJewelryZone2(idx, primaryColor, secondaryColor)
elif self.jewelryType == JewelryGlobals.NOSE:
pirate.setJewelryZone5(idx, primaryColor, secondaryColor)
elif self.jewelryType == JewelryGlobals.MOUTH:
pirate.setJewelryZone6(idx, primaryColor, secondaryColor)
elif self.jewelryType == JewelryGlobals.LHAND:
pirate.setJewelryZone7(idx, primaryColor, secondaryColor)
elif self.jewelryType == JewelryGlobals.RHAND:
pirate.setJewelryZone8(idx, primaryColor, secondaryColor)
pirate.model.handleJewelryHiding()
示例3: addTab
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)
示例4: __init__
def __init__(self, manager, itemTuple, imageScaleFactor = 1.0):
InventoryUIItem.InventoryUIItem.__init__(self, manager, itemTuple, imageScaleFactor = imageScaleFactor)
charmIcons = loader.loadModel('models/gui/gui_icons_inventory')
itemType = ItemGlobals.getType(itemTuple[1])
if ItemGlobals.getIcon(itemTuple[1]):
self['image'] = charmIcons.find('**/%s' % ItemGlobals.getIcon(itemTuple[1]))
self['image_scale'] = 0.10000000000000001 * imageScaleFactor
self.helpFrame = None
self.cm = CardMaker('itemCard')
self.cm.setFrame(-0.29999999999999999, 0.29999999999999999, -0.089999999999999997, 0.089999999999999997)
self.buffer = None
self.lens = PerspectiveLens()
self.lens.setNear(0.10000000000000001)
self.lens.setAspectRatio(0.59999999999999998 / 0.17999999999999999)
self.realItem = None
self.itemCard = None
self.portraitSceneGraph = NodePath('PortraitSceneGraph')
detailGui = loader.loadModel('models/gui/gui_card_detail')
self.bg = detailGui.find('**/color')
self.bg.setScale(4)
self.bg.setPos(0, 17, -6.2999999999999998)
self.glow = detailGui.find('**/glow')
self.glow.setScale(3)
self.glow.setPos(0, 17, -6.2999999999999998)
self.glow.setColor(1, 1, 1, 0.80000000000000004)
self.setBin('gui-fixed', 1)
self.accept('open_main_window', self.createBuffer)
self.accept('aspectRatioChanged', self.createBuffer)
self.accept('close_main_window', self.destroyBuffer)
示例5: getEquipRanges
def getEquipRanges(itemCat, itemType, expanded = False):
if itemCat == InventoryType.ItemTypeClothing:
if itemType:
equipType = ItemGlobals.getType(itemType)
ranges = Locations.LOCATION_EQUIP_RANGES_CLOTHING.get(equipType)
else:
ranges = (Locations.RANGE_EQUIP_CLOTHES,)
elif itemCat == InventoryType.ItemTypeJewelry:
if itemType:
equipType = ItemGlobals.getType(itemType)
ranges = Locations.LOCATION_EQUIP_RANGES_JEWELRY.get(equipType)
else:
ranges = (Locations.RANGE_EQUIP_JEWELRY,)
elif itemCat == InventoryType.ItemTypeTattoo:
if itemType:
equipType = ItemGlobals.getType(itemType)
ranges = Locations.LOCATION_EQUIP_RANGES_TATTOO.get(equipType)
else:
ranges = (Locations.RANGE_EQUIP_TATTOO,)
elif itemCat == InventoryType.ItemTypeWeapon:
ranges = (Locations.RANGE_EQUIP_WEAPONS,)
elif itemCat == InventoryType.ItemTypeCharm:
ranges = (Locations.RANGE_EQUIP_ITEMS,)
else:
return None
if expanded:
ranges = expandRanges(ranges)
return ranges
示例6: checkInfamyReq
def checkInfamyReq(self, itemId):
landInfamyLevel = ItemGlobals.getLandInfamyRequirement(itemId)
seaInfamyLevel = ItemGlobals.getSeaInfamyRequirement(itemId)
if landInfamyLevel and TitleGlobals.getRank(TitleGlobals.LandPVPTitle, localAvatar.getInfamyLand()) < landInfamyLevel:
self.highlightRed(PLocalizer.LandInfamyRequirement % landInfamyLevel)
if seaInfamyLevel and TitleGlobals.getRank(TitleGlobals.ShipPVPTitle, localAvatar.getInfamySea()) < seaInfamyLevel:
self.highlightRed(PLocalizer.SeaInfamyRequirement % seaInfamyLevel)
示例7: __init__
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))
示例8: cmp
def cmp(item1, item2):
goldCost1 = ItemGlobals.getGoldCost(item1[1])
if not goldCost1:
goldCost1 = item1[1]
goldCost2 = ItemGlobals.getGoldCost(item2[1])
if not goldCost2:
goldCost2 = item2[1]
return int(goldCost2 - goldCost1)
示例9: getGeomParams
def getGeomParams(itemId):
geomParams = { }
itemType = EconomyGlobals.getItemType(itemId)
if itemType <= ItemType.WAND or itemType == ItemType.POTION:
if itemType == ItemType.POTION:
geomParams['geom'] = InventoryItemGui.skillIcons.find('**/%s' % ItemGlobals.getIcon(itemId))
else:
itemType = ItemGlobals.getType(itemId)
if ItemGlobals.getIcon(itemId):
geomParams['geom'] = InventoryItemGui.weaponIcons.find('**/%s' % ItemGlobals.getIcon(itemId))
geomParams['geom_scale'] = 0.11
geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
else:
itemClass = EconomyGlobals.getItemCategory(itemId)
itemType = EconomyGlobals.getItemType(itemId)
if itemType == ItemType.FISHING_ROD or itemType == ItemType.FISHING_LURE:
asset = EconomyGlobals.getItemIcons(itemId)
if asset:
geomParams['geom'] = InventoryItemGui.fishingIcons.find('**/%s*' % asset)
geomParams['geom_scale'] = 0.11
geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
elif itemClass == ItemType.WEAPON and itemClass == ItemType.POUCH or itemClass == ItemType.AMMO:
asset = EconomyGlobals.getItemIcons(itemId)
if asset:
geomParams['geom'] = InventoryItemGui.weaponIcons.find('**/%s*' % asset)
geomParams['geom_scale'] = 0.11
geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
elif itemClass == ItemType.CONSUMABLE:
asset = EconomyGlobals.getItemIcons(itemId)
if asset:
geomParams['geom'] = InventoryItemGui.skillIcons.find('**/%s*' % asset)
geomParams['geom_scale'] = 0.11
geomParams['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
if not InventoryType.begin_WeaponCannonAmmo <= itemId or itemId <= InventoryType.end_WeaponCannonAmmo:
if (InventoryType.begin_WeaponPistolAmmo <= itemId or itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId) and itemId <= InventoryType.end_WeaponDaggerAmmo:
skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
if skillId:
asset = WeaponGlobals.getSkillIcon(skillId)
if asset:
geomParams['geom'] = InventoryListItem.skillIcons.find('**/%s' % asset)
geomParams['geom_scale'] = 0.14999999999999999
geomParams['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
geomParams['geom'] = InventoryListItem.topGui.find('**/main_gui_ship_bottle')
geomParams['geom_scale'] = 0.10000000000000001
geomParams['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
return geomParams
示例10: __init__
def __init__(self, manager, itemTuple, imageScaleFactor = 1.0, showMax = 1):
InventoryUIStackItem.InventoryUIStackItem.__init__(self, manager, itemTuple, imageScaleFactor = imageScaleFactor, showMax = showMax, update = False)
self.initialiseoptions(InventoryUIConsumableItem)
skillIcons = loader.loadModel('models/textureCards/skillIcons')
self['image'] = skillIcons.find('**/%s' % ItemGlobals.getIcon(self.itemTuple[1]))
self['image_scale'] = 0.10000000000000001 * imageScaleFactor
self.helpFrame = None
self.hasDrunk = False
self.cm = CardMaker('itemCard')
self.cm.setFrame(-0.29999999999999999, 0.29999999999999999, -0.089999999999999997, 0.089999999999999997)
self.buffer = None
self.lens = PerspectiveLens()
self.lens.setNear(0.10000000000000001)
self.lens.setAspectRatio(0.59999999999999998 / 0.17999999999999999)
self.realItem = None
self.iconLabel = None
self.itemCard = None
self.portraitSceneGraph = NodePath('PortraitSceneGraph')
detailGui = loader.loadModel('models/gui/gui_card_detail')
self.bg = detailGui.find('**/color')
self.bg.setScale(4)
self.bg.setPos(0, 17, -6.2999999999999998)
self.glow = detailGui.find('**/glow')
self.glow.setScale(3)
self.glow.setPos(0, 17, -6.2999999999999998)
self.glow.setColor(1, 1, 1, 0.80000000000000004)
self.setBin('gui-fixed', 1)
self.accept('open_main_window', self.createBuffer)
self.accept('aspectRatioChanged', self.createBuffer)
self.accept('close_main_window', self.destroyBuffer)
示例11: getName
def getName(self):
itemTypeName = PLocalizer.getItemName(self.getId())
clothingName = PLocalizer.TailorColorStrings.get(self.getColorId())
if ItemGlobals.canDyeItem(self.getId()):
return clothingName + ' ' + itemTypeName
else:
return itemTypeName
示例12: avIsReady
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
示例13: playOuch
def playOuch(
self,
skillId,
ammoSkillId,
targetEffects,
attacker,
pos,
itemEffects=[],
multihit=0,
targetBonus=0,
skillResult=0,
):
if self.isDisabled():
return None
if (
hasattr(attacker, "currentWeaponId")
and ItemGlobals.getWeaponAttributes(attacker.currentWeaponId, ItemGlobals.ANTI_VOODOO_ZOMBIE)
and self.avatarType.isA(AvatarTypes.VoodooZombie)
):
self.doAntiEffect()
DistributedBattleNPC.DistributedBattleNPC.playOuch(
self,
skillId,
ammoSkillId,
targetEffects,
attacker,
pos,
multihit=multihit,
targetBonus=targetBonus,
skillResult=skillResult,
)
示例14: getItemLimit
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
示例15: getBlurColor
def getBlurColor(self):
colorId = ItemGlobals.getVfxType1(self.itemId)
motion_trail_color = self.motion_color.get(colorId)
if not motion_trail_color:
motion_trail_color = self.motion_color.get(ItemGlobals.MotionBlurDefault)
return motion_trail_color[2]