Exemplo n.º 1
0
 public bool InsertItem(string username, int weizi, int itemid)
 {
     try
     {
         string server   = "d1";
         string name     = username;
         int    num      = weizi;
         long   num2     = 0L;
         int    num3     = itemid;
         int    num4     = 0;
         int    num5     = 0;
         int    num6     = 0;
         int    num7     = 0;
         int    num8     = 0;
         int    num9     = 0;
         int    num10    = 0;
         int    num11    = 0;
         int    num12    = 1;
         bool   flag     = false;
         string sm       = "550088081";
         string selectDb = "0";
         string str5     = "TBL_XWWL_Char";
         string str6     = "FLD_ITEM,FLD_ID,FLD_JOB,FLD_ZX";
         string str7     = "FLD_ITEM";
         string str8     = "FLD_NAME";
         if (selectDb == "0")
         {
             str5 = "TBL_XWWL_Char";
             str6 = "FLD_ITEM,FLD_ID,FLD_JOB,FLD_ZX";
             str7 = "FLD_ITEM";
             str8 = "FLD_NAME";
         }
         else if (selectDb == "1")
         {
             str5 = "TBL_XWWL_Char";
             str6 = "FLD_WEARITEM,FLD_ID,FLD_JOB,FLD_ZX";
             str7 = "FLD_WEARITEM";
             str8 = "FLD_NAME";
         }
         else if (selectDb == "2")
         {
             str5 = "TBL_XWWL_Warehouse";
             str6 = "FLD_ITEM,FLD_ID";
             str7 = "FLD_ITEM";
             str8 = "FLD_NAME";
         }
         else if (selectDb == "3")
         {
             str5 = "TBL_XWWL_PublicWarehouse";
             str6 = "FLD_ITEM,FLD_ID";
             str7 = "FLD_ITEM";
             str8 = "FLD_ID";
         }
         DataTable table = DBA.GetDBToDataTable(string.Format("select {3} from {2} WHERE {1} ='{0}'", new object[] { name, str8, str5, str6 }), "rxjhgame", server);
         if (table == null)
         {
             return(false);
         }
         if (table.Rows.Count == 0)
         {
             table.Dispose();
             throw new ArgumentException("提示:错误没有这个人物!");
         }
         物品类 物品类 = new 物品类(new byte[37]);
         if (num2 != 0)
         {
             sm = "更新物品 " + sm;
         }
         else
         {
             num2 = long.Parse(DBA.GetDBValue_3("EXEC XWWL_GetItemSerial 1", "rxjhgame", server).ToString());
         }
         物品类.物品全局ID     = BitConverter.GetBytes(num2);
         物品类.物品ID       = BitConverter.GetBytes(num3);
         物品类.物品数量       = BitConverter.GetBytes(num12);
         物品类.FLD_MAGIC0 = num4;
         物品类.FLD_MAGIC1 = num5;
         物品类.FLD_MAGIC2 = num6;
         物品类.FLD_MAGIC3 = num7;
         物品类.FLD_MAGIC4 = num8;
         //物品类.FLD_FJ_初级附魂 = num9;
         //物品类.FLD_FJ_中级附魂 = num10;
         //物品类.FLD_FJ_进化 = num11;
         物品类.物品绑定 = flag;
         byte[] dst = (byte[])table.Rows[0][str7];
         AdminClass.SetItmeLog(BitConverter.ToInt64(物品类.物品全局ID, 0), 物品类.物品名称, name, string.Concat(new object[] { num4, "_", num5, "_", num6, "_", num7, "_", num8, " 初", num9, " 中", num10, " 进", num11 }), server, sm);
         Buffer.BlockCopy(物品类.物品_byte, 0, dst, num * 37, 37);
         AdminClass.UpItemsDate(server, name, dst, selectDb);
         ItmeSClass itmeSC = new ItmeSClass {
             FLD_ID   = table.Rows[0]["FLD_ID"].ToString(),
             FLD_Name = name
         };
         if ((selectDb != "2") && (selectDb != "3"))
         {
             itmeSC.FLD_JOB = table.Rows[0]["FLD_JOB"].ToString();
             itmeSC.FLD_ZX  = table.Rows[0]["FLD_ZX"].ToString();
         }
         DataTable table2 = DBA.GetDBToDataTable(string.Format("select FLD_ID,FLD_ONLINE,FLD_SEX from [TBL_ACCOUNT] where FLD_ID='{0}'", itmeSC.FLD_ID)
                                                 , "rxjhaccount", server);
         itmeSC.FLD_ONLINE = table2.Rows[0]["FLD_ONLINE"].ToString();
         itmeSC.FLD_SEX    = table2.Rows[0]["FLD_SEX"].ToString();
         table2.Dispose();
         AdminClass.GetItemslist(itmeSC, dst, 0x24);
         table.Dispose();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }