本文整理汇总了Python中pirates.inventory.ItemGlobals.getRarity方法的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals.getRarity方法的具体用法?Python ItemGlobals.getRarity怎么用?Python ItemGlobals.getRarity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.inventory.ItemGlobals
的用法示例。
在下文中一共展示了ItemGlobals.getRarity方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getHandHeldPropsDict
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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
示例2: checkFreebooter
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [as 别名]
def checkFreebooter(self, itemId, avId):
if ItemGlobals.getRarity(itemId) == ItemGlobals.CRUDE:
return None
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:
return None
if itemId in [
InventoryType.RegularLure]:
return None
if not Freebooter.getPaidStatus(avId):
self.highlightRed(PLocalizer.FreebooterDisallow)
示例3: getPlunderName
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [as 别名]
def getPlunderName(self):
nameText = self.getName()
titleColor = PiratesGuiGlobals.TextFG6
rarity = ItemGlobals.getRarity(self.getId())
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
return (nameText, titleColor)
示例4: getItemRequirements
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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
示例5: canLocalUseItem
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [as 别名]
def canLocalUseItem(self, itemTuple):
canUse = 1
reason = ItemConstants.REASON_NONE
itemCat = itemTuple[0]
itemId = itemTuple[1]
rarity = ItemGlobals.getRarity(itemId)
if rarity != ItemConstants.CRUDE and not Freebooter.getPaidStatus(base.localAvatar.getDoId()):
canUse = 0
reason = ItemConstants.REASON_VELVETROPE
return (canUse, reason)
elif itemCat == InventoryType.ItemTypeClothing:
gender = localAvatar.style.getGender()
if gender == 'm' and ItemGlobals.getMaleModelId(itemId) == -1:
canUse = 0
reason = ItemConstants.REASON_GENDER
return (canUse, reason)
elif gender == 'f' and ItemGlobals.getFemaleModelId(itemId) == -1:
canUse = 0
reason = ItemConstants.REASON_GENDER
return (canUse, reason)
elif itemCat in [
InventoryType.ItemTypeWeapon,
InventoryType.ItemTypeCharm]:
inv = localAvatar.getInventory()
if not inv:
canUse = 0
reason = ItemConstants.REASON_INVENTORY
return (canUse, reason)
reqs = localAvatar.getInventory().getItemRequirements(itemId)
if reqs == None or filter(lambda x: reqs[x][1] == False, reqs):
canUse = 0
reason = ItemConstants.REASON_LEVEL
return (canUse, reason)
return (canUse, reason)
示例6: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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
#.........这里部分代码省略.........
示例7: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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.getTattooTypeName(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 = 'slant%s %s' % (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
headOffset = 0
armOffset = 0
chestOffset = 0
if bodyShape == 0:
bodyOffset = 0.5
if gender == 'm':
headOffset = 0.69999999999999996
armOffset = 0.59999999999999998
chestOffset = 0.5
elif gender == 'f':
headOffset = 0.55000000000000004
armOffset = 0.5
chestOffset = 0.5
elif bodyShape == 1:
bodyOffset = 0.5
if gender == 'm':
headOffset = 0.10000000000000001
armOffset = 0.14999999999999999
elif gender == 'f':
headOffset = 0.40000000000000002
armOffset = 0.40000000000000002
chestOffset = 0.29999999999999999
elif bodyShape == 2:
bodyOffset = 0.5
if gender == 'f':
headOffset = -0.10000000000000001
elif bodyShape == 3:
bodyOffset = 0.5
if gender == 'm':
#.........这里部分代码省略.........
示例8: createHelpbox
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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)
#.........这里部分代码省略.........
示例9: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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
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)
skillIcons = loader.loadModel('models/textureCards/skillIcons')
if itemSubtype == ItemGlobals.POTION_BUFF:
self.iconLabel = DirectLabel(parent = self.portraitSceneGraph, relief = None, image = skillIcons.find('**/%s' % ItemGlobals.getIcon(itemId)), pos = (0.0, 2.5, 0.0))
elif model:
self.realItem = loader.loadModel('models/inventory/' + model, okMissing = True)
if not self.realItem:
self.realItem = loader.loadModel('models/handheld/' + 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])
else:
self.realItem.setPos(0.0, 2.5, -0.40000000000000002)
self.realItem.setHpr(45, 0, 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)
if ItemGlobals.getSubtype(itemId) == 30:
duration = PotionGlobals.getPotionBuffDuration(WeaponGlobals.getSkillEffectFlag(ItemGlobals.getUseSkill(itemId)))
if duration >= 3600:
duration = duration / 3600
if duration == 1:
#.........这里部分代码省略.........
示例10: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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 = ClothingGlobals.getClothingTypeName(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)
clothingType = ItemGlobals.getType(itemId)
if localAvatar.style.getGender() == 'm':
maleModelId = ItemGlobals.getMaleModelId(itemId)
if maleModelId != -1:
modelId = maleModelId
texId = ItemGlobals.getMaleTextureId(itemId)
dna = HumanDNA.HumanDNA(localAvatar.style.gender)
dna.copy(localAvatar.style)
gender = 'm'
else:
modelId = ItemGlobals.getFemaleModelId(itemId)
texId = ItemGlobals.getFemaleTextureId(itemId)
dna = HumanDNA.HumanDNA('f')
gender = 'f'
else:
femaleModelId = ItemGlobals.getFemaleModelId(itemId)
if femaleModelId != -1:
modelId = femaleModelId
texId = ItemGlobals.getFemaleTextureId(itemId)
dna = HumanDNA.HumanDNA(localAvatar.style.gender)
dna.copy(localAvatar.style)
gender = 'f'
else:
modelId = ItemGlobals.getMaleModelId(itemId)
texId = ItemGlobals.getMaleTextureId(itemId)
dna = HumanDNA.HumanDNA('m')
gender = 'm'
bodyShape = localAvatar.style.getBodyShape()
bodyHeight = localAvatar.style.getBodyHeight()
bodyOffset = 0.5
headOffset = 0
topOffset = 0
pantOffset = 0
beltOffset = 0
shoeOffset = 0
if bodyShape == 0:
bodyOffset = 1
headOffset = 0.69999999999999996
#.........这里部分代码省略.........
示例11: showDetails
# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getRarity [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))
#.........这里部分代码省略.........