Esempio n. 1
0
        public void OnMobKill(int MobID, int MobNetID)
        {
            if (LoreAlreadyUnlocked)
            {
                return;
            }
            ClassUnlockLoreBase ClassBase = GetBase;

            for (int i = 0; i < ClassBase.Objectives.Count; i++)
            {
                if (!LoreInternalProgress[i].Complete)
                {
                    switch (ClassBase.Objectives[i].objectivetype)
                    {
                    case ClassUnlockLoreBase.ObjectiveType.Hunt:
                    {
                        ClassUnlockLoreBase.HuntMonsterObjective hmo = (ClassUnlockLoreBase.HuntMonsterObjective)ClassBase.Objectives[i];
                        if (IsRequiredMonster(MobID, hmo.MobID))
                        {
                            LoreInternalProgress[i].StepValue++;
                        }
                    }
                    break;
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
        public void Update(Player player)
        {
            if (LoreAlreadyUnlocked)
            {
                return;
            }
            if (MainMod.DebugMode)
            {
                IsComplete = true;
                return;
            }
            ClassUnlockLoreBase ClassBase = GetBase;

            IsComplete = true;
            int HighestCompletedObjective = 0;

            for (int i = 0; i < ClassBase.Objectives.Count; i++)
            {
                if (!LoreInternalProgress[i].Complete)
                {
                    switch (ClassBase.Objectives[i].objectivetype)
                    {
                    case ClassUnlockLoreBase.ObjectiveType.Hunt:
                    {
                        ClassUnlockLoreBase.HuntMonsterObjective hmo = (ClassUnlockLoreBase.HuntMonsterObjective)ClassBase.Objectives[i];
                        if (LoreInternalProgress[i].StepValue >= hmo.Stack)
                        {
                            LoreInternalProgress[i].Complete = true;
                        }
                    }
                    break;

                    case ClassUnlockLoreBase.ObjectiveType.GatherItem:
                    {
                        ClassUnlockLoreBase.GatherItemObjective gio = (ClassUnlockLoreBase.GatherItemObjective)ClassBase.Objectives[i];
                        if (LoreInternalProgress[i].StepValue >= gio.Stack)
                        {
                            LoreInternalProgress[i].Complete = true;
                        }
                    }
                    break;

                    case ClassUnlockLoreBase.ObjectiveType.TalkToNpc:
                    {
                        ClassUnlockLoreBase.TalkToNpcObjective tno = (ClassUnlockLoreBase.TalkToNpcObjective)ClassBase.Objectives[i];
                        if (LoreInternalProgress[i].StepValue >= 1)
                        {
                            LoreInternalProgress[i].Complete = true;
                        }
                        else
                        {
                            if (player.talkNPC > -1 && Main.npc[player.talkNPC].type == tno.NpcID)
                            {
                                LoreInternalProgress[i].StepValue = 1;
                                Main.npcChatText = tno.MessageText;
                            }
                        }
                    }
                    break;
                    }
                    if (!LoreInternalProgress[i].Complete)
                    {
                        IsComplete = false;
                        HighestCompletedObjective = i;
                        break;
                    }
                }
            }
            if (HighestCompletedObjective > LastLoreStep)
            {
                if (LastLoreStep > -1)
                {
                    if (LastLoreStep == ClassBase.Objectives.Count - 1)
                    {
                        Main.NewText("You unveiled [" + GetClassName + "] class knowledge.", Microsoft.Xna.Framework.Color.Green);
                    }
                    else
                    {
                        Main.NewText("Part of [" + GetClassName + "] class knowledge unlocked.", Microsoft.Xna.Framework.Color.Orange);
                    }
                }
                LastLoreStep = HighestCompletedObjective;
            }
        }
Esempio n. 3
0
        public string GetText()
        {
            string Lore = "";
            ClassUnlockLoreBase ClassBase = GetBase;
            bool LoreUnlocked             = LoreAlreadyUnlocked || MainMod.DebugMode;

            for (int i = 0; i < ClassBase.Objectives.Count; i++)
            {
                if (!LoreInternalProgress[i].Complete && !LoreUnlocked)
                {
                    if (Lore == "")
                    {
                        Lore = "[Lore is hidden until you prove your worth]\n";
                    }
                    else
                    {
                        Lore += "...'\n";
                    }
                    switch (ClassBase.Objectives[i].objectivetype)
                    {
                    case ClassUnlockLoreBase.ObjectiveType.Hunt:
                    {
                        ClassUnlockLoreBase.HuntMonsterObjective hmo = (ClassUnlockLoreBase.HuntMonsterObjective)ClassBase.Objectives[i];
                        Lore += "Hunt " + LoreInternalProgress[i].StepValue + "/" + hmo.Stack + " " + hmo.GetMobName + ".";
                    }
                    break;

                    case ClassUnlockLoreBase.ObjectiveType.GatherItem:
                    {
                        ClassUnlockLoreBase.GatherItemObjective gio = (ClassUnlockLoreBase.GatherItemObjective)ClassBase.Objectives[i];
                        Lore += "Collect " + (gio.Stack - LoreInternalProgress[i].StepValue) + " " + gio.GetItemName + ".\nUse the book to place items inside It.";
                    }
                    break;

                    case ClassUnlockLoreBase.ObjectiveType.TalkToNpc:
                    {
                        ClassUnlockLoreBase.TalkToNpcObjective tno = (ClassUnlockLoreBase.TalkToNpcObjective)ClassBase.Objectives[i];
                        Lore += "Speak with " + tno.NpcName + ".";
                    }
                    break;
                    }
                    break;
                }
                else
                {
                    if (Lore == "")
                    {
                        Lore += "'";
                    }
                    Lore += ClassBase.Objectives[i].LorePiece;
                }
            }
            if (MainMod.DebugMode)
            {
                Lore += "'\n'For debugging, you can unlock this class freely by using the book.'";
            }
            else if (LoreAlreadyUnlocked)
            {
                Lore += "'\nYou have already unlocked this class.";
            }
            else if (IsComplete)
            {
                Lore += "'\nUse the book to unlock the class knowledge.";
            }
            return(Lore);
        }