public override void Execute() { if (BattlegroundEngine.BattlegroundProfile.BattlegroundType == BattlegroundType.CaptureTheFlag) { IEnumerable <WowGameobject> flags = BattlegroundEngine.GetBattlegroundFlags(false); if (flags.Count() > 0) { if (!((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).IsMeFlagCarrier) { WowGameobject flagObject = flags.First(); if (flagObject != null && flagObject.Position.GetDistance(WowInterface.ObjectManager.Player.Position) < 8) { WowInterface.HookManager.WowObjectOnRightClick(flagObject); } else { WowInterface.MovementEngine.SetState(MovementEngineState.Moving, flagObject.Position); WowInterface.MovementEngine.Execute(); } } else { BattlegroundEngine.SetState(BattlegroundState.MoveToOwnBase); } } else { BattlegroundEngine.SetState(BattlegroundState.DefendMyself); } } }
public bool HanldeInterruptStates() { IEnumerable <WowGameobject> enemyflags = BattlegroundEngine.GetBattlegroundFlags(); if (enemyflags.Count() > 0 && !((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).IsMeFlagCarrier) { BattlegroundEngine.SetState(BattlegroundState.PickupEnemyFlag); return(true); } IEnumerable <WowGameobject> ownFlags = BattlegroundEngine.GetBattlegroundFlags(false); if (ownFlags.Count() > 0 && !((ICtfBattlegroundProfile)BattlegroundEngine.BattlegroundProfile).IsMeFlagCarrier && ownFlags.FirstOrDefault()?.Position.GetDistance(WsgDataset.OwnFlagPosition) > 4) { BattlegroundEngine.SetState(BattlegroundState.PickupOwnFlag); return(true); } return(false); }