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


Python WeaponGlobals.getRepId方法代码示例

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


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

示例1: loadWeaponButtons

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def loadWeaponButtons(self):
     for hotkey in self.hotkeys:
         hotkey.destroy()
     
     self.hotkeys = []
     for icon in self.icons:
         icon.destroy()
     
     self.icons = []
     for repMeter in self.repMeters:
         repMeter.destroy()
     
     self.repMeters = []
     self['frameSize'] = (0, self.ICON_WIDTH * len(self.items) + 0.040000000000000001, 0, self.HEIGHT)
     self.setX(-((self.ICON_WIDTH * len(self.items) + 0.040000000000000001) / 2.0))
     topGui = loader.loadModel('models/gui/toplevel_gui')
     kbButton = topGui.find('**/keyboard_button')
     for i in range(len(self.items)):
         if self.items[i]:
             category = WeaponGlobals.getRepId(self.items[i][0])
             icon = DirectFrame(parent = self, state = DGG.DISABLED, relief = None, frameSize = (0, 0.080000000000000002, 0, 0.080000000000000002), pos = (self.ICON_WIDTH * i + 0.080000000000000002, 0, 0.082000000000000003))
             icon.setTransparency(1)
             hotkeyText = 'F%s' % self.items[i][1]
             hotkey = DirectFrame(parent = icon, state = DGG.DISABLED, relief = None, text = hotkeyText, text_align = TextNode.ACenter, text_scale = 0.044999999999999998, text_pos = (0, 0), text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, image = kbButton, image_scale = 0.059999999999999998, image_pos = (0, 0, 0.01), image_color = (0.5, 0.5, 0.34999999999999998, 1), pos = (0, 0, 0.080000000000000002))
             self.hotkeys.append(hotkey)
             category = WeaponGlobals.getRepId(self.items[i][0])
             if Freebooter.getPaidStatus(base.localAvatar.getDoId()) or Freebooter.allowedFreebooterWeapon(category):
                 asset = ItemGlobals.getIcon(self.items[i][0])
                 if asset:
                     texCard = self.card.find('**/%s' % asset)
                     icon['geom'] = texCard
                     icon['geom_scale'] = 0.080000000000000002
                 
                 icon.resetFrameSize()
                 self.icons.append(icon)
             else:
                 texCard = topGui.find('**/pir_t_gui_gen_key_subscriber*')
                 icon['geom'] = texCard
                 icon['geom_scale'] = 0.20000000000000001
                 icon.resetFrameSize()
                 self.icons.append(icon)
             repMeter = DirectWaitBar(parent = icon, relief = DGG.SUNKEN, state = DGG.DISABLED, borderWidth = (0.002, 0.002), range = 0, value = 0, frameColor = (0.23999999999999999, 0.23999999999999999, 0.20999999999999999, 1), barColor = (0.80000000000000004, 0.80000000000000004, 0.69999999999999996, 1), pos = (-0.050000000000000003, 0, -0.052499999999999998), hpr = (0, 0, 0), frameSize = (0.0050000000000000001, 0.095000000000000001, 0, 0.012500000000000001))
             self.repMeters.append(repMeter)
             inv = base.localAvatar.getInventory()
             if inv:
                 repValue = inv.getReputation(category)
                 (level, leftoverValue) = ReputationGlobals.getLevelFromTotalReputation(category, repValue)
                 max = ReputationGlobals.getReputationNeededToLevel(category, level)
                 repMeter['range'] = max
                 repMeter['value'] = leftoverValue
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:52,代码来源:BarSelectionMenu.py

示例2: selectPrev

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def selectPrev(self):
     if len(self.items) < 1:
         return None
     
     self.show()
     if len(self.items) > 1:
         keepTrying = True
     else:
         keepTrying = False
     while keepTrying:
         keepTrying = False
         self.choice = self.choice - 1
         if self.choice < 0 or self.choice > len(self.items) - 1:
             self.choice = len(self.items) - 1
         
         if not Freebooter.getPaidStatus(base.localAvatar.getDoId()):
             if self.items[self.choice]:
                 category = WeaponGlobals.getRepId(self.items[self.choice][0])
                 if not Freebooter.allowedFreebooterWeapon(category):
                     keepTrying = True
                 
             else:
                 keepTrying = True
         self.items[self.choice]
     self.cursor.setPos(self.ICON_WIDTH * self.choice + 0.080000000000000002, 0, 0.071999999999999995)
     taskMgr.remove('BarSelectHideTask' + str(self.getParent()))
     self.hideTask = taskMgr.doMethodLater(self.SelectionDelay, self.confirmSelection, 'BarSelectHideTask' + str(self.getParent()), extraArgs = [])
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:29,代码来源:BarSelectionMenu.py

