当前位置: 首页>>代码示例>>Python>>正文


Python ItemGlobals.getSubtype方法代码示例

本文整理汇总了Python中pirates.inventory.ItemGlobals.getSubtype方法的典型用法代码示例。如果您正苦于以下问题:Python ItemGlobals.getSubtype方法的具体用法?Python ItemGlobals.getSubtype怎么用?Python ItemGlobals.getSubtype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pirates.inventory.ItemGlobals的用法示例。


在下文中一共展示了ItemGlobals.getSubtype方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: verifyCombo

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def verifyCombo(self, avId, weaponId, skillId, timestamp):
     if skillId in self.EXCLUDED_SKILLS:
         return 0
     
     combo = self.timers.get(avId)
     if not combo:
         return 0
     
     comboLength = len(combo)
     lastEntry = combo[comboLength - 1]
     lastSkillId = lastEntry[self.SKILLID_INDEX]
     lastTimestamp = lastEntry[self.TIMESTAMP_INDEX]
     subtypeId = ItemGlobals.getSubtype(weaponId)
     if not subtypeId:
         return 0
     
     comboChain = self.COMBO_ORDER.get(subtypeId)
     if not comboChain:
         return 0
     
     repId = WeaponGlobals.getSkillReputationCategoryId(skillId)
     if not repId:
         return 0
     
     if skillId in comboChain:
         index = comboChain.index(skillId)
         requisiteAttack = comboChain[index - 1]
         currentAttack = comboChain[index]
         if lastSkillId != requisiteAttack and lastSkillId != currentAttack and lastSkillId not in self.SPECIAL_SKILLS.get(repId, []):
             return 0
         
     
     return 1
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:35,代码来源:ClientComboDiary.py

示例2: loadData

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [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])
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:36,代码来源:InventoryListItem.py

示例3: loadModel

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def loadModel(self):
     self.prop = self.getModel(self.itemId)
     if ItemGlobals.getSubtype(self.itemId) == ItemGlobals.MUSKET:
         bayonetPart = self.prop.find('**/bayonet')
         if bayonetPart:
             bayonetPart.stash()
         
     
     self.prop.reparentTo(self)
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:11,代码来源:Gun.py

示例4: takeAim

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def takeAim(self, av, skillId = None, ammoSkillId = None):
     if not self.aimTrav:
         return (None, None)
     
     self.aimTrav.traverse(render)
     numEntries = self.aimQueue.getNumEntries()
     if numEntries == 0:
         return (None, None)
     
     self.aimQueue.sortEntries()
     avTeam = av.getTeam()
     (currentWeaponId, isWeaponDrawn) = av.getCurrentWeapon()
     friendlyWeapon = WeaponGlobals.isFriendlyFireWeapon(currentWeaponId)
     if skillId:
         friendlySkill = WeaponGlobals.isFriendlyFire(skillId, ammoSkillId)
     
     for i in range(numEntries):
         entry = self.aimQueue.getEntry(i)
         targetColl = entry.getIntoNodePath()
         if targetColl.node().getIntoCollideMask().hasBitsInCommon(PiratesGlobals.BattleAimOccludeBitmask):
             break
         
         target = self.getObjectFromNodepath(targetColl)
         if target:
             if targetColl.hasNetPythonTag('MonstrousObject'):
                 dist = entry.getSurfacePoint(localAvatar)[1]
             else:
                 dist = target.getY(av)
             targetTeam = target.getTeam()
             if target.gameFSM.state == 'Death':
                 continue
             
             if dist < 0:
                 continue
             
             if not TeamUtils.damageAllowed(target, localAvatar):
                 if not friendlyWeapon:
                     continue
                 
                 if skillId and not friendlySkill:
                     continue
                 
             
             if not self.cr.battleMgr.obeysPirateCode(av, target):
                 if ItemGlobals.getSubtype(av.currentWeaponId) != ItemGlobals.BAYONET:
                     localAvatar.guiMgr.showPirateCode()
                     continue
                 
             
             return (target, dist)
             continue
         continue
     
     return (None, None)
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:56,代码来源:TargetManager.py

