public void Create(string warp, Player p) { Warp wp = new Warp(); 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 = warp; wp.lvlname = p.level.name; Items.Add(wp); Save(p); }
public void Goto(Warp warp, Player p) { if (!p.level.name.CaselessEq(warp.Level)) { PlayerActions.ChangeMap(p, warp.Level); } if (p.level.name.CaselessEq(warp.Level)) { p.SendPosition(warp.Pos, new Orientation(warp.Yaw, warp.Pitch)); p.Message("Sent you to waypoint/warp"); } else { p.Message("Unable to send you to the warp as the map it is on is not loaded."); } }
public static void LoadAllSettings() { Colors.LoadExtColors(); Alias.Load(); BlockDefinition.LoadGlobal(); SrvProperties.Load("properties/server.properties"); Updater.Load("properties/update.properties"); Group.InitAll(); Command.InitAll(); GrpCommands.fillRanks(); Block.SetBlocks(); Awards.Load(); Economy.Load(); Warp.LOAD(); CommandOtherPerms.Load(); ProfanityFilter.Init(); Team.LoadList(); }
public void Load() { if (!File.Exists(Filename)) { return; } List <Warp> warps = new List <Warp>(); using (StreamReader r = new StreamReader(Filename)) { string line; while ((line = r.ReadLine()) != null) { line = line.Trim(); if (line.StartsWith("#") || !line.Contains(":")) { continue; } string[] parts = line.Split(':'); Warp warp = new Warp(); try { warp.Name = parts[0]; warp.Level = parts[1]; warp.Pos.X = int.Parse(parts[2]); warp.Pos.Y = int.Parse(parts[3]); warp.Pos.Z = int.Parse(parts[4]); warp.Yaw = byte.Parse(parts[5]); warp.Pitch = byte.Parse(parts[6]); warps.Add(warp); } catch (Exception ex) { Logger.LogError("Error loading warp from " + Filename, ex); } } } // don't change live list while still loading warps Items = warps; }
public void Load(Player p) { string file = playerWarp ? "extra/Waypoints/" + p.name + ".save" : "extra/warps.save"; if (!File.Exists(file)) { return; } using (StreamReader r = new StreamReader(file)) { string line; while ((line = r.ReadLine()) != null) { line = line.ToLower().Trim(); if (line.StartsWith("#") || !line.Contains(":")) { continue; } string[] parts = line.ToLower().Split(':'); Warp wp = new Warp(); try { wp.name = parts[0]; wp.lvlname = parts[1]; wp.x = ushort.Parse(parts[2]); wp.y = ushort.Parse(parts[3]); wp.z = ushort.Parse(parts[4]); wp.rotx = byte.Parse(parts[5]); wp.roty = byte.Parse(parts[6]); Items.Add(wp); } catch { Server.s.Log("Couldn't load a warp."); } } } }
public void Remove(Warp warp, Player p) { Items.Remove(warp); Save(); }
public void Update(Warp warp, Player p) { Make(warp, warp.Name, p); Save(); }
void Make(Warp warp, string name, Player p) { warp.Pos = p.Pos; warp.Name = name; warp.Yaw = p.Rot.RotY; warp.Pitch = p.Rot.HeadX; warp.Level = p.level.name; }
/// <summary> Moves the given warp to the target /// player's position, orientation, and map. </summary> public void Update(Warp warp, Player p) { InitWarp(warp, warp.Name, p); Save(); }