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


Python WeaponGlobals.getSkillMaxQuantity方法代码示例

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


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

示例1: updateSkillTrayAmounts

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillMaxQuantity [as 别名]
 def updateSkillTrayAmounts(self):
     if not self.traySkillMap:
         return None
     
     if self.weaponMode not in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
         return None
     
     if not hasattr(base, 'localAvatar'):
         return None
     
     inv = localAvatar.getInventory()
     if not inv:
         return None
     
     self.numberOfItems = len(self.traySkillMap)
     for i in range(self.numberOfItems):
         if self.tray[i + 1].greyOut == -1:
             continue
         
         skillId = self.traySkillMap[i]
         maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
         if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
             ammoAmt = WeaponGlobals.INF_QUANT
         else:
             ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
             ammoAmt = inv.getStackQuantity(ammoInvId)
             ammoMax = inv.getStackLimit(ammoInvId)
         self.tray[i + 1].updateQuantity(ammoAmt)
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:30,代码来源:RadialMenu.py

示例2: updateSkillTrayStates

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillMaxQuantity [as 别名]
 def updateSkillTrayStates(self):
     if not self.traySkillMap:
         return None
     
     if not hasattr(base, 'localAvatar'):
         return None
     
     inv = localAvatar.getInventory()
     if not inv:
         return None
     
     self.numberOfItems = len(self.traySkillMap)
     for i in range(self.numberOfItems):
         skillId = self.traySkillMap[i]
         greyOut = 0
         if self.tray[i + 1].greyOut == -1:
             continue
         
         if self.tray[i + 1].showQuantity:
             maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
             if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
                 quantity = WeaponGlobals.INF_QUANT
             else:
                 ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
                 quantity = inv.getStackQuantity(ammoInvId)
             if quantity == 0:
                 greyOut = 1
             
         
         if localAvatar.mojo < -1 * WeaponGlobals.getMojoCost(skillId):
             greyOut = 1
         
         if localAvatar.ship:
             if (skillId == InventoryType.SailBroadsideLeft or skillId == InventoryType.SailBroadsideRight) and not (localAvatar.ship.broadside):
                 greyOut = 1
             elif localAvatar.guiMgr.combatTray.skillDisabled(skillId):
                 greyOut = 1
             
         
         rep = WeaponGlobals.getSkillReputationCategoryId(skillId)
         if rep == InventoryType.DollRep:
             haveFriendly = localAvatar.getFriendlyStickyTargets()
             haveHostile = localAvatar.getHostileStickyTargets()
             if haveFriendly and not haveHostile:
                 if not WeaponGlobals.isFriendlyFire(skillId):
                     greyOut = 1
                 
             elif not haveFriendly and haveHostile:
                 if WeaponGlobals.isFriendlyFire(skillId):
                     greyOut = 1
                 
             
         
         if self.tray[i + 1].greyOut != greyOut:
             if hasattr(self.tray[i + 1], 'skillButton'):
                 self.tray[i + 1].greyOut = greyOut
                 if greyOut == 1:
                     self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
                     if self.tray[i + 1].showRing:
                         self.tray[i + 1].skillRing.meterFaceHalf1.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
                         self.tray[i + 1].skillRing.meterFaceHalf2.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
                     
                 elif greyOut == 2:
                     self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
                 elif greyOut == 3:
                     self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
                 else:
                     self.tray[i + 1].setGeomColor(1, 1, 1, 1)
                     if self.tray[i + 1].showRing:
                         self.tray[i + 1].skillRing.meterFaceHalf1.clearColorScale()
                         self.tray[i + 1].skillRing.meterFaceHalf2.clearColorScale()
                     
             
         
         if self.isPowerRecharged:
             self.continuePowerRechargeEffect()
             continue
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:79,代码来源:RadialMenu.py

示例3: updateSkillTray

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillMaxQuantity [as 别名]

