Beispiel #1
0
 public Controller(Flow flow, Inventory inventory, ObjectManager objectManager,
                   PathModule pathModule)
 {
     Flow          = flow;
     Inventory     = inventory;
     ObjectManager = objectManager;
     PathModule    = pathModule;
 }
Beispiel #2
0
        public TempFile(TempDir baseDir, string fileName = "")
        {
            if (PathModule.IsPath(fileName))
            {
                throw new ArgumentException("fileName is not allowed to be a path.", nameof(fileName));
            }

            _baseDir  = baseDir;
            _fileName = fileName;
        }
Beispiel #3
0
 public Flow(CMD cmd, CombatModule combatModule, ConsumablesModule consumablesModule,
             Inventory inventory, Lua lua, NodeScanModule nodeScanModule,
             ObjectManager objectManager, PathModule pathModule, Spell spell)
 {
     CMD               = cmd;
     CombatModule      = combatModule;
     ConsumablesModule = consumablesModule;
     Inventory         = inventory;
     Lua               = lua;
     NodeScanModule    = nodeScanModule;
     ObjectManager     = objectManager;
     PathModule        = pathModule;
     Spell             = spell;
 }
Beispiel #4
0
        public TempDir(string basePath, string dirName)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(basePath));
            Contract.Requires(!string.IsNullOrWhiteSpace(dirName));

            if (PathModule.IsPath(dirName))
            {
                throw new ArgumentException("dirName is not allowed to be a path.", nameof(dirName));
            }

            _basePath = basePath;
            _dirName  = dirName;

            _files = new List <TempFile>();
        }
Beispiel #5
0
        public WorkingDir(string basePath, string dirName = "")
        {
            if (PathModule.IsPath(dirName))
            {
                throw new ArgumentException("dirName is not allowed to be a path.", nameof(dirName));
            }

            if (string.IsNullOrWhiteSpace(dirName))
            {
                _basePath = Path.GetDirectoryName(basePath);
                _dirName  = PathModule.GetLastDirectoryName(basePath);
            }
            else
            {
                _basePath = basePath;
                _dirName  = dirName;
            }
        }
Beispiel #6
0
 public Flow(CMD cmd,
             CombatModule combatModule,
             ConsumablesModule consumablesModule,
             Inventory inventory,
             Lua lua,
             MerchantModule merchantModule,
             NPCScanModule npcScanModule,
             ObjectManager objectManager,
             PathModule pathModule,
             Spell spell)
 {
     CMD               = cmd;
     CombatModule      = combatModule;
     ConsumablesModule = consumablesModule;
     Inventory         = inventory;
     Lua               = lua;
     MerchantModule    = merchantModule;
     NPCScanModule     = npcScanModule;
     ObjectManager     = objectManager;
     PathModule        = pathModule;
     Spell             = spell;
 }
Beispiel #7
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();
             }
         }
     }
 }
Beispiel #8
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();
                        }
                    }
                }
            }
        }