Exemple #1
0
 public void ExecuteFlow()
 {
     //if (ObjectManager.Target != null)
     //Common.Instance.DebugMessage(ObjectManager.Target.FactionId.ToString());
     if (MerchantModule.NeedToVendor())
     {
         MerchantModule.Vendoring = true;
     }
     if (ObjectManager.Player.IsInCombat)
     {
         CombatModule.Fight();
     }
     else
     {
         var closestSkinnableNpc = NPCScanModule.ClosestSkinnableNPC();
         var closestLootableNpc  = NPCScanModule.ClosestLootableNPC();
         if (!MerchantModule.Vendoring)
         {
             if (closestLootableNpc != null && GrinderDefault.CorpseLoot)
             {
                 NPCScanModule.LootCorpse(closestLootableNpc);
             }
             else if (closestSkinnableNpc != null && GrinderDefault.CorpseLoot && GrinderDefault.CorpseSkin)
             {
                 NPCScanModule.LootCorpse(closestSkinnableNpc);
             }
             else
             {
                 if (CombatModule.IsReadyToFight())
                 {
                     if (!CombatModule.IsBuffRequired())
                     {
                         var closestCombattableNpc = NPCScanModule.ClosestCombattableNPC();
                         if (closestCombattableNpc != null &&
                             NPCScanModule.UnitInHotspots(closestCombattableNpc, PathModule.Hotspots, GrinderDefault.SearchRadius))
                         {
                             CombatModule.Pull(closestCombattableNpc);
                         }
                         else
                         {
                             PathModule.Traverse(PathModule.GetNextHotspot());
                         }
                     }
                     else
                     {
                         CombatModule.Rebuff();
                     }
                 }
                 else
                 {
                     CombatModule.PrepareForFight();
                 }
             }
         }
         else
         {
             if (CombatModule.IsReadyToFight())
             {
                 if (!CombatModule.IsBuffRequired())
                 {
                     var closestRepairNPC       = NPCScanModule.RepairNPCFromProfile();
                     var closestCombattableNpcV = NPCScanModule.ClosestCombattableNPCV();
                     if (closestRepairNPC != null)
                     {
                         NPCScanModule.InteractWithVendor(closestRepairNPC);
                         MerchantModule.RepairAndVendor();
                     }
                     else
                     {
                         if (closestCombattableNpcV != null &&
                             NPCScanModule.UnitInHotspots(closestCombattableNpcV, PathModule.Vendor, GrinderDefault.SearchRadius))
                         {
                             CombatModule.Pull(closestCombattableNpcV);
                         }
                         else
                         {
                             PathModule.Traverse(PathModule.GetNextVendorHotspot());
                         }
                     }
                 }
                 else
                 {
                     CombatModule.Rebuff();
                 }
             }
             else
             {
                 CombatModule.PrepareForFight();
             }
         }
     }
 }
