Example #1
0
        public void Save(object o)
        {
            db        db1 = new db();
            character t   = (character)o;

            if (t.IsDirty)
            {
                // save dirt to database
                db1 = new MMO.db();
                db1.SetCommand("s_SaveCharacter", CommandType.StoredProcedure);
                db1.AddParam <int>("id", SqlDbType.Int, 4, t.id);
                db1.AddParam <int>("login", SqlDbType.Int, 4, owner.loginID);
                db1.AddParam <string>("charactername", SqlDbType.VarChar, 50, t.name);
                db1.AddParam <int>("charactertype", SqlDbType.Int, 4, 0);
                db1.AddParam <int>("hp", SqlDbType.Int, 4, t.hp);
                db1.AddParam <int>("stamina", SqlDbType.Int, 4, t.stamina);
                db1.AddParam <int>("mana", SqlDbType.Int, 4, t.mana);
                db1.AddParam <int>("x", SqlDbType.Int, 4, t.x);
                db1.AddParam <int>("y", SqlDbType.Int, 4, t.y);

                // return value of runscalar is the new or old id of tile
                t.id = Int32.Parse(db1.RunScalar().ToString());

                // no dirt to save
                t.IsDirty = false;
            }
        }
Example #2
0
        public void Save(object o)
        {
            db db1 = new db();
            character t = (character)o;

            if (t.IsDirty)
            {
                // save dirt to database
                db1 = new MMO.db();
                db1.SetCommand("s_SaveCharacter", CommandType.StoredProcedure);
                db1.AddParam<int>("id", SqlDbType.Int, 4, t.id);
                db1.AddParam<int>("login", SqlDbType.Int, 4, owner.loginID);
                db1.AddParam<string>("charactername", SqlDbType.VarChar, 50, t.name);
                db1.AddParam<int>("charactertype", SqlDbType.Int, 4, 0);
                db1.AddParam<int>("hp", SqlDbType.Int, 4, t.hp);
                db1.AddParam<int>("stamina", SqlDbType.Int, 4, t.stamina);
                db1.AddParam<int>("mana", SqlDbType.Int, 4, t.mana);
                db1.AddParam<int>("x", SqlDbType.Int, 4, t.x);
                db1.AddParam<int>("y", SqlDbType.Int, 4, t.y);

                // return value of runscalar is the new or old id of tile
                t.id = Int32.Parse(db1.RunScalar().ToString());

                // no dirt to save
                t.IsDirty = false;
            }
        }
Example #3
0
        public TileDB(int characterid) /* Constructor for Tiles around usernames character */
        {
            db1   = new MMO.db();
            Tiles = new List <MMO.Tile>();

            db1.SetCommand("s_TilesGet", CommandType.StoredProcedure);
            db1.AddParam <int>("characterid", SqlDbType.Int, 4, characterid);

            db1.Read();

            // access the datareader within the class
            while (db1.dr.Read())
            {
                AddTile(Int32.Parse(db1.dr["id"].ToString()),
                        Int32.Parse(db1.dr["x"].ToString()),
                        Int32.Parse(db1.dr["y"].ToString()),
                        Int32.Parse(db1.dr["tile_type_id"].ToString())
                        );
            }
        }
Example #4
0
        public void Save(object o)
        {
            Tile t = (Tile)o;

            if (t.IsDirty)
            {
                // save dirt to database
                db1 = new MMO.db();
                db1.SetCommand("s_SaveTile", CommandType.StoredProcedure);
                db1.AddParam <int>("id", SqlDbType.Int, 4, t.Id);
                db1.AddParam <int>("x", SqlDbType.Int, 4, t.X);
                db1.AddParam <int>("y", SqlDbType.Int, 4, t.Y);
                db1.AddParam <int>("tile_type_id", SqlDbType.Int, 4, t.Tile_Type_Id);

                // return value of runscalar is the new or old id of tile
                t.Id = Int32.Parse(db1.RunScalar().ToString());

                // no dirt to save
                t.IsDirty = false;
            }
        }
Example #5
0
        public TileDB(int characterid) /* Constructor for Tiles around usernames character */
        {
            db1 = new MMO.db();
            Tiles = new List<MMO.Tile>();

            db1.SetCommand("s_TilesGet", CommandType.StoredProcedure);
            db1.AddParam<int>("characterid", SqlDbType.Int, 4, characterid);

            db1.Read();

            // access the datareader within the class
            while (db1.dr.Read())
            {
                AddTile(Int32.Parse(db1.dr["id"].ToString()),
                    Int32.Parse(db1.dr["x"].ToString()),
                    Int32.Parse(db1.dr["y"].ToString()),
                    Int32.Parse(db1.dr["tile_type_id"].ToString())
                );

            }
        }
Example #6
0
        public void Save(object o)
        {
            Tile t = (Tile)o;

            if (t.IsDirty)
            {

                // save dirt to database
                db1 = new MMO.db();
                db1.SetCommand("s_SaveTile", CommandType.StoredProcedure);
                db1.AddParam<int>("id", SqlDbType.Int, 4, t.Id);
                db1.AddParam<int>("x", SqlDbType.Int, 4, t.X);
                db1.AddParam<int>("y", SqlDbType.Int, 4, t.Y);
                db1.AddParam<int>("tile_type_id", SqlDbType.Int, 4, t.Tile_Type_Id);

                // return value of runscalar is the new or old id of tile
                t.Id = Int32.Parse(db1.RunScalar().ToString());

                // no dirt to save
                t.IsDirty = false;
            }
        }
Example #7
0
 public TileDB()
 {
     Tiles = new List <MMO.Tile>();
     db1   = new MMO.db();
 } /* Contructor for Blank data */
Example #8
0
 public TileDB() { 
     Tiles = new List<MMO.Tile>();
     db1 = new MMO.db();
 
 } /* Contructor for Blank data */