Example #1
0
 public static void LOAD()
 {
     if (File.Exists("extra/warps.save"))
     {
         using (StreamReader SR = new StreamReader("extra/warps.save"))
         {
             bool   failed    = false;
             bool   anyfailed = false;
             string line;
             while (SR.EndOfStream == false)
             {
                 line = SR.ReadLine().ToLower().Trim();
                 if (!line.StartsWith("#") && line.Contains(":"))
                 {
                     string[] LINE = line.ToLower().Split(':');
                     Wrp      warp = new Wrp();
                     failed = false;
                     try
                     {
                         warp.name    = LINE[0];
                         warp.lvlname = LINE[1];
                         warp.x       = ushort.Parse(LINE[2]);
                         warp.y       = ushort.Parse(LINE[3]);
                         warp.z       = ushort.Parse(LINE[4]);
                         warp.rotx    = byte.Parse(LINE[5]);
                         warp.roty    = byte.Parse(LINE[6]);
                     }
                     catch
                     {
                         Server.s.Log("Couldn't load a Warp! Look in the 'extra/warps.save' file to see the unloaded warp");
                         FailedLoadingWarpsList.Add(warp);
                         failed    = true;
                         anyfailed = true;
                     }
                     if (failed == false)
                     {
                         Warps.Add(warp);
                     }
                 }
             }
             if (anyfailed == true)
             {
                 SAVE();
             }
             SR.Dispose();
         }
     }
 }
Example #2
0
 public static void LOAD()
 {
     if (File.Exists("extra/warps.save"))
     {
         using (StreamReader SR = new StreamReader("extra/warps.save"))
         {
             bool failed = false;
             bool anyfailed = false;
             string line;
             while (SR.EndOfStream == false)
             {
                 line = SR.ReadLine().ToLower().Trim();
                 if (!line.StartsWith("#") && line.Contains(":"))
                 {
                     string[] LINE = line.ToLower().Split(':');
                     Wrp warp = new Wrp();
                     failed = false;
                     try
                     {
                         warp.name = LINE[0];
                         warp.lvlname = LINE[1];
                         warp.x = ushort.Parse(LINE[2]);
                         warp.y = ushort.Parse(LINE[3]);
                         warp.z = ushort.Parse(LINE[4]);
                         warp.rotx = byte.Parse(LINE[5]);
                         warp.roty = byte.Parse(LINE[6]);
                     }
                     catch
                     {
                         Server.s.Log("Couldn't load a Warp! Look in the 'extra/warps.save' file to see the unloaded warp");
                         FailedLoadingWarpsList.Add(warp);
                         failed = true;
                         anyfailed = true;
                     }
                     if (failed == false)
                     {
                         Warps.Add(warp);
                     }
                 }
             }
             if (anyfailed == true)
             {
                 SAVE();
             }
             SR.Dispose();
         }
     }
 }
Example #3
0
 public static void DeleteWarp(string name)
 {
     Wrp wa = new Wrp();
     foreach (Wrp w in Warps)
     {
         if (w.name.ToLower().Trim() == name.ToLower().Trim())
         {
             wa = w;
             break;
         }
         
     }
     TempDeletedWarpsList.Add(wa);
     Warps.Remove(wa); 
     SAVE();
 }
Example #4
0
        public static void DeleteWarp(string name)
        {
            Wrp wa = new Wrp();

            foreach (Wrp w in Warps)
            {
                if (w.name.ToLower().Trim() == name.ToLower().Trim())
                {
                    wa = w;
                    break;
                }
            }
            TempDeletedWarpsList.Add(wa);
            Warps.Remove(wa);
            SAVE();
        }
Example #5
0
 public static void AddWarp(string name, Player p)
 {
     Wrp w = new Wrp();
     try
     {
         w.name = name;
         w.lvlname = p.level.name;
         w.x = p.pos[0];
         w.y = p.pos[1];
         w.z = p.pos[2];
         w.rotx = p.rot[0];
         w.roty = p.rot[1];
         Warps.Add(w);
         SAVE();
     }
     catch { }
 }
Example #6
0
        public static void AddWarp(string name, Player p)
        {
            Wrp w = new Wrp();

            try
            {
                w.name    = name;
                w.lvlname = p.level.name;
                w.x       = p.pos[0];
                w.y       = p.pos[1];
                w.z       = p.pos[2];
                w.rotx    = p.rot[0];
                w.roty    = p.rot[1];
                Warps.Add(w);
                SAVE();
            }
            catch { }
        }
Example #7
0
        public static void MoveWarp(string Wrp, Player p)
        {
            Wrp w = new Wrp();

            w = GetWarp(Wrp);
            Wrp wa = new Wrp();

            try
            {
                Warps.Remove(w);
                wa.name    = w.name;
                wa.lvlname = p.level.name;
                wa.x       = p.pos[0];
                wa.y       = p.pos[1];
                wa.z       = p.pos[2];
                wa.rotx    = p.rot[0];
                wa.roty    = p.rot[1];
                Warps.Add(wa);
                SAVE();
            }
            catch { }
        }
Example #8
0
 public static void MoveWarp(string Wrp, Player p)
 {
     Wrp w = new Wrp();
     w = GetWarp(Wrp);
     Wrp wa = new Wrp();
     try
     {
         Warps.Remove(w);
         wa.name = w.name;
         wa.lvlname = p.level.name;
         wa.x = p.pos[0];
         wa.y = p.pos[1];
         wa.z = p.pos[2];
         wa.rotx = p.rot[0];
         wa.roty = p.rot[1];
         Warps.Add(wa);
         SAVE();
     }
     catch { }
 }