private static void SendGMail2Role(GameClient client, GroupMailData gmailData) { if (GroupMailManager.SetGMailNeverSend(client, gmailData.GMailID, 0)) { int mailID = Global.UseMailGivePlayerAward2(client, gmailData.GoodsList, gmailData.Subject, gmailData.Content, gmailData.Yinliang, gmailData.Tongqian, gmailData.YuanBao); GroupMailManager.SetGMailNeverSend(client, gmailData.GMailID, mailID); } }
private static bool InConditions(GameClient client, GroupMailData gmailData) { bool result; if (string.IsNullOrEmpty(gmailData.Conditions)) { result = true; } else { long currTicks = TimeUtil.NOW() * 10000L; if (currTicks < gmailData.InputTime || currTicks > gmailData.EndTime) { result = false; } else { string[] strFields = gmailData.Conditions.Split(new char[] { '|' }); bool bError = false; for (int i = 0; i < strFields.Length; i++) { string[] strKey = strFields[i].Split(new char[] { ',' }); if ("level" == strKey[0]) { if (strKey.Length != 2) { bError = true; break; } int currLvl = client.ClientData.ChangeLifeCount * 100 + client.ClientData.Level; int cfgLvl = Global.SafeConvertToInt32(strKey[1]); if (currLvl < cfgLvl) { return(false); } } else if ("levelrange" == strKey[0]) { if (strKey.Length != 3) { bError = true; break; } int currLvl = client.ClientData.ChangeLifeCount * 100 + client.ClientData.Level; int cfgLvlMin = Global.SafeConvertToInt32(strKey[1]); int cfgLvlMax = Global.SafeConvertToInt32(strKey[2]); if (currLvl < cfgLvlMin || currLvl > cfgLvlMax) { return(false); } } else if ("loginrange" == strKey[0]) { if (strKey.Length != 3) { bError = true; break; } string strBeginTime = strKey[1]; string strEndTime = strKey[2]; DateTime beginTime = DateTime.Parse(strBeginTime); DateTime endTime = DateTime.Parse(strEndTime); if (!Global.CheckRoleIsLoginByTime(client, beginTime, endTime)) { if (TimeUtil.NOW() * 10000L > endTime.Ticks) { GroupMailManager.SetGMailNeverSend(client, gmailData.GMailID, -1); } return(false); } } else if ("vip" == strKey[0]) { if (strKey.Length != 3) { bError = true; break; } int currLvl = client.ClientData.VipLevel; int cfgLvlMin = Global.SafeConvertToInt32(strKey[1]); int cfgLvlMax = Global.SafeConvertToInt32(strKey[2]); if (currLvl < cfgLvlMin || currLvl > cfgLvlMax) { return(false); } } else { if (string.IsNullOrEmpty(strKey[0])) { break; } LogManager.WriteLogUseCache(LogTypes.Error, string.Format("GroupMailManager::InConditions Error Conditions={0}", gmailData.Conditions)); return(false); } } if (bError) { GroupMailManager.SetGMailIsSend(client, gmailData.GMailID); LogManager.WriteLog(LogTypes.Error, string.Format("GroupMailManager::InConditions Error Conditions={0}", gmailData.Conditions), null, true); result = false; } else { result = true; } } } return(result); }