static void SlaveDoWork() { int idle = 0; int sleep = 500; while (1 == 1) { if (slave == null || master == null) { continue; } PlayerInfo PlayerInfo = new PlayerInfo(slave); TargetInfo TargetInfo = new TargetInfo(slave); PartyInfo PartyInfo = new PartyInfo(slave); Recast Recast = new Recast(slave); System.Threading.Thread.Sleep(sleep); if (master.Player.Status == 0 || master.Player.Status == 4) { if (master.Player.Status == 4 && slave.Player.Status != 4 && Properties.Settings.Default.interactions) { slave.Target.SetTarget((int)master.Target.GetTargetInfo().TargetIndex); Thread.Sleep(1000); slave.ThirdParty.KeyPress(EliteMMO.API.Keys.RETURN); Thread.Sleep(2000); continue; } if (slave.Menu.MenuName != "") { idle = 0; } if (master.Menu.MenuName == "menu query " && slave.Menu.MenuName == "" && Properties.Settings.Default.menufollow) { if (slave.Target.GetTargetInfo().TargetId != master.Target.GetTargetInfo().TargetId) { slave.Target.SetTarget((int)master.Target.GetTargetInfo().TargetIndex); continue; } if (idle > 0) { slave.ThirdParty.KeyPress(EliteMMO.API.Keys.RETURN); idle = 0; continue; } else { idle++; } } sleep = 10; if (TargetInfo.Name != "Riftworn Pyxis" && Properties.Settings.Default.menufollow) { if (slave.Player.Status == 4 && master.Player.Status == 0) { slave.ThirdParty.KeyPress(EliteMMO.API.Keys.ESCAPE); sleep = 300; continue; } if (master.Dialog.DialogOptionCount > 0 && slave.Dialog.DialogOptionCount > 0) { if (slave.Dialog.DialogId != master.Dialog.DialogId) { slave.ThirdParty.KeyPress(EliteMMO.API.Keys.RETURN); continue; } } if (master.Dialog.DialogOptionCount == 0 && slave.Dialog.DialogOptionCount > 0) { slave.ThirdParty.KeyPress(EliteMMO.API.Keys.RETURN); sleep = 300; continue; } if (slave.Dialog.DialogOptionCount > 0 && master.Dialog.DialogIndex > slave.Dialog.DialogIndex) { slave.ThirdParty.KeyPress(EliteMMO.API.Keys.DOWN); continue; } if (slave.Dialog.DialogOptionCount > 0 && master.Dialog.DialogIndex < slave.Dialog.DialogIndex) { slave.ThirdParty.KeyPress(EliteMMO.API.Keys.UP); continue; } if (master.Dialog.DialogOptionCount > 0) { continue; } } } } }
static void SlaveNavDoWork() { Queue <point> followqueue = new Queue <point>(); bool zoneAttempt = false; while (1 == 1) { if (slave == null || master == null) { continue; } PlayerInfo PlayerInfo = new PlayerInfo(slave); TargetInfo TargetInfo = new TargetInfo(slave); Movement Movement = new Movement(slave); Recast Recast = new Recast(slave); System.Threading.Thread.Sleep(100); if (slave.Player.Status == 0) { if (Box(slave) != null && CheckItem(slave, "Forbidden Key")) { if (TargetInfo.ID != Box(slave).TargetID) { TargetInfo.SetTarget((int)Box(slave).TargetID); continue; } else if (TargetInfo.Distance > 3) { Movement.Move(Box(slave)); continue; } else { Movement.Stop(); slave.ThirdParty.SendString("item \"Forbidden Key\" <t>"); if (!grayList.ContainsKey(Box(slave).TargetID)) { grayList.Add(Box(slave).TargetID, DateTime.Now.AddSeconds(20)); } else { grayList[Box(slave).TargetID] = DateTime.Now.AddSeconds(20); } Thread.Sleep(1500); continue; } } } switch (master.Player.Status) { case 85: case 0: case 4: case 33: if (master.Player.ZoneId != slave.Player.ZoneId && Properties.Settings.Default.follow) { if (!zoneAttempt) { slave.ThirdParty.KeyDown(EliteMMO.API.Keys.W); Thread.Sleep(1000); slave.ThirdParty.KeyUp(EliteMMO.API.Keys.W); zoneAttempt = true; } } else { zoneAttempt = false; } if (slave.Player.Status == 1 && Properties.Settings.Default.attack) { slave.ThirdParty.SendString("/attackoff"); continue; } if (master.Player.Status == 85 && slave.Player.Status != 85 && Properties.Settings.Default.mount) { slave.ThirdParty.SendString("/mount " + Properties.Settings.Default.mountname); continue; } if (master.Player.Status != 85 && slave.Player.Status == 85 && Properties.Settings.Default.mount) { slave.ThirdParty.SendString("/dismount"); continue; } followqueue.Enqueue(new point(master.Player.X, master.Player.Y, master.Player.Z, master.Player.ZoneId)); if (Properties.Settings.Default.follow) { if (followqueue.Count > 15) { point approach = followqueue.Dequeue(); float dX = approach.x - slave.Player.X; float dY = approach.y - slave.Player.Y; float dZ = approach.z - slave.Player.Z; float distance = (float)Math.Abs(Math.Sqrt(dX * dX + dY * dY + dZ * dZ)); if (distance > .3 && approach.zoneID == slave.Player.ZoneId && !PlayerInfo.Casting) { slave.AutoFollow.SetAutoFollowCoords(dX, dY, dZ); slave.AutoFollow.IsAutoFollowing = true; } else { if (approach.zoneID == slave.Player.ZoneId) { slave.AutoFollow.IsAutoFollowing = false; } } } else { slave.AutoFollow.IsAutoFollowing = false; } } else { if (followqueue.Count > 15) { followqueue.Dequeue(); } } if (!PlayerInfo.HasBuff(71) && new PlayerInfo(master).HasBuff(71)) { if (Properties.Settings.Default.spectral) { slave.ThirdParty.SendString("/ja \"Spectral Jig\" <me>"); Thread.Sleep(1000); } if (Properties.Settings.Default.whm) { slave.ThirdParty.SendString("/ma \"Sneak\" <me>"); Thread.Sleep(6000); } } if (!PlayerInfo.HasBuff(69) && new PlayerInfo(master).HasBuff(69)) { if (Properties.Settings.Default.spectral) { slave.ThirdParty.SendString("/ja \"Spectral Jig\" <me>"); Thread.Sleep(1000); } if (Properties.Settings.Default.whm) { slave.ThirdParty.SendString("/ma \"Invisible\" <me>"); Thread.Sleep(6000); } } if (!new PlayerInfo(master).HasBuff(69) && PlayerInfo.HasBuff(69) && Properties.Settings.Default.cancel) { if (Windower(slave) == "Windower") { slave.ThirdParty.SendString("//cancel 69"); } if (Windower(slave) == "Ashita") { slave.ThirdParty.SendString("/cancel Invisible"); } } if (!new PlayerInfo(master).HasBuff(71) && PlayerInfo.HasBuff(71) && Properties.Settings.Default.cancel) { if (Windower(slave) == "Windower") { slave.ThirdParty.SendString("//cancel 71"); } if (Windower(slave) == "Ashita") { slave.ThirdParty.SendString("/cancel Sneak"); } } break; case 1: if (slave.Target.GetTargetInfo().TargetIndex != master.Target.GetTargetInfo().TargetIndex&& Properties.Settings.Default.attack) { slave.Target.SetTarget((int)master.Target.GetTargetInfo().TargetIndex); continue; } if (slave.Player.Status == 0 && Properties.Settings.Default.attack) { slave.ThirdParty.SendString("/attack <t>"); continue; } List <EliteAPI.XiEntity> Entity = new List <EliteAPI.XiEntity>(); for (var x = 0; x < 2048; x++) { EliteAPI.XiEntity entity = slave.Entity.GetEntity(x); if (entity.HealthPercent == 0 || entity.TargetID <= 0) { continue; } var vertdiff = Math.Abs((PlayerInfo.Y - entity.Y)); if (vertdiff >= 2) { continue; } if (entity.Distance < 5) { Entity.Add(entity); } } EliteAPI.XiEntity target = slave.Entity.GetEntity((int)master.Target.GetTargetInfo().TargetIndex); float tX = target.X - slave.Player.X; float tY = target.Y - slave.Player.Y; float tZ = target.Z - slave.Player.Z; if (Properties.Settings.Default.attack) { if (target.Distance > 2 && !PlayerInfo.Casting && !Entity.Any(a => a.Name == "Moogle")) { slave.AutoFollow.SetAutoFollowCoords(tX, tY, tZ); slave.AutoFollow.IsAutoFollowing = true; continue; } else { slave.AutoFollow.IsAutoFollowing = false; } if (!TargetInfo.IsFacingTarget(PlayerInfo.X, PlayerInfo.Z, PlayerInfo.H, TargetInfo.X, TargetInfo.Z) && TargetInfo.HPP > 1 && !PlayerInfo.Casting) { TargetInfo.FaceTarget(TargetInfo.X, TargetInfo.Z); } } break; } } }