Exemple #1
0
        public void Complete()
        {
            if (IsContract)
            {
                if (!RPG.PlayerData.Tutorial.LearntAboutIcons && RPG.PlayerData.Tutorial.PurchasedContract)
                {
                    var tut = RPG.GetPopup <TutorialBox>();
                    RPG.PlayerData.Tutorial.LearntAboutIcons = true;
                    EventHandler.Do(o =>
                    {
                        tut.Hide();
                        EventHandler.Wait(300);
                        tut.Pop("The information blip is for available quests and speech bubbles for interaction.", "The star blip is for handing in quests. Hand in the quest 'The Grind Begins'");
                    });
                }

                RPG.PlayerData.CompletedContracts++;
            }

            if (Name == "The Grind Begins")
            {
                if (!RPG.PlayerData.Tutorial.LearntAboutCrafting && RPG.PlayerData.Tutorial.LearntAboutIcons)
                {
                    var tut = RPG.GetPopup <TutorialBox>();
                    RPG.PlayerData.Tutorial.LearntAboutCrafting = true;
                    EventHandler.Do(o =>
                    {
                        tut.Hide();
                        EventHandler.Wait(300);
                        RPG.PlayerData.AddItem("Vehicle Parts", 9);
                        tut.Pop("Crafting can help you get items you need.", "Access the menu > Actions > Craft Items and craft a 'Vehicle Repair Kit'");
                    });
                }
            }

            RPG.PlayerData.AddExp(ExpReward);
            RPG.PlayerData.AddMoney(MoneyReward);

            foreach (var r in AdditionalRewards)
            {
                switch (r.RewardType)
                {
                case RewardType.Exp:
                    RPG.PlayerData.AddExp(r.IntVal);
                    break;

                case RewardType.Money:
                    RPG.PlayerData.AddMoney(r.IntVal);
                    break;

                case RewardType.UnlockSkill:
                    RPG.PlayerData.Skills.First(s => s.Name == r.StringVal).Unlocked = true;
                    break;

                case RewardType.Item:
                    RPG.PlayerData.AddItem(r.StringVal, r.IntVal);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            QuestRepository.GetCompleteAction(Name).Invoke(this);

            //Cleanup
            CleanupQuestOnDone();

            RPG.GetPopup <QuestComplete>().Show(this);
            RPG.UIHandler.View.CloseAllMenus();

            Done       = true;
            InProgress = false;

            if (IsRepeatable)
            {
                Reset();
            }
        }