示例5: doAttack

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def doAttack(self, attacker, skillId, ammoSkillId, targetId, areaIdList, pos, combo = 0, charge = 0):
     attacker.battleRandom.advanceAttackSeed()
     if targetId:
         if WeaponGlobals.getIsShipSkill(skillId):
             target = base.cr.doId2do.get(targetId)
         elif WeaponGlobals.getIsDollAttackSkill(skillId):
             target = base.cr.doId2do.get(targetId)
         else:
             target = base.cr.doId2do.get(targetId)
             if hasattr(target, 'getSkillEffects'):
                 if WeaponGlobals.C_SPAWN in set(target.getSkillEffects()):
                     return WeaponGlobals.RESULT_MISS
                 
             
             if target and not TeamUtils.damageAllowed(localAvatar, target) and not WeaponGlobals.isFriendlyFire(skillId, ammoSkillId):
                 return WeaponGlobals.RESULT_NOT_AVAILABLE
             
     else:
         target = None
     weaponHit = self.willWeaponHit(attacker, target, skillId, ammoSkillId, charge)
     if combo == -1:
         if localAvatar.wantComboTiming:
             return WeaponGlobals.RESULT_MISS
         
     
     if not WeaponGlobals.getNeedTarget(skillId, ammoSkillId):
         return WeaponGlobals.RESULT_HIT
     
     if not target and not areaIdList:
         messenger.send('tooFar')
         return WeaponGlobals.RESULT_MISS
     
     if target and not self.obeysPirateCode(attacker, target):
         if ItemGlobals.getSubtype(localAvatar.currentWeaponId) == ItemGlobals.BAYONET:
             pass
         if not (WeaponGlobals.getAttackClass(skillId) == WeaponGlobals.AC_COMBAT):
             return WeaponGlobals.RESULT_AGAINST_PIRATE_CODE
         
     if target and not self.targetInRange(attacker, target, skillId, ammoSkillId, pos):
         return WeaponGlobals.RESULT_OUT_OF_RANGE
     
     if target and isinstance(target, DistributedBattleNPC.DistributedBattleNPC):
         if target.getGameState()[0] == 'BreakCombat':
             return WeaponGlobals.RESULT_MISS
         
     
     if target:
         skillEffects = target.getSkillEffects()
         if WeaponGlobals.C_SPAWN in skillEffects:
             return WeaponGlobals.RESULT_MISS
         
     
     messenger.send('properHit')
     return weaponHit
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:56,代码来源:BattleManager.py

