Пример #1
0
        private static void TeacherFound(int value, SkillRank skillRank, SkillLine skillLine, Npc teacher)
        {
            if (TeacherFoundNoSpam.Contains(teacher))
            {
                return;
            }
            TeacherFoundNoSpam.Add(teacher);
            SkillRank nextRank;

            if (skillRank == SkillRank.ZenMaster)
            {
                nextRank = skillRank + 100;
            }
            else
            {
                nextRank = skillRank + 75;
            }
            string current = "You don't know this skill yet";

            if (skillRank > SkillRank.None)
            {
                current = "You are currently " + skillRank + " of " + skillLine.ToString() + ". Level " + value + "/" + (int)skillRank;
            }
            Logging.Write("Teacher of " + skillLine.ToString() + " found. " + current + ". You will become " + nextRank + " of " + skillLine.ToString() + ".");
            Logging.Write("Informations about the teacher of " + skillLine.ToString() + ". Id: " + teacher.Entry + ", Name: " + teacher.Name + ", Distance: " +
                          teacher.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) + ", Coords: " + teacher.Position);
        }
    protected Profession(SkillLine professionName)
    {
        CurrentStep  = null;
        Name         = professionName;
        ItemToDelete = null;
        ItemToSplit  = null;

        // Reset save if prof level is 0
        if (ToolBox.GetProfessionLevel(Name) == 0)
        {
            ToolBox.ClearProfessionFromSavedList(Name.ToString());
        }
    }
