public Result Create( int ownerId, string targetUserName ) { Result result = new Result(); if (strUtil.IsNullOrEmpty( targetUserName )) { result.Add( lang.get( "exUserName" ) ); return result; } User target = userService.GetByName( targetUserName ); if (target == null) { result.Add( lang.get( "exUser" ) ); return result; } Blacklist b = new Blacklist(); b.User = new User( ownerId ); b.Target = target; result = b.insert(); if (result.IsValid) { friendService.DeleteFriendByBlacklist( ownerId, target.Id ); followerService.DeleteFollow( target.Id, ownerId ); } return result; }
protected void Page_Load(object sender, EventArgs e) { //AddNavigationItem("好友", BbsRouter.GetUrl("my/friends")); AddNavigationItem("黑名单"); if (_Request.IsClick("add")) Add(); m_PageNumber = _Request.Get<int>("page", Method.Get, 1); m_Blacklist = FriendBO.Instance.GetBlacklist(MyUserID, m_PageNumber, c_PageSize); WaitForFillSimpleUsers<BlacklistItem>(m_Blacklist); SetPager("list", null, m_PageNumber, PageSize, m_Blacklist.TotalRecords); }
public WurmSubdirsMonitor([NotNull] string directoryFullPath, [NotNull] TaskManager taskManager, [NotNull] Action onChanged, [NotNull] ILogger logger, [NotNull] Action<string> validateDirectory) { if (directoryFullPath == null) throw new ArgumentNullException("directoryFullPath"); if (taskManager == null) throw new ArgumentNullException("taskManager"); if (onChanged == null) throw new ArgumentNullException("onChanged"); if (validateDirectory == null) throw new ArgumentNullException("validateDirectory"); if (logger == null) throw new ArgumentNullException("logger"); this.DirectoryFullPath = directoryFullPath; this.taskManager = taskManager; this.onChanged = onChanged; this.validateDirectory = validateDirectory; this.logger = logger; directoryBlacklist = new Blacklist<string>(logger, "Character directories blacklist"); task = new TaskHandle(Refresh, "WurmSubdirsMonitor for path: " + directoryFullPath); taskManager.Add(task); try { Refresh(); } catch (Exception exception) { logger.Log(LogLevel.Error, "Error at initial Refresh of " + this.GetType().Name, this, exception); } fileSystemWatcher = new FileSystemWatcher(directoryFullPath) {NotifyFilter = NotifyFilters.DirectoryName}; fileSystemWatcher.Created += DirectoryMonitorOnDirectoriesChanged; fileSystemWatcher.Renamed += DirectoryMonitorOnDirectoriesChanged; fileSystemWatcher.Deleted += DirectoryMonitorOnDirectoriesChanged; fileSystemWatcher.Changed += DirectoryMonitorOnDirectoriesChanged; fileSystemWatcher.EnableRaisingEvents = true; task.Trigger(); }
public static WoWPoint SavePoint50832 = new WoWPoint(1749.258, 3209.693, 316.2377); // The Yowler #endregion /// <summary> /// Function to Find and Kill Mobs /// </summary> public void findAndKillMob() { bool CastSuccess = false; #region create List of Mobs in Reach // ----------------- Generate a List with all wanted Rares found in Object Manager --------------------- ObjectManager.Update(); List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(o => (!Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags) && ( (Rarekiller.Settings.CATA && (Rarekiller.CataRaresList.ContainsKey(Convert.ToInt32(o.Entry)))) || (Rarekiller.Settings.Poseidus && ((o.Entry == 50005) || // Poseidus (o.Entry == 9999999))) || // Platzhalter (Rarekiller.Settings.TLPD && ((o.Entry == 32491) || // Timelost Protodrake (o.Entry == 32630))) || // Vyragosa (Rarekiller.Settings.WOTLK && (Rarekiller.FrostbittenList.ContainsKey(Convert.ToInt32(o.Entry)))) || (Rarekiller.Settings.BC && (Rarekiller.BloodyRareList.ContainsKey(Convert.ToInt32(o.Entry)))) || (Rarekiller.Settings.KillList && (Rarekiller.KillMobsList.ContainsKey(Convert.ToInt32(o.Entry)))) || //Kill Mobs from List (Rarekiller.Settings.KillList && o.TaggedByOther && (Rarekiller.TaggedMobsList.ContainsKey(Convert.ToInt32(o.Entry)))) || //Kill Tagged Mobs from List ((o.Level < Rarekiller.Settings.Level) && Rarekiller.Settings.LowRAR && (o.CreatureRank == Styx.WoWUnitClassificationType.Rare)) || // every single Rare Mob < Level 61 is hunted (Rarekiller.Settings.HUNTbyID && (o.Entry == Convert.ToInt64(Rarekiller.Settings.MobID))) // Hunt special IDs // Pandaria Rares || (Rarekiller.Settings.MOP && ( (o.Entry == 50828 && Rarekiller.Settings.Bonobos50828) || // (o.Entry == 50836 && Rarekiller.Settings.IkIk50836) || // (o.Entry == 50840 && Rarekiller.Settings.Nanners50840) || // (o.Entry == 50823 && Rarekiller.Settings.Ferocious50823) || // (o.Entry == 50831 && Rarekiller.Settings.Scritch50831) || // (o.Entry == 50830 && Rarekiller.Settings.Spriggin50830) || // (o.Entry == 50832 && Rarekiller.Settings.Yowler50832) || // (o.Entry == 50750 && Rarekiller.Settings.Aethis50750) || // (o.Entry == 50768 && Rarekiller.Settings.Cournith50768) || // (o.Entry == 50772 && Rarekiller.Settings.Eshelon50772) || // (o.Entry == 50766 && Rarekiller.Settings.Selena50766) || // (o.Entry == 50769 && Rarekiller.Settings.Zai50769) || // (o.Entry == 50780 && Rarekiller.Settings.Sahn50780) || // (o.Entry == 50776 && Rarekiller.Settings.Nalash50776) || // (o.Entry == 50739 && Rarekiller.Settings.Garlok50739) || // (o.Entry == 50749 && Rarekiller.Settings.Kaltik50749) || // (o.Entry == 50734 && Rarekiller.Settings.Lithik50734) || // (o.Entry == 50364 && Rarekiller.Settings.Nallak50364) || // (o.Entry == 50363 && Rarekiller.Settings.Kraxik50363) || // (o.Entry == 50733 && Rarekiller.Settings.Skithik50733) || // (o.Entry == 50388 && Rarekiller.Settings.Torik50388) || // (o.Entry == 50341 && Rarekiller.Settings.Borginn50341) || // (o.Entry == 50349 && Rarekiller.Settings.Kang50349) || // (o.Entry == 50340 && Rarekiller.Settings.Gaarn50340) || // (o.Entry == 50347 && Rarekiller.Settings.Karr50347) || // (o.Entry == 50338 && Rarekiller.Settings.Kornas50338) || // (o.Entry == 50344 && Rarekiller.Settings.Norlaxx50344) || // (o.Entry == 50339 && Rarekiller.Settings.Sulikshor50339) || // (o.Entry == 50354 && Rarekiller.Settings.Havak50354) || // (o.Entry == 50351 && Rarekiller.Settings.JonnDar50351) || // (o.Entry == 50355 && Rarekiller.Settings.Kahtir50355) || // (o.Entry == 50356 && Rarekiller.Settings.Krol50356) || // (o.Entry == 50350 && Rarekiller.Settings.Morgrinn50350) || // (o.Entry == 50352 && Rarekiller.Settings.Qunas50352) || // (o.Entry == 50359 && Rarekiller.Settings.Urgolax50359) || // (o.Entry == 50821 && Rarekiller.Settings.AiLi50821) || // (o.Entry == 50817 && Rarekiller.Settings.Ahone50817) || // (o.Entry == 50822 && Rarekiller.Settings.AiRan50822) || // (o.Entry == 50816 && Rarekiller.Settings.Ruun50816) || // (o.Entry == 50811 && Rarekiller.Settings.Nasra50811) || // (o.Entry == 50808 && Rarekiller.Settings.Urobi50808) || // (o.Entry == 50820 && Rarekiller.Settings.Yul50820) || // (o.Entry == 50787 && Rarekiller.Settings.Arness50787) || // (o.Entry == 50806 && Rarekiller.Settings.Moldo50806) || // (o.Entry == 50789 && Rarekiller.Settings.Nessos50789) || // (o.Entry == 50805 && Rarekiller.Settings.Omnis50805) || // (o.Entry == 50783 && Rarekiller.Settings.Salyin50783) || // (o.Entry == 50782 && Rarekiller.Settings.Sarnak50782) || // (o.Entry == 50791 && Rarekiller.Settings.Siltriss50791) || // (o.Entry == 51059 && Rarekiller.Settings.Blackhoof51059) || // (o.Entry == 50334 && Rarekiller.Settings.Dak50334) || // (o.Entry == 51078 && Rarekiller.Settings.Ferdinand51078) || // (o.Entry == 50331 && Rarekiller.Settings.GoKan50331) || // (o.Entry == 50332 && Rarekiller.Settings.Korda50332) || // (o.Entry == 50333 && Rarekiller.Settings.Lon50333) || // (o.Entry == 50336 && Rarekiller.Settings.Yorik50336) // )) ))) .OrderBy(o => o.Distance).ToList(); #endregion foreach (WoWUnit o in objList) { if (!o.IsDead && !o.IsPet) { #region don't kill if // Don't kill Pandaria Rares with Low Health if ((o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 || o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 || o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 || o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 || o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 || o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 || o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 || o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 || o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 || o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 || o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 || o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 || o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 || o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) && Me.HealthPercent < 80) { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but don't Kill Pandaria Mob with Health < 80%", o.Name, o.Entry); return; } if (Rarekiller.Settings.NotKillTameable && o.IsTameable) // ... I want to tame him :) { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but kill tameable", o.Name, o.Entry); return; } #endregion Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", o.Name, o.Entry); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Mob 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); } #region don't kill if ... if (Rarekiller.Settings.PullCounter >= Rarekiller.Settings.MaxPullCounter) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but I pulled him now {1} Times", o.Name, Rarekiller.Settings.PullCounter); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes, MoP Rares will be deactivated"); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: I pulled now {0} times, blacklist')", Rarekiller.Settings.PullCounter); } Rarekiller.Settings.PullCounter = 0; Rarekiller.Settings.GuidCurrentPull = 0; Rarekiller.Settings.BlacklistCounter++; Rarekiller.Settings.DeactivateMoPRare(o); return; } // Don't kill Pandaria Rares with Level < 90 if ((o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 || o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 || o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 || o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 || o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 || o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 || o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 || o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 || o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 || o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 || o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 || o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 || o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 || o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) && Me.Level < 90) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but my level is to Low to kill him", o.Name); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: My Level is to low')", o.Name); } return; } if (o.TaggedByOther && !Rarekiller.TaggedMobsList.ContainsKey(Convert.ToInt32(o.Entry))) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's tagged by another Player", o.Name); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is tagged')", o.Name); } return; } //if not known ID of Inhouse Pandaria Rare --> don't kill if (!(o.Entry == 50817 || o.Entry == 50768 || o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 || o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769)) { if (Me.IsFlying && Me.IsOutdoors && o.IsIndoors) { Logging.Write(Colors.MediumPurple, "Rarekiller: Mob is Indoors and I fly Outdoors, so blacklist him to prevent Problems"); Logging.Write(Colors.MediumPurple, "Rarekiller: You have to place me next to the Spawnpoint, if you want me to hunt this Mob."); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is Indoors')", o.Name); } return; } } if (o.Level > (Me.Level + 4)) // ... 4 Levels higher them me { Logging.Write(Colors.MediumPurple, "Rarekiller: His Level is 5 over mine, better not to kill him."); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } if (o.IsFriendly) // ... is Friendly { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's friendly", o.Name); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is friendly')", o.Name); } return; } if ((o.Entry == 32630) && !Rarekiller.Settings.Vyragosa) // ... my Settings say don't kill Vyragosa { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Vyragosa."); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: don't kill NPC')", o.Name); } return; } if ((o.Entry == 50057) && !Rarekiller.Settings.Blazewing) // ... my Settings say don't kill Blazewing { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Blazewing."); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: don't kill NPC')", o.Name); } return; } if ((o.Entry == 596) || (o.Entry == 599) || Me.IsInInstance) { // ... Instance Mobs, don't run wild in Instances Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Don't run wild because of RareMobs in Instances."); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry))) // ... Mob is Blacklisted in Rarekiller/config/BlacklistedMobs.xml { Logging.Write(Colors.MediumPurple, "Rarekiller: {0} is Member of the BlacklistedMobs.xml", o.Name); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes."); return; } if (Rarekiller.DontInteract) { return; } #endregion if (Rarekiller.Settings.Alert) { Rarekiller.Alert(); } #region fly to Helperpoint for some Pandaria Rares if (Me.IsFlying && (o.Entry == 50817 || o.Entry == 50768 || o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 || o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769 || o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 || o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820)) { WoWPoint Helperpoint = o.Location; if (o.Entry == 50817) { Helperpoint = LandingPoint50817; } if (o.Entry == 50768) { Helperpoint = LandingPoint50768; } if (o.Entry == 50836) { Helperpoint = LandingPoint50836; } if (o.Entry == 50782) { Helperpoint = LandingPoint50782; } if (o.Entry == 50831) { Helperpoint = LandingPoint50831; } if (o.Entry == 50832) { Helperpoint = LandingPoint50832; } if (o.Entry == 50769) { Helperpoint = LandingPoint50769; } if (o.Entry == 50822) { Helperpoint = LandingPoint50822; } if (o.Entry == 50331) { Helperpoint = LandingPoint50331; } if (o.Entry == 51078) { Helperpoint = LandingPoint51078; } if (o.Entry == 50749) { Helperpoint = LandingPoint50749; } if (o.Entry == 50334) { Helperpoint = LandingPoint50334; } if (o.Entry == 50347) { Helperpoint = LandingPoint50347; } if (o.Entry == 50811) { Helperpoint = LandingPoint50811; } if (o.Entry == 50821) { Helperpoint = LandingPoint50821; } if (o.Entry == 50808) { Helperpoint = LandingPoint50808; } if (o.Entry == 50820) { Helperpoint = LandingPoint50820; } if (!Rarekiller.MoveTo(Helperpoint, o, 5, false)) { return; } Rarekiller.Dismount(); } #endregion #region Check PullRange if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) && ( o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 || o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50768 || o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 || o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820)) { Rarekiller.Settings.Range = "27"; Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 27 because of Inhouse Pandaria Rare"); } else if (o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 || o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 || o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 || o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 || o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 || o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 || o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 || o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 || o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 || o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 || o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 || o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 || o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 || o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) { Rarekiller.Settings.Range = "3"; Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 3 because of other Pandaria Rares"); } else if (!Rarekiller.Settings.DefaultPull && (Convert.ToInt64(Rarekiller.Settings.Range) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull)))) { Rarekiller.Settings.Range = Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull); Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Customized Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull)); } else if (Rarekiller.Settings.DefaultPull && (Convert.ToInt64(Rarekiller.Settings.Range) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell)))) { Rarekiller.Settings.Range = Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell); Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Default Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell)); } #endregion #region Move To Mob if (o.Entry == 50817 || o.Entry == 50768 || o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 || o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769 || o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 || o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820) { if (!Rarekiller.MoveTo(o, Convert.ToInt64(Rarekiller.Settings.Range), true)) { return; } } else { if (!Rarekiller.MoveTo(o, Convert.ToInt64(Rarekiller.Settings.Range), false)) { return; } } #endregion #region Special Behavior Nal'lak //if (Me.Combat && o.Entry == 50364) //Nal'lak //{ // WoWMovement.MoveStop(); // Thread.Sleep(100); // if (Me.IsFlying) // { // WoWUnit GroundUnit = ObjectManager.GetObjectsOfType<WoWUnit>().Where(u => (!u.IsFlying)).OrderBy(u => u.Distance).FirstOrDefault(); ; // if (!Rarekiller.DescendToLand(GroundUnit)) return; // } // Rarekiller.Dismount(); //} #endregion #region Special Behavior Clean up Area if (o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347) { ObjectManager.Update(); List <WoWUnit> AddList = ObjectManager.GetObjectsOfType <WoWUnit>().Where(Add => !Add.IsDead && Add.IsHostile && (Add != o) && Add.Location.Distance(o.Location) < 27 && Add.Location.Distance(Me.Location) < 27).OrderBy(Add => Add.Distance).ToList(); foreach (WoWUnit Add in AddList) { if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, Add, true); Logging.Write(Colors.MediumPurple, "Rarekiller: Clean up Area, pull Add: {0}", Add.Name); return; } } } #endregion #region Pull Mob Logging.Write(Colors.MediumPurple, "Rarekiller: Pull at Mob Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z)); Logging.Write(Colors.MediumPurple, "Rarekiller: ... my Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Target is Flying - {0}", o.IsFlying); o.Target(); if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) && (o.Entry == 50817 || o.Entry == 50768 || o.Entry == 50836 || o.Entry == 50782 || o.Entry == 50331 || o.Entry == 51078 || o.Entry == 50822 || o.Entry == 50831 || o.Entry == 50832 || o.Entry == 50769 || o.Entry == 50749 || o.Entry == 50334 || o.Entry == 50347 || o.Entry == 50811 || o.Entry == 50821 || o.Entry == 50808 || o.Entry == 50820)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, o, true); } else if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, o, false); } else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, o, false); } else { Logging.Write(Colors.MediumPurple, "Rarekiller: I have no valid Pullspell - sorry"); } if (Me.CurrentTarget != o) { o.Target(); } #endregion #region Quick Slowfall for known flying Mobs if (Rarekiller.Settings.UseSlowfall && ((o.Entry == 29753) || (o.Entry == 32491) || (o.Entry == 32630) || (o.Entry == 33687) || (o.Entry == 50364))) { Thread.Sleep(500); if (Me.IsFalling) { Rarekiller.Slowfall.HelpFalling(); } } Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Use Quick Slowfall: {0} Mob: {1}", Me.IsFalling, o.Name); #endregion #region Pulltimer and Pullcounter WaitAfterPullTimer.Reset(); WaitAfterPullTimer.Start(); while (WaitAfterPullTimer.IsRunning && !Rarekiller.ToonInvalidCombat && WaitAfterPullTimer.ElapsedMilliseconds < 2000) { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Wait for Combat now {0} ms", WaitAfterPullTimer.ElapsedMilliseconds); Thread.Sleep(100); } if (CastSuccess && Me.Combat) { Logging.Write(Colors.MediumPurple, "Rarekiller: Successfully pulled {0}", o.Name); } if (o.Entry != 32491 && o.Entry != 50005 && (Rarekiller.Settings.GuidCurrentPull != o.Guid) && Me.Combat) { Rarekiller.Settings.PullCounter = 1; Rarekiller.Settings.GuidCurrentPull = o.Guid; Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now first time", o.Name); } else if (Me.Combat) { Rarekiller.Settings.PullCounter++; Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now {1} times", o.Name, Rarekiller.Settings.PullCounter); if ((o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 || o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 || o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 || o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 || o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 || o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 || o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 || o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 || o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 || o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 || o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 || o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 || o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 || o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) && Me.Level < 90) { RoutineManager.Current.Combat(); } } #endregion #region Move to a Save Fighting Area after Pull for some Pandaria Rares if ((o.Entry == 50768 || o.Entry == 50832) && Me.Combat) { WoWPoint SaveHelperpoint = o.Location; Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point", o.Entry); if (o.Entry == 50768) { SaveHelperpoint = SavePoint50768; } if (o.Entry == 50832) { SaveHelperpoint = SavePoint50832; } if (Navigator.CanNavigateFully(Me.Location, SaveHelperpoint)) { Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point"); while (Me.Location.Distance(SaveHelperpoint) > 5) { if (Me.IsSwimming) { WoWMovement.ClickToMove(SaveHelperpoint); } else { Navigator.MoveTo(SaveHelperpoint); } Thread.Sleep(100); if (Rarekiller.ToonInvalid) { return; } } } else { Logging.Write(Colors.MediumPurple, "Rarekiller: Wasn't able to Move to Save Fighting Point", o.Entry); } } #endregion return; } else if (o.IsDead) { if (o.Guid == Rarekiller.Settings.GuidCurrentPull) { Rarekiller.Settings.PullCounter = 0; Rarekiller.Settings.GuidCurrentPull = 0; Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Set PullCounter to {0}", Rarekiller.Settings.PullCounter); } if (o.CanLoot) { if (!Rarekiller.Loothelper(o)) { return; } } if (!Blacklist.Contains(o.Guid, Rarekiller.Settings.Flags)) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but sadly he's dead", o.Name); Blacklist.Add(o.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); } } } }
private TabPage GetReportTab() { var txtBoxSteamID = new TextBox { PlaceholderText = "STEAM_0:0:131983088" }; var txtBoxMatchID = new TextBox { PlaceholderText = "CSGO-727c4-5oCG3-PurVX-sJkdn-LsXfE" }; var cbAbusiveText = new CheckBox { Text = "Abusive Text Chat", Checked = true }; var cbAbusiveVoice = new CheckBox { Text = "Abusive Voice Chat", Checked = true }; var cbGriefing = new CheckBox { Text = "Griefing", Checked = true }; var cbCheatAim = new CheckBox { Text = "Aim Hacking", Checked = true }; var cbCheatWall = new CheckBox { Text = "Wall Hacking", Checked = true }; var cbCheatOther = new CheckBox { Text = "Other Hacking", Checked = true }; var dropIndexes = new DropDown(); RefreshIndexesDropDown(dropIndexes); _indexDropDowns.Add(dropIndexes); var cbAllIndexes = new CheckBox { Text = "Use all accounts", Checked = false }; cbAllIndexes.CheckedChanged += delegate { if (cbAllIndexes.Checked != null) { dropIndexes.Enabled = (bool)!cbAllIndexes.Checked; } else { cbAllIndexes.Checked = false; } }; var btnReport = new Button { Text = "Report" }; btnReport.Click += delegate { if (!string.IsNullOrWhiteSpace(txtBoxSteamID.Text)) { var steamID = SteamUtil.Parse(txtBoxSteamID.Text); var matchID = SharecodeUtil.Parse(txtBoxMatchID.Text); if (steamID != null) { if (matchID == 8) { _log.Warning("Could not convert {ID} to a valid Match ID. Trying to resolve the " + "the Match ID in which the target is playing at the moment.", matchID); Titan.Instance.AccountManager.StartMatchIDResolving( cbAllIndexes.Checked != null && (bool)cbAllIndexes.Checked ? -1 : dropIndexes.SelectedIndex, new LiveGameInfo { SteamID = steamID }); } if (Blacklist.IsBlacklisted(steamID)) { Titan.Instance.UIManager.SendNotification( "Restriction applied", "The target you are trying to report is blacklisted from botting " + "in Titan.", delegate { Process.Start("https://github.com/Marc3842h/Titan/wiki/Blacklist"); } ); return; } var targetBanInfo = Titan.Instance.BanManager.GetBanInfoFor(steamID.ConvertToUInt64()); if (targetBanInfo != null) { if (targetBanInfo.VacBanned || targetBanInfo.GameBanCount > 0) { _log.Warning("The target has already been banned. Are you sure you " + "want to bot this player? Ignore this message if the " + "target has been banned in other games."); } if (Titan.Instance.VictimTracker.IsVictim(steamID)) { _log.Warning("You already report botted this victim. " + "Are you sure you want to bot this player? " + "Ignore this message if the first report didn't have enough reports."); } _log.Information("Starting reporting of {Target} in Match {Match}.", steamID.ConvertToUInt64(), matchID); Titan.Instance.AccountManager.StartReporting( cbAllIndexes.Checked != null && (bool)cbAllIndexes.Checked ? -1 : dropIndexes.SelectedIndex, new ReportInfo { SteamID = steamID, MatchID = matchID, AbusiveText = cbAbusiveText.Checked != null && (bool)cbAbusiveText.Checked, AbusiveVoice = cbAbusiveVoice.Checked != null && (bool)cbAbusiveVoice.Checked, Griefing = cbGriefing.Checked != null && (bool)cbGriefing.Checked, AimHacking = cbCheatAim.Checked != null && (bool)cbCheatAim.Checked, WallHacking = cbCheatWall.Checked != null && (bool)cbCheatWall.Checked, OtherHacking = cbCheatOther.Checked != null && (bool)cbCheatOther.Checked }); } } else { Titan.Instance.UIManager.SendNotification( "Titan - Error", "Could not parse Steam ID " + txtBoxSteamID.Text + " to Steam ID. Please provide a valid " + "SteamID, SteamID3 or SteamID64." ); } } else { Titan.Instance.UIManager.SendNotification( "Titan - Error", "Please provide a valid target." ); } }; return(new TabPage { Text = "Report", Enabled = !Titan.Instance.DummyMode, Content = new TableLayout { Spacing = new Size(5, 5), Padding = new Padding(10, 10, 10, 10), Rows = { new GroupBox { Text = "Target", Content = new TableLayout { Spacing = new Size(5, 5), Padding = new Padding(10, 10, 10, 10), Rows = { new TableRow( new TableCell(new Label { Text = "Steam ID" }, true), new TableCell(txtBoxSteamID, true) ), new TableRow( new TableCell(new Label { Text = "Match ID" }), new TableCell(txtBoxMatchID) ) } } }, new GroupBox { Text = "Options", Content = new TableLayout { Spacing = new Size(5, 5), Padding = new Padding(10, 10, 10, 10), Rows = { new TableRow( new TableCell(cbAbusiveText, true), new TableCell(cbAbusiveVoice, true), new TableCell(cbGriefing, true) ), new TableRow( new TableCell(cbCheatAim), new TableCell(cbCheatWall), new TableCell(cbCheatOther) ) } } }, new GroupBox { Text = "Bots", Content = new TableLayout { Spacing = new Size(5, 5), Padding = new Padding(10, 10, 10, 10), Rows = { new TableRow( new TableCell(new Label { Text = "Use Index" }, true), new TableCell(dropIndexes, true) ), new TableRow( new TableCell(new Panel()), new TableCell(cbAllIndexes) ) } } }, new TableLayout { Spacing = new Size(5, 5), Padding = new Padding(10, 10, 10, 10), Rows = { new TableRow( new TableCell(new Panel(), true), new TableCell(new Panel(), true), new TableCell(btnReport) ), new TableRow { ScaleHeight = true } } } } } }); }
static public void findAndReadBook() { ObjectManager.Update(); List <WoWGameObject> objList = ObjectManager.GetObjectsOfType <WoWGameObject>().Where(o => !Blacklist.Contains(o.Guid) && ( (o.Entry == 192708 && !bookStatus.Introduction) || (o.Entry == 192709 && !bookStatus.Abjuration) || (o.Entry == 192710 && !bookStatus.Conjuration) || (o.Entry == 192711 && !bookStatus.Divination) || (o.Entry == 192713 && !bookStatus.Enchantment) || (o.Entry == 192865 && !bookStatus.Illusion) || (o.Entry == 192866 && !bookStatus.Necromancy) || (o.Entry == 192867 && !bookStatus.Transmutation) || o.Entry == 192651 || o.Entry == 192871 || o.Entry == 192888 || o.Entry == 192887 || o.Entry == 192890 || o.Entry == 192874 || o.Entry == 192706 || o.Entry == 192881 || o.Entry == 192652 || o.Entry == 192895 || o.Entry == 192889 || o.Entry == 192882 || o.Entry == 192884 || o.Entry == 192870 || o.Entry == 192905 || o.Entry == 192883 || o.Entry == 192886 || o.Entry == 192869 || o.Entry == 192894 || o.Entry == 192872 || o.Entry == 192868 || o.Entry == 192710 || o.Entry == 192651 || o.Entry == 192871 || o.Entry == 192888 || o.Entry == 192887 || o.Entry == 192890 || o.Entry == 192874 || o.Entry == 192706 || o.Entry == 192881 || o.Entry == 192652 || o.Entry == 192895 || o.Entry == 192889 || o.Entry == 192882 || o.Entry == 192884 || o.Entry == 192870 || o.Entry == 192905 || o.Entry == 192883 || o.Entry == 192886 || o.Entry == 192869 || o.Entry == 192894 || o.Entry == 192872 || o.Entry == 192868 || o.Entry == 192710 || o.Entry == 192891 || o.Entry == 192896 || o.Entry == 192880 || o.Entry == 192653 || o.Entry == 192885 || o.Entry == 192707) ) .OrderBy(o => o.Distance).ToList(); foreach (WoWGameObject o in objList) { Slog("Moving towards book:" + o.Name); movetoLoc(o.Location); if (inCombat) { return; } o.Interact(); Thread.Sleep(1000); while (HasNextPage) { Lua.DoString("ItemTextNextPage()"); Thread.Sleep(1000); } Slog("Finshed reading: {0}, Blacklisting for 5 min", o.Name); Blacklist.Add(o.Guid, new TimeSpan(0, 5, 0)); } }
protected override Composite CreateBehavior() { return(_root ?? (_root = new PrioritySelector( new Decorator(c => Npc != null, new Action(c => { if (!Npc.Attackable) { Blacklist.Add(Npc.Guid, new TimeSpan(0, 5, 0)); } if ((Me.Combat && (Me.GotTarget && Me.CurrentTarget != Npc && !MobIds.Contains((int)Me.CurrentTarget.Entry)) || Me.HealthPercent < HealthPercent) || IsDone) { return RunStatus.Success; } WoWUnit lootable = ObjectManager.GetObjectsOfType <WoWUnit>().OrderBy(u => u.Distance). FirstOrDefault(u => u.Lootable); if (lootable != null) { if (!lootable.WithinInteractRange) { if (Npc.Distance < 30 && SpellManager.CanCast("Death Grip")) { SpellManager.Cast("Death Grip"); WoWMovement.MoveStop(); } else { Navigator.MoveTo(lootable.Location); } } else { lootable.Interact(); } if (Logic.Inventory.Frames.LootFrame.LootFrame.Instance != null && Logic.Inventory.Frames.LootFrame.LootFrame.Instance.IsVisible) { Logic.Inventory.Frames.LootFrame.LootFrame.Instance.LootAll(); if (Me.GotTarget) { Blacklist.Add(Me.CurrentTarget, new TimeSpan(1, 0, 0)); } Me.ClearTarget(); } return RunStatus.Running; } if (!Me.GotTarget || Me.CurrentTarget != Npc) { Npc.Target(); } if (!Npc.WithinInteractRange) { TreeRoot.GoalText = string.Format("Moving to {0}", Npc.Name); Navigator.MoveTo(WoWMathHelper.CalculatePointFrom(Me.Location, Npc.Location, 3)); } else { if (Me.IsMoving) { WoWMovement.MoveStop(); } if (!Me.IsAutoAttacking || !Me.IsSafelyFacing(ObjectManager.Me.CurrentTarget)) { TreeRoot.GoalText = string.Format("Bullying {0}", Npc.Name); Npc.Interact(); } } return RunStatus.Running; })), new Action(c => Navigator.MoveTo(Location)) ))); }
private async Task <bool> ResolveItem() { if (item != null) { return(false); } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint)i.Pointer.ToInt64(), BlacklistFlags.Loot)).ToArray(); var blackListDictionnary = new Dictionary <string, uint> { { "Fire Moraine", 5214 }, { "Lightning Moraine", 5218 }, { "Radiant Fire Moraine", 5220 }, { "Radiant Lightning Moraine", 5224 }, { "Bright Fire Rock", 12966 }, { "Bright Lightning Rock", 12967 }, { "Granular Clay", 12968 }, { "Peat Moss", 12969 }, { "Black Soil", 12970 }, { "Highland Oregano", 12971 }, { "Furymint", 12972 }, { "Clary Sage", 12973 }, { "Lover's Laurel", 15948 }, { "Radiant Astral Moraine", 15949 }, { "Near Eastern Antique", 17549 }, { "Coerthan Souvenir", 17550 }, { "Maelstrom Materiel ", 17551 }, { "Heartfelt Gift", 17552 }, { "Orphanage Donation", 17553 }, { "Dated Radz-at-Han Coin", 17557 }, { "Ice Stalagmite", 17558 }, { "Duskfall Moss", 17559 }, { "Glass Eye", 17560 }, { "Rainbow Pigment", 17561 }, { "Thavnairian Leaf", 17562 }, { "Ghost Faerie", 17563 }, { "Red Sky Coral", 17564 }, { "Lovers' Clam", 17565 }, { "River Shrimp", 17566 }, { "Windtea Leaves", 19916 }, { "Torreya Branch", 19937 }, { "Schorl", 20009 }, { "Perlite", 20010 }, { "Almandine", 20011 }, { "Doman Yellow", 20012 }, { "Gyr Abanian Souvenir", 20775 }, { "Far Eastern Antique", 20776 }, { "Gold Saucer Consolation Prize", 20777 }, { "M Tribe Sundries", 20778 }, { "Resistance Materiel", 20779 }, { "Starcrack", 20780 }, { "Shishu Koban", 20781 }, { "Cotter Dynasty Relic", 20782 }, { "Peaks Pigment", 20783 }, { "Yellow Kudzu Root", 20784 }, { "Gyr Abanian Chub", 20785 }, { "Coral Horse", 20786 }, { "Maiden's Heart", 20787 }, { "Velodyna Salmon", 20788 }, { "Purple Buckler", 20789 }, { "Gyr Abanian Remedies", 23143 }, { "Anti-shark Harpoon", 23144 }, { "Coerthan Cold-weather Gear", 23145 }, { "Sui-no-Sato Special", 23146 }, { "Cloud Pearl", 23147 }, { "Yanxian Soil", 23220 }, { "Yanxian Verbena", 23221 } }; if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0 && !blackListDictionnary.ContainsValue(i.RawItemId)); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return(false); } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return(isDone = true); }
/// <summary> /// Function to Find and Kill Mobs /// </summary> public void findAndKillMob(WoWUnit Enemy) { bool CastSuccess = false; if (!Enemy.IsDead) { #region don't kill if // Don't kill Pandaria Rares with Low Health if ((Enemy.Entry == 50828 || Enemy.Entry == 50836 || Enemy.Entry == 50840 || Enemy.Entry == 50823 || Enemy.Entry == 50831 || Enemy.Entry == 50830 || Enemy.Entry == 50832 || Enemy.Entry == 50750 || Enemy.Entry == 50768 || Enemy.Entry == 50772 || Enemy.Entry == 50766 || Enemy.Entry == 50769 || Enemy.Entry == 50780 || Enemy.Entry == 50776 || Enemy.Entry == 50739 || Enemy.Entry == 50749 || Enemy.Entry == 50734 || Enemy.Entry == 50364 || Enemy.Entry == 50363 || Enemy.Entry == 50733 || Enemy.Entry == 50388 || Enemy.Entry == 50341 || Enemy.Entry == 50349 || Enemy.Entry == 50340 || Enemy.Entry == 50347 || Enemy.Entry == 50338 || Enemy.Entry == 50344 || Enemy.Entry == 50339 || Enemy.Entry == 50354 || Enemy.Entry == 50351 || Enemy.Entry == 50355 || Enemy.Entry == 50356 || Enemy.Entry == 50350 || Enemy.Entry == 50352 || Enemy.Entry == 50359 || Enemy.Entry == 50821 || Enemy.Entry == 50817 || Enemy.Entry == 50822 || Enemy.Entry == 50816 || Enemy.Entry == 50811 || Enemy.Entry == 50808 || Enemy.Entry == 50820 || Enemy.Entry == 50787 || Enemy.Entry == 50806 || Enemy.Entry == 50789 || Enemy.Entry == 50805 || Enemy.Entry == 50783 || Enemy.Entry == 50782 || Enemy.Entry == 50791 || Enemy.Entry == 51059 || Enemy.Entry == 50334 || Enemy.Entry == 51078 || Enemy.Entry == 50331 || Enemy.Entry == 50332 || Enemy.Entry == 50333 || Enemy.Entry == 50336) && Me.HealthPercent < 80) { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but don't Kill Pandaria Mob with Health < 80%", Enemy.Name, Enemy.Entry); return; } if (Rarekiller.Settings.NotKillTameable && Enemy.IsTameable) // ... I want to tame him :) { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}, but kill tameable", Enemy.Name, Enemy.Entry); return; } #endregion Logging.WriteQuiet(Colors.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", Enemy.Name, Enemy.Entry); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Mob Location: {0} / {1} / {2}", Convert.ToString(Enemy.X), Convert.ToString(Enemy.Y), Convert.ToString(Enemy.Z)); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: Find {0} ID {1}')", Enemy.Name, Enemy.Entry); } #region don't kill if ... if (Rarekiller.Settings.PullCounter >= Rarekiller.Settings.MaxPullCounter) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but I pulled him now {1} Times", Enemy.Name, Rarekiller.Settings.PullCounter); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes, MoP Rares will be deactivated"); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: I pulled now {0} times, blacklist')", Rarekiller.Settings.PullCounter); } Rarekiller.Settings.PullCounter = 0; Rarekiller.Settings.GuidCurrentPull = 0; Rarekiller.Settings.BlacklistCounter++; Rarekiller.Settings.DeactivateMoPRare(Enemy); return; } // Don't kill Pandaria Rares with Level < 90 if ((Enemy.Entry == 50828 || Enemy.Entry == 50836 || Enemy.Entry == 50840 || Enemy.Entry == 50823 || Enemy.Entry == 50831 || Enemy.Entry == 50830 || Enemy.Entry == 50832 || Enemy.Entry == 50750 || Enemy.Entry == 50768 || Enemy.Entry == 50772 || Enemy.Entry == 50766 || Enemy.Entry == 50769 || Enemy.Entry == 50780 || Enemy.Entry == 50776 || Enemy.Entry == 50739 || Enemy.Entry == 50749 || Enemy.Entry == 50734 || Enemy.Entry == 50364 || Enemy.Entry == 50363 || Enemy.Entry == 50733 || Enemy.Entry == 50388 || Enemy.Entry == 50341 || Enemy.Entry == 50349 || Enemy.Entry == 50340 || Enemy.Entry == 50347 || Enemy.Entry == 50338 || Enemy.Entry == 50344 || Enemy.Entry == 50339 || Enemy.Entry == 50354 || Enemy.Entry == 50351 || Enemy.Entry == 50355 || Enemy.Entry == 50356 || Enemy.Entry == 50350 || Enemy.Entry == 50352 || Enemy.Entry == 50359 || Enemy.Entry == 50821 || Enemy.Entry == 50817 || Enemy.Entry == 50822 || Enemy.Entry == 50816 || Enemy.Entry == 50811 || Enemy.Entry == 50808 || Enemy.Entry == 50820 || Enemy.Entry == 50787 || Enemy.Entry == 50806 || Enemy.Entry == 50789 || Enemy.Entry == 50805 || Enemy.Entry == 50783 || Enemy.Entry == 50782 || Enemy.Entry == 50791 || Enemy.Entry == 51059 || Enemy.Entry == 50334 || Enemy.Entry == 51078 || Enemy.Entry == 50331 || Enemy.Entry == 50332 || Enemy.Entry == 50333 || Enemy.Entry == 50336) && Me.Level < 90) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but my level is to Low to kill him", Enemy.Name); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: My Level is to low')", Enemy.Name); } return; } if (Enemy.TaggedByOther && !Rarekiller.TaggedMobsList.ContainsKey(Convert.ToInt32(Enemy.Entry))) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's tagged by another Player", Enemy.Name); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is tagged')", Enemy.Name); } return; } //if not known ID of Inhouse Pandaria Rare --> don't kill if (!(Enemy.Entry == 50817 || Enemy.Entry == 50768 || Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 || Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769)) { if (Me.IsFlying && Me.IsOutdoors && Enemy.IsIndoors) { Logging.Write(Colors.MediumPurple, "Rarekiller: Mob is Indoors and I fly Outdoors, so blacklist him to prevent Problems"); Logging.Write(Colors.MediumPurple, "Rarekiller: You have to place me next to the Spawnpoint, if you want me to hunt this Mob."); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is Indoors')", Enemy.Name); } return; } } if (Enemy.Level > (Me.Level + 4)) // ... 4 Levels higher them me { Logging.Write(Colors.MediumPurple, "Rarekiller: His Level is 5 over mine, better not to kill him."); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } if (Enemy.IsFriendly) // ... is Friendly { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but he's friendly", Enemy.Name); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: NPC is friendly')", Enemy.Name); } return; } if ((Enemy.Entry == 32630) && !Rarekiller.Settings.Vyragosa) // ... my Settings say don't kill Vyragosa { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Vyragosa."); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: don't kill NPC')", Enemy.Name); } return; } if ((Enemy.Entry == 50057) && !Rarekiller.Settings.Blazewing) // ... my Settings say don't kill Blazewing { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Config says: don't kill Blazewing."); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 5 Minutes."); if (Rarekiller.Settings.LUAoutput) { Lua.DoString("print('NPCScan: don't kill NPC')", Enemy.Name); } return; } if ((Enemy.Entry == 596) || (Enemy.Entry == 599) || Me.IsInInstance) { // ... Instance Mobs, don't run wild in Instances Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Don't run wild because of RareMobs in Instances."); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(Enemy.Entry))) // ... Mob is Blacklisted in Rarekiller/config/BlacklistedMobs.xml { Logging.Write(Colors.MediumPurple, "Rarekiller: {0} is Member of the BlacklistedMobs.xml", Enemy.Name); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 15 Minutes."); return; } if (Rarekiller.DontInteract) { return; } #endregion if (Rarekiller.Settings.Alert) { Rarekiller.Alert(); } #region fly to Helperpoint for some Pandaria Rares if (Me.IsFlying && (Enemy.Entry == 50817 || Enemy.Entry == 50768 || Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 || Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769 || Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 || Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820)) { WoWPoint Helperpoint = Enemy.Location; if (Enemy.Entry == 50817) { Helperpoint = LandingPoint50817; } if (Enemy.Entry == 50768) { Helperpoint = LandingPoint50768; } if (Enemy.Entry == 50836) { Helperpoint = LandingPoint50836; } if (Enemy.Entry == 50782) { Helperpoint = LandingPoint50782; } if (Enemy.Entry == 50831) { Helperpoint = LandingPoint50831; } if (Enemy.Entry == 50832) { Helperpoint = LandingPoint50832; } if (Enemy.Entry == 50769) { Helperpoint = LandingPoint50769; } if (Enemy.Entry == 50822) { Helperpoint = LandingPoint50822; } if (Enemy.Entry == 50331) { Helperpoint = LandingPoint50331; } if (Enemy.Entry == 51078) { Helperpoint = LandingPoint51078; } if (Enemy.Entry == 50749) { Helperpoint = LandingPoint50749; } if (Enemy.Entry == 50334) { Helperpoint = LandingPoint50334; } if (Enemy.Entry == 50347) { Helperpoint = LandingPoint50347; } if (Enemy.Entry == 50811) { Helperpoint = LandingPoint50811; } if (Enemy.Entry == 50821) { Helperpoint = LandingPoint50821; } if (Enemy.Entry == 50808) { Helperpoint = LandingPoint50808; } if (Enemy.Entry == 50820) { Helperpoint = LandingPoint50820; } if (!Rarekiller.MoveTo(Helperpoint, Enemy, 5, false)) { return; } Rarekiller.Dismount(); } #endregion #region Check PullRange string UsedPullRange = Rarekiller.Settings.Range; // Range to 27 because of Inhouse Pandaria Mob if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) && ( Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 || Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50768 || Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 || Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820)) { UsedPullRange = "27"; Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 27 because of Inhouse Pandaria Rare"); } // Range to 3 for other Pandaria Mobs //else if (o.Entry == 50828 || o.Entry == 50836 || o.Entry == 50840 || o.Entry == 50823 || //o.Entry == 50831 || o.Entry == 50830 || o.Entry == 50832 || o.Entry == 50750 || //o.Entry == 50768 || o.Entry == 50772 || o.Entry == 50766 || o.Entry == 50769 || //o.Entry == 50780 || o.Entry == 50776 || o.Entry == 50739 || o.Entry == 50749 || //o.Entry == 50734 || o.Entry == 50364 || o.Entry == 50363 || o.Entry == 50733 || //o.Entry == 50388 || o.Entry == 50341 || o.Entry == 50349 || o.Entry == 50340 || //o.Entry == 50347 || o.Entry == 50338 || o.Entry == 50344 || o.Entry == 50339 || //o.Entry == 50354 || o.Entry == 50351 || o.Entry == 50355 || o.Entry == 50356 || //o.Entry == 50350 || o.Entry == 50352 || o.Entry == 50359 || o.Entry == 50821 || //o.Entry == 50817 || o.Entry == 50822 || o.Entry == 50816 || o.Entry == 50811 || //o.Entry == 50808 || o.Entry == 50820 || o.Entry == 50787 || o.Entry == 50806 || //o.Entry == 50789 || o.Entry == 50805 || o.Entry == 50783 || o.Entry == 50782 || //o.Entry == 50791 || o.Entry == 51059 || o.Entry == 50334 || o.Entry == 51078 || //o.Entry == 50331 || o.Entry == 50332 || o.Entry == 50333 || o.Entry == 50336) //{ // UsedPullRange = "3"; // Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to 3 because of other Pandaria Rares"); //} else if (!Rarekiller.Settings.DefaultPull && (Convert.ToInt64(UsedPullRange) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull)))) { UsedPullRange = Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull); Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Customized Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Settings.Pull)); } else if (Rarekiller.Settings.DefaultPull && (Convert.ToInt64(UsedPullRange) > Convert.ToInt64(Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell)))) { UsedPullRange = Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell); Logging.Write(Colors.MediumPurple, "Rarekiller: Set Range to {0} because of Low-Ranged Default Spell", Rarekiller.Spells.RangeCheck(Rarekiller.Spells.FastPullspell)); } #endregion #region Move To Mob if (Enemy.Entry == 50817 || Enemy.Entry == 50768 || Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 || Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769 || Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 || Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820) { if (!Rarekiller.MoveTo(Enemy, Convert.ToInt64(UsedPullRange), true)) { return; } } else { if (!Rarekiller.MoveTo(Enemy, Convert.ToInt64(UsedPullRange), false)) { return; } } #endregion #region Special Behavior Nal'lak //if (Me.Combat && o.Entry == 50364) //Nal'lak //{ // WoWMovement.MoveStop(); // Thread.Sleep(100); // if (Me.IsFlying) // { // WoWUnit GroundUnit = ObjectManager.GetObjectsOfType<WoWUnit>().Where(u => (!u.IsFlying)).OrderBy(u => u.Distance).FirstOrDefault(); ; // if (!Rarekiller.DescendToLand(GroundUnit)) return; // } // Rarekiller.Dismount(); //} #endregion #region Special Behavior Clean up Area if (Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347) { List <WoWUnit> AddList = ObjectManager.GetObjectsOfType <WoWUnit>().Where(Add => !Add.IsDead && Add.IsHostile && (Add != Enemy) && Add.Location.Distance(Enemy.Location) < 27 && Add.Location.Distance(Me.Location) < 27).OrderBy(Add => Add.Distance).ToList(); foreach (WoWUnit Add in AddList) { if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, Add, true); Logging.Write(Colors.MediumPurple, "Rarekiller: Clean up Area, pull Add: {0}", Add.Name); return; } } } #endregion #region Pull Mob Logging.Write(Colors.MediumPurple, "Rarekiller: Pull at Mob Location: {0} / {1} / {2}", Convert.ToString(Enemy.X), Convert.ToString(Enemy.Y), Convert.ToString(Enemy.Z)); Logging.Write(Colors.MediumPurple, "Rarekiller: ... my Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Target is Flying - {0}", Enemy.IsFlying); Enemy.Target(); if (SpellManager.HasSpell(Rarekiller.Spells.RangedPullspell) && (Enemy.Entry == 50817 || Enemy.Entry == 50768 || Enemy.Entry == 50836 || Enemy.Entry == 50782 || Enemy.Entry == 50331 || Enemy.Entry == 51078 || Enemy.Entry == 50822 || Enemy.Entry == 50831 || Enemy.Entry == 50832 || Enemy.Entry == 50769 || Enemy.Entry == 50749 || Enemy.Entry == 50334 || Enemy.Entry == 50347 || Enemy.Entry == 50811 || Enemy.Entry == 50821 || Enemy.Entry == 50808 || Enemy.Entry == 50820)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.RangedPullspell, Enemy, true); } else if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, Enemy, false); } else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, Enemy, false); } else { Logging.Write(Colors.MediumPurple, "Rarekiller: I have no valid Pullspell - sorry"); } if (Me.CurrentTarget != Enemy) { Enemy.Target(); } #endregion #region Quick Slowfall for known flying Mobs if (Rarekiller.Settings.UseSlowfall && ((Enemy.Entry == 29753) || (Enemy.Entry == 32491) || (Enemy.Entry == 32630) || (Enemy.Entry == 33687) || (Enemy.Entry == 50364))) { Thread.Sleep(500); if (Me.IsFalling) { Rarekiller.Slowfall.HelpFalling(); } } Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Use Quick Slowfall: {0} Mob: {1}", Me.IsFalling, Enemy.Name); #endregion #region Pulltimer and Pullcounter WaitAfterPullTimer.Reset(); WaitAfterPullTimer.Start(); while (WaitAfterPullTimer.IsRunning && !Rarekiller.ToonInvalidCombat && WaitAfterPullTimer.ElapsedMilliseconds < 2000) { Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Wait for Combat now {0} ms", WaitAfterPullTimer.ElapsedMilliseconds); Thread.Sleep(100); } if (CastSuccess && Me.Combat) { Logging.Write(Colors.MediumPurple, "Rarekiller: Successfully pulled {0}", Enemy.Name); } if (Enemy.Entry != 32491 && Enemy.Entry != 50005 && (Rarekiller.Settings.GuidCurrentPull != Enemy.Guid) && Me.Combat) { Rarekiller.Settings.PullCounter = 1; Rarekiller.Settings.GuidCurrentPull = Enemy.Guid; Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now first time", Enemy.Name); } else if (Me.Combat) { Rarekiller.Settings.PullCounter++; Logging.Write(Colors.MediumPurple, "Rarekiller: Pulled {0} now {1} times", Enemy.Name, Rarekiller.Settings.PullCounter); if ((Enemy.Entry == 50828 || Enemy.Entry == 50836 || Enemy.Entry == 50840 || Enemy.Entry == 50823 || Enemy.Entry == 50831 || Enemy.Entry == 50830 || Enemy.Entry == 50832 || Enemy.Entry == 50750 || Enemy.Entry == 50768 || Enemy.Entry == 50772 || Enemy.Entry == 50766 || Enemy.Entry == 50769 || Enemy.Entry == 50780 || Enemy.Entry == 50776 || Enemy.Entry == 50739 || Enemy.Entry == 50749 || Enemy.Entry == 50734 || Enemy.Entry == 50364 || Enemy.Entry == 50363 || Enemy.Entry == 50733 || Enemy.Entry == 50388 || Enemy.Entry == 50341 || Enemy.Entry == 50349 || Enemy.Entry == 50340 || Enemy.Entry == 50347 || Enemy.Entry == 50338 || Enemy.Entry == 50344 || Enemy.Entry == 50339 || Enemy.Entry == 50354 || Enemy.Entry == 50351 || Enemy.Entry == 50355 || Enemy.Entry == 50356 || Enemy.Entry == 50350 || Enemy.Entry == 50352 || Enemy.Entry == 50359 || Enemy.Entry == 50821 || Enemy.Entry == 50817 || Enemy.Entry == 50822 || Enemy.Entry == 50816 || Enemy.Entry == 50811 || Enemy.Entry == 50808 || Enemy.Entry == 50820 || Enemy.Entry == 50787 || Enemy.Entry == 50806 || Enemy.Entry == 50789 || Enemy.Entry == 50805 || Enemy.Entry == 50783 || Enemy.Entry == 50782 || Enemy.Entry == 50791 || Enemy.Entry == 51059 || Enemy.Entry == 50334 || Enemy.Entry == 51078 || Enemy.Entry == 50331 || Enemy.Entry == 50332 || Enemy.Entry == 50333 || Enemy.Entry == 50336) && Me.Level < 90) { RoutineManager.Current.Combat(); } } #endregion #region Move to a Save Fighting Area after Pull for some Pandaria Rares if ((Enemy.Entry == 50768 || Enemy.Entry == 50832) && Me.Combat) { WoWPoint SaveHelperpoint = Enemy.Location; Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point", Enemy.Entry); if (Enemy.Entry == 50768) { SaveHelperpoint = SavePoint50768; } if (Enemy.Entry == 50832) { SaveHelperpoint = SavePoint50832; } if (Navigator.CanNavigateFully(Me.Location, SaveHelperpoint)) { Logging.Write(Colors.MediumPurple, "Rarekiller: Move to Save Fighting Point"); while (Me.Location.Distance(SaveHelperpoint) > 5) { if (Me.IsSwimming) { WoWMovement.ClickToMove(SaveHelperpoint); } else { Navigator.MoveTo(SaveHelperpoint); } Thread.Sleep(100); if (Rarekiller.ToonInvalid) { return; } } } else { Logging.Write(Colors.MediumPurple, "Rarekiller: Wasn't able to Move to Save Fighting Point", Enemy.Entry); } } #endregion return; } else { if (Enemy.Guid == Rarekiller.Settings.GuidCurrentPull) { Rarekiller.Settings.PullCounter = 0; Rarekiller.Settings.GuidCurrentPull = 0; Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Set PullCounter to {0}", Rarekiller.Settings.PullCounter); } if (Enemy.CanLoot) { if (!Rarekiller.Loothelper(Enemy)) { return; } } if (!Blacklist.Contains(Enemy.Guid, Rarekiller.Settings.Flags)) { Logging.Write(Colors.MediumPurple, "Rarekiller: Find {0}, but sadly he's dead", Enemy.Name); Blacklist.Add(Enemy.Guid, Rarekiller.Settings.Flags, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.WriteDiagnostic(Colors.MediumPurple, "Rarekiller: Blacklist Mob for 60 Minutes."); } } }
private async Task <bool> FindNode(bool retryCenterHotspot = true) { if (Node != null) { return(false); } StatusText = Localization.ExGather_SearchForNodes; while (Behaviors.ShouldContinue) { IEnumerable <GatheringPointObject> nodes = GameObjectManager.GetObjectsOfType <GatheringPointObject>().Where(gpo => gpo.CanGather).ToArray(); if (GatherStrategy == GatherStrategy.TouchAndGo && HotSpots != null) { if (GatherObjects != null) { nodes = nodes.Where(gpo => GatherObjects.Contains(gpo.EnglishName, StringComparer.InvariantCultureIgnoreCase)); } foreach (var node in nodes.Where(gpo => HotSpots.CurrentOrDefault.WithinHotSpot2D(gpo.Location)) .OrderBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location)) .Skip(1)) { if (!Blacklist.Contains(node.ObjectId, BlacklistFlags.Interact)) { Blacklist.Add( node, BlacklistFlags.Interact, TimeSpan.FromSeconds(18), Localization.ExGather_SkipFurthestNodes); } } } nodes = nodes.Where(gpo => !Blacklist.Contains(gpo.ObjectId, BlacklistFlags.Interact)); if (FreeRange) { nodes = nodes.Where(gpo => gpo.Distance2D(ExProfileBehavior.Me.Location) < Radius); } else { if (HotSpots != null) { nodes = nodes.Where(gpo => HotSpots.CurrentOrDefault.WithinHotSpot2D(gpo.Location)); } } // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression if (GatherObjects != null) { Node = nodes.OrderBy( gpo => GatherObjects.FindIndex(i => string.Equals(gpo.EnglishName, i, StringComparison.InvariantCultureIgnoreCase))) .ThenBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location)) .FirstOrDefault(gpo => GatherObjects.Contains(gpo.EnglishName, StringComparer.InvariantCultureIgnoreCase)); } else { Node = nodes.OrderBy(gpo => gpo.Location.Distance2D(ExProfileBehavior.Me.Location)).FirstOrDefault(); } if (Node == null) { if (HotSpots != null) { var myLocation = ExProfileBehavior.Me.Location; var distanceToFurthestVisibleGameObject = GameObjectManager.GameObjects.Select(o => o.Location.Distance2D(myLocation)) .OrderByDescending(o => o) .FirstOrDefault(); var distanceToFurthestVectorInHotspot = myLocation.Distance2D(HotSpots.CurrentOrDefault) + HotSpots.CurrentOrDefault.Radius; if (myLocation.Distance2D(HotSpots.CurrentOrDefault) > Radius && GatherStrategy == GatherStrategy.GatherOrCollect && retryCenterHotspot && distanceToFurthestVisibleGameObject <= distanceToFurthestVectorInHotspot) { Logger.Verbose(Localization.ExGather_DistanceObject + distanceToFurthestVisibleGameObject); Logger.Verbose(Localization.ExGather_DistanceHotSpot + distanceToFurthestVectorInHotspot); Logger.Warn( Localization.ExGather_NoAvailableNode); await HotSpots.CurrentOrDefault.XYZ.MoveTo(radius : Radius, name : HotSpots.CurrentOrDefault.Name); retryCenterHotspot = false; await Coroutine.Yield(); continue; } if (!await ChangeHotSpot()) { retryCenterHotspot = false; await Coroutine.Yield(); continue; } } if (FreeRange && !FreeRangeConditional()) { await Coroutine.Yield(); isDone = true; return(true); } return(true); } var entry = Blacklist.GetEntry(Node.ObjectId); if (entry != null && entry.Flags.HasFlag(BlacklistFlags.Interact)) { Logger.Warn(Localization.ExGather_NodeBlacklist); if (await Coroutine.Wait(entry.Length, () => entry.IsFinished || Node.Location.Distance2D(ExProfileBehavior.Me.Location) > Radius) || Core.Player.IsDead) { if (!entry.IsFinished) { Node = null; Logger.Info(Localization.ExGather_NodeReset); return(false); } } Logger.Info(Localization.ExGather_NodeBlacklistRemoved); } Logger.Info(Localization.ExGather_NodeSet + Node); if (HotSpots == null) { MovementManager.SetFacing2D(Node.Location); } if (Poi.Current.Unit != Node) { Poi.Current = new Poi(Node, PoiType.Gather); } return(true); } return(true); }
public static void BlacklistPool(WoWGameObject pool, TimeSpan time, string reason) { Blacklist.Add(pool.Guid, time); AutoAngler.Instance.Log("Blacklisting {0} for {1} Reason: {2}", pool.Name, time, reason); BotPoi.Current = new BotPoi(PoiType.None); }
private static void HandleEvadeBuggedMob(LuaEventArgs args, CombatLogEventArgs e) { WoWUnit unit = e.DestUnit; WoWGuid guid = e.DestGuid; if (unit == null && StyxWoW.Me.GotTarget()) { unit = StyxWoW.Me.CurrentTarget; guid = StyxWoW.Me.CurrentTargetGuid; Logger.Write("Evade: bugged mob guid:{0}, so assuming current target instead", args.Args[7]); } if (unit != null) { if (!MobsThatEvaded.ContainsKey(unit.Guid)) { MobsThatEvaded.Add(unit.Guid, 0); } MobsThatEvaded[unit.Guid] = MobsThatEvaded[unit.Guid] + 1; if (MobsThatEvaded[unit.Guid] < SingularSettings.Instance.EvadedAttacksAllowed) { Logger.Write("Mob {0} has evaded {1} times. Not blacklisting yet, but will count evades on {2:X0} for now", unit.SafeName(), MobsThatEvaded[unit.Guid], unit.Guid); } else { const int MinutesToBlacklist = 5; if (Blacklist.Contains(unit.Guid, BlacklistFlags.Combat)) { Logger.Write(Color.LightGoldenrodYellow, "Mob {0} has evaded {1} times. Previously blacklisted {2:X0} for {3} minutes!", unit.SafeName(), MobsThatEvaded[unit.Guid], unit.Guid, MinutesToBlacklist); } else { string fragment = string.Format("Mob {0} has evaded {1} times", unit.SafeName(), MobsThatEvaded[unit.Guid]); Logger.Write(Color.LightGoldenrodYellow, "{0}. Blacklisting {1:X0} for {2} minutes!", fragment, unit.Guid, MinutesToBlacklist); Blacklist.Add(unit.Guid, BlacklistFlags.Combat, TimeSpan.FromMinutes(MinutesToBlacklist), "Singular - " + fragment); if (!Blacklist.Contains(unit.Guid, BlacklistFlags.Combat)) { Logger.Write(Color.Pink, "error: blacklist does not contain entry for {0} after Blacklist.Add", unit.SafeName()); } } if (BotPoi.Current.Guid == unit.Guid) { Logger.Write("EvadeHandling: Current BotPOI type={0} is Evading, clearing now...", BotPoi.Current.Type); BotPoi.Clear("Singular recognized Evade bugged mob"); } if (StyxWoW.Me.CurrentTargetGuid == guid) { foreach (var target in Targeting.Instance.TargetList) { if (Unit.ValidUnit(target) && !Blacklist.Contains(target.Guid, BlacklistFlags.Pull | BlacklistFlags.Combat) && unit.EvadedAttacksCount() < SingularSettings.Instance.EvadedAttacksAllowed ) { Logger.Write(Color.Pink, "Setting target to {0} to get off evade bugged mob!", target.SafeName()); target.Target(); return; } } Logger.Write(Color.Pink, "BotBase has 0 entries in Target list not blacklisted -- nothing else we can do at this point!"); // StyxWoW.Me.ClearTarget(); } } } /// line below was originally in Evade logic, but commenting to avoid Sleeps // StyxWoW.SleepForLagDuration(); }
//public static void Log(string text, params object[] args) { Logger.Info(text, args); } public static async Task <bool> Main(Vector3 gardenLoc) { var watering = GardenManager.Plants.Where(r => !Blacklist.Contains(r) && r.Distance2D(gardenLoc) < 10).ToArray(); foreach (var plant in watering) { //Water it if it needs it or if we have fertilized it 5 or more times. if (AlwaysWater || GardenManager.NeedsWatering(plant)) { var result = GardenManager.GetCrop(plant); if (result != null) { Log($"Watering {result} {plant.ObjectId:X}"); await Navigation.FlightorMove(plant.Location); plant.Interact(); if (!await Coroutine.Wait(5000, () => Talk.DialogOpen)) { continue; } Talk.Next(); if (!await Coroutine.Wait(5000, () => SelectString.IsOpen)) { continue; } if (!await Coroutine.Wait(5000, () => SelectString.LineCount > 0)) { continue; } if (SelectString.LineCount == 4) { SelectString.ClickSlot(1); await Coroutine.Sleep(2300); } else { Log("Plant is ready to be harvested"); SelectString.ClickSlot(1); await Coroutine.Sleep(1000); } } else { Log($"GardenManager.GetCrop returned null {plant.ObjectId:X}"); } } } var plants = GardenManager.Plants.Where(r => r.Distance2D(gardenLoc) < 10).ToArray(); foreach (var plant in plants) { var result = GardenManager.GetCrop(plant); if (result == null) { continue; } Log($"Fertilizing {GardenManager.GetCrop(plant)} {plant.ObjectId:X}"); await Navigation.FlightorMove(plant.Location); plant.Interact(); if (!await Coroutine.Wait(5000, () => Talk.DialogOpen)) { continue; } Talk.Next(); if (!await Coroutine.Wait(5000, () => SelectString.IsOpen)) { continue; } if (!await Coroutine.Wait(5000, () => SelectString.LineCount > 0)) { continue; } if (SelectString.LineCount == 4) { SelectString.ClickSlot(0); if (await Coroutine.Wait(2000, () => GardenManager.ReadyToFertilize)) { if (GardenManager.Fertilize() != FertilizeResult.Success) { continue; } Log($"Plant with objectId {plant.ObjectId:X} was fertilized"); await Coroutine.Sleep(2300); } else { Log($"Plant with objectId {plant.ObjectId:X} not able to be fertilized, trying again later"); } } else { Log("Plant is ready to be harvested"); SelectString.ClickSlot(1); await Coroutine.Sleep(1000); } } return(true); }
public Condition(Random random, Blacklist blacklist) { _random = random; _blacklist = blacklist; }
public static bool ExecuteAction(string action) { string fnname = "FTWCore.ExecuteAction"; string subfn = string.Format("FTWCore.ExecuteAction '{0}'", action); MyTimer.Start(fnname); MyTimer.Start(subfn); bool retval = false; WoWUnit Me = StyxWoW.Me; if (action == null) { throw new Exception("ExecuteAction - received null action"); } action = action.Replace("\t", ""); while (action.StartsWith(" ")) { action = action.Substring(1, action.Length - 1); } action = action.Replace(" ", " "); if (!action.Contains(".")) { action = "Target.Cast " + action; } if (action == "Target.Cast Blacklist" && Me.CurrentTarget != null) { FTWLogger.log(Color.Violet, "Blackisting {0} for 60 seconds", Me.CurrentTarget.SafeName()); Blacklist.Add(Me.CurrentTarget, TimeSpan.FromSeconds(60)); StyxWoW.Me.ClearTarget(); retval = true; } else { // Get first and last part of string string lastpart = string.Empty; string firstpart = string.Empty; int index = action.IndexOf(" "); if (index > -1) { firstpart = action.Substring(0, index); lastpart = action.Substring(index + 1, action.Length - index - 1); } else { firstpart = action; lastpart = string.Empty; } // Get target of action string[] words = firstpart.Split('.'); WoWUnit target = null; switch (words[0]) { case "Me": target = Me; break; case "Target": target = Me.CurrentTarget; break; case "Tank": target = FTWProps.tank; break; case "Healer": target = FTWProps.healer; break; case "Heal": target = FTWProps.healTarget; break; case "Revive": target = FTWProps.reviveTarget; break; case "Cleanse": target = FTWProps.cleanseTarget; break; case "Pet": target = Me.Pet; break; case "Add": target = FTWProps.add; break; default: target = null; break; } if (target == null) { retval = false; } else { switch (words[1]) { // Actions that use targets (Me, Target, Tank, etc from the list above.) case "DebugCast": retval = On_Cast(firstpart, lastpart, target, false, false, true); break; case "Cast": retval = On_Cast(firstpart, lastpart, target, false, false); break; case "DebugCastNow": retval = On_Cast(firstpart, lastpart, target, true, false, true); break; case "CastNow": retval = On_Cast(firstpart, lastpart, target, true, false); break; case "StopCasting": retval = On_StopCasting(lastpart); break; case "DebugCastOnce": retval = On_Cast(firstpart, lastpart, target, true, true, true); break; case "CastOnce": retval = On_Cast(firstpart, lastpart, target, true, true); break; case "DumpAuras": retval = FTWCoreStatus.On_DumpAuras(target); break; case "DumpParty": retval = FTWCoreStatus.On_DumpParty(); break; case "PetCast": retval = On_PetCast(lastpart, target, false); break; case "PetCastNow": retval = On_PetCast(lastpart, target, true); break; case "Use": retval = FTWCoreItems.On_Use(lastpart, target); break; // Actions that don't use targets (don't care what the prefix is - can be any from the list above) case "PullMore": retval = On_PullMore(firstpart, lastpart); break; case "ImbueWeapon1": retval = FTWCoreItems.ImbueWeapon(lastpart, "mainhand", 1); break; case "ImbueWeapon2": retval = FTWCoreItems.ImbueWeapon(lastpart, "offhand", 2); break; case "CastAll": retval = On_CastAll(firstpart, lastpart); break; case "InterruptAny": retval = On_Interrupt(firstpart, lastpart); break; case "ExecuteAny": retval = On_Execute(firstpart, lastpart); break; case "ParalyzeAny": retval = On_Paralyze(firstpart, lastpart); break; case "Message": retval = false; FTWLogger.log(lastpart); break; case "Range": retval = false; FTWProps.range = double.Parse(lastpart); FTWLogger.log("Combat range set to {0:0.00}", FTWProps.range); break; case "ClipTime": retval = false; FTWProps.cliptime = Int32.Parse(lastpart); FTWLogger.log("Spells will be clipped with {0} ms remaining cast time.", FTWProps.cliptime); break; case "Eat": retval = FTWCoreItems.On_Eat(); break; case "Drink": retval = FTWCoreItems.On_Drink(); break; case "UseBandage": retval = FTWCoreItems.On_UseBandage(); break; case "UseHealthPotion": retval = FTWCoreItems.On_UseHealthPotion(); break; case "UseManaPotion": retval = FTWCoreItems.On_UseManaPotion(); break; case "FollowTarget": retval = FTWCoreMovement.FollowTarget(); break; case "FindBetterTarget": retval = On_FindBetterTarget("by script request"); break; case "PetAttack": retval = On_PetAttack(); break; case "AutoAttack": retval = On_AutoAttack(); break; case "OnCooldown": retval = FTWCoreStatus.OnCooldown(lastpart); break; case "Macro": retval = false; Macro(lastpart); break; case "LootChestsOn": CharacterSettings.Instance.LootChests = true; break; case "LootChestsOff": CharacterSettings.Instance.LootChests = false; break; case "GrabAggro": retval = On_GrabAggro(); break; case "LeaveEarly": retval = true; break; // Unknown action default: retval = On_UnimplementedAction(action); break; } } } MyTimer.Stop(subfn); MyTimer.Stop(fnname); return(retval); }
internal void Reset() { Blacklist.Clear(i => true); }
private static void HandleEvadeBuggedMob(LuaEventArgs args, CombatLogEventArgs e) { WoWUnit unit = e.DestUnit; ulong guid = e.DestGuid; if (unit == null && StyxWoW.Me.CurrentTarget != null) { unit = StyxWoW.Me.CurrentTarget; guid = StyxWoW.Me.CurrentTargetGuid; Logging.Write("Evade: bugged mob guid:{0}, so assuming current target instead", args.Args[7]); } if (unit != null) { if (!MobsThatEvaded.ContainsKey(unit.Guid)) { MobsThatEvaded.Add(unit.Guid, 0); } MobsThatEvaded[unit.Guid]++; if (MobsThatEvaded[unit.Guid] <= 5) { Logging.Write("Mob {0} has evaded {1} times. Keeping an eye on {2:X0} for now!", unit.Name, MobsThatEvaded[unit.Guid], unit.Guid); } else { const int secondsToBlacklist = 10; if (Blacklist.Contains(unit.Guid, BlacklistFlags.Combat)) { Logging.Write(Colors.LightGoldenrodYellow, "Mob {0} has evaded {1} times. Previously blacklisted {2:X0} for {3} seconds!", unit.Name, MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist); } else { Logging.Write(Colors.LightGoldenrodYellow, "Mob {0} has evaded {1} times. Blacklisting {2:X0} for {3} seconds!", unit.Name, MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist); Blacklist.Add(unit.Guid, BlacklistFlags.Combat, TimeSpan.FromSeconds(secondsToBlacklist)); if (!Blacklist.Contains(unit.Guid, BlacklistFlags.Combat)) { Logging.Write(Colors.Pink, "error: blacklist does not contain entry for {0} so adding {1}", unit.Name, unit.Guid); } } if (BotPoi.Current.Guid == unit.Guid) { Logging.Write("EvadeHandling: Current BotPOI type={0} is Evading, clearing now...", BotPoi.Current.Type); BotPoi.Clear("Singular recognized Evade bugged mob"); } if (StyxWoW.Me.CurrentTargetGuid == guid) { foreach (var target in Targeting.Instance.TargetList) { if (target.IsAlive && Classname.ValidUnit(target) && !Blacklist.Contains(target, BlacklistFlags.Combat)) { Logging.Write(Colors.Pink, "Setting target to {0} to get off evade bugged mob!", target.Name); target.Target(); return; } } Logging.Write(Colors.Pink, "BotBase has 0 entries in Target list not blacklisted -- nothing else we can do at this point!"); // StyxWoW.Me.ClearTarget(); } } } /// line below was originally in Evade logic, but commenting to avoid Sleeps // StyxWoW.SleepForLagDuration(); }
internal static bool FateFilter(FateData fate) { var oracleFateData = FateDatabase.GetFateFromFateData(fate); if (oracleFateData.Type == FateType.Boss && !FateSettings.Instance.BossFatesEnabled) { return(false); } if (oracleFateData.Type == FateType.Collect && !FateSettings.Instance.CollectFatesEnabled) { return(false); } if (oracleFateData.Type == FateType.Defence && !FateSettings.Instance.DefenceFatesEnabled) { return(false); } if (oracleFateData.Type == FateType.Escort && !FateSettings.Instance.EscortFatesEnabled) { return(false); } if (oracleFateData.Type == FateType.Kill && !FateSettings.Instance.KillFatesEnabled) { return(false); } if (oracleFateData.Type == FateType.MegaBoss && !FateSettings.Instance.MegaBossFatesEnabled) { return(false); } if (WaitingForChainFate() && GetChainFate(PreviousFateId).Id != fate.Id) { return(false); } if (ModeSettings.Instance.OracleOperationMode == OracleOperationMode.SpecificFates && !FateSettings.Instance.SpecificFateList.Contains(fate.Id)) { return(false); } if (Blacklist.Contains(fate.Id, BlacklistFlags.Node)) { return(false); } if (BlacklistSettings.Instance.BlacklistedFates.Contains(fate.Id)) { return(false); } if (FateSettings.Instance.IgnoreLowDuration) { if (Math.Abs(fate.Progress) < 0.5f && fate.TimeLeft < TimeSpan.FromSeconds(FateSettings.Instance.LowFateDuration)) { return(false); } } // Always ignore FATEs under 60 seconds if they're collection FATEs (stops reselecting FATE after final turn in). if (oracleFateData.Type == FateType.Collect && fate.TimeLeft < TimeSpan.FromSeconds(60)) { return(false); } if (oracleFateData.SupportLevel == FateSupportLevel.Unsupported) { return(false); } if (oracleFateData.SupportLevel == FateSupportLevel.Problematic && !FateSettings.Instance.RunProblematicFates) { return(false); } if (oracleFateData.SupportLevel == FateSupportLevel.NotInGame) { return(false); } if (!FateProgressionMet(fate)) { return(false); } if (fate.Level > OracleClassManager.GetTrueLevel() + FateSettings.Instance.FateMaxLevelAbove) { return(false); } if (fate.Level < OracleClassManager.GetTrueLevel() - FateSettings.Instance.FateMinLevelBelow && (ModeSettings.Instance.OracleOperationMode == OracleOperationMode.FateGrind || ModeSettings.Instance.OracleOperationMode == OracleOperationMode.LevelMode || ModeSettings.Instance.OracleOperationMode == OracleOperationMode.MultiLevelMode)) { return(false); } return(true); }
private async Task MessageReceived(SocketMessage msg) { try { if (msg.Author.IsBot || !(msg is SocketUserMessage message)) { return; } int argPos = 0; List <string> prefixes = new List <string>(_configuration.BotPrefixes); Server server = null; ExecutionObject executionObj; if (message.Channel is ITextChannel channel) { IGuild guild = channel.Guild; _database.Execute(x => { server = x.Load <Server>($"{guild.Id}") ?? new Server(); }); switch (server.BlockingType) { case BlockingType.Whitelist when !server.Whitelist.Contains(channel.Id): case BlockingType.Blacklist when server.Blacklist.Contains(channel.Id): return; case BlockingType.None: break; } prefixes.AddRange(server.Prefixes); executionObj = new ExecutionObject { Server = server }; } else { executionObj = new ExecutionObject(); } if (message.HasMentionPrefix(_client.CurrentUser, ref argPos) || prefixes.Any(x => message.HasStringPrefix(x, ref argPos, StringComparison.OrdinalIgnoreCase))) { ShardedCommandContext context = new ShardedCommandContext(_client, message); string parameters = message.Content.Substring(argPos).TrimStart('\n', ' '); _services.GetService <CachingService>().ExecutionObjects[message.Id] = executionObj; IResult result = await _commands.ExecuteAsync(context, parameters, _services, MultiMatchHandling.Best); Console.WriteLine($"User {message.Author.Username} in {context.Guild.Name}: {message.ToString()}"); if (!result.IsSuccess) { await HandleErrorAsync(result, context, parameters, server); } } } catch (Exception e) { Console.WriteLine(e.ToString()); throw new Exception(e.ToString()); } }
public void LoadSettings() { var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var settingsPath = Path.Combine(path, Cache.Instance.FilterPath(_characterName) + ".xml"); var reloadSettings = _characterName != Cache.Instance.DirectEve.Me.Name; if (File.Exists(settingsPath)) { reloadSettings = _lastModifiedDate != File.GetLastWriteTime(settingsPath); } if (!reloadSettings) { return; } _characterName = Cache.Instance.DirectEve.Me.Name; _lastModifiedDate = File.GetLastWriteTime(settingsPath); if (!File.Exists(settingsPath)) { // Clear settings AgentName = string.Empty; AutoStart = false; waitDecline = false; SaveLog = false; maxLineConsole = 1000; Disable3D = false; RandomDelay = 0; minStandings = 10; MinimumDelay = 0; MinimumDelay = 0; minStandings = 10; WindowXPosition = null; WindowYPosition = null; LootHangar = string.Empty; AmmoHangar = string.Empty; MissionsPath = Path.Combine(path, "Missions"); bookmarkWarpOut = string.Empty; MaximumHighValueTargets = 0; MaximumLowValueTargets = 0; Ammo.Clear(); FactionFitting.Clear(); MissionFitting.Clear(); MinimumAmmoCharges = 0; WeaponGroupId = 0; ReserveCargoCapacity = 0; MaximumWreckTargets = 0; SpeedTank = false; OrbitDistance = 0; NosDistance = 38000; MinimumPropulsionModuleDistance = 0; MinimumPropulsionModuleCapacitor = 0; ActivateRepairModules = 0; DeactivateRepairModules = 0; MinimumShieldPct = 0; MinimumArmorPct = 0; MinimumCapacitorPct = 0; SafeShieldPct = 0; SafeArmorPct = 0; SafeCapacitorPct = 0; UseDrones = false; DroneTypeId = 0; DroneControlRange = 0; DroneMinimumShieldPct = 0; DroneMinimumArmorPct = 0; DroneMinimumCapacitorPct = 0; DroneRecallCapacitorPct = 0; LongRangeDroneRecallCapacitorPct = 0; UseGatesInSalvage = false; Blacklist.Clear(); FactionBlacklist.Clear(); return; } var xml = XDocument.Load(settingsPath).Root; DebugStates = (bool?)xml.Element("debugStates") ?? false; DebugPerformance = (bool?)xml.Element("debugPerformance") ?? false; AutoStart = (bool?)xml.Element("autoStart") ?? false; waitDecline = (bool?)xml.Element("waitDecline") ?? false; SaveLog = (bool?)xml.Element("saveLog") ?? false; maxLineConsole = (int?)xml.Element("maxLineConsole") ?? 1000; Disable3D = (bool?)xml.Element("disable3D") ?? false; RandomDelay = (int?)xml.Element("randomDelay") ?? 0; MinimumDelay = (int?)xml.Element("minimumDelay") ?? 0; minStandings = (float?)xml.Element("minStandings") ?? 10; UseGatesInSalvage = (bool?)xml.Element("useGatesInSalvage") ?? false; BattleshipInvasionLimit = (int?)xml.Element("battleshipInvasionLimit") ?? 0; BattlecruiserInvasionLimit = (int?)xml.Element("battlecruiserInvasionLimit") ?? 0; CruiserInvasionLimit = (int?)xml.Element("cruiserInvasionLimit") ?? 0; FrigateInvasionLimit = (int?)xml.Element("frigateInvasionLimit") ?? 0; InvasionRandomDelay = (int?)xml.Element("invasionRandomDelay") ?? 0; InvasionMinimumDelay = (int?)xml.Element("invasionMinimumDelay") ?? 0; EnableStorylines = (bool?)xml.Element("enableStorylines") ?? false; WindowXPosition = (int?)xml.Element("windowXPosition"); WindowYPosition = (int?)xml.Element("windowYPosition"); CombatShipName = (string)xml.Element("combatShipName"); SalvageShipName = (string)xml.Element("salvageShipName"); LootHangar = (string)xml.Element("lootHangar"); AmmoHangar = (string)xml.Element("ammoHangar"); CreateSalvageBookmarks = (bool?)xml.Element("createSalvageBookmarks") ?? false; BookmarkPrefix = (string)xml.Element("bookmarkPrefix") ?? "Salvage:"; MinimumWreckCount = (int?)xml.Element("minimumWreckCount") ?? 1; AfterMissionSalvaging = (bool?)xml.Element("afterMissionSalvaging") ?? false; UnloadLootAtStation = (bool?)xml.Element("unloadLootAtStation") ?? false; AgentName = (string)xml.Element("agentName"); bookmarkWarpOut = (string)xml.Element("bookmarkWarpOut"); var missionsPath = (string)xml.Element("missionsPath"); MissionsPath = !string.IsNullOrEmpty(missionsPath) ? Path.Combine(path, missionsPath) : Path.Combine(path, "Missions"); MaximumHighValueTargets = (int?)xml.Element("maximumHighValueTargets") ?? 2; MaximumLowValueTargets = (int?)xml.Element("maximumLowValueTargets") ?? 2; Ammo.Clear(); var ammoTypes = xml.Element("ammoTypes"); if (ammoTypes != null) { foreach (var ammo in ammoTypes.Elements("ammoType")) { Ammo.Add(new Ammo(ammo)); } } MinimumAmmoCharges = (int?)xml.Element("minimumAmmoCharges") ?? 0; FactionFitting.Clear(); var factionFittings = xml.Element("factionfittings"); if (factionFittings != null) { foreach (var factionfitting in factionFittings.Elements("factionfitting")) { FactionFitting.Add(new FactionFitting(factionfitting)); } if (FactionFitting.Exists(m => m.Faction.ToLower() == "default")) { DefaultFitting = FactionFitting.Find(m => m.Faction.ToLower() == "default"); if (!(DefaultFitting.Fitting == "") && !(DefaultFitting.Fitting == null)) { FittingsDefined = true; } else { Logging.Log("Settings: Error! No default fitting specified or fitting is incorrect. Fitting manager will not be used."); } } else { Logging.Log("Settings: Error! No default fitting specified or fitting is incorrect. Fitting manager will not be used."); } } else { Logging.Log("Settings: No faction fittings specified. Fitting manager will not be used."); } MissionFitting.Clear(); var missionFittings = xml.Element("missionfittings"); if (missionFittings != null) { foreach (var missionfitting in missionFittings.Elements("missionfitting")) { MissionFitting.Add(new MissionFitting(missionfitting)); } } WeaponGroupId = (int?)xml.Element("weaponGroupId") ?? 0; ReserveCargoCapacity = (int?)xml.Element("reserveCargoCapacity") ?? 0; MaximumWreckTargets = (int?)xml.Element("maximumWreckTargets") ?? 0; SpeedTank = (bool?)xml.Element("speedTank") ?? false; OrbitDistance = (int?)xml.Element("orbitDistance") ?? 0; NosDistance = (int?)xml.Element("NosDistance") ?? 38000; MinimumPropulsionModuleDistance = (int?)xml.Element("minimumPropulsionModuleDistance") ?? 5000; MinimumPropulsionModuleCapacitor = (int?)xml.Element("minimumPropulsionModuleCapacitor") ?? 0; ActivateRepairModules = (int?)xml.Element("activateRepairModules") ?? 65; DeactivateRepairModules = (int?)xml.Element("deactivateRepairModules") ?? 95; MinimumShieldPct = (int?)xml.Element("minimumShieldPct") ?? 100; MinimumArmorPct = (int?)xml.Element("minimumArmorPct") ?? 100; MinimumCapacitorPct = (int?)xml.Element("minimumCapacitorPct") ?? 50; SafeShieldPct = (int?)xml.Element("safeShieldPct") ?? 0; SafeArmorPct = (int?)xml.Element("safeArmorPct") ?? 0; SafeCapacitorPct = (int?)xml.Element("safeCapacitorPct") ?? 0; LootEverything = (bool?)xml.Element("lootEverything") ?? true; UseDrones = (bool?)xml.Element("useDrones") ?? true; DroneTypeId = (int?)xml.Element("droneTypeId") ?? 0; DroneControlRange = (int?)xml.Element("droneControlRange") ?? 0; DroneMinimumShieldPct = (int?)xml.Element("droneMinimumShieldPct") ?? 50; DroneMinimumArmorPct = (int?)xml.Element("droneMinimumArmorPct") ?? 50; DroneMinimumCapacitorPct = (int?)xml.Element("droneMinimumCapacitorPct") ?? 0; DroneRecallShieldPct = (int?)xml.Element("droneRecallShieldPct") ?? 0; DroneRecallArmorPct = (int?)xml.Element("droneRecallArmorPct") ?? 0; DroneRecallCapacitorPct = (int?)xml.Element("droneRecallCapacitorPct") ?? 0; LongRangeDroneRecallShieldPct = (int?)xml.Element("longRangeDroneRecallShieldPct") ?? 0; LongRangeDroneRecallArmorPct = (int?)xml.Element("longRangeDroneRecallArmorPct") ?? 0; LongRangeDroneRecallCapacitorPct = (int?)xml.Element("longRangeDroneRecallCapacitorPct") ?? 0; Blacklist.Clear(); var blacklist = xml.Element("blacklist"); if (blacklist != null) { foreach (var mission in blacklist.Elements("mission")) { Blacklist.Add((string)mission); } } FactionBlacklist.Clear(); var factionblacklist = xml.Element("factionblacklist"); if (factionblacklist != null) { foreach (var faction in factionblacklist.Elements("faction")) { FactionBlacklist.Add((string)faction); } } if (SettingsLoaded != null) { SettingsLoaded(this, new EventArgs()); } }
public async Task BlacklistAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { string m = "```Blacklisted Users:\n"; foreach (KeyValuePair <ulong, string> i in Blacklist.ToList()) { try { if ((m + Context.Client.GetUser(i.Key).Username + " (" + i.Key + ") - " + i.Value + "\n```").Length < 2000) { m += Context.Client.GetUser(i.Key).Username + " (" + i.Key + ")"; if (i.Value != "") { m += " - " + i.Value; } m += "\n"; } else { m += "```"; await Context.Message.Author.SendMessageAsync(m); m = "```" + Context.Client.GetUser(i.Key).Username + " (" + i.Key + ")"; if (i.Value != "") { m += " - " + i.Value; } m += "\n"; } } catch { if (("User Not Found (" + i.Key + ") - " + i.Value + "\n```").Length < 2000) { m += "User Not Found (" + i.Key + ")"; if (i.Value != "") { m += " - " + i.Value; } m += "\n"; } else { m += "```"; await Context.Message.Author.SendMessageAsync(m); m = "```User Not Found (" + i.Key + ")"; if (i.Value != "") { m += " - " + i.Value; } m += "\n"; } } } m += "```"; await Context.Message.Author.SendMessageAsync(m); m = "```Greylisted Users:\n"; foreach (ulong i in RainBorg.Greylist) { try { if ((m + Context.Client.GetUser(i).Username + " (" + i + ")\n```").Length < 2000) { m += Context.Client.GetUser(i).Username + " (" + i + ")\n"; } else { m += "```"; await Context.Message.Author.SendMessageAsync(m); m = "```" + Context.Client.GetUser(i).Username + " (" + i + ")\n"; } } catch { if (("User Not Found (" + i + ")\n```").Length < 2000) { m += "User Not Found (" + i + ")\n"; } else { m += "```"; await Context.Message.Author.SendMessageAsync(m); m = "```User Not Found (" + i + ")\n"; } } } m += "```"; await Context.Message.Author.SendMessageAsync(m); } }
public void LoadSettings() { var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var settingsPath = Path.Combine(path, Cache.Instance.FilterPath(_characterName) + ".xml"); var reloadSettings = _characterName != Cache.Instance.DirectEve.Me.Name; if (File.Exists(settingsPath)) { reloadSettings = _lastModifiedDate != File.GetLastWriteTime(settingsPath); } if (!reloadSettings) { return; } _characterName = Cache.Instance.DirectEve.Me.Name; _lastModifiedDate = File.GetLastWriteTime(settingsPath); if (!File.Exists(settingsPath)) { // Clear settings AgentName = string.Empty; AutoStart = false; RandomDelay = 0; WindowXPosition = null; WindowYPosition = null; LootHangar = string.Empty; AmmoHangar = string.Empty; MissionsPath = Path.Combine(path, "Missions"); MaximumHighValueTargets = 0; MaximumLowValueTargets = 0; Ammo.Clear(); MinimumAmmoCharges = 0; WeaponGroupId = 0; ReserveCargoCapacity = 0; MaximumWreckTargets = 0; SpeedTank = false; OrbitDistance = 0; ActivateRepairModules = 0; DeactivateRepairModules = 0; MinimumShieldPct = 0; MinimumArmorPct = 0; MinimumCapacitorPct = 0; SafeShieldPct = 0; SafeArmorPct = 0; SafeCapacitorPct = 0; UseDrones = false; DroneTypeId = 0; DroneControlRange = 0; DroneMinimumShieldPct = 0; DroneMinimumArmorPct = 0; DroneMinimumCapacitorPct = 0; DroneRecallCapacitorPct = 0; LongRangeDroneRecallCapacitorPct = 0; Blacklist.Clear(); return; } var xml = XDocument.Load(settingsPath).Root; DebugStates = (bool?)xml.Element("debugStates") ?? false; DebugPerformance = (bool?)xml.Element("debugPerformance") ?? false; AutoStart = (bool?)xml.Element("autoStart") ?? false; RandomDelay = (int?)xml.Element("randomDelay") ?? 0; EnableStorylines = (bool?)xml.Element("enableStorylines") ?? false; WindowXPosition = (int?)xml.Element("windowXPosition"); WindowYPosition = (int?)xml.Element("windowYPosition"); CombatShipName = (string)xml.Element("combatShipName"); SalvageShipName = (string)xml.Element("salvageShipName"); LootHangar = (string)xml.Element("lootHangar"); AmmoHangar = (string)xml.Element("ammoHangar"); CreateSalvageBookmarks = (bool?)xml.Element("createSalvageBookmarks") ?? false; BookmarkPrefix = (string)xml.Element("bookmarkPrefix") ?? "Salvage:"; MinimumWreckCount = (int?)xml.Element("minimumWreckCount") ?? 1; AfterMissionSalvaging = (bool?)xml.Element("afterMissionSalvaging") ?? false; UnloadLootAtStation = (bool?)xml.Element("unloadLootAtStation") ?? false; AgentName = (string)xml.Element("agentName"); var missionsPath = (string)xml.Element("missionsPath"); MissionsPath = !string.IsNullOrEmpty(missionsPath) ? Path.Combine(path, missionsPath) : Path.Combine(path, "Missions"); MaximumHighValueTargets = (int?)xml.Element("maximumHighValueTargets") ?? 2; MaximumLowValueTargets = (int?)xml.Element("maximumLowValueTargets") ?? 2; Ammo.Clear(); var ammoTypes = xml.Element("ammoTypes"); if (ammoTypes != null) { foreach (var ammo in ammoTypes.Elements("ammoType")) { Ammo.Add(new Ammo(ammo)); } } MinimumAmmoCharges = (int?)xml.Element("minimumAmmoCharges") ?? 0; WeaponGroupId = (int?)xml.Element("weaponGroupId") ?? 0; ReserveCargoCapacity = (int?)xml.Element("reserveCargoCapacity") ?? 0; MaximumWreckTargets = (int?)xml.Element("maximumWreckTargets") ?? 0; SpeedTank = (bool?)xml.Element("speedTank") ?? false; OrbitDistance = (int?)xml.Element("orbitDistance") ?? 0; ActivateRepairModules = (int?)xml.Element("activateRepairModules") ?? 65; DeactivateRepairModules = (int?)xml.Element("deactivateRepairModules") ?? 95; MinimumShieldPct = (int?)xml.Element("minimumShieldPct") ?? 100; MinimumArmorPct = (int?)xml.Element("minimumArmorPct") ?? 100; MinimumCapacitorPct = (int?)xml.Element("minimumCapacitorPct") ?? 50; SafeShieldPct = (int?)xml.Element("safeShieldPct") ?? 0; SafeArmorPct = (int?)xml.Element("safeArmorPct") ?? 0; SafeCapacitorPct = (int?)xml.Element("safeCapacitorPct") ?? 0; LootEverything = (bool?)xml.Element("lootEverything") ?? true; UseDrones = (bool?)xml.Element("useDrones") ?? true; DroneTypeId = (int?)xml.Element("droneTypeId") ?? 0; DroneControlRange = (int?)xml.Element("droneControlRange") ?? 0; DroneMinimumShieldPct = (int?)xml.Element("droneMinimumShieldPct") ?? 50; DroneMinimumArmorPct = (int?)xml.Element("droneMinimumArmorPct") ?? 50; DroneMinimumCapacitorPct = (int?)xml.Element("droneMinimumCapacitorPct") ?? 0; DroneRecallShieldPct = (int?)xml.Element("droneRecallShieldPct") ?? 0; DroneRecallArmorPct = (int?)xml.Element("droneRecallArmorPct") ?? 0; DroneRecallCapacitorPct = (int?)xml.Element("droneRecallCapacitorPct") ?? 0; LongRangeDroneRecallShieldPct = (int?)xml.Element("longRangeDroneRecallShieldPct") ?? 0; LongRangeDroneRecallArmorPct = (int?)xml.Element("longRangeDroneRecallArmorPct") ?? 0; LongRangeDroneRecallCapacitorPct = (int?)xml.Element("longRangeDroneRecallCapacitorPct") ?? 0; Blacklist.Clear(); var blacklist = xml.Element("blacklist"); if (blacklist != null) { foreach (var mission in blacklist.Elements("mission")) { Blacklist.Add((string)mission); } } if (SettingsLoaded != null) { SettingsLoaded(this, new EventArgs()); } }
protected override async Task <bool> Main() { if (interactTimeout.Elapsed.TotalSeconds > Timeout) { Logger.Error(Localization.Localization.ExTurnInGuildLeve_TurninTimeout); isDone = true; return(true); } if (!checkedTransport) { checkedTransport = true; StatusText = Localization.Localization.ExTurnInGuildLeve_CheckTransport; var selectYesnoCountWindow = new SelectYesnoCount(); if (await selectYesnoCountWindow.Refresh(2000)) { StatusText = Localization.Localization.ExTurnInGuildLeve_SelectTransport; if (AcceptTransport) { selectYesnoCountWindow.Yes(); await Coroutine.Wait(5000, () => CommonBehaviors.IsLoading); await Coroutine.Wait(System.Threading.Timeout.Infinite, () => !CommonBehaviors.IsLoading); } else { await selectYesnoCountWindow.CloseInstance(); } return(true); } } // Movement if (ExProfileBehavior.Me.Distance(Location) > 3.5) { StatusText = Localization.Localization.ExTurnInGuildLeve_Move + NpcId; await Location.MoveTo(radius : 3.4f, name : " NpcId: " + NpcId); return(true); } if (!interactTimeout.IsRunning) { interactTimeout.Restart(); } // Interact if (Core.Target == null && ExProfileBehavior.Me.Distance(Location) <= 3.5) { return(await InteractWithNpc()); } if (Talk.DialogOpen) { await HandleTalk(); } if (SelectIconString.IsOpen) { if (iconStringIndex == 9001) { iconStringIndex = (uint)SelectIconString.Lines().Count - 1; } // We will just click the last quest and decrement until we have either no quests left or none to turn in. SelectIconString.ClickSlot(--iconStringIndex); await Coroutine.Sleep(500); if (iconStringIndex == uint.MaxValue) { Logger.Warn(Localization.Localization.ExTurnInGuildLeve_NothingToTurnin); isDone = true; return(true); } return(true); } if (SelectString.IsOpen) { var lines = SelectString.Lines(); // If Collect Reward exists, we click that; otherwise we will click Close. (-1 as uint = uint.MaxValue) var index = (uint)lines.IndexOf(CollectRewardText, StringComparer.InvariantCultureIgnoreCase); if (index != uint.MaxValue) { Logger.Info(Localization.Localization.ExTurnInGuildLeve_CollectReward, WorldManager.EorzaTime); SelectString.ClickSlot(index); await Coroutine.Yield(); return(true); } // If yes is an option, click it to turn in more items.(crafting) index = (uint)lines.IndexOf(YesText, StringComparer.InvariantCultureIgnoreCase); if (index != uint.MaxValue) { Logger.Info(Localization.Localization.ExTurnInGuildLeve_TurninMore, WorldManager.EorzaTime); SelectString.ClickSlot(index); await Coroutine.Yield(); return(true); } Logger.Warn(Localization.Localization.ExTurnInGuildLeve_NoRewardsLeft); isDone = true; SelectString.ClickSlot(index); await Coroutine.Yield(); return(true); } if (Request.IsOpen) { var itemCount = Memory.Request.ItemsToTurnIn.Length; var itemId = Memory.Request.ItemId1; IEnumerable <BagSlot> itemSlots = InventoryManager.FilledInventoryAndArmory.Where( bs => bs.RawItemId == itemId && !Blacklist.Contains((uint)bs.Pointer.ToInt32(), BlacklistFlags.Loot)).ToArray(); if (HqOnly) { itemSlots = itemSlots.Where(bs => bs.IsHighQuality); } if (NqOnly) { itemSlots = itemSlots.Where(bs => !bs.IsHighQuality); } var items = itemSlots.Take(itemCount).ToArray(); if (items.Length == 0) { Logger.Warn(Localization.Localization.ExTurnInGuildLeve_NoItemToTurnin, HqOnly, NqOnly, itemId); isDone = true; return(true); } StatusText = Localization.Localization.ExTurnInGuildLeve_TurnIn; var isHq = items.Any(i => i.IsHighQuality); var itemName = items[0].EnglishName; var requestAttempts = 0; while (Request.IsOpen && requestAttempts++ < 5 && Behaviors.ShouldContinue) { foreach (var item in items) { item.Handover(); await Coroutine.Yield(); } await Coroutine.Wait(1000, () => Request.HandOverButtonClickable); if (Request.HandOverButtonClickable) { Request.HandOver(); if (isHq) { await Coroutine.Wait(2000, () => !Request.IsOpen && SelectYesno.IsOpen); } else { await Coroutine.Wait(2000, () => !Request.IsOpen); } } } turnedItemsIn = true; if (SelectYesno.IsOpen) { SelectYesno.ClickYes(); await Coroutine.Yield(); Logger.Info(Localization.Localization.ExTurnInGuildLeve_TurnInHq, itemName, WorldManager.EorzaTime); } else { Logger.Info(Localization.Localization.ExTurnInGuildLeve_TurnInNq, itemName, WorldManager.EorzaTime); } await HandleTalk(); await Coroutine.Wait(2000, () => JournalResult.IsOpen); return(true); } if (JournalResult.IsOpen) { await Coroutine.Wait(2000, () => JournalResult.ButtonClickable); JournalResult.Complete(); Logger.Info(Localization.Localization.ExTurnInGuildLeve_Complete, WorldManager.EorzaTime); await Coroutine.Wait(2000, () => !JournalResult.IsOpen); await HandleTalk(); return(true); } if (!await WaitForOpenWindow()) { if (MultipleQuests) { Logger.Info(Localization.Localization.ExTurnInGuildLeve_OpenWindow); CloseWindows(); ExProfileBehavior.Me.ClearTarget(); } else { isDone = true; } } return(true); }
/// <summary> /// This behavior SHOULD be called at top of the combat behavior. This behavior won't let the rest of the combat behavior to be called /// if you don't have a target. Also it will find a proper target, if the current target is dead or you don't have a target and still in combat. /// Tank targeting is also dealed in this behavior. /// </summary> /// <returns></returns> public static Composite EnsureTarget() { return (new Decorator( ret => !SingularSettings.DisableAllTargeting, new PrioritySelector( #region Switch from Current Target if a more important one exists! new PrioritySelector( #region Validate our CurrentTarget - ctx set to null if we need a new one, non-null if ok! ctx => { #region Tank Targeting // Handle tank targeting - only if in Combat, otherwise we'll choose based upon Targeting list if (TankManager.NeedTankTargeting && !SingularSettings.Instance.DisableTankTargetSwitching && Group.MeIsTank && StyxWoW.Me.Combat && TankManager.Instance.FirstUnit != null) { if (Me.CurrentTarget != TankManager.Instance.FirstUnit) { if (TankManager.TargetingTimer.IsFinished) { Logger.Write(targetColor, "TankTarget: switching to first unit of TankTargeting"); return TankManager.Instance.FirstUnit; } if (!Unit.ValidUnit(Me.CurrentTarget, showReason: false)) { Logger.Write(targetColor, "TankTarget: CurrentTarget invalid, switching to first unit of TankTargeting"); return TankManager.Instance.FirstUnit; } } return Me.CurrentTarget; // pass our currenttarget to skip setting or switching } #endregion #region WORLD_PVP_FIRST_AND_FOREMOST if (SingularRoutine.CurrentWoWContext == WoWContext.Normal && SingularSettings.Instance.TargetWorldPvpRegardless) { // if on an enemy player, stay there if (Me.GotTarget() && Me.CurrentTarget.IsPlayer && Unit.ValidUnit(Me.CurrentTarget)) { return Me.CurrentTarget; } // if attacked in last 15 seconds, go after them if (EventHandlers.TimeSinceAttackedByEnemyPlayer.TotalSeconds < 15) { WoWUnit ganker = EventHandlers.AttackingEnemyPlayer; if (Unit.ValidUnit(ganker)) { if (!Me.GotTarget() || !Me.CurrentTarget.IsPlayer || !Unit.ValidUnit(Me.CurrentTarget)) { if (ganker != Me.CurrentTarget) { Logger.Write(targetColor, "Switching to Ganker: " + ganker.SafeName() + " who attacked us first!"); Logger.WriteDebug("Setting BotPoi to Kill {0}", ganker.SafeName()); BotPoi.Current = new BotPoi(ganker, PoiType.Kill); } return ganker; } } } } #endregion #region TOTEM KILLER if (SingularRoutine.CurrentWoWContext == WoWContext.Normal && SingularSettings.Instance.TargetCurrentTargetTotems) { if (Me.GotTarget() && !Me.CurrentTarget.IsPlayer && Unit.ValidUnit(Me.CurrentTarget)) { if (Me.CurrentTarget.IsTotem) { if (Me.CurrentTarget.SummonedByUnit != null && !Me.CurrentTarget.SummonedByUnit.IsPlayer) { return Me.CurrentTarget; } } else if ((DateTime.UtcNow - timePrevTotem).TotalSeconds > 15) { float range = Me.IsMelee() ? 15 : 39; WoWUnit totem = ObjectManager.GetObjectsOfType <WoWUnit>(false, false) .FirstOrDefault(t => t.IsTotem && guidPrevTotem != t.Guid && t.SummonedByUnitGuid == Me.CurrentTargetGuid && Unit.ValidUnit(t) && t.SpellDistance() < range); if (totem != null) { guidPrevTotem = totem.Guid; timePrevTotem = DateTime.UtcNow; Logger.Write(targetColor, "Switching to Totem: {0} set by {1}", totem.Name, totem.SummonedUnit.SafeName()); return totem; } } } } #endregion #if ALWAYS_SWITCH_TO_BOTPOI WoWUnit unit; // Check botpoi (our top priority.) we switch to BotPoi if a kill type exists and not blacklisted // .. if blacklisted, clear the poi to give bot a chance to do something smarter // .. if we are already fighting it, we keep fighting it, end of story if (BotPoi.Current.Type == PoiType.Kill) { if (BotPoi.Current.AsObject == null) { Logger.Write(targetColor, "BotPOI is (null) --- clearing"); BotPoi.Clear(string.Format("Singular: (null) object was target (possibly another components error)")); } else { unit = BotPoi.Current.AsObject.ToUnit(); if (unit != null && !unit.IsAlive) { Logger.WriteDiagnostic(targetColor, "BotPOI " + unit.SafeName() + " is dead --- clearing"); BotPoi.Clear(string.Format("Singular: {0} is dead", unit.SafeName())); } else if (!Unit.ValidUnit(unit, showReason: true)) { Logger.Write(targetColor, "BotPOI " + unit.SafeName() + " not valid --- clearing"); BotPoi.Clear(string.Format("Singular: {0} invalid target", unit.SafeName())); } else { if (StyxWoW.Me.CurrentTargetGuid != unit.Guid) { Logger.Write(targetColor, "Switching to BotPoi: " + unit.SafeName() + "!"); } return unit; } } } #endif // Go below if current target is null or dead. We have other checks to deal with that if (!StyxWoW.Me.GotTarget() || StyxWoW.Me.CurrentTarget.IsDead) { return null; } // target not aggroed yet or out of range? check for adds in melee pounding us if (!Me.IsInGroup() && Me.Combat && ((!StyxWoW.Me.CurrentTarget.Combat && !StyxWoW.Me.CurrentTarget.Aggro && !StyxWoW.Me.CurrentTarget.PetAggro) || StyxWoW.Me.SpellDistance() > 30 || !StyxWoW.Me.CurrentTarget.InLineOfSpellSight)) { // Look for agrroed mobs next. prioritize by IsPlayer, Relative Distance, then Health var target = ObjectManager.GetObjectsOfType <WoWUnit>(false, false) .Where( p => p.SpellDistance() < 10 && Unit.ValidUnit(p) && (p.Aggro || p.PetAggro) && p.InLineOfSpellSight ) // .OrderBy(u => CalcDistancePriority(u)).ThenBy(u => u.HealthPercent) .OrderBy(u => u.HealthPercent) .FirstOrDefault(); if (target != null && target.Guid != Me.CurrentTargetGuid) { // Return the closest one to us Logger.Write(targetColor, "Switching to aggroed mob pounding on me " + target.SafeName() + "!"); return target; } } // check if current target is owned by a player WoWUnit pOwner = Unit.GetPlayerParent(Me.CurrentTarget); if (pOwner != null) { if (!Me.CurrentTarget.CanWeAttack()) { Logger.Write(targetColor, "CurrentTarget " + Me.CurrentTarget.SafeName() + " is a non-attackable enemy player pet so clearing target!"); Blacklist.Add(Me.CurrentTargetGuid, BlacklistFlags.Pull | BlacklistFlags.Combat, TimeSpan.FromSeconds(60), "Unattackable Enemy Player Pet is CurrentTarget"); Me.ClearTarget(); return null; } else if (Unit.ValidUnit(pOwner) && !Blacklist.Contains(pOwner, BlacklistFlags.Combat)) { Logger.Write(targetColor, "Current target owned by a player. Switching to " + pOwner.SafeName() + "!"); if (BotPoi.Current.Type == PoiType.Kill && BotPoi.Current.Guid == Me.CurrentTarget.Guid) { BotPoi.Clear(string.Format("Singular detected {0} as Player Owned Pet", Me.CurrentTarget.SafeName())); } return pOwner; } } // no valid BotPoi, so let's check Targeting.FirstUnit which is Bots #1 choice #if IGNORE_TARGETING_UNLESS_SEARCHING_FOR_NEW_TARGET #elif BOT_FIRSTUNIT_GETS_PRIORITY unit = Targeting.Instance.FirstUnit; if (unit != null && unit.IsAlive) { if (Blacklist.Contains(unit.Guid, BlacklistFlags.Combat)) { Logger.Write(targetColor, "Targeting.FirstUnit " + unit.SafeName() + " is blacklisted!"); if (unit == Me.CurrentTarget && (Me.CurrentTarget.Combat && Me.CurrentTarget.IsTargetingMeOrPet)) { return unit; } return null; } if (StyxWoW.Me.CurrentTarget != unit) { Logger.Write(targetColor, "Current target is not Bots first choice. Switching to " + unit.SafeName() + "!"); } return unit; } #else foreach (var unit in Targeting.Instance.TargetList) { if (StyxWoW.Me.CurrentTargetGuid != unit.Guid && unit.IsAlive && !Blacklist.Contains(unit.Guid, BlacklistFlags.Combat)) { Logger.Write(targetColor, "Bot has a higher priority target available. Switching to " + unit.SafeName() + "!"); return unit; } } #endif // at this point, just check its okay to kill currenttarget if (Blacklist.Contains(StyxWoW.Me.CurrentTargetGuid, BlacklistFlags.Combat)) { Logger.Write(targetColor, "CurrentTarget " + Me.CurrentTarget.SafeName() + " blacklisted and not in combat with so clearing target!"); Me.ClearTarget(); return null; } // valid unit? keep it then if (Unit.ValidUnit(Me.CurrentTarget, showReason: true)) { return Me.CurrentTarget; } if (Me.CurrentTarget.IsPlayer && !Battlegrounds.IsInsideBattleground && Me.CurrentTarget.IsHostile && !Me.CurrentTarget.CanWeAttack()) { Logger.Write(targetColor, "CurrentTarget " + Me.CurrentTarget.SafeName() + " is a non-attackable enemy player so clearing target!"); Blacklist.Add(Me.CurrentTargetGuid, BlacklistFlags.Pull | BlacklistFlags.Combat, TimeSpan.FromSeconds(15), "Unattackable Enemy Player is CurrentTarget"); Me.ClearTarget(); } // otherwise, let's get a new one Logger.WriteDebug(targetColor, "EnsureTarget: invalid target {0}, so forcing selection of a new one...", !Me.GotTarget() ? "(null)" : Me.CurrentTarget.SafeName()); return null; }, #endregion #region Target was selected -- change target if needed, or do nothing if already current target new Decorator( ret => ret != null, new Sequence( CreateClearPendingCursorSpell(RunStatus.Success), new Decorator( req => ((WoWUnit)req).Guid != StyxWoW.Me.CurrentTargetGuid, new Sequence( new Action(ret => { if (SingularSettings.Debug) { Logger.WriteDebug(targetColor, "EnsureTarget: switching to target {0}", ((WoWUnit)ret).SafeName()); } }), new Action(ret => ((WoWUnit)ret).Target()), new WaitContinue(2, ret => StyxWoW.Me.GotTarget() && StyxWoW.Me.CurrentTarget == (WoWUnit)ret, new ActionAlwaysSucceed()), new Action(ret => TankManager.TargetingTimer.Reset()) // cheaper to just reset than to check if we need Tank Targeting ) ), // fall through to spell priority at this point as we have our target and its valid new ActionAlwaysFail() ) ), #endregion #endregion #region Target Invalid (none or dead) - Find a New one if possible new Decorator( ret => ret == null, new PrioritySelector( ctx => { // If we have a RaF leader, then use its target. var rafLeader = RaFHelper.Leader; if (rafLeader != null && rafLeader.IsValid && !rafLeader.IsMe && rafLeader.Combat && rafLeader.GotTarget() && rafLeader.CurrentTarget.IsAlive && !Blacklist.Contains(rafLeader.CurrentTarget, BlacklistFlags.Combat)) { Logger.Write(targetColor, "Current target invalid. Switching to Tanks target " + rafLeader.CurrentTarget.SafeName() + "!"); return rafLeader.CurrentTarget; } /* * // if we have BotPoi then try it * if (SingularRoutine.CurrentWoWContext != WoWContext.Normal && BotPoi.Current.Type == PoiType.Kill) * { * var unit = BotPoi.Current.AsObject as WoWUnit; * if (unit == null) * { * Logger.Write(targetColor, "Current Kill POI invalid. Clearing POI!"); * BotPoi.Clear("Singular detected null POI"); * } * else if (!unit.IsAlive) * { * Logger.Write(targetColor, "Current Kill POI dead. Clearing POI " + unit.SafeName() + "!"); * BotPoi.Clear("Singular detected Unit is dead"); * } * else if (Blacklist.Contains(unit, BlacklistFlags.Combat)) * { * Logger.Write(targetColor, "Current Kill POI is blacklisted. Clearing POI " + unit.SafeName() + "!"); * BotPoi.Clear("Singular detected Unit is Blacklisted"); * } * else * { * Logger.Write(targetColor, "Current target invalid. Switching to POI " + unit.SafeName() + "!"); * return unit; * } * } */ // Look for agrroed mobs next. prioritize by IsPlayer, Relative Distance, then Health var target = Targeting.Instance.TargetList .Where( p => !Blacklist.Contains(p, BlacklistFlags.Combat) && Unit.ValidUnit(p) // && p.DistanceSqr <= 40 * 40 // dont restrict check to 40 yds && (p.Aggro || p.PetAggro || (p.Combat && p.GotTarget() && (p.IsTargetingMeOrPet || p.IsTargetingMyRaidMember)))) .OrderBy(u => u.IsPlayer) .ThenBy(u => CalcDistancePriority(u)) .ThenBy(u => u.HealthPercent) .FirstOrDefault(); if (target != null) { // Return the closest one to us Logger.Write(targetColor, "Current target invalid. Switching to aggroed mob " + target.SafeName() + "!"); return target; } /* * // if we have BotPoi then try it * if (SingularRoutine.CurrentWoWContext == WoWContext.Normal && BotPoi.Current.Type == PoiType.Kill) * { * var unit = BotPoi.Current.AsObject as WoWUnit; * if (unit == null) * { * Logger.Write(targetColor, "Current Kill POI invalid. Clearing POI!"); * BotPoi.Clear("Singular detected null POI"); * } * else if (!unit.IsAlive) * { * Logger.Write(targetColor, "Current Kill POI dead. Clearing POI " + unit.SafeName() + "!"); * BotPoi.Clear("Singular detected Unit is dead"); * } * else if (Blacklist.Contains(unit, BlacklistFlags.Combat)) * { * Logger.Write(targetColor, "Current Kill POI is blacklisted. Clearing POI " + unit.SafeName() + "!"); * BotPoi.Clear("Singular detected Unit is Blacklisted"); * } * } */ // now anything in the target list or a Player target = Targeting.Instance.TargetList .Where( p => !Blacklist.Contains(p, BlacklistFlags.Combat) && p.IsAlive // && p.DistanceSqr <= 40 * 40 // don't restrict check to 40 yds ) .OrderBy(u => u.IsPlayer) .ThenBy(u => u.DistanceSqr) .FirstOrDefault(); if (target != null) { // Return the closest one to us Logger.Write(targetColor, "Current target invalid. Switching to TargetList mob " + target.SafeName() + "!"); return target; } /* * // Cache this query, since we'll be using it for 2 checks. No need to re-query it. * var agroMob = * ObjectManager.GetObjectsOfType<WoWUnit>(false, false) * .Where(p => !Blacklist.Contains(p, BlacklistFlags.Combat) && p.IsHostile && !p.IsDead * && !p.Mounted && p.DistanceSqr <= 70 * 70 && p.IsPlayer && p.Combat && (p.IsTargetingMeOrPet || p.IsTargetingMyRaidMember)) * .OrderBy(u => u.DistanceSqr) * .FirstOrDefault(); * * if (agroMob != null) * { * if (!agroMob.IsPet || agroMob.SummonedByUnit == null) * { * Logger.Write(targetColor, "Current target invalid. Switching to player attacking us " + agroMob.SafeName() + "!"); * } * else * { * Logger.Write(targetColor, "Current target invalid. Enemy player pet {0} attacking us, switching to player {1}!", agroMob.SafeName(), agroMob.SummonedByUnit.SafeName()); * agroMob = agroMob.SummonedByUnit; * } * * return agroMob; * } */ // Look for agrroed mobs not in targetlist for some reason next. prioritize by IsPlayer, Relative Distance, then Health target = Unit.UnfriendlyUnits() .Where( p => !Blacklist.Contains(p, BlacklistFlags.Combat) && Unit.ValidUnit(p) // && p.DistanceSqr <= 40 * 40 // dont restrict check to 40 yds && (p.Aggro || p.PetAggro || (p.Combat && p.GotTarget() && (p.IsTargetingMeOrPet || p.IsTargetingMyRaidMember)))) .OrderBy(u => u.IsPlayer) .ThenBy(u => CalcDistancePriority(u)) .ThenBy(u => u.HealthPercent) .FirstOrDefault(); if (target != null) { // Return the closest one to us Logger.Write(targetColor, "Current target invalid. Switching to Unfriendly mob " + target.SafeName() + " attacking us!"); return target; } // And there's nothing left, so just return null, kthx. // ... but show a message about botbase still calling our Combat behavior with nothing to kill if (DateTime.UtcNow >= _timeNextInvalidTargetMessage) { _timeNextInvalidTargetMessage = DateTime.UtcNow + TimeSpan.FromSeconds(5); Logger.Write(targetColor, "Bot TargetList is empty, no targets available"); } return null; }, // Make sure the target is VALID. If not, then ignore this next part. (Resolves some silly issues!) new Decorator( ret => ret != null && ((WoWUnit)ret).Guid != StyxWoW.Me.CurrentTargetGuid, new Sequence( CreateClearPendingCursorSpell(RunStatus.Success), new Action(ret => Logger.WriteDebug(targetColor, "EnsureTarget: set target to chosen target {0}", ((WoWUnit)ret).SafeName())), new Action(ret => ((WoWUnit)ret).Target()), new WaitContinue(2, ret => StyxWoW.Me.GotTarget() && StyxWoW.Me.CurrentTargetGuid == ((WoWUnit)ret).Guid, new ActionAlwaysSucceed()) ) ), // fall through... we'll catch whether we targeted or not in next check new ActionAlwaysFail() ) ) ), #endregion new Decorator( req => !Me.GotTarget() || !Unit.ValidUnit(Me.CurrentTarget), new Action(r => { if (_lastTargetMessageGuid != Me.CurrentTargetGuid || _nextTargetMessageTimer.IsFinished) { Logger.Write(targetColor, "EnsureTarget: no valid target set by " + SingularRoutine.GetBotName() + " -- skipping " + Dynamics.CompositeBuilder.CurrentBehaviorType.ToString() + " spell priority"); _nextTargetMessageTimer.Reset(); } _lastTargetMessageGuid = Me.CurrentTargetGuid; return RunStatus.Success; }) ) ) )); }
public void findAndKillMob() { bool CastSuccess = false; int loothelper = 0; if (Rarekiller.Settings.DeveloperLogs) { Logging.WriteDebug("Rarekiller: Scan for Rare Mob"); } // ----------------- Generate a List with all wanted Rares found in Object Manager --------------------- ObjectManager.Update(); List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(o => ( (Rarekiller.Settings.CATA && ((o.Entry == 50057) || // Blazewing Hyjal (o.Entry == 50053) || // Thartuk the Exile Hyjal (o.Entry == 50050) || // Shok'sharak Vashir (o.Entry == 50005) || // Poseidus Vashir (o.Entry == 50052) || // Burgy Blackheart Vashir (o.Entry == 49913) || // Lady La-La Vashir (o.Entry == 50060) || // Terborus Tiefenheim (o.Entry == 50059) || // Golgarok Tiefenheim (o.Entry == 49822) || // Jadefang Tiefenheim (o.Entry == 50065) || // Armagedillo Uldum (o.Entry == 50064) || // Cyrus the Black Uldum (o.Entry == 50085) || // Overlord Sunderfury Twilight Higlands (o.Entry == 50086))) || // Tarvus the Vile Twilight Higlands (Rarekiller.Settings.Aeonaxx && (((o.Entry == 3868) && Rarekiller.Settings.BloodseekerSearch) // Blood Seeker for Aeonaxx )) || // Aeonaxx hostile || (o.Entry == 51236) (Rarekiller.Settings.Poseidus && ((o.Entry == 50005) || // Poseidus (o.Entry == 9999999))) || // Platzhalter (Rarekiller.Settings.TLPD && ((o.Entry == 32491) || // Timelost Protodrake (o.Entry == 32630))) || // Vyragosa (Rarekiller.Settings.WOTLK && ((o.Entry == 32517) || // Loque'nahak (o.Entry == 32495) || // Hildana Deathstealer (o.Entry == 32358) || // Fumblub Gearwind (o.Entry == 32377) || // Perobas the Bloodthirster (o.Entry == 32398) || // King Ping (o.Entry == 32409) || // Crazed Indu'le Survivor (o.Entry == 32422) || // Grocklar (o.Entry == 32438) || // Syreian the Bonecarver (o.Entry == 32471) || // Griegen (o.Entry == 32481) || // Aotona (o.Entry == 32630) || // Vyragosa (o.Entry == 32487) || // Putridus the Ancient (o.Entry == 32501) || // High Thane Jorfus (o.Entry == 32357) || // Old Crystalbark (o.Entry == 32361) || // Icehorn (o.Entry == 32386) || // Vigdis the War Maiden (o.Entry == 32400) || // Tukemuth (o.Entry == 32417) || // Scarlet Highlord Daion (o.Entry == 32429) || // Seething Hate (o.Entry == 32447) || // Zul'drak Sentinel (o.Entry == 32475) || // Terror Spinner (o.Entry == 32485) || // King Krush (o.Entry == 32500))) || // Dirkee (Rarekiller.Settings.BC && ((o.Entry == 18695) || // Ambassador Jerrikar (o.Entry == 18697) || // Chief Engineer Lorthander (o.Entry == 18694) || // Collidus the Warp-Watcher (o.Entry == 18686) || // Doomslayer Jurim (o.Entry == 18678) || // Fulgorge (o.Entry == 18692) || // Hemathion (o.Entry == 18680) || // Marticar (o.Entry == 18690) || // Morcrush (o.Entry == 18685) || // Okrek (o.Entry == 18683) || // Voidhunter Yar (o.Entry == 18682) || // Bog Lurker (o.Entry == 18681) || // Coilfang Emissary (o.Entry == 18689) || // Crippler (o.Entry == 18698) || // Ever-Core the Punisher (o.Entry == 17144) || // Goretooth (o.Entry == 18696) || // Kraator (o.Entry == 18677) || // Mekthorg the Wild (o.Entry == 20932) || // Nuramoc (o.Entry == 18693) || // Speaker Mar'grom (o.Entry == 18679))) || // Vorakem Doomspeaker ((o.Level < Rarekiller.Settings.Level) && Rarekiller.Settings.LowRAR && (o.CreatureRank == Styx.WoWUnitClassificationType.Rare)) || // every single Rare Mob < Level 61 is hunted (Rarekiller.Settings.HUNTbyID && (o.Entry == Convert.ToInt64(Rarekiller.Settings.MobID))) // Hunt special IDs )) .OrderBy(o => o.Distance).ToList(); foreach (WoWUnit o in objList) { if (!o.Dead && !o.IsPet && !Blacklist.Contains(o.Guid)) { Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller: Find a hunted Mob called {0} ID {1}", o.Name, o.Entry); //if ((o.Entry == 51236) && !Me.IsOnTransport) //{ // Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Find {0} ID {1}, but I don't mounted him", o.Name, o.Entry); // Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); // Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); // return; //} //else if (o.Entry == 51236) // return; if (o.Entry != 51236) { if (o.Level > (Me.Level + 4)) { Logging.Write("Rarekiller: His Level is 5 over mine, better not to kill him."); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } if (o.IsFriendly) { Logging.Write("Rarekiller: Find {0}, but he's friendly", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } if ((o.Entry == 32630) && !Rarekiller.Settings.Vyragosa) { Logging.Write("Rarekiller: Config says: don't kill Vyragosa."); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes."); return; } if ((o.Entry == 50057) && !Rarekiller.Settings.Blazewing) { Logging.Write("Rarekiller: Config says: don't kill Blazewing."); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes."); return; } if ((o.Entry == 596) || (o.Entry == 599)) { // ----------------- Distancecheck because of the Spawn Place is Underground Logging.Write("Rarekiller: Don't run wild because of Instance Mobs."); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } if (((o.Entry == 49822) || (o.Entry == 50086) || (o.Entry == 2744)) && (Me.IsFlying || o.Location.Distance(Me.Location) > 30)) { // ----------------- Distancecheck because of the Spawn Place is Underground Logging.Write("Rarekiller: {0} is more then 20 yd away and Underground", o.Name); Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller: You have to place me next to him, if you want to hunt this Mob."); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes."); return; } if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry))) { Logging.Write("Rarekiller: {0} is Member of the BlacklistedMobs.xml", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 15 Minutes."); return; } if (Rarekiller.Settings.NotKillTameable && o.IsTameable) { return; } if (Rarekiller.inCombat) { Logging.Write("Rarekiller: ... but first I have to finish fighting another one."); return; } if (Me.IsOnTransport) { Logging.Write("Rarekiller: ... but I'm on a Transport."); return; } if ((o.Entry == 3868) && !Rarekiller.Settings.BloodseekerKill) { Rarekiller.Settings.Range = "35"; } // ----------------- Check if hunted Mob is tagged by another Player --------------------- if (Rarekiller.Settings.DontKillTagged) { if (o.TaggedByOther) { WoWMovement.MoveStop(); Logging.Write(System.Drawing.Color.Red, "Rarekiller: {0} is tagged by another player", o.Name); if (Rarekiller.Settings.BlacklistTagged) { Logging.Write("Rarekiller: -- I'm a nice Guy so let him have it"); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist2)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 2 Minutes."); return; } else { Logging.Write("Rarekiller: -- lets take a look who wins :)"); } } while (o.TaggedByOther && !o.Dead) { if (Rarekiller.inCombat) { return; } Thread.Sleep(1000); } if (o.Dead) { Logging.Write("Rarekiller: {0} was killed by another Player", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } } } if (Rarekiller.Settings.Alert) { if (File.Exists(Rarekiller.Settings.SoundfileFoundRare) && (o.Entry != 51236)) { new SoundPlayer(Rarekiller.Settings.SoundfileFoundRare).Play(); } else if (File.Exists(Rarekiller.Soundfile)) { new SoundPlayer(Rarekiller.Soundfile).Play(); } else { Logging.Write(System.Drawing.Color.Red, "Rarekiller: playing Soundfile failes"); } } while (Me.IsCasting) { Thread.Sleep(100); } // ----------------- Move to Mob Part --------------------- if (o.Entry != 51236) { if ((o.Entry == 49822) || (Rarekiller.Settings.GroundMountMode && (!(o.Entry == 50005) || // Poseidus Vashir !(o.Entry == 50052) || // Burgy Blackheart Vashir !(o.Entry == 49913) // Lady La-La Vashir ))) //In Vashir you have to use Flightor ! { ForceGround = true; } else { ForceGround = false; } Logging.Write("Rarekiller Part MoveTo: Move to target"); BlacklistTimer.Reset(); BlacklistTimer.Start(); Place = Me.ZoneId; if (Rarekiller.Settings.GroundMountMode && ((o.Entry == 33687) || (o.Entry == 32630) || (o.Entry == 32491) || (o.Entry == 50057) || (o.Entry == 50005) || (o.Entry == 50052) || (o.Entry == 49913))) { WoWPoint LastLocation = o.Location; while ((o.Location.Distance(Me.Location) > SpellManager.Spells[Rarekiller.Spells.FastPullspell].MaxRange) && !o.TaggedByOther && !o.Dead) { Logging.Write("Rarekiller: Try to hunt flying Mob {0} in Ground Mount Mode, maybe he comes in Range.", o.Name); o.Face(); Thread.Sleep(100); if (o.Location.Distance(Me.Location) > LastLocation.Distance(Me.Location)) { Logging.Write("Rarekiller: {0} is flying away", o.Name); if (!(o.Entry == 50005)) { Blacklist.Add(o.Guid, TimeSpan.FromSeconds(10)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 10 Seconds."); } return; } else { LastLocation = o.Location; } } } else { while (o.Location.Distance(Me.Location) > Convert.ToInt64(Rarekiller.Settings.Range)) { if (Rarekiller.Settings.GroundMountMode || ForceGround) { Navigator.MoveTo(o.Location); } else { Flightor.MoveTo(o.Location); } Thread.Sleep(100); if (BlacklistTimer.Elapsed.TotalSeconds > 20 && FirstTry) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Rarekiller: Can't reach Mob {0} so try to dismount and walk", o.Name); WoWMovement.MoveStop(); Thread.Sleep(1000); //Descend to Land WoWMovement.Move(WoWMovement.MovementDirection.Descend); Thread.Sleep(2000); WoWMovement.MoveStop(); //Walk some Meters to avoid standing on a Tent WoWMovement.Move(WoWMovement.MovementDirection.StrafeLeft); Thread.Sleep(500); WoWMovement.MoveStop(); Thread.Sleep(1000); //Dismount if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } Thread.Sleep(300); ForceGround = true; FirstTry = false; BlacklistTimer.Reset(); BlacklistTimer.Start(); } if (Rarekiller.Settings.BlacklistCheck && !FirstTry && (BlacklistTimer.Elapsed.TotalSeconds > (Convert.ToInt32(Rarekiller.Settings.BlacklistTime)))) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part MoveTo: Can't reach Mob {0}, Blacklist and Move on", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes."); BlacklistTimer.Reset(); WoWMovement.MoveStop(); return; } if (Rarekiller.Settings.ZoneSave && (Me.ZoneId != Place)) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part MoveTo: Left Zone while move to {0} is not allowed", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes."); BlacklistTimer.Reset(); WoWMovement.MoveStop(); return; } } BlacklistTimer.Reset(); WoWMovement.MoveStop(); } // ----------------- another Check if hunted Mob is tagged by another Player --------------------- o.Target(); if (Rarekiller.Settings.DontKillTagged) { if (o.TaggedByOther) { Logging.Write(System.Drawing.Color.Red, "Rarekiller: {0} is tagged by another player", o.Name); if (Rarekiller.Settings.BlacklistTagged) { Logging.Write("Rarekiller: -- I'm a nice Guy so let him have it"); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist2)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 2 Minutes."); return; } else { Logging.Write("Rarekiller: -- lets take a look who wins :)"); } } while (o.TaggedByOther && !o.Dead) { if (Rarekiller.inCombat) { return; } Thread.Sleep(1000); } if (o.Dead) { Logging.Write("Rarekiller: {0} was killed by another Player", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } } if (Rarekiller.Settings.ScreenRarekiller && Rarekiller.Settings.ScreenFound) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(300); Logging.WriteDebug("Rarekiller Part Rarekiller: Take Screenshot before Pull"); } Logging.WriteDebug("Rarekiller: Pull at Mob Location: {0} / {1} / {2}", Convert.ToString(o.X), Convert.ToString(o.Y), Convert.ToString(o.Z)); Logging.WriteDebug("Rarekiller: ... my Location: {0} / {1} / {2}", Convert.ToString(Me.X), Convert.ToString(Me.Y), Convert.ToString(Me.Z)); Logging.Write("Rarekiller: Target is Flying - {0}", o.IsFlying); // move closer again if (Rarekiller.Settings.GroundMountMode && ((o.Entry == 33687) || (o.Entry == 32630) || (o.Entry == 32491) || (o.Entry == 50057) || (o.Entry == 50005) || (o.Entry == 50052) || (o.Entry == 49913))) { o.Face(); } else { while (o.Location.Distance(Me.Location) > Convert.ToInt64(Rarekiller.Settings.Range)) { if (Rarekiller.Settings.GroundMountMode || ForceGround) { Navigator.MoveTo(o.Location); } else { Flightor.MoveTo(o.Location); } Thread.Sleep(100); } } //----------------- Dismount ----------------------- if (Me.IsFlying && !((o.Entry == 33687) || (o.Entry == 32630) || (o.Entry == 32491) || (o.Entry == 50057) || (o.Entry == 50005) || (o.Entry == 50052) || (o.Entry == 49913) || (o.Entry == 29753) || (o.Entry == 3868) || o.IsFlying)) { //Descend to Land WoWMovement.Move(WoWMovement.MovementDirection.Descend); Thread.Sleep(1000); if (Me.IsFlying && !Rarekiller.inCombat) { Thread.Sleep(1000); } WoWMovement.MoveStop(); //Dismount if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } Thread.Sleep(150); } } else { o.Target(); } // ----------------- Pull Part -------------------- ForceGround = false; FirstTry = true; if (!Me.Mounted && ((Me.Class == WoWClass.Hunter) || (Me.Class == WoWClass.Warlock))) { Lua.DoString(string.Format("RunMacroText(\"/petpassive\")"), 0); } if ((o.Entry == 3868) && !Rarekiller.Settings.BloodseekerKill) { while (!o.Dead) { WoWMovement.MoveStop(); o.Target(); o.Face(); Thread.Sleep(1000); } return; } if (!(Rarekiller.Settings.DefaultPull) && SpellManager.HasSpell(Rarekiller.Settings.Pull)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Settings.Pull, o, false); } else if (SpellManager.HasSpell(Rarekiller.Spells.FastPullspell)) { CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.FastPullspell, o, false); } else if ((o.Entry != 32630) && (o.Entry != 32491) && (o.Entry != 33687) && (o.Entry != 50057) && SpellManager.HasSpell(Rarekiller.Spells.LowPullspell)) { if (Me.Auras.ContainsKey("Flight Form") && (o.Entry != 51236)) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted && (o.Entry != 51236)) { Lua.DoString("Dismount()"); } Thread.Sleep(150); WoWMovement.MoveStop(); CastSuccess = RarekillerSpells.CastSafe(Rarekiller.Spells.LowPullspell, o, true); if (o.Entry == 51236) { Lua.DoString("StartAttack()"); } } else { Logging.Write(System.Drawing.Color.Red, "Rarekiller: I have no valid Pullspell - set Range to 3 for next try"); Rarekiller.Settings.Range = "3"; return; } if (CastSuccess) { Logging.Write("Rarekiller: Successfully pulled {0}", o.Name); } else { Logging.Write("Rarekiller: Pull fails - set Range to 3 for next try", o.Name); Rarekiller.Settings.Range = "3"; } if (!Me.Mounted && ((Me.Class == WoWClass.Hunter) || (Me.Class == WoWClass.Warlock))) { Lua.DoString(string.Format("RunMacroText(\"/petdefensive\")"), 0); } Thread.Sleep(100); WoWMovement.MoveStop(); Logging.WriteDebug("Rarekiller: Use Quick Slowfall: {0} Mob: {1}", Me.IsFalling, o.Name); if (Me.IsFalling && Rarekiller.Settings.UseSlowfall && ((o.Entry == 29753) || (o.Entry == 3868) || (o.Entry == 32491) || (o.Entry == 32630) || (o.Entry == 33687))) { Thread.Sleep(200); Rarekiller.Slowfall.HelpFalling(); } if (Me.CurrentTarget != o) { o.Target(); } o.Face(); return; } else if (o.Dead) { if (o.CanLoot) { // ----------------- Loot Helper for all killed Rare Mobs --------------------- Logging.Write("Rarekiller: Found lootable corpse, move to him"); // ----------------- Move to Corpse ------------------- if (Rarekiller.Settings.GroundMountMode && (!(o.Entry == 50005) || // Poseidus Vashir !(o.Entry == 50052) || // Burgy Blackheart Vashir !(o.Entry == 49913) // Lady La-La Vashir )) //In Vashir you have to use Flightor ! { ForceGround = true; } else { ForceGround = false; } Logging.Write("Rarekiller Part MoveTo: Move to target"); while (o.Location.Distance(Me.Location) > 5) { if (Rarekiller.Settings.GroundMountMode || ForceGround) { Navigator.MoveTo(o.Location); } else { Flightor.MoveTo(o.Location); } Thread.Sleep(100); if (Rarekiller.inCombat) { return; } } WoWMovement.MoveStop(); if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } if (Rarekiller.Settings.ScreenRarekiller && Rarekiller.Settings.ScreenSuccess) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(500); Logging.WriteDebug("Rarekiller Part Rarekiller: Take Screenshot successfully killed {0}", o.Name); } while (loothelper < 3) { Thread.Sleep(500); WoWMovement.MoveStop(); o.Interact(); Thread.Sleep(2000); Lua.DoString("RunMacroText(\"/click StaticPopup1Button1\");"); Thread.Sleep(4000); if (!o.CanLoot) { Logging.Write("Rarekiller: successfully looted"); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); return; } else { Logging.Write("Rarekiller: Loot failed, try again"); loothelper = loothelper + 1; } Logging.Write("Rarekiller: Loot failed 3 Times"); } } if (!Blacklist.Contains(o.Guid)) { Logging.Write("Rarekiller: Find {0}, but sadly he's dead", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 60 Minutes."); } } } }
public void findAndTameMob() { if (Rarekiller.Settings.DeveloperLogs) { Logging.WriteDebug("Rarekiller: Scan for Tamer"); } ObjectManager.Update(); List <WoWUnit> objList = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(o => ( ((Rarekiller.Settings.TameDefault && Rarekiller.TameableMobsList.ContainsKey(Convert.ToInt32(o.Entry))) || (Rarekiller.Settings.TameByID && (o.Entry == Convert.ToInt64(Rarekiller.Settings.TameMobID)))) && !o.IsPet && o.IsTameable)) .OrderBy(o => o.Distance).ToList(); foreach (WoWUnit o in objList) { if (!o.Dead && !Blacklist.Contains(o.Guid)) { Logging.Write(System.Drawing.Color.MediumPurple, "Rarekiller Part Tamer: Found a new Pet {0} ID {1}", o.Name, o.Entry); if (Rarekiller.inCombat) { Logging.Write("Rarekiller Part Tamer: ... but I'm in another Combat :( !!!"); return; } if (Me.Level < o.Level) { Logging.Write("Rarekiller Part Tamer: Mob Level is higher then mine, can't tame the Mob."); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist60)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 60 Minutes."); return; } if (Me.IsOnTransport) { Logging.Write("Rarekiller Part Tamer: ... but I'm on a Transport."); return; } while (Me.IsCasting) { Thread.Sleep(100); } if (Rarekiller.BlacklistMobsList.ContainsKey(Convert.ToInt32(o.Entry))) { Logging.Write("Rarekiller Part Tamer: {0} is Member of the BlacklistedMobs.xml", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist15)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 15 Minutes."); return; } //Dismiss Pet SpellManager.Cast("Dismiss Pet"); Thread.Sleep(3000); if (Rarekiller.Settings.Alert) { if (File.Exists(Rarekiller.Settings.SoundfileFoundRare)) { new SoundPlayer(Rarekiller.Settings.SoundfileFoundRare).Play(); } else if (File.Exists(Rarekiller.Soundfile)) { new SoundPlayer(Rarekiller.Soundfile).Play(); } else { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Tamer: playing Soundfile failes"); } } WoWPoint newPoint = WoWMovement.CalculatePointFrom(o.Location, (float)Rarekiller.Settings.Tamedistance); if (o.Entry == 49822) { ForceGround = true; } Logging.Write("Rarekiller Part MoveTo: Move to target"); BlacklistTimer.Reset(); BlacklistTimer.Start(); Place = Me.ZoneId; while (newPoint.Distance(Me.Location) > Rarekiller.Settings.Tamedistance) { if (Rarekiller.Settings.GroundMountMode || ForceGround) { Navigator.MoveTo(newPoint); } else { Flightor.MoveTo(newPoint); } Thread.Sleep(100); if (Rarekiller.inCombat) { return; } if (Rarekiller.Settings.BlacklistCheck && (BlacklistTimer.Elapsed.TotalSeconds > (Convert.ToInt32(Rarekiller.Settings.BlacklistTime)))) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part Tamer: Can't reach Mob {0}, Blacklist and Move on", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); BlacklistTimer.Reset(); WoWMovement.MoveStop(); return; } if (Rarekiller.Settings.ZoneSave && (Me.ZoneId != Place)) { Logging.Write(System.Drawing.Color.Red, "Rarekiller Part MoveTo: Left Zone while move to {0} is not allowed", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller: Blacklist Mob for 5 Minutes."); BlacklistTimer.Reset(); WoWMovement.MoveStop(); return; } } BlacklistTimer.Reset(); Thread.Sleep(300); WoWMovement.MoveStop(); if (Me.Auras.ContainsKey("Flight Form")) { Lua.DoString("CancelShapeshiftForm()"); } else if (Me.Mounted) { Lua.DoString("Dismount()"); } Thread.Sleep(150); o.Target(); if (Rarekiller.Settings.ScreenTamer && Rarekiller.Settings.ScreenFound) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(300); Logging.WriteDebug("Rarekiller Part Tamer: Take Screenshot before tame"); } while (!o.IsPet) { if (o.Dead) { Logging.Write("Rarekiller Part Tamer: Mob was dying, I'm so Sorry !!! "); return; } if (Me.HealthPercent < 10) { Logging.Write("Rarekiller Part Tamer: Health < 10% , Use Feign Death !!! "); SpellManager.Cast("Feign Death"); return; } if (!Me.IsCasting) { WoWMovement.MoveStop(); SpellManager.Cast("Tame Beast"); Logging.Write("Plugin Part The Tamer: Try to tame Beast {0}", o.Name); Thread.Sleep(1500); } } Logging.Write("Rarekiller Part Tamer: Sucessfully tamed Beast {0}", o.Name); if (Rarekiller.Settings.ScreenTamer && Rarekiller.Settings.ScreenSuccess) { Lua.DoString("TakeScreenshot()"); Thread.Sleep(500); Logging.WriteDebug("Rarekiller Part Tamer: Take Screenshot after tame"); } } else if (o.IsPet) { return; } else { Logging.Write("Rarekiller Part Tamer: Find a Mob, but sadly he's dead, blacklistet or not tameable: {0}", o.Name); Blacklist.Add(o.Guid, TimeSpan.FromSeconds(Rarekiller.Settings.Blacklist5)); Logging.Write(System.Drawing.Color.DarkOrange, "Rarekiller Part Tamer: Blacklist Mob for 5 Minutes."); return; } } }
/// <summary> /// Coroutine logic to execute. /// </summary> /// <returns>true if logic was executed to handle this type and false otherwise.</returns> public async Task <bool> Run() { // NOTE: This task's Run function is triggered from "hook_post_combat" Logic, as it's added via a secondary TaskManager! // If this task needs to be disabled due to errors, support doing so. if (_skip) { return(false); } // Don't do anything in these cases. if (LokiPoe.Me.IsDead || LokiPoe.Me.IsInHideout || LokiPoe.Me.IsInTown || LokiPoe.Me.IsInMapRoom) { return(false); } // If we're currently disabled, skip logic. if (!BreachesSettings.Instance.Enabled) { return(false); } var myPos = LokiPoe.MyPosition; var active = BreachDataManager.Active; if (active == null) { return(false); } // Make sure the breach is still valid and not blacklisted if it's set. // We don't re-eval current against settings, because of the performance overhead. if (_current != null) { if (!_current.IsValid || Blacklist.Contains(_current.Id)) { _current = null; } } // Find the next best breach. if (_current == null) { _current = active.Breaches.Where(m => m.IsValid && !Blacklist.Contains(m.Id) && ShouldActivate(m)) .OrderBy(m => m.Position.Distance(myPos)) .FirstOrDefault(); _moveErrors = 0; } // Nothing to do if there's no breach. if (_current == null) { return(false); } // If we can't move to the breach, blacklist it. if (_moveErrors > 5) { Blacklist.Add(_current.Id, TimeSpan.FromHours(1), string.Format("[HandleBreachesTask::Logic] Unable to move to the Breach.")); _current = null; return(true); } // If we are too far away to interact, move towards the object. if (myPos.Distance(_current.WalkablePosition) > 50) { // Make sure nothing is in the way. await Coroutines.CloseBlockingWindows(); // Try to move towards the location. if (!PlayerMoverManager.MoveTowards(_current.WalkablePosition)) { Log.ErrorFormat("[HandleBreachesTask::Logic] PlayerMoverManager.MoveTowards({0}) failed for Breach [{1}].", _current.WalkablePosition, _current.Id); _moveErrors++; return(true); } _moveErrors = 0; return(true); } // Make sure we're not doing anything before we interact. await Coroutines.FinishCurrentAction(); // If the user wants to manually open, or just find them without opening, this task just blocks everything else after it, // rather than stopping the bot, to avoid deaths. if (!BreachesSettings.Instance.Open) { return(true); } // Now process the object, but make sure it exists. var breach = _current.NetworkObject; if (breach == null) { _current.Activate = false; Log.ErrorFormat("[HandleBreachesTask::Logic] The NetworkObject does not exist for the Breach [{0}] yet.", _current.Id); _current = null; return(true); } // Try to move towards the location. if (!PlayerMoverManager.MoveTowards(_current.WalkablePosition)) { Log.ErrorFormat("[HandleBreachesTask::Logic] PlayerMoverManager.MoveTowards({0}) failed for Breach [{1}].", _current.WalkablePosition, _current.Id); _moveErrors++; return(true); } return(true); }
private async Task <bool> ScareSpiders() { // if not in a turret than move to one and interact with it if (!Query.IsInVehicle()) { var mustang = GetMustang(); if (mustang == null) { QBCLog.Warning("No mustang was found nearby"); return(false); } TreeRoot.StatusText = "Moving To Mustang"; if (mustang.DistanceSqr > 5 * 5) { return((await CommonCoroutines.MoveTo(mustang.Location)).IsSuccessful()); } await CommonCoroutines.LandAndDismount(); QBCLog.Info("Interacting with Mustang"); mustang.Interact(); return(true); } // Find the nearest spider and if none exist then move to the spawn location if (!Query.IsViable(_currentTarget) || !_currentTarget.IsAlive) { _currentTarget = ObjectManager.GetObjectsOfType <WoWUnit>() .Where(u => u.IsAlive && u.Entry == 44284 && !Blacklist.Contains(u, BlacklistFlags.Interact)) .OrderBy(u => u.DistanceSqr).FirstOrDefault(); if (_currentTarget == null) { if (!Navigator.AtLocation(_spiderSpawnLocation)) { return((await CommonCoroutines.MoveTo(_spiderSpawnLocation)).IsSuccessful()); } TreeRoot.StatusText = "Waiting for spiders to spawn"; return(true); } _noMoveBlacklistTimer.Reset(); _blacklistTimer.Reset(); QBCLog.Info("Locked on a new target. Distance {0}", _currentTarget.Distance); } TreeRoot.StatusText = "Scaring spider towards lumber mill"; var moveToPoint = WoWMathHelper.CalculatePointFrom(_lumberMillLocation, _currentTarget.Location, -6); if (moveToPoint.DistanceSqr((WoWMovement.ActiveMover ?? StyxWoW.Me).Location) > 4 * 4) { return((await CommonCoroutines.MoveTo(moveToPoint)).IsSuccessful()); } // spider not moving? blacklist and find a new target. if (_noMoveBlacklistTimer.ElapsedMilliseconds > 20000 && _currentTarget.Location.DistanceSqr(_spiderScareLoc) < 10 * 10) { Blacklist.Add(_currentTarget, BlacklistFlags.Interact, TimeSpan.FromMinutes(3), "Spider is not moving"); _currentTarget = null; } else if (_blacklistTimer.IsFinished) { Blacklist.Add(_currentTarget, BlacklistFlags.Interact, TimeSpan.FromMinutes(3), "Took too long"); _currentTarget = null; } else if (!_currentTarget.HasAura("Fear")) { await CommonCoroutines.StopMoving(); Me.SetFacing(_lumberMillLocation); await CommonCoroutines.SleepForLagDuration(); await Coroutine.Sleep(200); if (!_noMoveBlacklistTimer.IsRunning || _currentTarget.Location.DistanceSqr(_spiderScareLoc) >= 10 * 10) { _noMoveBlacklistTimer.Restart(); _spiderScareLoc = _currentTarget.Location; } Lua.DoString("CastSpellByID(83605)"); await Coroutine.Wait(3000, () => Query.IsViable(_currentTarget) && _currentTarget.HasAura("Fear")); } return(true); }
public void Tick() { if (!World.CurrentArea.IsCorruptedArea) { return; } if (!ScanInterval.Elapsed) { return; } var cachedData = CachedData; if (cachedData.IsAreaFinished) { return; } foreach (var obj in LokiPoe.ObjectManager.Objects) { if (obj is Chest c && obj.Metadata == "Metadata/Chests/SideArea/SideAreaChest") { if (c.IsOpened) { GlobalLog.Warn("[CorruptedAreaTask] Vaal Vessel has been opened. Area is finished."); cachedData.IsAreaFinished = true; } else if (cachedData.Vessel == null) { cachedData.Vessel = new CachedObject(obj); GlobalLog.Warn($"[CorruptedAreaTask] Registering {cachedData.Vessel}"); } continue; } if (!cachedData.IsBossKilled && obj is Monster m && m.Rarity == Rarity.Unique && m.ExplicitAffixes.Any(a => a.Category == "MonsterSideAreaBoss")) { if (Blacklist.Contains(obj.Id)) { GlobalLog.Warn("[CorruptedAreaTask] Boss was blacklisted from outside. We will not be able to finish this area."); cachedData.IsAreaFinished = true; continue; } if (m.IsDead) { GlobalLog.Warn("[CorruptedAreaTask] Corrupted area boss has been killed."); cachedData.IsBossKilled = true; continue; } if (cachedData.Boss == null) { cachedData.Boss = new CachedObject(obj); GlobalLog.Warn($"[CorruptedAreaTask] Registering {cachedData.Boss}"); } else { cachedData.Boss.Position = obj.WalkablePosition(); } } } }
private PrioritySelector CreatePullBehavior() { return(new PrioritySelector( new Decorator(ret => DunatanksSettings.Instance.DisableMovement && !Me.GotTarget && !Me.CurrentTarget.IsFriendly && !Me.CurrentTarget.Dead && Me.CurrentTarget.Attackable, new Action(ctx => RunStatus.Success)), // Use leaders target new Decorator( ret => !DunatanksSettings.Instance.DisableMovement && Me.IsInParty && RaFHelper.Leader != null && RaFHelper.Leader.GotTarget && Me.GotTarget && Me.CurrentTargetGuid != RaFHelper.Leader.CurrentTargetGuid, new Action(ret => RaFHelper.Leader.CurrentTarget.Target())), // Clear target and return failure if it's tagged by someone else new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && !Me.IsInParty && Me.GotTarget && Me.CurrentTarget.TaggedByOther, new Action(delegate { SpellManager.StopCasting(); Logging.Write(Color.Orange, "Someone else tagged your target! We are so not going to help him!"); Blacklist.Add(Me.CurrentTarget, TimeSpan.FromMinutes(30)); Me.ClearTarget(); return RunStatus.Failure; }) ), // If we are casting we assume we are already pulling so let it 'return' smoothly. // if we are in combat pull suceeded and the combat behavior should run new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && (Me.IsCasting || Me.Combat) && Me.CurrentTarget.Distance < PullDistance + 3, new Action(delegate { return RunStatus.Success; })), // Make sure we got a proper target new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && !Me.GotTarget && !Me.IsInParty, new Action(delegate { Targeting.Instance.TargetList[0].Target(); WoWMovement.Face(); Thread.Sleep(100); return RunStatus.Success; })), // Blacklist target's we can't move to new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && Navigator.GeneratePath(Me.Location, Me.CurrentTarget.Location).Length <= 0, new Action(delegate { Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365)); Logging.Write(Color.Orange, "Can't move to: {0} blacklisted!", Me.CurrentTarget.Name); return RunStatus.Success; }) ), // Move closer to the target if we are too far away or in !Los new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && Me.GotTarget && (Me.CurrentTarget.Distance > PullDistance || !Me.CurrentTarget.InLineOfSight), new Action(delegate { if (!DunatanksSettings.Instance.DisableMovement) { Logging.Write(Color.Orange, "Approaching:{0}", Me.CurrentTarget); Navigator.MoveTo(Me.CurrentTarget.Location); } })), // Stop moving if we are moving new Decorator(ret => DunatanksSettings.Instance.DisableMovement && Me.IsMoving, new Action(ret => WoWMovement.MoveStop())), // Face the target if we aren't new Decorator(ret => !DunatanksSettings.Instance.DisableMovement && Me.GotTarget && !Me.IsFacing(Me.CurrentTarget), new Action(ret => WoWMovement.Face()) ), new PrioritySelector( new Sequence( //new Action(ret => Logging.Write(Color.Orange, "Engaging {0}", Me.CurrentTarget.Name)), new PrioritySelector( new PrioritySelector( CreateAutoAttack(), MoveToTargetProper(), WritePullDebug(), FaceTarget(ret => !DunatanksSettings.Instance.DisableMovement), ChargePull(), CreateSpellCheckAndCast("Heroic Throw", ret => Me.Level >= 20 && DunatanksSettings.Instance.PullHeroicThrow && !SpellManager.Spells["Heroic Throw"].Cooldown && Me.CurrentTarget.Distance <= 30), CreateSpellCheckAndCast("Intercept", ret => Me.Level >= 50 && DunatanksSettings.Instance.useInterceptApproachPvP && Styx.Logic.Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Distance <= 25), CreateSpellCheckAndCast("Shoot", ret => Me.Inventory.Equipped.Ranged != null && SpellManager.CanCast("Shoot") && !Styx.Logic.Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Distance <= 30 && Me.CurrentTarget.Distance > 15), CreateSpellCheckAndCast("Throw", ret => Me.Inventory.Equipped.Ranged != null && SpellManager.CanCast("Throw") && !Styx.Logic.Battlegrounds.IsInsideBattleground && Me.CurrentTarget.Distance <= 30 && Me.CurrentTarget.Distance > 15)), MoveToTargetProper(), //stopmoving(), CreateAutoAttack() ))))); }
internal void AddToBlackList(GameObject obj, TimeSpan time, string reason) { Blacklist.Add(obj, (BlacklistFlags)_floor, time, reason); Poi.Clear(reason); }
private async Task HandleCommandAsync(SocketMessage s) { var msg = s as SocketUserMessage; var context = new SocketCommandContext(_client, msg); await EventUtils.AssholeChecks(s); await EventUtils.HandleMessages(s); await Blacklist.CheckMessageForBlacklistedTerms(s); await Support.SupportSystem(s); if (msg == null) { Console.WriteLine($"{s} not cared for as it's null (for whatever reason)"); return; } if (context.User.IsBot) { return; } var config = GuildConfig.GetGuildConfig(context.Guild.Id) ?? GuildConfig.CreateGuildConfig(context.Guild.Id); var prefix = config.CommandPrefix ?? Config.bot.Prefix; if (config.EmbedColour1 == 0 && config.EmbedColour2 == 0 && config.EmbedColour3 == 0) { config.EmbedColour1 = 112; config.EmbedColour2 = 0; config.EmbedColour3 = 251; GuildConfig.SaveGuildConfig(); } var argPos = 0; foreach (var command in config.CustomCommands) { if (msg.HasStringPrefix($"{config.CommandPrefix}{command.Key}", ref argPos)) { await context.Channel.SendMessageAsync(command.Value); break; } } if (msg.HasStringPrefix(prefix, ref argPos) || msg.HasMentionPrefix(_client.CurrentUser, ref argPos)) { var result = await _service.ExecuteAsync(context, argPos); //Console.WriteLine($"Command -{msg.Content}- executed"); if (result.IsSuccess == false && result.ErrorReason != "Unknown command.") { string reason; switch (result.ErrorReason) { case "The server responded with error 403: Forbidden": reason = "I'm not allowed to do that. Either I don't have permission or the requested user is higher than me in the role heirarchy."; break; case "Sequence contains no elements": try { reason = $"{msg.MentionedUsers.FirstOrDefault().Mention} doesn't have any."; } catch (NullReferenceException) { reason = "List has no elements."; } break; case "Failed to parse Boolean": reason = "You can only input `true` or `false` for this command."; break; default: reason = result.ErrorReason; break; } var embed = new EmbedBuilder(); if (msg.HasMentionPrefix(_client.CurrentUser, ref argPos)) { var nm = msg.Content.Replace($"<@{_client.CurrentUser.Id}> ", config.CommandPrefix); embed.AddField("Error in command:", nm); embed.AddField("Error reason:", reason); embed.AddField("Weird error?", "[Report it in the SIVA-dev server](https://discord.gg/prR9Yjq)"); embed.WithAuthor(context.User); embed.WithColor(Config.bot.ErrorEmbedColour); await context.Channel.SendMessageAsync("", false, embed); } else { var nm = msg.Content; embed.AddField("Error in command:", nm); embed.AddField("Error reason:", reason); embed.AddField("Weird error?", "[Report it in the SIVA-dev server](https://discord.gg/prR9Yjq)"); embed.WithAuthor(context.User); embed.WithColor(Config.bot.ErrorEmbedColour); await context.Channel.SendMessageAsync("", false, embed); } } if (result.ErrorReason == "Unknown command.") { return; } if (Config.bot.LogAllCommands) { Console.WriteLine($"--| -Command from user: {context.User.Username}#{context.User.Discriminator}"); Console.WriteLine($"--| -Command Issued: {msg.Content}"); Console.WriteLine($"--| -In Guild: {context.Guild.Name}"); Console.WriteLine($"--| -In Channel: #{context.Channel.Name}"); Console.WriteLine($"--| -Time Issued: {DateTime.Now}"); Console.WriteLine(result.IsSuccess ? $"--| -Executed: {result.IsSuccess}" : $"--| -Executed: {result.IsSuccess} | Reason: {result.ErrorReason}"); Console.WriteLine("-------------------------------------------------"); } try { File.AppendAllText("Commands.log", $"--| -Command from user: {context.User.Username}#{context.User.Discriminator} ({context.User.Id})\n"); File.AppendAllText("Commands.log", $"--| -Command Issued: {msg.Content} ({msg.Id})\n"); File.AppendAllText("Commands.log", $"--| -In Guild: {context.Guild.Name} ({context.Guild.Id})\n"); File.AppendAllText("Commands.log", $"--| -In Channel: #{context.Channel.Name} ({context.Channel.Id})\n"); File.AppendAllText("Commands.log", $"--| -Time Issued: {DateTime.Now}\n"); File.AppendAllText("Commands.log", result.IsSuccess ? $"--| -Executed: {result.IsSuccess}\n" : $"--| -Executed: {result.IsSuccess} | Reason: {result.ErrorReason}\n"); File.AppendAllText("Commands.log", "-------------------------------------------------\n"); } catch (FileNotFoundException) { Console.WriteLine("The Commands.log file wasn't found, creating it now."); File.WriteAllText("Commands.log", ""); } if (config.DeleteMessageOnCommand) { await context.Message.DeleteAsync(); } } else { if (msg.Content.Contains($"<@{_client.CurrentUser.Id}>")) { await Helpers.SendMessage(context, null, "<:whO_PENG:437088256291504130>"); } } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer player = (UnturnedPlayer)caller; if (command.Length == 0 || command.Length > 2) { UnturnedChat.Say(player, U.Translate("command_generic_invalid_parameter")); throw new WrongUsageOfCommandException(caller, this); } ushort id = 0; byte amount = 1; string itemString = command[0].ToString(); if (!ushort.TryParse(itemString, out id)) { List <ItemAsset> sortedAssets = new List <ItemAsset>(SDG.Unturned.Assets.find(EAssetType.ITEM).Cast <ItemAsset>()); ItemAsset asset = sortedAssets.Where(i => i.itemName != null).OrderBy(i => i.itemName.Length).Where(i => i.itemName.ToLower().Contains(itemString.ToLower())).FirstOrDefault(); if (asset != null) { id = asset.id; } if (String.IsNullOrEmpty(itemString.Trim()) || id == 0) { UnturnedChat.Say(player, U.Translate("command_generic_invalid_parameter")); throw new WrongUsageOfCommandException(caller, this); } } Asset a = SDG.Unturned.Assets.find(EAssetType.ITEM, id); if (command.Length == 2 && !byte.TryParse(command[1].ToString(), out amount) || a == null) { UnturnedChat.Say(player, U.Translate("command_generic_invalid_parameter")); throw new WrongUsageOfCommandException(caller, this); } string assetName = ((ItemAsset)a).itemName; if (U.Settings.Instance.EnableItemBlacklist && !player.HasPermission("itemblacklist.bypass")) { for (int i = 0; i < U.Settings.Instance.Items.Count; i++) { Blacklist Item = U.Settings.Instance.Items[i]; if (id == Item.id) { UnturnedChat.Say(player, U.Translate("command_i_blacklisted")); return; } } } if (U.Settings.Instance.EnableItemSpawnLimit && !player.HasPermission("itemspawnlimit.bypass")) { if (amount > U.Settings.Instance.MaxSpawnAmount) { UnturnedChat.Say(player, U.Translate("command_i_too_much", U.Settings.Instance.MaxSpawnAmount)); return; } } if (player.GiveItem(id, amount)) { Logger.Log(Plugin.Instance.Translate("giving_console", player.DisplayName, amount, id, assetName)); UnturnedChat.Say(player, U.Translate("command_i_giving_private", amount, assetName, id)); } else { UnturnedChat.Say(player, Plugin.Instance.Translate("giving_failed", itemString)); } }
public void Code(string outDir, Blacklist[] blacklist, Threading[] threading) { m_blacklist = blacklist; m_threading = threading; m_fastCalls = 0; m_slowCalls = 0; foreach (NativeFile file in m_objects.Files) { string hfile = Path.GetFileNameWithoutExtension(file.Path); if (hfile != "NSObjCRuntime" && hfile != "NSObject" && hfile != "NSProxy" && hfile != "NSDistantObject" && hfile != "NSProtocolChecker") { m_inPath = file.Path; StringBuilder buffer = new StringBuilder(); m_buffer = buffer; DoWrite("// machine generated on {0} using {1}", DateTime.Now, Path.GetFullPath(m_inPath)); DoWrite(); DoWrite("using MObjc;"); DoWrite("using MObjc.Helpers;"); DoWrite("using System;"); DoWrite("using System.Runtime.InteropServices;"); DoWrite(); DoWrite("namespace MCocoa"); DoWrite("{"); DoEnums(buffer, file); DoInterfaces(buffer, file); m_buffer = buffer; DoWrite("}"); string outPath = Path.Combine(outDir, hfile + ".cs"); File.WriteAllText(outPath, buffer.ToString()); // These files should not normally be hand edited so we'll lock them. File.SetAttributes(outPath, FileAttributes.ReadOnly); } } string[] components = outDir.Split('/'); Console.WriteLine("{0:0.0}% of {1} {2} methods are fast path", 100.0*m_fastCalls/(m_fastCalls+m_slowCalls), m_fastCalls+m_slowCalls, components[components.Length - 2]); }