示例6: getModel

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [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
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:25,代码来源:Weapon.py

示例7: checkComboExpired

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def checkComboExpired(self, avId, weaponId, skillId, skillResult):
     barTime = 3.0
     curTime = globalClock.getFrameTime()
     for attackerId in self.timers:
         comboLength = len(self.timers[attackerId])
         lastEntry = self.timers[attackerId][comboLength - 1]
         lastSkillId = lastEntry[self.SKILLID_INDEX]
         timestamp = lastEntry[self.TIMESTAMP_INDEX]
         if (barTime + timestamp - curTime) + self.TOLERANCE > 0:
             if attackerId != avId:
                 return 0
             
             subtypeId = ItemGlobals.getSubtype(weaponId)
             if not subtypeId:
                 return 0
             
             repId = WeaponGlobals.getSkillReputationCategoryId(skillId)
             if not repId:
                 return 0
             
             if repId != WeaponGlobals.getRepId(weaponId):
                 return 0
             
             comboChain = self.COMBO_ORDER.get(subtypeId)
             if comboChain:
                 if not self.SPECIAL_SKILLS.get(repId, []):
                     self.notify.warning('No special skills for weapon %s with skill %s, subtype %s, rep %s' % (weaponId, skillId, subtypeId, repId))
                 
                 if skillId in self.SPECIAL_SKILLS.get(repId, []):
                     if lastSkillId not in self.SPECIAL_SKILLS.get(repId, []):
                         return 0
                     
                 elif skillId in comboChain:
                     index = comboChain.index(skillId)
                     if index > 0:
                         requisiteAttack = comboChain[index - 1]
                         if lastSkillId == requisiteAttack:
                             return 0
                         
                     elif not comboLength:
                         return 0
                     
                 
             
     
     return 1
开发者ID:XamarinDeveloper,项目名称:Pirates-Online-Source,代码行数:48,代码来源:ComboDiary.py

示例8: targetedWeaponHit

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [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,
#.........这里部分代码省略.........
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:103,代码来源:DistributedTargetableObject.py

示例9: checkComboExpired

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def checkComboExpired(self, avId, weaponId, skillId, skillResult):
     attacker = base.cr.doId2do.get(avId)
     if not attacker:
         return 0
     
     if skillId in self.EXCLUDED_SKILLS:
         return 0
     
     skillInfo = WeaponGlobals.getSkillAnimInfo(skillId)
     if not skillInfo:
         return 0
     
     barTime = self.TimingCache.get(skillId, None)
     if barTime is None:
         anim = skillInfo[WeaponGlobals.PLAYABLE_INDEX]
         skillAnim = getattr(base.cr.combatAnims, anim)(attacker, skillId, 0, 0, None, skillResult)
         if skillAnim == None:
             return 1
         
         barTime = skillAnim.getDuration()
         self.TimingCache[skillId] = barTime
     
     curTime = globalClock.getFrameTime()
     for attackerId in self.timers:
         comboLength = len(self.timers[attackerId])
         lastEntry = self.timers[attackerId][comboLength - 1]
         lastSkillId = lastEntry[self.SKILLID_INDEX]
         timestamp = lastEntry[self.TIMESTAMP_INDEX]
         if (barTime + timestamp - curTime) + self.TOLERANCE > 0:
             if attackerId != avId:
                 return 0
             
             subtypeId = ItemGlobals.getSubtype(weaponId)
             if not subtypeId:
                 return 0
             
             repId = WeaponGlobals.getSkillReputationCategoryId(skillId)
             if not repId:
                 return 0
             
             if repId != WeaponGlobals.getRepId(weaponId):
                 return 0
             
             comboChain = self.COMBO_ORDER.get(subtypeId)
             if comboChain:
                 if skillId in self.SPECIAL_SKILLS.get(repId, []):
                     if lastSkillId not in self.SPECIAL_SKILLS.get(repId, []):
                         return 0
                     elif lastSkillId == skillId:
                         numHits = WeaponGlobals.getNumHits(skillId)
                         if comboLength < numHits:
                             return 0
                         elif comboLength >= numHits:
                             preMultihitEntry = self.timers[attackerId][comboLength - numHits]
                             preMultihitSkillId = preMultihitEntry[self.SKILLID_INDEX]
                             if preMultihitSkillId != skillId:
                                 return 0
                             
                         
                     
                 elif skillId in comboChain:
                     index = comboChain.index(skillId)
                     if index > 0:
                         requisiteAttack = comboChain[index - 1]
                         if lastSkillId == requisiteAttack:
                             return 0
                         
                         currentAttack = comboChain[index]
                         if lastSkillId == skillId:
                             return 0
                         
                     elif not comboLength:
                         return 0
                     
                 
             
     
     return 1
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:80,代码来源:ClientComboDiary.py

示例10: getAreaList

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def getAreaList(self, skillId, ammoSkillId, target, pos, attackerId, isBoss = False):
     targets = []
     areaShape = WeaponGlobals.getAttackAreaShape(skillId, ammoSkillId)
     if areaShape == WeaponGlobals.AREA_SPHERE:
         self.runSphereAreaCollisions(skillId, ammoSkillId, target, pos)
     elif areaShape == WeaponGlobals.AREA_TUBE:
         self.runTubeAreaCollisions(skillId, ammoSkillId, target, pos)
     elif areaShape == WeaponGlobals.AREA_CONE:
         self.runConeAreaCollisions(skillId, ammoSkillId, target, pos)
     elif areaShape == WeaponGlobals.AREA_OFF:
         return targets
     
     numEntries = self.areaCollQueue.getNumEntries()
     if numEntries == 0:
         return targets
     
     if isBoss and numEntries > WeaponGlobals.BOSS_AREA_TARGETS:
         numEntries = WeaponGlobals.BOSS_AREA_TARGETS
     elif numEntries > WeaponGlobals.MAX_AREA_TARGETS:
         numEntries = WeaponGlobals.MAX_AREA_TARGETS
     
     avTeam = self.avatar.getTeam()
     for i in range(numEntries):
         entry = self.areaCollQueue.getEntry(i)
         potentialTargetColl = entry.getIntoNodePath()
         if potentialTargetColl in self.avatar.aimTubeNodePaths:
             potentialTarget = self.avatar
         else:
             potentialTarget = self.repository.targetMgr.getObjectFromNodepath(potentialTargetColl)
         if potentialTarget:
             potentialTargetId = potentialTarget.getDoId()
             if potentialTargetId == target.getDoId():
                 continue
             
             if potentialTargetId in targets:
                 continue
             
             if not WeaponGlobals.isFriendlyFire(skillId, ammoSkillId):
                 if not TeamUtils.damageAllowed(potentialTarget, self.avatar):
                     if attackerId and potentialTargetId == attackerId:
                         if not WeaponGlobals.isAttackAreaSelfDamaging(skillId, ammoSkillId):
                             continue
                         
                     
                 
             elif attackerId and potentialTargetId == attackerId:
                 if not WeaponGlobals.isAttackAreaSelfDamaging(skillId, ammoSkillId):
                     continue
                 
             
             if TeamUtils.damageAllowed(potentialTarget, self.avatar):
                 skillEffect = WeaponGlobals.getSkillEffectFlag(skillId)
                 if skillEffect != WeaponGlobals.C_ATTUNE:
                     continue
                 
             
             if potentialTarget.gameFSM.state == 'Death':
                 continue
             
             if potentialTarget.gameFSM.state in ('BenchRepair', 'PotionCrafting', 'Fishing'):
                 continue
             
             if not self.repository.battleMgr.obeysPirateCode(self.avatar, potentialTarget):
                 if ItemGlobals.getSubtype(localAvatar.currentWeaponId) == ItemGlobals.BAYONET:
                     pass
                 if not (WeaponGlobals.getAttackClass(skillId) == WeaponGlobals.AC_COMBAT):
                     continue
                 
             targets.append(potentialTargetId)
             continue
         continue
     
     return targets
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:75,代码来源:WeaponBaseBase.py

示例11: aimOverTargetTask

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [as 别名]
 def aimOverTargetTask(self, task):
     if base.localAvatar.hasStickyTargets():
         if isinstance(base.localAvatar.currentWeapon, Doll.Doll):
             target = base.localAvatar.currentTarget
             if target:
                 pt = self.getNearProjectionPoint(target)
                 (pt, distance) = self.getTargetScreenXY(target)
                 self.reticleHolder.setPos(pt)
                 self.reticle.setScale(self.reticleScale / distance)
             else:
                 self.reticleHolder.setPos(self.RETICLE_POS)
                 self.reticle.setScale(self.reticleScale)
         
         return Task.cont
     
     (target, dist) = self.takeAim(base.localAvatar)
     if target:
         monstrous = target.hasNetPythonTag('MonstrousObject')
     else:
         monstrous = False
     dt = globalClock.getDt()
     dt = min(1.0, 8 * dt)
     if self.wantAimAssist and target and not monstrous:
         pt = self.getNearProjectionPoint(target)
         (pt, distance) = self.getTargetScreenXY(target)
         rPos = self.reticleHolder.getPos()
         if not rPos.almostEqual(pt, 0.001):
             nPos = Vec3(rPos)
             nPos += (pt - rPos) * dt
             self.reticleHolder.setPos(nPos)
         
         rScale = self.reticle.getScale()
         if not rScale.almostEqual(Vec3(self.reticleScale), 0.001):
             nScale = Vec3(rScale)
             f = self.reticleScale / distance
             nScale += (Vec3(f, f, f) - rScale) * dt
             nScale.setX(max(self.reticleScale / 1.25, nScale[0]))
             nScale.setY(max(self.reticleScale / 1.25, nScale[1]))
             nScale.setZ(max(self.reticleScale / 1.25, nScale[2]))
             self.reticle.setScale(nScale)
         
     else:
         rPos = self.reticleHolder.getPos()
         if not rPos.almostEqual(self.RETICLE_POS, 0.001):
             nPos = Vec3(rPos)
             nPos += (self.RETICLE_POS - rPos) * dt
             self.reticleHolder.setPos(nPos)
             self.reticle.setScale(self.reticleScale)
         
     if target:
         if TeamUtils.damageAllowed(target, localAvatar):
             self.reticle.setColorScale(1, 1, 1, self.reticleAlpha)
             if base.localAvatar.currentWeapon:
                 repId = WeaponGlobals.getRepId(base.localAvatar.currentWeaponId)
                 baseRange = self.WeaponBaseRange.get(repId)
                 calcRange = 0
                 specialRange = 0
                 specialMeleeRange = 0
                 ammoSkillId = localAvatar.guiMgr.combatTray.ammoSkillId
                 deadzoneRange = base.cr.battleMgr.getModifiedAttackDeadzone(localAvatar, 0, ammoSkillId)
                 if repId == InventoryType.PistolRep:
                     if localAvatar.guiMgr.combatTray.isCharging:
                         calcRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, InventoryType.PistolTakeAim, ammoSkillId)
                     else:
                         calcRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, InventoryType.PistolShoot, ammoSkillId)
                     if ItemGlobals.getSubtype(localAvatar.currentWeaponId) == ItemGlobals.BLUNDERBUSS:
                         baseRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, EnemySkills.PISTOL_SCATTERSHOT, ammoSkillId)
                         calcRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, EnemySkills.PISTOL_SCATTERSHOT, ammoSkillId)
                     elif ItemGlobals.getSubtype(localAvatar.currentWeaponId) == ItemGlobals.MUSKET:
                         specialRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, EnemySkills.PISTOL_DEADEYE, ammoSkillId)
                     elif ItemGlobals.getSubtype(localAvatar.currentWeaponId) == ItemGlobals.BAYONET:
                         specialMeleeRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, EnemySkills.BAYONET_RUSH, 0)
                     
                 elif repId == InventoryType.DaggerRep:
                     calcRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, InventoryType.DaggerAsp, 0)
                 elif repId == InventoryType.WandRep:
                     if ammoSkillId:
                         calcRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, ammoSkillId, 0)
                     
                     specialRange = base.cr.battleMgr.getModifiedAttackRange(localAvatar, InventoryType.StaffBlast, 0)
                 
                 distance = dist
                 if hasattr(target, 'battleTubeNodePaths') and not monstrous:
                     for tube in target.battleTubeNodePaths:
                         tubeLength = max(target.battleTubeRadius, target.battleTubeHeight)
                         if distance - tubeLength < distance:
                             distance -= tubeLength
                             continue
                     
                 
                 range = max(baseRange, calcRange)
                 secondaryRange = max(baseRange, specialRange)
                 if distance <= secondaryRange and distance >= deadzoneRange:
                     self.reticle.setColorScale(1, 0.69999999999999996, 0, self.reticleAlpha)
                 
                 if distance <= range and distance >= deadzoneRange:
                     self.reticle.setColorScale(1, 0, 0, self.reticleAlpha)
                 
                 if specialMeleeRange and distance <= specialMeleeRange:
                     self.reticle.setColorScale(1, 0.69999999999999996, 0, self.reticleAlpha)
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:TargetManager.py

示例12: createHelpbox

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [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)
#.........这里部分代码省略.........
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:103,代码来源:InventoryItemGui.py

示例13: showDetails

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [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:
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:InventoryUIConsumableItem.py

示例14: showDetails

# 需要导入模块: from pirates.inventory import ItemGlobals [as 别名]
# 或者: from pirates.inventory.ItemGlobals import getSubtype [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))
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:InventoryUICharmItem.py


注:本文中的pirates.inventory.ItemGlobals.getSubtype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。