Пример #3
0
        private static bool IsNewSkillAvailable(int value, SkillRank maxValue, SkillLine skillLine, bool hardCheck = false)
        {
            uint price    = 0;
            uint minLevel = 0;
            int  maxLevelLeftBeforeLearn = 15;

            if (hardCheck)
            {
                maxLevelLeftBeforeLearn = 5;
            }
            bool primarySkillToLearn = false;

            // Note: Price and Levels of skills are hard-coded. But verified ingame with Friendly reputation to Orgrimmar.

            switch (maxValue)
            {
            case SkillRank.None:     // To Learn Apprentice
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                    if (!nManagerSetting.CurrentSetting.BecomeApprenticeIfNeededByProduct || PrimarySkillSlotAvailable() == 0)
                    {
                        return(false);
                    }
                    if ((skillLine == SkillLine.Mining &&
                         (!nManagerSetting.CurrentSetting.ActivateVeinsHarvesting &&
                          (Products.Products.ProductName != "Quester" || Products.Products.ProductName != "Gatherer" || Products.Products.ProductName == "Grinder"))) ||
                        (skillLine == SkillLine.Herbalism &&
                         (!nManagerSetting.CurrentSetting.ActivateHerbsHarvesting &&
                          (Products.Products.ProductName == "Quester" || Products.Products.ProductName == "Gatherer" || Products.Products.ProductName == "Grinder"))) ||
                        (skillLine == SkillLine.Skinning &&
                         (!nManagerSetting.CurrentSetting.ActivateBeastSkinning &&
                          (Products.Products.ProductName == "Quester" || Products.Products.ProductName == "Grinder"))))
                    {
                        return(false);
                    }
                    primarySkillToLearn = true;
                    price    = 10;
                    minLevel = 1;
                    break;

                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    if (Products.Products.ProductName != "ProfessionsManager" || PrimarySkillSlotAvailable() == 0)
                    {
                        return(false);
                    }
                    const string professionToLevelup = "Profession";         // Example
                    if (professionToLevelup != skillLine.ToString())
                    {
                        return(false);
                    }
                    primarySkillToLearn = true;
                    price    = 10;
                    minLevel = 5;
                    break;

                case SkillLine.Archaeology:
                    if (!nManagerSetting.CurrentSetting.BecomeApprenticeOfSecondarySkillsWhileQuesting || Products.Products.ProductName != "Quester")
                    {
                        if (!nManagerSetting.CurrentSetting.BecomeApprenticeIfNeededByProduct || Products.Products.ProductName != "Archaeologist")
                        {
                            return(false);
                        }
                    }
                    price    = 1000;
                    minLevel = 20;
                    break;

                case SkillLine.Cooking:
                case SkillLine.FirstAid:
                    if (!nManagerSetting.CurrentSetting.BecomeApprenticeOfSecondarySkillsWhileQuesting || Products.Products.ProductName != "Quester")
                    {
                        return(false);
                    }
                    price    = 95;
                    minLevel = 1;
                    break;

                case SkillLine.Fishing:
                    if (!nManagerSetting.CurrentSetting.BecomeApprenticeOfSecondarySkillsWhileQuesting || Products.Products.ProductName != "Quester")
                    {
                        if (!nManagerSetting.CurrentSetting.BecomeApprenticeIfNeededByProduct || Products.Products.ProductName != "Fisherbot")
                        {
                            return(false);
                        }
                    }
                    price    = 95;
                    minLevel = 5;
                    break;

                case SkillLine.Riding:
                    price    = 38000;
                    minLevel = 20;
                    break;
                }
                break;

            case SkillRank.Apprentice:     // To Learn Journeyman
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                    price    = 475;
                    minLevel = 1;
                    break;

                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    price    = 475;
                    minLevel = 10;
                    break;

                case SkillLine.Archaeology:
                    price    = 1000;
                    minLevel = 20;
                    break;

                case SkillLine.Cooking:
                case SkillLine.FirstAid:
                case SkillLine.Fishing:
                    price    = 475;
                    minLevel = 1;
                    break;

                case SkillLine.Riding:
                    price    = 475000;
                    minLevel = 40;
                    break;
                }
                break;

            case SkillRank.Journeyman:     // To Learn Expert
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                    price    = 4750;
                    minLevel = 10;
                    break;

                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    price    = 4750;
                    minLevel = 20;
                    break;

                case SkillLine.Archaeology:
                    price    = 1000;
                    minLevel = 20;
                    break;

                case SkillLine.Cooking:
                case SkillLine.FirstAid:
                case SkillLine.Fishing:
                    price    = 9500;
                    minLevel = 1;
                    break;

                case SkillLine.Riding:
                    price    = 2375000;
                    minLevel = 60;
                    break;
                }
                break;

            case SkillRank.Expert:     // To Learn Artisan
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                    price    = 47500;
                    minLevel = 25;
                    break;

                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    price    = 47500;
                    minLevel = 35;
                    break;

                case SkillLine.Archaeology:
                    price    = 25000;
                    minLevel = 35;
                    break;

                case SkillLine.Cooking:
                case SkillLine.Fishing:
                    price    = 23750;
                    minLevel = 1;
                    break;

                case SkillLine.FirstAid:
                    price    = 23750;
                    minLevel = 35;
                    break;

                case SkillLine.Riding:
                    // Todo: Check additionals Riding spells.
                    return(false);

                    /*case SkillLine.Riding:
                     * // Todo: Check additionals Riding spells.
                     * price = 47500000;
                     * minLevel = 70;
                     * break;*/
                }
                break;

            case SkillRank.Artisan:     // To Learn Master
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                    price    = 95000;
                    minLevel = 40;
                    break;

                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    price    = 95000;
                    minLevel = 50;
                    break;

                case SkillLine.Archaeology:
                    price    = 100000;
                    minLevel = 50;
                    break;

                case SkillLine.Cooking:
                case SkillLine.Fishing:
                    price    = 95000;
                    minLevel = 1;
                    break;

                case SkillLine.FirstAid:
                    price    = 95000;
                    minLevel = 50;
                    break;

                case SkillLine.Riding:
                    // Todo: Check additionals Riding spells.
                    return(false);

                    /*case SkillLine.Riding:
                     * // Todo: Check additionals Riding spells.
                     * price = 47500000;
                     * minLevel = 80;
                     * break;*/
                }
                break;

            case SkillRank.Master:     // To Learn Grand Master
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                    price    = 332500;
                    minLevel = 55;
                    break;

                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    price    = 332500;
                    minLevel = 65;
                    break;

                case SkillLine.Archaeology:
                    price    = 150000;
                    minLevel = 65;
                    break;

                case SkillLine.Cooking:
                case SkillLine.Fishing:
                    price    = 332500;
                    minLevel = 1;
                    break;

                case SkillLine.FirstAid:
                    price    = 142500;
                    minLevel = 65;
                    break;

                case SkillLine.Riding:
                    // Todo: Check additionals Riding spells.
                    return(false);
                }
                break;

            case SkillRank.GrandMaster:     // To Learn Illustrious Grand Master
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    price    = 475000;
                    minLevel = 75;
                    break;

                case SkillLine.Archaeology:
                    price    = 250000;
                    minLevel = 75;
                    break;

                case SkillLine.Cooking:
                    price    = 475000;
                    minLevel = 1;
                    break;

                case SkillLine.FirstAid:
                    price    = 237500;
                    minLevel = 75;
                    break;

                case SkillLine.Fishing:
                    return(false);
                }
                break;

            case SkillRank.IllustriousGrandMaster:     // To Learn Zen Master
                switch (skillLine)
                {
                case SkillLine.Herbalism:
                case SkillLine.Mining:
                case SkillLine.Skinning:
                case SkillLine.Leatherworking:
                case SkillLine.Alchemy:
                case SkillLine.Tailoring:
                case SkillLine.Enchanting:
                case SkillLine.Engineering:
                case SkillLine.Inscription:
                case SkillLine.Blacksmithing:
                case SkillLine.Jewelcrafting:
                    price    = 570000;
                    minLevel = 80;
                    break;

                case SkillLine.Archaeology:
                    price    = 600000;
                    minLevel = 80;
                    break;

                case SkillLine.Cooking:
                    price    = 570000;
                    minLevel = 1;
                    break;

                case SkillLine.FirstAid:
                    price    = 285000;
                    minLevel = 80;
                    break;
                }
                break;

            case SkillRank.ZenMaster:     // To Learn DraenorMaster. Complex.
            case SkillRank.DraenorMaster: // To Learn Legion. Complex.
            case SkillRank.Legion:        // Nothing to learn anymore.
                return(false);
                // Secondary skills should be easier to learn for Zen to Draenor to Legion (Fishing, Archaeology, etc)
            }
            if (nManagerSetting.CurrentSetting.OnlyTrainIfWeHave2TimesMoreMoneyThanOurWishListSum)
            {
                price = price * 2;
            }
            if (skillLine == SkillLine.Riding && ObjectManager.ObjectManager.Me.Level >= minLevel && (Usefuls.GetMoneyCopper - _whishListSum) >= price)
            {
                _whishListSum = _whishListSum + price;
                _lastPriceAddedToWhishList = price;
                return(true);
            }
            if ((int)maxValue - maxLevelLeftBeforeLearn <= value && ObjectManager.ObjectManager.Me.Level >= minLevel && (Usefuls.GetMoneyCopper - _whishListSum) >= price)
            {
                if (primarySkillToLearn && PrimarySkillSlotAvailable() - _primarySkillsSlotOnWhishList >= 1)
                {
                    _primarySkillsSlotOnWhishList = _primarySkillsSlotOnWhishList + 1;
                    _lastPrimarySkillsWhishList   = 1;
                }
                else if (primarySkillToLearn)
                {
                    return(false);
                }
                _whishListSum = _whishListSum + price;
                _lastPriceAddedToWhishList = price;
                return(true);
            }
            return(false);
        }