示例3: addTab

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def addTab(self, itemGroup, item):
     newTab = self.tabBar.addTab(itemGroup, command = self.setPage, extraArgs = [
         itemGroup])
     repId = WeaponGlobals.getRepId(item)
     if repId:
         iconName = ReputationGlobals.RepIcons.get(repId)
         if repId == InventoryType.FishingRep:
             icon = StoreGUI.FishingIcons.find('**/%s' % iconName)
         else:
             icon = StoreGUI.WeaponIcons.find('**/%s' % iconName)
     elif InventoryType.begin_Consumables <= item:
         pass
     elif repId or ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
         iconName = EconomyGlobals.getItemIcons(item)
         icon = StoreGUI.SkillIcons.find('**/%s' % iconName)
     elif InventoryType.begin_WeaponCannonAmmo <= item:
         pass
     elif ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
         iconName = EconomyGlobals.getItemIcons(InventoryType.CannonL1)
         icon = StoreGUI.WeaponIcons.find('**/%s' % iconName)
     elif InventoryType.begin_WeaponGrenadeAmmo <= item:
         pass
     elif ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
         itemId = InventoryType.GrenadeWeaponL1
         iconName = EconomyGlobals.getItemIcons(itemId)
         icon = StoreGUI.WeaponIcons.find('**/%s' % iconName)
     elif InventoryType.begin_FishingLures <= item:
         pass
     elif ItemGlobals.getClass(item) == InventoryType.ItemTypeConsumable:
         icon = StoreGUI.FishingIcons.find('**/pir_t_gui_gen_fish_lure')
     else:
         icon = None
     newTab.nameTag = DirectLabel(parent = newTab, relief = None, state = DGG.DISABLED, image = icon, image_scale = 0.40000000000000002, image_pos = (0, 0, 0.040000000000000001), pos = (0.059999999999999998, 0, -0.035000000000000003))
     self.pageNames.append(itemGroup)
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:36,代码来源:StoreGUI.py

示例4: updateRep

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def updateRep(self, category, value):
     for i in range(len(self.items)):
         repId = WeaponGlobals.getRepId(self.items[i][0])
         if repId == category:
             (level, leftoverValue) = ReputationGlobals.getLevelFromTotalReputation(category, value)
             max = ReputationGlobals.getReputationNeededToLevel(category, level)
             if len(self.repMeters) - 1 >= i:
                 self.repMeters[i]['range'] = max
                 self.repMeters[i]['value'] = leftoverValue
             
         len(self.repMeters) - 1 >= i
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:13,代码来源:BarSelectionMenu.py

示例5: checkComboExpired

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [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

示例6: createGui

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def createGui(self):
     itemId = self.data[0]
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.16, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())
     if itemId in range(InventoryType.begin_PistolPouches, InventoryType.end_PistolPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.PISTOL), 1)
     elif itemId in range(InventoryType.begin_DaggerPouches, InventoryType.end_DaggerPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.InventoryItemClassNames.get(ItemType.DAGGER), 1)
     elif itemId in range(InventoryType.begin_GrenadePouches, InventoryType.end_GrenadePouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.GrenadeShort, 1)
     elif itemId in range(InventoryType.begin_CannonPouches, InventoryType.end_CannonPouches):
         self.itemTypeFormatted = PLocalizer.makeHeadingString(PLocalizer.ShipCannonShort, 1)
     else:
         self.itemTypeFormatted = PLocalizer.makeHeadingString(self.itemType, 1)
     self.itemTypeName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.itemTypeFormatted, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.16, 0, 0.065000000000000002))
     self.miscText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.16, 0, 0.025000000000000001))
     if self.minLvl > 0:
         repId = WeaponGlobals.getRepId(itemId)
         if repId:
             self.checkLevel(repId, self.minLvl)
         
     
     self.checkFreebooter(itemId, base.localAvatar.getDoId())
     trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
     if trainingReq:
         self.checkTrainingReq(trainingReq)
     
     if EconomyGlobals.getItemCategory(itemId) == ItemType.AMMO:
         skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
         self.checkSkillReq(skillId)
     
     self.checkInfamyReq(itemId)
     if self.buy:
         self.checkPlayerInventory(itemId)
     
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = InventoryListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.065000000000000002), text_font = PiratesGlobals.getInterfaceFont())
     if self.quantity and self.quantity > 1:
         self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), frameColor = (0, 0, 0, 1), frameSize = (-0.01, 0.02, -0.01, 0.025000000000000001), text_scale = 0.0275, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.02, 0, 0.025000000000000001), text_font = PiratesGlobals.getPirateBoldOutlineFont())
     
     geomParams = InventoryItemGui.getGeomParams(itemId)
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, geom = geomParams['geom'], geom_pos = geomParams['geom_pos'], geom_scale = geomParams['geom_scale'], pos = (0.01, 0, 0.01))
     self.flattenStrong()
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:43,代码来源:InventoryItemGui.py

