Exemple #1
0
        /// <summary>
        /// 仓库里的精灵回收处理
        /// </summary>
        public static TCPProcessCmdResults SaleStoreDamonsProcess(GameClient client, int nRoleID, String strGoodsID)
        {
            int nTotalMoHe = 0;

            //int totalExp = 0;

            string[] idsList = strGoodsID.Split(',');
            for (int i = 0; i < idsList.Length; i++)
            {
                int       goodsDbID = Global.SafeConvertToInt32(idsList[i]);
                GoodsData goodsData = CallPetManager.GetPetByDbID(client, goodsDbID);
                if (null != goodsData && goodsData.Site == (int)SaleGoodsConsts.PetBagGoodsID && goodsData.Using <= 0) //必须在仓库中
                {
                    int category = Global.GetGoodsCatetoriy(goodsData.GoodsID);

                    //判断是否装备,装备才能分解
                    if (category < (int)ItemCategories.ShouHuChong || category > (int)ItemCategories.ChongWu)
                    {
                        continue;
                    }

                    SystemXmlItem xmlItem = null;
                    if (!GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out xmlItem) || null == xmlItem)
                    {
                        continue;
                    }

                    string modGoodsCmd = String.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}", client.ClientData.RoleID, (int)ModGoodsTypes.Destroy,
                                                       goodsData.Id, goodsData.GoodsID, 0, goodsData.Site, goodsData.GCount, goodsData.BagIndex, "");
                    if (TCPProcessCmdResults.RESULT_OK != Global.ModifyGoodsByCmdParams(client, modGoodsCmd))
                    {
                        continue;
                    }

                    // 精灵回收魔核=精灵等级所需魔核和+基础魔核
                    int nMoHePrice = xmlItem.GetIntValue("ZhanHunPrice");
                    if (nMoHePrice > 0)
                    {
                        nTotalMoHe += nMoHePrice;
                    }

                    for (int j = 0; j < goodsData.Forge_level; j++)
                    {
                        SystemXmlItem xmlItems = null;
                        GameManager.SystemDamonUpgrade.SystemXmlItemDict.TryGetValue(j + 2, out xmlItems);
                        if (null == xmlItems)
                        {
                            continue;
                        }

                        int nReqMoHe = xmlItems.GetIntValue("NeedEXP");
                        if (nReqMoHe > 0)
                        {
                            nTotalMoHe += nReqMoHe;
                        }
                    }
                }
            }

            // 增加天地精元 必须设置通知客户端
            if (nTotalMoHe > 0)
            {
                GameManager.ClientMgr.ModifyMUMoHeValue(client, nTotalMoHe, "一键出售或者回收", true, true);
            }

            return(TCPProcessCmdResults.RESULT_OK);
        }
Exemple #2
0
        public static TCPProcessCmdResults SaleStoreDamonsProcess(GameClient client, int nRoleID, string strGoodsID)
        {
            int nTotalMoHe = 0;

            string[] idsList = strGoodsID.Split(new char[]
            {
                ','
            });
            int i = 0;

            while (i < idsList.Length)
            {
                int       goodsDbID = Global.SafeConvertToInt32(idsList[i]);
                GoodsData goodsData = CallPetManager.GetPetByDbID(client, goodsDbID);
                if (goodsData != null && goodsData.Site == 4000 && goodsData.Using <= 0)
                {
                    int category = Global.GetGoodsCatetoriy(goodsData.GoodsID);
                    if (category >= 9 && category <= 10)
                    {
                        SystemXmlItem xmlItem = null;
                        if (GameManager.SystemGoods.SystemXmlItemDict.TryGetValue(goodsData.GoodsID, out xmlItem) && null != xmlItem)
                        {
                            string modGoodsCmd = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}", new object[]
                            {
                                client.ClientData.RoleID,
                                4,
                                goodsData.Id,
                                goodsData.GoodsID,
                                0,
                                goodsData.Site,
                                goodsData.GCount,
                                goodsData.BagIndex,
                                ""
                            });
                            if (TCPProcessCmdResults.RESULT_OK == Global.ModifyGoodsByCmdParams(client, modGoodsCmd, "客户端修改", null))
                            {
                                int nMoHePrice = xmlItem.GetIntValue("ZhanHunPrice", -1);
                                if (nMoHePrice > 0)
                                {
                                    nTotalMoHe += nMoHePrice;
                                }
                                for (int j = 0; j < goodsData.Forge_level; j++)
                                {
                                    SystemXmlItem xmlItems = null;
                                    GameManager.SystemDamonUpgrade.SystemXmlItemDict.TryGetValue(j + 2, out xmlItems);
                                    if (null != xmlItems)
                                    {
                                        int nReqMoHe = xmlItems.GetIntValue("NeedEXP", -1);
                                        if (nReqMoHe > 0)
                                        {
                                            nTotalMoHe += nReqMoHe;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
IL_207:
                i++;
                continue;
                goto IL_207;
            }
            if (nTotalMoHe > 0)
            {
                GameManager.ClientMgr.ModifyMUMoHeValue(client, nTotalMoHe, "一键出售或者回收", true, true, false);
            }
            return(TCPProcessCmdResults.RESULT_OK);
        }