コード例 #1
0
ファイル: characterDB.cs プロジェクト: C0d1ng-L0s3r/ajaxmmo
        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;
            }
        }
コード例 #2
0
        private int GetLoginID(string username)
        {
            MMO.db db1 = new db();

            /* if not exist, create and then return id */
            db1.SetCommand("s_LoginIDGet", CommandType.StoredProcedure);
            db1.AddParam <string>("Login", SqlDbType.NVarChar, 50, username);

            return(Int32.Parse(db1.RunScalar().ToString()));
        }
コード例 #3
0
ファイル: TileDB.cs プロジェクト: C0d1ng-L0s3r/ajaxmmo
        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;
            }
        }
コード例 #4
0
ファイル: TileDB.cs プロジェクト: joelldj/ajaxmmo
        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;
            }
        }
コード例 #5
0
ファイル: characterDB.cs プロジェクト: joelldj/ajaxmmo
        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;
            }
        }