示例7: update

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def update(self, repId = None, fromUser = 0):
     inv = localAvatar.getInventory()
     if not inv:
         self.notify.warning('SkillPage unable to find inventory')
         return None
     
     if self.tabBar == None:
         return None
     
     if self.demo:
         return None
     
     if fromUser:
         self.lastUserSelectedTab = repId
     
     if repId == None:
         if localAvatar.getGameState() == 'Fishing':
             if self.lastUserSelectedTab:
                 repId = self.lastUserSelectedTab
             else:
                 repId = InventoryType.CannonRep
         elif localAvatar.cannon:
             repId = InventoryType.CannonRep
         elif localAvatar.gameFSM.state == 'ShipPilot':
             repId = InventoryType.SailingRep
         elif localAvatar.currentWeaponId and localAvatar.isWeaponDrawn:
             repId = WeaponGlobals.getRepId(localAvatar.currentWeaponId)
         elif localAvatar.currentWeaponId and not (localAvatar.isWeaponDrawn) and self.lastUserSelectedTab:
             repId = self.lastUserSelectedTab
         else:
             repId = InventoryType.CannonRep
     
     self.setRep(repId)
     self.tabBar.selectTab(str(repId))
     self.repMeter.setCategory(repId)
     self.repMeter.update(inv.getReputation(repId))
     unSpentId = self.getUnspent()
     amt = inv.getStackQuantity(unSpentId)
     if unSpentId in self.localMods:
         amt = self.localMods[unSpentId]
     
     self.unspent['text'] = PLocalizer.SkillPageUnspentPoints % amt
     if amt > 0:
         self.unspent['text_fg'] = (0.80000000000000004, 1, 0.80000000000000004, 1)
     else:
         self.unspent['text_fg'] = (1, 1, 1, 1)
     comboSkills = RadialMenu.ComboSkills(repId, 1)
     totalComboSkills = RadialMenu.ComboSkills(repId, 0)
     activeSkills = RadialMenu.ActiveSkills(repId, 1)
     totalActiveSkills = RadialMenu.ActiveSkills(repId, 0)
     passiveSkills = RadialMenu.PassiveSkills(repId, 1)
     totalPassiveSkills = RadialMenu.PassiveSkills(repId, 0)
     self.linkedSkillIds = { }
     linkedSkills = ItemGlobals.getLinkedSkills(localAvatar.currentWeaponId)
     if linkedSkills:
         for skillId in linkedSkills:
             realSkillId = WeaponGlobals.getLinkedSkillId(skillId)
             self.linkedSkillIds[realSkillId] = skillId
         
     
     for excludedSkillId in self.EXCLUDED_SKILLS:
         for skillId in activeSkills:
             if excludedSkillId == skillId:
                 activeSkills.remove(skillId)
                 totalActiveSkills.remove(skillId)
                 continue
         
     
     for spot in self.skillFrames.keys():
         if spot not in totalComboSkills:
             self.skillFrames[spot].hide()
             continue
     
     count = 0
     for skill in totalComboSkills:
         skillPts = inv.getStackQuantity(skill)
         if skill in self.localMods:
             skillPts = self.localMods[skill]
         
         if not skill in comboSkills:
             pass
         showIcon = skillPts > 0
         freeLock = False
         if not Freebooter.getPaidStatus(base.localAvatar.getDoId()):
             if not WeaponGlobals.canFreeUse(skill):
                 freeLock = True
             
         
         if self.linkedSkillIds.has_key(skill):
             if self.skillFrames.has_key(skill):
                 self.skillFrames[skill].hide()
             
             skill = self.linkedSkillIds[skill]
         
         self.createFrame(skill, skillPts, amt, freeLock, showIcon)
         x = 0.20000000000000001 + 0.17499999999999999 * count
         y = 1.1100000000000001
         self.skillFrames[skill].setPos(x, 0, y)
         if showIcon and skillPts > 1:
             self.makeBoostDisplay(skill, skillPts - 1)
#.........这里部分代码省略.........
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:103,代码来源:SkillPage.py

