Esempio n. 1
0
 internal Arena(string name, TileLocation home, TileLocation redSpawn, TileLocation blueSpawn, TileLocation topLeft, TileLocation bottomRight, BunkerTile red, BunkerTile blue, ArenaStat stats = null, List <Script> scripts = null)
 {
     Name        = name;
     Home        = home;
     RedSpawn    = redSpawn;
     BlueSpawn   = blueSpawn;
     TopLeft     = topLeft;
     BottomRight = bottomRight;
     Red         = red;
     Blue        = blue;
     if (stats == null)
     {
         Stats = new ArenaStat();
     }
     else
     {
         Stats = stats;
     }
     if (scripts == null)
     {
         Scripts = new List <Script>();
     }
     else
     {
         Scripts = scripts;
     }
 }
Esempio n. 2
0
 internal void AddArena(Arena a)
 {
     Query("INSERT INTO CWArenas (Name, HomeX, HomeY, RedSpawnX, RedSpawnY, BlueSpawnX, BlueSpawnY, ArenaTopLeftX, ArenaTopLeftY, ArenaBottomRightX, ArenaBottomRightY, " +
           "RedBunkerTileID, BlueBunkerTileID, RedBunkerWallID, BlueBunkerWallID, RedBunkerPaintID, BlueBunkerPaintID, Stats, Scripts) " +
           "VALUES (@1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18)",
           a.Name, a.Home.X, a.Home.Y, a.RedSpawn.X, a.RedSpawn.Y, a.BlueSpawn.X, a.BlueSpawn.Y, a.TopLeft.X, a.TopLeft.Y, a.BottomRight.X, a.BottomRight.Y, a.Red.ID,
           a.Blue.ID, a.Red.Wall, a.Blue.Wall, a.Red.Paint, a.Blue.Paint, ArenaStat.Blob(a.Stats), Script.Blob(a.Scripts));
 }
Esempio n. 3
0
 internal void UpdateArena(Arena a)
 {
     Query("UPDATE CWArenas SET HomeX = @0, HomeY = @1, RedSpawnX = @2, RedSpawnY = @3, BlueSpawnX = @4, BlueSpawnY = @5, ArenaTopLeftX = @6, " +
           "ArenaTopLeftY = @7, ArenaBottomRightX = @8, ArenaBottomRightY = @9, RedBunkerTileID = @10, BlueBunkerTileID = @11, RedBunkerWallID = @12, " +
           "BlueBunkerWallID = @13, RedBunkerPaintID = @14, BlueBunkerPaintID = @15, Stats = @16, Scripts = @17 WHERE Name = @18"
           , a.Home.X, a.Home.Y, a.RedSpawn.X, a.RedSpawn.Y, a.BlueSpawn.X, a.BlueSpawn.Y, a.TopLeft.X, a.TopLeft.Y, a.BottomRight.X, a.BottomRight.Y, a.Red.ID,
           a.Blue.ID, a.Red.Wall, a.Blue.Wall, a.Red.Paint, a.Blue.Paint, ArenaStat.Blob(a.Stats), Script.Blob(a.Scripts), a.Name);
 }
Esempio n. 4
0
 internal Arena(string name, int homeX, int homeY, int redSpawnX, int redSpawnY, int blueSpawnX, int blueSpawnY, int topLeftX, int topLeftY, int bottomRightX, int bottomRightY, int redID, int redWall, int redPaint, int blueID, int blueWall, int bluePaint, string stats, string scriptBlob)
 {
     Name        = name;
     Home        = new TileLocation(homeX, homeY);
     RedSpawn    = new TileLocation(redSpawnX, redSpawnY);
     BlueSpawn   = new TileLocation(blueSpawnX, blueSpawnY);
     TopLeft     = new TileLocation(topLeftX, topLeftY);
     BottomRight = new TileLocation(bottomRightX, bottomRightY);
     Red         = new BunkerTile(redID, redWall, redPaint);
     Blue        = new BunkerTile(blueID, blueWall, bluePaint);
     Stats       = ArenaStat.DeBlob(stats);
     Scripts     = Script.DeBlob(scriptBlob);
 }
Esempio n. 5
0
        internal static ArenaStat DeBlob(string blob)
        {
            ArenaStat results = new ArenaStat();

            string[] b = blob.Split('◙');
            try
            {
                results = new ArenaStat(int.Parse(b[0]), int.Parse(b[1]), int.Parse(b[2]), int.Parse(b[3]), int.Parse(b[4]));
            }
            catch
            {
                Console.WriteLine("Warning: Error loading ArenaStat with BlueWins " + b[0] + " RedWins " + b[1] + " GameLength " + b[2] + " mapKills " + b[3] + " totalDeaths " + b[3]);
                Console.WriteLine("Skipping invalid ArenaStat and continuing");
            }
            return(results);
        }
Esempio n. 6
0
        internal static string Blob(ArenaStat preblob)
        {
            string blob = (preblob.BlueWins + "◙" + preblob.RedWins + "◙" + preblob.GameLength + "◙" + preblob.MapKills + "◙" + preblob.TotalDeaths);

            return(blob);
        }