Пример #1
0
    public void SetSelectedQuest(Quest quest)
    {
        if (quest.IsPlotQuest)
        {
            PlotQuest plotQuest = (PlotQuest)quest;

            questTitle.text       = LocalizationManager.GetString("town_quest_name_" + plotQuest.Id);
            questDescription.text = LocalizationManager.GetString("town_quest_description_" + plotQuest.Id);
            questLength.text      = plotQuest.Length.ToString();
            campfireAmount.text   = "x" + (quest.Length - 1).ToString();
            questLength.text      = LocalizationManager.GetString("town_quest_length_" + plotQuest.Length.ToString());
            questDifficulty.text  = LocalizationManager.GetString("town_quest_difficulty_" + plotQuest.Difficulty.ToString());
            questGoals.text       = LocalizationManager.GetString("town_quest_goals") + "\n";
            questGoals.text      += plotQuest.Goal.QuestData.GetDataString(plotQuest.Goal.Type);
            questRewardPanel.UpdateRewardSlots(quest);
        }
        else
        {
            questTitle.text = LocalizationManager.GetString("town_quest_name_" + quest.Type +
                                                            "+" + quest.Length.ToString() + "+" + quest.Dungeon + "+" + quest.Goal.Id);
            questDescription.text = LocalizationManager.GetString("town_quest_description_" +
                                                                  quest.Type + "+" + quest.Length.ToString() + "+" + quest.Dungeon + "+" + quest.Goal.Id);
            questLength.text     = quest.Length.ToString();
            campfireAmount.text  = "x" + (quest.Length - 1).ToString();
            questLength.text     = LocalizationManager.GetString("town_quest_length_" + quest.Length.ToString());
            questDifficulty.text = LocalizationManager.GetString("town_quest_difficulty_" + quest.Difficulty.ToString());
            questGoals.text      = LocalizationManager.GetString("town_quest_goals") + "\n";
            questGoals.text     += quest.Goal.QuestData.GetDataString(quest.Goal.Type);
            questRewardPanel.UpdateRewardSlots(quest);
        }
    }
