Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Linq;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- using System.Windows.Forms;
- using Buddy.Common;
- using Buddy.BehaviorTree;
- using Buddy.CommonBot;
- using Buddy.Swtor;
- using Buddy.Swtor.Objects;
- using Buddy.Common.Math;
- using Buddy.Navigation;
- using Action = Buddy.BehaviorTree.Action;
- /* Notes: By JoeBrewski - Started in Sep 2012. Recommended you REMOVE/DELETE ALL BW PLUGINS - They kill stability with the bot.
- */
- namespace JoesCombat
- {
- public static class MercHelpers
- {
- /* DRIVER VARIABLES - YOU CAN MODIFY THESE TO MODIFY BEHAVIORS WITH THE CC */
- private static bool DoRandomGrind = false; // ONLY RUN THIS WITH CombatBot.xml - Park character in a Mob-Rich Area first - It doesn't need any waypoints - it will find/target and kill the closest nonfriendly, and repeat.
- private static bool EnableMount = true;
- private static char chMount = 'X'; // Key to use for mounting - MUST CORRESPOND TO KEY SET FOR THE QUICKBAR BUTTON IN SWTOR
- // - MUST BE UPPERCASE IF A REGULAR CHARACTER - So if 'x' (an X with no Shift) in SWTOR, here it should be 'X'.
- private static int MountCheckFreq = 15; // Mount Check Frequency (in Seconds)
- private static bool TagAlong = false; // Tag Along in Groups (FPs, Ops, etc) - HIGHLY DEPENDENT ON MESHING FOR THE INSTANCE - IF THE INSTANCE ISN'T MESHED- IT WILL MESS EVERYTHING UP WHILE IT'S WAITING FOR A PATH GENERATION.
- private static bool AllowCombat = true; // Combat - mainly for use in groups
- private static bool ReportDurs = false; // Report Durations in log
- private static int MaxNodesBetweenFights = 2; // Max nodes to harvest between fights, IF ScanForNodes is true
- private static bool ScanForLoot = true; // Set to true for Node-Scanning w/DoRandomGrind - If you're bent on levelling, set this to false - you won't hit nodes, but it will run faster.
- private static bool ScanForNodes = true; // Set to true for Node-Scanning w/DoRandomGrind - If you're bent on levelling, set this to false - you won't hit nodes, but it will run faster.
- private static float MaxNodeDist = 6.0f; // Max Distance Used to scan for harvestable nodes/corpses (10x multiplier in variable value vs. displayed value, so 10=100)
- private static bool PullIG = false; // ONLY set this to true if you want to pull while In-Group for whatever reason
- private static string MyAbilities = ""; // Abilities List, Semicolon-Separated
- //private static bool UseMarksSurvRot = true; // Go with the (Sniper ONLY) Marksmanship 'Survival Rotation' (by Xanathos) vs. mine (mine is geared for a healer companion, his is not)
- private static bool HarvestCorpses = true; // Harvest corpses if you have de skills on given corpse (i.e. strong Droid=Scav, etc)
- private static bool DisplayRoughDPS = true;
- private static int RehookFreq = 60; // Re-Hook/Reload Frequency - Due to the frequent SWTOR 'Musical Chairs' with offset/addr changes - Strongly Recommend no more than 120 on this
- private static bool DisableAutoRez = false; // Set to true if you're running solo (CombatBot?) and don't want the bot to auto-rez
- private static bool EnableMemMon = false; // IF YOU ENABLE THIS WHEN YOU SHUT DOWN BUDDYWING THE .EXE __WILL__ NEED TO BE KILLED VIA TASKMANAGER - Until I figure out how to hook the Bot ShutDown event
- private static Keys CombatToggleHotKey = Keys.Home; // Combat Toggle - Mainly for Use in Ops, FPs, etc
- private static Keys MovementToggleHotKey = Keys.Delete; // Movement Toggle - Mainly for Use in Ops, FPs, etc
- private static Keys DRGToggle = Keys.Add; // DoRandomGrind Toggle Key
- private static Keys GroupTagAlongToggle = Keys.Subtract; // TagAlong Toggle Key
- private static CombatToughness DRGMinToughness = CombatToughness.Standard; // Min Combat Toughness with DoRandomGrind - if doing this above CombatToughness.Standard, park it in a spot where you KNOW there will be alot of these.
- /* END OF DRIVER VARIABLES */
- private static long RehookLastMemSize;
- private static Thread thMonMem; // if (EnableMemMon) - Thread to sit running in the background and monitor this app's memory usage and act accordingly if it goes through-the-roof.
- public static DateTime DateLastPingOOC = DateTime.Now;
- public static DateTime DateLastPingCombat = DateTime.Now;
- private static bool Is55H = false;
- [DllImport("user32.dll")]
- private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam); // Used for mounting/keysend
- // This is sketchy at-the-moment, only good for a pure single-target fight, and won't include overkill damage
- private static DateTime DPSCheckStart = DateTime.Now;
- private static double DPSHealthStart;
- private static double DPSTotalDamage = 0;
- private static double DPSTotalFightTime = 0;
- private static TorCharacter DPSLastTarget;
- private static DateTime DPSLastCheck;
- private static bool DPSWasInCombat = false;
- //private static bool RunningCombat = false;
- private static string LastPOIName = "";
- private static List<Vector3> DRGGrindPath=new List<Vector3>();
- private static Vector3 DRGVendorPos;
- private static string DRGVendorName = "";
- public static List<TorNpc> Attackers = new List<TorNpc>();
- //private static System.Windows.Forms.Keys TargWeakestToggleHotKey = Keys.Home; // Obsolete
- private static System.Windows.Forms.Keys ForceRestartHotKey = Keys.NumPad0; // Obsolete w/CheckGC and (if enabled) MonMem
- private static bool KillFest = false; // With DRG: If not at least 10 lootables around, just KILL - more XP/hr.
- private static Vector3 LastCombatPt; // With DRG: If we die in combat, remember where we were last fighting and try and run back
- private static float PullDist= 2.0f; // Char Settings - Pull Distance - .exe seems to ignore this so not of much use
- private static Buddy.CommonBot.Settings.GlobalSettings GS = new Buddy.CommonBot.Settings.GlobalSettings();
- private static int SWTORPID; // For Mounting and Spell Cancel/Stop
- private static IntPtr SWTORHWnd;
- private static DateTime LastXPCheckTime = DateTime.Now;
- private static ulong LastXPCheck = Me.Xp;
- private static DateTime LastXPShownTime = DateTime.Now;
- private static string MountName = Buddy.Swtor.Mounts.GetFastestAvailableMount(); // For use with DoRandomGrind (since the OOC pretty much overrides any 'idle time' for normal profile operations)
- private const float MaxDist = 50; // 10x factor internally in SWTOR - For use with DoRandomGrind
- private static bool InitsComplete = false;
- private static bool HasScav = false;
- private static bool HasBio = false;
- private static bool HasArch = false;
- private static bool HasSlicing = false;
- private static bool IsRanged = false; // Ranged or Melee Combat Spec
- private static Dictionary<ulong,DateTime> MyBlacklist = new Dictionary<ulong,DateTime>();
- // Blacklist for Mob Corpse-Harvesting/Nodes
- private static bool UseAOE = true;
- private static Dictionary<string, DateTime> EquippedRelics=new Dictionary<string,DateTime>();
- private static float MeleeDist; // Melee Distance - Used mainly for LARGE MOBS - where CT.Scale < 1
- private static DateTime datLLSl = DateTime.Now; // Last Long Sleep - to try and help even further with GrayMagic errors
- private static DateTime datLC; // Last check for harvestables
- private static DateTime datLMC; // Last check for harvestables
- private static DateTime datLCs; // Last cast - Used for check in ForcedCast - mainly PvP
- private static DateTime datLCL; // Last Check Local (used locally in various routines)
- private static DateTime datLFP; // Last Forced Pulse() - ONLY do this once every 5 seconds max
- private static DateTime datLOOC; // Last OOC call - for OOC 'throttling'
- private static DateTime datLCC = DateTime.Now; // Last Comp Check
- private static DateTime datLGC = DateTime.Now; // Last GC (runs roughly once-per-minute Out-Of-Combat)
- private static DateTime datLGC2 = DateTime.Now; // Last GC (Purely GC.GetTotalMemory())
- private static DateTime datLLS = DateTime.Now; // Last Loot Scan: To Be Used w/KillFest (only scan for loot every 2 minutes)
- private static DateTime datLMPU = DateTime.Now; // Last Medpack Used - 2-minute restriction
- private static DateTime datLBC = DateTime.Now; // Last Buff Check - Only check buffs every 20s
- private static DateTime datLCCoTF = DateTime.Now;
- private static DateTime CS; // Last GC
- private static ulong CG; // Cur Target GUI(ID)
- private static DateTime datLastHM = DateTime.Now; // Last Heroic Moment: Buggy Casting on Heroic Moment
- private static bool MovementAllowed = true;
- private static bool MovementAllowedOrig = true;
- private static DateTime datLSC = DateTime.Now; // Last Summon Companion (only try once every 5 minutes)
- private static IMovementProvider DefaultMP = Navigator.MovementProvider;
- private static INavigationProvider DefaultNP = Navigator.NavigationProvider;
- private static IMovementProvider CurrentMP = Navigator.MovementProvider;
- private static INavigationProvider CurrentNP = Navigator.NavigationProvider;
- private static NoMovement_MovementProvider NoMovementProvider = new NoMovement_MovementProvider();
- private static NoMovement_NavigationProvider NoNavigationProvider = new NoMovement_NavigationProvider();
- private static Buddy.CommonBot.ITargetingProvider NTP;
- public static bool Restarting = false;
- private static TorCharacter LHUnit = null; // Low-Health Unit - For Healing Classes such as BG, Seer, etc
- private static TorCharacter NGUnit = null; // 'Needs Guarding' Unit - for Tanking
- private static Dictionary<string, int> LHDebuffs = new Dictionary<string, int>();
- private static TorNpc NAUnit = null; // 'Needs Aggroed' NPC Unit - for Tanking
- private static TorCharacter CT; // Curr Targ
- private static TorPlayer CTP; // Curr Targ Player - PvP - useless
- private static TorCharacter CompTarg = null; // Comp Targ
- private static TorCharacter LastComp = null;
- private static string MyBuffs = ""; // Buffs/Affects List (String, Semicolon-Delimited)
- private static string CTDebuffs = ""; // Cur Targ Debuffs List (String, Semicolon-Delimited)
- private static Vector3 TP; // Targ Pos
- private static SkillTreeId MySpec = SpecHandler.GetSpec(); // Current Spec
- private static float HP = 0; // Health Pct
- private static float EP = 0; // Energy Pct
- private static float TD = 0; // Targ Dist
- private static bool TC = false; // Targ Casting
- private static float RS = 0; // Resource Stat
- private static float THP = 0; // Targ Health Pct
- public static bool IG = false; // In-Group - Important Re: Healing and Pulls
- private static float CHP = 0; // Comp Health Pct
- private static CombatToughness CTT; // Cur Targ Toughness
- private static int TWR30 = 0; // Target Count within 30m
- private static int TWR10 = 0; // Targets within 10m
- private static int TWR5 = 0; // Targets within 5m
- private static float LHH = 0; // Lowest-Health Health Pct (for In-Group Healing)
- private static float LHD = 0; // Lowest-Health Dist
- private static Vector3 LHP; // Lowest-Health Pct
- private static TorAbility taDeployFRD=null; // Field Repair Droid Deployment - Used in CheckInventory() - Issues trying to deplay and then interact with the droid ATM
- private static TorAbility taSummComp = null; // Summon Companion
- private static TorAbility taAttack = null; // Attack Ability
- private static EffectResult er; // Ability Use Result (Code)
- private static Buddy.CommonBot.IBot IB;
- private static Thread thStart;
- private static Thread thStop;
- public static MyQuestDef myHS_XenovirusPrime;
- public static MyQuestDef myHS_DroidMalfunction;
- public static PrioritySelector MyPS;
- public static string MyName = ""; // Issues comparing a TorChar to BuddyTor.Me, so this is used
- public static string CompName = "";
- public static string MyNameCompName = "";
- public static void Inits()
- {
- if (!InitsComplete)
- {
- //CPUInfo CI=new CPUInfo();
- //int ProcessorCount = CI.PC();
- int ProcessorCount = Environment.ProcessorCount;
- Logger.Write("Reported Processor Count: " + ProcessorCount.ToString());
- //Buddywing.MainWindow.OnClosing += OnBotShutdown;
- //Buddywing.App.Current.Exit += new System.Windows.ExitEventHandler(ShutdownHandler);
- //Buddywing.MainWindow.UnloadedEvent += ShutdownHandler(null, null);
- try
- {
- uint Affin = (uint)ProcessorCount;
- Process.GetCurrentProcess().ProcessorAffinity = (IntPtr)(1 << ProcessorCount - 1);
- Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;
- }
- catch { Logger.Write("Failed setting process attributes on BuddyWing."); }
- int TorMem = 0;
- foreach (Process proc in Process.GetProcesses()) if (proc.ProcessName.Contains("swtor"))
- try
- {
- uint Affin = ProcessorCount >= 4 ?
- (uint)((1 << (ProcessorCount - 2) | (1 << (ProcessorCount - 3)))) :
- (uint)(1 << (ProcessorCount - 2));
- proc.PriorityClass = ProcessPriorityClass.High;
- proc.ProcessorAffinity = (IntPtr)Affin;
- }
- catch (Exception ex)
- {
- Logger.Write("Failed setting process attributes on Star Wars (Main Window).");
- Logger.Write("Error: " + ex.Message);
- }
- foreach (Process proc in Process.GetProcesses()) if (proc.ProcessName.Contains("swtor") && proc.MainWindowTitle.Contains("Star Wars"))
- if (proc.PrivateMemorySize64 > TorMem)
- {
- SWTORPID = proc.Id;
- TorMem = (int)proc.NonpagedSystemMemorySize64;
- SWTORHWnd = proc.MainWindowHandle;
- }
- LoadQuests();
- Logger.Write("Star Wars Process ID Detected as: " + SWTORPID.ToString());
- Logger.Write("Checking Abilities...");
- datLLSl = DateTime.Now;
- NTP = null;
- foreach (Buddy.Swtor.Objects.Components.ProfessionInfo pi in BuddyTor.Me.ProfessionInfos)
- {
- Logger.Write("Abil " + pi.Name + " found");
- if (pi.Name.Contains("Bioanalysis")) HasBio = true;
- if (pi.Name.Contains("Scavenging")) HasScav = true;
- if (pi.Name.Contains("Archaeology")) HasArch = true;
- if (pi.Name.Contains("Slicing")) HasSlicing = true;
- }
- CT = null;
- GS.PullRange = PullDist;
- Logger.Write("Pull Range set at " + GS.PullRange.ToString());
- Logger.Write("DoRandomGrind Key [" + DRGToggle.ToString() + "] HotKey Registered.");
- Hotkeys.RegisterHotkey("DoRandomGrind", () => { DoRandomGrind = !DoRandomGrind; Logger.Write("DoRandom Grind: " + DoRandomGrind.ToString()); OOC(); }, DRGToggle);
- Logger.Write("Combat Toggle Key [" + CombatToggleHotKey.ToString() + "] HotKey Registered.");
- Hotkeys.RegisterHotkey("Combat Toggle", () => { AllowCombat = !AllowCombat; Logger.Write("AllowCombat: " + AllowCombat.ToString()); }, CombatToggleHotKey);
- Logger.Write("Group Tag-Along Key [" + GroupTagAlongToggle.ToString() + "] HotKey Registered.");
- Hotkeys.RegisterHotkey("Tag Along Toggle", () => { TagAlong = !TagAlong; Logger.Write("Group Tag-Along: " + TagAlong.ToString()); }, GroupTagAlongToggle);
- Logger.Write("Movement Toggle Key [" + MovementToggleHotKey.ToString() + "] HotKey Registered... You can edit the value in MercHelpers.cs if necessary (and then restart the .exe)");
- Hotkeys.RegisterHotkey("Movement Toggle", () => { MovementToggle(); }, MovementToggleHotKey);
- //Logger.Write("Target-Weakest Toggle Key [" + TargWeakestToggleHotKey.ToString() + "] HotKey Registered... You can edit the value in MercHelpers.cs if necessary (and then restart the .exe)");
- //Hotkeys.RegisterHotkey("Targeting Toggle", () => { TargetingToggle(); }, TargWeakestToggleHotKey);
- Logger.Write("Forced Reload [" + ForceRestartHotKey.ToString() + "] HotKey Registered (to try and force Reload if hung)...");
- Hotkeys.RegisterHotkey("Rehook", () =>
- {
- try
- {
- if (BotMain.IsRunning) BotMain.CurrentBot.Stop();
- //if (BotMain.IsRunning) Buddy.CommonBot.BotMain.BotThread.Abort();
- else if (!BotMain.IsRunning) BotMain.CurrentBot.Start();
- Thread.Sleep(1000);
- //BotMain.CurrentBot.Start();
- //Buddy.CommonBot.RoutineManager.Current.Initialize();
- //Thread.Sleep(1000);
- //Buddy.Swtor.Objects.Engine.Gom GOM = new Buddy.Swtor.Objects.Engine.Gom(); // Need further testing w/this before it 'Goes into Production'
- //GOM.Client.Read();
- //Buddy.CommonBot.GameEvents.Update();
- //Thread.Sleep(2000);
- //OOC();
- }
- catch { }
- //try
- //{
- // ObjectManager.Cache.Clear();
- // ObjectManager.FlushOldEntries(true);
- //}
- //catch { }
- //try
- //{
- // Buddy.Swtor.Movement.Update();
- // DefaultNP.Clear();
- //}
- //catch { }
- //try
- // {
- // Buddy.CommonBot.GameEvents.Update();
- // Buddy.CommonBot.Poi.Clear("FightAtJoes: Cache Clear.");
- // Thread.Sleep(3000);
- //}
- //catch { }
- }, ForceRestartHotKey);
- //Hotkeys.RegisterHotkey("Force Routine Reload", () => { DoRestart(); }, Keys.OemPipe);
- MySpec = SpecHandler.GetSpec(Me);
- foreach (TorAbility ta in BuddyTor.Me.KnownAbilitiesContainer)
- {
- MyAbilities += ta.Name+";";
- if (ta.Name.Contains("Incendiary Missile")) MySpec = SkillTreeId.MercenaryFirebug; // Fix the eternal Firebug mess
- if (ta.Name.Contains("Deploy Field Repair")) { taDeployFRD = ta; Logger.Write("Ability " + ta.Name + " found."); }
- if (ta.Name.Contains("Summon Companion")) { taSummComp = ta; Logger.Write("Ability " + ta.Name + " found."); }
- if (ta.Name.Contains("Attack")) { taAttack = ta; Logger.Write("Ability " + ta.Name + " found."); }
- }
- //Logger.Write("Abilities List: " + MyAbilities);
- Logger.Write("Spec Detected as: " + MySpec.ToString());
- if (DoRandomGrind)
- {
- Logger.Write("RANDOM-GRIND IS ACTIVE. If not intended, update the DoRandomGrind flag in MercHelpers.cs to false, and restart the .exe (as in exit and reopen).");
- Logger.Write("WITH DoRandomGrind, YOU NEED TO PARK YOUR CHARACTER IN A MOB-RICH AREA BEFORE STARTING (So it has something to find/attack).");
- }
- Logger.Write("Check Abilities: Bio " + HasBio.ToString() + " Scav " + HasScav.ToString() + " Arch " + HasArch.ToString() + " Slicing " + HasSlicing.ToString());
- Logger.Write("***IF YOU ARE RUNNING A QUESTING PROFILE AND CHANGE PLANETS/INSTANCES, OR LOG IN TO ANOTHER CHARACTER, RESTART SWTOR AND THEN RESTART THE BOT (AS IN CLOSE/RE-RUN THE APP)***");
- RehookLastMemSize = Process.GetCurrentProcess().PrivateMemorySize64;
- CheckForGroup();
- InitsComplete = true;
- //ForcePulse();
- }
- }
- private static void OnBotStart(IBot bot)
- {
- try {
- datLFP = DateTime.Now;
- datLGC = DateTime.Now;
- Thread.Sleep(500);
- }
- catch { }
- InitsComplete = false;
- datLLSl = DateTime.Now;
- OOC();
- }
- private static void OnBotStop(IBot bot)
- {
- }
- //public delegate BotEvent_OnBotShutdown BotEventHandler(object sender, BotEvent_OnBotShutdown e);
- private static void OnBotShutdown(IBot bot)
- {
- }
- // SHITLOADS of Trial-and-Error on this, it's 'Constantly Evolving' depending on updates to the .exe for the week, and SWTOR.
- public static void DoRehook()
- {
- DateTime datRehookStart = DateTime.Now;
- try
- {
- datLGC = DateTime.Now;
- datLLSl = DateTime.Now;
- System.GC.Collect();
- System.GC.GetTotalMemory(true);
- Buddy.CommonBot.RoutineManager.Current.Initialize();
- Thread.Sleep(3000);
- RehookLastMemSize = Process.GetCurrentProcess().PrivateMemorySize64;
- return;
- long WS = Process.GetCurrentProcess().PrivateMemorySize64;
- //Logger.Write("Starting GC/Rehook. Current (Working Set) Process Memory Usage at: " + (1.0*WS/(1024^2)).ToString("0.0")+"MB" );
- Logger.Write("Starting GC/Rehook.");
- //if (WS >= 100000000) // If things went apeshit and monitoring memory, try and do an overhaul
- //{
- // while (Process.GetCurrentProcess().PrivateMemorySize64 >= 100000000)
- // {
- // System.GC.Collect();
- // System.GC.GetTotalMemory(true);
- // Thread.Sleep(1000);
- // Buddy.Swtor.Objects.Engine.Gom GOM = new Buddy.Swtor.Objects.Engine.Gom(); // Need further testing w/this before it 'Goes into Production'
- // GOM.Client.Read();
- // BotMain.CurrentBot.Dispose();
- // BotMain.CurrentBot.Dispose();
- // Thread.Sleep(1500);
- // Buddy.Swtor.Movement.Update();
- // DefaultNP.Clear();
- // ObjectManager.Cache.Clear();
- // ObjectManager.FlushOldEntries(true);
- // Buddy.Swtor.NodeManager.Update();
- // Buddy.CommonBot.Logic.BrainBehavior.CreateBrain();
- // Buddy.CommonBot.RoutineManager.Current.Initialize();
- // BotMain.CurrentBot.Stop();
- // Thread.Sleep(5000);
- // }
- //}
- //else
- {
- System.GC.Collect();
- System.GC.GetTotalMemory(true);
- BotMain.CurrentBot.Dispose();
- BotMain.CurrentBot.Dispose();
- //Buddy.CommonBot.Logic.BrainBehavior.CreateBrain();
- Buddy.CommonBot.Logic.BrainBehavior.CreateBrain();
- Buddy.CommonBot.RoutineManager.Current.Initialize();
- //Buddy.Swtor.Objects.Engine.Gom GOM = new Buddy.Swtor.Objects.Engine.Gom();
- //GOM.Client.Read();
- //Buddy.CommonBot.Poi.Clear("FightAtJoes: Rehook/Reload.");
- Thread.Sleep(4500);
- }
- //Thread.Sleep(500);
- Me.Target();
- Thread.Sleep(500);
- Me.ClearTarget();
- //BuddyTor.Me.ClearTarget();
- //Buddy.CommonBot.GameEvents.Update();
- //Buddy.CommonBot.Logic.BrainBehavior.CreateBrain();
- //Buddy.CommonBot.RoutineManager.Current.Initialize();
- //Thread.Sleep(2000);
- //ForcePulse();
- }
- catch (Exception ex)
- { //Logger.Write("Error in DoRehook: " + ex.Message);
- }
- RehookLastMemSize = Process.GetCurrentProcess().PrivateMemorySize64;
- Logger.Write("Re-Hook/Reload Processed. Total Rehook Time: " + (ReportDurs?"":DateTime.Now.Subtract(datRehookStart).TotalSeconds.ToString("0.0")));
- BotMain.CurrentBot.Pulse();
- //OOC();
- }
- private static void CheckGC()
- {
- Inits();
- //return;
- if (DateTime.Now.Subtract(datLGC).TotalSeconds >= RehookFreq || (Process.GetCurrentProcess().PrivateMemorySize64-RehookLastMemSize>=50000000))
- //if (DateTime.Now.Subtract(datLGC).TotalSeconds >= (RehookFreq + 10))
- try
- {
- DoRehook();
- //Buddy.CommonBot.GameEvents.Update();
- //OOC();
- }
- catch { Thread.Sleep(4000); }
- //if (DateTime.Now.Subtract(datLGC2).TotalSeconds >= 30)
- //{
- // DefaultNP.Clear();
- // //Buddy.CommonBot.Logic.BrainBehavior.CreateBrain();
- // GC.Collect();
- // GC.GetTotalMemory(true);
- // ObjectManager.Cache.Clear();
- // Thread.Sleep(1500);
- // ObjectManager.FlushOldEntries(true);
- // ObjectManager.Update();
- // datLGC2 = DateTime.Now;
- //}
- }
- // Obsolete
- //private static void MoveIfNec()
- //{
- // MoveIfNec(2.8f);
- //}
- //private static void MoveIfNec(float dist)
- //{
- // if (CT == null) return;
- // if (CTT == CombatToughness.Player) return;
- // MoveTo(CT, dist);
- //}
- public static void WaitForCast()
- {
- DateTime dStart = DateTime.Now;
- //Logging.Write("Waiting for Cast...");
- ObjectManager.Update();
- while (Me.IsCasting && DateTime.Now.Subtract(dStart).TotalSeconds < 4)
- {
- Thread.Sleep(250);
- }
- //Logging.Write("Done with Cast...");
- }
- private static void StopMoving()
- {
- if (!MovementAllowed) return;
- Buddy.Swtor.Movement.Stop(MovementDirection.Forward);
- Thread.Sleep(50);
- Buddy.CommonBot.CommonBehaviors.MoveStop();
- Thread.Sleep(50);
- Buddy.Swtor.Input.MoveStopAll();
- Thread.Sleep(50);
- Buddy.CommonBot.CommonBehaviors.MoveStop();
- }
- private static void MoveTo(TorCharacter theUnit, float dist, string Cast1 ="", string Cast2="", string Cast3="", string Cast4="")
- {
- //if (theUnit == null)
- //{
- // Logger.Write("Null MoveTo: Aborting.");
- // return;
- //}
- if (!MovementAllowed) return;
- if (theUnit == null) theUnit = CT;
- if (theUnit == null || dist <= 0) return;
- if (theUnit.Distance <= dist && theUnit.InLineOfSight) return;
- try
- {
- StopMoving(); // To (try and) prevent 'The Chicken Dance'
- datLCL = DateTime.Now;
- //theUnit.Face();
- //theUnit.Face();
- if (theUnit.Distance > dist || !theUnit.InLineOfSight)
- {
- Logger.Write("MoveTo: " + theUnit.Name + " Moving to within " + dist.ToString("0.0") + " from dist of " + theUnit.Distance.ToString("0.0") + " current LOS: " + theUnit.InLineOfSight.ToString());
- MoveResult MR = MoveResult.Moved;
- StopMoving();
- while ((MR != MoveResult.Failed && MR != MoveResult.PathGenerationFailed) && theUnit != null && DateTime.Now.Subtract(datLCL).TotalSeconds <= 15 && (theUnit.Distance > dist || !theUnit.InLineOfSight))
- {
- if (Cast1 != "") MercCast(Cast1, CT);
- if (Cast2 != "") MercCast(Cast2, CT);
- if (Cast3 != "") MercCast(Cast3, CT);
- if (Cast4 != "") MercCast(Cast4, CT);
- if (theUnit.Distance > dist || !theUnit.InLineOfSight)
- {
- MR = Buddy.Navigation.Navigator.MoveTo(theUnit.Position);
- Thread.Sleep(100);
- }
- }
- if (MR == MoveResult.Failed && MR == MoveResult.PathGenerationFailed) Logger.Write("Move Result: " + MR.ToString());
- StopMoving();
- StopMoving();
- }
- }
- catch { }
- }
- private static bool MeOrCompInCombat()
- {
- try
- {
- TorCharacter CompX = Comp;
- if (Me.InCombat) return true;
- if (CompX != null) if (CompX.InCombat) return true;
- }
- catch { }
- return false;
- }
- // For use mainly in groups, trying to determine if the current target's target is a player, and it IS in combat. USED EVERYWHERE IN COMBAT.
- public static bool TargetInCombat()
- {
- try
- {
- if (CT == null) { Logger.Write("TargetInCombat: Null Target."); return false; }
- if (CT.IsDead || CT.HealthPercent < .2f) { Logger.Write("TargetInCombat: Dead Target."); return false; }
- if (Me.PvpFlagged) return true;
- if (CT.Toughness == CombatToughness.Player) { CT = null; Me.ClearTarget(); Logger.Write("Player targeted outside of Heals, clearing target."); return false; }
- if (CTT == CombatToughness.Player) if (!CT.IsFriendly) return true; // PvP - you target an enemy player, go-to-town
- if (IG && !PullIG)
- {
- if (!CT.InCombat) { Logger.Write("In-Group and target not in combat."); return false; } // If we're in Ops/FP/etc - DON'T ATTACK SHIT THAT HASN'T BEEN PULLED
- if (CT.IsStunned) { Me.ClearTarget(); Thread.Sleep(300); CT = null; return false; }
- if (CT.CurrentTarget == null) return false; else if (CT.CurrentTarget.Toughness != CombatToughness.Player) return false;
- }
- }
- catch { CT = null; Logger.Write("Error testing target."); return false; }
- return true;
- }
- public static void UseMedPackInInventory()
- {
- if (DateTime.Now.Subtract(datLMPU).TotalSeconds < 120) return;
- datLMPU = DateTime.Now; // One scan every 2 minutes
- foreach (var o in Me.InventoryEquipment)
- {
- if (o.Name.Contains("Medpac") && o.MinimumLevel<=Me.Level && !o.Name.Contains("Warzone"))
- { Logger.Write("Using Medpac " + o.Name + "..."); o.Use(); o.Interact(); o.Interact(); Thread.Sleep(500); return; }
- }
- }
- public static bool HaveBuffStacks(string strBuff, int intCount, TorCharacter theUnit=null)
- {
- if (theUnit == null) theUnit = Me;
- try { if (MyBuffs.Contains(strBuff)) foreach (TorEffect te in Me.Buffs) if (te.Name.Contains(strBuff)) if (te.Stacks >= intCount) return true; }
- catch { }
- return false;
- }
- public static bool HasDebuffStacks(string strDebuff, int intCount)
- {
- try { if (CTDebuffs.Contains(strDebuff)) foreach (TorEffect te in CT.Debuffs) if (te.Name.Contains(strDebuff)) if (te.Stacks >= intCount) return true; }
- catch { }
- return false;
- }
- public static bool IAmDead()
- {
- if (BuddyTor.Me.IsDead || BuddyTor.Me.HealthPercent < .2f)
- if (IG || DisableAutoRez)
- {
- Logger.Write("Death detected and In-Group (or DisableAutoRez set) - waiting for manual rez...");
- while (BuddyTor.Me.IsDead) Thread.Sleep(2000);
- }
- else
- {
- Logger.Write("Death detected.");
- Me.ClearTarget();
- Thread.Sleep(500);
- return true;
- }
- return false;
- }
- public static PrioritySelector SelfBuff(string theSpell, bool Req)
- {
- return new PrioritySelector(Spell.Cast(theSpell, ch=>BuddyTor.Me, ret => !BuddyTor.Me.HasBuff(theSpell) && Req));
- }
- public static PrioritySelector MercenaryCombatPS()
- {
- return new PrioritySelector(
- new Action( ret=> {LoadVars();return RunStatus.Failure;}),
- Spell.WaitForCast(),
- new Action(ret=>{if(CT!=null){ StopMoving(); MoveTo(CT, 2.8f);} return RunStatus.Failure;}),
- SelfBuff("Combustible Gas Cylinder", MySpec==SkillTreeId.MercenaryFirebug),
- new Action(ret=>{
- if (!CT.InCombat)
- {
- if (MercCast("Fusion Missile")) Thread.Sleep(400);
- if (MercCastOnGround("Death from Above", TD >= .6f, CT,false)) Thread.Sleep(400);
- if (MercCast("Explosive Dart")) Thread.Sleep(400);
- //if (MercCast("Concussion Missile", !CT.InCombat)) Thread.Sleep(400);
- if (MercCastOnGround("Sweeping Blasters", true, CT, false)) ;
- if (MercCast("Concussion Missile", MobsInRangeOf(CT.Position, 2.0f) >= 3)) Thread.Sleep(400);
- }
- return RunStatus.Failure;}),
- Spell.Cast("Thermal Detonator", ret=>true),
- Spell.Cast("Heatseeker Missiles", ret=>true),
- Spell.Cast("Incendiary Missile",ret=>!CTDebuffs.Contains("Burning")),
- Spell.Cast("Rapid Shots", ret=>true));
- }
- public static bool MercenaryCombat()
- {
- datLCL = DateTime.Now;
- Thread.Sleep(400); // Needs enough time to pulse for Self-Heals and Interrupts, CRUCIAL in Oricon
- WaitForCast();
- LoadVars();
- if (MercBuffSelf("Combat Support Cylinder", MySpec==SkillTreeId.MercenaryBodyguard)) return true;
- if (MercBuffSelf("Combustible Gas Cylinder", MySpec == SkillTreeId.MercenaryFirebug)) return true;
- if (MercBuffSelf("High Velocity Gas Cylinder", MySpec == SkillTreeId.MercenaryArsenal)) return true;
- if (MercBuffSelf("Kolto Shell")) return true;
- MercCast("Vent Heat", RS <= 25f);
- if (MercCast("Hunter's Boon", !MyBuffs.Contains("Hunter's Boon"))) return true;
- if (HP <= 70f)
- {
- Thread.Sleep(300);
- if (MercCast("Chaff Flare", HP <= 50f)) return true;
- if (MercCast("Energy Shield", HP <= 60f)) return true;
- if (MercCastOnGround("Kolto Missile", HP < 70f, BuddyTor.Me, false)) return true;
- if (MercCast("Emergency Scan", HP <= 70f)) return true;
- if (MercCast("Rapid Scan", HP <= 70f)) return true;
- }
- if (IG && MySpec == SkillTreeId.MercenaryBodyguard && IG)
- {
- for (int i = 0; i < (Is55H ? 3 : 1); i++) { BGHeals(Is55H ? 85f : 70f);}
- if (Me.ResourceStat<=75f) return MercCast("Rapid Shots");
- }
- MoveTo(CT, 2.8f);
- StopMoving();
- if (!TargetInCombat()) return false; //else if (CT != Me.CurrentTarget) CT.Target();
- if (!CT.InCombat)
- {
- if (MercCast("Fusion Missile")) Thread.Sleep(400);
- if (MercCastOnGround("Death from Above", TD >= .6f, CT)) Thread.Sleep(400);
- if (MercCast("Explosive Dart")) Thread.Sleep(400);
- //if (MercCast("Concussion Missile", !CT.InCombat)) Thread.Sleep(400);
- if (MercCastOnGround("Sweeping Blasters", true, CT)) return true;
- if (MercCast("Concussion Missile", MobsInRangeOf(CT.Position, 2.0f) >= 3)) Thread.Sleep(400);
- }
- //MoveTo(CT, EliteOrGreater(CT)?1.0f:2.8f);
- //if (CT.Name.Contains("Commander Zaoron")) MoveTo(CT, .50f);
- if (TC && StrongOrGreater(CT))
- {
- if (MercCast("Disabling Shot")) return true;
- if (MercCast("Electro Dart")) return true;
- //if (MercCast("Neural Dart")) return true;
- if (MercCast("Electro Net")) return true;
- if (MercCast("Concussion Missile")) return true;
- }
- if ((!IG && RS<=35) || (IG && RS <= 50 && MySpec == SkillTreeId.MercenaryBodyguard)) return MercCast("Rapid Shots");
- if (IG && MySpec != SkillTreeId.MercenaryBodyguard) if (BGHeals(60f)) return true;
- if (!IG && BGCheckCompHealth()) return true;
- if (MercCast("Jet Boost", TD <= .8f)) return true;
- if (MercCast("Shoulder Slam", TD <= .8f)) return true;
- if (MercCast("Rocket Punch", TD <= .8f)) return true;
- if (MercCast("Electro Dart", TD <= .8f)) return true;
- if (IG && MySpec == SkillTreeId.MercenaryBodyguard && RS <= 70f)
- {
- if (MercCast("Rapid Shots", true)) return true ;
- Thread.Sleep(300);
- return Me.InCombat;
- }
- //StopMoving();
- if (MercCastOnGround("Death from Above", TD >= .6f && RS >= 80f, CT)) return true;
- if (MercCast("Emergency Scan", HP < 70f)) return true;
- if (MercCast("Determination", BuddyTor.Me.IsStunned)) return true;
- // I've ALWAYS had issues w/the cast on this and distance, tried to qualify the hell out of it
- if (MercFaceAndCast("Flame Thrower", TD > .01f && TD <= .60f)) return true;
- if (MercCast("Heroic Moment: On the Trail", HP <= 50f)) return true;
- if (MercCast("Power Surge")) return true;
- if (MercCast("Supercharged Gas", !MyBuffs.Contains("Supercharged Gas"))) return true;
- if (MercCast("Thermal Sensor Override", RS <= 30f)) return true;
- if (MercCast("Chaff Flare", HP <= 70f && Comp!=null)) return true;
- if (MercCast("Thermal Detonator")) return true;
- if (MercCast("Heatseeker Missiles", StrongOrGreater(CT))) return true;
- if (MercCast("Incendiary Missile", CT, !CTDebuffs.Contains("Burning (Tech)"))) return true;
- if (MercCast("Explosive Dart", StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .80f) >= 3)) return true;
- if (MercCast("Unload")) return true;
- if (MercCast("Rail Shot")) return true;
- if (MercCast("Fusion Missile", StrongOrGreater(CT))) return true;
- if (MercCast("Power Shot", MyBuffs.Contains("Power Surge"))) return true;
- if (MercCast("Rapid Shots", RS <= 30f)) return true;
- if (!IG || (MySpec!=SkillTreeId.MercenaryBodyguard) || (IG && RS >= 40f))
- {
- if (MercCast("Concussion Missile", MobsInRangeOf(CT.Position, MeleeDist) >= 3)) return true;
- if (MercCastOnGround("Sweeping Blasters", MobsInRangeOf(CT.Position, MeleeDist) >= 3, CT)) return true;
- if (MercCast("Rapid Shots", HP < 70 && RS >= 30)) return true;
- if (UseAOE)
- {
- if (MercCast("Missile Blast", (TD <= .8f && !StrongOrGreater(CT)) || RS >= 50f)) return true;
- if (MercCast("Tracer Missile", StrongOrGreater(CT) && !HasDebuffStacks("Heat Signature", 4))) return true;
- if (CTT == CombatToughness.Player) MercCastOnGround("Sweeping Blasters", TD >= .1f && RS >= 35 && (TWR30 > 2 || StrongOrGreater(CT)), CT);
- if (MercCastOnGround("Sweeping Blasters", TD >= .1f && RS >= 35 && (TWR30 > 2 || StrongOrGreater(CT)), CT)) return true;
- }
- if (MercFaceAndCast("Flame Burst", TD <= 1.0f && RS>=65f)) return true;
- }
- if (MercCast("Power Shot")) return true;
- if (MercCast("Rapid Shots")) return true;
- return false;
- }
- public static bool PowerTechCombat()
- {
- if (BuddyTor.Me.IsDead || BuddyTor.Me.HealthPercent <= .2f) return false;
- //Thread.Sleep(500);
- try
- {
- //Thread.Sleep(300);
- datLCL = DateTime.Now;
- WaitForCast();
- LoadVars();
- if (!TargetInCombat()) return false;
- if (CT == null || (CT != null && CT.IsFriendly)) return false;
- //if (MercCast("Combustible Gas Cylinder", !MyBuffs.Contains("Combustible Gas Cylinder") && HP >= 95f)) return true;
- if (MercBuffSelf("Ion Gas Cylinder", MySpec==SkillTreeId.PowertechShieldTech)) return true;
- if (MercBuffSelf("High Energy Gas Cylinder", MySpec == SkillTreeId.PowertechAdvanced)) return true;
- if (MercBuffSelf("Combustible Gas Cylinder", MySpec == SkillTreeId.PowertechFirebug)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (TC && StrongOrGreater(CT))
- {
- if (MercCast("Quell")) return true;
- if (MercCast("Electro Dart")) return true;
- if (MercCast("Grapple")) return true;
- if (MercCast("Rocket Punch", TD <= MeleeDist)) return true;
- }
- if (MercCast("Kolto Shell", BuddyTor.Me, !MyBuffs.Contains("Kolto Shell") && HP <= 85f)) return true;
- if (MercCast("Kolto Overload", HP <= 70f)) return true;
- if (MercCast("Energy Shield", HP <= 60f)) return true;
- MoveTo(CT, 2.8f);
- StopMoving();
- //if (MercCast("Oil Slick", CT, TWR10 >= 3)) return true; // Buggy spell, won't cast, and keeps trying after that till we're dead
- if (!CT.InCombat)
- {
- if (MercCast("Explosive Dart")) Thread.Sleep(800);
- if (MercCastOnGround("Death from Above", TD >= .6f, CT)) Thread.Sleep(800);
- if (MercCast("Grapple")) Thread.Sleep(800);
- }
- if (MercCast("Explosive Dart", StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .80f) >= 3)) return true;
- if (MercCast("Thermal Detonator", TD <= 1.0f)) return true;
- if (MercCast("Immobilize", TD <= 1.0f)) return true;
- if (MercCast("Incendiary Missile", TD <= 1.0f)) return true;
- if (MercCast("Jet Boost", TD <= .5f)) return true;
- if (MercCast("Shoulder Slam", TD <= .5f)) return true;
- if (MercCast("Rocket Punch", TD <= .5f)) return true;
- if (MercCast("Retractable Blade", TD <= .5f)) return true;
- //if (MercCast("Electro Dart", TD <= .8f)) return true;
- if (MercCast("Vent Heat", Me, RS <= 20f)) return true;
- if (MercCast("Flame Sweep", TWR5 >= 4)) return true;
- if (MercCastOnGround("Death from Above", TD >= .6f && (MobsInRangeOf(CT.Position, 1.0f)>=3 || StrongOrGreater(CT)) && BuddyTor.Me.ResourceStat >= 60f, CT)) return true;
- if (MercCastOnGround("Sweeping Blasters", MobsInRangeOf(CT.Position, .80f) >= 3, CT)) return true;
- if (MercCast("Emergency Scan", HP < 70f)) return true;
- if (MercCast("Determination", BuddyTor.Me.IsStunned)) return true;
- if (!TargetInCombat()) return true;
- if (MercCast("Power Shot", MyBuffs.Contains("Power Surge"))) return true;
- if (MercCast("Disabling Shot", TC)) return true;
- if (MercCast("Electro Dart", TC)) return true;
- if (MercCast("Neural Dart", TC || StrongOrGreater(CT))) return true;
- if (MercFaceAndCast("Flame Thrower", TD <= 1.0f)) return true;
- if (MercCast("Hunter's Boon", !MyBuffs.Contains("Hunter's Boon"))) return true;
- if (MercCast("Heroic Moment: On the Trail", HP <= 50f)) return true;
- if (MercCast("Power Surge")) return true;
- if (MercCast("Thermal Sensor Override", RS <= 30f)) return true;
- if (Comp != null) if (MercCast("Chaff Flare", HP <= 70f)) return true;
- if (MercCast("Supercharged Gas", !MyBuffs.Contains("Supercharged Gas"))) return true;
- if (MercCast("Rapid Shots", HP < 70 && RS >= 30)) return true;
- if (MercCast("Unload")) return true;
- if (MercCast("Rail Shot")) return true;
- if (UseAOE)
- {
- if (MercCast("Fusion Missile", StrongOrGreater(CT))) return true;
- if (MercCast("Explosive Dart")) return true;
- if (MercCast("Missile Blast", (TD <= .8f && !StrongOrGreater(CT)) || RS >= 50f)) return true;
- if (CTT == CombatToughness.Player) MercCastOnGround("Sweeping Blasters", TD >= .1f && RS >= 35 && (TWR30 > 2 || StrongOrGreater(CT)), CT);
- if (MercCastOnGround("Sweeping Blasters", TD >= .1f && RS >= 35 && (TWR30 > 2 || StrongOrGreater(CT)), CT)) return true;
- }
- if (MercFaceAndCast("Flame Burst", TD <= 1.0f && RS >= 65f)) return true;
- if (MercCast("Rapid Shots")) return true;
- }
- catch
- {}
- return false;
- }
- public static bool CommandoCombat()
- {
- Thread.Sleep(300); // Needs enough time to pulse for Self-Heals and Interrupts, CRUCIAL in Oricon
- WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- //Thread.Sleep(100);
- if (MercCast("Tenacity", BuddyTor.Me.IsStunned)) return true;
- HandleDebuffs();
- MercBuffSelf("Combat Support Cell", MySpec == SkillTreeId.CommandoCombatMedic);
- MercBuffSelf("Armor Piercing Cell", MySpec == SkillTreeId.CommandoGunnery);
- MercBuffSelf("Plasma Cell", MySpec == SkillTreeId.CommandoAssaultSpecialist);
- if (MercCast("Recharge Cells", RS <= 25f)) return true;
- if (MercCast("Supercharge Cells", StrongOrGreater(CT) || HP<=50f || EP <=25f)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (HP <= 70f)
- {
- MercBuffSelf("Trauma Probe", true);
- MercCastOnGround("Kolto Bomb", HP <= 70f, Me);
- MercCast("Reactive Shield", HP <= 50f);
- MercCast("Adrenaline Rush", Me, HP < 50f);
- MercCast("Hold the Line", Me, HP < 50f);
- MercCast("Diversion", HP < 60f);
- MercCast("Bacta Infusion", Me, HP < 70f);
- MercCast("Advanced Medical Probe", Me, HP < 70f);
- MercCast("Medical Probe", Me, HP < 60f);
- Thread.Sleep(300);
- WaitForCast();
- }
- if (MySpec == SkillTreeId.CommandoCombatMedic && IG)
- {
- for (int i = 0; i < 3; i++) { CMHeals(Is55H ? 85f : 75f); Thread.Sleep(100); }
- if (RS <= ((IG && Is55H) ? 95f : 50f)) return MercCast("Hammer Shot");
- //return false;
- }
- if (!TargetInCombat()) return false;
- MoveTo(CT, 2.8f);
- StopMoving();
- if (TC && !IG && StrongOrGreater(CT))
- {
- if (MercCast("Cryo Grenade")) return true;
- if (MercCast("Disabling Shot")) return true;
- if (MercCast("Electro Net")) return true;
- if (MercCast("Tech Override")) return true;
- if (MercCast("Concussive Round", MyBuffs.Contains("Tech Override"))) return true;
- }
- if (!CT.InCombat)
- {
- if (MercCastOnGround("Mortar Volley", true, CT)) Thread.Sleep(500);
- if (MercCastOnGround("Hail of Bolts", true, CT)) Thread.Sleep(500);
- if (MercCast("Incendiary Round")) return true;
- if (MercCast("Sticky Grenade")) return true;
- }
- //if (MercCast("Hammer Shot", CT, HP < 70f)) Thread.Sleep(1000); ;
- if (CMCheckCompHealth()) { Thread.Sleep(500); if (MercCast("Hammer Shot")) return true; }
- if (MySpec == SkillTreeId.CommandoCombatMedic) if (IG && RS <= 50f) { MercCast("Hammer Shot"); return true; }
- if (!IG || MySpec != SkillTreeId.CommandoCombatMedic || (IG && RS > 50f))
- {
- if (MercCast("Concussion Charge", TD <= MeleeDist)) return true;
- if (MercCast("Blitz", TD <= MeleeDist)) return true;
- if (MercCast("Stockstrike", TD <= MeleeDist)) return true;
- if (MercFaceAndCast("Pulse Cannon", TD <= 1.0f)) return true;
- if (MercCastOnGround("Mortar Volley", RS >= 50f && TD >= .6f && (StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .60f) >= 3), CT)) return true;
- if (MercCast("Sticky Grenade")) return true;
- if (MercCast("High Impact Bolt", StrongOrGreater(CT))) return true;
- if (MercCast("Plasma Grenade", StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .50f) >= 3)) return true;
- if (MercCastOnGround("Hail of Bolts", BuddyTor.Me.ResourceStat > 50f && MobsInRangeOf(CT.Position, .60f) >= 3, CT, true)) return true;
- if (MercCast("Incendiary Round", StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .50f) >= 4)) return true;
- if (MercCast("Explosive Round", (TD <= MeleeDist && StrongOrGreater(CT)) || (Me.Level<10 && RS>=50f))) return true;
- if (MercCast("Grav Round", StrongOrGreater(CT))) return true;
- if (MercCast("Demolition Round", StrongOrGreater(CT) && CTDebuffs.Contains("Grav"))) return true;
- if (MercCast("Tech Override", StrongOrGreater(CT))) return true;
- if (MercCast("Charged Bolts", MyBuffs.Contains("Tech Override"))) return true;
- if (MercCast("Full Auto")) return true;
- if (MercCast("Charged Bolts")) return true;
- if (MercCast("Hammer Shot")) return true;
- }
- if (MercCast("Hammer Shot")) return true;
- return false;
- }
- public static bool SSCombat()
- {
- Thread.Sleep(200);
- WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- if (CT == null) { Logger.Write("No target. Exiting."); return false; }
- if (IG && !TargetInCombat()) return false;
- MercBuffSelf("Ion Cell", MySpec==SkillTreeId.VanguardShieldSpecialist);
- MercBuffSelf("Plasma Cell", MySpec==SkillTreeId.VanguardAssaultSpecialist);
- MoveTo(CT, 2.90f);
- StopMoving();
- if (!CT.InCombat) MercCast("Harpoon");
- if (HP <= 30f) UseMedPackInInventory();
- //Thread.Sleep(100);
- if (MercCast("Tenacity", BuddyTor.Me.IsStunned)) return true;
- if (MercCast("Reactive Shield", HP <= 50f)) return true;
- if (MercCast("Adrenaline Rush", HP <= 50f)) return true;
- if (MercCast("Recharge Cells", RS <= 6f)) return true;
- if (MercCast("Reserve Powercell", RS <= 6f)) return true;
- if (MercCast("Supercharge Cells")) return true;
- if (MercCast("Energy Blast", RS <= 8f)) return true;
- if (MercCast("Neural Jolt")) return true;
- if (!TargetInCombat()) return false;
- if (MercCast("Stockstrike", TD <= MeleeDist)) return true;
- if (MercCast("Explosive Surge", TWR5 >= 2)) return true;
- if (MercCastOnGround("Mortar Volley", TD >= .6f && (StrongOrGreater(CT) || TWR30 > 2), CT, true)) return true;
- if (MercCast("High Impact Bolt")) return true;
- if (MercFaceAndCast("Pulse Cannon", TD <= 1.0f)) return true;
- if (MercCast("Sticky Grenade")) return true;
- if (MercCast("Ion Pulse", TD <= 1.0f)) return true;
- if (MercCast("Battle Focus")) return true;
- if (MercCast("Full Auto")) return true;
- if (MercCast("Hammer Shot", HP < 50f && RS < 3f)) return true;
- if (MercCast("Concussive Round", HP < 50f)) { BuddyTor.Me.ClearTarget(); return true; }
- if (MercCast("Cryo Grenade", TC || TD <= 1.0f)) return true;
- if (MercCast("Disabling Shot", TC)) return true;
- if (!IG || (IG && RS > 40f))
- {
- if (MercCast("Blitz", TD <= MeleeDist)) return true;
- if (MercFaceAndCast("Pulse Cannon", TD <= 1.0f && RS>=50f)) return true;
- if (MercCast("Concussion Charge", TD <= MeleeDist)) return true;
- if (MercCast("Explosive Round", TD <= MeleeDist && !StrongOrGreater(CT))) return true;
- if (MercCast("Tech Override", StrongOrGreater(CT))) return true;
- if (MercCast("Charged Bolts", MyBuffs.Contains("Tech Override"))) return true;
- if (MercCast("Riot Gas", StrongOrGreater(CT))) return true; // Can be a bit buggy, moved it down here to try and alleviate that
- if (MercCast("Plasma Grenade", StrongOrGreater(CT))) return true;
- if (MercCast("Sticky Grenade")) return true;
- if (MercCastOnGround("Hail of Bolts", RS > 50f && MobsInRangeOf(CT.Position, 1.0f)>=3, CT, true)) return true;
- if (MercCast("Hammer Shot")) return true;
- }
- if (MercCast("Hammer Shot")) return true;
- return false;
- }
- public static bool HandleGuardingKinetic()
- {
- //if (!IG) return false;
- CheckForGuarding();
- if (NAUnit != null) try
- {
- CT = NAUnit;
- if (MercCast("Force Pull", NAUnit)) return true;
- if (MercCast("Mind Control", NAUnit)) return true;
- if (MercCast("Mass Mind Control", NAUnit, NAUnit.Distance <= 1.50f)) return true;
- //if (MercCast("Guard", NGUnit)) return true;
- }
- catch { }
- return false;
- }
- public static bool ShadowCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- MercBuffSelf("Combat Technique", MySpec==SkillTreeId.ShadowCombat);
- MercBuffSelf("Shadow Technique", MySpec == SkillTreeId.ShadowInfiltration);
- MercBuffSelf("Force Technique", MySpec == SkillTreeId.ShadowBalance);
- if (!TargetInCombat()) return false;
- if (!CT.InCombat && CT.HealthPercent > .2f)
- {
- MercBuffSelf("Stealth");
- while (CT.Distance > .15f) MoveTo(CT, .15f);
- if (MercCast("Shadow Strike", CT.Distance <= .20f)) if (MercCast("Double Strike")) return true;
- }
- MercCast("Force of Will", Me.IsStunned);
- if (IG) if (HandleGuardingKinetic()) return true;
- if (TD > 1.5f) if (MercCast("Force Pull")) return true;
- MoveTo(CT, MeleeDist, "Force Speed");
- if (MercCast("Mind Snap", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Mind Control", TC && StrongOrGreater(CT))) return true;
- if (HP <= 30) UseMedPackInInventory();
- if (MercCast("Kinetic Ward", HP < 80f)) return true;
- if (MercCast("Battle Readiness", HP <= 50f)) return true;
- if (MercCast("Force Potency", HP <= 50f)) return true;
- if (MercCast("Resilience", HP <= 50f)) return true;
- if (MercCast("Deflection", HP <= 50f)) return true;
- if (MercCast("Force Potency", HP <= 70f || (StrongOrGreater(CT) || TWR10 >= 3))) return true;
- if (MercCast("Force Breach", TD <= 1.0f && (StrongOrGreater(CT) || TWR10 >= 3))) return true;
- if (MercCastOnGround("Force in Balance",MobsInRangeOf(CT.Position,.80f)>=3,CT)) return true;
- if (MercCast("Slow Time", TWR10>=4 || StrongOrGreater(CT))) return true;
- if (MercCast("Force Wave", TWR10 >= 3)) return true;
- if (MercCast("Force Stun", StrongOrGreater(CT) && CTT <= CombatToughness.Boss1)) return true;
- if (MercCast("Sever Force", StrongOrGreater(CT))) return true;
- if (MercCast("Clairvoyant Strike", StrongOrGreater(CT))) return true;
- if (MercCast("Project", (RS > 45f && TD >= .6f) || MyBuffs.Contains("Clairvoyance"))) return true;
- if (MercCast("Telekinetic Throw", TD >= .6f && Me.ForcePercent <= 50f)) return true;
- if (MercCast("Tumult", TD <= MeleeDist)) return true;
- if (MercCast("Project", TD <= 1.0f && RS > 45f)) return true;
- if (MercCast("Double Strike", EP > 50f && TD <= MeleeDist)) return true;
- if (MercCast("Spinning Strike", THP <= 30f)) return true;
- if (MercCast("Mind Crush", StrongOrGreater(CT) && !CTDebuffs.Contains("Mind Crush") && THP >= 50)) return true;
- if (MercCast("Telekinetic Throw", TD <= 1.0f)) return true;
- if (MercCast("Force Slow", StrongOrGreater(CT))) return true;
- if (MercCast("Slow Time", !CTDebuffs.Contains("Slow Time (Force)"))) return true;
- if (MercCast("Force Breach", TWR10 >= 3)) return true;
- if (MercCast("Whirling Blow", TWR5 >= 3)) return true;
- if (MercCast("Project", RS > 45f)) return true;
- if (MercCast("Telekinetic Throw")) return true;
- MercCast("Saber Strike");
- return false;
- }
- public static bool SageKineticCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- if (!TargetInCombat()) return false;
- MercBuffSelf("Force Valor");
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (CT == null && Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (CT == null) { Logger.Write("No target. Exiting."); return false; }
- MoveTo(CT, 2.90f, "Force Speed");
- MercCast("Force of Will", Me.IsStunned);
- if (MercCast("Force Shield", Comp, Comp!=null && !Comp.HasBuff("Force Shield"))) return true;
- if (MercCast("Force Shield", Me, !MyBuffs.Contains("Force Shield"))) return true;
- if (MercCast("Project", RS > 45f && TD >= .6f)) return true;
- if (HP <= 30) UseMedPackInInventory();
- if (MercCast("Force Wave", TWR10 >= 2)) return true;
- //if (MercCast("Heroic Moment: Channel the Force", HP <= 40f)) return true;
- if (MercCast("Force Mend", Me, HP < 80f)) return true;
- if (MercCast("Benevolence", Me, HP < 80f)) return true;
- if (MercCast("Benevolence", Comp, CHP <= 70f)) return true;
- if (MercCast("Telekinetic Throw", TD >= .6f)) return true;
- if (TD > 1.5f) if (MercCast("Force Pull")) return true;
- if (MercCast("Mind Snap", TC)) return true;
- if (MercCast("Mind Control", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Force Wave", TWR10 >= 3)) return true;
- if (MercCast("Force Stun", StrongOrGreater(CT) && CTT <= CombatToughness.Boss1)) return true;
- if (!IG) foreach (TorCharacter u in Attackers) if (MercCast("Weaken Mind", u, !u.HasDebuff("Weaken Mind (Force)"))) WaitForCast();
- if (MercCast("Battle Readiness", HP <= 50f)) return true;
- if (MercCast("Force Potency", HP <= 50f)) return true;
- if (MercCast("Resilience", HP <= 50f)) return true;
- if (MercCast("Deflection", HP <= 50f)) return true;
- if (MercCast("Force Potency", HP <= 70f || (CTT >= CombatToughness.Boss1) || (TWR10 >= 3))) return true;
- if (MercCast("Force Breach", (TD <= 1.0f && StrongOrGreater(CT)) || TWR10 >= 3)) return true;
- if (MercCast("Force Wave", TWR10 >= 3)) return true;
- if (MercCast("Tumult", TD <= MeleeDist)) return true;
- if (MercCast("Spinning Strike", THP <= 30f)) return true;
- if (MercCast("Mind Crush", StrongOrGreater(CT) && !CTDebuffs.Contains("Mind Crush") && THP >= 50)) return true;
- if (MercCast("Project", TD <= 1.0f && RS > 45f)) return true;
- if (MercCast("Telekinetic Throw", TD <= 1.0f)) return true;
- if (MercCast("Force Slow", StrongOrGreater(CT))) return true;
- if (MercCast("Slow Time", !CTDebuffs.Contains("Slow Time (Force)"))) return true;
- if (MercCast("Force Breach", TWR10 >= 3)) return true;
- if (MercCast("Whirling Blow", TWR5 >= 3)) return true;
- if (MercCast("Project", RS > 45f)) return true;
- if (MercCast("Telekinetic Throw")) return true;
- if (MercCast("Double Strike", RS > 65f)) return true;
- if (MercCast("Saber Strike"))return true;
- return false;
- }
- public static void InfiltrationCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (CT == null && Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (CT == null) { Logger.Write("No target. Exiting."); return; }
- MoveTo(CT, 2.9f);
- if (!CT.InCombat && CT.HealthPercent > .2f)
- {
- MercCast("Stealth");
- while (CT.Distance > .15f) MoveTo(CT, .15f);
- if (MercCast("Shadow Strike", CT.Distance <= .20f)) if (MercCast("Double Strike")) return;
- }
- MercCast("Force of Will", Me.IsStunned);
- if (IG) if (HandleGuardingKinetic()) return;
- if (MercCast("Project", RS > 45f && TD >= .6f)) return;
- if (MercCast("Telekinetic Throw", TD >= .6f)) return;
- if (TD > 1.5f) if (MercCast("Force Pull")) return;
- MoveTo(CT, .490f, "Force Speed");
- if (MercCast("Mind Snap", TC)) return;
- if (MercCast("Mind Control", TC && StrongOrGreater(CT))) return;
- if (MercCast("Force Wave", TWR10 >= 3)) return;
- if (MercCast("Force Stun", StrongOrGreater(CT) && CTT <= CombatToughness.Boss1)) return;
- if (HP <= 30) UseMedPackInInventory();
- //if (MercCast("Heroic Moment: Channel the Force", HP <= 40f)) return;
- if (MercCast("Kinetic Ward", HP < 80f)) return;
- if (MercCast("Battle Readiness", HP <= 50f)) return;
- if (MercCast("Force Potency", HP <= 50f)) return;
- if (MercCast("Resilience", HP <= 50f)) return;
- if (MercCast("Deflection", HP <= 50f)) return;
- if (MercCast("Force Potency", HP <= 70f || (CTT >= CombatToughness.Boss1) || (TWR10 >= 3))) return;
- if (MercCast("Force Breach", (TD <= 1.0f && StrongOrGreater(CT)) || TWR10 >= 2)) return;
- if (MercCast("Force Wave", TWR10 >= 3)) return;
- if (MercCast("Tumult", TD <= MeleeDist)) return;
- if (MercCast("Spinning Strike", THP <= 30f)) return;
- if (MercCast("Mind Crush", StrongOrGreater(CT) && !CTDebuffs.Contains("Mind Crush") && THP >= 50)) return;
- if (MercCast("Project", TD <= 1.0f && RS > 45f)) return;
- if (MercCast("Telekinetic Throw", TD <= 1.0f)) return;
- if (MercCast("Force Slow", StrongOrGreater(CT))) return;
- if (MercCast("Slow Time", !CTDebuffs.Contains("Slow Time (Force)"))) return;
- if (MercCast("Force Breach", TWR10 >= 3)) return;
- if (MercCast("Whirling Blow", TWR10 >= 3)) return;
- if (MercCast("Project", RS > 45f)) return;
- if (MercCast("Telekinetic Throw")) return;
- if (MercCast("Whirling Blow", TWR5 >= 2)) return;
- if (MercCast("Double Strike", RS > 65f)) return;
- MercCast("Saber Strike");
- }
- public static void SniperMarksmanshipPull()
- {
- CT = Me.CurrentTarget;
- if (!TargetInCombat()) return;
- LoadVars();
- MoveTo(CT, 2.8f);
- //Me.CurrentTarget.Face();
- //Thread.Sleep(600);
- MercCast("Crouch");
- Thread.Sleep(600);
- MercCast("Ambush");
- return;
- }
- // Ops Medicine BLOWS, weak, WEAK, heals
- public static void MedicineCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(300);
- LoadVars();
- MercBuffSelf("Coordination");
- if (MercCast("Escape", Me.IsStunned)) return;
- if (MercCast("Heroic Moment: Advanced Recon", Me, HP <= 25)) return;
- if (MercCast("Evasion", Me, HP <= 30)) return;
- if (MercCast("Kolto Probe", Me, HP <= 70 && !MyBuffs.Contains("Kolto Probe"))) return;
- if (MercCast("Surgical Probe", HP <= 70 && MyBuffs.Contains("Tactical Advantage"))) return;
- if (MercCast("Kolto Injection", Me, HP <= 60)) return;
- if (MercCast("Kolto Infusion", Me, HP <= 70)) return;
- if (MercCast("Adrenaline Probe", EP <= 20)) return;
- if (MercCast("Stim Boost", EP <= 60 && MyBuffs.Contains("Tactical Advantage"))) return;
- if (IG) if (MedicineHeals(80)) return;
- if (!TargetInCombat()) return;
- MoveTo(CT, 2.80f);
- StopMoving();
- MercCast("Crouch", Me, !Me.IsCoverAffected);
- if (!CT.InCombat)
- {
- Thread.Sleep(600);
- MercCast("Snipe");
- }
- if (MercCast("Distraction", (IG && HP <= 50f) || (StrongOrGreater(CT) && TC))) return;
- if (MercCast("Flash Bang", TD <= MeleeDist)) return;
- if (MercCast("Carbine Burst", MyBuffs.Contains("Tactical Advantage") && StrongOrGreater(CT) && TD <= MeleeDist)) return;
- if (MercCast("Debilitate", StrongOrGreater(CT) && TC)) return;
- if (MercCast("Fragmentation Grenade", !IG && StrongOrGreater(CT) && TC)) return;
- //if (HP <= 70) MercCast("Rifle Shot"); // Force a Rifle-Shot on healing so we get at least a LITTLE DAMAGE in - may help with a Heals Catch-22
- if (MercCast("Eviscerate", TD <= MeleeDist)) return;
- if (MercCast("Shiv", TD <= MeleeDist)) return;
- if (MercCast("Sever Tendon", TD <= 1.0f)) return;
- if (MedicineCheckCompHealth()) return;
- if (MercCast("Rifle Shot", RS <= 30 && (StrongOrGreater(CT) || IG))) return;
- if (MercCast("Fragmentation Grenade", !IG)) return;
- if (MercCast("Explosive Probe")) return;
- if (MercCast("Corrosive Dart", !CTDebuffs.Contains("Poisoned (Tech)"))) return;
- if (MercCast("Flash Bang")) return;
- if (MercCast("Carbine Burst", TWR10 >= 3)) return;
- if (MercCast("Snipe")) return;
- if (MercCast("Rifle Shot")) return;
- }
- // Ops Medicine BLOWS, weak, WEAK, heals
- public static bool OperativeCombat()
- {
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- WaitForCast();
- LoadVars();
- if (!TargetInCombat()) return false;
- MercBuffSelf("Coordination");
- if (MercCast("Escape", Me.IsStunned)) return true;
- if (Me.IsStunned) return false;
- if (MercCast("Heroic Moment: Advanced Recon", Me, HP <= 25f)) ;
- if (MercCast("Unity", Me, HP <= 25f)) ;
- if (!CT.InCombat)
- {
- MercCast("Stealth", BuddyTor.Me);
- Thread.Sleep(800);
- MoveTo(CT, .20f);
- if (!MercCast("Hidden Strike")) if (!MercCast("Backstab")) MercCast("Shiv");
- }
- MoveTo(CT, MySpec == SkillTreeId.OperativeMedic && IG ? 2.8f : MeleeDist, "Explosive Probe", "Fragmentation Grenade", "Rifle Shot");
- //if (!CT.InCombat && MySpec != SkillTreeId.OperativeMedic)
- if (MercBuffSelf("Crouch")) Thread.Sleep(800);
- if (MercBuffSelf("Shield Probe")) Thread.Sleep(800);
- if (Comp != null) try
- {
- if (MercCast("Toxin Scan", Comp, CHP <= 70f && Comp.Debuffs.Count() >= 2)) return true;
- if (MercCast("Kolto Infusion", Comp, CHP <= 70f && MyBuffs.Contains("Tactical Advantage"))) return true;
- if (MercCast("Kolto Injection", Comp, CHP <= 70f)) return true;
- }
- catch { }
- if (MercCast("Adrenaline Probe", EP <= 20f)) ;
- if (HP < 70f)
- {
- if (HP <= 30) UseMedPackInInventory();
- if (MercCast("Rifle Shot")) { Thread.Sleep(900); WaitForCast(); }
- if (MercCast("Recuperative Nanotech", Me));
- if (MercCast("Recuperative Nanotech", Me));
- if (MercCast("Distraction", HP<=40f));
- if (MercCast("Toxin Scan", Me, HP <= 70f && NeedsDispell(Me))) return true;
- if (MercCast("Stim Boost", EP <= 60f && MyBuffs.Contains("Tactical Advantage"))) ;
- if (MercCast("Evasion", Me, HP <= 30f)) ;
- if (MercCast("Countermeasures", Me, HP <= 50f)) return true;
- if (MercCast("Kolto Injection", Me, HP <= 60f)) ;
- if (MercCast("Kolto Probe", Me, HP <= 70f && !MyBuffs.Contains("Kolto Probe"))) ;
- if (MercCast("Surgical Probe", HP <= 70f && MyBuffs.Contains("Tactical Advantage"))) ;
- if (MercCast("Kolto Infusion", Me, HP <= 70f)) ;
- }
- if (MercCast("Distraction", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Flash Bang", TC && StrongOrGreater(CT))) return true;
- //if (MercCast("Shield Probe", Me, HP <= 70f)) return true;
- if (TWR10 >= 3)
- {
- if (MercCast("Explosive Probe")) return true;
- if (MercCast("Fragmentation Grenade")) return true;
- }
- for (int i = 0; i < (Is55H ? 3 : 1); i++) if (IG && MySpec == SkillTreeId.OperativeMedic) MedicineHeals(MySpec == SkillTreeId.OperativeMedic ? 85 : 60);
- if (MercCast("Corrosive Grenade", !CTDebuffs.Contains("Poisoned (Tech)"))) return true;
- foreach (TorCharacter u in Attackers) if (MercCast("Corrosive Dart", u, !u.HasDebuff("Poisoned (Tech)"))) { Thread.Sleep(800); break; }
- if (MySpec == SkillTreeId.OperativeMedic && IG && RS <= 70) { MercCast("Rifle Shot"); return true; }
- if (MercCast("Explosive Probe")) return true;
- if (MercCast("Shiv", TD <= MeleeDist)) return true;
- if (MercCast("Backstab", TD <= MeleeDist)) return true;
- if (MercCast("Laceration", TD <= MeleeDist)) return true;
- if (MercCast("Fragmentation Grenade")) return true;
- if (MercCast("Debilitate", TD <= MeleeDist && StrongOrGreater(CT))) return true;
- if (MercFaceAndCast("Carbine Burst", TD <= 1.0f && (TWR10 >= 3 || StrongOrGreater(CT)))) return true;
- if (MercCast("Cull", TD <= 1.0f)) return true;
- if (MercCast("Sever Tendon", TD <= 1.0f && !CTDebuffs.Contains("Slowed (Tech)"))) return true;
- if (MercCast("Snipe")) return true;
- if (MercCast("Rifle Shot")) return true;
- return false;
- }
- public static void ConcealmentCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(100);
- LoadVars();
- if (!TargetInCombat()) return;
- MercBuffSelf("Coordination");
- MoveTo(CT, 2.8f);
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (CT == null && Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (CT == null) { Logger.Write("No target. Exiting."); return; }
- if (CT == Comp) { BuddyTor.Me.ClearTarget(); return; }
- if (!CT.InCombat && CT.HealthPercent > .2f)
- {
- MercCast("Stealth");
- while (CT.Distance > .15f) MoveTo(CT, .15f);
- MercCast("Acid Blade");
- MercCast("Ambush", CT.Distance <= .20f);
- MercCast("Backstab", CT.Distance <= .20f);
- }
- if (MercCast("Escape", Me.IsStunned)) return;
- MercCast("Crouch", Me, !MyBuffs.Contains("Crouch"));
- MoveTo(CT, MeleeDist, "Rifle Shot");
- if (MercCast("Acid Blade", !CTDebuffs.Contains("Acid Blade"))) return;
- if (MercCast("Followthrough")) return;
- if (MercCast("Takedown")) return;
- if (MercCast("Headshot")) return;
- if (MercCast("Shattershot")) return;
- //if (HP <= 70) MercCast("Rifle Shot"); // Force a Rifle-Shot on healing so we get at least a LITTLE DAMAGE in - may help with a Heals Catch-22
- if (MercCast("Shield Probe", Me, !MyBuffs.Contains("Shield Probe"))) return;
- if (MercCast("Heroic Moment: Advanced Recon", Me, HP <= 25)) return;
- //if (MercCast("Evasion", Me, HP <= 30)) return;
- //if (MercCast("Kolto Probe", Me, HP <= 70 && !MyBuffs.Contains("Kolto Probe"))) return;
- //if (MercCast("Surgical Probe", HP <= 70 && MyBuffs.Contains("Tactical Advantage"))) return;
- if (MercCast("Kolto Injection", Me, HP <= 60)) return;
- if (MercCast("Kolto Infusion", Me, HP <= 70)) return;
- if (MercCast("Adrenaline Probe", EP <= 20)) return;
- if (MercCast("Stim Boost", EP <= 60 && MyBuffs.Contains("Tactical Advantage"))) return;
- if (MercCast("Stim Boost", Me, RS <= 20)) return;
- if (MercCast("Fragmentation Grenade", !IG)) return;
- if (TD <= MeleeDist)
- {
- if (MercCast("Orbital Strike", EliteOrGreater(CT))) return;
- if (MercCast("Shiv")) return;
- if (MercCast("Lacerate", MyBuffs.Contains("Tactical Advantage"))) return;
- if (MercCast("Carbine Burst", MyBuffs.Contains("Tactical Advantage") && StrongOrGreater(CT))) return;
- if (MercCast("Eviscerate")) return;
- if (MercCast("Sever Tendon")) return;
- }
- if (MercCast("Distraction", (IG && HP <= 50) || (StrongOrGreater(CT) && TC))) return;
- if (MercCast("Flash Bang", TD <= MeleeDist)) return;
- if (MercCast("Debilitate", StrongOrGreater(CT) && TC)) return;
- if (MercCast("Fragmentation Grenade", !IG && StrongOrGreater(CT) && TC)) return;
- if (MercCast("Cull", MyBuffs.Contains("Tactical Advantage") && TWR10 >= 2)) return;
- if (MedicineCheckCompHealth()) return;
- if (MercCast("Rifle Shot", RS <= 30 && (StrongOrGreater(CT) || IG))) return;
- if (MercCast("Corrosive Grenade")) return;
- if (MercCast("Debilitate", StrongOrGreater(CT))) return;
- if (MercCast("Headshot", CT.IsStunned)) return;
- if (MercCast("Explosive Probe")) return;
- if (MercCast("Weakening Blast")) return;
- if (MercCast("Corrosive Dart", !CTDebuffs.Contains("Poisoned (Tech)"))) return;
- if (MercCast("Flash Bang")) return;
- if (MercCast("Carbine Burst", TWR10 >= 3)) return;
- if (MercCast("Snipe")) return;
- if (MercCast("Rifle Shot")) return;
- }
- public static bool ScrapperCombat()
- {
- if (Me.HealthPercent < .2f || Me.IsDead) return false;
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- if (!TargetInCombat()) return false;
- //if (!PvP) if(!CT.InCombat) if (TD > 1.50f) if (!Buddy.CommonBot.Blacklist.Contains(CT.Guid)) { Buddy.CommonBot.Blacklist.Add(CT.Guid,BlacklistFlags.Kill,TimeSpan.FromSeconds(120)); return; }
- MercBuffSelf("Lucky Shots");
- MoveTo(CT, 2.8f);
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (CT == null && Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (CT == null) { Logger.Write("No target. Exiting."); return false; }
- if (CT == Comp) { BuddyTor.Me.ClearTarget(); return false; }
- if (MercCast("Crouch", Me, !MyBuffs.Contains("Crouch"))) Thread.Sleep(500);
- if (TD > 3.0f || !CT.InLineOfSight) return false;
- //MoveTo(CT, MeleeDist,"Sabotage Charge", "Thermal Grenade","Flurry of Bolts");
- if (MercCast("Escape", Me.IsStunned)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Flash Grenade", TD <= 1.0f && TC)) return true;
- if (MercCast("Dirty Kick", TD <= MeleeDist && TC)) return true;
- if (MercCast("Tranquilizer", TD <= 1.0f && TC)) return true;
- if (MercCast("Pugnacity", Me, HP <= 50f || CHP <= 50f)) return true;
- if (MercCast("Shield Probe", Me, HP <= 70f)) return true;
- if (MercCast("Countermeasures", Me, HP <= 60f)) return true;
- if (MercCast("Stim Boost", Me, HP <= 60f)) return true;
- if (MercCast("Adrenaline Probe", Me, EP <= 20f)) return true;
- if (MercCast("Cool Head", RS <= 30f)) return true;
- if (MercCast("Evasion", Me, EP <= 50f)) return true;
- if (MyBuffs.Contains("Upper Hand"))
- {
- if (MercCast("Kolto Pack", Me, HP <= 70f)) return true;
- if (MercCast("Kolto Pack", Comp, CHP <= 70f)) return true;
- if (MercCast("Pugnacity", RS <= 20f)) return true;
- }
- if (MercCast("Kolto Infusion", Me, HP <= 70f)) return true;
- if (MercCast("Underworld Medicine", Me, HP <= 50f)) return true;
- if (MercCast("Underworld Medicine", Comp, CHP <= 50f)) return true;
- if (MercCastOnGround("XS Freighter Flyby", CT.Toughness >= CombatToughness.Boss1, CT)) return true;
- if (!IG) foreach (TorCharacter u in Attackers) if (MercCast("Corrosive Dart", u, !u.HasDebuff("Poisoned (Tech)"))) WaitForCast();
- if (MercCast("Vital Shot", !CTDebuffs.Contains("Bleeding (Tech"))) return true;
- if (MercCast("Sucker Punch", TD <= 1.0f)) return true;
- if (MercCast("Carbine Burst", TD <= 1.0f)) return true;
- if (MercCast("Tendon Blast", TD <= 1.0f)) return true;
- if (MercCast("Back Blast", CT.IsFacing && TD<=1.0f)) return true;
- if (MercCast("Carbine Burst", TWR10>=2)) return true;
- if (TD <= MeleeDist)
- {
- if (MercCast("Blaster Whip")) return true;
- if (MercCast("Blaster Volley")) return true;
- if (MercCastOnGround("Flurrry of Bolts", TWR10 >= 3, CT)) return true;
- if (MercCast("Sucker Punch")) return true;
- if (MercCast("Dirty Kick")) return true;
- if (MercCast("Back Blast")) return true;
- }
- if (MercCast("Vital Shot", StrongOrGreater(CT) && !CTDebuffs.Contains("Bleeding (Tech)"))) return true;
- if (MercCast("Thermal Grenade")) return true;
- if (MercCast("Sabotage Charge")) return true;
- if (MercCastOnGround("Flurrry of Bolts", TWR30 >= 3, CT)) return true;
- if (MercCast("Aimed Shot")) return true;
- if (MercCast("Charged Burst")) return true;
- if (MercCast("Quick Shot")) return true;
- if (MercCast("Flurry of Bolts")) return true;
- return false;
- }
- public static bool GunslingerCombat()
- {
- //if (Me.HealthPercent < .2f || Me.IsDead) return false;
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- if (!TargetInCombat()) return false;
- //if (!PvP) if(!CT.InCombat) if (TD > 1.50f) if (!Buddy.CommonBot.Blacklist.Contains(CT.Guid)) { Buddy.CommonBot.Blacklist.Add(CT.Guid,BlacklistFlags.Kill,TimeSpan.FromSeconds(120)); return; }
- MercBuffSelf("Lucky Shots");
- if (!TargetInCombat()) return false;
- MoveTo(CT, MySpec == SkillTreeId.GunslingerDirtyFighting ? MeleeDist : 2.8f);
- StopMoving();
- if (MercCast("Crouch", Me, !MyBuffs.Contains("Crouch"))) Thread.Sleep(800);
- if (!CT.InLineOfSight) { Movement.Move(MovementDirection.Forward, TimeSpan.FromMilliseconds(500)); MercCast("Crouch", Me, !MyBuffs.Contains("Crouch")); }
- //if (TD > 3.0f || !CT.InLineOfSight) return false;
- //MoveTo(CT, MeleeDist,"Sabotage Charge", "Thermal Grenade","Flurry of Bolts");
- if (MercCast("Escape", Me.IsStunned)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Flash Grenade", StrongOrGreater(CT) && TC)) return true;
- if (MercCast("Distraction", StrongOrGreater(CT) && TC)) return true;
- if (MercCast("Leg Shot", StrongOrGreater(CT) && TC)) return true;
- if (MercCast("Dirty Kick", TD <= MeleeDist && StrongOrGreater(CT) && TC)) return true;
- if (MercCast("Tranquilizer", StrongOrGreater(CT) && TC)) return true;
- if (MercCast("Cool Head", Me, RS <= 30f)) return true;
- if (MercCast("Pugnacity", RS <= 20f)) return true;
- if (HP <= 70f)
- {
- if (MercCast("Pugnacity", Me, HP <= 50f || CHP <= 50f)) return true;
- if (MercCast("Shield Probe", Me, HP <= 70f)) return true;
- if (MercCast("Countermeasures", Me, HP <= 60f)) return true;
- if (MercCast("Stim Boost", Me, HP <= 60f)) return true;
- if (MercCast("Adrenaline Probe", Me, EP <= 20f)) return true;
- if (MercCast("Evasion", Me, EP <= 50f)) return true;
- }
- if (!CT.InCombat && !IG) if (MercCast("Aimed Shot")) return true;
- if (MercCast("Quickdraw")) return true;
- if (MercCast("Sabotage Charge")) return true;
- if (MercCast("Thermal Grenade")) return true;
- if (MercCastOnGround("XS Freighter Flyby", CT.Toughness >= CombatToughness.Boss1, CT)) return true;
- if (MercCast("Smuggler's Luck", StrongOrGreater(CT))) return true;
- if (MercCast("Charged Burst", StrongOrGreater(CT) && MyBuffs.Contains("Smuggler's Luck"))) return true;
- if (MercCastOnGround("Sweepging Gunfire", MobsInRangeOf(CT.Position, .50f) >= 3, CT)) return true;
- //if (!IG) foreach (TorCharacter u in Attackers) if (MercCast("Corrosive Dart", u, !u.HasDebuff("Poisoned (Tech)"))) WaitForCast();
- if (MercCast("Vital Shot", StrongOrGreater(CT) && !CTDebuffs.Contains("Bleeding (Tech)"))) return true;
- //if (MercCast("Flash Grenade", StrongOrGreater(CT))) return true;
- if (TD <= 1.0f)
- {
- if (MercCast("Blaster Whip")) return true;
- if (MercCast("Dirty Kick")) return true;
- if (MercCast("Pulse Detonator", TWR10 >= 2)) return true;
- if (MercCast("Sucker Punch", TD <= 1.0f)) return true;
- if (MercCast("Carbine Burst", TWR10 >= 2)) return true;
- if (MercCast("Tendon Blast", TD <= 1.0f)) return true;
- if (MercCast("Blaster Volley")) return true;
- if (MercCastOnGround("Sweepging Gunfire", TWR10 >= 3, CT)) return true;
- if (MercCast("Back Blast")) return true;
- }
- if (MercCast("Aimed Shot")) return true;
- if (MercCast("Charged Burst")) return true;
- if (MercCast("Quick Shot")) return true;
- if (MercCast("Flurry of Bolts")) return true;
- return false;
- }
- public static void ScoundrelCheckCompHealth(float MinHealth)
- {
- try
- {
- var CompX = Comp;
- if (CompX == null) return;
- if (CompX.HealthPercent <= MinHealth && !CompX.IsDead)
- {
- CompX.Target();
- Thread.Sleep(350);
- CompX.Target();
- Thread.Sleep(350);
- if (MercCast("Toxin Scan", Comp, CHP <= 70f && Comp.Debuffs.Count() >= 2)) Thread.Sleep(800);
- if (MercCast("Triage", Comp, CHP <= 70f && Comp.Debuffs.Count() >= 2)) Thread.Sleep(800);
- if (!MercCast("Kolto Pack", CompX))
- if (!MercCast("Emergency Medpac", CompX))
- if (!MercCast("Slow-release Medpac", CompX, !CompX.HasBuff("Slow-release Medpac")))
- if (!MercCast("Underworld Medicine", CompX)) ;
- Thread.Sleep(300);
- WaitForCast();
- Me.ClearTarget();
- Thread.Sleep(150);
- }
- }
- catch { }
- }
- public static bool SawbonesHeals(float MinHealth)
- {
- GetGroupLHUnitInfo(MinHealth);
- if (LHUnit == null) return false;
- while (true)
- {
- MoveTo(LHUnit, 2.90f);
- if (!LHUnit.InLineOfSight || LHUnit.Distance > 3.0f) break;
- Thread.Sleep(250);
- WaitForCast();
- LHUnit.Target();
- Thread.Sleep(350);
- LHUnit.Target();
- Thread.Sleep(350);
- MercCast("Kolto Cloud", LHUnit);
- MercCastOnGround("Kolto Cloud",true, LHUnit);
- if (MercCast("Toxin Scan", Comp, CHP <= 70f && Comp.Debuffs.Count() >= 2)) Thread.Sleep(800);
- MercCast("Emergency Medpac", LHUnit);
- MercCast("Kolto Pack", LHUnit, !LHUnit.HasBuff("Kolto Pack"));
- MercCast("Slow-release Medpac", LHUnit, !LHUnit.HasBuff("Slow-release Medpac"));
- MercCast("Underworld Medicine", LHUnit);
- MercCast("Diagnostic Scan", LHUnit);
- Thread.Sleep(300);
- WaitForCast();
- GetGroupLHUnitInfo(MinHealth);
- if (LHUnit == null) break;
- }
- Me.ClearTarget();
- var pt = GetGroupTarget();
- if (pt != null && pt.Toughness != CombatToughness.Player) pt.Target();
- Thread.Sleep(200);
- return false;
- }
- public static bool ScoundrelCombat()
- {
- Thread.Sleep(200);
- WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- if (!TargetInCombat()) return false;
- if (!CT.InCombat)
- {
- if (MercBuffSelf("Stealth")) Thread.Sleep(800);
- while (CT.Distance > .20f) MoveTo(CT, .20f);
- if (MercCast("Shoot First")) Thread.Sleep(800);
- if (MercCast("Back Blast")) Thread.Sleep(800);
- if (MercCast("Dirty Kick")) Thread.Sleep(800);
- if (MercCast("Blaster Whip")) Thread.Sleep(800);
- }
- MoveTo(CT, IG && MySpec == SkillTreeId.ScoundrelSawbones ? 2.8f : MeleeDist, "Sabotage Charge", "Thermal Grenade", "Flurry of Bolts");
- MercBuffSelf("Crouch");
- if (HP <= 70f)
- {
- if (HP < 30) UseMedPackInInventory();
- if (MercCast("Flurry of Bolts")) Thread.Sleep(800);
- if (MercBuffSelf("Slow-release Medpac")) return true;
- if (MercBuffSelf("Kolto Pack")) return true;
- if (MercCast("Stim Boost", Me, EP <= 20f)) return true;
- if (MercCast("Kolto Pack", Me, HP <= 70f && MyBuffs.Contains("Upper Hand"))) return true;
- if (MercCast("Dodge", Me, HP <= 50f)) return true;
- if (MercCast("Surrender", Me, HP <= 50f)) return true;
- if (MercCast("Countermeasures", Me, RS <= 60f)) return true;
- if (MercCast("Shield Probe", Me, RS <= 70f)) return true;
- if (MercCast("Defense Screen", Me, HP <= 70f)) return true;
- if (MercCast("Underworld Medicine", Me, HP <= 70f)) return true;
- }
- ScoundrelCheckCompHealth(MySpec == SkillTreeId.ScoundrelSawbones ? 85f : 60f);
- if (IG) for (int i = 0; i < (Is55H ? 3 : 1); i++) SawbonesHeals(Is55H ? 85f : 60f);
- //if (!PvP) if(!CT.InCombat) if (TD > 1.50f) if (!Buddy.CommonBot.Blacklist.Contains(CT.Guid)) { Buddy.CommonBot.Blacklist.Add(CT.Guid,BlacklistFlags.Kill,TimeSpan.FromSeconds(120)); return; }
- MercBuffSelf("Lucky Shots");
- if (MercCast("Distraction", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Transquilizer", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Dirty Kick", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Slice Droid", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Shrap Bomb", !CTDebuffs.Contains("Bleeding"))) return true;
- if (MercCast("Thermal Grenade")) return true;
- if (MercCast("Sabotage Charge")) return true;
- if (MercCast("Escape", Me.IsStunned)) return true;
- if (TD > 3.0f || !CT.InLineOfSight) return true;
- //MoveTo(CT, MeleeDist);
- if (MercCast("Cool Head", Me, RS <= 20f)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (MyBuffs.Contains("Upper Hand"))
- {
- //if (MercCast("Kolto Pack", Comp, CHP <= 70f)) return true;
- if (MercCast("Pugnacity", StrongOrGreater(CT) || HP <= 70f)) return true;
- if (MercFaceAndCast("Blaster Volley", TD <= 1.0f && (StrongOrGreater(CT)))) return true;
- if (MercCast("Cull")) return true;
- if (MercCast("Carbine Burst", TD<=1.0f)) return true;
- }
- if (TD <= MeleeDist)
- {
- if (MercCast("Debilitate", StrongOrGreater(CT))) return true;
- if (MercCast("Shiv")) return true;
- if (MercCast("Back Blast")) return true;
- if (MercCast("Dirty Kick")) return true;
- if (MercCast("Sever Tendon")) return true;
- if (MercCast("Blaster Whip")) return true;
- if (MercCast("Sucker Punch")) return true;
- }
- if (MercCast("Vital Shot", !CTDebuffs.Contains("Vital Shot"))) return true;
- if (MercCast("Flash Grenade", TWR10 >= 2 || StrongOrGreater(CT))) return true;
- if (MercCast("Sabotage Charge")) return true;
- if (MercCast("Charged Burst")) return true;
- if (MercCast("Thermal Grenade")) return true;
- if (MercCast("Quickdraw")) return true;
- if (MercCast("Quick Shot")) return true;
- if (MercCast("Sweeping Gunfire", MobsInRangeOf(CT.Position, MeleeDist)>=2)) return true;
- if (MercCastOnGround("XS Freighter Flyby", MobsInRangeOf(CT.Position, .80f)>=3 || StrongOrGreater(CT), CT)) return true;
- if (MercCast("Flurry of Bolts")) return true;
- return false;
- }
- public static bool SniperCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- //using (BuddyTor.Memory.AcquireFrame()) { }
- //StopMoving();
- Thread.Sleep(300);
- LoadVars();
- //if (!ValidTarget()) return false;
- MercBuffSelf("Coordination");
- //MoveTo(CT, MySpec==SkillTreeId.SniperLethality?MeleeDist:2.80f);
- //if (!IG) if (CTT >= CombatToughness.Boss1) MoveIfNec(9.90f); else MoveIfNec();
- //if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (CT == null && Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (CT == null) { Logger.Write("No target. Exiting."); return false; }
- MoveTo(CT, 2.80f);
- if (!TargetInCombat()) return false;
- if (MercCast("Crouch", Me, !MyBuffs.Contains("Crouch")))Thread.Sleep(1000);
- if (!CT.InCombat)
- {
- if (MercCast("Orbital Strike", MobsInRangeOf(CT.Position, .80f)>=4)) Thread.Sleep(850);
- if (MercCast("Ambush")) Thread.Sleep(850);
- if (MercCast("Followthrough")) Thread.Sleep(850);
- if (MercCast("Snipe")) Thread.Sleep(850);
- if (MercCast("Followthrough")) Thread.Sleep(850);
- if (MercCast("Explosive Probe")) Thread.Sleep(850);
- if (MercCast("Fragmentation Grenade")) Thread.Sleep(850);
- return true;
- }
- if (StrongOrGreater(CT) && TC)
- {
- if (MercCast("Flash Bang")) return true;
- if (MercCast("Debilitate")) return true;
- if (MercCast("Distraction")) return true;
- if (MercCast("Leg Shot")) return true;
- }
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Adrenaline Probe", RS <= 20)) return true;
- if (MercCast("Shatter Shot", StrongOrGreater(CT) && !CTDebuffs.Contains("Armor Reduced (Physical)"))) return true;
- if (MercCast("Diversion", HP <= 70f && StrongOrGreater(CT) && TC)) return true;
- if (MercCast("EMP Discharge", HP <= 50f)) return true;
- if (MercCast("Shield Probe", !MyBuffs.Contains("Shield Probe"))) return true;
- if (MercCast("Entrench", HP <= 70f)) return true;
- if (MercCast("Ballistic Shield", HP <= 50f)) return true;
- if (MercCast("Takedown")) return true;
- if (MercCast("Headshot", CT.IsStunned)) return true;
- if (MercCast("Followthrough")) return true;
- if (MercCast("Cull")) return true;
- if (MercCast("Explosive Probe")) return true;
- if (MercCast("Snapshot", MyBuffs.Contains("Snap Shot"))) return true;
- if (MercCastOnGround("Suppressive Fire", MobsInRangeOf(CT.Position, .5f) >= 3, CT)) return true;
- if (TD <= MeleeDist)
- {
- if (MercCast("Cover Pulse")) return true;
- if (MercCast("Flash Bang")) return true;
- if (MercCast("Shiv")) return true;
- if (MercCast("Eviscerate")) return true;
- if (MercCast("Ambush")) return true;
- }
- //if (UseMarksSurvRot)
- //{
- // if (MercCast("Takedown")) return true;
- // if (MercCast("Headshot")) return true;
- // if (MercCast("Followthrough")) return true;
- // if (MercCast("Evasion", HP <= 30f)) return true;
- // if (MercCast("Shield Probe", HP <= 75f)) return true;
- // if (MercCast("Countermeasures", MyBuffs.Contains("Shield Probe"))) return true;
- // if (MercCast("Cover Pulse", TD <= MeleeDist)) return true;
- // if (MercCast("Target Acquired", StrongOrGreater(CT) && THP >= 50f)) return true;
- // if (MercCast("Laze Target", StrongOrGreater(CT) && THP >= 50f)) return true;
- // if (MercCast("Adrenaline Probe", RS <= 50f)) return true;
- // if (MercCast("Sniper Volley", HP <= 50f || RS <= 40f)) return true;
- // if (MercCastOnGround("Orbital Strike", CTT >= CombatToughness.Boss1 && THP >= 30f, CT)) return true;
- // if (MercCast("Fragmentation Grenade", TWR30 >= 3)) return true;
- // if (MercCast("Distraction", TC && StrongOrGreater(CT))) return true;
- // if (MercCast("Flash Bang", TWR5 >= 2)) return true;
- // if (MercCast("Debilitate", TC)) return true;
- // if (MercCast("Shiv", TD <= MeleeDist)) return true;
- // if (MercCast("Eviscerate", TD <= MeleeDist)) return true;
- // if (MercCast("Snipe", MyBuffs.Contains("Snap Shot"))) return true;
- // if (MercCast("Shatter Shot", !CTDebuffs.Contains("Armor Reduced (Physical)") && StrongOrGreater(CT))) return true;
- // if (MercCast("Takedown")) return true;
- // if (MercCast("Ambush", MyBuffs.Contains("Reactive Shot"))) return true;
- // if (MercCast("Followthrough")) return true;
- // if (MercCast("Series of Shots")) return true;
- // if (MercCast("Ambush", MyBuffs.Contains("Followthrough"))) return true;
- // if (MercCast("Snipe", MyBuffs.Contains("Followthrough"))) return true;
- // if (MercCast("Snipe", MyBuffs.Contains("Laze Target"))) return true;
- // if (MercCast("Headshot")) return true;
- // if (MercCast("Explosive Probe", StrongOrGreater(CT))) return true;
- // if (MercCast("Corrosive Dart", !CTDebuffs.Contains("Poisoned (Tech)") && StrongOrGreater(CT))) return true;
- // if (MercCast("Ambush")) return true;
- // if (MercCast("Snipe")) return true;
- // if (MercCast("Rifle Shot")) return true;
- //}
- //else
- //{
- if (MercCastOnGround("Orbital Strike", !CT.CombatMoving && EliteOrGreater(CT), CT)) return true;
- if (MercCast("Interrogation Probe", StrongOrGreater(CT) && !CTDebuffs.Contains("Interrogation Probe"))) return true;
- if (MercCast("Sniper Volley", StrongOrGreater(CT))) return true;
- if (MercCast("Series of Shots", StrongOrGreater(CT))) return true;
- if (MercCast("Weakening Blast", StrongOrGreater(CT))) return true;
- if (MercCast("Plasma Probe", MobsInRangeOf(CT.Position, .50f) >= 2)) return true;
- if (MercCast("Corrosive Grenade", MobsInRangeOf(CT.Position, .50f) >= 2) && !CTDebuffs.Contains("Poison")) return true;
- if (MercCast("Ambush", StrongOrGreater(CT))) return true;
- if (MercCast("Fragmentation Grenade")) return true;
- if (MercCast("Explosive Probe")) return true;
- if (MercCastOnGround("Suppressive Fire", MobsInRangeOf(CT.Position, .50f) >= 3, CT)) return true;
- if (!IG) foreach (TorCharacter u in Attackers) if (MercCast("Corrosive Dart", u, !u.HasDebuff("Poisoned (Tech)"))) WaitForCast();
- //if (MercCast("Corrosive Dart", !CTDebuffs.Contains("Poisoned (Tech)"))) return true;
- if (MercCast("Sniper Volley", HP <= 50 || RS <= 20 || StrongOrGreater(CT))) return true;
- if (MercCast("Laze Target", StrongOrGreater(CT) && THP >= 50f)) return true;
- if (MercCast("Target Acquired", StrongOrGreater(CT) && THP >= 50f)) return true;
- if (MercCast("Debilitate", StrongOrGreater(CT))) return true;
- if (MercCast("Leg Shot", StrongOrGreater(CT))) return true;
- if (MercCast("Snipe", StrongOrGreater(CT))) return true;
- if (MercCast("Snipe", CTDebuffs.Contains("Laze Target"))) return true;
- if (MercCast("Series of Shots")) return true;
- if (MercCast("Ambush")) return true;
- if (MercCast("Snipe")) return true;
- if (MercCast("Rifle Shot")) return true;
- //}
- ////Logger.Write(RS.ToString("0.0") + " Forced Cast: Rifle Shot");
- ////Buddy.CommonBot.AbilityManager.Cast("Rifle Shot", CT);
- return false;
- }
- public static bool MarauderAnnihilationCombat()
- {
- //WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(100);
- LoadVars();
- if (!TargetInCombat()) return false;
- if (MercCast("Juyo Form", !MyBuffs.Contains("Juyo Form"))) return true;
- if (MercCast("Unnatural Might", Me, !MyBuffs.Contains("Unnatural Might"))) return true;
- MoveTo(CT, (float)(.490/Math.Min(1,CT.Scale)), "Force Charge", "Deadly Throw", "Dual Saber Throw", "Force Scream");
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- //Thread.Sleep(100);
- if (MercCast("Unleash", BuddyTor.Me.IsStunned)) return true;
- if (MercCast("Disruption", TC)) return true;
- if (MercCast("Saber Ward", Me, HP <= 50f)) return true;
- if (MercCast("Undying Rage", Me, HP <= 20f)) return true;
- if (MercCast("Berserk", Me, MyBuffs.Contains("Fury") && HP <= 70)) return true;
- if (MercCast("Pommel Strike", CT.IsStunned)) return true;
- if (MercCast("Rupture")) return true;
- if (MercCast("Deadly Saber")) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Annihilate")) return true;
- if (MercCast("Ravage")) return true;
- if (MercCast("Retaliation")) return true;
- if (MercCast("Force Scream")) return true;
- if (MercCast("Vicious Slash")) return true;
- if (MercCast("Smash", TWR5 >= 2)) return true;
- if (MercCast("Intimidating Roar", TWR5 >= 4)) return true;
- if (HP <= 80f)
- {
- if (MercCast("Frenzy", Me, !MyBuffs.Contains("Fury"))) return true;
- if (MercCast("Cloak of Pain", Me)) return true;
- if (MercCast("Obfuscate")) return true;
- if (MercCast("Intimidating Roar")) return true;
- if (MercCast("Deadly Throw")) return true;
- if (MercCast("Force Choke", HP >= 40f)) return true;
- }
- if (MercCast("Bloodthirst", Me)) return true;
- if (MercCast("Smash", TWR5 >= 2)) return true;
- if (MercCast("Force Scream")) return true;
- if (MercCast("Annihilate")) return true;
- if (MercCast("Sweeping Slash", TWR10 >= 4)) return true;
- if (MercCast("Battering Assault")) return true;
- if (MercCast("Vicious Throw", THP <= 30f)) return true;
- if (MercCast("Assault")) return true;
- return false;
- }
- // For Hybrid Trees - Covers It ALL
- public static bool MarauderCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- //Thread.Sleep(450);
- LoadVars();
- MoveTo(CT, MeleeDist);
- StopMoving();
- if (!TargetInCombat()) return false;
- if (MercBuffSelf("Ataru Form", MySpec==SkillTreeId.MarauderCarnage)) return true;
- if (MercBuffSelf("Juyo Form", MySpec == SkillTreeId.MarauderAnnihilation)) return true;
- if (MercBuffSelf("Shii-Cho Form", MySpec == SkillTreeId.MarauderRage)) return true;
- if (MercCast("Unnatural Might", Me, !MyBuffs.Contains("Unnatural Might"))) return true;
- //MoveTo(CT, 2.8f);
- if (MercCast("Predation", TD >= 1.5f)) return true;
- if (MercCast("Force Charge", TD >= 1.0f && TD <= 3.0f)) return true;
- if (MercCast("Deadly Throw", TD>=1.0f && TD<=3.0f)) return true;
- //Thread.Sleep(100);
- if (MercCast("Unleash", BuddyTor.Me.IsStunned)) return true;
- if (MercCast("Disruption", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Intimidating Roar", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Dual Saber Throw", TC && StrongOrGreater(CT))) return true; // Force Choke WILL NOT WORK on all Elites (See Oricon)
- if (MercCast("Force Choke", TC && StrongOrGreater(CT))) return true;
- ///HandleDebuffs();
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Frenzy", Me, HP <= 50f)) return true;
- if (MercCast("Saber Ward", Me, HP <= 50f)) return true;
- if (MercCast("Undying Rage", Me, HP <= 20f)) return true;
- if (MercCast("Berserk", Me, HP <= 70)) return true;
- //if (MercCast("Unity", Me, HP <= 40f)) return true;
- if (MercCast("Pommel Strike", CT.IsStunned)) return true;
- if (MercCast("Rupture")) return true;
- if (MercCast("Deadly Saber")) return true;
- //if (MercCast("Berserk")) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Vicious Throw", THP <= 30f)) return true;
- if (MercCast("Smash", TWR5 >= 2 || StrongOrGreater(CT))) return true;
- if (MercCast("Force Scream")) return true;
- if (MercCast("Annihilate")) return true;
- if (MercCast("Obliterate")) return true;
- if (MercCast("Force Crush")) return true;
- if (MercCast("Ravage")) return true;
- if (MercCast("Gore")) return true;
- if (MercCast("Vicious Slash")) return true;
- if (MercCast("Battering Assault")) return true;
- if (MercCast("Force Scream")) return true;
- if (MercCast("Retaliation")) return true;
- if (MercCast("Vicious Slash")) return true;
- if (MercCast("Battering Assault")) return true;
- if (MercCast("Intimidating Roar", TWR5 >= 4)) return true;
- if (MercCast("Sweeping Slash", TWR5 >= 3)) return true;
- if (MercCast("Frenzy", Me, HP<=80f && !MyBuffs.Contains("Fury"))) return true;
- if (MercCast("Cloak of Pain", Me, HP <= 80f)) return true;
- if (MercCast("Obfuscate", HP <= 80f)) return true;
- if (MercCast("Intimidating Roar", HP <= 80f)) return true;
- if (MercCast("Deadly Throw", HP <= 80f)) return true;
- if (MercCast("Bloodthirst", Me)) return true;
- if (MercCast("Force Scream")) return true;
- if (MercCast("Massacre")) return true;
- if (MercCast("Assault")) return true;
- Buddy.CommonBot.AbilityManager.Cast("Assault", CT);
- return false;
- }
- public static void MarauderRageCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(100);
- LoadVars();
- if (MercCast("Shii-Cho Form", !MyBuffs.Contains("Shii-Cho Form"))) return;
- if (MercCast("Unnatural Might", !MyBuffs.Contains("Unnatural Might"))) return;
- if (MercCast("Unleash", BuddyTor.Me.IsStunned)) return;
- if (MercCast("Saber Ward", HP <= 50f)) return;
- if (MercCast("Undying Rage", HP <= 20f)) return;
- if (MercCast("Berserk", Me, MyBuffs.Contains("Fury") && HP <= 70)) return;
- if (MercCast("Predation", Me)) return;
- if (MercCast("Bloodthirst", Me, HP > 70)) return;
- if (MercCast("Cloak of Pain", Me)) return;
- if (MercCast("Obfuscate")) return;
- if (!TargetInCombat()) return;
- if (TD >= MeleeDist && TD <= 3.0f) if (MercCast("Force Charge")) return;
- MoveTo(CT, MeleeDist, "Force Charge");
- StopMoving();
- //if (!IG) MoveIfNec(.49f);
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- //Thread.Sleep(100);
- if (MercCast("Disruption", TC)) return;
- ///HandleDebuffs();
- if (MercCast("Smash", MyBuffs.Contains("Dominate") || HaveBuffStacks("Shockwave", 4))) return;
- if (MercCast("Frenzy", Me, !MyBuffs.Contains("Fury") && StrongOrGreater(CT))) return;
- if (MercCast("Force Crush", StrongOrGreater(CT))) return;
- if (MercCast("Rupture")) return;
- if (MercCast("Intimidating Roar", TWR10 >= 2)) return;
- if (MercCast("Force Choke")) return;
- if (MercCast("Obliterate")) return;
- if (MercCast("Vicious Throw", THP <= 30f)) return;
- if (MercCast("Pommel Strike", CT.IsStunned)) return;
- if (MercCast("Battering Assault")) return;
- //if (MercCast("Annihilate")) return;
- if (MercCast("Force Scream")) return;
- if (MercCast("Deadly Throw")) return;
- if (MercCast("Deadly Saber")) return;
- if (MercCast("Predation", MyBuffs.Contains("Fury") && HP < 50) && !MyBuffs.Contains("Predation")) return;
- if (MercCast("Bloodthirst", MyBuffs.Contains("Fury") && HP > 50) && !MyBuffs.Contains("Bloodthirst")) return;
- if (MercCast("Retaliation")) return;
- if (MercCast("Ravage")) return;
- if (MercCast("Deadly Throw")) return;
- if (MercCast("Bloodthirst")) return;
- if (MercCast("Vicious Slash")) return;
- if (MercCast("Assault")) return;
- }
- public static bool SageCombat()
- {
- Thread.Sleep(200);
- WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- if (MercCast("Noble Sacrifice", Me, HP >= 30f && (Me.ForcePercent<= 25f || Me.Force<=Me.ForceMax*.30f))) return true;
- if (HP <= 50f && EP >= 10f) MercCastOnGround("Salvation", true, Me);
- // Redundant, most of the time it won't proc like it should
- if (MercCast("Noble Sacrifice", HP >= 30f && (Me.ForcePercent <= 50f || Me.Force <= Me.ForceMax * .50f))) return true;
- if (MercCast("Noble Sacrifice", HP >= 30f && (Me.ForcePercent <= 50f || Me.Force <= Me.ForceMax * .50f))) return true;
- if (MercCast("Noble Sacrifice", HP >= 30f && (Me.ForcePercent <= 50f || Me.Force <= Me.ForceMax * .50f))) return true;
- if (CT !=null && TC && StrongOrGreater(CT))
- {
- if (MercCast("Force Stun", TC)) return true;
- if (MercCast("Mind Snap", TC)) return true;
- if (MercCast("Mental Alacrity")) return true;
- }
- if (HP <= 30f) UseMedPackInInventory();
- if (HP <= 70f)
- {
- Thread.Sleep(300);
- if (MercCast("Cloud Mind", HP <= 70f)) return true;
- if (MercCast("Restoration", NeedsDispell(Me))) return true;
- if (MercCast("Force Mend", HP <= 70f)) return true;
- if (MercCastOnGround("Salvation", HP <= 50f && !MyBuffs.Contains("Salvation"), Me)) return true;
- if (MercCast("Rejuvenate", HP <= 70f && !MyBuffs.Contains("Rejuvenate"))) return true;
- if (MercCast("Mental Alacrity", HP <= 50f)) return true;
- if (MercCast("Benevolence", HP <= 50f)) return true;
- return true;
- }
- if (IG && MySpec == SkillTreeId.SageSeer)
- {
- for (int i = 0; i < (Is55H ? 3 : 1); i++) SeerHeals(Is55H?85f:75f);
- MercCast("Telekinetic Throw", Me.ForcePercent <= 30f);
- MercCast("Forcequake", Me.ForcePercent <= 30f);
- }
- else if (SeerHeals(60f)) return true;
- if (!IG && SeerCheckCompHealth()) return true;
- MoveTo(CT, 2.8f, "Force Speed");
- if (!TargetInCombat()) return false;
- if (MySpec == SkillTreeId.SageSeer) foreach (TorCharacter u in Attackers) if (MercCast("Weaken Mind", u, !u.HasDebuff("Weaken Mind (Force)"))) { Thread.Sleep(800); break; }
- if (MercCast("Force Valor", !MyBuffs.Contains("Force Valor"))) return true;
- StopMoving();
- //if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercCast("Force of Will", Me.IsStunned)) return true;
- if (MercCast("Force Potency", HP <= 50f)) return true;
- if (MercCast("Mind Crush", StrongOrGreater(CT))) return true;
- if (MercBuffSelf("Force Armor")) return true;
- try { var CompX = Comp; if (MercCast("Force Armor", CompX, CompX != null && !CompX.HasBuff("Force Armor"))) return true; }
- catch { }
- if (MercCastOnGround("Forcequake", (!IG && MobsInRangeOf(CT.Position, .80f) >= 3) || (IG && MobsInRangeOf(CT.Position, .80f) >= 6), CT)) return true;
- if (MercCast("Telekinetic Throw", MyBuffs.Contains("Psychic Projection"))) return true;
- if (MercCast("Telekinetic Wave", MyBuffs.Contains("Tidal Force") || (!IG && !CT.InCombat && !Me.InCombat) || MyBuffs.Contains("Mental Alacrity") )) return true;
- if (MercCastOnGround("Force in Balance", StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .80f) >= 2, CT)) return true;
- if (MercCast("Project")) return true;
- if (MercCastOnGround("Forcequake", MyAbilities.Contains("Tidal Force") && MobsInRangeOf(CT.Position, .80f) >= 4, CT)) return true;
- if (MercCast("Disturbance", MyAbilities.Contains("Tidal Force") || !CT.InCombat || MyBuffs.Contains("Presence of Mind"))) return true;
- if (!CT.InCombat)
- {
- if (MercCast("Mind Crush")) Thread.Sleep(500);
- if (MercCast("Disturbance")) Thread.Sleep(500);
- }
- if (MercFaceAndCast("Force Wave", StrongOrGreater(CT) && TD <= MeleeDist)) return true;
- //if (MercCast("Deliverance", BuddyTor.Me, HP <= 70f)) return true;
- if (TD <= MeleeDist)
- {
- if (MercCast("Force Wave", TD <= MeleeDist)) return true;
- if (MercCast("Tumult")) return true;
- }
- //if (MercCast("Heroic Moment: Channel the Force", Me.HealthPercent <= 30f)) return true;
- if (MercCast("Force Potency", Me.ForcePercent <= 50f || StrongOrGreater(CT))) return true;
- if (MercCastOnGround("Force in Balance", MobsInRangeOf(CT.Position, .80f) >= 2, CT)) return true;
- if (MercCastOnGround("Forcequake", (!IG && MobsInRangeOf(CT.Position, .80f) >= 3) || (IG && MobsInRangeOf(CT.Position, .80f) >= 6), CT)) return true;
- //if (MercCast("Turbulence", CTDebuffs.Contains("Weaken Mind"))) return true;
- if (!IG || Me.ForcePercent > 30f)
- {
- if (MercCast("Weaken Mind", !CTDebuffs.Contains("Weaken Mind (Force)"))) return true;
- //if (MercCast("Force Stun", StrongOrGreater(CT))) return true;
- if (MercCast("Force Slow", StrongOrGreater(CT) && !CTDebuffs.Contains("Slowed (Force)"))) return true;
- if (MercCast("Telekinetic Throw")) return true;
- if (MercCast("Disturbance")) return true;
- if (MercCastOnGround("Forcequake", MobsInRangeOf(CT.Position, .80f) >= 3, CT)) return true;
- }
- if (MercCast("Double Strike")) return true;
- if (MercCast("Saber Strike")) return true;
- return false;
- }
- public static void MadnessCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- if (!TargetInCombat()) return;
- if (MercCast("Mark of Power", !MyBuffs.Contains("Mark of Power"))) return;
- if (!IG) MoveTo(CT, 2.8f, "Force Speed");
- //if (!IG) MoveIfNec(.49f);
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercCast("Unbreakable Will", Me.IsStunned)) return;
- if (MercCastOnGround("Death Field", HP <= 50 || StrongOrGreater(CT), CT)) return;
- if (MercCast("Affliction", !CTDebuffs.Contains("Affliction (Force)"))) return;
- if (MercCast("Creeping Terror")) return;
- if (MercCast("Static Barrier", Me, !MyBuffs.Contains("Static Barrier"))) return;
- if (MercCast("Unnatural Preservation", Me, HP <= 70f)) return;
- if (MercCast("Dark Heal", Me, HP <= 70f)) return;
- if (MercCast("Dark Infusion", Me, HP <= 70f)) return;
- if (MercCast("Cloud Mind", Me, CTT != CombatToughness.Player && HP <= 70f)) return;
- if (CorruptionCheckCompHealth()) return;
- if (MercCast("Recklessness", Me.ForcePercent <= 50f)) return;
- //if (MercCast("Heroic Moment: Channel the Force", Me.ForcePercent <= 30f)) return;
- if (MercCast("Crushing Darkness", StrongOrGreater(CT) && !CTDebuffs.Contains("Crushing Darkness (Force)"))) return;
- if (MercCast("Consumption", HP > 50 && Me.ForcePercent <= 20)) return;
- //if (SeerHeals(75f)) return;
- if (TD <= MeleeDist)
- {
- if (MercCast("Overload", TD <= MeleeDist)) return;
- if (MercCast("Tumult")) return;
- //if (MercCast("Double Strike")) return;
- }
- if (!IG || Me.ForcePercent > 30f)
- {
- if (MercCast("Electrocute", (TC || TD <= .5f) && StrongOrGreater(CT))) return;
- if (MercCast("Jolt", TC && StrongOrGreater(CT))) return;
- if (MercCast("Shock", TC && StrongOrGreater(CT))) return;
- if (MercCastOnGround("Death Field", StrongOrGreater(CT) || TWR30 >= 3, CT)) return;
- if (MercCast("Force Slow", StrongOrGreater(CT) && !CTDebuffs.Contains("Slow (Force)"))) return;
- if (MercCastOnGround("Force Storm", TWR30 >= 3, CT)) return;
- if (MercCast("Force Lightning")) return;
- }
- if (MercCast("Saber Strike")) return;
- }
- public static bool SorcererCombat()
- {
- Thread.Sleep(200);
- WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- if (MercCast("Unbreakable Will", Me.IsStunned)) return true;
- if (MercCast("Consumption", Me, HP > 30 && (Me.ForcePercent <= 25f || Me.Force<Me.ForceMax*.50f))) return true;
- if (MercBuffSelf("Mark of Power")) return true;
- if (MercCast("Static Barrier", Me, !MyBuffs.Contains("Static Barrier"))) ;// return true;
- if (MercCast("Force Barrier", Me, HP<=25f)) ;// return true;
- if (HP <= 70f) {
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Cloud Mind", HP <= 60f)) return true;
- MercCast("Purge", Me, NeedsDispell(Me));
- MercCast("Unnatural Preservation", BuddyTor.Me, HP <= 70f);
- MercCast("Dark Heal", Me, HP <= 70f);
- //if (MercCast("Dark Infusion", BuddyTor.Me, HP <= 70f)) return true;
- }
- if (IG && MySpec == SkillTreeId.SorcererCorruption && IG)
- {
- for (int i = 0; i < (Is55H?3:1); i++) { CorruptionHeals(Is55H ? 85f : 75f); }
- if (EP <= 90f && Is55H) return MercCast("Force Lightning");
- }
- if (IG && MySpec != SkillTreeId.SorcererCorruption && CorruptionHeals(65f)) return true;
- if (CorruptionCheckCompHealth()) return true;
- if (!TargetInCombat()) return false;
- MoveTo(CT, 2.90f, "Force Speed");
- StopMoving();
- if (MercCast("Electrocute", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Jolt", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Overload", TC && StrongOrGreater(CT) && TD <= 1.0f)) return true;
- if (MercCast("Creeping Terror", TC && StrongOrGreater(CT))) return true;
- if (MercCastOnGround("Force Storm", MobsInRangeOf(CT.Position, .80f) >= 5, CT)) return true;
- if (MercCast("Recklessness", Me, EP <= 20f || EliteOrGreater(CT))) ;// return true;
- if (MercCast("Polarity Shift", Me, EP <= 20f || EliteOrGreater(CT))) ;// return true;
- if (MercCastOnGround("Death Field", StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .80f) >= 3, CT)) return true;
- if (MercCast("Crushing Darkness", StrongOrGreater(CT) && !CTDebuffs.Contains("Crushing Darkness")
- && (!MyAbilities.Contains("Wrath") || MyBuffs.Contains("Polarity Shift") || MyBuffs.Contains("Wrath")))) return true;
- if (MercCast("Lightning Strike", MyBuffs.Contains("Wrath"))) return true;
- if (MercCast("Chain Lightning", StrongOrGreater(CT) && MyBuffs.Contains("Lightning Storm"))) return true;
- if (MercCast("Force Lightning", StrongOrGreater(CT) && MyBuffs.Contains("Lightning Barrage"))) return true;
- if (MercCast("Thundering Blast", StrongOrGreater(CT) && CTDebuffs.Contains("Affliction"))) return true;
- if (MercCast("Chain Lightning", MyBuffs.Contains("Polarity Shift") || MobsInRangeOf(CT.Position, .80f) >= 4)) return true;
- if (MercCast("Creeping Terror", StrongOrGreater(CT))) return true;
- if (MercCast("Shock")) return true;
- if (MercCast("Force Lightning", EP <= 30f)) return true;
- if (TD <= MeleeDist)
- {
- if (MercCast("Overload", TD <= MeleeDist)) return true;
- if (MercCast("Tumult")) return true;
- }
- if (MercCastOnGround("Force Storm", MobsInRangeOf(CT.Position, .80f) >= (IG ? 5 : 2), CT)) return true;
- if (MercCast("Affliction", !CTDebuffs.Contains("Affliction (Force)"))) return true;
- if (MercCast("Force Slow", StrongOrGreater(CT) && !CTDebuffs.Contains("Slow (Force)"))) return true;
- if (MercCast("Force Lightning", MySpec==SkillTreeId.SorcererCorruption || (MyAbilities.Contains("Wrath") && !MyBuffs.Contains("Wrath")))) return true;
- if (MercCast("Lightning Strike", MyAbilities.Contains("Forked Lightning") || MyAbilities.Contains("Lightning Storm"))) return true;
- if (MercCast("Crushing Darkness", StrongOrGreater(CT) && !CTDebuffs.Contains("Crushing Darkness (Force)"))) return true;
- if (MercCast("Force Lightning")) return true;
- if (!IG || (IG && EP >= 50f)) foreach (TorCharacter u in Attackers) if (MercCast("Affliction", u, !u.HasDebuff("Affliction (Force)"))) break; ;
- if (MercCast("Saber Strike")) return true;
- return false;
- }
- public static bool CorruptionCombat()
- {
- try
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- if (MercCast("Mark of Power", Me, !MyBuffs.Contains("Mark of Power"))) return true;
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercCast("Unbreakable Will", Me.IsStunned)) return true;
- if (MercCast("Static Barrier", Me, !MyBuffs.Contains("Static Barrier"))) return true;
- if (MercCast("Force Barrier", Me, HP <= 30f)) return true;
- if (MercCast("Resurgence", Me, !MyBuffs.Contains("Resurgence") && HP <= 70f)) return true;
- if (MercCast("Unnatural Preservation", Me, HP <= 70f)) return true;
- if (MercCastOnGround("Revivification", HP <= 70f, Me)) return true;
- if (MercCast("Dark Heal", Me, HP <= 70f)) return true;
- if (MercCast("Dark Infusion", Me, HP <= 70f)) return true;
- if (MercCast("Purge", Me, Me.Debuffs.Count() >= 3)) return true;
- if (!IG) if (CorruptionCheckCompHealth()) return true;
- if (IG && MySpec==SkillTreeId.SorcererCorruption) if (CorruptionHeals(85f)) return true;
- if (!TargetInCombat()) return false;
- MoveTo(CT, 2.8f); ;
- if (MercCast("Electrocute", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Jolt", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Shock", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Consumption", HP > 50 && Me.ForcePercent <= 20)) return true;
- if (MercFaceAndCast("Overload", TD <= MeleeDist)) return true;
- if (MercCast("Tumult", TD <= MeleeDist)) return true;
- if (!IG || MySpec!=SkillTreeId.SorcererCorruption || Me.ForcePercent > 30f)
- {
- if (MercCast("Cloud Mind", CTT != CombatToughness.Player && HP <= 70f)) return true;
- if (MercCast("Recklessness", Me, !IG && StrongOrGreater(CT))) return true;
- if (MercCastOnGround("Death Field", MobsInRangeOf(CT.Position, .8f) >= 4, CT)) return true;
- if (MercCastOnGround("Force Storm", MobsInRangeOf(CT.Position, .80f) >= 4, CT)) return true;
- if (MercCast("Chain Lightning", MobsInRangeOf(CT.Position, .8f) >= 4)) return true;
- if (MercCast("Recklessness", Me.ForcePercent <= 50f)) return true;
- //if (MercCast("Heroic Moment: Channel the Force", Me.ForcePercent <= 30f)) return true;
- if (MercCast("Creeping Terror", StrongOrGreater(CT) && !CTDebuffs.Contains("Creeping Terror"))) return true;
- if (MercCast("Shock")) return true;
- if (MercCast("Lightning Strike", MyBuffs.Contains("Wrath"))) return true;
- if (MercCast("Force Lightning")) return true;
- if (MercCast("Crushing Darkness", StrongOrGreater(CT) && !CTDebuffs.Contains("Crushing Darkness (Force)"))) return true;
- if (MercCast("Affliction", !CTDebuffs.Contains("Affliction"))) return true;
- if (MercCast("Force Slow", StrongOrGreater(CT) && !CTDebuffs.Contains("Slow (Force)"))) return true;
- }
- //if (!IG) foreach (TorCharacter u in Attackers) if (MercCast("Affliction", u, !u.HasDebuff("Affliction (Force)"))) Thread.Sleep(400);
- if (MercCast("Thrash", TD <= MeleeDist)) return true;
- if (MercCast("Saber Strike", TD <= MeleeDist)) return true;
- if (MercCast("Lightning Strike")) return true;
- //Buddy.CommonBot.AbilityManager.Cast("Force Lightning", CT); // Forced Cast - CanCast gets just a little flaky
- }
- catch { }
- return false;
- }
- public static void CorruptionCombatPvP()
- { // Tried and tried on this - BW seems just about uselesss with it due to all of the bugs and hangs..... With PVP.
- try
- {
- Thread.Sleep(300);
- IG = true;
- if (Me.IsDead || Me.HealthPercent < .2f) return;
- WaitForCast();
- datLCL = DateTime.Now;
- CT = Me.CurrentTarget;
- if (CT == null) return;
- TD = CT.Distance;
- if (TD >= 3.0f) return;
- HP = Me.HealthPercent;
- RS = Me.ResourceStat;
- MyBuffs = "";
- foreach (TorEffect te in Me.Buffs) MyBuffs += te.Name + ";";
- CTDebuffs = "";
- if (CT != null) foreach (TorEffect te in CT.Debuffs) CTDebuffs += te.Name + ";";
- MySpec = SkillTreeId.SorcererCorruption;
- if (TD <= MeleeDist)
- {
- if (MercCast("Overload", TD <= MeleeDist)) return;
- if (MercCast("Tumult")) return;
- if (MercCast("Electrocute")) return;
- }
- if (MercCast("Mark of Power", !MyBuffs.Contains("Mark of Power"))) return;
- if (!IG) MoveTo(CT, 2.8f, "Force Speed");
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercCast("Static Barrier", Me, !MyBuffs.Contains("Static Barrier"))) return;
- if (MercCast("Unbreakable Will", Me.IsStunned)) return;
- if (MercCast("Unnatural Preservation", Me, HP <= 70f)) return;
- if (MercCast("Resurgence", Me, MyBuffs.Contains("Resurgence") && HP <= 70f)) return;
- if (MercCast("Dark Infusion", Me, HP <= 70f)) return;
- if (MercCast("Dark Heal", Me, HP <= 70f)) return;
- if (CorruptionHeals(80f)) return;
- if (MercCast("Recklessness", Me, !IG && StrongOrGreater(CT))) return;
- if (MercCast("Recklessness", Me.ForcePercent <= 50f)) return;
- //if (MercCast("Heroic Moment: Channel the Force", Me.ForcePercent <= 30f)) return;
- if (MercCast("Consumption", HP > 50 && Me.ForcePercent <= 20)) return;
- if (TD <= MeleeDist)
- {
- if (MercCast("Overload", TD <= MeleeDist)) return;
- if (MercCast("Tumult")) return;
- }
- if (!IG || Me.ForcePercent > 30f)
- {
- if (MercCast("Electrocute", (TC || TD <= .5f) && StrongOrGreater(CT))) return;
- if (MercCast("Jolt", TC && StrongOrGreater(CT))) return;
- if (MercCast("Affliction", !CTDebuffs.Contains("Affliction"))) return;
- if (MercCast("Shock")) return;
- if (MercCast("Force Slow", StrongOrGreater(CT) && !CTDebuffs.Contains("Slow (Force)"))) return;
- }
- if (MercCast("Force Lightning")) return;
- if (MercCast("Thrash", TD <= MeleeDist)) return;
- if (MercCast("Saber Strike", TD <= MeleeDist)) return;
- }
- catch { }
- if (DateTime.Now.Subtract(datLCs).TotalSeconds >= 4) MercForcedCast("Lightning Strike", CT);
- }
- public static bool WatchmanCombatPvP()
- {
- try
- {
- CheckGC();
- Thread.Sleep(150);
- if (IAmDead()) { BuddyTor.Me.ClearTarget(); return false; }
- var x = BuddyTor.Me.CurrentTarget;
- if (x == null) return false;
- //x = (TorCharacter)x;
- //WaitForCast();
- if (MercCastX("Force Leap", x)) return true;
- if (MercCastX("Crippling Throw", x)) return true;
- while (x.Distance >= MeleeDist || !x.InLineOfSight) {
- if (IAmDead()) return false;
- Buddy.Swtor.Input.MoveTo(BuddyTor.Me.CurrentTarget.Position);
- Thread.Sleep(150);
- MercCastX("Force Leap", x);
- MercCastX("Crippling Throw", x);
- }
- //Buddy.Navigation.Navigator.MoveTo(x.Position);
- x.Face();
- CT = x;
- double HPx = Me.HealthPercent;
- MercBuffSelf("Juyo Form");
- if (MercCastX("Resolute", Me, Me.IsStunned)) return true;
- if (MercCastX("Guarded by the Force", Me, HPx <= 20f)) return true;
- if (MercCastX("Saber Ward", Me, HPx <= 50f)) return true;
- if (MercCastX("Zen", BuddyTor.Me, HPx <= 80f)) return true;
- if (MercCastX("Inspiration", Me, HPx <= 70f)) return true;
- if (MercCastX("Rebuke", Me, HPx <= 70f)) return true;
- if (MercCastX("Zen", BuddyTor.Me)) return true;
- if (MercCastX("Transcendence", BuddyTor.Me)) return true;
- if (MercCastX("Cauterize", x)) return true;
- if (MercCastX("Overload Saber", x)) return true;
- if (MercCastX("Force Kick", x)) return true;
- if (MercCastX("Zealous Strike", x)) return true;
- if (MercCastX("Force Stasis", x)) return true;
- if (MercCastX("Blade Storm", x)) return true;
- if (MercCastX("Pacify", x)) return true;
- if (MercCastX("Cyclone Slash", x)) return true;
- if (MercCastX("Slash", x)) return true;
- if (MercCastX("Riposte", x)) return true;
- if (MercCastX("Strike", x)) return true;
- //if (Buddy.CommonBot.AbilityManager.CanCast("Force Leap", x)) { Buddy.CommonBot.AbilityManager.Cast("Force Leap", x); Thread.Sleep(700); return true; }
- //if (Buddy.CommonBot.AbilityManager.CanCast("Cauterize", x)) { Buddy.CommonBot.AbilityManager.Cast("Cauterize", x); Thread.Sleep(700); return true; }
- //if (Buddy.CommonBot.AbilityManager.CanCast("Force Kick", x)) { Buddy.CommonBot.AbilityManager.Cast("Force Kick", x); Thread.Sleep(700); return true; }
- //if (Buddy.CommonBot.AbilityManager.CanCast("Zealous Strike", x)) { Buddy.CommonBot.AbilityManager.Cast("Zealous Strike", x); Thread.Sleep(700); return true; }
- //if (Buddy.CommonBot.AbilityManager.CanCast("Riposte", x)) { Buddy.CommonBot.AbilityManager.Cast("Riposte", x); Thread.Sleep(700); return true; }
- //if (Buddy.CommonBot.AbilityManager.CanCast("Strike", x)) { Buddy.CommonBot.AbilityManager.Cast("Strike", x); Thread.Sleep(700); return true; }
- }
- catch { }
- return false;
- }
- public static bool BGCombatPvP()
- {
- try
- {
- CheckGC();
- Thread.Sleep(150);
- if (IAmDead()) { BuddyTor.Me.ClearTarget(); return false; }
- var x = BuddyTor.Me.CurrentTarget;
- BGHeals(70f);
- if (x == null) return false;
- CT = x;
- TD = x.Distance;
- RS = Me.ResourceStat;
- while (x.Distance >= 2.8f || !x.InLineOfSight)
- {
- if (IAmDead()) return false;
- Buddy.Swtor.Input.MoveTo(BuddyTor.Me.CurrentTarget.Position);
- Thread.Sleep(150);
- }
- x.Face();
- CT = x;
- float HP = BuddyTor.Me.HealthPercent;
- double HPx = Me.HealthPercent;
- if (MercCastX("Determination", BuddyTor.Me.IsStunned)) return true;
- if (MercCastX("Kolto Shell", BuddyTor.Me, !Me.HasBuff("Kolto Shell") && HP <= 85f)) return true;
- if (MercCastOnGround("Kolto Missile", HP < 60f, Me)) return true;
- if (MercCastX("Emergency Scan", Me, HP <= 70)) return true;
- if (MercCastX("Rapid Scan", Me, HP <= 70)) return true;
- if (MercCastX("Kolto Overload", Me, HP <= 70f)) return true;
- if (MercCastX("Energy Shield", Me, HP <= 60f)) return true;
- if (MercCastX("Jet Boost", TD <= .8f)) return true;
- if (MercCastX("Shoulder Slam", TD <= .8f)) return true;
- if (MercCastX("Rocket Punch", TD <= .8f)) return true;
- if (MercCastX("Elactro Dart", TD <= .8f)) return true;
- if (MercCastX("Vent Heat", RS <= 20)) return true;
- if (MercCastOnGround("Death from Above", TD >= .6f && BuddyTor.Me.ResourceStat >= 80f, CT)) return true;
- if (MercCastX("Emergency Scan", HP < 70f)) return true;
- if (!TargetInCombat()) return true;
- if (MercCastX("Power Shot", Me.HasBuff("Power Surge"))) return true;
- if (MercCastX("Disabling Shot", TC)) return true;
- if (MercCastX("Electro Dart", TC)) return true;
- if (MercCastX("Neural Dart", TC || StrongOrGreater(CT))) return true;
- if (MercFaceAndCast("Flame Thrower", TD <= 1.0f)) return true;
- if (MercCastX("Hunter's Boon", !Me.HasBuff("Hunter's Boon"))) return true;
- if (MercCastX("Heroic Moment: On the Trail", HP <= 50f)) return true;
- if (MercCastX("Power Surge", true)) return true;
- if (MercCastX("Thermal Sensor Override", RS <= 30f)) return true;
- if (Comp != null) if (MercCastX("Chaff Flare", HP <= 70f)) return true;
- if (MercCastX("Supercharged Gas", Me.HasBuff("Supercharged Gas"))) return true;
- if (!IG || (IG && RS >= 40f))
- {
- if (MercCastX("Explosive Dart", StrongOrGreater(CT) || MobsInRangeOf(CT.Position, .80f) >= 3)) return true;
- if (MercCastOnGround("Sweeping Blasters", TWR10 >= 5, CT)) return true;
- if (MercCastX("Rapid Shots", HP < 70 && RS >= 30)) return true;
- if (MercCastX("Unload", true)) return true;
- if (MercCastX("Rail Shot", true)) return true;
- if (UseAOE)
- {
- if (MercCastX("Fusion Missile", StrongOrGreater(CT))) return true;
- if (MercCastX("Explosive Dart", true)) return true;
- if (MercCastX("Missile Blast", (TD <= .8f && !StrongOrGreater(CT)) || RS >= 50f)) return true;
- if (CTT == CombatToughness.Player) MercCastOnGround("Sweeping Blasters", TD >= .1f && RS >= 35, CT);
- }
- if (MercFaceAndCast("Flame Burst", TD <= 1.0f && RS >= 65f)) return true;
- }
- if (MercCastX("Rapid Shots", true)) return true;
- }
- catch { }
- return false;
- }
- public static bool SageCombatPvP()
- {
- try
- {
- CheckGC();
- Thread.Sleep(150);
- if (IAmDead()) { BuddyTor.Me.ClearTarget(); return false; }
- GetEffects();
- var x = BuddyTor.Me.CurrentTarget;
- //SeerHeals(70f);
- if (x == null) return false;
- CT = x;
- TD = x.Distance;
- RS = Me.ResourceStat;
- TC = x.IsCasting;
- while (x.Distance >= 2.8f || !x.InLineOfSight)
- {
- if (IAmDead()) return false;
- Buddy.Swtor.Input.MoveTo(BuddyTor.Me.CurrentTarget.Position);
- Thread.Sleep(150);
- }
- x.Face();
- CT = x;
- float HP = BuddyTor.Me.HealthPercent;
- double HPx = Me.HealthPercent;
- if (MercCastX("Force of Will", Me.IsStunned)) return true;
- if (MercCastX("Force Potency", HP <= 50f)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- HandleDebuffs();
- if (MercCastX("Force Stun", TC)) return true;
- if (MercCastX("Mind Snap", TC)) return true;
- if (MercCastX("Mental Alacrity", RS<=30f)) return true;
- if (MercBuffSelf("Force Armor")) return true;
- if (HP <= 70f)
- {
- if (MercCastX("Restoration", NeedsDispell(Me))
- || MercCastOnGround("Salvation", HP <= 50f && !MyBuffs.Contains("Salvation"), Me)
- || MercCastX("Cloud Mind", HP <= 70f)
- || MercCastX("Force Mend", HP <= 70f)
- || MercCastX("Rejuvenate", HP <= 70f && !MyBuffs.Contains("Rejuvenate"))
- || MercCastX("Mental Alacrity", HP <= 50f)
- || MercCastX("Benevolence", HP <= 50f)) { Thread.Sleep(600); MercCast("Project"); return true; }
- }
- //if (IG && MySpec == SkillTreeId.SageSeer) { if (SeerHeals(85f)) return true; } else if (SeerHeals(70f)) return true;
- //if (!IG && SeerCheckCompHealth()) return true;
- if (MercCastX("Telekinetic Throw", MyBuffs.Contains("Psychic Projection"))) return true;
- if (MercCastX("Telekinetic Wave", MyBuffs.Contains("Tidal Force"))) return true;
- if (MercCastOnGround("Force in Balance", MobsInRangeOf(CT.Position, .80f) >= 2, CT)) return true;
- if (MercCastX("Project",true)) return true;
- if (MercCastOnGround("Forcequake", MyAbilities.Contains("Tidal Force") && MobsInRangeOf(CT.Position, .80f) >= 4, CT)) return true;
- if (MercCastX("Disturbance", MyAbilities.Contains("Tidal Force") || !CT.InCombat || MyBuffs.Contains("Presence of Mind"))) return true;
- if (!CT.InCombat)
- {
- //if (MercCast("Mind Crush")) Thread.Sleep(500);
- if (MercCast("Disturbance")) Thread.Sleep(500);
- }
- if (MercFaceAndCast("Force Wave", TD <= MeleeDist)) return true;
- //if (MercCast("Deliverance", BuddyTor.Me, HP <= 70f)) return true;
- if (TD <= MeleeDist)
- {
- if (MercCastX("Force Wave", TD <= MeleeDist)) return true;
- if (MercCastX("Tumult",true)) return true;
- }
- //if (MercCast("Heroic Moment: Channel the Force", Me.HealthPercent <= 30f)) return true;
- if (MercCastX("Force Potency", Me.ForcePercent <= 50f || StrongOrGreater(CT))) return true;
- if (MercCastOnGround("Force in Balance", MobsInRangeOf(CT.Position, .80f) >= 2, CT)) return true;
- if (MercCastOnGround("Forcequake", (!IG && MobsInRangeOf(CT.Position, .80f) >= 3) || (IG && MobsInRangeOf(CT.Position, .80f) >= 6), CT)) return true;
- //if (MercCast("Turbulence", CTDebuffs.Contains("Weaken Mind"))) return true;
- if (MercCastX("Noble Sacrifice", HP >= 50 && RS <= Me.ForceMax * .2f)) return true;
- if (MercCastX("Mind Crush", StrongOrGreater(CT))) return true;
- if (!IG || Me.ForcePercent > 30f)
- {
- if (MercCastX("Weaken Mind", !CTDebuffs.Contains("Weaken Mind (Force)"))) return true;
- //if (MercCast("Force Stun", StrongOrGreater(CT))) return true;
- if (MercCastX("Force Slow", !CTDebuffs.Contains("Slowed (Force)"))) return true;
- if (MercCastX("Telekinetic Throw",true)) return true;
- if (MercCastX("Disturbance",true)) return true;
- if (MercCastOnGround("Forcequake", MobsInRangeOf(CT.Position, .80f) >= 3, CT)) return true;
- }
- //if (!IG) foreach (TorCharacter u in Attackers) if (MercCast("Weaken Mind", u, !u.HasDebuff("Weaken Mind (Force)"))) WaitForCast();
- if (MercCastX("Double Strike",true)) return true;
- if (MercCastX("Saber Strike", true)) return true;
- }
- catch { }
- return false;
- }
- public static bool WatchmanCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(100);
- LoadVars();
- if (!TargetInCombat())
- {
- Logger.Write("Target not in combat, exiting.");
- return false;
- }
- if (MercCast("Crippling Throw", TD >= 1.0f && TD <= 3.0f)) return true;
- if (MercCast("Dual Saber Throw", TD >= 1.0f && TD <= 3.0f)) return true;
- MoveTo(CT, .490f, "Force Leap", "Transcendence");
- if (MercCast("Resolute", Me, Me.IsStunned)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- MercBuffSelf("Juyo Form");
- if (MercCast("Pacify", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Force Kick", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Force Stasis", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Guarded by the Force", HP <= 20f)) return true;
- if (MercCast("Saber Ward", HP <= 50f)) return true;
- if (MercCast("Inspiration", HP <= 70f)) return true;
- if (MercCast("Rebuke", HP <= 70f)) return true;
- if (MercCast("Zen", BuddyTor.Me)) return true;
- if (MercCast("Transcendence", BuddyTor.Me)) return true;
- if (MercCast("Overload Saber")) return true;
- if (MercCast("Dispatch", THP <= 30f)) return true;
- if (MercCast("Master Strike", StrongOrGreater(CT) && THP >= 30f)) return true;
- if (MercCast("Blade Storm", TWR10 >= 2 || StrongOrGreater(CT))) return true;
- if (MercCast("Riposte")) return true;
- if (MercCast("Merciless Slash", StrongOrGreater(CT) && THP >= 30f)) return true;
- if (MercCast("Slash")) return true;
- if (MercCast("Zealous Strike")) return true;
- if (MercCast("Cauterize")) return true;
- if (MercCast("Force Sweep", TWR5 >= 2)) return true;
- if (MercCast("Cyclone Slash", TWR5 >= 2)) return true;
- if (MercCast("Crippling Throw", StrongOrGreater(CT) && HP <= 80f)) return true;
- if (MercCast("Leg Slash", StrongOrGreater(CT) && HP <= 80f)) return true;
- if (MercCast("Rebuke")) return true;
- if (MercCast("Strike")) return true;
- return false;
- }
- public static bool GuardianCombat()
- {
- Thread.Sleep(300);
- while (Me.IsCasting) Thread.Sleep(300);
- ////Thread.Sleep(200);
- ////WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- if (MercBuffSelf("Soresu Form")) return true;
- if (MercBuffSelf("Force Might")) return true;
- if (!TargetInCombat()) return false;
- //if (MercCast("Force Leap", TD >= 1.0f && TD <= 3.0f)) return true;
- //if (MercCast("Crippling Throw", TD >= 1.0f && TD <= 3.0f)) return true;
- //if (MercCast("Taunt", TD >= 1.0f && TD <= 3.0f)) return true;
- MoveTo(CT, .490f,"Force Leap", "Crippling Throw", "Taunt");
- if (MercCast("Pacify", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Force Kick", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Force Stasis", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Resolute", Me, Me.IsStunned)) return true;
- if (HP < 70f)
- {
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Warding Call", HP <= 50f)) return true;
- if (MercCast("Enure", HP <= 60f)) return true;
- if (MercCast("Guarded by the Force", HP <= 20f)) return true;
- if (MercCast("Saber Ward", HP <= 50f)) return true;
- if (MercCast("Inspiration", HP <= 70f)) return true;
- if (MercCast("Rebuke", HP <= 70f)) return true;
- if (MercCast("Combat Focus", Me, HP <= 70f)) return true;
- }
- if (MercCast("Zen", Me)) return true;
- if (MercCast("Transcendence", Me)) return true;
- if (MercCast("Crippling Throw", StrongOrGreater(CT) && HP <= 80f)) return true;
- if (MercCast("Leg Slash", StrongOrGreater(CT) && HP <= 80f)) return true;
- if (MercCast("Dispatch", THP <= 30f)) return true;
- if (MercCast("Blade Storm", TWR10 >= 2 || StrongOrGreater(CT))) return true;
- if (MercCast("Riposte")) return true;
- if (MercCast("Overload Saber")) return true;
- if (MercCast("Sundering Strike")) return true;
- if (MercCast("Merciless Slash", StrongOrGreater(CT) && THP >= 30f)) return true;
- if (MercCast("Master Strike", StrongOrGreater(CT) && THP >= 30f)) return true;
- if (MercCast("Challenging Call", IG)) return true;
- if (MercCast("Force Sweep", TWR5 >= 2)) return true;
- if (MercCast("Cauterize")) return true;
- if (MercCast("Zealous Strike")) return true;
- if (MercCast("Riposte")) return true;
- if (MercCast("Rebuke")) return true;
- if (MercCast("Slash")) return true;
- if (MercCast("Strike")) return true;
- return false;
- }
- public static bool FocusCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(100);
- LoadVars();
- if (Attackers == null || Attackers.Count() == 0) return false;
- if (MercCast("Shii-Cho Form", !MyBuffs.Contains("Shii-Cho Form"))) return true;
- if (MercCast("Force Might", !MyBuffs.Contains("Force Might"))) return true;
- if (!TargetInCombat()) return false;
- if (MercCast("Crippling Throw", TD >= 1.0f && TD <= 3.0f)) return true;
- if (MercCast("Zealous Leap", Me, TD <= 1.0f)) return true;
- if (MercCast("Transcendence", Me, TD >= 1.0f)) return true;
- if (MercCast("Zealous Leap", TD <= 1.0f)) return true;
- MoveTo(CT, .490f, "Force Leap");
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercCast("Resolute", Me, Me.IsStunned)) return true;
- if (HP <= 30) UseMedPackInInventory();
- if (MercCast("Guarded by the Force", Me, HP <= 20f)) return true;
- if (MercCast("Zen", Me, HP <= 70f)) return true;
- if (MercCast("Saber Ward", Me, HP <= 50)) return true;
- if (MercCast("Rebuke", HP <= 70)) return true;
- if (MercCast("Dispatch", THP <= 30f)) return true;
- if (MercCast("Awe", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Force Kick", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Force Stasis", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Overload Saber", Me)) return true;
- if (MercCast("Blade Storm", TWR10 >= 2 || StrongOrGreater(CT))) return true;
- if (MercCast("Cyclone Slash", TWR5 >= 2)) return true;
- if (MercCast("Force Sweep", TWR5 >= 2)) return true;
- if (MercCast("Cauterize")) return true;
- if (MercCast("Zealous Strike")) return true;
- if (MercCast("Merciless Slash")) return true;
- if (MercCast("Master Strike")) return true;
- if (MercCast("Dispatch")) return true;
- if (MercCast("Crippling Throw", StrongOrGreater(CT))) return true;
- if (MercCast("Leg Slash", StrongOrGreater(CT))) return true;
- if (MercCast("Pacify", StrongOrElite(CT))) return true;
- if (MercCast("Riposte")) return true;
- if (MercCastOnGround("Force Sweep", TWR5 >= 3 || StrongOrGreater(CT), CT)) return true;
- if (MercCast("Master Strike")) return true;
- if (MercCast("Force Leap")) return true;
- if (MercCast("Slash")) return true;
- if (MercCast("Strike")) return true;
- return false;
- }
- public static bool SentinelCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(150);
- LoadVars();
- if (Attackers == null || Attackers.Count() == 0) return false;
- if (MercBuffSelf("Shii-Cho Form",MySpec==SkillTreeId.SentinelFocus)) return true;
- if (MercBuffSelf("Ataru Form", MySpec == SkillTreeId.SentinelCombat)) return true;
- if (MercBuffSelf("Juyo Form", MySpec == SkillTreeId.SentinelWatchman)) return true;
- if (MercCast("Force Might", !MyBuffs.Contains("Force Might"))) return true;
- if (!TargetInCombat()) return false;
- if (MercCast("Crippling Throw", TD >= 1.0f && TD <= 3.0f)) return true;
- if (MercCast("Zealous Leap", Me, TD <= 1.0f)) return true;
- if (MercCast("Transcendence", Me, TD >= 1.0f)) return true;
- if (MercCast("Zealous Leap", TD <= 1.0f)) return true;
- MoveTo(CT, MeleeDist, "Force Leap");
- if (TC && StrongOrGreater(CT))
- {
- if (MercCast("Force Kick")) return true;
- if (MercCast("Force Stasis")) return true;
- if (MercCast("Awe")) return true;
- }
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercCast("Resolute", Me, Me.IsStunned)) return true;
- if (HP <= 30) UseMedPackInInventory();
- if (MercCast("Overload Saber")) return true;
- if (MercCast("Cauterize")) return true;
- if (MercCast("Dispatch", THP <= 30f)) return true;
- if (MercCast("Zen", Me, HP <= 70f)) return true;
- if (MercCast("Rebuke", HP <= 70)) return true;
- if (MercCast("Guarded by the Force", Me, HP <= 20f)) return true;
- if (MercCast("Saber Ward", Me, HP <= 50)) return true;
- if (MercCast("Dispatch", THP <= 30f)) return true;
- if (MercCast("Blade Storm", TWR10 >= 2 || StrongOrGreater(CT))) return true;
- if (MercCast("Cyclone Slash", TWR5 >= 2)) return true;
- if (MercCast("Master Strike")) return true;
- if (MercCast("Force Sweep", TWR5 >= 2)) return true;
- if (MercCast("Cauterize")) return true;
- if (MercCast("Zealous Strike")) return true;
- if (MercCast("Merciless Slash")) return true;
- if (MercCast("Zealous Leap")) return true;
- if (MercCast("Force Exhaustion")) return true;
- if (MercCast("Dispatch")) return true;
- if (MercCast("Crippling Throw", StrongOrGreater(CT))) return true;
- if (MercCast("Leg Slash", StrongOrGreater(CT))) return true;
- if (MercCast("Pacify", StrongOrElite(CT))) return true;
- if (MercCast("Riposte")) return true;
- if (MercCastOnGround("Force Sweep", TWR5 >= 3 || StrongOrGreater(CT), CT)) return true;
- if (MercCast("Master Strike")) return true;
- if (MercCast("Force Leap")) return true;
- if (MercCast("Slash")) return true;
- if (MercCast("Strike")) return true;
- return false;
- }
- public static bool AssassinCombat()
- {
- //WaitForCast();
- datLCL = DateTime.Now;
- //Thread.Sleep(100);
- LoadVars();
- MercBuffSelf("Mark of Power");
- MercBuffSelf("Dark Charge");
- if (!TargetInCombat()) return false;
- if (!CT.InCombat && CT.HealthPercent > .2f)
- {
- MercBuffSelf("Stealth");
- Thread.Sleep(400);
- while (CT.Distance > .15f) MoveTo(CT, .15f);
- if (!MercCast("Maul", CT.Distance <= .20f)) if (!MercCast("Thrash")) MercCast("Shock");
- return true;
- }
- if (MercCast("Unbreakable Will", Me.IsStunned)) return true;
- if (HP <= 30f) UseMedPackInInventory();
- if (MercCast("Electrocute", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Shock", TC && StrongOrGreater(CT))) return true;
- if (MercCast("Jolt", TC && StrongOrGreater(CT))) return true;
- MercCast("Force Speed", TD >= 1.5f);
- MoveTo(CT, MeleeDist);
- if (MercCast("Overcharge Saber", HP <= 70f)) return true;
- if (MercCast("Force Shroud", HP <= 40f)) return true;
- if (MercCast("Deflection", HP <= 50f)) return true;
- if (MercCast("Dark Ward")) return true;
- if (MercCast("Wither", TWR10 >= 2)) return true;
- //if (MercCast("Dark Charge")) return true;
- if (MercCast("Discharge", MyBuffs.Contains("Dark Charge"))) return true;
- if (MercCast("Force Lightning", MyBuffs.Contains("Harnessed Darkness"))) return true;
- if (MercCast("Assassinate", THP <= 30f)) return true;
- if (MercCast("Lacerate", TWR10 >= 3)) return true;
- if (MercCast("Maul")) return true;
- if (MercCast("Shock")) return true;
- if (MercCast("Force Lightning")) return true;
- if (StrongOrGreater(CT))
- {
- if (MercCast("Recklessness")) return true;
- if (MercCast("Electrocute")) return true;
- if (MercCast("Force Slow")) return true;
- }
- //if (!IG) MoveIfNec(.49f);
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercFaceAndCast("Overload", TD <= MeleeDist)) return true;
- if (MercCast("Thrash")) return true;
- if (MercCast("Saber Strike")) return true;
- return false;
- }
- public static void DefenseCombat()
- {
- WaitForCast();
- datLCL = DateTime.Now;
- Thread.Sleep(200);
- LoadVars();
- if (!TargetInCombat()) return;
- if (CT == null && Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (!IG) StopMoving();
- MoveTo(CT, MeleeDist, "Force Leap");
- if (MercCast("Resolute", Me.IsStunned)) return;
- if (!MyBuffs.Contains("Soresu Form")) if (AbilityManager.CanCast("Soresu Form", Me)) if (MercCast("Soresu Form", Me)) return;
- if (!MyBuffs.Contains("Shii-Cho Form")) if (!AbilityManager.CanCast("Soresu Form", Me)) if (MercCast("Shii-Cho Form", Me)) return;
- if (MercCast("Hilt Strike", CT.IsStunned && RS >= 3)) return;
- if (MercCast("Pommel Strike", CT.IsStunned)) return;
- if (MercCast("Dispatch", HP <= 20 && RS >= 3)) return;
- if (MercCast("Hilt Strike", TC && HP <= 30f && MyBuffs.Contains("Saber Ward"))) return;
- if (MercBuffSelf("Endure", HP <= 30)) return;
- if (MercBuffSelf("Saber Ward", HP <= 50)) return;
- if (MercCast("Awe", TWR5 >= 3 && HP <= 60)) return;
- if (MercCast("Force Stasis", TC && HP <= 60f && MyBuffs.Contains("Saber Ward"))) return;
- if (MercBuffSelf("Warding Call", HP <= 60)) return;
- if (MercCast("Sundering Strike")) return;
- if (MercCast("Master Strike")) return;
- if (MercCast("Freezing Force", !CTDebuffs.Contains("Slowed (Force)") && (TWR5 >= 2 || StrongOrGreater(CT)))) return;
- if (MercCast("Blade Storm")) return;
- if (MercCast("Force Sweep", TWR5 >= 2 && RS >= 3)) return;
- if (MercCast("Guardian Slash", RS >= 4 && TWR10 >= 3)) return;
- if (MercCast("Cyclone Slash", TWR5 >= 4)) return;
- if (MercCast("Force Push", TWR10 >= 3)) return;
- if (MercCast("Saber Throw", TD >= MeleeDist)) return;
- if (MercCast("Combat Focus", RS <= 6)) return;
- if (MercCast("Force Kick", TC)) return;
- if (MercCast("Opportune Strike", CTT != CombatToughness.Player)) return;
- if (MercCast("Slash", RS >= 6)) return;
- if (MercCast("Strike")) return;
- }
- public static void CheckForGuarding()
- {
- NGUnit = null;
- NAUnit = null;
- foreach (TorNpc tn in Helpers.Targets.OrderBy(t => t.Distance).Where(t=> t!=null && !t.IsDeleted && !t.IsDead && t.CurrentTarget != Me))
- try
- {
- bool Att = false;
- if (tn != null) if (!tn.IsDeleted) if (tn.InCombat)
- {
- Att = (tn.CurrentTarget.Toughness == CombatToughness.Player);
- if (!Att) if (Comp != null) if (tn.CurrentTarget == Comp) Att = true;
- if (Att)
- {
- TorCharacter pt = tn.CurrentTarget;
- if (pt.HealthPercent < 80) { NGUnit = pt; NAUnit = tn; break; }
- }
- }
- }
- catch { }
- }
- public static bool HandleGuardingJugg()
- {
- //if (!IG) return false;
- if(IG) CheckForGuarding();
- if (NAUnit != null) try
- {
- CT = NAUnit;
- if (MercCast("Taunt", NAUnit)) return true;
- if (MercCast("Intercede", NGUnit)) return true;
- if (MercCast("Saber Throw", NAUnit)) return true;
- //if (MercCast("Guard", NGUnit)) return true;
- }
- catch { }
- return false;
- }
- public static bool JuggernautCombat()
- {
- //Thread.Sleep(200);
- //WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- //if (CT == null && Me.CurrentTarget != null ) CT = Me.CurrentTarget;
- if (!TargetInCombat()) return false;
- if (HP<=30f) UseMedPackInInventory();
- if (MySpec == SkillTreeId.JuggernautImmortal) if (MercBuffSelf("Soresu Form")) return true;
- if (MySpec == SkillTreeId.JuggernautVengeance) if (MercBuffSelf("Shien Form")) return true;
- if (MySpec == SkillTreeId.JuggernautRage) if (MercBuffSelf("Shii-Cho Form")) return true;
- if (MercBuffSelf("Unnatural Might")) return true;
- if (MercCast("Force Charge", CT, TD >= 1.0f && TD <= 3.0f)) return true;
- if (MercCast("Saber Throw", CT, TD >= 1.0f && TD <= 3.0f)) return true;
- if (MercCast("Force Scream", CT, TD <= 1.0f)) return true;
- if (MercCast("Taunt", CT, (TD >= 1.2f && TD <= 3.0f) || StrongOrGreater(CT))) return true;
- //if (!IG) MoveTo(CT, .490f, "Force Charge");
- MoveTo(CT, MeleeDist, "Force Charge");
- // ALOT of these are bugged in SWTOR for Elites in Oricon - annoying as all hell
- if (TC && StrongOrGreater(CT)) {
- if (MercCast("Disruption")) return true;
- if (MercCast("Backhand")) return true;
- if (MercCast("Force Push")) return true;
- if (MercCast("Force Charge")) return true;
- if (MercCast("Savage Kick")) return true;
- if (MercCast("Taunt")) return true;
- if (MercCast("Force Choke")) return true;
- }
- //StopMoving();
- if (MercCast("Unleash", CT, BuddyTor.Me.IsStunned)) return true;
- if (MercCast("Smash", CT, TWR5 >= 2 || (StrongOrGreater(CT) && TD <= MeleeDist))) return true;
- if (MercCast("Heroic Moment: Call on the Force", BuddyTor.Me, DateTime.Now.Subtract(datLCCoTF).TotalSeconds >= 900 && HP <= 50f)) { datLCCoTF = DateTime.Now; return true; }
- if (HP <= 30f) UseMedPackInInventory();
- if (HP <= 70f)
- {
- if (MercCast("Endure Pain", HP <= 40f)) return true;
- if (MercCast("Invincible", HP <= 50f)) return true;
- if (MercCast("Saber Ward", HP <= 60f)) return true;
- if (MercCast("Enraged Defense", HP <= 70f)) return true;
- if (MercCast("Saber Reflect", HP <= 70f)) return true;
- if (MercCast("Heroic Moment: Call on the Force", BuddyTor.Me, DateTime.Now.Subtract(datLCCoTF).TotalSeconds >= 900 && HP <= 50f)) { datLCCoTF = DateTime.Now; return true; }
- }
- if (MercCast("Sundering Assault", CT)) return true;
- if (MercCast("Deadly Throw", StrongOrGreater(CT))) return true;
- if (MercCast("Force Scream", CT)) return true;
- if (MercCast("Backhand")) return true;
- if (MercCast("Retaliation", CT)) return true;
- if (MercCast("Crushing Blow", CT, CTDebuffs.Contains("Armor Reduced") && (TWR5 >= 2 || StrongOrGreater(CT)))) return true;
- if (MercCast("Impale")) return true;
- if (MercCast("Shatter", StrongOrGreater(CT))) return true;
- //if (MercCast("Force Push", (TWR10 >= 3))) return true;
- if (IG && MySpec==SkillTreeId.JuggernautImmortal)
- {
- //if (MercCast("Guard", Comp, CHP <= 50)) return true;
- HandleGuardingJugg();
- }
- if (MercCast("Obliterate", StrongOrGreater(CT))) return true;
- if (MercCast("Ravage")) return true;
- if (MercCast("Force Crush", StrongOrGreater(CT))) return true;
- if (MercCast("Enrage", CT)) return true;
- if (MercCast("Sweeping Slash", (TWR5 >= 3))) return true;
- if (MercCast("Vicious Throw", THP <= 30f)) return true;
- if (MercCast("Pommel Strike", CT.IsStunned)) return true;
- if (MercCast("Force Choke", THP <= 30f)) return true;
- if (MercCast("Intimidating Roar")) return true;
- if (MercCast("Threatening Scream", (TWR10 >= 3 || StrongOrGreater(CT)))) return true;
- if (MercCast("Vicious Slash")) return true;
- if (MercCast("Sweeping Slash",TWR5>=3)) return true;
- if (MercCast("Chilling Scream", !CTDebuffs.Contains("Slow (Force)") && (HP <= 50 || TWR10 >= 2))) return true;
- if (MercCast("Assault")) return true;
- return false;
- }
- public static void VengeanceCombat()
- {
- Thread.Sleep(200);
- WaitForCast();
- datLCL = DateTime.Now;
- LoadVars();
- if (CT == null && Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (MercCast("Shien Form", !MyBuffs.Contains("Shien Form"))) return;
- //if (MercCast("Shi-Cho Form", !MyBuffs.Contains("Shii-Cho Form"))) return;
- if (MercCast("Unnatural Might", !MyBuffs.Contains("Unnatural Might"))) return;
- if (MercCast("Saber Throw", TD >= 1.1f && TD <= 3.0f)) return;
- if (MercCast("Force Charge", TD >= 1.0f && TD <= 3.0f)) return;
- if (MercCast("Force Scream", TD <= 1.0f)) return;
- if (MercCast("Taunt", (TD >= 1.2f && TD <= 3.0f) || StrongOrGreater(CT))) return;
- //if (!IG) MoveTo(CT, .490f, "Force Charge");
- MoveTo(CT, .490f, "Force Charge");
- if (!IG && BuddyTor.Me.IsMoving) StopMoving();
- if (MercCast("Unleash", Me, BuddyTor.Me.IsStunned)) return;
- if (MercCast("Disruption", TC)) return;
- if (MercCast("Smash", (TWR5 >= 2 || (StrongOrGreater(CT)) && TD <= MeleeDist))) return;
- if (MercCast("Enraged Defense", Me, HP <= 80f)) return;
- if (MercCast("Saber Reflect", BuddyTor.Me, HP <= 70f)) return;
- if (MercCast("Heroic Moment: Call on the Force", BuddyTor.Me, DateTime.Now.Subtract(datLCCoTF).TotalSeconds >= 900 && HP <= 50f)) { datLCCoTF = DateTime.Now; return; }
- if (MercCast("Saber Ward", BuddyTor.Me, HP <= 60f)) return;
- if (MercCast("Invincible", BuddyTor.Me, HP <= 50f)) return;
- if (MercCast("Endure Pain", BuddyTor.Me, HP <= 40f)) return;
- if (HP <= 60f) UseMedPackInInventory();
- //if (MercCast("Force Push", (TWR10 >= 3))) return;
- //if (MercCast("Guard", Comp, CHP <= 50)) return;
- HandleGuardingJugg();
- if (MercCast("Impale")) return;
- if (MercCast("Savage Kick")) return;
- if (MercCast("Sundering Assault")) return;
- if (MercCast("Retaliation")) return;
- if (MercCast("Ravage")) return;
- if (MercCast("Enrage", Me)) return;
- if (MercCast("Crushing Blow")) return;
- if (MercCast("Backhand")) return;
- if (MercCast("Sweeping Slash", (TWR5 >= 3))) return;
- if (MercCast("Vicious Throw", THP <= 30f)) return;
- if (MercCast("Pommel Strike", CT.IsStunned)) return;
- if (MercCast("Force Choke", THP <= 30f)) return;
- if (MercCast("Deadly Throw")) return;
- if (MercCast("Intimidating Roar")) return;
- if (MercCast("Chilling Scream", !CTDebuffs.Contains("Slow (Force)") && (HP <= 50 || TWR10 >= 2))) return;
- if (MercCast("Threatening Scream", (TWR10 >= 3))) return;
- if (MercCast("Vicious Slash")) return;
- if (MercCast("Assault")) return;
- }
- // Credit to ChinaJade and WingIt for this routine
- public static void MovementToggle()
- {
- MovementAllowedOrig = !MovementAllowedOrig;
- Logger.Write("Movement Toggled " + (MovementAllowedOrig ? "ON" : "OFF"));
- MovementToggle(MovementAllowedOrig);
- }
- public static void MovementToggle(bool MoveOn)
- {
- if (!MoveOn)
- {
- Buddy.Navigation.Navigator.NavigationProvider = NoNavigationProvider;
- Buddy.Navigation.Navigator.MovementProvider = NoMovementProvider;
- }
- else
- {
- Buddy.Navigation.Navigator.NavigationProvider = DefaultNP;
- Buddy.Navigation.Navigator.MovementProvider = DefaultMP;
- }
- }
- //private static System.EventHandler ShutdownHandler(object obj, System.Windows.ExitEventArgs args)
- ////private static System.EventHandler ShutdownHandler()
- //{
- // if (thMonMem != null && thMonMem.IsAlive)
- // {
- // thMonMem.Abort();
- // Thread.Sleep(2000);
- // thMonMem = null;
- // Thread.Sleep(2000);
- // }
- // return null;
- //}
- private static bool HandleDebuffs()
- {
- return HandleDebuffs(Me);
- }
- private static bool HandleDebuffs(TorCharacter unit)
- {
- try
- {
- if (unit == null) return false;
- foreach (TorEffect te in unit.Debuffs)
- {
- string spellCure = "";
- if (MySpec == SkillTreeId.MercenaryBodyguard) spellCure = "Cure";
- else if (MySpec == SkillTreeId.CommandoCombatMedic) spellCure = "Field Aid";
- else if (MySpec == SkillTreeId.SageSeer) spellCure = "Restoration";
- else if (MySpec == SkillTreeId.SorcererCorruption) spellCure = "Purge";
- else { return false; }
- if (te.Name.Contains("Burning")) if (MercCast(spellCure, unit)) return true;
- //if (te.Name.Contains("Armor")) if (MercCast(spellCure, unit)) return true; // Can't be dispelled
- if (te.Name.Contains("Slowed")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Shocked")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Poisoned")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Crippling")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Crush")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Infected")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Bleeding")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Grav")) if (MercCast(spellCure, unit)) return true;
- if (te.Name.Contains("Hallucinat")) if (MercCast(spellCure, unit)) return true;
- }
- }
- catch { }
- return false;
- }
- public static bool MercBuffSelf(string theSpell, bool req=true)
- {
- if (theSpell == "") return false;
- if (Me.HasBuff(theSpell)) return false;
- return MercCast(theSpell, BuddyTor.Me, req);
- }
- //public static bool MercCastOnGround(string theSpell, bool requirements, TorCharacter unit)
- //{
- // if (unit == null) return false;
- // if (theSpell == "") return false;
- // return MercCastOnGround(theSpell, requirements, unit, false);
- //}
- public static bool MercCastOnGround(string theSpell, bool requirements, TorCharacter unit, bool OnlyInCombat=false)
- {
- if (unit == null) unit=CT;
- if (theSpell == "") return false;
- if (unit.IsDead) return false;
- try
- {
- if (requirements) if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, unit))
- {
- datLCs = DateTime.Now;
- Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " THP: " + CT.HealthPercent.ToString("00.00") + " Casting " + theSpell);
- AbilityManager.Cast(theSpell, unit.Position);
- Thread.Sleep(500);
- if (OnlyInCombat)
- {
- while (Me.InCombat && Me.IsCasting) Thread.Sleep(500);
- return true;
- }
- WaitForCast();
- BuddyTor.Me.ClearTarget();
- return true;
- }
- }
- catch { }
- return false;
- }
- // Used in 'Directional Casting' such as Pulse Cannon - WE HAVE TO BE FACING THE TARGET FIRST - otherwise - useless
- public static bool MercFaceAndCast(string theSpell, bool req)
- {
- if (CT == null) return false;
- if (theSpell == "") return false;
- if (req)
- {
- CT.Face(); // Bug w/Face() - do it twice to be safe
- CT.Face();
- Thread.Sleep(300);
- if (MercCast(theSpell, TD <= 1.0f)) return true;
- }
- return false;
- }
- public static bool MercCast(string theSpell)
- {
- return MercCast(theSpell, CT, true);
- }
- public static bool MercCast(string theSpell, bool req = true)
- {
- return MercCast(theSpell, CT, req);
- }
- public static bool MercCastX(string theSpell, bool req = true)
- {
- return MercCastX(theSpell, CT, req);
- }
- public static bool MercCastX(string theSpell, TorCharacter theChar = null, bool req = true)
- {
- try
- {
- if (theChar == null) return false;
- if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, theChar) && CT != BuddyTor.Me)
- {
- Buddy.CommonBot.AbilityManager.Cast(theSpell, theChar);
- Logger.Write("PvP Cast " + theSpell);
- WaitForCast();
- return true;
- }
- if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, Me))
- {
- Buddy.CommonBot.AbilityManager.Cast(theSpell, Me);
- Logger.Write("PvP Cast " + theSpell);
- WaitForCast();
- return true;
- }
- }
- catch { }
- return false;
- }
- public static bool MercCast(string theSpell, TorCharacter theChar=null, bool req = true)
- {
- try
- {
- ObjectManager.Update();
- if (!req) return false;
- if (theChar == null) theChar=CT;
- if (theChar == null) return false;
- if (theSpell == "") return false;
- if (theChar.IsDead) return false;
- //if (theChar.Toughness==CombatToughness.Player) theChar=(TorCharacter)theChar;
- //if (BuddyTor.Me.PvpFlagged)
- // if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, BuddyTor.Me.CurrentTarget) && CT!=BuddyTor.Me)
- // {
- // datLCs = DateTime.Now;
- // Buddy.CommonBot.AbilityManager.Cast(theSpell, BuddyTor.Me.CurrentTarget);
- // Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " THP: " + CT.HealthPercent.ToString("00.00") + " CT Scale: " + theChar.Scale.ToString("00.00") + " Casting " + theSpell //+ " on " + Me.CurrentTarget.Name
- // );
- // Thread.Sleep(1100);
- // WaitForCast();
- // BuddyTor.Me.ClearTarget();
- // //if (Me.CurrentTarget.Name == Me.Name) BuddyTor.Me.ClearTarget();
- // return true;
- // }
- int SleepAfterCast = 300;
- if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, theChar))
- {
- datLCs = DateTime.Now;
- Buddy.CommonBot.AbilityManager.Cast(theSpell, theChar);
- //Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " MyFac: " + Me.cbtFaction.ToString() +" AC: " + (Attackers==null?0:Attackers.Count()).ToString() + " TFac: " + CT.cbtFaction.ToString() +
- //Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " HostileFriendly: " + CT.IsHostile.ToString() + " " + CT.IsFriendly.ToString() + " " + CT.IsNeutral.ToString() + " AC: " + (Attackers==null?0:Attackers.Count()).ToString() +
- Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " AC: " + (Attackers==null?0:Attackers.Count()).ToString() +
- " CTScale: " + CT.Scale.ToString("0.0") +
- " THP: " + CT.HealthPercent.ToString("00.00") + " Comp: " + (Comp != null ? Comp.Name : "NONE").ToString() +
- " CHP: " + CHP.ToString("000.0") + " Casting " + theSpell //+ " on " + theChar.Name
- );
- Thread.Sleep(SleepAfterCast);
- WaitForCast();
- //if (theChar.Name==Me.Name) BuddyTor.Me.ClearTarget();
- return true;
- }
- //if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, BuddyTor.Me.CurrentTarget))
- //{
- // datLCs = DateTime.Now;
- // Buddy.CommonBot.AbilityManager.Cast(theSpell, BuddyTor.Me.CurrentTarget);
- // Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " AC: " + (Attackers == null ? 0 : Attackers.Count()).ToString() + " CTScale: " + CT.Scale.ToString("0.0") +
- // " THP: " + CT.HealthPercent.ToString("00.00") + " Comp: " + (Comp != null ? Comp.Name : "NONE").ToString() +
- // " CHP: " + CHP.ToString("000.0") + " Casting " + theSpell //+ " on " + theChar.Name
- // );
- // Thread.Sleep(SleepAfterCast);
- // WaitForCast();
- // //if (theChar.Name==Me.Name) BuddyTor.Me.ClearTarget();
- // return true;
- //}
- //if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, null))
- //{
- // datLCs = DateTime.Now;
- // Buddy.CommonBot.AbilityManager.Cast(theSpell, null);
- // Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " AC: " + (Attackers == null ? 0 : Attackers.Count()).ToString() + " CTScale: " + CT.Scale.ToString("0.0") +
- // " THP: " + CT.HealthPercent.ToString("00.00") + " Comp: " + (Comp != null ? Comp.Name : "NONE").ToString() +
- // " CHP: " + CHP.ToString("000.0") + " Casting " + theSpell //+ " on " + theChar.Name
- // );
- // Thread.Sleep(SleepAfterCast);
- // WaitForCast();
- // //if (theChar.Name==Me.Name) BuddyTor.Me.ClearTarget();
- // return true;
- //}
- if (Buddy.CommonBot.AbilityManager.CanCast(theSpell, BuddyTor.Me))
- {
- datLCs = DateTime.Now;
- Buddy.CommonBot.AbilityManager.Cast(theSpell, BuddyTor.Me);
- Logger.Write("HP: " + HP.ToString("000.0") + " RS: " + RS.ToString("000.0") + " AC: " + (Attackers == null ? 0 : Attackers.Count()).ToString() + " CTScale: " + CT.Scale.ToString("0.0") +
- " THP: " + CT.HealthPercent.ToString("00.00") + " Comp: " + (Comp != null ? Comp.Name : "NONE").ToString() +
- " CHP: " + CHP.ToString("000.0") + " Casting " + theSpell //+ " on " + theChar.Name
- );
- Thread.Sleep(SleepAfterCast);
- WaitForCast();
- //if (theChar.Name==Me.Name) BuddyTor.Me.ClearTarget();
- return true;
- }
- }
- catch { }
- return false;
- }
- public static void MercForcedCast(string theSpell, TorCharacter theUnit)
- {
- try
- {
- if (theSpell == "") return;
- datLCs = DateTime.Now;
- Buddy.CommonBot.AbilityManager.Cast(theSpell, theUnit);
- WaitForCast();
- }
- catch { }
- }
- static bool HaveTarget()
- {
- if (CT != null) if (!CT.IsFriendly && !CT.IsDead) return true;
- return false;
- }
- static void CheckForGroup()
- {
- IG = (!PullIG && BuddyTor.Me.GroupId != 0);
- }
- public static void GetEffects()
- {
- MyBuffs = ""; // Me.HasBuff(X) will ignore element 0 - buggy, so created this
- try {foreach (TorEffect te in BuddyTor.Me.Buffs) MyBuffs += te.Name + ";";} catch { }
- CTDebuffs = "";
- try {if (CT != null) foreach (TorEffect te in CT.Debuffs) CTDebuffs += te.Name + ";";} catch { }
- }
- public static int MobsInRangeOf(Buddy.Common.Math.Vector3 Loc, float Range)
- {
- int MC = 0;
- try
- {
- foreach (TorNpc t in Attackers.Where(t => t!=null && !t.IsDeleted && !t.IsDead))
- if ( !(t.Toughness==CombatToughness.Player || t.Toughness==CombatToughness.Companion) && t.HealthPercent>=.2f
- && !t.IsFriendly && Buddy.Common.Math.Vector3.Distance(Loc, t.Position)<=Range) MC+=1;
- }
- catch { }
- return MC;
- }
- public static TorPlayer Me { get { return (TorPlayer)BuddyTor.Me; } }
- public static void UseQuestItem(string theItem, TorCharacter theUnit=null, float WithinRange=1.5f, int SleepAfterUse=5000)
- {
- //foreach (var o in BuddyTor.Me.InventoryEquipment)
- foreach (var o in BuddyTor.Me.InventoryQuest)
- {
- if (o.Name.Contains(theItem) && o.MinimumLevel <= Me.Level)
- {
- Logger.Write("Using Quest Item " + o.Name + "...");
- if (theUnit != null)
- {
- MoveTo(theUnit, WithinRange);
- Thread.Sleep(500);
- }
- o.Use();
- o.Interact();
- o.Interact();
- Thread.Sleep(1000);
- WaitForCast();
- if (SleepAfterUse != 0)
- {
- Thread.Sleep(SleepAfterUse);
- Logger.Write("Sleeping after Item-Use for " + SleepAfterUse.ToString() + "...");
- }
- return;
- }
- }
- }
- public static void AdjCTIfNull()
- {
- if (CT != null && (CT.Name == MyName || CT.Name == CompName))
- {
- CT = null;
- BuddyTor.Me.ClearTarget();
- }
- if (CT != null) return;
- TorCharacter CTx = BuddyTor.Me.CurrentTarget;
- string CTName = "NONE";
- if (CTx!=null) CTName = CTx.Name;
- if (!IG && CT == null && CTName!=MyName && CTName!=CompName) CT = CTx;
- }
- public static void CheckCombatQuestItemUsage()
- {
- var CTx = Me.CurrentTarget;
- if (Buddy.CommonBot.ConditionParser.HasQuest(0xE0006744EE8D74C2) && !Buddy.CommonBot.ConditionParser.IsStepComplete(0xE0006744EE8D74C2, 2))
- if (CTx != null && CTx.Name.Contains("Savant") && CTx.HealthPercent<=30f) UseQuestItem("Savant Subjugation Device", CTx, 20f, 15000);
- if (Buddy.CommonBot.ConditionParser.HasQuest(0xE0003BF69E6650DB) && !Buddy.CommonBot.ConditionParser.IsStepComplete(0xE0003BF69E6650DB, 2))
- if (CTx != null && CTx.Name.Contains("Unstable Defense Droid")) UseQuestItem("Veek's Modified Ion Gun", CTx, 1.0f, 15000);
- }
- // If I have myself or my own companion targeted, clear the target - name used due to possibility of a non-pointer/handle-match
- public static void ClearTargetIfNec()
- {
- try
- {
- if (Me.CurrentTarget != null && (Me.CurrentTarget.Name == MyName || Me.CurrentTarget.Name == CompName)) BuddyTor.Me.ClearTarget();
- }
- catch { }
- }
- public static void LoadVars()
- {
- CheckGC();
- DateTime LVStart = DateTime.Now;
- if (Me.InCombat) CheckCombatQuestItemUsage();
- try
- {
- ObjectManager.FlushOldEntries();
- ObjectManager.Update();
- GetEffects();
- CompName = "NONE";
- MyName = "NONE";
- ClearTargetIfNec();
- CheckForGroup();
- GetAttackers();
- CompTarg = null;
- PullIG = false; // They wanna pull shit, they can do it MANUALLY
- TD = 100;
- RS = 50;
- TC = false;
- LHH = 0;
- CTT = CombatToughness.None;
- LHD = 100;
- THP = 0;
- TC = false;
- THP = 100;
- if (Me.CurrentTarget!=null && Me.CurrentTarget.Name==MyName) BuddyTor.Me.ClearTarget();
- RS = BuddyTor.Me.ResourceStat;
- HP = BuddyTor.Me.HealthPercent;
- EP = BuddyTor.Me.EnergyPercent;
- if (!IG)
- {
- LHDebuffs.Clear();
- string strLHDebuffs = "";
- foreach (var db in Me.Debuffs) try
- {
- { LHDebuffs.Add(db.Name, db.Stacks); strLHDebuffs += db.Name + ":" + db.Stacks.ToString() + ";"; }
- }
- catch { }
- }
- if (Me.Class == CharacterClass.BountyHunter || Me.Class == CharacterClass.Trooper)
- {
- RS = Math.Min((float)Me.ResourceStat, (float)Me.EnergyPercent);
- RS = Math.Min(RS, (float)Me.Energy);
- }
- if (MyName == "") MyName = BuddyTor.Me.Name;
- if (BuddyTor.Me.InCombat && HP >= 10f) LastCombatPt = Me.Position;
- //using (BuddyTor.Memory.AcquireFrame()) ...
- CTP = null;
- if (!IG && CT != null && (CT.IsDead || CT.HealthPercent < .2f) && CT == DPSLastTarget)
- {
- DPSTotalDamage += DPSHealthStart;
- DPSTotalFightTime += DateTime.Now.Subtract(DPSCheckStart).TotalSeconds;
- Logger.Write("Rough Average Single-Target DPS: " + (DPSTotalDamage / DPSTotalFightTime).ToString("0.0"));
- }
- if (!IG && CT != null && CT != DPSLastTarget && BuddyTor.Me.InCombat)
- {
- DPSLastTarget = CT;
- DPSCheckStart = DateTime.Now;
- DPSHealthStart = CT.Health;
- }
- CT = null;
- try
- {
- if (!IG && Attackers != null) if (Attackers.Count() > 0) foreach (TorNpc d in Attackers) if (!d.IsDead && d.HealthPercent > .1f) { CT = d; break; }
- if (Me.CurrentTarget != null && Me.CurrentTarget.Toughness == CombatToughness.Player && !Me.PvpFlagged) { CT = null; Me.ClearTarget(); }
- }
- catch { }
- TorCharacter GT = null;
- if (IG)
- {
- GT = GetGroupTarget();
- if (GT != null)
- {
- if (GT!=null) CT = (TorCharacter)GT;
- GT.Target();
- if (IG && CT!=null && !CT.IsDeleted && CT.Toughness != CombatToughness.Player && CT.IsHostile) Is55H = (CT.Level >= 55);
- }
- }
- //if (IG) CT = Me.CurrentTarget;
- if (!IG && CHP <= 70f && Attackers != null && Attackers.Count() > 0) foreach (TorCharacter att in Attackers) if (att.CurrentTarget.Name == CompName) { CT = att; break; }
- //if (!IG && CT != null && !(CT.IsNeutral || CT.IsFriendly || CT.IsHostile))
- //{
- // Logger.Write("Vendor/'Friendly' targeted, blacklisting.");
- // if (!Buddy.CommonBot.Blacklist.Contains(CT.Guid)) Buddy.CommonBot.Blacklist.Add(CT, BlacklistFlags.Kill, TimeSpan.FromSeconds(300));
- // if (!MyBlacklist.ContainsKey(CT.Guid)) MyBlacklist.Add(CT.Guid, DateTime.Now);
- // CT = null;
- // Me.ClearTarget();
- //}
- if (!IG && CT == null && LastComp != null && LastComp.CurrentTarget != null && LastComp.CurrentTarget.Name!=MyName && LastComp.CurrentTarget.Name!=CompName) {CT = LastComp.CurrentTarget; CT.Target();}
- if (CT != null) if (CT.Guid != CG)
- {
- Logger.Write("Initiating Combat with " + CT.Name + " InGroup: " + IG.ToString() + " My Spec: " + MySpec.ToString());
- Me.ClearTarget();
- CT.Target();
- CG = CT.Guid;
- CS = DateTime.Now;
- }
- if (CT != null)
- try
- {
- CTT = CombatToughness.None;
- MeleeDist = .50f;
- if (CT.Scale == .80f || CT.Scale == 1.3f) MeleeDist = 1.0f;
- CTT = CT.Toughness;
- TD = BuddyTor.Me.Position.Distance(CT.Position);
- TC = CT.IsCasting;
- THP = CT.HealthPercent;
- }
- catch { }
- CompTarg = null;
- CHP = 100;
- if (!IG)
- {
- var CompX = Comp;
- if (CompX != null && !CompX.IsDead && CompX.CurrentTarget != null)
- {
- var CTx = CompX.CurrentTarget;
- if (!CTx.IsFriendly && CTx != CompX && CTx != Me && CTx.Name != MyName) CompTarg = CompX.CurrentTarget;
- }
- }
- TWR30 = 0;
- TWR10 = 0;
- TWR5 = 0;
- }
- catch { }
- if (Attackers != null)
- try
- {
- TWR30 = Attackers.Where(o => o.Distance <= 3.0f).Count();
- TWR10 = Attackers.Where(o => o.Distance <= 1.50f).Count();
- TWR5 = Attackers.Where(o => o.Distance <= MeleeDist).Count();
- }
- catch { }
- if (ReportDurs) Logger.Write("LoadVar Dur: " + DateTime.Now.Subtract(LVStart).TotalMilliseconds.ToString("0ms"));
- }
- public static TorCharacter Comp
- {
- get
- {
- float HealthTest = 0;
- float DistTest = 0;
- if (IG || BuddyTor.Me.IsMounted || BuddyTor.Me.PvpFlagged) return null;
- bool bErr = false;
- if (LastComp!=null) try
- {
- HealthTest = ((TorNpc)LastComp).HealthPercent;
- DistTest = LastComp.Distance;
- }
- catch { bErr = true; }
- // If it's been 10 or more seconds since we acquired the 'last reused the comp handle' then force a requery to get the most recent comp, otherwise if no error on Health/Distance, return the last comp queried
- if (DateTime.Now.Subtract(datLCC).TotalSeconds < 10 && !bErr && LastComp != null) { CHP = HealthTest; CompName = LastComp.Name; return (TorCharacter)LastComp; }
- DateTime CompCheckBeg = DateTime.Now;
- TorCharacter LastCompX=null;
- foreach (TorNpc mob in ObjectManager.GetObjects<TorNpc>().OrderBy(t => t.Distance))
- try
- {
- if (mob != null && !mob.IsDeleted && mob.Toughness==CombatToughness.Companion && mob.Distance<=5.0f) //if (!mob.IsDeleted)
- {
- CHP = mob.HealthPercent;
- datLCC = DateTime.Now;
- LastComp = mob;
- LastCompX=mob;
- break;
- }
- }
- catch {}
- if (LastCompX != null)
- {
- try
- {
- //LastComp = (TorCharacter)LastCompX;
- CompName = LastComp.Name;
- //CHP = LastComp.HealthPercent;
- }
- catch { LastComp = null; CompName = "NONE"; CHP = 100; }
- }
- if (ReportDurs) Logger.Write("Companion Check Dur: " + DateTime.Now.Subtract(CompCheckBeg).TotalMilliseconds.ToString("0ms"));
- return (TorCharacter)LastComp;
- }
- }
- public static bool IsBG { get { return BuddyTor.Me.AdvancedClass == Buddy.Swtor.AdvancedClass.Mercenary; } }
- public static bool IsCM { get { return BuddyTor.Me.AdvancedClass == Buddy.Swtor.AdvancedClass.Commando; } }
- public static bool IsSage { get { return BuddyTor.Me.AdvancedClass == Buddy.Swtor.AdvancedClass.Sage; } }
- //public static void CheckForHeals(float minH)
- //{
- // try
- // {
- // LHUnit = null;
- // LHUnit = UnitLowOnHealth(minH);
- // LHH = 100f;
- // LHD = 100f;
- // if (LHUnit != null)
- // {
- // LHH = LHUnit.HealthPercent;
- // LHD = LHUnit.Distance;
- // LHP = LHUnit.Position;
- // }
- // }
- // catch { }
- //}
- // Get the 'Group Target'
- // Verify that the player's target IS NOT a player.
- // Trying to query objects objects of NPC/Player type, by using type, doesn't work at the moment, so you get Players with an NPC query, and vice versa.
- // To Sum it All Up: Listen to the song, 'Hot Dog', by Limp Bizkit.
- public static TorCharacter GetGroupTarget()
- {
- foreach (TorPlayer unit in ObjectManager.GetObjects<TorPlayer>().OrderBy(o => o.Distance).Where(o => o!=null && !o.IsDeleted && o.Toughness==CombatToughness.Player && o.Name!=MyName))
- try
- {
- if (unit.Distance <= 4.5f && unit.Toughness==CombatToughness.Player)
- {
- var t=unit.CurrentTarget;
- if (t != null && !t.IsFriendly && t.Toughness!=CombatToughness.Player && unit.InCombat && !unit.IsStunned)
- {
- Logger.Write("Group Target Determined: " + t.Name);
- return (TorCharacter)t;
- }
- }
- }
- catch { }
- foreach (TorCharacter o in ObjectManager.GetObjects<TorCharacter>().OrderBy(o => o.Distance)
- .Where(o => o != null && !o.IsDeleted && o.Toughness != CombatToughness.Player && o.Name != MyName && o.InCombat && o.CurrentTarget != null &&
- o.CurrentTarget.Name == MyName)) return (TorCharacter)o;
- return null;
- }
- public static bool CheckPlayerBuffs(string Buff)
- {
- if (BuddyTor.Me.IsMounted) return false;
- if (DateTime.Now.Subtract(datLBC).TotalSeconds < 20) return false;
- try
- {
- foreach (TorPlayer unit in ObjectManager.GetObjects<TorPlayer>().OrderBy(t => t.HealthPercent).Where(t=>t!=Me))
- if (unit.Distance <= 2.8f && unit.IsFriendly && unit.InLineOfSight && !unit.HasBuff(Buff))
- { datLBC = DateTime.Now; MercCast(Buff, unit); Thread.Sleep(500); BuddyTor.Me.ClearTarget(); return true; }
- }
- catch {
- return false;
- }
- return false;
- }
- public static void GetGroupLHUnitInfo(float minH)
- {
- LHUnit = null;
- LHH = 100f;
- LHD = 100f;
- for (int inti = 0; inti < 3; inti++)
- {
- try
- {
- //foreach (TorCharacter unit in ObjectManager.GetObjects<TorCharacter>().OrderBy(t => t.HealthPercent))
- foreach (TorPlayer unit in ObjectManager.GetObjects<TorPlayer>().OrderBy(o=>o.HealthPercent))//.Where(o=>o.Distance<=3.00f))
- if (unit!=null && !unit.IsDeleted && !unit.IsHostile && unit.Toughness==CombatToughness.Player && unit.Distance <= 3.0f
- && (float)unit.HealthPercent < minH )
- {
- TorCharacter unitX = (TorCharacter)unit;
- float uhp = (float)unitX.HealthPercent;
- //Logger.Write("Unit: " + unit.Name + " HP: " + uhp.ToString());
- if (uhp < .2f)
- {
- if (MySpec == SkillTreeId.SorcererCorruption) MercForcedCast("Reanimation", unitX);
- else if (MySpec == SkillTreeId.OperativeMedic) MercForcedCast("Resuscitation Probe", unitX);
- else if (MySpec == SkillTreeId.MercenaryBodyguard) MercForcedCast("Onboard AED", unitX);
- else if (MySpec == SkillTreeId.SageSeer) MercForcedCast("Revival", unitX);
- else if (MySpec == SkillTreeId.CommandoCombatMedic) MercForcedCast("Emergency Medical Probe", unitX);
- WaitForCast();
- } else //else
- if (uhp <= minH)
- {
- LHUnit = unitX;
- LHH = LHUnit.HealthPercent;
- LHD = LHUnit.Distance;
- LHP = LHUnit.Position;
- LHDebuffs.Clear();
- string strLHDebuffs="";
- foreach (var db in LHUnit.Debuffs) try
- {
- try { LHDebuffs.Add(db.Name, db.Stacks); strLHDebuffs += db.Name + ":" + db.Stacks.ToString() + ";"; }
- catch { }
- }
- catch { }
- //Logger.Write("LH Debuffs: " + strLHDebuffs);
- return ;
- }
- }
- }
- catch {}
- Thread.Sleep(50);
- }
- }
- public static bool MercMoveAndStop(TorCharacter tc, float rng)
- {
- CommonBehaviors.MoveAndStop(ret => tc.Position, rng, true, "Target Position");
- return false;
- }
- public static bool BGCheckCompHealth()
- {
- try
- {
- TorCharacter CompX = Comp;
- if (CompX == null) return false;
- TorCharacter PT = Me.CurrentTarget;
- if (CHP < 1f)
- {
- if (MercCast("Onboard AED", (TorPlayer)CompX)) return true;
- }
- else if (CHP <= 90f)
- {
- CompX.Target();
- Thread.Sleep(300);
- WaitForCast();
- if (CompX.Distance > 2.8f) { MoveTo(CompX, 2.8f); Thread.Sleep(300); }
- else
- {
- MercCastOnGround("Kolto Missile", true, CompX);
- MercCast("Emergency Scan", CompX);
- MercCast("Kolto Shell", CompX,!CompX.HasBuff("Kolto Shell"));
- MercCast("Kolto Shield", CompX,!CompX.HasBuff("Kolto Shield"));
- MercCast("Healing Scan", CompX);
- MercCast("Rapid Scan", CompX);
- if (MyBuffs.Contains("Combat Support Cylinder")) MercCast("Rapid Shots", CompX);
- }
- WaitForCast();
- PT.Target();
- Thread.Sleep(300);
- }
- }
- catch { Logger.Write("Error in CheckCompHealth()"); }
- return false;
- }
- public static bool CMCheckCompHealth()
- {
- try
- {
- if (Comp == null) return false;
- var CompX = (TorCharacter)Comp;
- HandleDebuffs(CompX);
- if (CHP <= 85f)
- {
- WaitForCast();
- var PT=Me.CurrentTarget;
- CompX.Target();
- Thread.Sleep(250);
- if (Comp.Distance > 2.8f) { MoveTo(Comp, 2.8f); Thread.Sleep(300); }
- if (CHP < 1f)
- {
- if (MercCast("Onboard AED", CompX)) return true;
- }
- else
- {
- if (MercCastOnGround("Kolto Bomb", true, CompX)) Thread.Sleep(600);
- if (
- MercCast("Trauma Probe", CompX, !CompX.HasBuff("Trauma Probe")) ||
- MercCast("Advanced Medical Probe", CompX) ||
- MercCast("Bacta Infusion", CompX) ||
- MercCast("Medical Probe", CompX) ||
- (MyBuffs.Contains("Combat Support Cell") && MercCast("Hammer Shot", CompX)))
- {
- Thread.Sleep(250);
- if (PT == null || PT.Toughness == CombatToughness.Companion)
- Me.ClearTarget();
- else
- PT.Target();
- return true;
- }
- }
- }
- }
- catch { Logger.Write("Error in CheckCompHealth()"); }
- return false;
- }
- public static bool MedicineCheckCompHealth()
- {
- try
- {
- if (Comp == null) return false;
- if (CHP <= 50)
- {
- WaitForCast();
- if (Comp.Distance > 2.8f) { MoveTo(Comp, 2.8f); Thread.Sleep(300); }
- if (CHP < 1f)
- {
- //if (MercCast("Onboard AED", Comp)) return true;
- }
- else
- {
- if (MercCast("Surgical Probe", Comp, MyBuffs.Contains("Tactical Advantage"))) return true;
- if (MercCast("Kolto Infusion", Comp, MyBuffs.Contains("Tactical Advantage"))) return true;
- if (MercCast("Kolto Probe", Comp, HP <= 70 && !Comp.HasBuff("Kolto Probe"))) return true;
- if (MercCast("Kolto Injection", Comp)) return true;
- }
- }
- }
- catch { Logger.Write("Error in CheckCompHealth()"); }
- return false;
- }
- public static bool SeerCheckCompHealth()
- {
- try
- {
- if (Comp == null) return false;
- var CompX = (TorCharacter)Comp;
- if (!CompX.HasBuff("Force Armor")) if (MercCast("Force Armor", CompX)) return true;
- if (CHP <= 50)
- {
- WaitForCast();
- if (Comp.Distance > 2.8f) { MoveTo(Comp, 2.8f); Thread.Sleep(300); }
- if (CHP < 1f || Comp.IsDead)
- {
- if (MercCast("Onboard AED", Comp)) return true;
- }
- else
- {
- var pt = Me.CurrentTarget;
- CompX.Target();
- Thread.Sleep(500);
- if (
- MercCast("Force Armor", CompX, !CompX.HasBuff("Force Armor")) ||
- MercCast("Healing Trance", CompX, true) ||
- MercCast("Rejuvenate", CompX, !CompX.HasBuff("Rejuvenate")) ||
- MercCastOnGround("Salvation", !CompX.HasBuff("Salvation"), CompX) ||
- MercCast("Benevolence", CompX) ||
- MercCast("Deliverance", CompX) ||
- MercCast("Rescue", CompX, CHP <= 20)
- ) { if (pt != null && pt != CompX)pt.Target(); else Me.ClearTarget(); return true; }
- }
- }
- }
- catch { Logger.Write("Error in CheckCompHealth()"); }
- return false;
- }
- public static bool CorruptionCheckCompHealth()
- {
- try
- {
- if (Comp == null) return false;
- var CompX = (TorCharacter)Comp;
- if (!CompX.HasBuff("Static Barrier") && !Comp.HasDebuff("Deionized")) if (MercCast("Static Barrier", CompX)) return true;
- if (CHP <= 75f)
- {
- WaitForCast();
- MoveTo(CompX, 2.8f);
- if (CHP < .2f)
- {
- if (MercCast("Reanimation", CompX)) return true;
- }
- else
- {
- var pt = Me.CurrentTarget;
- CompX.Target();
- Thread.Sleep(200);
- //bool HealedComp = false;
- //if (CompX.Debuffs.Count() >= 2) if (MercCast("Purge")) HealedComp=true;
- //else if (MercCast("Rejuvenate", CompX, !CompX.HasBuff("Rejuvenate"))) HealedComp = true;
- //else if (MercCastOnGround("Revivification", !CompX.HasBuff("Revivification"), CompX)) HealedComp = true;
- //else if (MercCast("Resurgence", CompX)) HealedComp = true;
- //else if (MercCast("Dark Heal", CompX)) HealedComp = true;
- //else if (MercCast("Dark Infusion", CompX)) HealedComp = true;
- //else if (MercCast("Innervate", CompX, !CompX.HasBuff("Innervate"))) HealedComp = true;
- //else if (MercCast("Rescue", CompX, CHP <= 20)) HealedComp = true;
- bool HealedComp = false;
- if (CompX.Debuffs.Count() >= 2) {if (MercCast("Purge")) HealedComp=true;};
- if (!HealedComp) if (
- MercCast("Rejuvenate", CompX, !CompX.HasBuff("Rejuvenate")) ||
- MercCastOnGround("Revivification", !CompX.HasBuff("Revivification"), CompX)||
- MercCast("Resurgence", CompX) ||
- MercCast("Dark Heal", CompX) ||
- MercCast("Dark Infusion", CompX) ||
- MercCast("Innervate", CompX, !CompX.HasBuff("Innervate"))||
- MercCast("Rescue", CompX, CHP <= 20)) HealedComp = true;
- if (pt == null || pt == CompX) Me.ClearTarget(); else pt.Target();
- Thread.Sleep(200);
- if (HealedComp) return true;
- }
- }
- }
- catch (Exception ex) { Logger.Write("Error in CorruptionCheckCompHealth: " + ex.Message); }
- return false;
- }
- public static void TagAlongWithGroup()
- {
- if (BuddyTor.Me.PvpFlagged) return;
- foreach (TorPlayer unit in ObjectManager.GetObjects<TorPlayer>().OrderBy(t => t.Distance).Reverse())
- if (unit!=null && !unit.IsDeleted) try
- {
- MoveTo(unit, 2.0f);
- break;
- }
- catch { }
- }
- public static bool UnitHasBuff(TorCharacter theUnit, string theBuff)
- {
- foreach (var buf in theUnit.Buffs) try
- {
- if (buf != null && !buf.IsDeleted && buf.Name.Contains(theBuff)) return true;
- }
- catch { }
- return false;
- }
- // All Redundant code here is due to timing issues, where the game would bug on the healtargeting, or the bot might miss the 'window'
- // The redundancy mainly added for 55HMs. Apparently the healtargeting bug has been around in SWTOR (game, not bot, bug) and BIG SURPRISE - they haven't fixed it yet.
- // Namely, where you target someone in range for a Cure, heal, etc, and it casts the spell on YOU instead. Good times. Happens mainly with Emergency Scan from what I've seen.
- public static bool BGHeals(float minH, bool UntilFullyHealed=true)
- {
- try
- {
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) return false;
- while (true)
- {
- Thread.Sleep(150);
- WaitForCast();
- if (!LHUnit.InLineOfSight || LHUnit.Distance > 3.0f) MoveTo(LHUnit, 2.5f);
- if (!LHUnit.InLineOfSight || LHUnit.Distance > 3.0f) break;
- //Me.ClearTarget();
- //Thread.Sleep(100);
- // Heal-Targeting in SWTOR is buggy as all fuck, specially for Mercs
- LHUnit.Target(); Thread.Sleep(350);
- LHUnit.Target(); Thread.Sleep(350);
- if (MercCastOnGround("Kolto Missile", true, LHUnit)) Thread.Sleep(800);
- if (MercCast("Kolto Shell", LHUnit, !LHUnit.HasBuff("Kolto Shell"))) Thread.Sleep(800);
- if (MercCast("Cure", LHUnit, NeedsDispell(LHUnit))) Thread.Sleep(800);
- if (!MercCast("Emergency Scan", (TorCharacter)LHUnit, Me.CurrentTarget == LHUnit))
- if (!MercCast("Rapid Scan", LHUnit, MyBuffs.Contains("Critical Efficiency") || LHUnit.HealthPercent<=65f))
- if (!MercCast("Healing Scan", LHUnit, true))
- if (!MercCast("Supercharged Gas", Me, HaveBuffStacks("Supercharge", 30)))
- if (!MercCast("Vent Heat")) ;
- Thread.Sleep(250);
- WaitForCast();
- if (MercCast("Rapid Shots", LHUnit, true)) Thread.Sleep(800);
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) break;
- }
- var pt = GetGroupTarget();
- Me.ClearTarget();
- if (pt != null && pt.Toughness!=CombatToughness.Player) pt.Target();
- return false;
- }
- catch { }
- return false;
- }
- public static bool CMHeals(Single minH)
- {
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) return false;
- TorCharacter pt;
- while (true)
- {
- Thread.Sleep(200);
- WaitForCast();
- MoveTo(LHUnit, 2.5f);
- if (!LHUnit.InLineOfSight || LHUnit.Distance > 2.90f) break;
- LHUnit.Target();
- Thread.Sleep(350);
- LHUnit.Target();
- Thread.Sleep(350);
- if (MercCastOnGround("Kolto Bomb", true, LHUnit)) Thread.Sleep(800);
- if (MercCast("Trauma Probe", LHUnit, LHUnit.InCombat && !LHUnit.HasBuff("Trauma Probe"))) Thread.Sleep(800);
- if (MercCast("Field Aid", LHUnit, NeedsDispell(LHUnit))) Thread.Sleep(800);
- if(!MercCast("Medical Probe", LHUnit, MyBuffs.Contains("Field Triage") || MyBuffs.Contains("Tech Override") || LHUnit.HealthPercent<=70f))
- if(!MercCast("Bacta Infusion", LHUnit, LHH <= 70f))
- if(!MercCast("Advanced Medical Probe", LHUnit, true))
- if(!MercCastOnGround("Kolto Bomb", true, LHUnit))
- if (!MercCast("Hammer Shot", LHUnit)) ;
- Thread.Sleep(200);
- WaitForCast();
- if (MyBuffs.Contains("Combat Support Cell")) if (MercCast("Hammer Shot", LHUnit)) Thread.Sleep(800);
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) break;
- }
- Me.ClearTarget();
- pt = GetGroupTarget();
- if (pt != null && pt.Toughness != CombatToughness.Player) pt.Target();
- Thread.Sleep(200);
- return false;
- }
- public static bool NeedsDispell(TorCharacter theUnit)
- {
- bool DoPurge = false;
- DoPurge=LHDebuffs.Count()>=2 || LHDebuffs.Where(t=>t.Value>=3).Count()>=3;
- //try
- //{ if (!DoPurge) DoPurge = theUnit.Debuffs.Where(db => db != null && !db.IsDeleted && db.Name.Contains("Targeted Laser")).Count() > 0; }
- //catch { }
- //if (!DoPurge) try
- //{
- // int dbC = theUnit.Debuffs.Where(db => db != null && !db.IsDeleted).Count();
- // int dbStack2 = theUnit.Debuffs.Where(db => db != null && !db.IsDeleted && db.Stacks >= 2).Count();
- // if (dbStack2 >= 1 || dbC >= 4) DoPurge = true;
- //}
- //catch { }
- //if (!DoPurge)
- // foreach (TorEffect deb in theUnit.Debuffs)
- // try { if (deb != null && !deb.IsDeleted && deb.Stacks >= 3) { DoPurge = true; break; } }
- // catch { }
- return DoPurge;
- }
- public static bool SeerHeals(float minH)
- {
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) return false;
- if (LHUnit.HealthPercent>minH) return false;
- var pt = Me.CurrentTarget;
- while (true)
- {
- WaitForCast();
- MoveTo(LHUnit, 2.5f);
- if (!LHUnit.InLineOfSight || LHUnit.Distance > 2.90f) break;
- LHUnit.Target();
- Thread.Sleep(350);
- LHUnit.Target();
- Thread.Sleep(350);
- if (MercCast("Force Armor", LHUnit, LHH <= minH && !LHUnit.HasBuff("Force Armor")))Thread.Sleep(900);
- if(NeedsDispell(LHUnit)) if (MercCast("Restoration", LHUnit)) Thread.Sleep(900);
- if(MercCast("Deliverance", LHUnit, MyBuffs.Contains("Resplendence"))) Thread.Sleep(900);
- //if(!MercCast("Rescue", LHUnit, LHH <= 20f))
- if(!MercCast("Healing Trance",LHUnit, true))
- if(!MercCast("Rejuvenate", LHUnit, !LHUnit.HasBuff("Rejuvenate")))
- if(!MercCastOnGround("Salvation", true, LHUnit))
- if(!MercCast("Benevolence", LHUnit, true))
- if(!MercCast("Deliverance", LHUnit, true)) ;
- if(!MercCast("Noble Sacrifice", HP >= 30f && (Me.ForcePercent <= 50f || Me.Force <= Me.ForceMax * .50f)));
- Thread.Sleep(250);
- WaitForCast();
- if (MercCast("Deliverance", LHUnit, MyBuffs.Contains("Resplendence"))) Thread.Sleep(900);
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) break;
- if (LHUnit.HealthPercent > minH) break;
- }
- Me.ClearTarget();
- pt = GetGroupTarget();
- if (pt != null && pt.Toughness != CombatToughness.Player) pt.Target();
- Thread.Sleep(200);
- return false;
- }
- // MAJOR Heal-Targeting bugs in SWTOR - You ARE gonna hit alot of heals that go to YOU instead of the target in here - game bug, not a bot bug
- //public static bool ShieldTank(string theSpell)
- //{
- // foreach (TorPlayer unit in ObjectManager.GetObjects<TorPlayer>().OrderBy(o=>o.HealthPercent))//.Where(o=>o.Distance<=3.00f))
- // if (unit!=null && !unit.IsDeleted && !unit.IsHostile && unit.Toughness==CombatToughness.Player && unit!=Me && unit.Distance <= 3.0f
- // && unit.AdvancedClass==AdvancedClass. )
- //}
- public static bool CorruptionHeals(float minH)
- {
- var pt = Me.CurrentTarget;
- while (true)
- {
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) return false;
- WaitForCast();
- if (LHUnit.InLineOfSight) MoveTo((TorCharacter)LHUnit, 2.5f);
- if (!LHUnit.InLineOfSight || LHUnit.Distance>3.0f) return false;
- LHUnit.Target();
- Thread.Sleep(350);
- LHUnit.Target();
- Thread.Sleep(350);
- if (MercCast("Static Barrier", LHUnit, !LHUnit.HasBuff("Static Barrier"))) Thread.Sleep(900);
- if (NeedsDispell(LHUnit)) if (MercCast("Purge", LHUnit)) Thread.Sleep(800);
- if (MercCastOnGround("Revivification", MyBuffs.Contains("Force Surge"), LHUnit)) Thread.Sleep(900);
- if (!MercCast("Rescue", LHUnit, LHH <= 20))
- if (!MercCast("Innervate", LHUnit, true))
- if (!MercCast("Resurgence", LHUnit, !LHUnit.HasBuff("Resurgence")))
- if (!MercCast("Dark Heal", LHUnit, true))
- if (!MercCast("Dark Infusion", LHUnit, LHH <= 70f))
- if (!MercCastOnGround("Revivification", true, LHUnit))
- if (!MercCast("Consumption", Me.HealthPercent>=30f));
- //if (MercCast("", LHUnit, LHH <= minH && !LHUnit.HasBuff("Healing Trance"))) return true;
- if (MercCastOnGround("Revivification", MyBuffs.Contains("Force Surge"), LHUnit)) Thread.Sleep(900);
- Thread.Sleep(250);
- WaitForCast();
- }
- pt = GetGroupTarget();
- Me.ClearTarget();
- if (pt != null && pt.Toughness != CombatToughness.Player) pt.Target();
- Thread.Sleep(200);
- return false;
- }
- public static bool MedicineHeals(float minH)
- {
- if (Me.ResourceStat < 16.0f && !Me.HasBuff("Tactical Advantage")) return false;
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null) return false ;
- if (LHUnit.HealthPercent > minH) return false;
- var pt = Me.CurrentTarget;
- while (true)
- {
- Thread.Sleep(250);
- WaitForCast();
- MoveTo(LHUnit, 2.5f);
- if (!LHUnit.InLineOfSight || LHUnit.Distance > 3.0f) break;
- LHUnit.Target(); Thread.Sleep(350);
- LHUnit.Target(); Thread.Sleep(350);
- if (MercCast("Recuperative Nanotech", LHUnit))Thread.Sleep(900);
- if (MercCast("Toxin Scan", LHUnit, NeedsDispell(LHUnit)));
- if (MercCast("Kolto Infusion", LHUnit, !LHUnit.HasBuff("Kolto Infusion") && HaveBuffStacks("Tactical Advantage", 2) && Me.ResourceStat>=100f));
- if (MercCast("Surgical Probe", LHUnit, HaveBuffStacks("Tactical Advantage", 2)));
- if (MercCast("Kolto Probe", LHUnit, !LHUnit.HasBuff("Kolto Probe") && !HaveBuffStacks("Tactical Advantage", 2)));
- if (MercCast("Kolto Injection", LHUnit));
- if (MercCast("Diagnostic Scan", LHUnit));
- Thread.Sleep(250);
- WaitForCast();
- if (Me.ResourceStat < 16.0f && !Me.HasBuff("Tactical Advantage")) break;
- GetGroupLHUnitInfo(minH);
- if (LHUnit == null || LHUnit.Distance > 3.0f || !LHUnit.InLineOfSight) break;
- if (LHUnit.HealthPercent > minH) break;
- }
- Me.ClearTarget();
- pt = GetGroupTarget();
- if (pt != null && pt.Toughness != CombatToughness.Player) { pt.Target(); Thread.Sleep(150); }
- return false;
- }
- public static void CheckForDeadComp()
- {
- if (Me.Level < 10) return;
- if (BuddyTor.Me.IsMounted) return;
- var datStart = DateTime.Now;
- try
- {
- var CompX = Comp;
- if (CompX != null) if (!CompX.IsDeleted) if (CompX.IsDead && CompX.HealthPercent < .20f)
- {
- Logger.Write("Reviving Comp...");
- while (DateTime.Now.Subtract(datStart).TotalSeconds<5 && (CompX.Distance>.50f || !CompX.InLineOfSight))
- Buddy.Navigation.Navigator.MoveTo(CompX.Position);
- CompX.Interact();
- Thread.Sleep(2500);
- }
- } catch {}
- }
- // Buggy, not sure why, but always thinks everything is null and returns false
- //public static bool ValidTarget(TorCharacter theTarget)
- //{
- // try {
- // TorCharacter Targ = null;
- // if (theTarget == null) if (!IG) Targ = CT; else Targ = BuddyTor.Me.CurrentTarget;
- // if (Targ == null || Targ == BuddyTor.Me) { Logger.Write("ValidTarget: Null target."); return false; }
- // //Targ = (TorCharacter)Targ;
- // if (Targ.IsDead || Targ.HealthPercent < .2f || Targ.IsFriendly) { Logger.Write("TargetInCombat: Dead or friendly."); return false; }
- // if (!IG || TargetInCombat()) if (Targ.Distance<=3.0f) return true;
- // }
- // catch {}
- // Logger.Write("Error in ValidTarget.");
- // return false;
- //}
- public static void HandleBuffs(string theBuff, bool req=true)
- {
- if (req)
- {
- if (BuddyTor.Me.IsDead || BuddyTor.Me.HealthPercent < .2f) return;
- MercBuffSelf(theBuff);
- CheckPlayerBuffs(theBuff);
- }
- }
- public static void MyRestAndBuffs()
- {
- if (Me.InCombat) return;
- //if (MySpec == SkillTreeId.None)
- if (Me.HasBuff("Crouch") || Me.HasBuff("Take Cover"))
- {
- Buddy.Swtor.Movement.Move(MovementDirection.Forward, TimeSpan.FromMilliseconds(100));
- if (!MovementAllowed) Buddy.Swtor.Movement.Stop(MovementDirection.Forward);
- StopMoving();
- StopMoving();
- }
- MercCast("Stealth", BuddyTor.Me, Me.HasBuff("Stealth"));
- {
- if (Me.Class == CharacterClass.Warrior)
- {
- IsRanged = false;
- WaitForRest(true, "Channel Hatred", true, 0);
- HandleBuffs("Unnatural Might");
- }
- else if (Me.Class == CharacterClass.Inquisitor)
- {
- if (Me.AdvancedClass == AdvancedClass.Assassin) IsRanged = false; else IsRanged = true;
- WaitForRest(true, "Seethe", true, BuddyTor.Me.ForceMax * .8f);
- HandleBuffs("Mark of Power");
- }
- else if (Me.Class == CharacterClass.Agent)
- {
- IsRanged = false;
- HandleBuffs("Coordination");
- WaitForRest(true, "Recuperate", true, 80f);
- }
- else if (Me.Class == CharacterClass.BountyHunter)
- {
- IsRanged = true;
- WaitForRest(true, "Recharge and Reload", true, 80f);
- HandleBuffs("Hunter's Boon");
- }
- else if (Me.Class == CharacterClass.Knight)
- {
- IsRanged = false;
- WaitForRest(true, "Introspection", true, 0f);
- HandleBuffs("Force Might");
- }
- else if (Me.Class == CharacterClass.Consular)
- {
- if (Me.AdvancedClass == AdvancedClass.Shadow) IsRanged = false; else IsRanged = true;
- WaitForRest(true, "Meditation", true, BuddyTor.Me.ForceMax * .8f);
- HandleBuffs("Force Valor");
- }
- else if (Me.Class == CharacterClass.Smuggler)
- {
- IsRanged = true;
- HandleBuffs("Lucky Shots");
- WaitForRest(true, "Recuperate", true, 80f);
- }
- else if (Me.Class == CharacterClass.Trooper)
- {
- IsRanged = true;
- WaitForRest(true, "Recharge and Reload", true, 80f);
- HandleBuffs("Fortification");
- }
- //else if (Me.Class == CharacterClass.Inquisitor)
- //{
- // IsRanged = true;
- // WaitForRest(true, "Seethe", true, .8f * BuddyTor.Me.ForceMax);
- // HandleBuffs("Fortification");
- //}
- }
- // Special Handling for Specs (Group Heals, etc)
- if (MySpec == SkillTreeId.MercenaryBodyguard)
- {
- if (!IG) if (!MyBuffs.Contains("High-Velocity Gas Cylinder")) MercCast("High-Velocity Gas Cylinder", BuddyTor.Me);
- if (IG) if (!MyBuffs.Contains("Combat Support Cylinder")) MercCast("Combat Support Cylinder", BuddyTor.Me);
- if (IG) BGHeals(95f);
- }
- else if (MySpec == SkillTreeId.CommandoCombatMedic)
- {
- if (IG) while(CMHeals(95f));
- MercBuffSelf("Combat Support Cell", true);
- }
- else if (MySpec == SkillTreeId.ScoundrelSawbones)
- {
- if (IG) while (SawbonesHeals(95f)) ;
- //MercBuffSelf("Combat Support Cell", true);
- }
- else if (MySpec == SkillTreeId.VanguardShieldSpecialist)
- {
- MercBuffSelf("Ion Cell");
- }
- else if (MySpec == SkillTreeId.SageSeer)
- {
- if (IG) SeerHeals(95);
- }
- else if (MySpec == SkillTreeId.SorcererCorruption)
- {
- if (IG) CorruptionHeals(95);
- }
- else if (MySpec == SkillTreeId.OperativeMedic)
- {
- if (IG) MedicineHeals(95);
- }
- }
- // Since I override the hell out of everything, this is a shell for combat, empty, to say we DO have a Combat Routine in BuddyWing (All actual combat is invoked through Joe's, through OOCPS->OOC)
- // ... as Combat PrioritySelectors are REQUIRED in BuddyWing, but since per above I override everything, not necessary in the 'BuddyWing Root Declarations'.
- public static Composite MyCombatPSShell()
- {
- return MyCombatPS();
- //return new PrioritySelector();
- }
- // Not sure why, but the .exe seems to definitely prefer a PrioritySelector over an Action, so coded a PrioritySelector for stability-sake.
- public static Composite MyCombatPS()
- {
- if (IAmDead() || !AllowCombat) return new PrioritySelector();
- return //new PrioritySelector(
- //new Action(ret => { if (AllowCombat) while (true) { MyCombat(); ObjectManager.Update(); Thread.Sleep(300); if (!MeOrCompInCombat()) break; } return RunStatus.Failure; });
- new Action(ret => { if (AllowCombat) MyCombat(); return RunStatus.Failure; });
- //, Spell.Cast("DoNothing", ret => false)
- //);
- }
- public static Composite MyOOCPS()
- {
- if (IAmDead()) return new PrioritySelector();
- return new Action(ret =>
- {
- while (true)
- try
- {
- OOC();
- if ((!IG && !DoRandomGrind) || (!IG && DoRandomGrind && IAmDead())) return RunStatus.Failure;
- Thread.Sleep(200);
- }
- catch { return RunStatus.Failure; }
- }
- );
- }
- public static void MyCombat()
- {
- if (IAmDead() || !AllowCombat) return;
- //RunningCombat = true;
- DateLastPingCombat = DateTime.Now;
- //return;
- if (Restarting) return;
- //Logger.Write("Entered MyCombat Void...");
- // while (true)
- {
- CT = Me.CurrentTarget;
- if (CT != null && CT.Name != Me.Name && !CT.IsFriendly)
- {
- MovementAllowed = MovementAllowedOrig;
- //if (BuddyTor.Me.InCombat && !MovementAllowed) { MovementAllowed = true; MovementToggle(true); }
- if (MySpec == SkillTreeId.None)
- switch (BuddyTor.Me.Class)
- {
- case CharacterClass.BountyHunter: while (!IAmDead() && MercenaryCombat()) ; break;
- case CharacterClass.Warrior: while (!IAmDead() && MarauderCombat()) ; break;
- case CharacterClass.Sorcerer: while (!IAmDead() && SorcererCombat()) ; break;
- case CharacterClass.Agent: while (!IAmDead() && SniperCombat()) ; break;
- case CharacterClass.Smuggler: while (!IAmDead() && ScrapperCombat()) ; break;
- case CharacterClass.Trooper: while (!IAmDead() && CommandoCombat()) ; break;
- case CharacterClass.Knight: while (!IAmDead() && WatchmanCombat()) ; break;
- case CharacterClass.Consular: while (!IAmDead() && SageCombat()) ; break;
- default: { break; }
- }
- else switch (MySpec)
- {
- case SkillTreeId.MercenaryBodyguard: while (!IAmDead() && MercenaryCombat())Thread.Sleep(300); break;
- case SkillTreeId.MercenaryArsenal: while (!IAmDead() && MercenaryCombat()); break;
- case SkillTreeId.MercenaryFirebug: while (!IAmDead() && MercenaryCombat()); break;
- case SkillTreeId.PowertechAdvanced: while (!IAmDead() && PowerTechCombat()); break;
- //case SkillTreeId.PowertechFirebug: break; // Bugged - overlapping SkillTreeID on this bug not sure where exactly
- case SkillTreeId.PowertechShieldTech: while (!IAmDead() && PowerTechCombat()); break;
- case SkillTreeId.MarauderAnnihilation: while (!IAmDead() && MarauderCombat()); break;
- case SkillTreeId.MarauderRage: while (!IAmDead() && MarauderCombat()); break;
- case SkillTreeId.MarauderCarnage: while (!IAmDead() && MarauderCombat()); break;
- case SkillTreeId.JuggernautImmortal: while (!IAmDead() && JuggernautCombat()) ; break;
- case SkillTreeId.JuggernautVengeance: while (!IAmDead() && JuggernautCombat()) ; break;
- case SkillTreeId.JuggernautRage: while (!IAmDead() && JuggernautCombat()) ; break;
- case SkillTreeId.SorcererMadness: while (!IAmDead() && SorcererCombat()); break;
- case SkillTreeId.SorcererCorruption: while (!IAmDead() && SorcererCombat()); break;
- case SkillTreeId.SorcererLightning: while (!IAmDead() && SorcererCombat()); break;
- case SkillTreeId.AssassinDarkness: while (!IAmDead() && AssassinCombat()); break;
- case SkillTreeId.AssassinMadness: while (!IAmDead() && AssassinCombat()); break;
- case SkillTreeId.AssassinDeception: while (!IAmDead() && AssassinCombat()); break;
- case SkillTreeId.OperativeMedic: while (!IAmDead() && OperativeCombat()); break;
- case SkillTreeId.OperativeLethality: while (!IAmDead() && OperativeCombat()); break;
- case SkillTreeId.OperativeConcealment: while (!IAmDead() && OperativeCombat()); break;
- case SkillTreeId.SniperEngineering: while (!IAmDead() && SniperCombat()); break;
- case SkillTreeId.SniperMarksmanship: while (!IAmDead() && SniperCombat()); break;
- case SkillTreeId.SniperLethality: while (!IAmDead() && SniperCombat()); break;
- case SkillTreeId.SentinelWatchman: while (!IAmDead() && SentinelCombat()); break;
- case SkillTreeId.SentinelFocus: while (!IAmDead() && SentinelCombat()) ; break;
- case SkillTreeId.SentinelCombat: while (!IAmDead() && SentinelCombat()) ; break;
- case SkillTreeId.GuardianDefense: while (!IAmDead() && GuardianCombat()); break;
- case SkillTreeId.GuardianFocus: while (!IAmDead() && GuardianCombat()); break;
- case SkillTreeId.GuardianVigilance: while (!IAmDead() && GuardianCombat()); break;
- case SkillTreeId.SageSeer: while (!IAmDead() && SageCombat()); break;
- case SkillTreeId.SageTelekinetics: while (!IAmDead() && SageCombat()); break;
- case SkillTreeId.SageBalance: while (!IAmDead() && SageCombat()); break;
- case SkillTreeId.ShadowCombat: while (!IAmDead() && ShadowCombat()); break;
- case SkillTreeId.ShadowBalance: while (!IAmDead() && ShadowCombat()); break;
- case SkillTreeId.ShadowInfiltration: while (!IAmDead() && ShadowCombat()); break;
- case SkillTreeId.CommandoCombatMedic: while (!IAmDead() && CommandoCombat() ||Me.InCombat); break;
- case SkillTreeId.CommandoGunnery: while (!IAmDead() && CommandoCombat()); break;
- case SkillTreeId.CommandoAssaultSpecialist: while (!IAmDead() && CommandoCombat()); break;
- case SkillTreeId.VanguardShieldSpecialist: while (!IAmDead() && SSCombat()); break;
- //case SkillTreeId.VanguardAssaultSpecialist: break;
- case SkillTreeId.VanguardTactics: while (!IAmDead() && SSCombat()); break;
- case SkillTreeId.GunslingerDirtyFighting: while (!IAmDead() && GunslingerCombat()); break;
- case SkillTreeId.GunslingerSaboteur: while (!IAmDead() && GunslingerCombat()); break;
- case SkillTreeId.GunslingerSharpshooter: while (!IAmDead() && GunslingerCombat()); break;
- case SkillTreeId.ScoundrelDirtyFighting: while (!IAmDead() && ScoundrelCombat()); break;
- case SkillTreeId.ScoundrelSawbones: while (!IAmDead() && ScoundrelCombat()); break;
- case SkillTreeId.ScoundrelScrapper: while (!IAmDead() && ScoundrelCombat()); break;
- default: { break; }
- }
- }
- }
- //Logger.Write("Exiting (Complete?) Combat.");
- //RunningCombat = false;
- }
- // If low on inventory, deploy a Field Repair Droid if we have that legacy ability, and sell all qualified.
- public static void CheckInventory()
- {
- bool LowDur = false;
- int MinSlots = 5;
- // Buggy - no use trying on this
- //foreach (var eq in BuddyTor.Me.InventoryEquipped) if (eq.HasDurability && eq.DurabilityPercent <= 50f) { LowDur = true; break; }
- if (LowDur || BuddyTor.Me.FreeInventorySlots < MinSlots) if (taDeployFRD.IsValid)
- {
- Logger.Write("Out of inventory slots, trying to deploy Field Repair Droid.");
- BuddyTor.Me.AbilityActivate(taDeployFRD, Me, out er);
- Thread.Sleep(500); WaitForCast();
- var datStart = DateTime.Now;
- // FUCKING PAIN IN THE ASS - wish I'd never even posted this 'feature' - as always, nothin ever works 'The Following Week'
- while (true)
- {
- if (DateTime.Now.Subtract(datStart).TotalSeconds >= 300) return; // Keep trying for FIVE FUCKING MINUTES
- BuddyTor.Me.ClearTarget();
- Thread.Sleep(3000);
- ObjectManager.Update();
- TorCharacter TheVendor = null;
- // Scan for EVERYTHING UNDER THE SUN until we find SOMETHING
- foreach (TorVendor d in ObjectManager.GetObjects<TorVendor>())//.OrderBy(t=>t.Distance))
- try
- {
- if (d != null && d.Name != null && d.Name.Contains("Field Repair")) { TheVendor = d; break; }
- } catch {}
- if (TheVendor==null) foreach (TorNpc d in ObjectManager.GetObjects<TorNpc>())//.OrderBy(t=>t.Distance))
- try
- {
- if (d != null && d.Name != null && d.Name.Contains("Field Repair")) { TheVendor = d; break; }
- } catch {}
- if (TheVendor==null) foreach (TorCharacter d in ObjectManager.GetObjects<TorCharacter>())//.OrderBy(t=>t.Distance))
- try
- {
- if (d != null && d.Name != null && d.Name.Contains("Field Repair")) { TheVendor = d; break; }
- } catch {}
- if (TheVendor == null) foreach (TorObject d in ObjectManager.GetObjects<TorObject>())//.OrderBy(t=>t.Distance))
- try
- {
- if (d != null && d.Name != null && d.Name.Contains("Field Repair") && d.Distance<=2.0f) { TheVendor = (TorCharacter)d; break; }
- }
- catch { }
- if (TheVendor != null)
- try
- {
- Logger.Write("Vendor " + TheVendor.Name + " found at: " + TheVendor.Position.ToString() + ", trying to interact...");
- TheVendor.Target();
- Thread.Sleep(1000);
- //if (Me.CurrentTarget != null)
- {
- TheVendor.Interact();
- TheVendor.Interact();
- Thread.Sleep(2000);
- Buddy.CommonBot.Logic.BrainBehavior.SellAllItems();
- Thread.Sleep(5000); // Apparently Asynch - Give it enough time to sell it all
- Buddy.Swtor.GuiApiManager.RepairAllItems();
- Thread.Sleep(2000);
- Buddy.Swtor.GuiApiManager.RepairAllItems(); // Fails 1/2 the time, so reducndant
- Thread.Sleep(2000);
- Me.ClearTarget();
- }
- }
- catch { }
- else Logger.Write("I still CANNOT FIND A GODDAMN VENDOR. Sleeping to try again... Give me a moment to delicately smash my keyboard through my monitor.");
- if (Me.FreeInventorySlots >= MinSlots) return;
- Thread.Sleep(3000);
- }
- }
- }
- public static void RunGathering()
- {
- if (!IG && MovementAllowed)
- {
- ScanForLootables();
- ScanForPlaceables();
- HarvestIfNec();
- }
- }
- public static void LoadQuests()
- {
- // Xenovirus Prime - Belsavis Daily
- myHS_XenovirusPrime = new MyQuestDef();
- var myHS = myHS_XenovirusPrime;
- myHS.SetProperties(0xE000D987B579F78A, 2,"Handful of Location Markers","", 7000);
- //myHS.SetItemToUse("Handful of Location Markers");
- myHS.AddToHSList( -49.04824,10.001,-263.1941);
- myHS.AddToHSList(-46.53094,10.001,-263.2531 );
- myHS.AddToHSList(-46.57342,10.001,-258.4337);
- myHS.AddToHSList( -49.1338,10.001,-258.4071);
- myHS.AddToHSList( -61.9276,10.001,-263.2448 );
- myHS.AddToHSList(-59.28479,10.001,-263.2181);
- myHS.AddToHSList( -61.93335,10.001,-258.3529);
- myHS.AddToHSList( -59.26503,10.001,-258.3987);
- //myHS.AddToHSList(-61.95681, 10.001, -263.2149);
- //Droid Malfunction - Belsavis Daily
- myHS_DroidMalfunction = new MyQuestDef();
- myHS = myHS_DroidMalfunction;
- myHS.SetProperties(0xE000BA9BB7DBB97D, 2);
- myHS.AddToHSList(-87.60915, 12.50146, -303.4151);
- myHS.AddToHSList(-88.06365, 12.37658, -307.7879);
- myHS.AddToHSList(-84.47065, 11.88158, -307.719);
- myHS.AddToHSList(-82.41384, 11.35196, -309.6615);
- }
- public static void CheckQuesting()
- {
- if (IG) return;
- myHS_DroidMalfunction.RunThrough();
- myHS_XenovirusPrime.RunThrough();
- }
- // Somewhat experimental at-the-moment
- public static void CheckPOI()
- {
- if (IG) return;
- try
- {
- //foreach (TorPlaceable obj in ObjectManager.GetObjects<Buddy.Swtor.Objects.TorPlaceable>().Where(obj => obj.Name != null && !obj.DisabledForEveryone && (obj.AlwaysUsable || obj.IsLootable || obj.IsUsable)).OrderBy(t => t.Distance))
- foreach (TorPlaceable obj in ObjectManager.GetObjects<Buddy.Swtor.Objects.TorPlaceable>().Where(obj => obj.Name != null).OrderBy(t => t.Distance))
- //if (!MyBlacklist.Contains(obj.Guid.ToString()) && obj.Harvestable!=null && !obj.Harvestable.CanHarvest && obj.QuestIndication!=null && obj.QuestIndication==QuestIndication.QuestActive)
- if (!MyBlacklist.ContainsKey(obj.Guid) && obj.QuestIndication != null && obj.IsUsable && obj.Distance!=null && obj.Distance <= 3.0f && obj.Name!=null && !obj.Name.Contains("Training Dummy"))
- //if (!MyBlacklist.ContainsKey(obj.Guid) && obj.QuestIndication != null && obj.QuestIndication == QuestIndication.QuestActive && !obj.DisabledForEveryone)
- {
- Logger.Write("Questing Object Scan: Found [" + obj.Name + "], working on getting there now.");
- MoveToAndInteract(obj, .30f);
- MyBlacklist.Add(obj.Guid, DateTime.Now);
- if (BuddyTor.Me.InCombat) return;
- }
- }
- catch { return; }
- return;
- //if (Buddy.CommonBot.Poi.Current != null) Logger.Write("POI Type: " + Buddy.CommonBot.Poi.Current.Type + " Loc: " + Buddy.CommonBot.Poi.Current.Location.ToString());
- // If not in-group, not doing RandomGrind etc, just go ahead and move to the POI hotspot if appropriate (helps w/questing etc a little)
- Vector3 theLoc = new Vector3(0, 0, 0);
- string POIName = "";
- var CurHS = Buddy.CommonBot.HotspotManager.CurrentHotspot;
- string StatusText = Buddy.CommonBot.BotMain.StatusText;
- if (StatusText!=null && StatusText.Contains("Using object"))
- {
- int ForPos = StatusText.IndexOf(" for");
- POIName = StatusText.Substring(13, ForPos - 13);
- //Logger.Write("POIName: " + POIName);
- foreach (TorPlaceable obj in ObjectManager.GetObjects<Buddy.Swtor.Objects.TorPlaceable>().Where(obj => obj.Name != null && obj.Name.ToLower().Contains(POIName.ToLower())).OrderBy(t => t.Distance))
- {
- Logger.Write("POI Object Scan: Found [" + POIName + "], working on getting there now.");
- MoveToAndInteract(obj, .3);
- if (BuddyTor.Me.InCombat) return;
- Thread.Sleep(7000);
- }
- }
- return;
- if (!IG && !Me.InCombat && !DoRandomGrind && Buddy.CommonBot.Poi.Current != null && Buddy.CommonBot.Poi.Current.Location.X != 0)
- Logger.Write("POI Type: " + Buddy.CommonBot.Poi.Current.Type.ToString() + " Name: " + Buddy.CommonBot.Poi.Current.Name + " Loc: " + Buddy.CommonBot.Poi.Current.Location.ToString());
- if (!IG && !Me.InCombat && !DoRandomGrind && Buddy.CommonBot.Poi.Current != null && Buddy.CommonBot.Poi.Current.Type != PoiType.Kill && Buddy.CommonBot.Poi.Current.Type != PoiType.Loot &&
- Buddy.CommonBot.Poi.Current.Location.X != 0)
- {
- theLoc = Buddy.CommonBot.Poi.Current.Location;
- POIName = Buddy.CommonBot.Poi.Current.Name;
- }
- else if (CurHS != null && CurHS.X != 0)
- {
- theLoc = CurHS.ToVector3();
- POIName = CurHS.Name;
- }
- if (POIName != "" && theLoc.X != 0)
- try
- {
- //Vector3 theLoc = new Vector3((float)-243.2681, (float)22.03563, (float)28.79927);
- //Buddy.CommonBot.Poi.Current.Type==
- //theLoc = new Vector3((float)theLoc.X, (float)theLoc.Y, (float)theLoc.Z);
- if (theLoc.X != 0)
- {
- Logger.Write("POI (" + Buddy.CommonBot.Poi.Current.Name + ": " + Buddy.CommonBot.Poi.Current.Type.ToString() + ") Found and set to " + theLoc.ToString() + "... Working on getting there now.");
- MountUp();
- while (!Me.InCombat && Buddy.Common.Math.Vector3.Distance(Me.Position, theLoc) > .45f)
- {
- if (BuddyTor.Me.CurrentTarget != null && Me.CurrentTarget.Name != Me.Name) break;
- //Buddy.Swtor.Input.MoveTo(theLoc);
- Buddy.Navigation.Navigator.MoveTo(theLoc);
- Thread.Sleep(200);
- }
- }
- if (!Me.InCombat && Me.CurrentTarget == null && Buddy.Common.Math.Vector3.Distance(Me.Position, theLoc) < .45f)
- foreach (TorPlaceable obj in ObjectManager.GetObjects<Buddy.Swtor.Objects.TorPlaceable>().Where(obj => obj.Name != null && obj.Name.Contains(POIName)))
- {
- obj.Interact();
- Thread.Sleep(7000);
- }
- LastPOIName = POIName;
- }
- catch { }
- //}
- //using (BuddyTor.Memory.AcquireFrame()) { }
- }
- public static void CheckXP()
- {
- if (DateTime.Now.Subtract(LastXPShownTime).TotalSeconds >= 60)
- {
- if (Me.Xp > LastXPCheck)
- {
- ulong XPGained = Me.Xp - LastXPCheck;
- DateTime LocalTime = DateTime.Now.ToLocalTime(); // Time is all F'd up, just goin with ETA Minutes now.
- ulong XPRemaining = Me.XpNeeded - Me.Xp;
- double XPPerHour = XPGained * 3600 / (DateTime.Now.Subtract(LastXPCheckTime).TotalSeconds);
- Logger.Write("XP Per Hour: " + XPPerHour.ToString("0,000") + " XP Needed for Level: " + XPRemaining.ToString("0,000") + " ETA for Level: " + (XPRemaining * 60 / XPPerHour).ToString("0") + " minutes.");
- }
- else
- {
- LastXPCheck = Me.Xp;
- LastXPCheckTime = DateTime.Now;
- }
- LastXPShownTime = DateTime.Now;
- }
- }
- public static void CheckForCompTarget()
- {
- if (IG) return;
- try
- {
- var CompX = Comp;
- if (!IG && Me.CurrentTarget == null && CompX != null && CompX.InCombat)
- {
- var CompTargX = CompX.CurrentTarget;
- if (CompTargX != null && CompTargX != Me && CompTargX != CompX) { CompTargX.Target(); }
- }
- }
- catch { }
- }
- public static void CheckForQuestingInteract()
- {
- try
- {
- var CTx = Me.CurrentTarget;
- if (!IG && CTx != null && !CTx.IsDead && CTx.IsFriendly && CTx.Distance <= .50f) CTx.Interact(); // Questing Behavior update - attack a mob, get it to just-about-dead, then talk to it, sketchy in questing profiles
- }
- catch { }
- }
- public static void OOC()
- {
- CheckGC();
- if (IAmDead()) return;
- //Logger.Write("Running OOC....");
- DateLastPingOOC = DateTime.Now;
- if (Restarting) return;
- if (EnableMemMon) if (thMonMem == null || !thMonMem.IsAlive)
- {
- thMonMem = null;
- thMonMem = new Thread(MonMemory.WatchIt);
- thMonMem.Start();
- }
- CheckXP();
- if (!IG && Me.CurrentTarget!=null && Me.CurrentTarget.Name.Contains(CompName)) Me.ClearTarget();
- if (!Me.InCombat && !IG)
- {
- CheckForDeadComp();
- CheckInventory();
- CheckForCompTarget();
- }
- try
- {
- CT = IG ? GetGroupTarget() : Me.CurrentTarget;
- CheckForQuestingInteract();
- CheckForCompTarget();
- if (IG && CT != null) CT.Target();
- if (BuddyTor.Me.InCombat || (CT != null && TargetInCombat()) || (BuddyTor.Me.CurrentTarget != null && !BuddyTor.Me.CurrentTarget.IsDead && BuddyTor.Me.CurrentTarget.Toughness != CombatToughness.Player)) { MyCombat(); return; }
- }
- catch { }
- if (DoRandomGrind && !IG) RunAroundAndKillStuff();
- if (DateTime.Now.Subtract(datLOOC).TotalSeconds <= 10) return;
- MyRestAndBuffs();
- if (!IG)
- {
- ScanForLootables();
- HarvestIfNec();
- ScanForPlaceables();
- }
- if (Me.Level>=10 && !IG && !DoRandomGrind && !Me.IsMounted && Comp == null && !Me.PvpFlagged && DateTime.Now.Subtract(datLSC).TotalMinutes>=2) if (taSummComp != null && taSummComp.IsValid)
- {
- Logger.Write("Trying to summon companion...");
- if (BuddyTor.Me.AbilityActivate(taSummComp, Me, out er)) Thread.Sleep(1500);
- datLSC = DateTime.Now;
- }
- //if (MovementAllowed != MovementAllowedOrig)
- //{
- // MovementAllowed = MovementAllowedOrig;
- // MovementToggle(MovementAllowed);
- //}
- if (IG && MovementAllowed && TagAlong) TagAlongWithGroup();
- //while (true) // Enable this at your own risk - but from what I tested with it worked fairly well - for Bodyguard combat.
- //{
- // while (SageCombatPvP()) ;
- // Thread.Sleep(500);
- // if (IAmDead()) break;
- //}
- //return;
- //if (BuddyTor.Me.PvpFlagged) return;
- LoadVars();
- //CheckQuesting();
- try
- {
- if (ReportDurs) Logger.Write("OOC Dur up Thru Time Check: " + DateTime.Now.Subtract(DateLastPingOOC).TotalMilliseconds);
- datLOOC = DateTime.Now;
- if (Me.InCombat) { return; }
- if (Me.IsDead) { Logger.Write("Dead, clearing target and returning."); BuddyTor.Me.ClearTarget(); return; }
- LoadVars();
- if (!IG && CT == null && CompTarg != null && CompTarg != Me)
- {
- CT = CompTarg;
- CT.Target();
- StopMoving();/*Bug with .exe - wants to move within zero meters of the target*/
- }
- if (!IG) WaitForComp();
- if (!BuddyTor.Me.IsMounted) { MountUp(); }
- if (ReportDurs) Logger.Write("OOC Duration: " + DateTime.Now.Subtract(datLOOC).TotalMilliseconds.ToString("0ms"));
- }
- catch { }
- }
- public static bool NeedRestRSMin(float minH, float minRS)
- {
- try
- { if (Comp != null) if ((Comp.Position.X != 0) && Comp.HealthPercent > 0f && Comp.HealthPercent < 85f) return true; }
- catch { }
- return (Me.ResourceStat < minRS || Me.HealthPercent < minH);
- //if (NR) Logger.Write("Need Rest...");
- }
- public static bool NeedRestRSMax(float minH, float minRS)
- {
- try
- { if (Comp != null) if (Comp.Position.X != 0 && Comp.HealthPercent < 85f) return true; }
- catch { }
- return (Me.ResourceStat > minRS || Me.HealthPercent < minH);
- }
- public static void KillStealth()
- {
- //Logger.Write("Entering WaitForRest...");
- while (MyBuffs.Contains("Stealth"))
- {
- if (!MercCast("Stealth")) MercForcedCast("Force Wave", Me); // Fucking PITA - Trying to cast Stealth while stealthed - WILL NOT WORK (nor will the Stealth ability)
- Thread.Sleep(1000);
- LoadVars();
- }
- }
- public static void WaitForRest(bool WaitForComp, string theSpell, bool RSIsMinimum, float RSVal)
- {
- if (Me.InCombat) return;// false;
- if (IAmDead()) return;// false;
- try
- {
- if (WaitForComp) if (!IG && Comp != null && !Comp.IsDeleted) if (Comp.InCombat) return;// false;
- }
- catch { }
- if (RSIsMinimum)if(!NeedRestRSMin(90, RSVal)) return;// false;
- if (!RSIsMinimum)if(!NeedRestRSMax(90, RSVal)) return;// false;
- if(Me.CurrentTarget==null)KillStealth();
- if (IAmDead()) return;
- StopMoving();
- StopMoving();
- //Logger.Write("Starting Rest - HP: " Me.HealthPercent.ToString(".0") +
- Logger.Write("Starting Rest....");
- DateTime RestStart = DateTime.Now;
- while (!Me.IsCasting && !Me.InCombat && !IAmDead() && DateTime.Now.Subtract(RestStart).TotalSeconds<=3)
- {
- Buddy.CommonBot.AbilityManager.Cast(theSpell, BuddyTor.Me);
- Thread.Sleep(300);
- }
- Thread.Sleep(2000);
- TorCharacter CompX = Comp;
- datLCL = DateTime.Now;
- //ForcePulse();
- if (RSIsMinimum) while (DateTime.Now.Subtract(datLCL).TotalSeconds < 10 && BuddyTor.Me.IsCasting && NeedRestRSMin(90,RSVal) && !BuddyTor.Me.InCombat) Thread.Sleep(1000);
- if (!RSIsMinimum) while (DateTime.Now.Subtract(datLCL).TotalSeconds < 10 && BuddyTor.Me.IsCasting && NeedRestRSMax(90, RSVal) && !BuddyTor.Me.InCombat) Thread.Sleep(1000);
- if (CompX!=null && !CompX.IsDead) try
- {
- if (WaitForComp && Comp != null) while (Me.IsCasting && Comp.HealthPercent <= 90f) Thread.Sleep(1000);
- }
- catch { }
- Logger.Write("Done with Rest.");
- if (BuddyTor.Me.IsCasting) SendMessage(SWTORHWnd, (int)0x100, (IntPtr)(char)0x1b, (IntPtr)0);
- Thread.Sleep(300);
- }
- public static void ForcePulse()
- {
- if (DateTime.Now.Subtract(datLFP).TotalSeconds < 5) return;
- try { datLFP = DateTime.Now; Buddy.CommonBot.BotMain.CurrentBot.Pulse(); }
- catch { }
- }
- public static void WaitForComp()
- {
- var CompX = Comp;
- datLCL = DateTime.Now;
- if (CompX != null) { while (CompX.IsCasting && DateTime.Now.Subtract(datLCL).TotalSeconds <= 5) Thread.Sleep(500); }
- }
- public static ulong PISkill(string Skill)
- {
- foreach (Buddy.Swtor.Objects.Components.ProfessionInfo pi in BuddyTor.Me.ProfessionInfos)if (pi.Name.Contains(Skill)) return (ulong)pi.CurrentLevel;
- return 0;
- }
- public static bool CanHarvestCorpse(TorNpc unit)
- {
- //Logger.Write("Harvest: " + unit.Name + " UnitType: " + unit.CreatureType.ToString());
- ulong SkillReq = Math.Max(unit.Level - 11, 0) * 8;
- if (unit != null) if (!unit.IsDeleted) if (unit.IsDead && unit.Distance <= 4.0f &&
- ((HasBio && unit.CreatureType == Buddy.Swtor.CreatureType.Creature && PISkill("Bioanalysis") >= SkillReq) ||
- (HasScav && unit.CreatureType == Buddy.Swtor.CreatureType.Droid && PISkill("Scavenging") >= SkillReq)) &&
- StrongOrGreater(unit) && !unit.IsFriendly) if (!Buddy.CommonBot.Blacklist.Contains(unit.Guid))
- {
- //Logger.Write("Can Harvest the corpse.");
- return true;
- }
- return false;
- }
- public static void MoveToAndInteract(TorNpc unit, double ToWithin = .99f)
- {
- if (MyBlacklist.ContainsKey(unit.Guid)) return;//|| !CanHarvestCorpse(unit)) return;
- datLCL = DateTime.Now;
- if (unit.Distance >= 3.0f) MountUp();
- MoveResult MR = MoveResult.Moved;
- while (unit.Distance > ToWithin && MR != MoveResult.Failed && MR != MoveResult.PathGenerationFailed && DateTime.Now.Subtract(datLCL).TotalSeconds <= 15)
- {
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return; }
- MR = Buddy.Navigation.Navigator.MoveTo(unit.Position);
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return; }
- Thread.Sleep(200);
- }
- StopMoving();
- StopMoving();
- Thread.Sleep(1500);
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return; }
- if (unit.Distance <= ToWithin)
- {
- //if (Comp != null) while (Comp.IsCasting) Thread.Sleep(1000);
- if (unit != null) if (unit.Distance <= ToWithin) {
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return; }
- unit.Interact(); // Loot
- Thread.Sleep(2000);
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return; }
- if (CanHarvestCorpse(unit)) { unit.Interact(); unit.Interact(); Thread.Sleep(3500); while (Me.IsCasting) Thread.Sleep(1000); }
- if (BuddyTor.Me.CurrentTarget != null) MyBlacklist.Add(unit.Guid,DateTime.Now);
- return;
- }
- }
- return;
- }
- public static int GetLootableCount()
- {
- int LC=0;
- foreach (TorNpc unit in ObjectManager.GetObjects<TorNpc>())
- try
- { if (unit!=null) if (!unit.IsDeleted) if (unit.Distance <= MaxDist && unit.IsDead && unit.IsLootable) LC+=1;
- } catch {}
- Logger.Write("Lootables Count: " + LC.ToString());
- return LC;
- }
- public static bool StrongOrGreater(TorCharacter unit)
- {
- if (IG) return EliteOrGreater(unit);
- if (unit != null) if (unit.Toughness == CombatToughness.Strong || unit.Toughness == CombatToughness.Boss1 || unit.Toughness == CombatToughness.Boss2 || unit.Toughness == CombatToughness.Player) return true;
- return false;
- }
- public static bool EliteOrGreater(TorCharacter unit)
- {
- if (unit != null) if (unit.Toughness == CombatToughness.Boss1 || unit.Toughness == CombatToughness.Boss2 || unit.Toughness == CombatToughness.Player || unit.Toughness==CombatToughness.Boss3 || unit.Toughness==CombatToughness.Boss4 || unit.Toughness==CombatToughness.RaidBoss) return true;
- return false;
- }
- public static bool StrongOrElite(TorCharacter unit)
- {
- if (unit != null) if (unit.Toughness == CombatToughness.Strong || unit.Toughness == CombatToughness.Boss1) return true;
- return false;
- }
- public static bool HarvestIfNec()
- {
- if (!HarvestCorpses) return false;
- if (!(HasBio || HasScav)) return false;
- datLCL = DateTime.Now;
- if (DateTime.Now.Subtract(datLC).TotalSeconds < 10) return false;
- //Logger.Write("Entering Harvest...");
- if (BuddyTor.Me.InCombat) return false;
- if (BuddyTor.Me.Companion != null) if (BuddyTor.Me.Companion.InCombat) return false;
- int H = 0;
- //AcquireFrame seems to gen ALOT more crashes when the bot is stopped, so do variable lists used (so I try and use the query directly)
- //var varObj = ObjectManager.GetObjects<TorNpc>();
- //IEnumerable<TorNpc> varObj;
- //using (BuddyTor.Memory.AcquireFrame())
- //{
- //varObj =
- //}
- if (BuddyTor.Me.InCombat) return false;
- if (DateTime.Now.Subtract(datLCL).TotalSeconds >= 2f) return false;
- float theDist = DoRandomGrind ? 15.0f : MaxNodeDist;
- foreach (TorNpc unit in ObjectManager.GetObjects<TorNpc>().OrderBy(t => t.Distance))
- try {
- if(unit != null && !unit.IsDeleted && unit.Distance <= theDist && StrongOrGreater(unit) && !unit.IsFriendly && unit.IsDead &&
- (
- (HasBio && unit.CreatureType == Buddy.Swtor.CreatureType.Creature) ||
- (HasScav && (unit.CreatureType == Buddy.Swtor.CreatureType.Droid || unit.Name.Contains("Droid")))
- ))
- if (!MyBlacklist.ContainsKey(unit.Guid) && CanHarvestCorpse(unit))
- {
- Logger.Write("Harvest: Moving to " + unit.Name + " Distance: " + unit.Distance.ToString() + " Position: " + unit.Position.ToString());
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return true; }
- MoveToAndInteract(unit);
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return true; }
- H += 1;
- }
- }
- catch
- {
- //Logger.Write("Error in HarvestIfNec.");
- //return false;
- }
- datLC = DateTime.Now;
- return (H > 0);
- }
- public static bool CanHarvestObj(TorPlaceable obj)
- {
- try
- {
- if (obj.Name.Contains("Security Chest")) return true;
- ulong LR = obj.Harvestable.ProfessionLevelRequired;
- //Logger.Write("Skill Level Required for " + obj.Name + ": " + LR.ToString() + " Arch Skill: " + PISkill("Archaeology"));
- if (ObjIsArch(obj) && HasArch && LR <= PISkill("Archaeology")) return true; // Arch placeables don't (currently) have the Harvestable or other properties from what I can see, so free-ball it
- if (obj != null) if (!obj.IsDeleted) if (obj.Harvestable != null)
- if (
- (
- (obj.Harvestable.ProfessionRequired == ProfessionType.Archaeology || obj.Name.Contains("Crystal Formation")) && HasArch && LR <= PISkill("Archaeology")) || (obj.Harvestable.ProfessionRequired == ProfessionType.Bioanalysis && HasBio && LR <= PISkill("Bioanalysis")) ||
- (obj.Harvestable.ProfessionRequired == ProfessionType.Scavenging && HasScav && LR <= PISkill("Scavenging")) || (obj.Harvestable.ProfessionRequired == ProfessionType.Slicing && HasSlicing && LR <= PISkill("Slicing"))
- )
- return true;
- if (obj != null) if (!obj.IsDeleted) if (ObjIsArch(obj) && HasArch && LR <= PISkill("Archaology")) return true;
- }
- catch { }
- return false;
- }
- public static int ChampsElitesNearObj(TorObject obj)
- {
- try
- {
- return (ObjectManager.GetObjects<TorNpc>().Where(d => d!=null && !d.IsDeleted && !d.IsDead && Vector3.Distance(obj.Position,d.Position)<=3.0f &&
- (d.Toughness==CombatToughness.Boss3 || d.Toughness==CombatToughness.Boss2 ||d.Toughness==CombatToughness.Boss1)
- )
- .Count());}
- catch { Logger.Write("Error in ChampsElitesNearObj()"); return 0; }
- }
- public static void MoveToAndInteract(TorObject obj, double ToWithin = .99f, int WaitAfterInteract=4000)
- {
- bool IsSecChest=obj.Name.Contains("Security Chest");
- if (IsSecChest) ToWithin = .30f;
- if (obj.Distance >= 3.0f) MountUp();
- MoveResult MR = MoveResult.Moved;
- datLCL = DateTime.Now;
- while (obj.Distance > ToWithin && MR != MoveResult.Failed && MR != MoveResult.PathGenerationFailed && DateTime.Now.Subtract(datLCL).TotalSeconds <= 20)
- {
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return; } // If it's a chest, grab that shit FIRST
- MR = Buddy.Navigation.Navigator.MoveTo(obj.Position);
- Thread.Sleep(200);
- //Buddy.Swtor.Input.MoveTo(obj.Position, MeleeDist); Thread.Sleep(2000);
- }
- StopMoving();
- Thread.Sleep(1000);
- if (Me.InCombat && !IsSecChest) { BuddyTor.Me.ClearTarget(); return; }
- if (obj.Distance <= ToWithin)
- {
- obj.Interact();
- Thread.Sleep(WaitAfterInteract);
- if (obj != null) MyBlacklist.Add(obj.Guid,DateTime.Now);
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return; }
- }
- if (Me.InCombat) return;
- }
- public static bool ObjIsChest(TorObject obj)
- {
- return (obj.Name.Contains("ity Chest"));
- }
- public static bool ObjIsArch(TorObject obj)
- {
- return (obj.Name.Contains("eological F") || obj.Name.Contains("Crystal Formation"));
- }
- public static bool ScanForPlaceables()
- {
- if (IG) return false;
- if (!ScanForNodes || !MovementAllowed) return false;
- if (MaxNodesBetweenFights == 0) return false;
- datLCL = DateTime.Now;
- int Harv = 0;
- int intI = 0;
- //float theDist = DoRandomGrind ? 6.0f : MaxNodeDist;
- foreach (TorPlaceable obj in ObjectManager.GetObjects<Buddy.Swtor.Objects.TorPlaceable>())
- try
- { if (obj != null && !obj.IsDeleted && obj.Name!=null && obj.Distance <= MaxNodeDist && CanHarvestObj(obj))
- if (ChampsElitesNearObj(obj) < 1)
- {
- intI += 1;
- if (!MyBlacklist.ContainsKey(obj.Guid)) if (CanHarvestObj(obj) || obj.Name.Contains("est"))
- {
- Logger.Write("Placeable: Moving to " + obj.Name + " Distance: " + obj.Distance.ToString() + " Position: " + obj.Position.ToString());
- MoveToAndInteract(obj);
- if (Me.InCombat) return true;
- Harv += 1;
- if (Harv >= MaxNodesBetweenFights) return true;
- }
- }
- }
- catch
- {
- return false;
- }
- if (ReportDurs) Logger.Write("Scan for Nodes: " +intI.ToString() + " Placeables, " + DateTime.Now.Subtract(datLCL).TotalSeconds.ToString("#.00") + "s");
- return false;
- }
- public static void MountUp()
- {
- if (!EnableMount || !MovementAllowed || IG || Me.HasBuff("Stealth")) return;
- if (DateTime.Now.Subtract(datLMC).TotalSeconds < MountCheckFreq || Me.InCombat || BuddyTor.Me.PvpFlagged) return;
- datLMC = DateTime.Now;
- if (!BuddyTor.Me.IsMounted)
- {
- Logger.Write("Trying to mount using the [" + chMount + "] key."); // SPELL IT OUT FOR THOSE WHO CAN'T READ
- StopMoving(); Thread.Sleep(250);
- //if (MercCast("Stealth", BuddyTor.Me, Me.HasBuff("Stealth"))) { Thread.Sleep(250); WaitForCast(); }
- SendMessage(SWTORHWnd, (int)0x100, (IntPtr)chMount, (IntPtr)0);
- SendMessage(SWTORHWnd, (int)0x100, (IntPtr)chMount, (IntPtr)0);
- Thread.Sleep(300);
- }
- else return;
- DateTime MountStart = DateTime.Now;
- while (Me.IsCasting && DateTime.Now.Subtract(MountStart).TotalSeconds <= 1) Thread.Sleep(1000);
- }
- public static bool ScanForLootables()
- {
- //if (!ScanForLoot || ! MovementAllowed) return false;
- if (!MovementAllowed) return false;
- //if (DateTime.Now.Subtract(datLLS).TotalSeconds < 10) return false;
- DateTime datBeg = DateTime.Now;
- int Looted = 0;
- try
- {
- foreach (TorNpc unit in ObjectManager.GetObjects<TorNpc>().OrderBy(t => t.Distance).Where(t => t != null && !t.IsDeleted && t.IsLootable))// !t.IsFriendly && t.IsDead))
- if (!MovementAllowed)
- {
- if (unit.Distance <= .99f) { unit.Interact(); Thread.Sleep(3000); return true; }
- }
- else
- if (unit != null && !unit.IsDeleted && unit.IsDead && unit.IsLootable && unit.Distance <= MaxNodeDist)
- {
- if (Me.InCombat) { BuddyTor.Me.ClearTarget(); return false; }
- Logger.Write("Loot: Moving to " + unit.Name + " Distance: " + unit.Distance.ToString(".0") + " Position: " + unit.Position.ToString());
- MoveToAndInteract(unit);
- if (Me.InCombat) return true;
- Looted += 1;
- datLLS = DateTime.Now;
- //return true;
- }
- }
- catch { return false; }
- //MountUp();
- datLLS = DateTime.Now;
- if (ReportDurs) Logger.Write("Lootables Scan: " + DateTime.Now.Subtract(datBeg).TotalMilliseconds.ToString("0.0") + "ms");
- return Looted > 0;
- }
- public static void GetAttackers()
- {
- DateTime datStart = DateTime.Now;
- if (Attackers != null) Attackers.Clear();
- Attackers = null;
- Attackers = new List<TorNpc>();
- TorCharacter CompX = Comp;
- MyNameCompName = MyName + CompName;
- //foreach (TorNpc d in Me.EnemiesAttackers.Where(t => t != null && !t.IsDeleted).OrderBy(t => t.HealthMax))
- if (!IG)
- try
- {
- //foreach (TorNpc d in ObjectManager.GetObjects<TorNpc>().Where(t => t.InCombat && t.Distance <= 4.5f).OrderBy(t => IsRanged ? t.HealthMax : t.Distance))
- var Att = Me.EnemiesAttackers;
- foreach (TorNpc d in Att.Where(t => t.InCombat && t.Distance <= 4.5f).OrderBy(t => IsRanged ? t.HealthMax : (int)t.Distance))
- if (d != null && !d.IsDeleted && !d.IsDead && d.HealthPercent > .1 && d.CurrentTarget != null &&
- d.CurrentTarget.Name!=null && MyNameCompName.Contains(d.CurrentTarget.Name) && d.Distance<=4.5f && !d.IsFriendly)
- Attackers.Add(d);
- }
- catch (Exception ex) { Logger.Write("GetAttackers() Error: " + ex.Message); }
- if (IG)
- foreach (TorNpc d in ObjectManager.GetObjects<TorNpc>()
- //.Where(t => t != null && !t.IsDeleted && !t.IsDead && t.HealthPercent > .1 && t.CurrentTarget != null &&
- // t.Toughness!=CombatToughness.Player && t.CurrentTarget.Toughness==CombatToughness.Player && !t.IsFriendly).OrderBy(t => t.HealthMax))
- .Where(t => t != null && !t.IsDeleted && t.Distance<=4.0f).OrderBy(t => t.HealthMax))
- if (d.InCombat && !d.IsDead && d.HealthPercent > .1 && !d.IsFriendly && !d.IsStunned && d.Toughness!=CombatToughness.Player)
- try
- {
- //if (d!=null && !d.IsDeleted && d.InCombat && d.Toughness!=CombatToughness.Player && d.IsHostile && d.Distance<=5.0f)
- //if (!d.IsDead && d != Me && d != CompX && !d.IsDead && d.HealthPercent > .2f && d.Distance <= 5.0f)
- Attackers.Add(d);
- }
- catch (Exception ex) { Logger.Write("GetAttackers() Error: " + ex.Message); }
- if (Attackers == null || Attackers.Count() == 0) if (CompTarg != null && CompTarg != Me && CompTarg.Name != MyName) Attackers.Add((TorNpc)CompTarg);
- if (Attackers==null || Attackers.Count()==0) if (!IG) { if (Me.CurrentTarget != null && Me.CurrentTarget.Name != Me.Name && !Me.CurrentTarget.IsDead
- && Me.CurrentTarget.Toughness!=CombatToughness.Player) Attackers.Add((TorNpc)Me.CurrentTarget); }
- if (!IG && Attackers != null && Attackers.Count() > 0) return;
- if (ReportDurs) Logger.Write("Attackers List Duration: " + DateTime.Now.Subtract(datStart).TotalMilliseconds.ToString());
- try
- {
- if (!BuddyTor.Me.InCombat && (!IG || DoRandomGrind)) { if (Me.CurrentTarget != null && Me.CurrentTarget.Name != Me.Name && !Me.CurrentTarget.IsDead)
- Attackers.Add((TorNpc)Me.CurrentTarget); }
- if (!BuddyTor.Me.PvpFlagged)
- {
- foreach (TorNpc d in Me.EnemiesAttackers.OrderBy(t=>t.Distance))
- if (!d.IsDead && d.HealthPercent > .2f && d.Distance <= 5.0f) Attackers.Add(d);
- }
- }
- catch { if (Me.CurrentTarget != null && Me.CurrentTarget.HealthPercent > .2) Attackers.Add((TorNpc)Me.CurrentTarget); return; }
- }
- public static bool ScanForMobs()
- {
- DateTime datStart = DateTime.Now;
- TorCharacter theUnit = null;
- float theDist = MaxDist;
- if (Me.InCombat) return false;
- Logger.Write("Scanning for mobs....");
- // Try for LOS Mobs First
- if (BuddyTor.Me.PvpFlagged)
- foreach (TorPlayer unit in ObjectManager.GetObjects<TorPlayer>().Where(t => t != null && !t.IsDeleted).OrderBy(t => t.Distance))
- try
- {
- if (unit != BuddyTor.Me && unit.InLineOfSight && unit.IsHostile && !unit.IsDead && (unit.Level >= Me.Level - 6) && unit.Distance <= MaxDist && unit.Toughness >= DRGMinToughness &&
- unit.Toughness <= CombatToughness.Boss1 && unit.IsHostile && !unit.InCombat)
- { theUnit = (TorCharacter)unit; theDist = unit.Distance; break; }
- }
- catch
- {
- return false;
- }
- else
- foreach (TorNpc unit in ObjectManager.GetObjects<TorNpc>().Where(t => t != null && !t.IsDeleted && t.InLineOfSight).OrderBy(t => t.Distance))
- try {
- if (unit!=BuddyTor.Me && !unit.IsFriendly && !unit.IsDead && (unit.Level >= Me.Level-6) && unit.Distance <= MaxDist && unit.Toughness >= DRGMinToughness &&
- unit.Toughness <= CombatToughness.Boss1 && unit.IsHostile && !unit.InCombat)
- { theUnit = unit; theDist = unit.Distance; break; }
- }
- catch
- {
- return false;
- }
- if (theUnit == null)
- foreach (TorNpc unit in ObjectManager.GetObjects<TorNpc>().OrderBy(t => t.Distance))
- try
- {
- if (unit != null && !unit.IsDeleted && unit.IsHostile) if (!unit.IsDead && unit!=BuddyTor.Me && unit.Distance <= MaxDist && unit.Toughness>=DRGMinToughness && unit.Toughness <= CombatToughness.Boss1 && unit.IsHostile && !unit.InCombat)
- if (unit.Distance < theDist || theUnit == null) { theUnit = unit; theDist = unit.Distance; break; }
- }
- catch { return false; }
- // Next, ANYTHING
- if (theUnit == null)
- //foreach (TorNpc unit in ObjectManager.GetObjects<TorNpc>().OrderBy(t => t.Distance))
- foreach (TorNpc unit in ObjectManager.GetObjects<TorNpc>().OrderBy(t => t.Distance).Where(unit => unit!=null && !unit.IsDeleted && (unit.IsHostile || unit.IsNeutral) && unit.Distance <= MaxDist &&
- !unit.IsDead && unit!=BuddyTor.Me && unit.Toughness <= CombatToughness.Boss1 && !unit.IsFriendly && !unit.InCombat))
- if (!MyBlacklist.ContainsKey(unit.Guid) && (unit.Distance < theDist || theUnit == null))
- try
- {
- theUnit = unit; theDist = unit.Distance; break;
- }
- catch { return false; }
- if (theUnit == null) return false;
- if (Me.InCombat) return false;
- Logger.Write("Targeting: Moving to " + theUnit.Name + " Distance: " + theUnit.Distance.ToString() + " Position: " + theUnit.Position.ToString());
- theUnit.Target();
- if (theUnit.Distance >= 3.0f) MountUp();
- while (theUnit != null && (theUnit.Distance > 2.8f || !theUnit.InLineOfSight))
- {
- if (Me.InCombat) MyCombat();
- Buddy.Navigation.Navigator.MoveTo(theUnit.Position);
- Thread.Sleep(500);
- }
- if (theUnit.Distance <= 2.8f && theUnit.InLineOfSight)
- {
- CT = theUnit;
- StopMoving();
- MyCombat();
- return true;
- }
- StopMoving();
- datLC = DateTime.Now;
- theUnit = null;
- return false;
- }
- // Experimental
- public static bool CheckRelics()
- {
- if (HP <= 40f)
- {
- //foreach(TorItem ti in BuddyTor.Me.InventoryEquipped)if(ti.Name.Contains("Relic")
- }
- return false;
- }
- public static float DRGPathMinDistFromPoint(Vector3 thePoint)
- {
- float MinDist = 999;
- float Dist = 0;
- foreach (Vector3 CurrPt in DRGGrindPath)
- {
- Dist = Vector3.Distance(CurrPt, thePoint);
- if ( Dist < MinDist) MinDist = Dist;
- }
- if (MinDist != 999) return MinDist; else return 0;
- }
- private static void DRGUpdateVendor()
- {
- try
- {
- if (DRGVendorName == "")
- {
- foreach (TorVendor t in ObjectManager.GetObjects<TorVendor>().Where(t => t.Distance <= 15f && !t.IsHostile).OrderBy(t => t.Distance))
- {
- DRGVendorName = t.Name;
- DRGVendorPos = t.Position;
- Logger.Write("DoRandomGrind: Last-Closest-Vendor-Info updated to " + t.Name + " at " + t.Position.ToString());
- break;
- }
- }
- }
- catch { }
- }
- public static bool RunAroundAndKillStuff()
- {
- datLCL = DateTime.Now;
- //Logger.Write("Entering Harvest...");
- if (MeOrCompInCombat()) return true;
- MyRestAndBuffs();
- //RunGathering();
- //if (DateTime.Now.Subtract(datLCL).TotalSeconds >= 5) return false;
- bool LootFound = false;
- bool MobsFound = false;
- DRGUpdateVendor();
- if (DRGGrindPath.Count() >= 500) DRGGrindPath.Clear();
- bool bAdd = false;
- if (DRGGrindPath.Count() == 0) bAdd = true;
- if (!bAdd && DRGGrindPath.Count() < 50 && DRGPathMinDistFromPoint(Me.Position) >= 5.0f) bAdd = true;
- if (bAdd)
- {
- DRGGrindPath.Add(new Vector3((float)Me.Position.X, (float)Me.Position.Y, (float)Me.Position.Z));
- Logger.Write("DoRandomGrind: Adding Path Element " + Me.Position.ToString() + " Total Path Elements: " + DRGGrindPath.Count().ToString());
- }
- if (ScanForLootables());
- if (HarvestIfNec());
- if (ScanForPlaceables());
- //if (ScanForPlaceables()) return true;
- if (MeOrCompInCombat()) { MyCombat(); return true; }
- //CheckPOI();
- if (ScanForMobs()) return true;
- CT = null;
- if (Me.CurrentTarget != null) CT = Me.CurrentTarget;
- if (CT != null && !CT.IsFriendly && !CT.IsDead) { return true; }
- //if (LastCombatPt.X != 0 && !(LootFound || MobsFound))
- if (LastCombatPt.X != 0 && !(LootFound || MobsFound))
- {
- Logger.Write("No mobs or loot found, returning to point of last combat.");
- ////while (!Me.InCombat && Buddy.Common.Math.Vector3.Distance(LastCombatPt, Me.Position) >= MeleeDist) { Navigator.MoveTo(LastCombatPt); Thread.Sleep(200); }
- try
- {
- MountUp();
- //Logger.Write("DRGGrindPathElements: " + pt.ToString());
- if (DRGGrindPath.Count() > 0)
- foreach (var pt in DRGGrindPath)
- {
- while (!Me.InCombat && DRGGrindPath.ElementAt(0).Distance(Me.Position) >= MeleeDist) { Navigator.MoveTo(pt); Thread.Sleep(200); }
- }
- }
- catch { }
- }
- return false;
- }
- }
- class NoMovement_MovementProvider : IMovementProvider
- {
- public void MoveTowards(Buddy.Common.Math.Vector3 location) { /*empty*/ }
- public void StopMovement() { /*empty*/ }
- };
- class NoMovement_NavigationProvider : INavigationProvider
- {
- public void Clear() { /*empty*/ }
- public MoveResult MoveTo(Buddy.Common.Math.Vector3 destination, string destName, bool useRaycast, bool useStraightLine)
- {
- return (MoveResult.Moved);
- }
- };
- class MakebRepublicQuests
- {
- }
- }
- public static class MonMemory
- {
- public static void WatchIt()
- {
- Thread.Sleep(30000); // Let the bot 'settle-in'
- var objBot = BotMain.CurrentBot;
- while (true)
- {
- string ProcName=Process.GetCurrentProcess().ProcessName;
- long LastMemUsed = Process.GetCurrentProcess().WorkingSet64;
- if (Process.GetCurrentProcess().WorkingSet64 - LastMemUsed >= 10000000 || Process.GetCurrentProcess().PrivateMemorySize64 >= 100000000)
- //if (DateTime.Now.Subtract(JoesCombat.MercHelpers.DateLastPingCombat).TotalSeconds >= 20 || DateTime.Now.Subtract(JoesCombat.MercHelpers.DateLastPingOOC).TotalSeconds >= 20)
- {
- try
- {
- //JoesCombat.Logger.Write("Bot going haywire - stopping and restarting it.");
- JoesCombat.MercHelpers.Restarting = true;
- Thread.Sleep(8000);
- //while (BotMain.IsRunning)
- //{
- Buddy.CommonBot.BotMain.BotThread.Abort();
- Thread.Sleep(1000);
- Buddy.CommonBot.BotMain.BotThread.Start();
- //BotMain.CurrentBot.Stop();
- Thread.Sleep(1000);
- //}
- //BotMain.CurrentBot.Stop();
- //Thread.Sleep(1000);
- JoesCombat.MercHelpers.DoRehook();
- Thread.Sleep(4000);
- LastMemUsed = Process.GetCurrentProcess().PrivateMemorySize64;
- }
- catch { }
- JoesCombat.MercHelpers.Restarting = false;
- LastMemUsed = Process.GetCurrentProcess().PrivateMemorySize64;
- }
- //if (Process.GetCurrentProcess().ProcessName != ProcName) break;
- Thread.Sleep(15000);
- }
- }
- }
- //namespace Buddy.Swtor
- //{
- // class Mounts
- // {
- // private static string OverrideMount = "";
- // public static string GetFastestAvailableMount()
- // {
- // if (OverrideMount != "") return OverrideMount;
- // return "";
- // }
- // }
- //}
- // Questing, wayyyyy experimental and VERY INCOMPLETE at this point.
- public class MyHotspotList
- {
- private List<Vector3> theHotSpots = new List<Vector3>();
- private string HSName = "";
- private ulong QuestID = 0;
- private uint QuestStepID = 0;
- public void DefineName(string theName)
- {
- HSName = theName;
- }
- public void AddToHSList(Vector3 thePoint)
- {
- theHotSpots.Add(thePoint);
- }
- public void SetIDAndStep(ulong theID, uint theStep)
- {
- QuestID = theID;
- QuestStepID = theStep;
- }
- }
- public class MyQuestProfile
- {
- private string ProfilePath;
- //private static string ProfileContents;
- private string[] ProfileLines;
- private string CurLine;
- private List<MyHotspotList> Hotspots = new List<MyHotspotList>();
- private string GetStringStartingAt(string theString, int thePos)
- {
- bool bStarted = false;
- bool bEnded = false;
- string sIdentifier = "";
- string sCur = "";
- for (int i = thePos; i <= theString.Length - 1; i++)
- {
- sCur = theString.Substring(i, 1);
- if (sCur == "\"")
- {
- if (!bStarted) bStarted = true; else bEnded = true;
- }
- else
- {
- if (bStarted) sIdentifier += sCur;
- }
- if (bEnded) return sIdentifier;
- }
- return "";
- }
- private bool LoadProfile(string strPath)
- {
- ProfileLines = System.IO.File.ReadAllLines(strPath);
- MyHotspotList CurHS;
- int i;
- for (i = 0; i < ProfileLines.Length - 1; i++)
- {
- CurLine = ProfileLines[i];
- if (CurLine.Contains("GrindArea"))
- {
- int NamePos = CurLine.IndexOf("Name");
- string sIDVal = GetStringStartingAt(CurLine, NamePos);
- if (sIDVal != "")
- {
- MyHotspotList HS = new MyHotspotList();
- CurHS = HS;
- HS.DefineName(sIDVal);
- }
- }
- if (CurLine.Contains("<Hotspot "))
- {
- }
- }
- return false;
- }
- }
- public class MyObject
- {
- object TI;
- public object DeclareIt(object theItem)
- {
- TI = theItem;
- return TI;
- }
- public void DisposeIt(object theItem)
- {
- theItem = null;
- }
- }
- public class MyQuestDef
- {
- private static List<Vector3> theHotSpots = new List<Vector3>();
- private static int currIndex = 0;
- private static string ItemToUse = "";
- private static ulong QuestID;
- private static uint StepID;
- private static string objectToUse = "";
- private static int WaitAfterUse;
- private static float DistanceForUse;
- //public void SetIDs(ulong theQuest, uint theStep)
- //{
- // QuestID = theQuest;
- // StepID = theStep;
- //}
- public void AddToHSList(double x, double y, double z)
- { theHotSpots.Add(new Vector3((float)x, (float)y, (float)z)); }
- public void SetProperties(ulong questID, uint stepID, string theItem = "", string theObject = "", int waitMsAfterUse = 4000, float distForUse = .40f)
- {
- QuestID = questID;
- StepID = stepID;
- ItemToUse = theItem;
- objectToUse = theObject;
- WaitAfterUse = waitMsAfterUse;
- DistanceForUse = distForUse;
- }
- public void RunThrough()
- {
- JoesCombat.MercHelpers.RunGathering();
- if (Buddy.CommonBot.ConditionParser.HasQuest(QuestID) && !Buddy.CommonBot.ConditionParser.IsStepComplete(QuestID, StepID))
- while (!BuddyTor.Me.InCombat)
- {
- var pt = theHotSpots[currIndex];
- JoesCombat.Logger.Write("Quest Hotspot set to " + theHotSpots[currIndex].ToString());
- while (!BuddyTor.Me.InCombat && Buddy.Common.Math.Vector3.Distance(BuddyTor.Me.Position, pt) >= .05f)
- {
- Buddy.Navigation.Navigator.MoveTo(new Vector3(pt.X, pt.Y, pt.Z));
- Thread.Sleep(300);
- }
- if (ItemToUse != "" && !BuddyTor.Me.InCombat)
- {
- foreach (TorItem o in BuddyTor.Me.InventoryQuest)
- if (o.Name.Contains(ItemToUse) && o.MinimumLevel <= BuddyTor.Me.Level)
- {
- JoesCombat.Logger.Write("Using Quest Item " + o.Name + "...");
- o.Interact();
- //Thread.Sleep(7000);
- }
- currIndex += 1;
- return;
- }
- if (objectToUse != "" && !BuddyTor.Me.InCombat)
- foreach (TorPlaceable obj in ObjectManager.GetObjects<Buddy.Swtor.Objects.TorPlaceable>().Where(obj => obj.Name.Contains(objectToUse)))
- {
- JoesCombat.MercHelpers.MoveToAndInteract(obj, .40f, WaitAfterUse);
- currIndex += 1;
- return;
- }
- else break;
- if (currIndex >= theHotSpots.Count()) currIndex = 0;
- }
- }
- }
Add Comment
Please, Sign In to add comment