本文整理汇总了Python中pirates.economy.EconomyGlobals.getItemType方法的典型用法代码示例。如果您正苦于以下问题:Python EconomyGlobals.getItemType方法的具体用法?Python EconomyGlobals.getItemType怎么用?Python EconomyGlobals.getItemType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.economy.EconomyGlobals
的用法示例。
在下文中一共展示了EconomyGlobals.getItemType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sortData
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [as 别名]
def sortData(a, b):
aId = a.getData()[0]
bId = b.getData()[0]
aType = EconomyGlobals.getItemType(aId)
bType = EconomyGlobals.getItemType(bId)
if aType == bType:
if aType <= ItemType.WAND or aType == ItemType.POTION:
aSubtype = ItemGlobals.getSubtype(aId)
bSubtype = ItemGlobals.getSubtype(bId)
if aSubtype == bSubtype:
if aType <= ItemType.WAND:
aLevel = ItemGlobals.getWeaponRequirement(aId)
bLevel = ItemGlobals.getWeaponRequirement(bId)
if aLevel == bLevel:
if a.price == b.price:
if aId > bId:
return 1
else:
return -1
elif a.price > b.price:
return 1
else:
return -1
elif aLevel > bLevel:
return 1
else:
return -1
else:
aLevel = ItemGlobals.getNotorietyRequirement(aId)
bLevel = ItemGlobals.getNotorietyRequirement(bId)
if aLevel == bLevel:
if a.price == b.price:
if aId > bId:
return 1
else:
return -1
elif a.price > b.price:
return 1
else:
return -1
elif aLevel > bLevel:
return 1
else:
return -1
elif aSubtype > bSubtype:
return 1
else:
return -1
elif aId > bId:
return 1
else:
return -1
elif aType > bType:
return 1
else:
return -1
示例2: getGeomParams
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [as 别名]
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
示例3: __init__
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [as 别名]
def __init__(self, uid):
SimpleItem.__init__(self, uid)
self.itemClass = EconomyGlobals.getItemCategory(uid)
self.itemType = EconomyGlobals.getItemType(uid)
self.cost = EconomyGlobals.getItemCost(uid)
if not self.cost:
self.cost = ItemGlobals.getGoldCost(uid)
示例4: loadData
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [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])
示例5: createGui
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [as 别名]
def createGui(self):
itemId = self.data[0]
self.itemCount += 1
self.itemQuantity = self.quantity
self.itemCost = self.price
self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, pos = (0.035000000000000003, 0, 0.025000000000000001))
self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ARight, text_wordwrap = 11, pos = (0.1225, 0, 0.014999999999999999))
if len(self.name) >= 39:
textScale = PiratesGuiGlobals.TextScaleMicro * PLocalizer.getHeadingScale(2)
elif len(self.name) >= 35:
textScale = PiratesGuiGlobals.TextScaleTiny * PLocalizer.getHeadingScale(2)
else:
textScale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2)
self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_fg = PiratesGuiGlobals.TextFG2, text_scale = textScale, text_align = TextNode.ALeft, pos = (0.13, 0, 0.014999999999999999))
self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = InventoryListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.0050000000000000001, 0, 0.012500000000000001), text = str(self.price), text_fg = PiratesGuiGlobals.TextFG2, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.014999999999999999), text_font = PiratesGlobals.getInterfaceFont())
itemClass = EconomyGlobals.getItemCategory(itemId)
itemType = EconomyGlobals.getItemType(itemId)
if itemType == ItemType.FISHING_ROD or itemType == ItemType.FISHING_LURE:
asset = EconomyGlobals.getItemIcons(itemId)
if asset:
self.picture['geom'] = PurchaseListItem.fishingIcons.find('**/%s*' % asset)
self.picture['geom_scale'] = 0.040000000000000001
self.picture['geom_pos'] = (0, 0, 0)
elif itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
asset = EconomyGlobals.getItemIcons(itemId)
if asset:
self.picture['geom'] = InventoryListItem.weaponIcons.find('**/%s*' % asset)
self.picture['geom_scale'] = 0.040000000000000001
self.picture['geom_pos'] = (0, 0, 0)
elif itemClass == ItemType.CONSUMABLE:
asset = EconomyGlobals.getItemIcons(itemId)
if asset:
self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s*' % asset)
self.picture['geom_scale'] = 0.040000000000000001
self.picture['geom_pos'] = (0, 0, 0)
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:
self.picture['geom'] = InventoryListItem.skillIcons.find('**/%s' % asset)
self.picture['geom_scale'] = 0.059999999999999998
self.picture['geom_pos'] = (0, 0, 0)
elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
self.picture['geom'] = self.topGui.find('**/main_gui_ship_bottle')
self.picture['geom_scale'] = 0.10000000000000001
self.picture['geom_pos'] = (0, 0, 0)
self.flattenStrong()
示例6: setupItems
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [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()
示例7: showDetails
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [as 别名]
def showDetails(self, cell, detailsPos, detailsHeight, event = None):
self.notify.debug('Item showDetails')
if self.manager.heldItem and self.manager.locked and cell.isEmpty() and self.isEmpty() or not (self.itemTuple):
self.notify.debug(' early exit')
return None
self.helpFrame = DirectFrame(parent = self.manager, relief = None, state = DGG.DISABLED, sortOrder = 1)
self.helpFrame.setBin('gui-popup', -5)
detailGui = loader.loadModel('models/gui/gui_card_detail')
topGui = loader.loadModel('models/gui/toplevel_gui')
coinImage = topGui.find('**/treasure_w_coin*')
SkillIcons = loader.loadModel('models/textureCards/skillIcons')
border = SkillIcons.find('**/base')
halfWidth = 0.29999999999999999
halfHeight = 0.20000000000000001
basePosX = cell.getX(aspect2d)
basePosZ = cell.getZ(aspect2d)
cellSizeX = 0.0
cellSizeZ = 0.0
if cell:
cellSizeX = cell.cellSizeX
cellSizeZ = cell.cellSizeZ
textScale = PiratesGuiGlobals.TextScaleMed
titleScale = PiratesGuiGlobals.TextScaleTitleSmall
if len(self.getName()) >= 30:
titleNameScale = PiratesGuiGlobals.TextScaleLarge
else:
titleNameScale = PiratesGuiGlobals.TextScaleExtraLarge
subtitleScale = PiratesGuiGlobals.TextScaleMed
iconScalar = 1.5
borderScaler = 0.25
splitHeight = 0.01
vMargin = 0.029999999999999999
runningVertPosition = 0.29999999999999999
runningSize = 0.0
labels = []
titleColor = PiratesGuiGlobals.TextFG24
titleLabel = DirectLabel(parent = self, relief = None, text = self.getName(), text_scale = titleNameScale, text_fg = titleColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
self.bg.setColor(titleColor)
tHeight = 0.070000000000000007
titleLabel.setZ(runningVertPosition)
runningVertPosition -= tHeight
runningSize += tHeight
labels.append(titleLabel)
subtitleLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.InventoryItemClassNames.get(EconomyGlobals.getItemType(self.getId()), ''), text_scale = subtitleScale, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
subtHeight = 0.050000000000000003
subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
runningVertPosition -= subtHeight
runningSize += subtHeight
labels.append(subtitleLabel)
MaterialIcons = loader.loadModel('models/textureCards/shipMaterialIcons')
self.iconLabel = DirectLabel(parent = self.portraitSceneGraph, relief = None, image = MaterialIcons.find('**/%s' % EconomyGlobals.getItemIcons(self.getItemId())), pos = (0.0, 2.5, 0.0))
iHeight = 0.17999999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
description = PLocalizer.WeaponDescriptions.get(self.getId())
if not description:
description = PLocalizer.WeaponDescriptions.get(self.getItemId())
if description:
descriptionLabel = DirectLabel(parent = self, relief = None, text = description, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
dHeight = descriptionLabel.getHeight() + 0.02
runningVertPosition -= dHeight
runningSize += dHeight
labels.append(descriptionLabel)
runningVertPosition -= 0.02
runningSize += 0.02
panels = self.helpFrame.attachNewNode('panels')
topPanel = panels.attachNewNode('middlePanel')
detailGui.find('**/top_panel').copyTo(topPanel)
topPanel.setScale(0.080000000000000002)
topPanel.reparentTo(self.helpFrame)
middlePanel = panels.attachNewNode('middlePanel')
detailGui.find('**/middle_panel').copyTo(middlePanel)
middlePanel.setScale(0.080000000000000002)
middlePanel.reparentTo(self.helpFrame)
placement = 0
i = 0
heightMax = -0.080000000000000002
currentHeight = runningVertPosition
if detailsHeight:
currentHeight = -detailsHeight
while currentHeight < heightMax:
middlePanel = panels.attachNewNode('middlePanel%s' % 1)
detailGui.find('**/middle_panel').copyTo(middlePanel)
middlePanel.setScale(0.080000000000000002)
middlePanel.reparentTo(self.helpFrame)
if currentHeight + 0.20000000000000001 >= heightMax:
difference = heightMax - currentHeight
placement += (0.16800000000000001 / 0.20000000000000001) * difference
currentHeight += difference
else:
placement += 0.16800000000000001
currentHeight += 0.20000000000000001
#.........这里部分代码省略.........
示例8: handleBuyItem
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [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:
#.........这里部分代码省略.........
示例9: createHelpbox
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [as 别名]
def createHelpbox(self, args = None):
if self.helpFrame:
return None
itemType = EconomyGlobals.getItemType(self.data[0])
if itemType <= ItemType.WAND or itemType == ItemType.POTION:
itemId = self.data[0]
self.helpFrame = DirectFrame(parent = aspect2d, relief = None, state = DGG.DISABLED, sortOrder = 1)
detailGui = loader.loadModel('models/gui/gui_card_detail')
topGui = loader.loadModel('models/gui/toplevel_gui')
coinImage = topGui.find('**/treasure_w_coin*')
self.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
self.BuffIcons = loader.loadModel('models/textureCards/buff_icons')
border = self.SkillIcons.find('**/base')
halfWidth = 0.29999999999999999
halfHeight = 0.20000000000000001
textScale = PiratesGuiGlobals.TextScaleMed
titleScale = PiratesGuiGlobals.TextScaleTitleSmall
titleNameScale = PiratesGuiGlobals.TextScaleExtraLarge
subtitleScale = PiratesGuiGlobals.TextScaleMed
iconScalar = 1.5
borderScaler = 0.25
splitHeight = 0.01
vMargin = 0.029999999999999999
runningVertPosition = 0.29999999999999999
runningSize = 0.0
labels = []
titleColor = PiratesGuiGlobals.TextFG6
itemColor = 'itemRed'
rarity = ItemGlobals.getRarity(itemId)
rarityText = PLocalizer.getItemRarityName(rarity)
subtypeText = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
if rarity == ItemGlobals.CRUDE:
titleColor = PiratesGuiGlobals.TextFG24
itemColor = 'itemBrown'
elif rarity == ItemGlobals.COMMON:
titleColor = PiratesGuiGlobals.TextFG13
itemColor = 'itemYellow'
elif rarity == ItemGlobals.RARE:
titleColor = PiratesGuiGlobals.TextFG4
itemColor = 'itemGreen'
elif rarity == ItemGlobals.FAMED:
titleColor = PiratesGuiGlobals.TextFG5
itemColor = 'itemBlue'
titleLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemName(itemId), text_scale = titleNameScale, text_fg = titleColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
self.bg.setColor(titleColor)
tHeight = 0.070000000000000007
titleLabel.setZ(runningVertPosition)
runningVertPosition -= tHeight
runningSize += tHeight
labels.append(titleLabel)
subtitleLabel = DirectLabel(parent = self, relief = None, text = '\x01slant\x01%s %s\x02' % (rarityText, subtypeText), text_scale = subtitleScale, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
subtHeight = 0.050000000000000003
subtitleLabel.setZ(subtHeight * 0.5 + runningVertPosition)
runningVertPosition -= subtHeight
runningSize += subtHeight
labels.append(subtitleLabel)
itemType = ItemGlobals.getType(itemId)
itemSubtype = ItemGlobals.getSubtype(itemId)
model = ItemGlobals.getModel(itemId)
if model:
if itemType == ItemGlobals.GRENADE:
self.realItem = loader.loadModel('models/ammunition/' + model)
elif itemType == ItemGlobals.POTION:
self.realItem = loader.loadModel('models/inventory/' + model)
else:
self.realItem = loader.loadModel('models/handheld/' + model)
if self.realItem:
spinBlur = self.realItem.find('**/motion_blur')
if spinBlur:
spinBlur.hide()
if itemSubtype == ItemGlobals.MUSKET:
bayonetPart = self.realItem.find('**/bayonet')
if bayonetPart:
bayonetPart.stash()
posHpr = ItemGlobals.getModelPosHpr(model)
if posHpr:
self.realItem.setPos(posHpr[0], posHpr[1], posHpr[2])
self.realItem.setHpr(posHpr[3], posHpr[4], posHpr[5])
elif itemType == ItemGlobals.SWORD:
self.realItem.setPos(-1.5, 3.0, -0.29999999999999999)
self.realItem.setHpr(90, 170, -90)
elif itemSubtype in (ItemGlobals.MUSKET, ItemGlobals.BAYONET):
self.realItem.setPos(-1.2, 3.0, -0.10000000000000001)
self.realItem.setHpr(0, 135, 10)
elif itemSubtype == ItemGlobals.BLUNDERBUSS:
self.realItem.setPos(-0.29999999999999999, 2.0, 0.0)
self.realItem.setHpr(0, 90, 0)
elif itemType == ItemGlobals.GUN:
self.realItem.setPos(-0.5, 2.0, -0.20000000000000001)
self.realItem.setHpr(0, 90, 0)
elif itemType == ItemGlobals.DOLL:
self.realItem.setPos(0.0, 1.8999999999999999, -0.10000000000000001)
self.realItem.setHpr(0, 90, 180)
elif itemType == ItemGlobals.DAGGER:
self.realItem.setPos(-1.0, 2.0, -0.29999999999999999)
#.........这里部分代码省略.........
示例10: checkLevel
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getItemType [as 别名]
def checkLevel(self, repId, minLvl):
inv = localAvatar.getInventory()
if inv:
repAmt = inv.getAccumulator(repId)
if minLvl > ReputationGlobals.getLevelFromTotalReputation(repId, repAmt)[0]:
self.highlightRed(PLocalizer.LevelRequirement % self.minLvl + ' ' + PLocalizer.InventoryItemClassNames.get(EconomyGlobals.getItemType(self.data[0])))