Beispiel #1
0
 public static bool ReLoad()
 {
     try
     {
         Dictionary <int, List <ActiveConditionInfo> > dictionary = ActiveMgr.LoadActiveConditionDb();
         Dictionary <int, ActiveAwardInfo>             value      = ActiveMgr.LoadActiveAwardDb(dictionary);
         if (dictionary.Count > 0)
         {
             Interlocked.Exchange <Dictionary <int, List <ActiveConditionInfo> > >(ref ActiveMgr.m_ActiveConditionInfo, dictionary);
             Interlocked.Exchange <Dictionary <int, ActiveAwardInfo> >(ref ActiveMgr.m_ActiveAwardInfo, value);
         }
         return(true);
     }
     catch (Exception exception)
     {
         ActiveMgr.log.Error("QuestMgr", exception);
     }
     return(false);
 }
Beispiel #2
0
        public static List <ActiveAwardInfo> GetAwardInfo(DateTime lastDate, int playerGrade)
        {
            string itemIds = null;
            int    days    = (DateTime.Now - lastDate).Days;

            if (DateTime.Now.DayOfYear > lastDate.DayOfYear)
            {
                days++;
            }
            List <ActiveAwardInfo> list = new List <ActiveAwardInfo>();

            foreach (List <ActiveConditionInfo> infos in ActiveMgr.m_ActiveConditionInfo.Values)
            {
                foreach (ActiveConditionInfo info in infos)
                {
                    if (ActiveMgr.IsValid(info) && ActiveMgr.IsInGrade(info.LimitGrade, playerGrade) && info.Condition <= days)
                    {
                        itemIds = info.AwardId;
                        int activeId = info.ActiveID;
                    }
                }
            }
            if (!string.IsNullOrEmpty(itemIds))
            {
                string[] itemArray = itemIds.Split(new char[]
                {
                    ','
                });
                string[] array = itemArray;
                for (int i = 0; i < array.Length; i++)
                {
                    string item = array[i];
                    if (!string.IsNullOrEmpty(item))
                    {
                        list.Add(ActiveMgr.m_ActiveAwardInfo[Convert.ToInt32(item)]);
                    }
                }
            }
            return(list);
        }
Beispiel #3
0
        public static List <ActiveAwardInfo> GetAwardInfo(DateTime lastDate, int playerGrade)
        {
            string text = null;
            int    num  = (DateTime.Now - lastDate).Days;

            if (DateTime.Now.DayOfYear > lastDate.DayOfYear)
            {
                num++;
            }
            List <ActiveAwardInfo> list = new List <ActiveAwardInfo>();

            foreach (List <ActiveConditionInfo> current in ActiveMgr.m_ActiveConditionInfo.Values)
            {
                foreach (ActiveConditionInfo current2 in current)
                {
                    if (ActiveMgr.IsValid(current2) && ActiveMgr.IsInGrade(current2.LimitGrade, playerGrade) && current2.Condition <= num)
                    {
                        text = current2.AwardId;
                        int arg_98_0 = current2.ActiveID;
                    }
                }
            }
            if (!string.IsNullOrEmpty(text))
            {
                string[] array = text.Split(new char[]
                {
                    ','
                });
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string value = array2[i];
                    if (!string.IsNullOrEmpty(value) && ActiveMgr.m_ActiveAwardInfo.ContainsKey(Convert.ToInt32(value)))
                    {
                        list.Add(ActiveMgr.m_ActiveAwardInfo[Convert.ToInt32(value)]);
                    }
                }
            }
            return(list);
        }
Beispiel #4
0
        public static List <ActiveAwardInfo> GetAwardInfo(DateTime lastDate, int playerGrade)
        {
            string str1 = (string)null;
            int    days = (DateTime.Now - lastDate).Days;

            if (DateTime.Now.DayOfYear > lastDate.DayOfYear)
            {
                ++days;
            }
            List <ActiveAwardInfo> list1 = new List <ActiveAwardInfo>();

            foreach (List <ActiveConditionInfo> list2 in ActiveMgr.m_ActiveConditionInfo.Values)
            {
                foreach (ActiveConditionInfo info in list2)
                {
                    if (ActiveMgr.IsValid(info) && ActiveMgr.IsInGrade(info.LimitGrade, playerGrade) && info.Condition <= days)
                    {
                        str1 = info.AwardId;
                        int activeId = info.ActiveID;
                    }
                }
            }
            if (!string.IsNullOrEmpty(str1))
            {
                string str2    = str1;
                char[] chArray = new char[1]
                {
                    ','
                };
                foreach (string str3 in str2.Split(chArray))
                {
                    if (!string.IsNullOrEmpty(str3) && ActiveMgr.m_ActiveAwardInfo.ContainsKey(Convert.ToInt32(str3)))
                    {
                        list1.Add(ActiveMgr.m_ActiveAwardInfo[Convert.ToInt32(str3)]);
                    }
                }
            }
            return(list1);
        }
Beispiel #5
0
        public static bool ReLoad()
        {
            bool result;

            try
            {
                Dictionary <int, List <ActiveConditionInfo> > tempActiveConditionInfo = ActiveMgr.LoadActiveConditionDb();
                Dictionary <int, ActiveAwardInfo>             tempActiveAwardInfo     = ActiveMgr.LoadActiveAwardDb(tempActiveConditionInfo);
                if (tempActiveConditionInfo.Count > 0)
                {
                    Interlocked.Exchange <Dictionary <int, List <ActiveConditionInfo> > >(ref ActiveMgr.m_ActiveConditionInfo, tempActiveConditionInfo);
                    Interlocked.Exchange <Dictionary <int, ActiveAwardInfo> >(ref ActiveMgr.m_ActiveAwardInfo, tempActiveAwardInfo);
                }
                result = true;
                return(result);
            }
            catch (Exception e)
            {
                ActiveMgr.log.Error("QuestMgr", e);
            }
            result = false;
            return(result);
        }
Beispiel #6
0
 public static bool Init()
 {
     return(ActiveMgr.ReLoad());
 }