#.........这里部分代码省略.........
             else:
                 image = self.SkillIcons.find('**/base')
             button = DirectButton(parent = self.skillTray, relief = None, state = DGG.DISABLED, image = image, image_pos = (0.0, 0.0, 0.059999999999999998), image_scale = 0.12, image_color = (0.20000000000000001, 0.20000000000000001, 0.20000000000000001, 0.55000000000000004), sortOrder = 100, pos = (x, 0, -0.0))
             button.setTransparency(1)
             button.showQuantity = False
             button.greyOut = -1
             button.showRing = False
             button.skillStatus = False
             if locked:
                 lock = DirectFrame(parent = button, relief = None, image = self.lockArt, image_scale = 0.14000000000000001, image_pos = (0.050000000000000003, 0, 0.035000000000000003))
                 button['state'] = DGG.NORMAL
                 button['command'] = base.localAvatar.guiMgr.showNonPayer
                 button['extraArgs'] = [
                     'Restricted_Radial_Menu',
                     5]
             
             self.tray[i + 1] = button
             x = x + 0.14999999999999999
             if i < self.numberOfItems - 1:
                 offset = offset + 0.01
                 self.skillTray.setX(self.skillTray.getX() - 0.074999999999999997)
             
         i < self.numberOfItems - 1
         if self.origMap[i][1] == True:
             skillId = self.traySkillMap[i]
             if linkedSkillIds.has_key(skillId):
                 skillId = linkedSkillIds[skillId]
             
             name = PLocalizer.InventoryTypeNames[skillId]
             hotkey = str(i + 1)
             totalRechargeTime = base.cr.battleMgr.getModifiedRechargeTime(localAvatar, skillId)
             timeSpentRecharging = localAvatar.skillDiary.getTimeSpentRecharging(skillId)
             if not timeSpentRecharging:
                 timeSpentRecharging = 0
             
             if weaponMode not in (WeaponGlobals.CANNON, WeaponGlobals.FIREARM, WeaponGlobals.GRENADE, WeaponGlobals.STAFF, WeaponGlobals.DEFENSE_CANNON) and skillId in WeaponGlobals.SpecialSkills or WeaponGlobals.getSkillReputationCategoryId(skillId) not in (InventoryType.PistolRep, InventoryType.WandRep, InventoryType.CannonRep, InventoryType.GrenadeRep, InventoryType.DefenseCannonRep):
                 showRing = True
             else:
                 showRing = False
             locked = self.origMap[i][2]
             if weaponMode == WeaponGlobals.DEFENSE_CANNON:
                 button = AmmoSkillButton(skillId, i, self.callback, 99, 0, showQuantity = True, showHelp = False, showRing = showRing, hotkey = hotkey, name = name, showLock = locked)
             else:
                 button = SkillButton(skillId, self.callback, 0, 0, showQuantity = False, showHelp = False, showRing = showRing, hotkey = hotkey, name = name, showLock = locked)
             button.skillStatus = True
             if locked:
                 button.skillButton['command'] = base.localAvatar.guiMgr.showNonPayer
                 button.skillButton['extraArgs'] = [
                     'Restricted_Radial_Menu',
                     5]
             
             if showRing:
                 button.skillRing.meterFaceHalf1.setScale(0.95999999999999996)
                 button.skillRing.meterFaceHalf2.setScale(0.95999999999999996)
             
             button.reparentTo(self.skillTray)
             button.setPos(x, 0, 0.070000000000000007)
             self.tray[i + 1] = button
             if weaponMode in (WeaponGlobals.CANNON, WeaponGlobals.FIREARM, WeaponGlobals.GRENADE, WeaponGlobals.STAFF):
                 lastAmmo = localAvatar.guiMgr.combatTray.lastAmmoSkillId.get(localAvatar.currentWeaponId)
                 if lastAmmo is not None:
                     if lastAmmo == skillId:
                         button.toggleButton(True)
                     
                 elif self.tray[1].skillStatus is True:
                     self.tray[1].toggleButton(True)
                 
             
             if self.weaponMode in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
                 inv = localAvatar.getInventory()
                 maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
                 if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
                     ammoAmt = WeaponGlobals.INF_QUANT
                 else:
                     ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
                     ammoAmt = inv.getStackQuantity(ammoInvId)
                     ammoMax = inv.getStackLimit(ammoInvId)
                     button.showQuantity = True
                     button.updateQuantity(ammoAmt)
             
             x = x + 0.17000000000000001
             if i < self.numberOfItems - 1:
                 if weaponMode == WeaponGlobals.DEFENSE_CANNON:
                     self.skillTray.setX(self.skillTray.getX() - 0.072499999999999995)
                 else:
                     self.skillTray.setX(self.skillTray.getX() - 0.085000000000000006)
             
         i < self.numberOfItems - 1
     
     currentX = self.skillTray.getX()
     self.skillTray.setX(currentX + float(offset))
     if self.repMeter:
         self.repMeter.setPos(-currentX, 0.0, -0.11)
     
     self.updateSkillTrayStates()
     if weaponMode == WeaponGlobals.DEFENSE_CANNON:
         self.setMoveUpValue(0.34499999999999997)
     else:
         self.resetMoveUpVale()
     self.showSkillTray()
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:104,代码来源:RadialMenu.py

