/// <summary> /// 消息处理:检查 /// </summary> /// <param name="type">消息类型</param> /// <param name="reader">读取器</param> private static void ProcessCheck(ushort type, BinaryReader reader) { BinaryWriter writer = new BinaryWriter(new MemoryStream()); writer.Write((int)0); writer.Write((ushort)type); writer.Write(PVPReward.hasInitialize); Network.Send(writer); if (PVPReward.hasInitialize) { PVPReward.SendUpdate(); } }
/// <summary> /// 定时器计时 /// </summary> private static void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (!PVPReward.hasInitialize) { return; } bool hasSend = false; lock (PVPReward.dataList) { for (int i = 0; i < PVPReward.dataList.Count; ++i) { PVPRewardData data = PVPReward.dataList[i]; if (data.gift != 0 && (DateTime.Now - data.UpdateTime).TotalDays >= 7) { data.gift = 0; hasSend = true; Log.AddLog(data.ServerId + " PVP奖励更新时间太早 " + data.UpdateTime.ToShortDateString()); continue; } if (data.gift != 0 && DateTime.Now >= data.UpdateTime && GMCommand.Execute(data.Address, data.ServerId, "0", string.Format("RPVP({0})", data.gift), "")) { data.gift = 0; hasSend = true; } } if (hasSend) { PVPReward.SendUpdate(); } } }