Пример #4
0
        public override void Run()
        {
            if (_listOfTeachers.Count <= 0)
            {
                return;
            }
            Npc bestTeacher = new Npc();

            for (int i = 0; i < _listOfTeachers.Count; i++)
            {
                Npc teacher = _listOfTeachers[i];
                if (bestTeacher.Entry > 0)
                {
                    // priority checks first
                    switch (Products.Products.ProductName)
                    {
                    case "Gatherer":
                        if (bestTeacher.Type == Npc.NpcType.MiningTrainer && teacher.Type != Npc.NpcType.RidingTrainer)
                        {
                            continue;
                        }
                        if (bestTeacher.Type == Npc.NpcType.HerbalismTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.MiningTrainer)
                        {
                            continue;
                        }
                        if (bestTeacher.Type == Npc.NpcType.SkinningTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.MiningTrainer &&
                            teacher.Type != Npc.NpcType.HerbalismTrainer)
                        {
                            continue;
                        }
                        if (teacher.Type == Npc.NpcType.RidingTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        else if (teacher.Type == Npc.NpcType.MiningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        else if (teacher.Type == Npc.NpcType.HerbalismTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.MiningTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        else if (teacher.Type == Npc.NpcType.SkinningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.MiningTrainer &&
                                 bestTeacher.Type != Npc.NpcType.HerbalismTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        break;

                    case "Quester":
                    case "Grinder":
                        if (bestTeacher.Type == Npc.NpcType.SkinningTrainer && teacher.Type != Npc.NpcType.RidingTrainer)
                        {
                            continue;
                        }
                        if (bestTeacher.Type == Npc.NpcType.MiningTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.SkinningTrainer)
                        {
                            continue;
                        }
                        if (bestTeacher.Type == Npc.NpcType.HerbalismTrainer && teacher.Type != Npc.NpcType.RidingTrainer && teacher.Type != Npc.NpcType.SkinningTrainer &&
                            teacher.Type != Npc.NpcType.MiningTrainer)
                        {
                            continue;
                        }
                        if (teacher.Type == Npc.NpcType.RidingTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        else if (teacher.Type == Npc.NpcType.SkinningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        else if (teacher.Type == Npc.NpcType.MiningTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.SkinningTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        else if (teacher.Type == Npc.NpcType.HerbalismTrainer && bestTeacher.Type != Npc.NpcType.RidingTrainer && bestTeacher.Type != Npc.NpcType.SkinningTrainer &&
                                 bestTeacher.Type != Npc.NpcType.MiningTrainer)
                        {
                            bestTeacher = teacher;
                        }
                        break;
                    }
                    if (bestTeacher == teacher)
                    {
                        continue; // We just set a best from priority checks, so distance check is not important anymore
                    }
                    if (ObjectManager.ObjectManager.Me.Position.DistanceTo(teacher.Position) < ObjectManager.ObjectManager.Me.Position.DistanceTo(bestTeacher.Position))
                    {
                        bestTeacher = teacher; // We do not have priority between teacher and the actual bestTeacher, so we use distance instead
                    }
                }
                else
                {
                    bestTeacher = teacher;
                }
            }

            if (bestTeacher.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 800)
            {
                if (Quest.TravelToQuestZone(bestTeacher.Position, ref _doTravel, bestTeacher.ContinentIdInt, false, bestTeacher.Type.ToString()))
                {
                    return;
                }
            }
            uint baseAddress = MovementManager.FindTarget(ref bestTeacher);

            if (MovementManager.InMovement)
            {
                return;
            }
            if (baseAddress == 0 && bestTeacher.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 10)
            {
                NpcDB.DelNpc(bestTeacher);
            }
            else if (baseAddress > 0)
            {
                if (bestTeacher.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) > 5f)
                {
                    return;
                }
                string[] skillInfo = bestTeacher.InternalData.Split(',');
                if (skillInfo.Length == 2)
                {
                    SkillLine skillLine = (SkillLine)Others.ToInt32(skillInfo[0]);
                    SkillRank skillRank = (SkillRank)Others.ToInt32(skillInfo[1]);
                    SkillRank nextRank;
                    if (skillRank == SkillRank.ZenMaster)
                    {
                        nextRank = skillRank + 100;
                    }
                    else
                    {
                        nextRank = skillRank + 75;
                    }
                    string oldRank = "";
                    if (skillRank != SkillRank.None)
                    {
                        oldRank = " We were only " + skillRank.ToString() + " of " + skillLine.ToString() + ".";
                    }
                    Logging.Write("We have just reached the Teacher of " + skillLine.ToString() + ", " + bestTeacher.Name + ". We are now going to learn " + nextRank.ToString() +
                                  " of " + skillLine.ToString() + "." + oldRank);
                }
                Interact.InteractWith(baseAddress);
                Thread.Sleep(500 + Usefuls.Latency);
                Quest.CompleteQuest();
                Gossip.TrainAllAvailableSpells();
                TeacherFoundNoSpam.Remove(bestTeacher);
                SpellManager.UpdateSpellBook();
                _doTravel = true;
            }
            // still on the road, but not in movement for some reasons
        }