public static ZhuLingZhuHunError ReqZhuHun(GameClient client) { int oldLevel = client.ClientData.MyWingData.ZhuHunNum; int oldYinLiang = client.ClientData.YinLiang; int oldMoney = client.ClientData.Money1; ZhuLingZhuHunError result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun, false)) { result = ZhuLingZhuHunError.ZhuHunNotOpen; } else { ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); if (i == null) { result = ZhuLingZhuHunError.ErrorConfig; } else if (client.ClientData.MyWingData.ZhuHunNum >= i.ZhuHunLimit) { result = ZhuLingZhuHunError.ZhuHunFull; } else if (Global.GetTotalGoodsCountByID(client, ZhuLingZhuHunManager.ZhuHunCostGoodsID) < ZhuLingZhuHunManager.ZhuHunCostGoodsNum) { result = ZhuLingZhuHunError.ZhuHunMaterialNotEnough; } else if (Global.GetTotalBindTongQianAndTongQianVal(client) < ZhuLingZhuHunManager.ZhuHunCostJinBi) { result = ZhuLingZhuHunError.ZhuHunJinBiNotEnough; } else if (!Global.SubBindTongQianAndTongQian(client, ZhuLingZhuHunManager.ZhuHunCostJinBi, "注魂消耗")) { result = ZhuLingZhuHunError.DBSERVERERROR; } else { string strCostList = EventLogManager.NewResPropString(ResLogType.SubJinbi, new object[] { -ZhuLingZhuHunManager.ZhuHunCostJinBi, oldYinLiang, client.ClientData.YinLiang, oldMoney, client.ClientData.Money1 }); bool bUsedBinding = true; bool bUsedTimeLimited = false; if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ZhuLingZhuHunManager.ZhuHunCostGoodsID, ZhuLingZhuHunManager.ZhuHunCostGoodsNum, false, out bUsedBinding, out bUsedTimeLimited, false)) { result = ZhuLingZhuHunError.DBSERVERERROR; } else { GoodsData goodsDataCost = new GoodsData { GoodsID = ZhuLingZhuHunManager.ZhuHunCostGoodsID, GCount = ZhuLingZhuHunManager.ZhuHunCostGoodsNum }; strCostList += EventLogManager.AddGoodsDataPropString(goodsDataCost); int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.JinJieFailedNum, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum + 1); if (iRet < 0) { result = ZhuLingZhuHunError.DBSERVERERROR; } else { client.ClientData.MyWingData.ZhuHunNum++; ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7); EventLogManager.AddWingZhuHunEvent(client, oldLevel, client.ClientData.MyWingData.ZhuHunNum, strCostList); if (client._IconStateMgr.CheckReborn(client)) { client._IconStateMgr.SendIconStateToClient(client); } result = ZhuLingZhuHunError.Success; } } } } return(result); }
public string MergeGoods(GameClient client, int index) { string strcmd = string.Format("{0}:{1}:{2}", 0, client.ClientData.RoleID, 154); string result; if (this.GetThemeDHTodayLeftMergeNum(client, index) <= 0) { strcmd = string.Format("{0}:{1}:{2}", -20000, client.ClientData.RoleID, 154); result = strcmd; } else { ThemeDuiHuan config = this.GetAwardConfig(index); if (null == config) { strcmd = string.Format("{0}:{1}:{2}", -20001, client.ClientData.RoleID, 154); result = strcmd; } else if (null == config.MyAwardItem) { strcmd = string.Format("{0}:{1}:{2}", -20001, client.ClientData.RoleID, 154); result = strcmd; } else if (null == config.MyAwardItem.GoodsDataList) { strcmd = string.Format("{0}:{1}:{2}", -20001, client.ClientData.RoleID, 154); result = strcmd; } else { if (null != config.NeedGoodsList) { for (int i = 0; i < config.NeedGoodsList.Count; i++) { if (Global.GetTotalGoodsNotUsingCountByID(client, config.NeedGoodsList[i].GoodsID) < config.NeedGoodsList[i].GCount) { return(string.Format("{0}:{1}:{2}", -20003, client.ClientData.RoleID, 154)); } } } string castResList = ""; if (null != config.NeedGoodsList) { for (int i = 0; i < config.NeedGoodsList.Count; i++) { bool usedBinding = false; bool usedTimeLimited = false; if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, config.NeedGoodsList[i].GoodsID, config.NeedGoodsList[i].GCount, false, out usedBinding, out usedTimeLimited, true)) { return(string.Format("{0}:{1}:{2}", -20004, client.ClientData.RoleID, 154)); } castResList += EventLogManager.AddGoodsDataPropString(config.NeedGoodsList[i]); } } if (!this.GiveAward(client, index)) { strcmd = string.Format("{0}:{1}:{2}", -20005, client.ClientData.RoleID, 154); result = strcmd; } else { if (castResList.Length > 0) { castResList = castResList.Remove(0, 1); } string strResList = EventLogManager.MakeGoodsDataPropString(config.MyAwardItem.GoodsDataList); EventLogManager.AddPurchaseEvent(client, 8, index, castResList, strResList); int leftNum = Math.Max(0, config.DayMaxTimes - this.ModifyThemeTodayLeftMergeNum(client, index, 1)); strcmd = string.Format("{0}:{1}:{2}:{3}:{4}", new object[] { 1, client.ClientData.RoleID, 154, leftNum, index }); result = strcmd; } } } return(result); }