public void HandleClientChargeItem(GameClient client, byte HandleDel = 0) { if (client != null && !GameManager.IsKuaFuServer) { lock (client.ClientData.ChargeItemMutex) { List <TempItemChargeInfo> list = new List <TempItemChargeInfo>(); string cmd = string.Format("{0}:{1}:{2}", client.strUserID, client.ClientData.RoleID, HandleDel); list = Global.sendToDB <List <TempItemChargeInfo>, string>(13320, cmd, client.ServerId); if (list != null && list.Count != 0) { if (HandleDel == 1) { this.ComputeClientChargeItem(client, list); } Dictionary <int, ChargeItemData> ChargeItemDict = Data.ChargeItemDict; for (int i = 0; i < list.Count; i++) { TempItemChargeInfo tempitem = list[i]; if (tempitem.isDel == 0) { int ProcessChargeMoney = 0; int ReturnUserMoney = 0; ChargeItemData configdata = null; if (!ChargeItemDict.TryGetValue(tempitem.zhigouID, out configdata)) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购zhigouID错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else if (string.Compare(tempitem.chargeTime, configdata.FromDate) < 0 || string.Compare(tempitem.chargeTime, configdata.ToDate) > 0) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Time错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else { int Money = 0; if (!Data.ChargeData.ChargeIDVsMoneyDict.TryGetValue(configdata.ChargeDangID, out Money)) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Dang错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else { int ZhiGouImplicit = GameManager.PlatConfigMgr.GetGameConfigItemInt("zhigou_implicit", 0); if (ZhiGouImplicit > 0) { if (tempitem.addUserMoney < Money) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Money错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else { ReturnUserMoney = Math.Max(tempitem.addUserMoney - Money, 0); } } else if (tempitem.addUserMoney != Money) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Money错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } } } int PurchaseNum = this.GetChargeItemPurchaseNum(client, tempitem.zhigouID); int DayPurchaseNum = this.GetChargeItemDayPurchaseNum(client, tempitem.zhigouID); if (configdata != null && configdata.SinglePurchase > 0 && PurchaseNum >= configdata.SinglePurchase) { ProcessChargeMoney = 1; } if (configdata != null && configdata.DayPurchase > 0) { EverydayActivity everyAct = HuodongCachingMgr.GetEverydayActivity(); if (everyAct == null || !everyAct.CheckValidChargeItem(tempitem.zhigouID)) { ProcessChargeMoney = 1; } if (DayPurchaseNum >= configdata.DayPurchase) { ProcessChargeMoney = 1; } } if (configdata != null && configdata.ThemePurchase > 0) { ThemeZhiGouActivity zhigouAct = HuodongCachingMgr.GetThemeZhiGouActivity(); if (zhigouAct == null || !zhigouAct.CheckValidChargeItem(tempitem.zhigouID)) { ProcessChargeMoney = 1; } if (DayPurchaseNum >= configdata.ThemePurchase) { ProcessChargeMoney = 1; } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (spAct != null && !spAct.CheckValidChargeItem(tempitem.zhigouID)) { ProcessChargeMoney = 1; } RegressActiveDayBuy radbAct = HuodongCachingMgr.GetRegressActiveDayBuy(); if (radbAct != null && !radbAct.CheckValidChargeItem(client, tempitem.zhigouID)) { ProcessChargeMoney = 1; } cmd = string.Format("{0}:{1}:{2}", tempitem.ID, ProcessChargeMoney, ReturnUserMoney); string[] dbFields = null; TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 13321, cmd, out dbFields, client.ServerId); if (dbRequestResult != TCPProcessCmdResults.RESULT_FAILED && dbFields.Length > 0) { if (ProcessChargeMoney == 0) { this.AddChargeItemPurchaseNum(client, tempitem.zhigouID); this.AddChargeItemDayPurchaseNum(client, tempitem.zhigouID, tempitem.chargeTime); } if (configdata != null && ProcessChargeMoney == 0) { ChargeItemBaseEventObject evObj_ChargeItem = new ChargeItemBaseEventObject(client, configdata); GlobalEventSource.getInstance().fireEvent(evObj_ChargeItem); } if (ProcessChargeMoney != 1) { if (null != configdata) { List <GoodsData> awardList = new List <GoodsData>(); if (configdata.GoodsDataOne != null) { awardList.AddRange(configdata.GoodsDataOne); } List <GoodsData> proGoods = GoodsHelper.GetAwardPro(client, configdata.GoodsDataTwo); if (proGoods != null) { awardList.AddRange(proGoods); } this.GiveClientChargeItem(client, awardList); this.HandleClientChargeMoney(client.strUserID, client.ClientData.RoleID, tempitem.addUserMoney - ReturnUserMoney, false, 0); } } } } } } } } }
public void HandleClientChargeMoney(string userID, int rid, int addMoney, bool transmit, int superInputFanLi = 0) { JieriIPointsExchgActivity act = HuodongCachingMgr.GetJieriIPointsExchgActivity(); if (null != act) { act.OnMoneyChargeEvent(userID, rid, addMoney); } EverydayActivity everyAct = HuodongCachingMgr.GetEverydayActivity(); if (null != everyAct) { everyAct.OnMoneyChargeEvent(userID, rid, addMoney); } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != everyAct) { spAct.OnMoneyChargeEvent(userID, rid, addMoney); } if (superInputFanLi > 0) { JieriSuperInputActivity siAct = HuodongCachingMgr.GetJieRiSuperInputActivity(); if (null != siAct) { siAct.OnMoneyChargeEvent(userID, rid, addMoney, superInputFanLi); } } TMSKSocket clientSocket = GameManager.OnlineUserSession.FindSocketByUserID(userID); if (null == clientSocket) { SpecialActivity specAct = HuodongCachingMgr.GetSpecialActivity(); if (null != specAct) { specAct.OnMoneyChargeEventOffLine(userID, rid, addMoney); } } else { if (transmit) { LogManager.WriteLog(LogTypes.SQL, string.Format("通知账户ID{0}的角色更新元宝数量", userID), null, true); } GameClient otherClient = GameManager.ClientMgr.FindClient(clientSocket); if (null != otherClient) { SpecialActivity specAct = HuodongCachingMgr.GetSpecialActivity(); if (null != specAct) { specAct.OnMoneyChargeEventOnLine(otherClient, addMoney); } GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, otherClient, 0, "", ActivityTypes.None, ""); GameManager.logDBCmdMgr.AddDBLogInfo(-1, "钻石", "GM命令强迫更新", "系统", otherClient.ClientData.RoleName, "增加", addMoney, otherClient.ClientData.ZoneID, otherClient.strUserID, otherClient.ClientData.UserMoney, otherClient.ServerId, null); otherClient._IconStateMgr.FlushChongZhiIconState(otherClient); otherClient._IconStateMgr.CheckJieRiActivity(otherClient, false); otherClient._IconStateMgr.SendIconStateToClient(otherClient); UserReturnManager.getInstance().initUserReturnData(otherClient); SingletonTemplate <SevenDayActivityMgr> .Instance().OnCharge(otherClient); FundManager.initFundData(otherClient); } else { SpecialActivity specAct = HuodongCachingMgr.GetSpecialActivity(); if (null != specAct) { specAct.OnMoneyChargeEventOffLine(userID, rid, addMoney); } } } }