public override bool GiveAward(GameClient client, int _params) { IPointsExchgData ipointsExchgData; bool result; if (!this.AwardItemDict.TryGetValue(_params, out ipointsExchgData)) { result = false; } else { int retInputPoints = 0; if (ipointsExchgData.MinAwardCondionValue > 0) { int InputPointsCost = -ipointsExchgData.MinAwardCondionValue; string strcmd = string.Format("{0}:{1}:{2}:{3}", new object[] { client.ClientData.RoleID, InputPointsCost, this.FromDate.Replace(':', '$'), this.ToDate.Replace(':', '$') }); string[] fields = Global.ExecuteDBCmd(13151, strcmd, client.ServerId); if (fields == null || fields.Length < 2) { return(false); } retInputPoints = Convert.ToInt32(fields[1]); if (retInputPoints < 0) { return(false); } } this.ModifyIPointsLeftMergeNum(client, _params, 1); base.GiveAward(client, ipointsExchgData); this.NotifyInputPointsInfo(client, true); client._IconStateMgr.CheckJieRiActivity(client, false); client._IconStateMgr.SendIconStateToClient(client); string castResList = EventLogManager.NewResPropString(ResLogType.InputPoints, new object[] { -ipointsExchgData.MinAwardCondionValue, retInputPoints + ipointsExchgData.MinAwardCondionValue, retInputPoints }); string strResList = EventLogManager.MakeGoodsDataPropString(ipointsExchgData.GoodsDataList); EventLogManager.AddPurchaseEvent(client, 6, _params, castResList, strResList); result = true; } 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); }