private int GrabDistance_GEO() { string checkedName = string.Empty; string name1 = string.Empty; if (_config.SpecifiedEngageTarget && !string.IsNullOrEmpty(_config.LuopanSpellTarget)) { checkedName = _config.LuopanSpellTarget; } else { checkedName = Monitored.Player.Name; } for (int x = 0; x < 2048; x++) { XiEntity entityGEO = PL.Entity.GetEntity(x); if (!string.IsNullOrEmpty(checkedName) && !string.IsNullOrEmpty(entityGEO.Name)) { name1 = entityGEO.Name; if (name1 == checkedName) { return((int)entityGEO.Distance); } } } return(0); }
private void FullCircle_Timer_Tick(object sender, EventArgs e) { if (PL.Player.Pet.HealthPercent >= 1) { ushort PetsIndex = PL.Player.PetIndex; if (_config.FullCircleGeoTarget && !string.IsNullOrEmpty(_config.LuopanSpellTarget)) { XiEntity PetsEntity = PL.Entity.GetEntity(PetsIndex); int FullCircle_CharID = 0; for (int x = 0; x < 2048; x++) { XiEntity entity = PL.Entity.GetEntity(x); if (entity.Name != null && entity.Name.ToLower().Equals(_config.LuopanSpellTarget.ToLower())) { FullCircle_CharID = Convert.ToInt32(entity.TargetID); break; } } if (FullCircle_CharID != 0) { XiEntity FullCircleEntity = PL.Entity.GetEntity(FullCircle_CharID); float fX = PetsEntity.X - FullCircleEntity.X; float fY = PetsEntity.Y - FullCircleEntity.Y; float fZ = PetsEntity.Z - FullCircleEntity.Z; float generatedDistance = (float)Math.Sqrt((fX * fX) + (fY * fY) + (fZ * fZ)); if (generatedDistance >= 10) { PL.ThirdParty.SendString("/ja \"Full Circle\" <me>"); } } } else if (!_config.FullCircleGeoTarget && Monitored.Player.Status == 1) { string SpellCheckedResult = ReturnGeoSpell(_config.GeoSpell, 2); if (!_config.FullCircleDisableEnemy || (_config.FullCircleDisableEnemy && PL.Resources.GetSpell(SpellCheckedResult, 0).ValidTargets == 32)) { XiEntity PetsEntity = Monitored.Entity.GetEntity(PetsIndex); if (PetsEntity.Distance >= 10 && PetsEntity.Distance != 0 && PL.AbilityAvailable(Ability.FullCircle)) { PL.ThirdParty.SendString("/ja \"Full Circle\" <me>"); } } } } FullCircleTimer.Enabled = false; }
private bool GEO_EnemyCheck() { if (Monitored == null || PL == null) { return(false); } // Grab GEO spell name string SpellCheckedResult = ReturnGeoSpell(_config.GeoSpell, 2); if (SpellCheckedResult == "SpellError_Cancel" || SpellCheckedResult == "SpellRecast" || SpellCheckedResult == "SpellUnknown") { // Do nothing and continue on with the program return(true); } else { if (PL.Resources.GetSpell(SpellCheckedResult, 0).ValidTargets == 5) { return(true); // SPELL TARGET IS PLAYER THEREFORE ONLY THE DEFAULT CHECK IS REQUIRED SO JUST RETURN TRUE TO VOID THIS CHECK } else { if (_config.SpecifiedEngageTarget && !string.IsNullOrEmpty(_config.LuopanSpellTarget)) { for (int x = 0; x < 2048; x++) { XiEntity z = PL.Entity.GetEntity(x); if (!string.IsNullOrEmpty(z.Name)) { if (z.Name.ToLower() == _config.LuopanSpellTarget.ToLower()) // A match was located so use this entity as a check. { if (z.Status == 1) { return(true); } else { return(false); } } } } return(false); } else { if (Monitored.Player.Status == 1) { return(true); } else { return(false); } } } } }
public static double GetDistance(XiEntity entity1, XiEntity entity2) { if (string.IsNullOrWhiteSpace(entity1.Name)) { return(double.MaxValue); } if (string.IsNullOrWhiteSpace(entity2.Name)) { return(double.MaxValue); } return(Math.Sqrt( Math.Pow(entity1.X - entity2.X, 2) + Math.Pow(entity1.Y - entity2.Y, 2) + Math.Pow(entity1.Z - entity2.Z, 2))); }
private bool CheckEngagedStatus() { if (Monitored == null || PL == null) { return(false); } if (!_config.GeoWhenEngaged) { return(true); } else if (_config.SpecifiedEngageTarget && !string.IsNullOrEmpty(_config.LuopanSpellTarget)) { for (int x = 0; x < 2048; x++) { XiEntity z = PL.Entity.GetEntity(x); if (!string.IsNullOrEmpty(z.Name)) { if (z.Name.ToLower() == _config.LuopanSpellTarget.ToLower()) // A match was located so use this entity as a check. { if (z.Status == 1) { return(true); } else { return(false); } } } } return(false); } else { if (Monitored.Player.Status == 1) { return(true); } else { return(false); } } }
private async Task <bool> EstablishHate(AppViewModel app, XiEntity target) { if (target == null) { return(false); } if (target.TargetID == lastGeoTargetId) { return(false); } foreach (var player in app.ActivePlayers) { if (player.IsGeoTarget) { // self geo target, dia the mob if (player.Name == app.Healer.Player.Name) { await Task.Delay(1000); app.Healer.Target.SetTarget((int)target.TargetID); if (await app.Actions.CastSpell("Dia", "<t>")) { lastGeoTargetId = target.TargetID; return(true); } } else { // cure the player await Task.Delay(500); if (await app.Actions.CastSpell("Cure", player.Name)) { lastGeoTargetId = target.TargetID; return(true); } } } } return(false); }
private int CheckEngagedStatus_Hate(PLConfig Config) { if (Config.AssistSpecifiedTarget == true && !string.IsNullOrEmpty(Config.AutoTargetTarget)) { for (int x = 0; x < 2048; x++) { XiEntity z = PL.Entity.GetEntity(x); if (!string.IsNullOrEmpty(z.Name) && z.Name.ToLower() == Config.AutoTargetTarget.ToLower()) { if (z.Status == 1) { return(z.TargetingIndex); } else { return(0); } } } return(0); } else { if (Monitored.Player.Status == 1) { TargetInfo target = Monitored.Target.GetTargetInfo(); XiEntity entity = Monitored.Entity.GetEntity(Convert.ToInt32(target.TargetIndex)); return(Convert.ToInt32(entity.TargetID)); } else { return(0); } } }
private int GrabGEOTargetID() { if (_config.SpecifiedEngageTarget && !string.IsNullOrEmpty(_config.LuopanSpellTarget)) { for (int x = 0; x < 2048; x++) { XiEntity z = PL.Entity.GetEntity(x); if (z.Name != null && z.Name.ToLower() == _config.LuopanSpellTarget.ToLower()) { if (z.Status == 1) { return(z.TargetingIndex); } else { return(0); } } } return(0); } else { if (Monitored.Player.Status == 1) { TargetInfo target = Monitored.Target.GetTargetInfo(); XiEntity entity = Monitored.Entity.GetEntity(Convert.ToInt32(target.TargetIndex)); return(Convert.ToInt32(entity.TargetID)); } else { return(0); } } }
public EngineAction Run(SongConfig Config) { EngineAction actionResult = new EngineAction() { Target = Target.Me }; PL_BRDCount = PL.Player.GetPlayerInfo().Buffs.Where(b => b == 195 || b == 196 || b == 197 || b == 198 || b == 199 || b == 200 || b == 201 || b == 214 || b == 215 || b == 216 || b == 218 || b == 219 || b == 222).Count(); if (Config.SingingEnabled && PL.Player.Status != 33) { int songs_currently_up = Monitored.Player.GetPlayerInfo().Buffs.Where(b => b == 197 || b == 198 || b == 195 || b == 199 || b == 200 || b == 215 || b == 196 || b == 214 || b == 216 || b == 218 || b == 222).Count(); // TODO: Add support for multiple JAs per cast, or else this will never work. // For now we just return the action with only the ability in it. // ie. If N + T were up, this would return once with Troub, then next cycle return Night, // then finally return the song cast. if (Config.TroubadourEnabled && PL.AbilityAvailable(Ability.Troubadour) && songs_currently_up == 0) { actionResult.JobAbility = Ability.Troubadour; return(actionResult); } else if (Config.NightingaleEnabled && PL.AbilityAvailable(Ability.Nightingale) && songs_currently_up == 0) { actionResult.JobAbility = Ability.Nightingale; return(actionResult); } SongData song_1 = SongInfo.Where(c => c.song_position == Config.Song1).FirstOrDefault(); SongData song_2 = SongInfo.Where(c => c.song_position == Config.Song2).FirstOrDefault(); SongData song_3 = SongInfo.Where(c => c.song_position == Config.Song3).FirstOrDefault(); SongData song_4 = SongInfo.Where(c => c.song_position == Config.Song4).FirstOrDefault(); SongData dummy1_song = SongInfo.Where(c => c.song_position == Config.Dummy1).FirstOrDefault(); SongData dummy2_song = SongInfo.Where(c => c.song_position == Config.Dummy2).FirstOrDefault(); // Check the distance of the Monitored player int Monitoreddistance = 50; XiEntity monitoredTarget = PL.Entity.GetEntity((int)Monitored.Player.TargetID); Monitoreddistance = (int)monitoredTarget.Distance; int Songs_Possible = 0; if (song_1.song_name.ToLower() != "blank") { Songs_Possible++; } if (song_2.song_name.ToLower() != "blank") { Songs_Possible++; } if (dummy1_song != null && dummy1_song.song_name.ToLower() != "blank") { Songs_Possible++; } if (dummy2_song != null && dummy2_song.song_name.ToLower() != "blank") { Songs_Possible++; } // List to make it easy to check how many of each buff is needed. List <int> SongDataMax = new List <int> { song_1.buff_id, song_2.buff_id, song_3.buff_id, song_4.buff_id }; // Check Whether e have the songs Currently Up int count1_type = PL.Player.GetPlayerInfo().Buffs.Where(b => b == song_1.buff_id).Count(); int count2_type = PL.Player.GetPlayerInfo().Buffs.Where(b => b == song_2.buff_id).Count(); int count3_type = PL.Player.GetPlayerInfo().Buffs.Where(b => b == dummy1_song.buff_id).Count(); int count4_type = PL.Player.GetPlayerInfo().Buffs.Where(b => b == song_3.buff_id).Count(); int count5_type = PL.Player.GetPlayerInfo().Buffs.Where(b => b == dummy2_song.buff_id).Count(); int count6_type = PL.Player.GetPlayerInfo().Buffs.Where(b => b == song_4.buff_id).Count(); int MON_count1_type = Monitored.Player.GetPlayerInfo().Buffs.Where(b => b == song_1.buff_id).Count(); int MON_count2_type = Monitored.Player.GetPlayerInfo().Buffs.Where(b => b == song_2.buff_id).Count(); int MON_count3_type = Monitored.Player.GetPlayerInfo().Buffs.Where(b => b == dummy1_song.buff_id).Count(); int MON_count4_type = Monitored.Player.GetPlayerInfo().Buffs.Where(b => b == song_3.buff_id).Count(); int MON_count5_type = Monitored.Player.GetPlayerInfo().Buffs.Where(b => b == dummy2_song.buff_id).Count(); int MON_count6_type = Monitored.Player.GetPlayerInfo().Buffs.Where(b => b == song_4.buff_id).Count(); if (ForceSongRecast == true) { song_casting = 0; ForceSongRecast = false; } // SONG NUMBER #4 if (song_casting == 3 && PL_BRDCount >= 3 && song_4.song_name.ToLower() != "blank" && count6_type < SongDataMax.Where(c => c == song_4.buff_id).Count() && Last_Song_Cast != song_4.song_name) { if (PL_BRDCount == 3) { if (PL.SpellAvailable(dummy2_song.song_name)) { actionResult.Spell = dummy2_song.song_name; } } else { if (PL.SpellAvailable(song_4.song_name)) { actionResult.Spell = song_4.song_name; Last_Song_Cast = song_4.song_name; Last_SongCast_Timer[0] = DateTime.Now; playerSong4[0] = DateTime.Now; song_casting = 0; } } } else if (song_casting == 3 && song_4.song_name.ToLower() != "blank" && count6_type >= SongDataMax.Where(c => c == song_4.buff_id).Count()) { song_casting = 0; } // SONG NUMBER #3 else if (song_casting == 2 && PL_BRDCount >= 2 && song_3.song_name.ToLower() != "blank" && count4_type < SongDataMax.Where(c => c == song_3.buff_id).Count() && Last_Song_Cast != song_3.song_name) { if (PL_BRDCount == 2) { if (PL.SpellAvailable(dummy1_song.song_name)) { actionResult.Spell = dummy1_song.song_name; } } else { if (PL.SpellAvailable(song_3.song_name)) { actionResult.Spell = song_3.song_name; Last_Song_Cast = song_3.song_name; Last_SongCast_Timer[0] = DateTime.Now; playerSong3[0] = DateTime.Now; song_casting = 3; } } } else if (song_casting == 2 && song_3.song_name.ToLower() != "blank" && count4_type >= SongDataMax.Where(c => c == song_3.buff_id).Count()) { song_casting = 3; } // SONG NUMBER #2 else if (song_casting == 1 && song_2.song_name.ToLower() != "blank" && count2_type < SongDataMax.Where(c => c == song_2.buff_id).Count() && Last_Song_Cast != song_4.song_name) { if (PL.SpellAvailable(song_2.song_name)) { actionResult.Spell = song_2.song_name; Last_Song_Cast = song_2.song_name; Last_SongCast_Timer[0] = DateTime.Now; playerSong2[0] = DateTime.Now; song_casting = 2; } } else if (song_casting == 1 && song_2.song_name.ToLower() != "blank" && count2_type >= SongDataMax.Where(c => c == song_2.buff_id).Count()) { song_casting = 2; } // SONG NUMBER #1 else if ((song_casting == 0) && song_1.song_name.ToLower() != "blank" && count1_type < SongDataMax.Where(c => c == song_1.buff_id).Count() && Last_Song_Cast != song_4.song_name) { if (PL.SpellAvailable(song_1.song_name)) { actionResult.Spell = song_1.song_name; Last_Song_Cast = song_1.song_name; Last_SongCast_Timer[0] = DateTime.Now; playerSong1[0] = DateTime.Now; song_casting = 1; } } else if (song_casting == 0 && song_2.song_name.ToLower() != "blank" && count1_type >= SongDataMax.Where(c => c == song_1.buff_id).Count()) { song_casting = 1; } // ONCE ALL SONGS HAVE BEEN CAST ONLY RECAST THEM WHEN THEY MEET THE THRESHOLD SET ON SONG RECAST AND BLOCK IF IT'S SET AT LAUNCH DEFAULTS if (playerSong1[0] != DefaultTime && playerSong1_Span[0].Minutes >= Config.SongRecastMinutes) { if ((Config.SingOnlyWhenNear && Monitoreddistance < 10) || Config.SingOnlyWhenNear == false) { if (PL.SpellAvailable(song_1.song_name)) { actionResult.Spell = song_1.song_name; playerSong1[0] = DateTime.Now; song_casting = 0; } } } else if (playerSong2[0] != DefaultTime && playerSong2_Span[0].Minutes >= Config.SongRecastMinutes) { if ((Config.SingOnlyWhenNear && Monitoreddistance < 10) || Config.SingOnlyWhenNear == false) { if (PL.SpellAvailable(song_2.song_name)) { actionResult.Spell = song_2.song_name; playerSong2[0] = DateTime.Now; song_casting = 0; } } } else if (playerSong3[0] != DefaultTime && playerSong3_Span[0].Minutes >= Config.SongRecastMinutes) { if ((Config.SingOnlyWhenNear && Monitoreddistance < 10) || Config.SingOnlyWhenNear == false) { if (PL.SpellAvailable(song_3.song_name)) { actionResult.Spell = song_3.song_name; playerSong3[0] = DateTime.Now; song_casting = 0; } } } else if (playerSong4[0] != DefaultTime && playerSong4_Span[0].Minutes >= Config.SongRecastMinutes) { if ((Config.SingOnlyWhenNear && Monitoreddistance < 10) || Config.SingOnlyWhenNear == false) { if (PL.SpellAvailable(song_4.song_name)) { actionResult.Spell = song_4.song_name; playerSong4[0] = DateTime.Now; song_casting = 0; } } } } return(actionResult); }
public EngineAction Run(GeoConfig Config) { _config = Config; EngineAction actionResult = new EngineAction { Target = Target.Me }; if (Config.EntrustEnabled && !PL.HasStatus((StatusEffect)584) && CheckEngagedStatus() == true && PL.AbilityAvailable(Ability.Entrust)) { actionResult.JobAbility = Ability.Entrust; return(actionResult); } else if (Config.DematerializeEnabled && CheckEngagedStatus() == true && PL.Player.Pet.HealthPercent >= 90 && PL.AbilityAvailable(Ability.Dematerialize)) { actionResult.JobAbility = Ability.Dematerialize; return(actionResult); } else if (Config.EclipticAttritionEnabled && CheckEngagedStatus() == true && PL.Player.Pet.HealthPercent >= 90 && PL.AbilityAvailable(Ability.EclipticAttrition) && !PL.HasStatus(516) && EclipticStillUp != true) { actionResult.JobAbility = Ability.EclipticAttrition; return(actionResult); } else if (Config.LifeCycleEnabled && CheckEngagedStatus() == true && PL.Player.Pet.HealthPercent <= 30 && PL.Player.Pet.HealthPercent >= 5 && PL.Player.HPP >= 90 && PL.AbilityAvailable(Ability.LifeCycle)) { actionResult.JobAbility = Ability.LifeCycle; return(actionResult); } // TODO: Fix up this logic, I think something was lost in the refactoring. // Need to see if there's a situation where both of these JA's would be activated for the cast. // For now the old logic seems to be use RA on it's own, or check for FC + Cast. if (Config.RadialArcanaEnabled && (PL.Player.MP <= Config.RadialArcanaMP) && PL.AbilityAvailable(Ability.RadialArcana) && !PL.Player.Buffs.Contains((short)StatusEffect.Weakness)) { // Check if a pet is already active if (PL.Player.Pet.HealthPercent >= 1 && PL.Player.Pet.Distance <= 9) { actionResult.JobAbility = Ability.RadialArcana; return(actionResult); } else if (PL.Player.Pet.HealthPercent >= 1 && PL.Player.Pet.Distance >= 9 && PL.AbilityAvailable(Ability.FullCircle)) { actionResult.JobAbility = Ability.FullCircle; } actionResult.Spell = ReturnGeoSpell(Config.RadialArcanaSpell, 2); } else if (Config.FullCircleEnabled) { // When out of range Distance is 59 Yalms regardless, Must be within 15 yalms to gain // the effect //Check if "pet" is active and out of range of the monitored player if (PL.Player.Pet.HealthPercent >= 1) { if (Config.FullCircleGeoTarget == true && Config.LuopanSpellTarget != "") { ushort PetsIndex = PL.Player.PetIndex; XiEntity PetsEntity = PL.Entity.GetEntity(PetsIndex); int FullCircle_CharID = 0; for (int x = 0; x < 2048; x++) { XiEntity entity = PL.Entity.GetEntity(x); if (entity.Name != null && entity.Name.ToLower().Equals(Config.LuopanSpellTarget.ToLower())) { FullCircle_CharID = Convert.ToInt32(entity.TargetID); break; } } if (FullCircle_CharID != 0) { XiEntity FullCircleEntity = PL.Entity.GetEntity(FullCircle_CharID); float fX = PetsEntity.X - FullCircleEntity.X; float fY = PetsEntity.Y - FullCircleEntity.Y; float fZ = PetsEntity.Z - FullCircleEntity.Z; float generatedDistance = (float)Math.Sqrt((fX * fX) + (fY * fY) + (fZ * fZ)); if (generatedDistance >= 10) { FullCircleTimer.Enabled = true; } } } else if (Config.FullCircleGeoTarget == false && Monitored.Player.Status == 1) { ushort PetsIndex = PL.Player.PetIndex; XiEntity PetsEntity = Monitored.Entity.GetEntity(PetsIndex); if (PetsEntity.Distance >= 10) { FullCircleTimer.Enabled = true; } } } } // ENTRUSTED INDI SPELL CASTING, WILL BE CAST SO LONG AS ENTRUST IS ACTIVE else if (Config.GeoSpellsEnabled && PL.HasStatus((StatusEffect)584) && PL.Player.Status != 33) { string SpellCheckedResult = ReturnGeoSpell(Config.EntrustSpell, 1); if (SpellCheckedResult == "SpellError_Cancel") { Config.GeoSpellsEnabled = false; actionResult.Error = "An error has occurred with Entrusted INDI spell casting, please report what spell was active at the time."; } else if (SpellCheckedResult == "SpellRecast" || SpellCheckedResult == "SpellUnknown") { } else { actionResult.Target = string.IsNullOrEmpty(Config.EntrustSpellTarget) ? Monitored.Player.Name : Config.EntrustSpellTarget; actionResult.Spell = SpellCheckedResult; } } // CAST NON ENTRUSTED INDI SPELL else if (Config.GeoSpellsEnabled && !PL.HasStatus(612) && PL.Player.Status != 33 && (CheckEngagedStatus() == true || !Config.IndiWhenEngaged)) { string SpellCheckedResult = ReturnGeoSpell(Config.IndiSpell, 1); if (SpellCheckedResult == "SpellError_Cancel") { Config.GeoSpellsEnabled = false; actionResult.Error = "An error has occurred with INDI spell casting, please report what spell was active at the time."; } else if (SpellCheckedResult == "SpellRecast" || SpellCheckedResult == "SpellUnknown") { } else { actionResult.Spell = SpellCheckedResult; } } // GEO SPELL CASTING else if (Config.LuopanSpellsEnabled && (PL.Player.Pet.HealthPercent < 1) && (CheckEngagedStatus() == true)) { // Use BLAZE OF GLORY if ENABLED if (Config.BlazeOfGloryEnabled && PL.AbilityAvailable(Ability.BlazeOfGlory) && CheckEngagedStatus() == true && GEO_EnemyCheck() == true) { actionResult.JobAbility = Ability.BlazeOfGlory; return(actionResult); } // Grab GEO spell name string SpellCheckedResult = ReturnGeoSpell(Config.GeoSpell, 2); if (SpellCheckedResult == "SpellError_Cancel") { Config.GeoSpellsEnabled = false; actionResult.Error = "An error has occurred with GEO spell casting, please report what spell was active at the time."; } else if (SpellCheckedResult == "SpellRecast" || SpellCheckedResult == "SpellUnknown") { // Do nothing and continue on with the program } else { if (PL.Resources.GetSpell(SpellCheckedResult, 0).ValidTargets == 5) { // PLAYER CHARACTER TARGET actionResult.Target = string.IsNullOrEmpty(Config.LuopanSpellTarget) ? Monitored.Player.Name : Config.LuopanSpellTarget; if (PL.HasStatus(516)) // IF ECLIPTIC IS UP THEN ACTIVATE THE BOOL { EclipticStillUp = true; } actionResult.Spell = SpellCheckedResult; } else { // ENEMY BASED TARGET NEED TO ASSURE PLAYER IS ENGAGED if (CheckEngagedStatus() == true) { int GrabbedTargetID = GrabGEOTargetID(); if (GrabbedTargetID != 0) { PL.Target.SetTarget(GrabbedTargetID); if (PL.HasStatus(516)) // IF ECLIPTIC IS UP THEN ACTIVATE THE BOOL { EclipticStillUp = true; } actionResult.Target = "<t>"; actionResult.Spell = SpellCheckedResult; } } } } } return(actionResult); }