private static bool IsLevelSyncNeeded(GameObject battleCharacter) { if (battleCharacter.FateId == 0) { return(false); } return(FateManager.GetFateById(battleCharacter.FateId).MaxLevel < OracleClassManager.GetTrueLevel()); }
private static double GetWeight(BattleCharacter battleCharacter) { var weight = 1800f; var currentFate = OracleFateManager.GetCurrentFateData(); var oracleFate = new Fate(); if (currentFate != null) { oracleFate = OracleFateManager.FateDatabase.GetFateFromFateData(currentFate); } // If FATE has a preferred target, prioritise it if we're out of combat. if (oracleFate.PreferredTargetId != null && oracleFate.PreferredTargetId.Contains(battleCharacter.NpcId) && !Core.Player.InCombat) { weight += 20000; } if (battleCharacter.Pointer == Core.Player.PrimaryTargetPtr) { weight += 150; } if (battleCharacter.HasTarget && battleCharacter.CurrentTargetId == Core.Player.ObjectId) { weight += 750; } if (ChocoboManager.Object != null && battleCharacter.HasTarget && battleCharacter.CurrentTargetId == ChocoboManager.Object.ObjectId) { weight += 400; } if (!battleCharacter.TappedByOther) { weight += 200; } if (battleCharacter.CurrentTargetId == Core.Player.ObjectId) { weight += 1000 / Convert.ToSingle(battleCharacter.CurrentHealth) * 3000; } if (!battleCharacter.InCombat) { weight += 130; } // Prefer nearer targets in combat if melee, and always out of combat. if (OracleClassManager.IsMeleeDpsClassJob(Core.Player.CurrentJob) || OracleClassManager.IsTankClassJob(Core.Player.CurrentJob) || !Core.Player.InCombat) { weight -= battleCharacter.Distance(Core.Player) * 30; } return(weight); }
internal static async Task <bool> Main() { if (CommonBehaviors.IsLoading) { return(false); } if (IsFateSet()) { if (OracleFateManager.GetCurrentFateData() == null) { return(true); } if (!IsFatePoiSet() && Poi.Current.Type != PoiType.Death && !GameObjectManager.Attackers.Any()) { Poi.Current = new Poi(OracleFateManager.GetCurrentFateData(), PoiType.Fate); } return(true); } if (OracleClassManager.ZoneChangeNeeded()) { return(false); } if (OracleFateManager.PreviousFateChained() && ModeSettings.Instance.OracleOperationMode != OracleOperationMode.SpecificFates) { await SelectChainFate(); } else if (ModeSettings.Instance.OracleOperationMode == OracleOperationMode.SpecificFates) { await SelectSpecificFate(); } else { await SelectClosestFate(); } if (OracleFateManager.GetCurrentFateData() != null && MovementSettings.Instance.DelayFateMovement && !OracleFateManager.DoNotWaitBeforeMovingFlag) { await WaitBeforeMoving(); } OracleFateManager.DoNotWaitBeforeMovingFlag = false; return(IsFateSet() && IsFatePoiSet()); }
internal static async Task <bool> Main() { if (Poi.Current.Type != PoiType.Kill) { return(false); } OracleFateManager.ForceUpdateGameCache(); if (!Poi.Current.BattleCharacter.IsValid || Poi.Current.BattleCharacter.IsDead) { OracleFateManager.ClearPoi("Mob is " + "no longer" + " valid.", false); return(false); } if (Core.Player.CurrentHealthPercent < MainSettings.Instance.RestHealthPercent) { WaitForPlayerRegeneration(); return(true); } if (OracleClassManager.IsTankClassJob(Core.Player.CurrentJob) || OracleClassManager.IsMeleeDpsClassJob(Core.Player.CurrentJob) || OracleClassManager.IsRangedDpsClassJob(Core.Player.CurrentJob)) { if (Core.Player.CurrentTPPercent < MainSettings.Instance.RestTPManaPercent) { WaitForPlayerRegeneration(); return(true); } } if (OracleClassManager.IsCasterClassJob(Core.Player.CurrentJob) || OracleClassManager.IsHealerClassJob(Core.Player.CurrentJob)) { if (Core.Player.CurrentManaPercent < MainSettings.Instance.RestTPManaPercent) { WaitForPlayerRegeneration(); return(true); } } return(false); }
internal static async Task <bool> Main() { if (CommonBehaviors.IsLoading) { return(false); } if (OracleClassManager.ZoneChangeNeeded()) { return(false); } OracleFateManager.DoNotWaitBeforeMovingFlag = false; switch (WaitSettings.Instance.FateWaitMode) { case FateWaitMode.ReturnToAetheryte: await ReturnToAetheryte.Main(); break; case FateWaitMode.MoveToWaitLocation: await MoveToWaitLocation.Main(); break; case FateWaitMode.GrindMobs: await GrindMobs.Main(); break; case FateWaitMode.WaitInPlace: await WaitInPlace.Main(); break; default: Logger.SendDebugLog("Cannot determine idle strategy, defaulting to 'Return to Aetheryte'."); await ReturnToAetheryte.Main(); break; } return(false); }
internal static async Task <bool> HandleZoneChange() { const uint idyllshireAetheryte = 75; MovementSettings.Instance.ZoneLevels.TryGetValue(OracleClassManager.GetTrueLevel(), out uint aetheryteId); // Ensure we have no FATE selected to prevent null references. await OracleFateManager.ClearCurrentFate("Zone change needed.", false); if (aetheryteId == 0 || !WorldManager.HasAetheryteId(aetheryteId)) { Logger.SendErrorLog("Can't find requested teleport destination, make sure you've unlocked it."); OracleBot.StopOracle("Cannot teleport to destination."); return(false); } if (!WorldManager.CanTeleport()) { return(false); } var zoneName = WorldManager.AvailableLocations.FirstOrDefault(teleport => teleport.AetheryteId == aetheryteId).Name; Logger.SendLog("Character is level " + OracleClassManager.GetTrueLevel() + ", teleporting to " + zoneName + "."); await OracleTeleportManager.TeleportToAetheryte(aetheryteId); if (WorldManager.ZoneId != WorldManager.GetZoneForAetheryteId(aetheryteId)) { return(true); } if (MovementSettings.Instance.BindHomePoint) { await BindHomePoint.Main(aetheryteId); } if (aetheryteId == idyllshireAetheryte) { await OracleMovementManager.MoveOutOfIdyllshire(); } return(true); }
internal static async Task <bool> HandleMultiLevelling() { if (!Core.Player.InCombat && OracleClassManager.NoClassesEnabled()) { Logger.SendErrorLog("You haven't enabled any classes for levelling. Ensure at least one class is enabled and then restart Oracle."); OracleBot.StopOracle("No classes enabled."); } else if (!Core.Player.InCombat && OracleClassManager.FinishedLevelling()) { Logger.SendLog("We've reached level " + ClassSettings.Instance.MaxLevel + " with all enabled classes! Stopping Oracle."); await OracleTeleportManager.TeleportToClosestCity(); OracleBot.StopOracle("We are done!"); } else if (OracleClassManager.ClassChangeNeeded()) { if (GameObjectManager.Attackers.Any()) { return(true); } Logger.SendLog("Class change is needed."); var changeClassResult = await OracleClassManager.ChangeClassJob(OracleClassManager.GetLowestLevelClassJob()); if (changeClassResult == ChangeClassResult.NoGearset || changeClassResult == ChangeClassResult.NonCombatClass) { OracleBot.StopOracle("Problem swapping classes."); } } else if (OracleClassManager.ZoneChangeNeeded()) { if (Core.Player.InCombat || GameObjectManager.Attackers.Any()) { return(true); } Logger.SendLog("Zone change is needed."); await ZoneChange.HandleZoneChange(); } return(true); }
internal static async Task <bool> HandleLevelling() { if (!Core.Player.InCombat && OracleClassManager.FinishedLevelling()) { Logger.SendLog("We've reached level " + ClassSettings.Instance.MaxLevel + " on our current class! Stopping Oracle."); await OracleTeleportManager.TeleportToClosestCity(); OracleBot.StopOracle("We are done!"); } else if (OracleClassManager.ZoneChangeNeeded()) { if (Core.Player.InCombat) { return(true); } Logger.SendLog("Zone change is needed."); await ZoneChange.HandleZoneChange(); } return(true); }
internal static async Task <bool> HandleAnimaGrind() { if (!ConditionParser.HasQuest(AnimaQuest)) { Logger.SendErrorLog("You do not have the quest 'Soul Without Life', which is required to run in Anima grind mode."); OracleBot.StopOracle("Required quest is not picked up."); return(true); } if (ConditionParser.GetQuestStep(AnimaQuest) != AnimaQuestStep) { OracleFateManager.PausePoiSetting = true; if (WorldManager.ZoneId != ZoneMorDhona) { await ZoneChange.HandleZoneChange(ZoneMorDhona, false); } // Step 1: Talk to Rowena. if (ConditionParser.GetQuestStep(AnimaQuest) == 1) { var rowenaLocation = new Vector3(25.65759f, 29f, -822.5876f); if (Core.Player.Distance(rowenaLocation) > 10f) { await OracleMovementManager.NavigateToLocation(rowenaLocation, 2f, false); } const uint rowenaNpcId = 1001304; var rowenaGameObject = GameObjectManager.GameObjects.FirstOrDefault(npc => npc.NpcId == rowenaNpcId); if (rowenaGameObject != null) { if (Core.Player.Distance2D(rowenaGameObject.Location) > 4f) { await OracleMovementManager.NavigateToLocation(rowenaGameObject.Location, 4f, false); } rowenaGameObject.Interact(); await Coroutine.Sleep(MainSettings.Instance.ActionDelay); await SkipDialogue.Main(); } } // Step 2: Talk to Syndony. if (ConditionParser.GetQuestStep(AnimaQuest) == 2) { var syndonyLocation = new Vector3(56.6797f, 50f, -777.5304f); if (Core.Player.Distance(syndonyLocation) > 10f) { await OracleMovementManager.NavigateToLocation(syndonyLocation, 2f, false); } const uint syndonyNpcId = 1016289; var syndonyGameObject = GameObjectManager.GameObjects.FirstOrDefault(npc => npc.NpcId == syndonyNpcId); if (syndonyGameObject != null) { if (Core.Player.Distance2D(syndonyGameObject.Location) > 4f) { await OracleMovementManager.NavigateToLocation(syndonyGameObject.Location, 4f, false); } syndonyGameObject.Interact(); await Coroutine.Sleep(MainSettings.Instance.ActionDelay); await SkipDialogue.Main(); } } } else { if (OracleFateManager.PausePoiSetting) { OracleFateManager.PausePoiSetting = false; } } if (!ConditionParser.HasAtLeast(LuminousIceCrystal, ModeSettings.Instance.AnimaCrystalsToFarm)) { if (OracleClassManager.GetTrueLevel() < 50) { Logger.SendErrorLog("You are too low level to run FATEs in Coerthas Western Highlands."); OracleBot.StopOracle("Too low level to continue."); return(true); } if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == ZoneCoerthasWesternHighlands) { return(true); } var amountNeeded = ModeSettings.Instance.AnimaCrystalsToFarm - OracleInventoryManager.GetItemAmount(LuminousIceCrystal); if (amountNeeded == 1) { Logger.SendLog("We need " + amountNeeded + " more Luminous Ice Crystal."); } else { Logger.SendLog("We need " + amountNeeded + " more Luminous Ice Crystals."); } await ZoneChange.HandleZoneChange(ZoneCoerthasWesternHighlands, true); } else if (!ConditionParser.HasAtLeast(LuminousWindCrystal, ModeSettings.Instance.AnimaCrystalsToFarm)) { if (OracleClassManager.GetTrueLevel() < 50) { Logger.SendErrorLog("You are too low level to run FATEs in The Sea of Clouds."); OracleBot.StopOracle("Too low level to continue."); return(true); } if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == ZoneSeaOfClouds) { return(true); } var amountNeeded = ModeSettings.Instance.AnimaCrystalsToFarm - OracleInventoryManager.GetItemAmount(LuminousWindCrystal); if (amountNeeded == 1) { Logger.SendLog("We need " + amountNeeded + " more Luminous Wind Crystal."); } else { Logger.SendLog("We need " + amountNeeded + " more Luminous Wind Crystals."); } await ZoneChange.HandleZoneChange(ZoneSeaOfClouds, true); } else if (!ConditionParser.HasAtLeast(LuminousEarthCrystal, ModeSettings.Instance.AnimaCrystalsToFarm)) { if (OracleClassManager.GetTrueLevel() < 50) { Logger.SendErrorLog("You are too low level to run FATEs in The Dravanian Forelands."); OracleBot.StopOracle("Too low level to continue."); return(true); } if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == ZoneDravanianForelands) { return(true); } var amountNeeded = ModeSettings.Instance.AnimaCrystalsToFarm - OracleInventoryManager.GetItemAmount(LuminousEarthCrystal); if (amountNeeded == 1) { Logger.SendLog("We need " + amountNeeded + " more Luminous Earth Crystal."); } else { Logger.SendLog("We need " + amountNeeded + " more Luminous Earth Crystals."); } await ZoneChange.HandleZoneChange(ZoneDravanianForelands, true); } else if (!ConditionParser.HasAtLeast(LuminousLightningCrystal, ModeSettings.Instance.AnimaCrystalsToFarm)) { if (OracleClassManager.GetTrueLevel() < 52) { Logger.SendErrorLog("You are too low level to run FATEs in The Churning Mists."); OracleBot.StopOracle("Too low level to continue."); return(true); } if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == ZoneChurningMists) { return(true); } var amountNeeded = ModeSettings.Instance.AnimaCrystalsToFarm - OracleInventoryManager.GetItemAmount(LuminousLightningCrystal); if (amountNeeded == 1) { Logger.SendLog("We need " + amountNeeded + " more Luminous Lightning Crystal."); } else { Logger.SendLog("We need " + amountNeeded + " more Luminous Lightning Crystals."); } await ZoneChange.HandleZoneChange(ZoneChurningMists, true); } else if (!ConditionParser.HasAtLeast(LuminousWaterCrystal, ModeSettings.Instance.AnimaCrystalsToFarm)) { if (OracleClassManager.GetTrueLevel() < 54) { Logger.SendErrorLog("You are too low level to run FATEs in The Dravanian Hinterlands."); OracleBot.StopOracle("Too low level to continue."); return(true); } if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == ZoneDravanianHinterlands) { return(true); } var amountNeeded = ModeSettings.Instance.AnimaCrystalsToFarm - OracleInventoryManager.GetItemAmount(LuminousWaterCrystal); if (amountNeeded == 1) { Logger.SendLog("We need " + amountNeeded + " more Luminous Water Crystal."); } else { Logger.SendLog("We need " + amountNeeded + " more Luminous Water Crystals."); } await ZoneChange.HandleZoneChange(ZoneDravanianHinterlands, true); } else if (!ConditionParser.HasAtLeast(LuminousFireCrystal, ModeSettings.Instance.AnimaCrystalsToFarm)) { if (OracleClassManager.GetTrueLevel() < 55) { Logger.SendErrorLog("You are too low level to run FATEs in Azys Lla."); OracleBot.StopOracle("Too low level to continue."); return(true); } if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == ZoneAzysLla) { return(true); } var amountNeeded = ModeSettings.Instance.AnimaCrystalsToFarm - OracleInventoryManager.GetItemAmount(LuminousFireCrystal); if (amountNeeded == 1) { Logger.SendLog("We need " + amountNeeded + " more Luminous Fire Crystal."); } else { Logger.SendLog("We need " + amountNeeded + " more Luminous Fire Crystals."); } await ZoneChange.HandleZoneChange(ZoneAzysLla, true); } else if (!Core.Player.InCombat) { Logger.SendLog("We have collected " + ModeSettings.Instance.AnimaCrystalsToFarm + " of every crystal! Stopping Oracle."); await OracleTeleportManager.TeleportToClosestCity(); if (OracleTeleportManager.InCity()) { OracleBot.StopOracle("We are done!"); } } return(true); }
internal static async Task <bool> HandleAtmaGrind() { if (!OracleClassManager.ClassJobCanFarmAtma(Core.Player.CurrentJob)) { Logger.SendErrorLog("Your current class (" + OracleClassManager.GetClassJobName(Core.Player.CurrentJob) + ") cannot farm Atma."); OracleBot.StopOracle("Current class cannot farm Atma."); return(true); } var weaponId = GetClassJobZenithWeapon(Core.Player.CurrentJob); if (!OracleInventoryManager.IsItemEquipped(weaponId, EquipmentSlot.MainHand)) { await EquipMainHand(); } // Special case for Gladiator/Paladin shield. if ((Core.Player.CurrentJob == ClassJobType.Gladiator || Core.Player.CurrentJob == ClassJobType.Paladin) && !OracleInventoryManager.IsItemEquipped(ShieldPaladinItemId, EquipmentSlot.OffHand)) { await EquipOffHand(); } if (!ConditionParser.HasAtLeast(AtmaLionItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaLionZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaLionItemId)) + " Atma of the Lion."); await ZoneChange.HandleZoneChange(AtmaLionZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaWaterBearerItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaWaterBearerZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaWaterBearerItemId)) + " Atma of the Water-bearer."); await ZoneChange.HandleZoneChange(AtmaWaterBearerZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaRamItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaRamZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaRamItemId)) + " Atma of the Ram."); await ZoneChange.HandleZoneChange(AtmaRamZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaCrabItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaCrabZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaCrabItemId)) + " Atma of the Crab."); await ZoneChange.HandleZoneChange(AtmaCrabZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaFishItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaFishZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaFishItemId)) + " Atma of the Fish."); await ZoneChange.HandleZoneChange(AtmaFishZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaBullItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaBullZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaBullItemId)) + " Atma of the Bull."); await ZoneChange.HandleZoneChange(AtmaBullZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaScalesItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaScalesZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaScalesItemId)) + " Atma of the Scales."); await ZoneChange.HandleZoneChange(AtmaScalesZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaTwinsItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaTwinsZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaTwinsItemId)) + " Atma of the Twins."); await ZoneChange.HandleZoneChange(AtmaTwinsZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaScorpionItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaScorpionZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaScorpionItemId)) + " Atma of the Scorpion."); await ZoneChange.HandleZoneChange(AtmaScorpionZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaArcherItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaArcherZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaArcherItemId)) + " Atma of the Archer."); await ZoneChange.HandleZoneChange(AtmaArcherZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaGoatItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaGoatZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaGoatItemId)) + " Atma of the Goat."); await ZoneChange.HandleZoneChange(AtmaGoatZoneId, true); } else if (!ConditionParser.HasAtLeast(AtmaMaidenItemId, ModeSettings.Instance.AtmaToFarm)) { if (Core.Player.InCombat || !WorldManager.CanTeleport() || WorldManager.ZoneId == AtmaMaidenZoneId) { return(true); } Logger.SendLog("We need " + (ModeSettings.Instance.AtmaToFarm - OracleInventoryManager.GetItemAmount(AtmaMaidenItemId)) + " Atma of the Maiden."); await ZoneChange.HandleZoneChange(AtmaMaidenZoneId, true); } else if (!Core.Player.InCombat) { Logger.SendLog("We have collected " + ModeSettings.Instance.AtmaToFarm + " of every Atma! Stopping Oracle."); await OracleTeleportManager.TeleportToClosestCity(); OracleBot.StopOracle("We are done!"); } return(true); }