Пример #1
0
    def setItemRewards(self, rewards):
        if self.rewardsContainer:
            self.rewardsContainer.destroy()
            self.rewardsContainer = None

        itemRewards = []
        for reward in rewards:
            if reward.getItemId():
                itemRewards.append(reward.getItemId())
                continue

        if itemRewards and hasattr(localAvatar, 'guiMgr'):
            scale = 0.10000000000000001 * len(itemRewards)
            self.rewardsContainer = InventoryUIRewardsContainer.InventoryUIRewardsContainer(
                localAvatar.guiMgr.inventoryUIManager,
                sizeX=scale,
                sizeZ=scale,
                countX=len(itemRewards),
                countZ=1)
            self.rewardsContainer.setPos(
                0.050000000000000003, 0,
                -0.25 - 0.059999999999999998 * len(itemRewards))
            self.rewardsContainer.reparentTo(self)
            for itemId in itemRewards:
                self.rewardsContainer.addRewardIntoGrid(
                    itemId, itemRewards.index(itemId), 0)
Пример #2
0
    def __init__(self, quest, rewards):
        self.width = 1
        self.rewards = rewards
        QuestDetailBase.__init__(self, parent=base.a2dBottomRight, pos=(0.6, 0, 0.52), text_fg=PiratesGuiGlobals.TextFG0)
        self.initialiseoptions(QuestRewardGUI)
        self.questComplete = DirectLabel(parent=self, relief=None, text=PLocalizer.QuestCompleted, text_fg=PiratesGuiGlobals.TextFG4, text_font=PiratesGlobals.getPirateOutlineFont(), text_shadow=(0,
                                                                                                                                                                                                    0,
                                                                                                                                                                                                    0,
                                                                                                                                                                                                    1), pos=(-1.32,
                                                                                                                                                                                                             0,
                                                                                                                                                                                                             0.13), scale=PiratesGuiGlobals.TextScaleTitleMed)
        gui = loader.loadModel('models/gui/toplevel_gui')
        gcButton = gui.find('**/treasure_w_coin*')
        goldCoin = gcButton.copyTo(gcButton)
        goldCoin.setScale(3)
        tpMgr.setGraphic('goldCoin', goldCoin)
        self.popupSfx = loadSfx(SoundGlobals.SFX_GUI_REWARD_POPUP)
        self.popupSfx.setVolume(0.4)
        self.reputation = self.rewards.get('reputation', 0)
        self.totalReputation = 0
        self.rewardsContainer = None
        self.items = self.rewards.get('items', [])
        if self.items:
            scale = 0.12 * len(self.items)
            self.rewardsContainer = InventoryUIRewardsContainer.InventoryUIRewardsContainer(localAvatar.guiMgr.inventoryUIManager, sizeX=scale, sizeZ=scale, countX=len(self.items), countZ=1)
            self.rewardsContainer.setPos(-0.1, 0, -0.225 - 0.06 * len(self.items))
            self.rewardsContainer.reparentTo(self)
            for itemId in self.items:
                self.rewardsContainer.addRewardIntoGrid(itemId, self.items.index(itemId), 0)

        inv = localAvatar.getInventory()
        if inv:
            self.totalReputation = localAvatar.getInventory().getReputation(InventoryType.OverallRep)
        oldLevel, leftoverValue = ReputationGlobals.getLevelFromTotalReputation(InventoryType.OverallRep, self.totalReputation)
        newLevel, leftoverValue = ReputationGlobals.getLevelFromTotalReputation(InventoryType.OverallRep, self.totalReputation + self.reputation)
        if oldLevel != newLevel:
            self.showLevelUp = True
        else:
            self.showLevelUp = False
        self.buildIvals()
        self.setQuestInfoFromQuest(quest)
        self.showPanel()
        return