/// <summary> /// Function to Find and Interact with NPCs /// </summary> public void findAndInteractNPC(WoWUnit InteractNPC) { List <WoWUnit> RareList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(r => ((r.CreatureRank == Styx.WoWUnitClassificationType.Rare) && r.Level > 85 && !r.IsDead)).OrderBy(r => r.Distance).ToList(); bool Forceground = false; Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find NPC {0} ID {1}", InteractNPC.Name, InteractNPC.Entry); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: NPC Location: {0} / {1} / {2}", Convert.ToString(InteractNPC.X), Convert.ToString(InteractNPC.Y), Convert.ToString(InteractNPC.Z)); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Find {0} ID {1}')", InteractNPC.Name, InteractNPC.Entry); } if (Rarekiller.Settings.Alert) { Rarekiller.Alert(); } #region don't collect if ... // ----------------- Underground ---------- //if not ID of Underground NPCs of Another Mans Treasure --> don't collect if (!(InteractNPC.Entry == 64227)) { if (InteractNPC.IsIndoors && Me.IsFlying && Me.IsOutdoors && (InteractNPC.Location.Distance(Me.Location) > 30)) { Logging.Write(Colors.MediumPurple, "Rarekiller: Can't reach NPC because it is Indoors and I fly Outdoors {0}, Blacklist and Move on", InteractNPC.Name); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is Indoors')", InteractNPC.Name); } Blacklist.Add(InteractNPC.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); return; } } // ----------------- don't collect if Rare Pandaria Elite Around if (RareList != null) { foreach (WoWUnit r in RareList) { if (r.Location.Distance(InteractNPC.Location) < 30) { Logging.Write(Colors.MediumPurple, "Rarekiller: Can't reach NPC because there's a Rare Elite around, Blacklist and move on", InteractNPC.Name); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC Elite Rare around')", InteractNPC.Name); } Blacklist.Add(InteractNPC.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); return; } } } if (Rarekiller.Settings.PlayerScan && RarekillerSecurity.PlayerAround(InteractNPC)) { Logging.Write(Colors.MediumPurple, "Rarekiller: There are other Players around, so move on"); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Other Players around')"); } Blacklist.Add(InteractNPC.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); return; } if (Rarekiller.DontInteract) { return; } #endregion #region Move to Helperpoint if found known Figurine under a Tent if (Me.IsFlying && ((InteractNPC.Location.Distance(ProblemCamel1) < 10) || (InteractNPC.Location.Distance(ProblemCamel2) < 10) || (InteractNPC.Location.Distance(ProblemCamel3) < 10) || (InteractNPC.Location.Distance(ProblemCamel4) < 20))) { WoWPoint HelperPointCamel = InteractNPC.Location; HelperPointCamel.X = HelperPointCamel.X + 20; HelperPointCamel.Z = HelperPointCamel.Z + 5; Logging.Write(Colors.MediumPurple, "Rarekiller: Found a Problem Figurine {0} so dismount and walk", InteractNPC.Entry); if (!Rarekiller.MoveTo(HelperPointCamel, 3, false)) { return; } //if (!Rarekiller.DescendToLand(o)) return; Rarekiller.Dismount(); Forceground = true; } #endregion #region Move to Helperpoint if known Underground NPC if (Me.IsFlying && InteractNPC.Entry == 64227) { if (!Rarekiller.MoveTo(LandingPoint64227, 5, false)) { return; } Rarekiller.Dismount(); Forceground = true; } #endregion #region Move to NPC if (Me.IsFlying && Forceground) { Logging.Write(Colors.MediumPurple, "Rarekiller: Failure in Programming. Fly again to Helperpoint and Dismount", InteractNPC.Entry); return; } if (!Rarekiller.MoveTo(InteractNPC, 4, Forceground)) { return; } Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: NPC Location: {0} / {1} / {2}", Convert.ToString(InteractNPC.X), Convert.ToString(InteractNPC.Y), Convert.ToString(InteractNPC.Z)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: My Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z)); Rarekiller.Dismount(); #endregion InteractNPC.Interact(); InteractNPC.Interact(); InteractNPC.Interact(); Logging.Write(Colors.MediumPurple, "Rarekiller: Interact with NPC - ID {0}", InteractNPC.Entry); Thread.Sleep(300); //Another Mans Treasure NPCs if (InteractNPC.Entry == 65552 || InteractNPC.Entry == 64272 || InteractNPC.Entry == 64004 || InteractNPC.Entry == 64191 || InteractNPC.Entry == 64227) { Thread.Sleep(1000); Lua.DoString("RunMacroText(\"/click GossipTitleButton1\");"); Thread.Sleep(1000); } //Blingtron if (InteractNPC.Entry == 43929) { Thread.Sleep(1000); Lua.DoString("SelectGossipAvailableQuest(GetNumGossipAvailableQuests())"); Thread.Sleep(1000); Lua.DoString("RunMacroText(\"/click QuestFrameCompleteQuestButton\")"); Thread.Sleep(1000); Blacklist.Add(InteractNPC.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); } }
/// <summary> /// Function Find and Pickup Objects /// </summary> public void findAndPickupObject() { #region create a List with Objects in Reach // ----------------- Generate a List with all wanted Nests found in Object Manager --------------------- ObjectManager.Update(); List <WoWGameObject> objList = ObjectManager.GetObjectsOfType <WoWGameObject>() .Where(o => (!Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags) && (((o.Entry == 202082) && Rarekiller.Settings.RaptorNest) || ((o.Entry == 202080) && Rarekiller.Settings.RaptorNest) || ((o.Entry == 202083) && Rarekiller.Settings.RaptorNest) || ((o.Entry == 202081) && Rarekiller.Settings.RaptorNest) || ((o.Entry == 210565) && Rarekiller.Settings.DarkSoil) || ((o.Entry == 214945) && Rarekiller.Settings.OnyxEgg) || (Rarekiller.AnotherMansTreasureList.ContainsKey(Convert.ToInt32(o.Entry)) && Rarekiller.Settings.AnotherMansTreasure && o.Entry > 200000) || (Rarekiller.CollectObjectsList.ContainsKey(Convert.ToInt32(o.Entry)) && Rarekiller.Settings.ObjectsCollector) || ((o.Entry == 206195) && Rarekiller.Settings.TestRaptorNest) //Testcase Thundermar Ale Keg ))) .OrderBy(o => o.Distance).ToList(); List <WoWUnit> RareList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(r => ((r.CreatureRank == Styx.WoWUnitClassificationType.Rare) && r.Level > 85 && !r.IsDead)).OrderBy(r => r.Distance).ToList(); #endregion foreach (WoWGameObject o in objList) { Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find A Object to collect {0} ID {1}", o.Name, o.Entry); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Object Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z)); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Find {0} ID {1}')", o.Name, o.Entry); } if (Rarekiller.Settings.Alert) { Rarekiller.Alert(); } #region don't collect, if ... if (o.Entry == 213970 || o.Entry == 213362) { Logging.Write(Colors.MediumPurple, "Rarekiller: Can't reach Object because it is under Water {0}, Blacklist and Move on", o.Name); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Object is under Water')"); } Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); return; } // ----------------- Underground Object ---------- //if not ID of known Underground Object of Another Mans Treasure --> don't collect if (!(o.Entry == 213364 || o.Entry == 214337 || o.Entry == 213649 || o.Entry == 213650 || o.Entry == 214340 || o.Entry == 213651 || o.Entry == 213750 || o.Entry == 214325 || o.Entry == 213768 || o.Entry == 213751 || o.Entry == 213770 || o.Entry == 213793 || o.Entry == 213769 || o.Entry == 214438 || o.Entry == 214407 || o.Entry == 213956)) // || o.Entry == 213970 || o.Entry == 213362 { if (o.IsIndoors && Me.IsFlying && Me.IsOutdoors && (o.Location.Distance(Me.Location) > 30)) { Logging.Write(Colors.MediumPurple, "Rarekiller: Can't reach Object because it is Indoors and I fly Outdoors {0}, Blacklist and Move on", o.Name); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Object is Indoors')"); } Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); return; } } // ----------------- don't collect if Rare Pandaria Elite Around if (RareList != null) { foreach (WoWUnit r in RareList) { if (r.Location.Distance(o.Location) < 30) { Logging.Write(Colors.MediumPurple, "Rarekiller: Can't reach Object because there's a Rare Elite around, Blacklist and move on", o.Name); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Object Elite Rare around')", o.Name); } Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); return; } } } if (Rarekiller.Settings.PlayerScan && RarekillerSecurity.PlayerAround(o)) { Logging.Write(Colors.MediumPurple, "Rarekiller: There are other Players around, so move on"); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Other Players around')"); } Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); return; } if (Rarekiller.DontInteract) { return; } #endregion #region fly to Helperpoint if known Underground Object //ToDo IDs of Underground NPCs if (Me.IsFlying && (o.Entry == 213364 || o.Entry == 214337 || o.Entry == 213649 || o.Entry == 213650 || o.Entry == 214340 || o.Entry == 213651 || o.Entry == 213750 || o.Entry == 214325 || o.Entry == 213768 || o.Entry == 213751 || o.Entry == 213770 || o.Entry == 213793 || o.Entry == 213769 || o.Entry == 214438 || o.Entry == 214407 || o.Entry == 213956 || o.Entry == 213970 || o.Entry == 213362)) { WoWPoint Helperpoint = o.Location; if (o.Entry == 213364) { Helperpoint = LandingPoint213364; } if (o.Entry == 214337) { Helperpoint = LandingPoint214337; } if (o.Entry == 213649) { Helperpoint = LandingPoint213649; } if (o.Entry == 213650) { Helperpoint = LandingPoint213650; } if (o.Entry == 214340) { Helperpoint = LandingPoint214340; } if (o.Entry == 213651) { Helperpoint = LandingPoint213651; } if (o.Entry == 213750) { Helperpoint = LandingPoint213750; } if (o.Entry == 214325) { Helperpoint = LandingPoint214325; } if (o.Entry == 213768) { Helperpoint = LandingPoint213768; } if (o.Entry == 213751) { Helperpoint = LandingPoint213751; } if (o.Entry == 213770) { Helperpoint = LandingPoint213770; } if (o.Entry == 213793) { Helperpoint = LandingPoint213793; } if (o.Entry == 213769) { Helperpoint = LandingPoint213769; } if (o.Entry == 214438) { Helperpoint = LandingPoint214438; } if (o.Entry == 214407) { Helperpoint = LandingPoint214407; } if (o.Entry == 213956) { Helperpoint = LandingPoint213956; } if (o.Entry == 213970) { Helperpoint = LandingPoint213970; } if (o.Entry == 213362) { Helperpoint = LandingPoint213362; } if (!Rarekiller.MoveTo(Helperpoint, 5, false)) { return; } Rarekiller.Dismount(); } #endregion #region Move to Object // ----------------- Move to Object Part --------------------- if (o.Entry == 213364 || o.Entry == 214337 || o.Entry == 213649 || o.Entry == 213650 || o.Entry == 214340 || o.Entry == 213651 || o.Entry == 213750 || o.Entry == 214325 || o.Entry == 213768 || o.Entry == 213751 || o.Entry == 213770 || o.Entry == 213793 || o.Entry == 213769 || o.Entry == 214438 || o.Entry == 214407 || o.Entry == 213956 || o.Entry == 213970 || o.Entry == 213362) { if (!Rarekiller.MoveTo(o, 4, true)) { return; } } else { if (!Rarekiller.MoveTo(o, 4, false)) { return; } } #endregion // Collect Object Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Object Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: My Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z)); Rarekiller.Dismount(); if (Rarekiller.ToonInvalidCombat) { return; } Thread.Sleep(1000); o.Interact(); o.Interact(); o.Interact(); Thread.Sleep(1000); Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");"); Thread.Sleep(1000); Logging.Write(Colors.MediumPurple, "Rarekiller: Interact with {0} - ID {1}", o.Name, o.Entry); } }