public bool CheckValidChargeItem(GameClient client, int zhigouID) { bool result; if (!this.ActZhiGouIDSet.Contains(zhigouID)) { result = true; } else { RegressActiveOpen iflAct = HuodongCachingMgr.GetRegressActiveOpen(); if (null == iflAct) { result = false; } else if (!iflAct.InActivityTime()) { result = true; } else if (!iflAct.CanGiveAward()) { result = false; } else { DateTime now = TimeUtil.NowDateTime(); string newtime = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second).ToString("yyyy-MM-dd HH:mm:ss"); int CDate = Global.GetOffsetDay(DateTime.Parse(newtime)) - Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)); string ZeroTime = "2011-11-11 00$00$00"; string GetInfoStr = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, ZeroTime, iflAct.FromDate.Replace(':', '$')); string[] dbResult; if (TCPProcessCmdResults.RESULT_FAILED == Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 14136, GetInfoStr, out dbResult, 0)) { result = false; } else if (dbResult == null || dbResult.Length != 2 || Convert.ToInt32(dbResult[0]) != client.ClientData.RoleID) { result = false; } else { int Money = Convert.ToInt32(dbResult[1]); if (Money < 0) { Money = 0; } string Regtime; if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals("")) { result = false; } else { int ConfID; int CaleLevel = iflAct.GetUserActiveFile(Regtime, out ConfID); if (0 == CaleLevel) { result = false; } else { foreach (RegressActiveDayBuyXML item in this.regressActiveDayBuyXML.Values) { if (item.ZhiGouID == zhigouID) { foreach (KeyValuePair <int, int> it in item.TotalYuanBao) { if (it.Value == -1 && Money < it.Key) { return(false); } if ((it.Value != -1 && Money > it.Value) || Money < it.Key) { return(false); } } if (CDate + 1 != item.Day) { return(false); } return(true); } } result = false; } } } } } return(result); }
public RegressActiveOpcode ProcessRegressAcitveStore(GameClient client, int StoreConfID, int Level, int GoodsID, int Count) { RegressActiveOpen iflAct = HuodongCachingMgr.GetRegressActiveOpen(); RegressActiveOpcode result; string Regtime; if (iflAct == null || !iflAct.InActivityTime()) { result = RegressActiveOpcode.RegressActiveOpenErr; } else if (!iflAct.CanGiveAward()) { result = RegressActiveOpcode.RegressActiveNotIn; } else if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals("")) { result = RegressActiveOpcode.RegressActiveGetRegTime; } else { int ConfID; int CaleLevel = iflAct.GetUserActiveFile(Regtime, out ConfID); if (0 == CaleLevel) { result = RegressActiveOpcode.RegressActiveGetFile; } else if (CaleLevel != Level) { result = RegressActiveOpcode.RegressActiveStoreCheckFail; } else { DateTime nowDateTime = TimeUtil.NowDateTime(); string CurrDate = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, nowDateTime.Hour, nowDateTime.Minute, nowDateTime.Second).ToString("yyyy-MM-dd HH:mm:ss"); int CDate = Global.GetOffsetDay(DateTime.Parse(CurrDate)) - Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)); if (CDate < 0) { result = RegressActiveOpcode.RegressActiveStoreCheckDayFail; } else { RegressActiveStore StoreAct = HuodongCachingMgr.GetRegressActiveStore(); if (null == StoreAct) { result = RegressActiveOpcode.RegressActiveStoreConfErr; } else { string stage = string.Format("{0}_{1}", Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)), Global.GetOffsetDay(DateTime.Parse(iflAct.ToDate))); int needYuanBao; int Sum; GoodsData goodData; if (!StoreAct.RegressStoreGoodsBuyCheck(client, StoreConfID, Level, CDate + 1, GoodsID, Count, stage, out needYuanBao, out Sum, out goodData)) { result = RegressActiveOpcode.RegressActiveStoreBuyFail; } else if (goodData == null) { result = RegressActiveOpcode.RegressActiveStoreCheckGoodFail; } else if (Sum <= 0 || needYuanBao <= 0) { result = RegressActiveOpcode.RegressActiveStoreCheckParmErr; } else { int BagInt; if (!RebornEquip.OneIsCanIntoRebornOrBaseBag(client, goodData, out BagInt)) { if (BagInt == 1) { return(RegressActiveOpcode.RegressActiveSignRebornBagFail); } if (BagInt == 2) { return(RegressActiveOpcode.RegressActiveSignBaseBagFail); } } if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, needYuanBao, "三周年商城购买物品", true, true, false, DaiBiSySType.None)) { result = RegressActiveOpcode.RegressActiveStoreUserYuanBaoFail; } else { string GetInfoStr = string.Format("{0}:{1}:{2}:{3}:{4}", new object[] { client.ClientData.RoleID, StoreConfID, CDate, Sum, stage }); string[] dbResult; if (TCPProcessCmdResults.RESULT_FAILED == Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 14135, GetInfoStr, out dbResult, 0)) { result = RegressActiveOpcode.RegressActiveStoreInsertInfoErr; } else if (dbResult == null || dbResult.Length != 2 || Convert.ToInt32(dbResult[1]) != 0) { result = RegressActiveOpcode.RegressActiveStoreInsertInfoErr; } else { if (Global.GetGoodsRebornEquip(goodData.GoodsID) == 1) { Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodData.GoodsID, Count, goodData.Quality, goodData.Props, goodData.Forge_level, goodData.Binding, 15000, goodData.Jewellist, true, 1, "三周年商城购买", false, "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, false, null, null, "1900-01-01 12:00:00", 0, true); } else { Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodData.GoodsID, Count, goodData.Quality, goodData.Props, goodData.Forge_level, goodData.Binding, 0, goodData.Jewellist, true, 1, "三周年商城购买", false, "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, false, null, null, "1900-01-01 12:00:00", 0, true); } result = RegressActiveOpcode.RegressActiveSucc; } } } } } } } return(result); }
public RegressActiveOpcode ProcessRegressAcitveDayBuy(GameClient client, int Role, int Level, out Dictionary <int, int> ZhiGouDict) { ZhiGouDict = null; RegressActiveOpen iflAct = HuodongCachingMgr.GetRegressActiveOpen(); RegressActiveOpcode result; string Regtime; if (iflAct == null || !iflAct.InActivityTime()) { result = RegressActiveOpcode.RegressActiveOpenErr; } else if (!iflAct.CanGiveAward()) { result = RegressActiveOpcode.RegressActiveNotIn; } else if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals("")) { result = RegressActiveOpcode.RegressActiveGetRegTime; } else { int ConfID; int CaleLevel = iflAct.GetUserActiveFile(Regtime, out ConfID); if (0 == CaleLevel) { result = RegressActiveOpcode.RegressActiveGetFile; } else if (CaleLevel != Level) { result = RegressActiveOpcode.RegressActiveGetFile; } else { Dictionary <int, int> ZhiGouInfoDict = new Dictionary <int, int>(); RegressActiveDayBuy act = HuodongCachingMgr.GetRegressActiveDayBuy(); if (null == act) { result = RegressActiveOpcode.RegressActiveBuyGetInfoErr; } else { ZhiGouInfoDict = act.BuildRegressZhiGouInfoForClient(client); ZhiGouDict = ZhiGouInfoDict; result = RegressActiveOpcode.RegressActiveSucc; } } } return(result); }
public RegressActiveOpcode ProcessRegressAcitveRecharge(GameClient client, int Level, int RechargeConfID) { RegressActiveOpen iflAct = HuodongCachingMgr.GetRegressActiveOpen(); RegressActiveOpcode result; string Regtime; if (iflAct == null || !iflAct.InActivityTime()) { result = RegressActiveOpcode.RegressActiveOpenErr; } else if (!iflAct.CanGiveAward()) { result = RegressActiveOpcode.RegressActiveNotIn; } else if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals("")) { result = RegressActiveOpcode.RegressActiveGetRegTime; } else { int ConfID; int CaleLevel = iflAct.GetUserActiveFile(Regtime, out ConfID); if (0 == CaleLevel) { result = RegressActiveOpcode.RegressActiveGetFile; } else if (CaleLevel != Level) { result = RegressActiveOpcode.RegressActiveGetFile; } else { DateTime nowDateTime = TimeUtil.NowDateTime(); string endtime = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, nowDateTime.Hour, nowDateTime.Minute, nowDateTime.Second).ToString("yyyy-MM-dd HH:mm:ss"); string GetInfoStr = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, iflAct.FromDate.Replace(':', '$'), endtime.Replace(':', '$')); string[] dbResult; if (TCPProcessCmdResults.RESULT_FAILED == Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 14136, GetInfoStr, out dbResult, 0)) { result = RegressActiveOpcode.RegressActiveInputGetInfoErr; } else if (dbResult == null || dbResult.Length != 2 || Convert.ToInt32(dbResult[0]) != client.ClientData.RoleID) { result = RegressActiveOpcode.RegressActiveInputGetInfoErr; } else { int Money = Convert.ToInt32(dbResult[1]); if (Money < 0) { Money = 0; } string stage = string.Format("{0}_{1}", Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)), Global.GetOffsetDay(DateTime.Parse(iflAct.ToDate))); string GetAwardInfoStr = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, 112, stage); string Repair = ""; string[] dbResult2; Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 14137, GetAwardInfoStr, out dbResult2, 0); if (dbResult2 == null || dbResult2.Length != 4 || Convert.ToInt32(dbResult2[0]) != client.ClientData.RoleID) { result = RegressActiveOpcode.RegressActiveInputGetInfoErr; } else { if (!dbResult2[3].Equals("")) { string[] idList = dbResult2[3].Split(new char[] { '_' }); foreach (string it in idList) { if (!it.Equals("") && Convert.ToInt32(it) == RechargeConfID) { return(RegressActiveOpcode.RegressActiveInputHas); } } Repair = this.RepairRegressStoreData(idList); if (!string.IsNullOrEmpty(Repair) && !Repair.Equals(dbResult2[3])) { string SqlStr = string.Format("{0}:{1}:{2}:{3}", new object[] { client.ClientData.RoleID, 112, Repair, stage }); string[] SqlCmd = Global.ExecuteDBCmd(14138, SqlStr, 0); if (SqlCmd == null || SqlCmd.Length != 4) { return(RegressActiveOpcode.RegressActiveUpdateInputInfoErr); } } } RegressActiveTotalRecharge SignAct = HuodongCachingMgr.GetRegressActiveTotalRecharge(); List <GoodsData> goodsList; if (SignAct == null || !SignAct.InActivityTime()) { result = RegressActiveOpcode.RegressActiveInputConfErr; } else if (SignAct.GiveAwardCheck(client, Level, Money, RechargeConfID, out goodsList)) { result = RegressActiveOpcode.RegressActiveInputCheckAwardErr; } else if (goodsList == null) { result = RegressActiveOpcode.RegressActiveInputCheckAwardErr; } else { int BagInt; if (!RebornEquip.MoreIsCanIntoRebornOrBaseBag(client, goodsList, out BagInt)) { if (BagInt == 1) { return(RegressActiveOpcode.RegressActiveSignRebornBagFail); } if (BagInt == 2) { return(RegressActiveOpcode.RegressActiveSignBaseBagFail); } } DateTime FromActDate = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, 0, 0, 0); DateTime ToActDate = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, 23, 59, 59); string beginStr = FromActDate.ToString("yyyy-MM-dd HH:mm:ss").Replace(':', '$'); string endStr = ToActDate.ToString("yyyy-MM-dd HH:mm:ss").Replace(':', '$'); string keyHasStr = string.Format("{0}_{1}", beginStr, endStr); string ativedata = Repair + "_" + RechargeConfID.ToString(); string WriteInfoStr = string.Format("{0}:{1}:{2}:{3}", new object[] { client.ClientData.RoleID, 112, ativedata, stage }); string[] resData = Global.ExecuteDBCmd(14138, WriteInfoStr, 0); if (resData == null || resData.Length != 4) { result = RegressActiveOpcode.RegressActiveUpdateInputInfoErr; } else if (!SignAct.GiveAward(client, goodsList)) { result = RegressActiveOpcode.RegressActiveInputGiveAwardErr; } else { result = RegressActiveOpcode.RegressActiveSucc; } } } } } } return(result); }
public RegressActiveOpcode ProcessRegressAcitveDaySignAward(GameClient client, int Level, int Day) { RegressActiveOpen iflAct = HuodongCachingMgr.GetRegressActiveOpen(); RegressActiveOpcode result; string Regtime; if (iflAct == null || !iflAct.InActivityTime()) { result = RegressActiveOpcode.RegressActiveOpenErr; } else if (!iflAct.CanGiveAward()) { result = RegressActiveOpcode.RegressActiveNotIn; } else if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals("")) { result = RegressActiveOpcode.RegressActiveGetRegTime; } else { int ConfID; int CaleLevel = iflAct.GetUserActiveFile(Regtime, out ConfID); if (0 == CaleLevel) { result = RegressActiveOpcode.RegressActiveGetFile; } else if (CaleLevel != Level) { result = RegressActiveOpcode.RegressActiveSignCheckFail; } else { string stage = string.Format("{0}_{1}", Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)), Global.GetOffsetDay(DateTime.Parse(iflAct.ToDate))); string GetInfoStr = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, 111, stage); Dictionary <string, string> SignInfoStr = Global.sendToDB <Dictionary <string, string>, string>(14132, GetInfoStr, 0); if (SignInfoStr == null) { result = RegressActiveOpcode.RegressActiveSignSelectFail; } else { DateTime nowDateTime = TimeUtil.NowDateTime(); DateTime FromActDate = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, 0, 0, 0); DateTime ToActDate = new DateTime(nowDateTime.Year, nowDateTime.Month, nowDateTime.Day, 23, 59, 59); string SignInfo; Dictionary <int, int> Info = this.ProcessSignInfo(SignInfoStr, Global.GetOffsetDay(nowDateTime), out SignInfo); if (Info == null) { result = RegressActiveOpcode.RegressActiveGetSignInfoErr; } else { Dictionary <int, int> Dict = this.ChangeData(SignInfoStr, Info); int state; if (!Dict.TryGetValue(Day, out state)) { result = RegressActiveOpcode.RegressActiveSignNotDay; } else if (state == 1) { result = RegressActiveOpcode.RegressActiveSignHas; } else { RegressActiveSignGift SignAct = HuodongCachingMgr.GetRegressActiveSignGift(); List <GoodsData> OutGoodsList; int DBDay; if (SignAct == null || !SignAct.InActivityTime()) { result = RegressActiveOpcode.RegressActiveSignConfErr; } else if (!SignAct.GetAwardGoodsList(client, Level, Day, out OutGoodsList, out DBDay)) { result = RegressActiveOpcode.RegressActiveSignGetAwardFail; } else { int BagInt; if (!RebornEquip.MoreIsCanIntoRebornOrBaseBag(client, OutGoodsList, out BagInt)) { if (BagInt == 1) { return(RegressActiveOpcode.RegressActiveSignRebornBagFail); } if (BagInt == 2) { return(RegressActiveOpcode.RegressActiveSignBaseBagFail); } } string beginStr = FromActDate.ToString("yyyy-MM-dd HH:mm:ss").Replace(':', '$'); string endStr = ToActDate.ToString("yyyy-MM-dd HH:mm:ss").Replace(':', '$'); string keyHasStr = string.Format("{0}_{1}", beginStr, endStr); SignInfo = SignInfo + "|" + DBDay.ToString(); string WriteInfoStr = string.Format("{0}:{1}:{2}:{3}", new object[] { client.ClientData.RoleID, 111, SignInfo, stage }); string[] resData = Global.ExecuteDBCmd(14138, WriteInfoStr, 0); if (resData == null || resData.Length != 4) { result = RegressActiveOpcode.RegressActiveSignRecordFail; } else if (!SignAct.GiveAward(client, OutGoodsList)) { result = RegressActiveOpcode.RegressActiveSignGiveAwardFail; } else { result = RegressActiveOpcode.RegressActiveSucc; } } } } } } } return(result); }
public RegressActiveOpcode ProcessGetRegressAcitveFile(GameClient client, out string ToClientRegtime, out int ToClientID, out int ToClientLevel, out int CurrDay, out int ActiveMoney) { ToClientRegtime = ""; ToClientID = 0; ToClientLevel = 0; CurrDay = 0; ActiveMoney = 0; string UserID = client.strUserID; RegressActiveOpcode result; if (UserID == null || UserID.Equals("") || !UserID.Equals(client.strUserID)) { result = RegressActiveOpcode.RegressActiveUserInfoErr; } else { RegressActiveOpen iflAct = HuodongCachingMgr.GetRegressActiveOpen(); string Regtime; if (iflAct == null || !iflAct.InActivityTime()) { result = RegressActiveOpcode.RegressActiveOpenErr; } else if (!iflAct.CanGiveAward()) { result = RegressActiveOpcode.RegressActiveNotIn; } else if (!UserRegressActiveManager.GetRegressMinRegtime(client, out Regtime) || Regtime == null || Regtime.Equals("")) { result = RegressActiveOpcode.RegressActiveGetRegTime; } else { int ConfID; int Level = iflAct.GetUserActiveFile(Regtime, out ConfID); if (0 == Level) { result = RegressActiveOpcode.RegressActiveGetFile; } else { ToClientRegtime = Regtime.Replace(":", "$"); ToClientID = ConfID; ToClientLevel = Level; DateTime nowDateTime = TimeUtil.NowDateTime(); int Day = Global.GetOffsetDay(nowDateTime) - Global.GetOffsetDay(DateTime.Parse(iflAct.FromDate)); CurrDay = Day + 1; string ZeroTime = "2011-11-11 00$00$00"; string GetInfoStr = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, ZeroTime, iflAct.FromDate.Replace(':', '$')); string[] dbResult; if (TCPProcessCmdResults.RESULT_FAILED == Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 14136, GetInfoStr, out dbResult, 0)) { result = RegressActiveOpcode.RegressActiveGetFile; } else if (dbResult == null || dbResult.Length != 2 || Convert.ToInt32(dbResult[0]) != client.ClientData.RoleID) { result = RegressActiveOpcode.RegressActiveGetFile; } else { int Money = Convert.ToInt32(dbResult[1]); if (Money < 0) { Money = 0; } ActiveMoney = Money; result = RegressActiveOpcode.RegressActiveSucc; } } } } return(result); }