Exemple #2
0
        public void ExecuteFlow()
        {
            closestNode = NodeScanModule.ClosestNode();

            if (ObjectManager.Player.IsInCombat)
            {
                if (closestNode == null)
                {
                    if (ObjectManager.Player.IsMounted)
                    {
                        PathModule.Traverse(PathModule.GetNextHotspot());
                    }

                    if (!ObjectManager.Player.IsMounted)
                    {
                        if (CombatModule.EliteInCombatNPC() == null)
                        {
                            CombatModule.Fight();
                        }

                        if (CombatModule.EliteInCombatNPC() != null)
                        {
                            PathModule.Traverse(PathModule.GetNextHotspot());
                        }
                    }
                }

                if (closestNode != null)
                {
                    nodeGuardian = NodeScanModule.NodeGuardian(closestNode);

                    if (nodeGuardian != null)
                    {
                        if ((nodeGuardian.CreatureRank & Enums.CreatureRankTypes.Elite) == Enums.CreatureRankTypes.Elite ||
                            (nodeGuardian.CreatureRank & Enums.CreatureRankTypes.RareElite) == Enums.CreatureRankTypes.RareElite)
                        {
                            NodeScanModule.blacklist.Add(closestNode.Guid);

                            return;
                        }
                    }

                    if (ObjectManager.Player.IsMounted)
                    {
                        if (CombatModule.EliteInCombatNPC() == null)
                        {
                            Inventory.GetItem(ConsumablesModule.Mount().Name).Use();
                        }

                        if (CombatModule.EliteInCombatNPC() != null)
                        {
                            PathModule.Traverse(NodeScanModule.ClosestNode().Position);
                        }
                    }

                    if (!ObjectManager.Player.IsMounted)
                    {
                        if (CombatModule.EliteInCombatNPC() == null)
                        {
                            CombatModule.Fight();
                        }

                        if (CombatModule.EliteInCombatNPC() != null)
                        {
                            PathModule.Traverse(NodeScanModule.ClosestNode().Position);
                        }
                    }
                }
            }

            if (!ObjectManager.Player.IsInCombat)
            {
                if (!CombatModule.IsReadyToFight())
                {
                    if (ObjectManager.Player.IsMounted)
                    {
                        Inventory.GetItem(ConsumablesModule.Mount().Name).Use();
                    }

                    if (ConsumablesModule.Food() != null &&
                        ObjectManager.Player.HealthPercent < 60 &&
                        !ObjectManager.Player.GotAura("Food"))
                    {
                        Inventory.GetItem(ConsumablesModule.Food().Name).Use();
                    }

                    if (ConsumablesModule.Drink() != null &&
                        ObjectManager.Player.ManaPercent < 60 &&
                        !ObjectManager.Player.GotAura("Drink"))
                    {
                        Inventory.GetItem(ConsumablesModule.Drink().Name).Use();
                    }
                }

                if (CombatModule.IsReadyToFight())
                {
                    if (closestNode == null)
                    {
                        if (ObjectManager.Player.CastingAsName == "Herb Gathering" ||
                            ObjectManager.Player.CastingAsName == "Mining")
                        {
                            Spell.StopCasting();
                        }

                        if (!ObjectManager.Player.IsMounted &&
                            !CMD.mountDisabled &&
                            Inventory.GetItemCount(ConsumablesModule.Mount().Name) > 0 &&
                            !ObjectManager.Player.IsSwimming &&
                            ObjectManager.Player.CastingAsName == "")
                        {
                            Lua.Execute("DoEmote('stand')");
                            Inventory.GetItem(ConsumablesModule.Mount().Name).Use();
                        }

                        if (ObjectManager.Player.IsMounted ||
                            Inventory.GetItemCount(ConsumablesModule.Mount().Name) == 0 ||
                            ObjectManager.Player.IsSwimming)
                        {
                            PathModule.Traverse(PathModule.GetNextHotspot());
                        }
                    }

                    if (closestNode != null)
                    {
                        nodeGuardian = NodeScanModule.NodeGuardian(closestNode);

                        if (nodeGuardian != null)
                        {
                            if ((nodeGuardian.CreatureRank & Enums.CreatureRankTypes.Elite) == Enums.CreatureRankTypes.Elite ||
                                (nodeGuardian.CreatureRank & Enums.CreatureRankTypes.RareElite) == Enums.CreatureRankTypes.RareElite)
                            {
                                NodeScanModule.blacklist.Add(closestNode.Guid);

                                return;
                            }

                            if (ObjectManager.Player.IsMounted)
                            {
                                Inventory.GetItem(ConsumablesModule.Mount().Name).Use();
                            }

                            ObjectManager.Player.SetTarget(nodeGuardian);

                            if (ObjectManager.Target == nodeGuardian)
                            {
                                CombatModule.Pull(ObjectManager.Target);
                            }

                            return;
                        }

                        if (closestNode.Position.DistanceToPlayer() > 3 &&
                            (ObjectManager.Player.CastingAsName == "Herb Gathering" ||
                             ObjectManager.Player.CastingAsName == "Mining"))
                        {
                            Spell.StopCasting();
                        }

                        if (closestNode.Position.DistanceToPlayer() <= 3)
                        {
                            if (ObjectManager.Player.IsMounted)
                            {
                                Inventory.GetItem(ConsumablesModule.Mount().Name).Use();
                            }

                            ObjectManager.Player.CtmStopMovement();

                            if (ObjectManager.Player.CastingAsName != "Herb Gathering" &&
                                ObjectManager.Player.CastingAsName != "Mining")
                            {
                                Lua.Execute("DoEmote('stand')");
                                closestNode.Interact(true);
                            }

                            return;
                        }

                        PathModule.Traverse(NodeScanModule.ClosestNode().Position);
                        PathModule.index = -1;
                        PathModule.playerPositions.Add(Convert.ToInt32(ObjectManager.Player.Position.X).ToString()
                                                       + Convert.ToInt32(ObjectManager.Player.Position.Y).ToString()
                                                       + Convert.ToInt32(ObjectManager.Player.Position.Z).ToString());

                        if (PathModule.Stuck())
                        {
                            NodeScanModule.blacklist.Add(closestNode.Guid);
                            PathModule.playerPositions.Clear();
                            ObjectManager.Player.Jump();
                        }
                    }
                }
            }
        }