示例8: handleBuyItem

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
    def handleBuyItem(self, data, useCode):
        itemId = data[0]
        if not itemId:
            return None

        itemType = EconomyGlobals.getItemType(itemId)
        if itemType <= ItemType.WAND or itemType == ItemType.POTION:
            data[1] = 1
        else:
            data[1] = EconomyGlobals.getItemQuantity(itemId)
        inventory = base.localAvatar.getInventory()
        if not inventory:
            return None

        itemQuantity = self.purchaseInventory.getItemQuantity(itemId)
        currStock = inventory.getStackQuantity(itemId)
        currStockLimit = inventory.getStackLimit(itemId)
        if useCode == PiratesGuiGlobals.InventoryAdd:
            itemTypeName = PLocalizer.InventoryItemClassNames.get(itemType)
            trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
            if trainingReq:
                amt = inventory.getStackQuantity(trainingReq)
                if not amt:
                    base.localAvatar.guiMgr.createWarning(PLocalizer.NoTrainingWarning % itemTypeName, PiratesGuiGlobals.TextFG6)
                    return None


            itemType = EconomyGlobals.getItemType(itemId)
            if itemType != ItemType.POTION:
                minLvl = ItemGlobals.getWeaponRequirement(itemId)
            else:
                minLvl = 0
            repId = WeaponGlobals.getRepId(itemId)
            repAmt = inventory.getAccumulator(repId)
            if minLvl > ReputationGlobals.getLevelFromTotalReputation(repId, repAmt)[0]:
                base.localAvatar.guiMgr.createWarning(PLocalizer.LevelReqWarning % (minLvl, itemTypeName), PiratesGuiGlobals.TextFG6)
                return None

            if itemId in ItemGlobals.getAllWeaponIds():
                locatables = []
                for dataInfo in self.purchaseInventory.inventory:
                    dataId = dataInfo[0]
                    if dataId in ItemGlobals.getAllWeaponIds():
                        locatables.append(InvItem([
                            InventoryType.ItemTypeWeapon,
                            dataId,
                            0]))
                        continue

                locatables.append(InvItem([
                    InventoryType.ItemTypeWeapon,
                    itemId,
                    0]))
                locationIds = inventory.canAddLocatables(locatables)
                for locationId in locationIds:
                    if locationId in (Locations.INVALID_LOCATION, Locations.NON_LOCATION):
                        base.localAvatar.guiMgr.createWarning(PLocalizer.InventoryFullWarning, PiratesGuiGlobals.TextFG6)
                        return None
                        continue

            elif itemId in ItemGlobals.getAllConsumableIds():
                itemQuantity = self.purchaseInventory.getItemQuantity(itemId)
                currStock = inventory.getItemQuantity(InventoryType.ItemTypeConsumable, itemId)
                currStockLimit = inventory.getItemLimit(InventoryType.ItemTypeConsumable, itemId)
                if currStock + itemQuantity >= currStockLimit:
                    base.localAvatar.guiMgr.createWarning(PLocalizer.TradeItemFullWarning, PiratesGuiGlobals.TextFG6)
                    return None

                if currStock == 0:
                    locatables = []
                    dataIds = { }
                    for dataInfo in self.purchaseInventory.inventory:
                        dataId = dataInfo[0]
                        if dataId in ItemGlobals.getAllConsumableIds():
                            if dataIds.has_key(dataId):
                                dataIds[dataId] += 1
                            else:
                                dataIds[dataId] = 1
                        dataIds.has_key(dataId)

                    if dataIds.has_key(itemId):
                        dataIds[itemId] += 1
                    else:
                        dataIds[itemId] = 1
                    for dataId in dataIds:
                        locatables.append(InvItem([
                            InventoryType.ItemTypeConsumable,
                            dataId,
                            0,
                            dataIds[dataId]]))

                    locationIds = inventory.canAddLocatables(locatables)
                    for locationId in locationIds:
                        if locationId in (Locations.INVALID_LOCATION, Locations.NON_LOCATION):
                            base.localAvatar.guiMgr.createWarning(PLocalizer.InventoryFullWarning, PiratesGuiGlobals.TextFG6)
                            return None
                            continue


            else:
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:StoreGUI.py

