Exemplo n.º 1
0
        public void Generate(List <int> randQuestList, int questCellCount)
        {
            foreach (var questData in SceneQuestBook.GetQuestConfigData(mapId))
            {
                for (int j = 0; j < questData.Value; j++)
                {
                    randQuestList.Add(questData.Id);
                }
            }

            int offset = UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.DungeonQuestOffside);

            while (randQuestList.Count < questCellCount)
            {
                if (offset < UserProfile.InfoWorld.SavedDungeonQuests.Count - 1)
                {
                    randQuestList.Add(UserProfile.InfoWorld.SavedDungeonQuests[offset]);
                    offset++;
                }
                else
                {
                    ListTool.RandomShuffle(UserProfile.InfoWorld.SavedDungeonQuests);
                    offset = 0;
                    randQuestList.Add(UserProfile.InfoWorld.SavedDungeonQuests[offset]);
                }
            }
            UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.DungeonQuestOffside, offset);
            ListTool.RandomShuffle(randQuestList);
        }
Exemplo n.º 2
0
        public static int[] GetRandNPeople(int count, int minLevel, int maxLevel)
        {
            List <int> pids = new List <int>();

            foreach (PeopleConfig peopleConfig in ConfigData.PeopleDict.Values)
            {
                if (IsPeople(peopleConfig.Id) && peopleConfig.Level >= minLevel && peopleConfig.Level <= maxLevel)
                {
                    pids.Add(peopleConfig.Id);
                }
            }

            ListTool.RandomShuffle(pids);
            return(pids.GetRange(0, count).ToArray());
        }
Exemplo n.º 3
0
 public void Init(int id, int minute)
 {
     mapId = id;
     if (UserProfile.InfoWorld.SavedDungeonQuests.Count == 0)
     {
         UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.DungeonQuestOffside, 0);
         foreach (var questData in SceneQuestBook.GetDungeonQuestConfigData(mapId))
         {
             for (int j = 0; j < questData.Value; j++)
             {
                 UserProfile.InfoWorld.SavedDungeonQuests.Add(questData.Id);
             }
         }
         ListTool.RandomShuffle(UserProfile.InfoWorld.SavedDungeonQuests);
     }
 }
Exemplo n.º 4
0
        public void CopyRandomNCard(int n, int spellid)
        {
            List <int> indexs = new List <int>();

            for (int i = 0; i < GameConstants.CardSlotMaxCount; i++)
            {
                if (cards[i].CardId != 0 && (cards[i].CardId != spellid || cards[i].CardType != CardTypes.Spell))
                {
                    indexs.Add(i);
                }
            }
            ListTool.RandomShuffle(indexs);
            for (int i = 0; i < Math.Min(n, indexs.Count); i++)
            {
                AddCard(cards[indexs[i]].GetCopy());
            }
        }
Exemplo n.º 5
0
        public DbMergeData[] GetAllMergeData()
        {
            int time = TimeTool.DateTimeToUnixTime(DateTime.Now);

            if (MergeMethods == null || UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastMergeTime) < time - GameConstants.MergeWeaponDura)
            {
                int[]      ids    = EquipBook.GetCanMergeId(UserProfile.InfoBasic.Level);
                List <int> newids = new List <int>(ids);
                ListTool.RandomShuffle(newids);
                MergeMethods = new List <DbMergeData>();
                for (int i = 0; i < 8; i++)
                {
                    MergeMethods.Add(CreateMergeMethod(newids[i]));
                }
                UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.LastMergeTime, TimeManager.GetTimeOnNextInterval(UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastMergeTime), time, GameConstants.MergeWeaponDura));
            }

            return(MergeMethods.ToArray());
        }
Exemplo n.º 6
0
        public void Generate(List <int> randQuestList, int questCellCount)
        {
            foreach (var questData in SceneQuestBook.GetQuestConfigData(mapId))
            {
                for (int j = 0; j < questData.Value; j++)
                {
                    randQuestList.Add(questData.Id);
                }
            }

            if (randQuestList.Count > questCellCount)
            {
                randQuestList.RemoveRange(questCellCount, randQuestList.Count - questCellCount);
                NLog.Warn(string.Format("Generate id={0} size too big {1}", mapId, randQuestList.Count));
            }
            else
            {
                ListTool.Fill(randQuestList, 0, questCellCount);
            }
            ListTool.RandomShuffle(randQuestList);
        }
Exemplo n.º 7
0
        internal List <int> GetBlessShopData()
        {
            int time = TimeTool.DateTimeToUnixTime(DateTime.Now);

            if (BlessShopItems == null || UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastBlessShopTime) < time - GameConstants.BlessShopDura)
            {
                BlessShopItems = new List <int>();

                BlessShopItems.Clear();
                foreach (var blessData in ConfigData.BlessDict.Values)
                {
                    if (blessData.Type == 1)
                    {
                        BlessShopItems.Add(blessData.Id);
                    }
                }
                ListTool.RandomShuffle(BlessShopItems);
                BlessShopItems = BlessShopItems.GetRange(0, 5);
                UserProfile.InfoRecord.SetRecordById((int)MemPlayerRecordTypes.LastBlessShopTime, TimeManager.GetTimeOnNextInterval(UserProfile.InfoRecord.GetRecordById((int)MemPlayerRecordTypes.LastBlessShopTime), time, GameConstants.BlessShopDura));
            }

            return(BlessShopItems);
        }