public static void Create(string waypoint, Player p) { Waypoint wp = new Waypoint(); wp.x = p.pos[0]; wp.y = p.pos[1]; wp.z = p.pos[2]; wp.rotx = p.rot[0]; wp.roty = p.rot[1]; wp.name = waypoint; wp.lvlname = p.level.name; p.Waypoints.Add(wp); Save(); }
public static void Load(Player p) { if ( File.Exists("extra/Waypoints/" + p.name + ".save") ) { using ( StreamReader SR = new StreamReader("extra/Waypoints/" + p.name + ".save") ) { bool failed = false; string line; while ( SR.EndOfStream == false ) { line = SR.ReadLine().ToLower().Trim(); if ( !line.StartsWith("#") && line.Contains(":") ) { failed = false; string[] LINE = line.ToLower().Split(':'); Waypoint wp = new Waypoint(); try { wp.name = LINE[0]; wp.lvlname = LINE[1]; wp.x = ushort.Parse(LINE[2]); wp.y = ushort.Parse(LINE[3]); wp.z = ushort.Parse(LINE[4]); wp.rotx = byte.Parse(LINE[5]); wp.roty = byte.Parse(LINE[6]); } catch { Server.s.Log("Couldn't load a Waypoint!"); failed = true; } if ( failed == false ) { p.Waypoints.Add(wp); } } } SR.Dispose(); } } }