public bool initialize() { TodayManager.InitConfig(); return(true); }
public bool startup() { TCPCmdDispatcher.getInstance().registerProcessorEx(1030, 1, 1, TodayManager.getInstance(), TCPCmdFlags.IsStringArrayParams); TCPCmdDispatcher.getInstance().registerProcessorEx(1031, 2, 2, TodayManager.getInstance(), TCPCmdFlags.IsStringArrayParams); return(true); }
private string TodayAward(GameClient client, bool isAll, int todayID) { string result = "{0}:{1}"; string result2; if (!this.IsGongNengOpened()) { result2 = string.Format(result, -11, 0); } else { TodayInfo oneInfo = null; if (!isAll) { oneInfo = this.GetTadayInfoByID(client, todayID); if (oneInfo == null) { return(string.Format(result, -3, 0)); } if (oneInfo.NumMax - oneInfo.NumEnd <= 0) { return(string.Format(result, -4, 0)); } } List <TodayInfo> listAll = new List <TodayInfo>(); if (isAll) { listAll = this.InitToday(client); } else { listAll.Add(oneInfo); } if (listAll.IsNullOrEmpty <TodayInfo>()) { result2 = string.Format(result, -3, 0); } else { IEnumerable <TodayInfo> fubenList = from info in listAll where info.FuBenID > 0 && client.ClientData.FuBenID > 0 && client.ClientData.FuBenID == info.FuBenID && info.NumMax - info.NumEnd > 0 && info.NumEnd >= 0 select info; if (fubenList.Any <TodayInfo>()) { result2 = string.Format(result, -6, 0); } else { IEnumerable <TodayInfo> awardList = from info in listAll where info.NumMax - info.NumEnd > 0 select info; if (!awardList.Any <TodayInfo>()) { result2 = string.Format(result, -5, 0); } else { int goodsCount = 0; foreach (TodayInfo info2 in awardList) { goodsCount += info2.AwardInfo.GoodsList.Count; } if (!Global.CanAddGoodsNum(client, goodsCount)) { result2 = string.Format(result, -2, 0); } else { foreach (TodayInfo info2 in awardList) { SystemXmlItem fuBenInfo = null; if (info2.Type == 6) { TaskData taskData = TodayManager.GetTaoTask(client); if (taskData != null) { if (!Global.CancelTask(client, taskData.DbID, taskData.DoingTaskID)) { return(string.Format(result, -8, 0)); } } } else if (info2.Type == 9) { BufferData bufferData = Global.GetBufferDataByID(client, 34); if (bufferData != null) { bufferData.BufferVal = 0L; bufferData.BufferSecs = 0; GameManager.ClientMgr.NotifyBufferData(client, bufferData); } } else if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(info2.FuBenID, out fuBenInfo)) { return(string.Format(result, -7, 0)); } if (!this.SetFinishNum(client, info2, fuBenInfo)) { return(string.Format(result, -1, 0)); } } TodayAwardInfo awardInfo = new TodayAwardInfo(); foreach (TodayInfo info2 in awardList) { int num = info2.NumMax - info2.NumEnd; for (int i = 0; i < info2.AwardInfo.GoodsList.Count; i++) { GoodsData goods = info2.AwardInfo.GoodsList[i]; Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, goods.GoodsID, goods.GCount * num, goods.Quality, "", goods.Forge_level, goods.Binding, 0, "", true, 1, "每日专享", "1900-01-01 12:00:00", goods.AddPropIndex, goods.BornIndex, goods.Lucky, goods.Strong, goods.ExcellenceInfo, goods.AppendPropLev, 0, null, null, 0, true); } awardInfo.AddAward(info2.AwardInfo, num); } if (awardInfo.Exp > 0.0) { GameManager.ClientMgr.ProcessRoleExperience(client, (long)awardInfo.Exp, true, true, false, "none"); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(30, new object[0]), new object[] { awardInfo.Exp }), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlyErr, 0); } if (awardInfo.GoldBind > 0.0) { GameManager.ClientMgr.AddMoney1(client, (int)awardInfo.GoldBind, "每日专享", true); } if (awardInfo.MoJing > 0.0) { GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, (int)awardInfo.MoJing, "每日专享", true, true, false); } if (awardInfo.ChengJiu > 0.0) { GameManager.ClientMgr.ModifyChengJiuPointsValue(client, (int)awardInfo.ChengJiu, "每日专享", true, true); } if (awardInfo.ShengWang > 0.0) { GameManager.ClientMgr.ModifyShengWangValue(client, (int)awardInfo.ShengWang, "每日专享", true, true); } if (awardInfo.ZhanGong > 0.0) { int zhanGong = (int)awardInfo.ZhanGong; GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref zhanGong, AddBangGongTypes.Today, 0); } if (awardInfo.DiamondBind > 0.0 || awardInfo.ExtDiamondBind > 0.0) { GameManager.ClientMgr.AddUserGold(client, (int)(awardInfo.DiamondBind + awardInfo.ExtDiamondBind), "每日专享"); } if (awardInfo.XingHun > 0.0) { GameManager.ClientMgr.ModifyStarSoulValue(client, (int)awardInfo.XingHun, "每日专享", true, true); } if (awardInfo.YuanSuFenMo > 0.0) { GameManager.ClientMgr.ModifyYuanSuFenMoValue(client, (int)awardInfo.YuanSuFenMo, "每日专享", true, false); } if (awardInfo.ShouHuDianShu > 0.0) { SingletonTemplate <GuardStatueManager> .Instance().AddGuardPoint(client, (int)awardInfo.ShouHuDianShu, "每日专享"); } if (awardInfo.ZaiZao > 0.0) { GameManager.ClientMgr.ModifyZaiZaoValue(client, (int)awardInfo.ZaiZao, "每日专享", true, true, false); } if (awardInfo.LingJing > 0.0) { GameManager.ClientMgr.ModifyMUMoHeValue(client, (int)awardInfo.LingJing, "每日专享", true, true, false); } if (awardInfo.RongYao > 0.0) { GameManager.ClientMgr.ModifyTianTiRongYaoValue(client, (int)awardInfo.RongYao, "每日专享", true); } result2 = this.GetTodayData(client); } } } } } return(result2); }