def getItemRequirements(self, itemType, otherAdds=[]):
        if not itemType:
            return
        results = {}
        if game.process == 'client':
            paidStatus = Freebooter.getPaidStatus(self.ownerId)
        else:
            paidStatus = Freebooter.getPaidStatusAI(self.ownerId)
        rarity = ItemGlobals.getRarity(itemType)
        if rarity != ItemConstants.CRUDE and not paidStatus:
            results['paidStatus'] = (rarity != ItemConstants.CRUDE, False)
        itemClass = ItemGlobals.getClass(itemType)
        if itemClass == InventoryType.ItemTypeWeapon or itemClass == InventoryType.ItemTypeCharm:
            itemRepId = ItemGlobals.getItemRepId(itemType)
            itemRep = self.getReputation(itemRepId)
            itemLevel = ReputationGlobals.getLevelFromTotalReputation(
                itemRepId, itemRep)[0]
            weaponReq = ItemGlobals.getWeaponRequirement(itemType)
            trainingToken = EconomyGlobals.getItemTrainingReq(itemType)
            trainingAmt = self.getItemQuantity(trainingToken)
            for currAdd in otherAdds:
                otherAdd = InvItem(currAdd)
                if otherAdd.getCat(
                ) == trainingToken and otherAdd.getCount() > 0:
                    trainingAmt += otherAdd.getCount()

            weaponLevelPass = weaponReq == None or itemLevel >= weaponReq
            weaponTrainPass = trainingToken == 0 or trainingToken == None or trainingAmt > 0
            results['itemLevel'] = (weaponReq, weaponLevelPass
                                    and weaponTrainPass)
        else:
            results['itemLevel'] = (0, True)
        return results
    def getItemRequirements(self, itemType, otherAdds = []):
        if not itemType:
            return None

        results = { }
        if game.process == 'client':
            paidStatus = Freebooter.getPaidStatus(self.ownerId)
        else:
            paidStatus = Freebooter.getPaidStatusAI(self.ownerId)
        rarity = ItemGlobals.getRarity(itemType)
        if rarity != ItemConstants.CRUDE and not paidStatus:
            results['paidStatus'] = (rarity != ItemConstants.CRUDE, False)

        itemClass = ItemGlobals.getClass(itemType)
        if itemClass == InventoryType.ItemTypeWeapon or itemClass == InventoryType.ItemTypeCharm:
            itemRepId = ItemGlobals.getItemRepId(itemType)
            itemRep = self.getReputation(itemRepId)
            itemLevel = ReputationGlobals.getLevelFromTotalReputation(itemRepId, itemRep)[0]
            weaponReq = ItemGlobals.getWeaponRequirement(itemType)
            trainingToken = EconomyGlobals.getItemTrainingReq(itemType)
            trainingAmt = self.getItemQuantity(trainingToken)
            for currAdd in otherAdds:
                otherAdd = InvItem(currAdd)
                if otherAdd.getCat() == trainingToken and otherAdd.getCount() > 0:
                    trainingAmt += otherAdd.getCount()
                    continue

            if not weaponReq == None:
                pass
            weaponLevelPass = itemLevel >= weaponReq
            if not trainingToken == 0 and trainingToken == None:
                pass
            weaponTrainPass = trainingAmt > 0
            if weaponLevelPass:
                pass
            results['itemLevel'] = (weaponReq, weaponTrainPass)
        else:
            results['itemLevel'] = (0, True)
        return results
 def createGui(self):
     itemId = self.data[0]
     (item, quantity) = self.data
     name = ItemGlobals.getName(item)
     itemType = ItemGlobals.getType(item)
     itemTypeName = name
     repCategory = ItemGlobals.getItemRepId(itemId)
     if quantity:
         repValue = localAvatar.getInventory().getReputation(repCategory)
         self.repMeter = ReputationMeter(repCategory, width = 0.66000000000000003)
         self.repMeter.setPos(0.62, 0, 0.041000000000000002)
         self.repMeter.update(repValue)
         self.repMeter.reparentTo(self)
         self.repMeter.flattenLight()
         hotkeyLabel = ''
         hotkeys = ()
         desc = PLocalizer.WeaponDescriptions.get(itemId)
         helpText = PLocalizer.InventoryTypeNames[repCategory]
         self.weaponButton = CombatTray.WeaponButton(hotkeys = hotkeys, hotkeyLabel = hotkeyLabel, helpOpaque = True, helpText = helpText, parent = self, showQuant = 0, pos = (0.10000000000000001, 0, -0.02), scale = 1.1000000000000001)
         self.weaponButton.ignoreHotkeys()
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton['extraArgs'] = [
             itemId]
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = PLocalizer.WeaponAlreadyUnlocked, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, -0.0050000000000000001), text_font = PiratesGlobals.getInterfaceFont())
     else:
         self.repMeter = None
         name = PLocalizer.makeHeadingString(PLocalizer.InventoryTypeNames[repCategory], 2)
         self.categoryLabel = DirectLabel(parent = self, relief = None, text = name, text_scale = PiratesGuiGlobals.TextScaleLarge, text_align = TextNode.ALeft, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.059999999999999998), textMayChange = 0)
         self.weaponButton = CombatTray.WeaponButton(parent = self, state = DGG.DISABLED, showQuant = 0, scale = 1.1000000000000001)
         self.weaponButton.setPos(0.10000000000000001, 0, -0.02)
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         unlockDesc = PLocalizer.WeaponUnlockText[repCategory]
         self.desc = DirectLabel(parent = self, relief = None, state = DGG.DISABLED, text = unlockDesc, text_scale = PiratesGuiGlobals.TextScaleSmall, text_align = TextNode.ALeft, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, pos = (0.28999999999999998, 0, 0.025000000000000001), text_font = PiratesGlobals.getInterfaceFont())
         self.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1, 1)
