Пример #1
0
        public static bool SetGMailNeverSend(GameClient client, int gmailID, int mailID)
        {
            string dbCmds = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, gmailID, mailID);

            string[] dbFields = null;
            Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10178, dbCmds, out dbFields, client.ServerId);
            bool result2;

            if (dbFields == null || dbFields.Length != 1)
            {
                result2 = false;
            }
            else
            {
                int result = Convert.ToInt32(dbFields[0]);
                if (result <= 0)
                {
                    result2 = false;
                }
                else
                {
                    GroupMailManager.SetGMailIsSend(client, gmailID);
                    result2 = true;
                }
            }
            return(result2);
        }
Пример #2
0
        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);
        }