示例4: radialMenuHeartBeat

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillMaxQuantity [as 别名]
 def radialMenuHeartBeat(self, task):
     if base.mouseWatcherNode.hasMouse():
         mouseData = base.win.getPointer(0)
         curX = mouseData.getX()
         curY = mouseData.getY()
     else:
         curX = 0
         curY = 0
     hLItem = RingMatch(self.numberOfItems, curX - self.mouseBasePosX, curY - self.mouseBasePosY)
     if hLItem != self.hiLiteItem:
         if hLItem < 1:
             self.radialHelp.hide()
         else:
             self.radialHelp['text'] = PLocalizer.InventoryTypeNames[self.radialSkillMap[hLItem - 1]]
             basePos = self.radial[hLItem].getPos()
             self.radialHelp.setPos(basePos[0] + 0.059999999999999998, basePos[1], basePos[2] - 0.040000000000000001)
             self.radialHelp.show()
         if self.hiLiteItem != -1:
             self.rframe[self.hiLiteItem].rollover(False)
         
         self.hiLiteItem = hLItem
         if self.hiLiteItem > 0:
             self.rframe[self.hiLiteItem].rollover(True)
         
     
     count = 0
     for skillId in self.radialSkillMap:
         greyOut = 0
         count += 1
         if self.weaponMode in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
             inv = localAvatar.getInventory()
             maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
             if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
                 greyOut = 0
             else:
                 ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
                 ammoAmt = inv.getStackQuantity(ammoInvId)
                 if ammoAmt <= 0:
                     greyOut = 1
                 
         
         if localAvatar.mojo < -1 * WeaponGlobals.getMojoCost(skillId):
             greyOut = 1
         
         if skillId == InventoryType.SailBroadsideLeft or skillId == InventoryType.SailBroadsideRight:
             if not localAvatar.ship.broadside:
                 greyOut = 1
             
         
         range = localAvatar.cr.battleMgr.getModifiedRechargeTime(localAvatar, skillId)
         value = localAvatar.skillDiary.getTimeSpentRecharging(skillId)
         if not value:
             value = range
         elif value >= range:
             if self.rstatus[count] == 3:
                 startScale = self.rframe[count].getScale()
                 startColor = Vec4(1, 1, 1, 1)
                 glowColor = Vec4(0.0, 0.75, 0.0, 1.0)
                 buttomFrame = self.rframe[count]
             
         
         self.rframe[count].update(value, range)
         if value < range:
             greyOut = 3
         
         if self.rep == InventoryType.DollRep:
             haveFriendly = localAvatar.getFriendlyStickyTargets()
             haveHostile = localAvatar.getHostileStickyTargets()
             if haveFriendly and not haveHostile:
                 if not WeaponGlobals.isFriendlyFire(self.radialSkillMap[count - 1]):
                     greyOut = 1
                 
             elif not haveFriendly and haveHostile:
                 if WeaponGlobals.isFriendlyFire(self.radialSkillMap[count - 1]):
                     greyOut = 1
                 
             
         
         if self.rstatus[count] != greyOut:
             self.rstatus[count] = greyOut
             if greyOut == 2:
                 self.radial[count].setColorScale(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1.0)
             elif greyOut == 1:
                 self.radial[count].setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
                 self.rframe[count].meterFaceHalf1.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
                 self.rframe[count].meterFaceHalf2.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
             elif greyOut == 3:
                 self.radial[count].setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
             else:
                 self.radial[count].setColorScale(1, 1, 1, 1)
                 self.radial[count].setAlphaScale(1)
                 self.rframe[count].meterFaceHalf1.setColorScale(1, 1, 1, 1.0)
                 self.rframe[count].meterFaceHalf2.setColorScale(1, 1, 1, 1.0)
         greyOut == 2
     
     return Task.cont
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:98,代码来源:RadialMenu.py