示例9: checkComboExpired

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [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: aimOverTargetTask

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [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

示例11: rePanel

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def rePanel(self, inventory):
     if not self.showing:
         self.needRefresh = 1
         return None
     
     skillTokens = {
         InventoryType.CutlassToken: (ItemGlobals.RUSTY_CUTLASS,),
         InventoryType.PistolToken: (ItemGlobals.FLINTLOCK_PISTOL,),
         InventoryType.DollToken: (ItemGlobals.VOODOO_DOLL,),
         InventoryType.DaggerToken: (ItemGlobals.BASIC_DAGGER,),
         InventoryType.GrenadeToken: (ItemGlobals.GRENADE_POUCH,),
         InventoryType.WandToken: (ItemGlobals.CURSED_STAFF,) }
     zIndex = 1
     for skillTokenKey in TOKEN_LIST:
         quantity = 0
         if localAvatar.getInventory().stacks.get(skillTokenKey):
             quantity = 1
         
         skillData = skillTokens[skillTokenKey]
         weaponId = skillData[0]
         key = None
         panel = WeaponPanel.WeaponPanel((weaponId, quantity), key)
         panel.reparentTo(self)
         panel.setZ(PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999 - zIndex * panel.height)
         zIndex += 1
         repCat = WeaponGlobals.getRepId(weaponId)
         self.weaponPanels[repCat] = panel
         self.ignore('inventoryQuantity-%s' % inventory.getDoId())
         self.acceptOnce('inventoryQuantity-%s-%s' % (inventory.getDoId(), skillTokenKey), self.refreshList)
     
     repIcon_gui = loader.loadModel('models/textureCards/skillIcons')
     repIcon = repIcon_gui.find('**/box_base')
     if config.GetBool('want-fishing-game', 0):
         self.fishingIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.FishingRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
         fishIconCard = loader.loadModel('models/textureCards/fishing_icons')
         inv = localAvatar.getInventory()
         fishingChangeMsg = InventoryGlobals.getCategoryQuantChangeMsg(inv.doId, InventoryType.FishingRod)
         if self.fishingChangeMsg:
             self.ignore(fishingChangeMsg)
         
         self.fishingChangeMsg = fishingChangeMsg
         self.acceptOnce(fishingChangeMsg, self.refreshList)
         rodIcons = [
             'pir_t_gui_fsh_smRodIcon',
             'pir_t_gui_fsh_mdRodIcon',
             'pir_t_gui_fsh_lgRodIcon']
         rodLvl = inv.getStackQuantity(InventoryType.FishingRod)
         rodIcon = rodIcons[rodLvl - 1]
         rodText = PLocalizer.FishingRodNames[rodLvl]
         if rodLvl >= 1:
             self.fishingIcon['geom'] = fishIconCard.find('**/' + rodIcon)
         
         self.fishingIcon['geom_scale'] = 0.10000000000000001
         self.fishingIcon['geom_pos'] = (0, 0, 0)
         self.fishingIcon.reparentTo(self)
         fishingRepValue = localAvatar.getInventory().getReputation(InventoryType.FishingRep)
         self.fishingRepMeter = ReputationMeter(InventoryType.FishingRep, width = 0.66000000000000003)
         self.fishingRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
         self.fishingRepMeter.update(fishingRepValue)
         self.fishingRepMeter.reparentTo(self)
         self.fishingRepMeter.flattenLight()
         self.fishingPoleName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = rodText, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - 7 * panel.height), text_font = PiratesGlobals.getInterfaceFont())
         self.fishingPoleName.reparentTo(self)
         zIndex += 1
     
     iconCard = loader.loadModel('models/textureCards/skillIcons')
     if config.GetBool('want-potion-game', 0):
         self.potionIcon = GuiButton(pos = (0.16600000000000001, 0, 0.044999999999999998 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height), helpText = PLocalizer.PotionRepDescription, helpOpaque = True, image = (repIcon, repIcon, repIcon, repIcon), image_scale = (0.14399999999999999, 0.14399999999999999, 0.14399999999999999))
         self.potionIcon['geom'] = iconCard.find('**/pir_t_gui_pot_base')
         self.potionIcon['geom_scale'] = 0.10000000000000001
         self.potionIcon['geom_pos'] = (0, 0, 0)
         self.potionIcon.reparentTo(self)
         potionRepValue = localAvatar.getInventory().getReputation(InventoryType.PotionsRep)
         self.potionRepMeter = ReputationMeter(InventoryType.PotionsRep, width = 0.66000000000000003)
         self.potionRepMeter.setPos(0.62, 0, 0.041000000000000002 + (PiratesGuiGlobals.InventoryPanelHeight - 0.17999999999999999) - zIndex * panel.height)
         self.potionRepMeter.update(potionRepValue)
         self.potionRepMeter.reparentTo(self)
         self.potionRepMeter.flattenLight()
         zIndex += 1
     
     items = dict(map(lambda x: (x.getType(), x.getCount()), inventory.getConsumables().values()))
     possibleItems = ItemGlobals.getAllHealthIds()
     havePorky = items.get(ItemGlobals.ROAST_PORK)
     if not havePorky and ItemGlobals.ROAST_PORK in possibleItems:
         possibleItems.remove(ItemGlobals.ROAST_PORK)
     
     offset = 0
     if base.config.GetBool('want-potion-game', 0):
         items = inventory.getConsumables()
         listLength = len(InventoryType.PotionMinigamePotions)
         count = 0
         for i in range(listLength):
             tonicId = InventoryType.PotionMinigamePotions[i]
             if items.get(tonicId):
                 button = SkillButton(tonicId, self.tonicCallback, items.get(tonicId), showQuantity = True, showHelp = True, showRing = True)
                 button.skillButton['geom_scale'] = 0.080000000000000002
                 x = 0.16 * (count % 6) + -1.2
                 z = 1.0 - int(count / 6) * 0.16
                 button.setPos(x, 0, z)
                 button.reparentTo(self)
#.........这里部分代码省略.........
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:103,代码来源:WeaponPage.py