예제 #4
0
 def createGui(self):
     itemId = self.data[0]
     (item, quantity) = self.data
     name = ItemGlobals.getName(item)
     itemType = ItemGlobals.getType(item)
     itemTypeName = name
     repCategory = ItemGlobals.getItemRepId(itemId)
     if quantity:
         repValue = localAvatar.getInventory().getReputation(repCategory)
         self.repMeter = ReputationMeter(repCategory,
                                         width=0.66000000000000003)
         self.repMeter.setPos(0.62, 0, 0.041000000000000002)
         self.repMeter.update(repValue)
         self.repMeter.reparentTo(self)
         self.repMeter.flattenLight()
         hotkeyLabel = ''
         hotkeys = ()
         desc = PLocalizer.WeaponDescriptions.get(itemId)
         helpText = PLocalizer.InventoryTypeNames[repCategory]
         self.weaponButton = CombatTray.WeaponButton(
             hotkeys=hotkeys,
             hotkeyLabel=hotkeyLabel,
             helpOpaque=True,
             helpText=helpText,
             parent=self,
             showQuant=0,
             pos=(0.10000000000000001, 0, -0.02),
             scale=1.1000000000000001)
         self.weaponButton.ignoreHotkeys()
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton['extraArgs'] = [itemId]
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         self.desc = DirectLabel(
             parent=self,
             relief=None,
             state=DGG.DISABLED,
             text=PLocalizer.WeaponAlreadyUnlocked,
             text_scale=PiratesGuiGlobals.TextScaleSmall,
             text_align=TextNode.ALeft,
             text_fg=PiratesGuiGlobals.TextFG2,
             text_shadow=PiratesGuiGlobals.TextShadow,
             pos=(0.28999999999999998, 0, -0.0050000000000000001),
             text_font=PiratesGlobals.getInterfaceFont())
     else:
         self.repMeter = None
         name = PLocalizer.makeHeadingString(
             PLocalizer.InventoryTypeNames[repCategory], 2)
         self.categoryLabel = DirectLabel(
             parent=self,
             relief=None,
             text=name,
             text_scale=PiratesGuiGlobals.TextScaleLarge,
             text_align=TextNode.ALeft,
             text_shadow=PiratesGuiGlobals.TextShadow,
             pos=(0.28999999999999998, 0, 0.059999999999999998),
             textMayChange=0)
         self.weaponButton = CombatTray.WeaponButton(
             parent=self,
             state=DGG.DISABLED,
             showQuant=0,
             scale=1.1000000000000001)
         self.weaponButton.setPos(0.10000000000000001, 0, -0.02)
         self.weaponButton.setWeaponId(itemId)
         self.weaponButton.helpDelay = 0
         self.weaponButton.helpPos = (0.12, 0, -0.040000000000000001)
         unlockDesc = PLocalizer.WeaponUnlockText[repCategory]
         self.desc = DirectLabel(
             parent=self,
             relief=None,
             state=DGG.DISABLED,
             text=unlockDesc,
             text_scale=PiratesGuiGlobals.TextScaleSmall,
             text_align=TextNode.ALeft,
             text_fg=PiratesGuiGlobals.TextFG2,
             text_shadow=PiratesGuiGlobals.TextShadow,
             pos=(0.28999999999999998, 0, 0.025000000000000001),
             text_font=PiratesGlobals.getInterfaceFont())
         self.setColorScale(0.40000000000000002, 0.40000000000000002,
                            0.40000000000000002, 1, 1)