示例5: __init__

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillMaxQuantity [as 别名]
 def __init__(self, rep, weaponMode):
     self.rep = rep
     self.weaponMode = weaponMode
     localAvatar.cr.targetMgr.reticle.hide()
     if self.weaponMode in (WeaponGlobals.MELEE, WeaponGlobals.COMBAT, WeaponGlobals.THROWING):
         target = base.cr.targetMgr.takeAim(localAvatar)
         if target:
             localAvatar.guiMgr.combatTray.beginAimAssist(target)
         
     
     base.win.movePointer(0, base.win.getXSize() / 2, base.win.getYSize() / 2)
     localAvatar.guiMgr.setSeaChestAllowed(False)
     self.radial = { }
     self.rframe = { }
     self.ammoAmt = { }
     self.rstatus = { }
     self.rstatus[0] = 0
     self.rframe[0] = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
     skillRing = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
     skillRing.reparentTo(aspect2d)
     skillRing.setPos(0.01, 0, 0.01)
     if not self.SkillIcons:
         self.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
         icons = loader.loadModel('models/gui/gui_icons_weapon')
         icons.reparentTo(self.SkillIcons)
     
     if self.rep == InventoryType.DollRep and localAvatar.hasStickyTargets():
         asset = getSkillIconName(self.rep, 1)
     else:
         asset = getSkillIconName(self.rep, 0)
     self.radial[0] = DirectFrame(parent = aspect2d, relief = None, image = self.SkillIcons.find('**/%s' % asset), image_scale = ImageScale(self.rep), image_pos = (0.059999999999999998, 0, 0.059999999999999998), pos = (-0.050000000000000003, 0, -0.050000000000000003), sortOrder = 10)
     self.radial[0].setTransparency(1)
     origMap = ActiveSkills(self.rep, 2)
     self.radialSkillMap = Freebooter.pruneFreebooterSkills(origMap)
     self.numberOfItems = len(self.radialSkillMap)
     for i in range(self.numberOfItems):
         (x, y) = InnerRingOffset(i + 1)
         self.rstatus[i + 1] = 0
         self.rframe[i + 1] = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
         skillRing = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
         skillRing.reparentTo(aspect2d)
         skillRing.setPos(0.01 + x, 0, 0.01 + y)
         asset = getSkillIconName(self.radialSkillMap[i], 0)
         self.radial[i + 1] = DirectFrame(parent = aspect2d, relief = None, image = self.SkillIcons.find('**/%s' % asset), image_pos = (0.059999999999999998, 0, 0.059999999999999998), image_scale = ImageScale(self.rep), sortOrder = 100, pos = (-0.050000000000000003 + x, 0, -0.050000000000000003 + y))
         self.radial[i + 1].setTransparency(1)
         if self.weaponMode in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
             inv = localAvatar.getInventory()
             skillId = self.radialSkillMap[i]
             maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
             if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
                 amtstr = '++'
             else:
                 ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
                 ammoAmt = inv.getStackQuantity(ammoInvId)
                 ammoMax = inv.getStackLimit(ammoInvId)
                 amtstr = '%d' % ammoAmt
             self.ammoAmt[i + 1] = DirectLabel(parent = aspect2d, relief = None, text = amtstr, text_align = TextNode.ACenter, text_scale = 0.029999999999999999, text_fg = (0.69999999999999996, 1.0, 1.0, 1), text_font = PiratesGlobals.getPirateBoldOutlineFont(), pos = (x + 0.059999999999999998, 0, y + 0.040000000000000001), textMayChange = 1)
             continue
     
     self.mouseBasePosX = base.win.getXSize() / 2
     self.mouseBasePosY = base.win.getYSize() / 2
     self.radialHelp = DirectLabel(parent = aspect2d, relief = None, text = '', text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_fg = (0.94999999999999996, 1.0, 1.0, 1), text_shadow = PiratesGuiGlobals.TextShadow, pos = (0, 0, 0), textMayChange = 1)
     self.radialHelp.hide()
     self.radial[0].show()
     self.rframe[0].show()
     self.hiLiteItem = 0
     taskMgr.add(self.radialMenuHeartBeat, 'radialMenuHeartBeat', priority = 40)
     messenger.send('openedSpecialMenu')
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:70,代码来源:RadialMenu.py


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