Exemple #1
0
        public static void AddOldPaiZhuDamonGoodsData(GameClient client)
        {
            if (null != client.ClientData.GoodsDataList)
            {
                List <GoodsData> listDamon = new List <GoodsData>();
                int i = 0;
                while (i < client.ClientData.GoodsDataList.Count)
                {
                    int nCategories = Global.GetGoodsCatetoriy(client.ClientData.GoodsDataList[i].GoodsID);
                    if (nCategories >= 9 && nCategories <= 10)
                    {
                        if (client.ClientData.GoodsDataList[i].Using > 0 && client.ClientData.GoodsDataList[i].Site == 0)
                        {
                            int      nBagIndex = JingLingYaoSaiManager.GetIdleSlotOfPaiZhuDamonGoods(client);
                            string[] dbFields  = null;
                            string   strcmd    = Global.FormatUpdateDBGoodsStr(new object[]
                            {
                                client.ClientData.RoleID,
                                client.ClientData.GoodsDataList[i].Id,
                                client.ClientData.GoodsDataList[i].Using,
                                "*",
                                "*",
                                "*",
                                10000,
                                "*",
                                "*",
                                client.ClientData.GoodsDataList[i].GCount,
                                "*",
                                nBagIndex,
                                "*",
                                "*",
                                "*",
                                "*",
                                "*",
                                "*",
                                "*",
                                "*",
                                "*",
                                "*",
                                "*"
                            });
                            TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(TCPClientPool.getInstance(), TCPOutPacketPool.getInstance(), 10006, strcmd, out dbFields, client.ServerId);
                            if (dbRequestResult != TCPProcessCmdResults.RESULT_FAILED)
                            {
                                if (dbFields.Length > 0 && Convert.ToInt32(dbFields[1]) >= 0)
                                {
                                    JingLingYaoSaiManager.AddPaiZhuDamonGoodsData(client, client.ClientData.GoodsDataList[i], false);
                                    client.ClientData.GoodsDataList[i].Site     = 10000;
                                    client.ClientData.GoodsDataList[i].BagIndex = nBagIndex;
                                    listDamon.Add(client.ClientData.GoodsDataList[i]);
                                }
                            }
                        }
                    }
IL_2AC:
                    i++;
                    continue;
                    goto IL_2AC;
                }
                for (i = 0; i < listDamon.Count; i++)
                {
                    Global.RemoveGoodsData(client, listDamon[i]);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 兼容老版本的宠物
        /// </summary>
        /// <param name="goodsData"></param>
        public static void AddOldDamonGoodsData(GameClient client)
        {
            if (null == client.ClientData.GoodsDataList)
            {
                return;
            }

            List <GoodsData> listDamon = new List <GoodsData>();

            // 把在装备栏也在背包中的精灵添加到精灵栏
            for (int i = 0; i < client.ClientData.GoodsDataList.Count; i++)
            {
                int nCategories = Global.GetGoodsCatetoriy(client.ClientData.GoodsDataList[i].GoodsID);
                if (nCategories >= (int)ItemCategories.ShouHuChong && nCategories <= (int)ItemCategories.ChongWu)
                {
                    if (client.ClientData.GoodsDataList[i].Using > 0 && client.ClientData.GoodsDataList[i].Site == 0)
                    {
                        int                  nBagIndex       = Global.GetIdleSlotOfDamonGoods(client);
                        string[]             dbFields        = null;
                        String               strcmd          = Global.FormatUpdateDBGoodsStr(client.ClientData.RoleID, client.ClientData.GoodsDataList[i].Id, client.ClientData.GoodsDataList[i].Using, "*", "*", "*", (int)SaleGoodsConsts.UsingDemonGoodsID, "*", "*", client.ClientData.GoodsDataList[i].GCount, "*", nBagIndex, "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*"); // 卓越信息 [12/13/2013 LiaoWei] 装备转生
                        TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(TCPClientPool.getInstance(), TCPOutPacketPool.getInstance(), (int)TCPGameServerCmds.CMD_DB_UPDATEGOODS_CMD, strcmd, out dbFields, client.ServerId);
                        if (dbRequestResult == TCPProcessCmdResults.RESULT_FAILED)
                        {
                            continue;
                        }

                        if (dbFields.Length <= 0 || Convert.ToInt32(dbFields[1]) < 0)
                        {
                            continue;
                        }

                        AddDamonGoodsData(client, client.ClientData.GoodsDataList[i], false);
                        client.ClientData.GoodsDataList[i].Site     = (int)SaleGoodsConsts.UsingDemonGoodsID;
                        client.ClientData.GoodsDataList[i].BagIndex = nBagIndex;
                        listDamon.Add(client.ClientData.GoodsDataList[i]);
                    }
                }
            }

            // 添加到精灵栏的精灵从背包中移除
            for (int i = 0; i < listDamon.Count; i++)
            {
                Global.RemoveGoodsData(client, listDamon[i]);
            }

            JingLingQiYuanManager.getInstance().RefreshProps(client);
        }