Пример #2
0
    public void PrepareRewards()
    {
        rewardPanel.UpdateRewardSlots(RaidSceneManager.Raid.Quest);
        if (DarkestDungeonManager.RaidManager.Status == RaidStatus.Success)
        {
            if (RaidSceneManager.Raid.Quest.IsPlotQuest)
            {
                var plot = RaidSceneManager.Raid.Quest as PlotQuest;
                DarkestDungeonManager.Campaign.CompletedPlot.Add(plot.Id);
            }
            DarkestDungeonManager.Campaign.QuestsComleted++;

            if (RaidSceneManager.Raid.Quest.CompletionDungeonXp)
            {
                int dungeonExpAmount = DarkestDungeonManager.Data.CampaignGeneration.DungeonXpTable[RaidSceneManager.Raid.Quest.Length];
                dungeonExpAmount += (RaidSceneManager.Raid.Quest.Difficulty + 1) / 2;
                DarkestDungeonManager.Campaign.Dungeons[RaidSceneManager.Raid.Quest.Dungeon].AddExperience(dungeonExpAmount);
            }

            foreach (var rewardSlot in rewardPanel.RewardSlots)
            {
                if (rewardSlot.isActiveAndEnabled)
                {
                    if (rewardSlot.Item.Type == "gold")
                    {
                        DarkestDungeonManager.Campaign.Estate.AddGold(rewardSlot.Item.Amount);
                    }
                    else if (rewardSlot.Item.Type == "heirloom")
                    {
                        if (rewardSlot.Item.Id == "bust")
                        {
                            DarkestDungeonManager.Campaign.Estate.AddHeirlooms(0, 0, 0, rewardSlot.Item.Amount);
                        }
                        else if (rewardSlot.Item.Id == "portrait")
                        {
                            DarkestDungeonManager.Campaign.Estate.AddHeirlooms(0, 0, rewardSlot.Item.Amount, 0);
                        }
                        else if (rewardSlot.Item.Id == "deed")
                        {
                            DarkestDungeonManager.Campaign.Estate.AddHeirlooms(0, rewardSlot.Item.Amount, 0, 0);
                        }
                        else if (rewardSlot.Item.Id == "crest")
                        {
                            DarkestDungeonManager.Campaign.Estate.AddHeirlooms(rewardSlot.Item.Amount, 0, 0, 0);
                        }
                    }
                    else if (rewardSlot.Item.Type == "trinket")
                    {
                        for (int i = 0; i < rewardSlot.Item.Amount; i++)
                        {
                            DarkestDungeonManager.Campaign.RealmInventory.Trinkets.Add(
                                DarkestDungeonManager.Data.Items[rewardSlot.Item.Type][rewardSlot.Item.Id] as Trinket);
                        }
                    }
                }
            }
        }
        int gold     = 0;
        int crest    = 0;
        int deed     = 0;
        int portrait = 0;
        int bust     = 0;

        if (RaidSceneManager.Formations.Heroes.Party.Units.Count > 0)
        {
            foreach (var slot in RaidSceneManager.Inventory.InventorySlots)
            {
                if (slot.HasItem && slot.SlotItem.ItemType != "trinket")
                {
                    if (slot.SlotItem.Item.Type == "heirloom")
                    {
                        if (slot.SlotItem.Item.Id == "bust")
                        {
                            bust += slot.SlotItem.Item.Amount;
                        }
                        else if (slot.SlotItem.Item.Id == "portrait")
                        {
                            portrait += slot.SlotItem.Item.Amount;
                        }
                        else if (slot.SlotItem.Item.Id == "deed")
                        {
                            deed += slot.SlotItem.Item.Amount;
                        }
                        else if (slot.SlotItem.Item.Id == "crest")
                        {
                            crest += slot.SlotItem.Item.Amount;
                        }

                        for (int i = 0; i < slot.SlotItem.Item.Amount; i++)
                        {
                            GameObject newSlot = Instantiate(lootSlot);
                            RewardSlot rewSlot = newSlot.GetComponentInChildren <RewardSlot>();
                            rewSlot.SetSingle(slot.SlotItem.Item);
                            newSlot.transform.SetParent(heirloomSlots, false);
                            newSlot.transform.SetAsLastSibling();
                        }
                    }
                    else if (slot.SlotItem.Item.Type == "gold")
                    {
                        gold += slot.SlotItem.Item.Amount;
                        GameObject newSlot = Instantiate(lootSlot);
                        RewardSlot rewSlot = newSlot.GetComponentInChildren <RewardSlot>();
                        rewSlot.SetItem(slot.SlotItem.Item);
                        newSlot.transform.SetParent(treasureSlots, false);
                        newSlot.transform.SetAsLastSibling();
                    }
                    else if (slot.SlotItem.ItemData.SellPrice != 0)
                    {
                        gold += slot.SlotItem.ItemData.SellPrice * slot.SlotItem.Item.Amount;

                        for (int i = 0; i < slot.SlotItem.Item.Amount; i++)
                        {
                            GameObject newSlot = Instantiate(lootSlot);
                            RewardSlot rewSlot = newSlot.GetComponentInChildren <RewardSlot>();
                            rewSlot.SetSingle(slot.SlotItem.Item);
                            newSlot.transform.SetParent(treasureSlots, false);
                            newSlot.transform.SetAsLastSibling();
                        }
                    }
                }
                else if (slot.HasItem && slot.SlotItem.ItemType == "trinket")
                {
                    DarkestDungeonManager.Campaign.RealmInventory.Trinkets.Add(slot.SlotItem.ItemData as Trinket);
                }
            }
        }
        goldAmount.text     = gold.ToString();
        crestAmount.text    = crest.ToString();
        deedAmount.text     = deed.ToString();
        portraitAmount.text = portrait.ToString();
        bustAmount.text     = bust.ToString();

        DarkestDungeonManager.Campaign.Estate.AddGold(gold);
        DarkestDungeonManager.Campaign.Estate.AddHeirlooms(crest, deed, portrait, bust);
    }