示例12: createGui

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def createGui(self):
     itemId = self.data[0]
     self.picture = DirectFrame(parent = self, relief = None, state = DGG.DISABLED, pos = (0.01, 0, 0.01))
     self.nameTag = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = self.name, text_scale = PiratesGuiGlobals.TextScaleSmall * PLocalizer.getHeadingScale(2), text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.050000000000000003, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())
     itemTypeFormatted = ''
     self.itemTypeName = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = itemTypeFormatted, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_font = PiratesGlobals.getInterfaceFont(), pos = (0.050000000000000003, 0, 0.065000000000000002))
     self.miscText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = '', text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.050000000000000003, 0, 0.025000000000000001))
     if self.minLvl > 0:
         repId = WeaponGlobals.getRepId(itemId)
         if repId:
             self.checkLevel(repId, self.minLvl)
         
     
     trainingReq = EconomyGlobals.getItemTrainingReq(itemId)
     if trainingReq:
         self.checkTrainingReq(trainingReq)
     
     if EconomyGlobals.getItemCategory(itemId) == ItemType.AMMO:
         skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
         self.checkSkillReq(skillId)
     
     if self.buy:
         self.checkPlayerInventory(itemId)
     
     self.costText = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, image = SongListItem.coinImage, image_scale = 0.12, image_pos = Vec3(-0.01, 0, 0.01), text = str(self.price), text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ARight, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, text_pos = (-0.029999999999999999, 0, 0), pos = (self.width - 0.035000000000000003, 0, 0.105), text_font = PiratesGlobals.getInterfaceFont())
     if self.quantity and self.quantity > 1:
         self.quantityLabel = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = str(self.quantity), frameColor = (0, 0, 0, 1), frameSize = (-0.01, 0.02, -0.01, 0.025000000000000001), text_scale = 0.0275, text_align = TextNode.ACenter, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, text_wordwrap = 11, pos = (0.02, 0, 0.025000000000000001), text_font = PiratesGlobals.getPirateBoldOutlineFont())
     
     itemClass = EconomyGlobals.getItemCategory(itemId)
     if itemClass == ItemType.WEAPON or itemClass == ItemType.POUCH:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = SongItemGui.weaponIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.11
             self.picture['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
         
     elif itemClass == ItemType.CONSUMABLE:
         asset = EconomyGlobals.getItemIcons(itemId)
         if asset:
             self.picture['geom'] = SongItemGui.skillIcons.find('**/%s*' % asset)
             self.picture['geom_scale'] = 0.11
             self.picture['geom_pos'] = (0.080000000000000002, 0, 0.068000000000000005)
         
     
     if not InventoryType.begin_WeaponCannonAmmo <= itemId or itemId <= InventoryType.end_WeaponCannonAmmo:
         if (InventoryType.begin_WeaponPistolAmmo <= itemId or itemId <= InventoryType.end_WeaponGrenadeAmmo or InventoryType.begin_WeaponDaggerAmmo <= itemId) and itemId <= InventoryType.end_WeaponDaggerAmmo:
             skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
             if skillId:
                 asset = WeaponGlobals.getSkillIcon(skillId)
                 if asset:
                     self.picture['geom'] = SongListItem.skillIcons.find('**/%s' % asset)
                     self.picture['geom_scale'] = 0.14999999999999999
                     self.picture['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
                 
             
         elif InventoryType.SmallBottle <= itemId and itemId <= InventoryType.LargeBottle:
             self.picture['geom'] = SongListItem.topGui.find('**/main_gui_ship_bottle')
             self.picture['geom_scale'] = 0.10000000000000001
             self.picture['geom_pos'] = (0.069000000000000006, 0, 0.069000000000000006)
         
     self.flattenStrong()
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:63,代码来源:SongItemGui.py

示例13: createHelpbox

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

#.........这里部分代码省略.........
             if attributeNameLabel.getHeight() > 0.074999999999999997:
                 attributeNameSpace = 0.080000000000000002
             else:
                 attributeNameSpace = PiratesGuiGlobals.TextScaleLarge
             attributeDescriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemAttributeDescription(attributes[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.7999999999999998 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition - attributeNameSpace), text_pos = (0.0, -textScale))
             aHeight = attributeNameLabel.getHeight() + attributeDescriptionLabel.getHeight()
             runningVertPosition -= aHeight + splitHeight
             runningSize += aHeight + splitHeight
             labels.append(attributeNameLabel)
             labels.append(attributeRankLabel)
             labels.append(attributeDescriptionLabel)
         
         skillBoosts = ItemGlobals.getSkillBoosts(itemId)
         for i in range(0, len(skillBoosts)):
             boostIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(skillBoosts[i][0]))
             boostNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.050000000000000003, geom = boostIcon, geom_scale = 0.050000000000000003, image_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), geom_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), text = PLocalizer.ItemBoost % PLocalizer.getInventoryTypeName(skillBoosts[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
             boostRankLabel = DirectLabel(parent = self, relief = None, text = '+%s' % str(skillBoosts[i][1]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ARight, pos = (halfWidth - textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
             bHeight = boostNameLabel.getHeight()
             runningVertPosition -= bHeight + splitHeight
             runningSize += bHeight + splitHeight
             labels.append(boostNameLabel)
             labels.append(boostRankLabel)
         
         description = PLocalizer.getItemFlavorText(itemId)
         if description != '':
             descriptionLabel = DirectLabel(parent = self, relief = None, text = description, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
             dHeight = descriptionLabel.getHeight() + 0.02
             runningVertPosition -= dHeight
             runningSize += dHeight
             labels.append(descriptionLabel)
         
         inv = localAvatar.getInventory()
         weaponLevel = 0
         weaponRepId = WeaponGlobals.getRepId(itemId)
         weaponRep = inv.getReputation(weaponRepId)
         weaponReq = ItemGlobals.getWeaponRequirement(itemId)
         weaponText = None
         trainingToken = EconomyGlobals.getItemTrainingReq(itemId)
         trainingAmt = inv.getItemQuantity(trainingToken)
         if weaponReq:
             weaponLevel = ReputationGlobals.getLevelFromTotalReputation(weaponRepId, weaponRep)[0]
             if weaponLevel < weaponReq:
                 weaponColor = PiratesGuiGlobals.TextFG6
             else:
                 weaponColor = (0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
                 weaponText = PLocalizer.ItemLevelRequirement % (weaponReq, PLocalizer.getItemTypeName(itemType))
         elif trainingAmt == 0:
             weaponColor = PiratesGuiGlobals.TextFG6
             weaponText = PLocalizer.ItemTrainingRequirement % PLocalizer.getItemTypeName(itemType)
         
         if trainingAmt == 0:
             if itemType == ItemGlobals.GUN:
                 base.localAvatar.sendRequestContext(InventoryType.GunTrainingRequired)
             elif itemType == ItemGlobals.DOLL:
                 base.localAvatar.sendRequestContext(InventoryType.DollTrainingRequired)
             elif itemType == ItemGlobals.DAGGER:
                 base.localAvatar.sendRequestContext(InventoryType.DaggerTrainingRequired)
             elif itemType == ItemGlobals.STAFF:
                 base.localAvatar.sendRequestContext(InventoryType.StaffTrainingRequired)
             
         
         if weaponText:
             weaponReqLabel = DirectLabel(parent = self, relief = None, text = weaponText, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = weaponColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
             wHeight = weaponReqLabel.getHeight()
             runningVertPosition -= wHeight
             runningSize += wHeight
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:70,代码来源:InventoryItemGui.py

示例14: checkPlayerInventory

# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getRepId [as 别名]
 def checkPlayerInventory(self, itemId, extraQty = 0):
     if self.available:
         itemCategory = EconomyGlobals.getItemCategory(itemId)
         inventory = base.localAvatar.getInventory()
         currStock = inventory.getStackQuantity(itemId)
         currStockLimit = inventory.getStackLimit(itemId)
         if itemCategory == ItemType.AMMO or itemCategory == ItemType.CONSUMABLE:
             if currStock + extraQty >= currStockLimit and currStockLimit > 0:
                 self.highlightGreen(PLocalizer.InventoryFull % currStockLimit)
             else:
                 self.highlightBox(PLocalizer.InventoryCurrent % (currStock + extraQty, currStockLimit), Vec4(1, 1, 1, 1), PiratesGuiGlobals.TextFG2)
         elif itemCategory == ItemType.WEAPON:
             if currStock >= 1:
                 self.highlightGreen(PLocalizer.InventoryOwned)
             else:
                 inv = base.localAvatar.getInventory()
                 if inv is None:
                     return None
                 
                 itemRep = WeaponGlobals.getRepId(itemId)
                 if itemRep == InventoryType.CutlassRep:
                     options = [
                         InventoryType.CutlassWeaponL1,
                         InventoryType.CutlassWeaponL2,
                         InventoryType.CutlassWeaponL3,
                         InventoryType.CutlassWeaponL4,
                         InventoryType.CutlassWeaponL5,
                         InventoryType.CutlassWeaponL6]
                 elif itemRep == InventoryType.PistolRep:
                     options = [
                         InventoryType.PistolWeaponL1,
                         InventoryType.PistolWeaponL2,
                         InventoryType.PistolWeaponL3,
                         InventoryType.PistolWeaponL4,
                         InventoryType.PistolWeaponL5,
                         InventoryType.PistolWeaponL6]
                 elif itemRep == InventoryType.DaggerRep:
                     options = [
                         InventoryType.DaggerWeaponL1,
                         InventoryType.DaggerWeaponL2,
                         InventoryType.DaggerWeaponL3,
                         InventoryType.DaggerWeaponL4,
                         InventoryType.DaggerWeaponL5,
                         InventoryType.DaggerWeaponL6]
                 elif itemRep == InventoryType.GrenadeRep:
                     options = [
                         InventoryType.GrenadeWeaponL1,
                         InventoryType.GrenadeWeaponL2,
                         InventoryType.GrenadeWeaponL3,
                         InventoryType.GrenadeWeaponL4,
                         InventoryType.GrenadeWeaponL5,
                         InventoryType.GrenadeWeaponL6]
                 elif itemRep == InventoryType.DollRep:
                     options = [
                         InventoryType.DollWeaponL1,
                         InventoryType.DollWeaponL2,
                         InventoryType.DollWeaponL3,
                         InventoryType.DollWeaponL4,
                         InventoryType.DollWeaponL5,
                         InventoryType.DollWeaponL6]
                 elif itemRep == InventoryType.WandRep:
                     options = [
                         InventoryType.WandWeaponL1,
                         InventoryType.WandWeaponL2,
                         InventoryType.WandWeaponL3,
                         InventoryType.WandWeaponL4,
                         InventoryType.WandWeaponL5,
                         InventoryType.WandWeaponL6]
                 else:
                     return None
                 for idx in range(len(options)):
                     optionId = options[idx]
                     if optionId == itemId:
                         currIdx = idx
                         for weaponId in options[currIdx:]:
                             if weaponId == itemId:
                                 continue
                             
                             stackAmt = inv.getStackQuantity(weaponId)
                             if stackAmt >= 1:
                                 self.highlightRed(PLocalizer.InventoryLowLevel)
                                 return None
                                 continue
                         
                 
         elif itemCategory == ItemType.POUCH:
             inv = base.localAvatar.getInventory()
             if currStock >= 1:
                 self.highlightGreen(PLocalizer.InventoryOwned)
             else:
                 pistolPouches = [
                     InventoryType.PistolPouchL1,
                     InventoryType.PistolPouchL2,
                     InventoryType.PistolPouchL3]
                 daggerPouches = [
                     InventoryType.DaggerPouchL1,
                     InventoryType.DaggerPouchL2,
                     InventoryType.DaggerPouchL3]
                 grenadePouches = [
                     InventoryType.GrenadePouchL1,
#.........这里部分代码省略.........
开发者ID:TTGhost,项目名称:POTCOR-src,代码行数:103,代码来源:InventoryItemGui.py

示例15: showDetails

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

#.........这里部分代码省略.........
            attributeRankLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.ItemRank % attributes[i][1], text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ARight, pos = (halfWidth - textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
            if attributeNameLabel.getHeight() > 0.074999999999999997:
                attributeNameSpace = 0.080000000000000002
            else:
                attributeNameSpace = PiratesGuiGlobals.TextScaleLarge
            attributeDescriptionLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.getItemAttributeDescription(attributes[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.7999999999999998 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition - attributeNameSpace), text_pos = (0.0, -textScale))
            aHeight = attributeNameLabel.getHeight() + attributeDescriptionLabel.getHeight()
            runningVertPosition -= aHeight + splitHeight
            runningSize += aHeight + splitHeight
            labels.append(attributeNameLabel)
            labels.append(attributeRankLabel)
            labels.append(attributeDescriptionLabel)

        skillBoosts = ItemGlobals.getSkillBoosts(itemId)
        for i in range(0, len(skillBoosts)):
            boostIcon = self.SkillIcons.find('**/%s' % WeaponGlobals.getSkillIcon(skillBoosts[i][0]))
            boostNameLabel = DirectLabel(parent = self, relief = None, image = border, image_scale = 0.050000000000000003, geom = boostIcon, geom_scale = 0.050000000000000003, image_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), geom_pos = (-0.070000000000000007, 0.0, -0.029999999999999999), text = PLocalizer.ItemBoost % PLocalizer.getInventoryTypeName(skillBoosts[i][0]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ALeft, pos = (-halfWidth + 0.12 + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
            boostRankLabel = DirectLabel(parent = self, relief = None, text = '+%s' % str(skillBoosts[i][1]), text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.90000000000000002 / titleScale), text_align = TextNode.ARight, pos = (halfWidth - textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
            bHeight = boostNameLabel.getHeight()
            runningVertPosition -= bHeight + splitHeight
            runningSize += bHeight + splitHeight
            labels.append(boostNameLabel)
            labels.append(boostRankLabel)

        description = PLocalizer.getItemFlavorText(itemId)
        if description != '':
            descriptionLabel = DirectLabel(parent = self, relief = None, text = description, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (0.94999999999999996 / textScale), text_align = TextNode.ALeft, pos = (-halfWidth + textScale * 0.5, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
            dHeight = descriptionLabel.getHeight() + 0.02
            runningVertPosition -= dHeight
            runningSize += dHeight
            labels.append(descriptionLabel)

        weaponLevel = 0
        weaponRepId = WeaponGlobals.getRepId(itemId)
        weaponRep = inv.getReputation(weaponRepId)
        weaponReq = ItemGlobals.getWeaponRequirement(itemId)
        weaponText = None
        if weaponReq:
            weaponLevel = ReputationGlobals.getLevelFromTotalReputation(weaponRepId, weaponRep)[0]
            if weaponLevel < weaponReq:
                weaponColor = PiratesGuiGlobals.TextFG6
            else:
                weaponColor = (0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
            weaponText = PLocalizer.ItemLevelRequirement % (weaponReq, PLocalizer.getItemTypeName(itemType))
        else:
            trainingToken = EconomyGlobals.getItemTrainingReq(itemId)
            trainingAmt = inv.getItemQuantity(trainingToken)
            if trainingAmt == 0:
                weaponColor = PiratesGuiGlobals.TextFG6
                weaponText = PLocalizer.ItemTrainingRequirement % PLocalizer.getItemTypeName(itemType)

        if weaponText:
            weaponReqLabel = DirectLabel(parent = self, relief = None, text = weaponText, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = weaponColor, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
            wHeight = weaponReqLabel.getHeight()
            runningVertPosition -= wHeight
            runningSize += wHeight
            labels.append(weaponReqLabel)

        if not Freebooter.getPaidStatus(localAvatar.getDoId()):
            if rarity != ItemGlobals.CRUDE:
                unlimitedLabel = DirectLabel(parent = self, relief = None, text = PLocalizer.UnlimitedAccessRequirement, text_scale = textScale, text_wordwrap = halfWidth * 2.0 * (1.5 / titleScale), text_fg = PiratesGuiGlobals.TextFG6, text_shadow = PiratesGuiGlobals.TextShadow, text_align = TextNode.ACenter, pos = (0.0, 0.0, runningVertPosition), text_pos = (0.0, -textScale))
                uHeight = unlimitedLabel.getHeight()
                runningVertPosition -= uHeight
                runningSize += uHeight
                labels.append(unlimitedLabel)
开发者ID:Puggyblue999,项目名称:PiratesOfTheCarribeanOnline,代码行数:69,代码来源:InventoryUICharmItem.py


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