private static bool CurrentInformationsHasChanged(bool ignoreFight, bool isHoldingWGFlag, bool isSomeoneHoldingMyFlag, bool isSomeoneHoldingThemFlag, bool inCombat) { if (Usefuls.BadBottingConditions || !Usefuls.IsInBattleground || Battleground.IsFinishBattleground() || !Battleground.BattlegroundIsStarted()) { Logging.Write("Current Informations Has Changed. #1"); return(true); } if (isHoldingWGFlag && !isSomeoneHoldingMyFlag) { if (!ObjectManager.Me.IsHoldingWGFlag || ObjectManager.IsSomeoneHoldingWGFlag()) { Logging.Write("Current Informations Has Changed. #2"); return(true); } Main.InternalIgnoreFight = ObjectManager.Me.Position.DistanceTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _hordeFlagPositionInCTFModule : _allianceFlagPositionInCTFModule) <= 20; } else if (isHoldingWGFlag) { if (!ObjectManager.Me.IsHoldingWGFlag || !ObjectManager.IsSomeoneHoldingWGFlag()) { Logging.Write("Current Informations Has Changed. #3"); return(true); } Main.InternalDontStartFights = ObjectManager.Me.Position.DistanceTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _hordeFlagPositionInCTFModule : _allianceFlagPositionInCTFModule) > 20; } else if (!isSomeoneHoldingThemFlag) { if (ObjectManager.Me.IsHoldingWGFlag || ObjectManager.IsSomeoneHoldingWGFlag(false)) { Logging.Write("Current Informations Has Changed. #4"); return(true); } Main.InternalIgnoreFight = ObjectManager.IsSomeoneHoldingWGFlag() && ObjectManager.Me.Position.DistanceTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _allianceFlagPositionInCTFModule : _hordeFlagPositionInCTFModule) <= 20; } else if (isSomeoneHoldingMyFlag) { if (ObjectManager.Me.IsHoldingWGFlag || !ObjectManager.IsSomeoneHoldingWGFlag() || !ObjectManager.IsSomeoneHoldingWGFlag(false)) { Logging.Write("Current Informations Has Changed. #5"); return(true); } } else { if (ObjectManager.Me.IsHoldingWGFlag || ObjectManager.IsSomeoneHoldingWGFlag() || !ObjectManager.IsSomeoneHoldingWGFlag(false)) { Logging.Write("Current Informations Has Changed. #6"); return(true); } } if (inCombat && !ignoreFight && !ObjectManager.Me.InCombat) { Logging.Write("Current Informations Has Changed. #7"); return(true); } if (!inCombat && ObjectManager.Me.InCombat && !ignoreFight) { Logging.Write("Current Informations Has Changed. #8"); return(true); } return(false); }
internal CaptureTheFlag() { _allianceFlagPositionTwinPeaks = new Point((float)2117.637, (float)191.6823, (float)44.05199); _allianceFlagPositionWarsongGulch = new Point((float)1540.423, (float)1481.325, (float)351.8284); _allianceFlagId = 179830; _allianceFlagFloorId = 179785; _hordeFlagPositionInTwinPeaks = new Point((float)1578.337, (float)344.0451, (float)2.418409); _hordeFlagPositionInWarsongGulch = new Point((float)916.5073, (float)1433.826, (float)346.3796); _hordeFlagId = _allianceFlagId + 1; _hordeFlagFloorId = _allianceFlagFloorId + 1; while (Main.Loop) { try { if (Battleground.GetCurrentBattleground() == BattlegroundId.WarsongGulch) { _allianceFlagPositionInCTFModule = _allianceFlagPositionWarsongGulch; _hordeFlagPositionInCTFModule = _hordeFlagPositionInWarsongGulch; } else { _allianceFlagPositionInCTFModule = _allianceFlagPositionTwinPeaks; _hordeFlagPositionInCTFModule = _hordeFlagPositionInTwinPeaks; } Main.InternalIgnoreFight = false; Main.InternalDontStartFights = false; if (!Usefuls.BadBottingConditions && Usefuls.IsInBattleground && !Battleground.IsFinishBattleground() && Battleground.BattlegroundIsStarted()) { if (ObjectManager.Me.IsHoldingWGFlag && !ObjectManager.IsSomeoneHoldingWGFlag()) { // 1 possibility : // Go to my base and capture it. Logging.Write("Go to my base and capture it."); Main.InternalDontStartFights = true; Main.InternalIgnoreFight = false; InternalGoTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _hordeFlagPositionInCTFModule : _allianceFlagPositionInCTFModule, ObjectManager.Me.IsHoldingWGFlag, ObjectManager.IsSomeoneHoldingWGFlag(), ObjectManager.IsSomeoneHoldingWGFlag(false), ObjectManager.Me.InCombat); } else if (ObjectManager.Me.IsHoldingWGFlag) { // 4 possibilities : if (CaptureTheFlagSettings.CurrentSetting.PlayTheFlag) { // Go to my base and wait until I can capture it. Logging.Write("Go to my base and wait until I can capture it."); Main.InternalDontStartFights = true; Main.InternalIgnoreFight = false; InternalGoTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _hordeFlagPositionInCTFModule : _allianceFlagPositionInCTFModule, ObjectManager.Me.IsHoldingWGFlag, ObjectManager.IsSomeoneHoldingWGFlag(), ObjectManager.IsSomeoneHoldingWGFlag(false), ObjectManager.Me.InCombat); } // Go to my base and wait in a protected area until I can capture it. // Search & Destroy the Hostile Flag holder if not so far from my base. // Search & Destroy the Hostile Flag holder. } else if (!ObjectManager.IsSomeoneHoldingWGFlag(false)) { // 2 possibilities : // Go to the ennemy base and take it. Logging.Write("Go to the ennemy base and take it."); Main.InternalDontStartFights = true; Main.InternalIgnoreFight = false; InternalGoTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _allianceFlagPositionInCTFModule : _hordeFlagPositionInCTFModule, ObjectManager.Me.IsHoldingWGFlag, ObjectManager.IsSomeoneHoldingWGFlag(), ObjectManager.IsSomeoneHoldingWGFlag(false), ObjectManager.Me.InCombat, "Take"); // Search & Destroy the Hostile Flag holder. } else if (ObjectManager.IsSomeoneHoldingWGFlag()) { // 4 possibilities : Logging.Write("Go to the ennemy base and wait until I can take it. #1"); Main.InternalIgnoreFight = false; Main.InternalDontStartFights = false; // Go to the ennemy base and wait until I can take it. InternalGoTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _allianceFlagPositionInCTFModule : _hordeFlagPositionInCTFModule, ObjectManager.Me.IsHoldingWGFlag, ObjectManager.IsSomeoneHoldingWGFlag(), ObjectManager.IsSomeoneHoldingWGFlag(false), ObjectManager.Me.InCombat, "Take"); // Go to the ennemy base and wait in a protected area until I can take it. // Protect the ally Flag holder. // Search & Destroy the Hostile Flag holder. } else { // 3 possibilities : Logging.Write("Go to the ennemy base and wait until I can take it. #2"); Main.InternalIgnoreFight = false; Main.InternalDontStartFights = false; // Go to the ennemy base and wait until I can take it. InternalGoTo(ObjectManager.Me.PlayerFaction.ToLower() == "horde" ? _allianceFlagPositionInCTFModule : _hordeFlagPositionInCTFModule, ObjectManager.Me.IsHoldingWGFlag, ObjectManager.IsSomeoneHoldingWGFlag(), ObjectManager.IsSomeoneHoldingWGFlag(false), ObjectManager.Me.InCombat, "Take"); // Go to the ennemy base and wait in a protected area until I can take it. // Protect the ally Flag holder. } } else { Thread.Sleep(100); } } catch (Exception e) { Logging.WriteError("Custom Profile > TheNoobBotCP > CaptureTheFlagWG > Loop: " + e); } Thread.Sleep(100); } }