Beispiel #1
0
        /// <summary>
        /// 精灵回收处理
        /// </summary>
        public static TCPProcessCmdResults SaleDamonsProcess(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 = Global.GetGoodsByDbID(client, goodsDbID);
                if (null != goodsData && goodsData.Site == 0 && 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;
                        }
                    }

                    nTotalMoHe += (int)PetSkillManager.DelGoodsReturnLingJing(goodsData);
                }
            }

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

            return(TCPProcessCmdResults.RESULT_OK);
        }
Beispiel #2
0
        public static TCPProcessCmdResults SaleDamonsProcess(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 = Global.GetGoodsByDbID(client, goodsDbID);
                if (goodsData != null && goodsData.Site == 0 && 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;
                                        }
                                    }
                                }
                                nTotalMoHe += (int)PetSkillManager.DelGoodsReturnLingJing(goodsData);
                            }
                        }
                    }
                }
IL_20D:
                i++;
                continue;
                goto IL_20D;
            }
            if (nTotalMoHe > 0)
            {
                GameManager.ClientMgr.ModifyMUMoHeValue(client, nTotalMoHe, "一键出售或者回收", true, true, false);
            }
            return(TCPProcessCmdResults.RESULT_OK);
        }