public override void ExecuteLeft(Player p) { byte targetkick = (byte)((p.rot[0] - 32) % 256); var targetdir = DirUtils.GetDirVector(targetkick, p.rot[1]); PlayerHandlers.KickBall(p, (float)(targetdir.X * 0.5), 0, (float)(targetdir.Z * 0.5), false); }
public void InitFootball() { Stats.CheckTableExists(); SkillHandler.Init(); PlayerHandlers.InitHandlers(); BotInstruction.Instructions.Add(new RefereeInstruction()); BotInstruction.Instructions.Add(new BallInstruction()); Server.s.Log("Added player handlers"); Commands.CommandHandler.AddAll(); Server.s.Log("Added commands"); Ball = new Ball(); Match = new Match(Ball); footballTimer.Interval = ServerConfig.PositionUpdateInterval; footballTimer.Elapsed += delegate { Scheduler.Update(); foreach (Player p in Player.players) { HUD.UpdateAll(p); } }; footballTimer.Start(); Core.Match.MatchTimer.Elapsed += new ElapsedEventHandler(Match.UnforcedEnd); Task.Run(() => Match.KickOff(true)); Server.s.Log("Football started"); }
public override void ExecuteRight(Player p) { var dir = DirUtils.GetDirVector(p.rot[0], p.rot[1]); PlayerHandlers.KickBall(p, (float)(dir.X * -0.1), 0, (float)(dir.Z * -0.3)); Thread.Sleep(250); PlayerHandlers.KickBall(p, (float)(dir.X * 0.5), 0, (float)(dir.Z * 0.5)); }
public override void ExecuteLeft(Player p) { byte first = (byte)((p.rot[0] + 90) % 256); var firstdir = DirUtils.GetDirVector(first, p.rot[1]); byte second = (byte)((p.rot[0] - 60) % 256); var seconddir = DirUtils.GetDirVector(second, p.rot[1]); PlayerHandlers.KickBall(p, (float)(firstdir.X * 0.1), 0, (float)(firstdir.Z * 0.1)); Thread.Sleep(500); PlayerHandlers.KickBall(p, (float)(seconddir.X * 0.3), 0, (float)(seconddir.Z * 0.3)); }
public override void ExecuteLeft(Player p) { var dir = DirUtils.GetDirVector(p.rot[0], p.rot[1]); PlayerHandlers.KickBall(p, (float)(dir.X * -0.2), 0, (float)(dir.Z * -0.2)); byte yaw = (byte)((p.rot[0] + 128) % 256); byte targetkick = (byte)((p.rot[0] - 64) % 256); var targetdir = DirUtils.GetDirVector(targetkick, p.rot[1]); p.SendPos(p.id, p.pos[0], p.pos[1], p.pos[2], yaw, p.rot[1]); Thread.Sleep(1000); PlayerHandlers.KickBall(p, (float)(targetdir.X * 0.4), 0, (float)(targetdir.Z * 0.4)); p.SendPos(p.id, p.pos[0], p.pos[1], p.pos[2], targetkick, p.rot[1]); }
public static void Execute(Player p, int skill) { try { string line; var Dir = DirUtils.GetDirVector(p.rot[0], p.rot[1]); var MaxDir = DirUtils.GetDirVector(255, 255); // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader("skills/" + p.name.ToLower() + skill.ToString() + ".txt"); while ((line = file.ReadLine()) != null) { if (line.StartsWith("Kick(")) { //Kick(X, Y, Z); var line_ = line.Replace("Kick(", "").Replace(");", "").Replace(" ", "").Replace("X", Dir.X.ToString()) .Replace("Y", Dir.Y.ToString()).Replace("Z", Dir.Z.ToString()).Split(','); var X = Evaluate(line_[0]); var Y = Evaluate(line_[1]); var Z = Evaluate(line_[2]); PlayerHandlers.KickBall(p, X, Y, Z); Thread.Sleep(500); } //Kick X Y Z if (line.StartsWith("Kick ")) { //Kick(X, Y, Z); var line_ = line.Replace("Kick ", "").Replace(");", "").Replace(" ", "").Replace("X", Dir.X.ToString()) .Replace("Y", Dir.Y.ToString()).Replace("Z", Dir.Z.ToString()).Split(','); var X = Evaluate(line_[0]); var Y = Evaluate(line_[1]); var Z = Evaluate(line_[2]); PlayerHandlers.KickBall(p, X, Y, Z); Thread.Sleep(500); } } } catch { p.SendMessage("Error in Skill #" + skill.ToString()); } }
public override void ExecuteLeft(Player p) { var dir = DirUtils.GetDirVector(p.rot[0], p.rot[1]); PlayerHandlers.KickBall(p, (float)(dir.X * -0.4), 0.4f, (float)(dir.Z * -0.4)); }
public override void ExecuteRight(Player p) { var dir = DirUtils.GetDirVector(p.rot[0], p.rot[1]); PlayerHandlers.KickBall(p, (float)(dir.X * 0.1), 0.3f, (float)(dir.Z * 0.1)); }