本文整理汇总了Python中pirates.inventory.ItemGlobals.getType方法的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals.getType方法的具体用法?Python ItemGlobals.getType怎么用?Python ItemGlobals.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.inventory.ItemGlobals
的用法示例。
在下文中一共展示了ItemGlobals.getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getEquipRanges
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
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
示例2: getHandHeldPropsDict
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def getHandHeldPropsDict(
versionFilter=None,
rarityFilter=None,
isFromLoot=True,
isFromShop=True,
isFromQuest=True,
isFromPromo=True,
isFromPVP=True,
isFromNPC=True,
):
resultDict = {}
for weaponId in ItemGlobals.getHumanWeaponTypes():
toBeAdded = True
name = ItemGlobals.getModel(weaponId)
if versionFilter is not None:
toBeAdded = ItemGlobals.getVersion(weaponId) == versionFilter
if toBeAdded and rarityFilter is not None:
toBeAdded = ItemGlobals.getRarity(weaponId) == rarityFilter
if not isFromLoot or ItemGlobals.isFromLoot(weaponId):
if not isFromShop or ItemGlobals.isFromShop(weaponId):
if not isFromQuest or ItemGlobals.isFromQuest(weaponId):
if not isFromPromo or ItemGlobals.isFromPromo(weaponId):
if (isFromPVP or ItemGlobals.isFromPVP(weaponId)) and isFromNPC:
pass
toBeAdded &= ItemGlobals.isFromNPC(weaponId)
if toBeAdded:
if ItemGlobals.getType(weaponId) == ItemGlobals.GRENADE:
resultDict[name] = "models/ammunition/%s" % name
else:
resultDict[name] = "models/handheld/%s" % name
ItemGlobals.getType(weaponId) == ItemGlobals.GRENADE
if not versionFilter is not None and rarityFilter is not None:
if isFromLoot == True and isFromShop == True and isFromQuest == True and isFromPromo == True:
pass
if not (isFromPVP == True):
return resultDict
for key in INTERACT_ANIMS.keys():
allIdles = INTERACT_ANIMS[key].get("idles")
if allIdles:
if type(allIdles) is type({}):
props = allIdles.get(3003).get("props")
else:
props = INTERACT_ANIMS[key].get("props")
if props:
if isinstance(props[0], list):
prop = props[0][0]
else:
prop = props[0]
if prop:
name = prop[prop.rfind("/") + 1 :]
resultDict[name] = prop
return resultDict
示例3: __init__
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
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)
示例4: __init__
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [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))
示例5: getItemTrainingReq
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def getItemTrainingReq(itemId):
typeId = ItemGlobals.getType(itemId)
if typeId:
return __itemTrainingList.get(typeId)
item = __itemList.get(itemId)
if item:
return item[6]
else:
return 0
示例6: getItemType
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def getItemType(itemId):
typeId = ItemGlobals.getType(itemId)
if typeId:
return __itemTypeNameList.get(typeId)
item = __itemList.get(itemId)
if item:
return item[2]
else:
return None
示例7: getGeomParams
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [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
示例8: startFollowAim
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def startFollowAim(self):
self.reticleHolder.setPos(self.RETICLE_POS)
self.reticle.setScale(self.reticleScale)
typeId = ItemGlobals.getType(localAvatar.currentWeaponId)
if (typeId or typeId not in self.TypesWithoutReticles or not typeId) and localAvatar.currentWeaponId not in self.WeaponsWithoutReticles:
self.reticleHolder.reparentTo(aspect2d)
self.reticle.setColorScale(1, 1, 1, self.reticleAlpha)
self.reticleHolder.show()
base.localAvatar.currentAimOver = None
self.aimRayNodePath.setPos(0, 0, 1)
taskMgr.remove('aimOverTarget')
taskMgr.add(self.aimOverTargetTask, 'aimOverTarget', priority = 41)
示例9: createGui
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def createGui(self):
itemId = self.data[0]
(item, quantity) = self.data
name = ItemGlobals.getName(item)
itemType = ItemGlobals.getType(item)
itemTypeName = name
repCategory = ItemGlobals.getItemRepId(itemId)
if quantity:
repValue = localAvatar.getInventory().getReputation(repCategory)
self.repMeter = ReputationMeter(repCategory, width = 0.66000000000000003)
self.repMeter.setPos(0.62, 0, 0.041000000000000002)
self.repMeter.update(repValue)
self.repMeter.reparentTo(self)
self.repMeter.flattenLight()
hotkeyLabel = ''
hotkeys = ()
desc = PLocalizer.WeaponDescriptions.get(itemId)
helpText = PLocalizer.InventoryTypeNames[repCategory]
self.weaponButton = CombatTray.WeaponButton(hotkeys = hotkeys, hotkeyLabel = hotkeyLabel, helpOpaque = True, helpText = helpText, parent = self, showQuant = 0, pos = (0.10000000000000001, 0, -0.02), scale = 1.1000000000000001)
self.weaponButton.ignoreHotkeys()
self.weaponButton.setWeaponId(itemId)
self.weaponButton['extraArgs'] = [
itemId]
self.weaponButton.helpDelay = 0
self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.WeaponAlreadyUnlocked, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001), text_font = PiratesGlobals.getInterfaceFont())
else:
self.repMeter = None
name = PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames[repCategory], 2)
self.categoryLabel = DirectLabel(parent = self, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.059999999999999998), textMayChange = 0)
self.weaponButton = CombatTray.WeaponButton(parent = self, state = DGG.DISABLED, showQuant = 0, scale = 1.1000000000000001)
self.weaponButton.setPos(0.10000000000000001, 0, -0.02)
self.weaponButton.setWeaponId(itemId)
self.weaponButton.helpDelay = 0
self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
unlockDesc = PLocalizer.WeaponUnlockText[repCategory]
self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = unlockDesc, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.025000000000000001), text_font = PiratesGlobals.getInterfaceFont())
self.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1, 1)
示例10: getModel
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def getModel(self, itemId):
if self.modelId:
if ItemGlobals.getType(self.itemId) == ItemGlobals.GRENADE:
itemId = 'models/ammunition/' + self.modelId
elif ItemGlobals.getSubtype(self.itemId) == ItemGlobals.QUEST_PROP_TORCH:
itemId = 'models/props/' + self.modelId
elif ItemGlobals.getSubtype(self.itemId) == ItemGlobals.HEALING:
itemId = 'models/inventory/' + self.modelId
else:
itemId = 'models/handheld/' + self.modelId
model = self.models.get(itemId)
if not model:
self.notify.error('failed to load %s, phases complete 3:%s 4:%s 5:%s' % (itemId, launcher.getPhaseComplete(3), launcher.getPhaseComplete(4), launcher.getPhaseComplete(5)))
lod = model.find('**/+LODNode')
if lod:
lastSwitch = lod.getNumChildren() - 1
switchOut = lod.node().getOut(lastSwitch)
lod.node().setSwitch(lastSwitch, 1000, switchOut)
model = model.copyTo(NodePath())
return model
示例11: targetedWeaponHit
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def targetedWeaponHit(self, skillId, ammoSkillId, skillResult, targetEffects, attacker, pos, charge = 0, delay = None, multihit = 0, itemEffects = []):
if self == attacker:
if not targetEffects[0] and targetEffects[1] and targetEffects[2] and targetEffects[3] > 0:
pass
if not targetEffects[4] and not WeaponGlobals.isSelfUseSkill(skillId):
return None
if not delay:
(targetPos, time, impactT) = self.getProjectileInfo(skillId, attacker)
if impactT:
delay = impactT
else:
delay = WeaponGlobals.getAttackReactionDelay(skillId, ammoSkillId)
if WeaponGlobals.getIsDollAttackSkill(skillId):
delay += random.uniform(0.0, 0.5)
if attacker and attacker.isLocal():
self.localAttackedMe()
centerEffect = WeaponGlobals.getCenterEffect(skillId, ammoSkillId)
if self.hasNetPythonTag('MonstrousObject'):
pass
elif not centerEffect == 2:
if not self.avatarType.isA(AvatarTypes.Stump) and self.avatarType.isA(AvatarTypes.FlyTrap) and self.avatarType.isA(AvatarTypes.GiantCrab):
pass
if not self.avatarType.isA(AvatarTypes.CrusherCrab):
mult = 0.66600000000000004
if self.avatarType.isA(AvatarTypes.GiantCrab) or self.avatarType.isA(AvatarTypes.CrusherCrab):
mult = 0.10000000000000001
elif self.avatarType.isA(AvatarTypes.RockCrab):
mult = 0.20000000000000001
pos = Vec3(0, 0, self.height * mult)
elif centerEffect == 1:
newZ = attacker.getZ(self)
pos = Vec3(0, 0, newZ + attacker.height * 0.66600000000000004)
else:
newPos = self.cr.targetMgr.getAimHitPos(attacker)
if newPos:
pos = Vec3(newPos[0], newPos[1], newPos[2] + 1.5)
else:
centerEffect = WeaponGlobals.getCenterEffect(skillId, ammoSkillId)
if centerEffect >= 1:
pos = Vec3(0, 0, self.height * 0.66600000000000004)
weaponSubType = None
if attacker and attacker.currentWeapon:
weaponType = ItemGlobals.getType(attacker.currentWeapon.itemId)
if weaponType in [
ItemGlobals.SWORD]:
weaponSubType = ItemGlobals.getSubtype(attacker.currentWeapon.itemId)
elif attacker.currentWeapon.getName() in [
'sword']:
weaponSubType = ItemGlobals.CUTLASS
if delay > 0.0:
taskMgr.doMethodLater(delay, self.playHitSound, self.taskName('playHitSoundTask'), extraArgs = [
skillId,
ammoSkillId,
skillResult,
weaponSubType])
else:
self.playHitSound(skillId, ammoSkillId, skillResult, weaponSubType)
if skillResult in [
WeaponGlobals.RESULT_HIT,
WeaponGlobals.RESULT_MISTIMED_HIT,
WeaponGlobals.RESULT_REFLECTED]:
bonus = 0
if bonus:
targetEffects[0] -= bonus
if skillResult == WeaponGlobals.RESULT_MISTIMED_HIT:
if type(targetEffects) is types.TupleType:
targetEffects = (int(targetEffects[0] * WeaponGlobals.MISTIME_PENALTY),) + targetEffects[1:]
else:
targetEffects[0] = int(targetEffects[0] * WeaponGlobals.MISTIME_PENALTY)
if delay > 0.0:
taskMgr.doMethodLater(delay, self.playOuch, self.taskName('playOuchTask'), extraArgs = [
skillId,
ammoSkillId,
targetEffects,
attacker,
pos,
itemEffects,
multihit,
0,
skillResult])
else:
self.playOuch(skillId, ammoSkillId, targetEffects, attacker, pos, itemEffects, multihit, skillResult = skillResult)
if bonus:
taskMgr.doMethodLater(WeaponGlobals.COMBO_DAMAGE_DELAY, self.playOuch, self.taskName('playBonusOuchTask'), extraArgs = [
skillId,
ammoSkillId,
[
bonus,
0,
0,
#.........这里部分代码省略.........
示例12: makeItem
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def makeItem(self, itemId, index):
checkBox = CheckButton(parent = self, relief = None, scale = 0.34999999999999998, value = self.isItemEquipped(itemId), pos = (-0.17000000000000001, 0, -0.41999999999999998 - index * 0.074999999999999997), state = DGG.DISABLED)
typeText = ClothingGlobals.getClothingTypeName(ItemGlobals.getType(itemId))
label = DirectLabel(parent = self, relief = None, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG0, text_align = TextNode.ALeft, text = typeText, pos = (-0.12, 0, -0.42999999999999999 - index * 0.074999999999999997))
return (checkBox, label)
示例13: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [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() or not (self.itemTuple):
self.notify.debug(' early exit')
return None
itemId = self.getId()
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*')
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.TextFG6
rarity = ItemGlobals.getRarity(itemId)
rarityText = PLocalizer.getItemRarityName(rarity)
typeText = PLocalizer.getJewelryTypeName(ItemGlobals.getType(itemId))
if rarity == ItemGlobals.CRUDE:
titleColor = PiratesGuiGlobals.TextFG24
elif rarity == ItemGlobals.COMMON:
titleColor = PiratesGuiGlobals.TextFG13
elif rarity == ItemGlobals.RARE:
titleColor = PiratesGuiGlobals.TextFG4
elif rarity == ItemGlobals.FAMED:
titleColor = PiratesGuiGlobals.TextFG5
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 = '\x001slant\x001%s %s\x002' % (rarityText, typeText), 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)
gender = localAvatar.style.gender
dna = HumanDNA.HumanDNA(gender)
dna.copy(localAvatar.style)
bodyShape = localAvatar.style.getBodyShape()
bodyHeight = localAvatar.style.getBodyHeight()
bodyOffset = 0.5
browOffset = 0
earOffset = 0
noseOffset = 0
mouthOffset = 0
handOffset = 0
if bodyShape == 0:
bodyOffset = 0.5
if gender == 'm':
browOffset = 0.75
earOffset = 0.65000000000000002
noseOffset = 0.69999999999999996
mouthOffset = 0.75
handOffset = 0.40000000000000002
elif gender == 'f':
browOffset = 0.55000000000000004
earOffset = 0.55000000000000004
noseOffset = 0.45000000000000001
mouthOffset = 0.65000000000000002
handOffset = 0.29999999999999999
elif bodyShape == 1:
bodyOffset = 0.5
if gender == 'm':
browOffset = 0.20000000000000001
earOffset = 0.20000000000000001
noseOffset = 0.10000000000000001
mouthOffset = 0.20000000000000001
handOffset = 0.20000000000000001
elif gender == 'f':
browOffset = 0.5
earOffset = 0.5
noseOffset = 0.40000000000000002
#.........这里部分代码省略.........
示例14: cellRightClick
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [as 别名]
def cellRightClick(self, cell, mouseAction=MOUSE_CLICK, task=None):
if mouseAction == MOUSE_PRESS and cell.inventoryItem and self.manager.heldItem == None:
if localAvatar.guiMgr.combatTray.isUsingSkill or localAvatar.guiMgr.combatTray.isCharging:
localAvatar.guiMgr.createWarning(PLocalizer.NoSwitchingItemsWarning, PiratesGuiGlobals.TextFG6)
return None
rangeData = self.rightClickAction.get(cell.inventoryItem.getCategory())
if rangeData == None:
return None
flatRange = rangeData[0]
rangeTypeDict = rangeData[1]
canRightClickReplace = rangeData[2]
destCell = None
if flatRange:
if len(flatRange) > 1:
slotRange = range(flatRange[0], flatRange[1] + 1)
else:
slotRange = (flatRange[0],)
for slotId in slotRange:
destSlot = slotId
testCell = self.manager.slotToCellMap.get(destSlot)
itemInfo = cell.inventoryItem.itemTuple
itemType = ItemGlobals.getType(itemInfo[1])
if self.manager.isSlotPending(destSlot):
continue
if testCell.inventoryItem and ItemGlobals.getType(testCell.inventoryItem.itemTuple[1]) == itemType:
destCell = testCell
continue
if testCell.inventoryItem == None:
destCell = testCell
break
continue
elif rangeTypeDict:
itemInfo = cell.inventoryItem.itemTuple
itemType = ItemGlobals.getType(itemInfo[1])
subtypeRange = rangeTypeDict.get(itemType)
if len(subtypeRange) > 1:
slotRange = range(subtypeRange[0], subtypeRange[1] + 1)
else:
slotRange = (subtypeRange[0],)
if slotRange:
for slotId in slotRange:
destSlot = slotId
destCell = self.manager.slotToCellMap.get(destSlot)
if destCell.inventoryItem == None:
break
continue
if destCell and cell.inventoryItem and not self.manager.isSlotPending(destCell.slotId):
if self.manager.testCanUse(cell.inventoryItem.itemTuple):
self.manager.putIntoHeld(cell.inventoryItem, cell)
if destCell.inventoryItem:
if canRightClickReplace:
self.manager.swapHeldWithCell(destCell)
else:
self.manager.displaySlotFullReason()
else:
self.manager.placeHeldIntoCell(destCell)
else:
self.manager.displayReasonNoUse(popUp=0)
self.manager.releaseHeld()
示例15: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getType [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
inv = localAvatar.getInventory()
if not inv:
return None
itemId = self.getId()
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*')
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
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.TextFG6
rarity = ItemGlobals.getRarity(itemId)
rarityText = PLocalizer.getItemRarityName(rarity)
subtypeText = PLocalizer.getItemSubtypeName(ItemGlobals.getSubtype(itemId))
if rarity == ItemGlobals.CRUDE:
titleColor = PiratesGuiGlobals.TextFG24
elif rarity == ItemGlobals.COMMON:
titleColor = PiratesGuiGlobals.TextFG13
elif rarity == ItemGlobals.RARE:
titleColor = PiratesGuiGlobals.TextFG4
elif rarity == ItemGlobals.FAMED:
titleColor = PiratesGuiGlobals.TextFG5
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 = 'slant%s %s' % (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:
self.realItem = loader.loadModel('models/inventory/' + model)
if self.realItem:
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 itemSubtype == ItemGlobals.RAM:
self.realItem.setPos(-1.5, 1.5, -0.59999999999999998)
self.realItem.setHpr(70, 160, -90)
else:
self.realItem.setPos(0.0, 1.5, -0.059999999999999998)
self.realItem.setHpr(0, 90, 0)
self.realItem.reparentTo(self.portraitSceneGraph)
iHeight = 0.17999999999999999
self.createBuffer()
self.itemCard.setZ(runningVertPosition - 0.059999999999999998)
runningVertPosition -= iHeight
runningSize += iHeight
labels.append(self.itemCard)
goldLabel = DirectLabel(parent = self, relief = None, image = coinImage, image_scale = 0.12, image_pos = Vec3(0.025000000000000001, 0, -0.02), text = str(int(ItemGlobals.getGoldCost(itemId) * ItemGlobals.GOLD_SALE_MULTIPLIER)), text_scale = subtitleScale, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (halfWidth - 0.050000000000000003, 0.0, runningVertPosition + 0.080000000000000002), text_pos = (0.0, -textScale))
labels.append(goldLabel)
specialAttack = ItemGlobals.getSpecialAttack(itemId)
if specialAttack:
attackIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(specialAttack))
specialAttackNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.10000000000000001, geom = attackIcon, geom_scale = 0.10000000000000001, image_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), geom_pos = (-0.070000000000000007, 0.0, -0.050000000000000003), text = PLocalizer.getInventoryTypeName(specialAttack), text_scale = PiratesGuiGlobals.TextScaleLarge, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, text_fg = titleColor, text_font = PiratesGlobals.getInterfaceOutlineFont(), pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
#.........这里部分代码省略.........