Пример #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;
                }
            }
        }
Пример #2
0
        public void OnBookUsed(Player player)
        {
            if (player.whoAmI != Main.myPlayer || LoreAlreadyUnlocked)
            {
                return;
            }
            ClassUnlockLoreBase ClassBase = GetBase;

            if (IsComplete || MainMod.DebugMode)
            {
                if (!LoreAlreadyUnlocked)
                {
                    MainMod.AddClassUnlocked(ClassID, ClassModID);
                    Main.NewText("You unlocked [" + GetClassName + "] class.", Microsoft.Xna.Framework.Color.LightBlue);
                }
                return;
            }
            for (int o = 0; o < ClassBase.Objectives.Count; o++)
            {
                if (!LoreInternalProgress[o].Complete)
                {
                    switch (ClassBase.Objectives[o].objectivetype)
                    {
                    case ClassUnlockLoreBase.ObjectiveType.GatherItem:
                    {
                        ClassUnlockLoreBase.GatherItemObjective gio = (ClassUnlockLoreBase.GatherItemObjective)ClassBase.Objectives[o];
                        for (int i = 0; i < 58; i++)
                        {
                            if (player.inventory[i].type == gio.ItemID)
                            {
                                int StackToReduce = gio.Stack - (int)LoreInternalProgress[o].StepValue;
                                if (player.inventory[i].stack < StackToReduce)
                                {
                                    StackToReduce = player.inventory[i].stack;
                                }
                                LoreInternalProgress[o].StepValue += StackToReduce;
                                player.inventory[i].stack         -= StackToReduce;
                            }
                        }
                    }
                    break;
                    }
                    break;
                }
            }
        }
Пример #3
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;
            }
        }
Пример #4
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);
        }