Пример #1
0
        public void UpdateWaitTimeDps(int waitTime, uint dungeonId)
        {
            LfgWaitTime wt         = waitTimesDpsStore[dungeonId];
            uint        old_number = wt.number++;

            wt.time = (int)((wt.time * old_number + waitTime) / wt.number);
        }
Пример #2
0
        public void UpdateQueueTimers(byte queueId, long currTime)
        {
            Log.outDebug(LogFilter.Lfg, "Updating queue timers...");
            foreach (var itQueue in QueueDataStore)
            {
                LfgQueueData queueinfo  = itQueue.Value;
                uint         dungeonId  = queueinfo.dungeons.FirstOrDefault();
                uint         queuedTime = (uint)(currTime - queueinfo.joinTime);
                LfgRoles     role       = LfgRoles.None;
                int          waitTime   = -1;

                if (!waitTimesTankStore.ContainsKey(dungeonId))
                {
                    waitTimesTankStore[dungeonId] = new LfgWaitTime();
                }
                if (!waitTimesHealerStore.ContainsKey(dungeonId))
                {
                    waitTimesHealerStore[dungeonId] = new LfgWaitTime();
                }
                if (!waitTimesDpsStore.ContainsKey(dungeonId))
                {
                    waitTimesDpsStore[dungeonId] = new LfgWaitTime();
                }
                if (!waitTimesAvgStore.ContainsKey(dungeonId))
                {
                    waitTimesAvgStore[dungeonId] = new LfgWaitTime();
                }

                int wtTank   = waitTimesTankStore[dungeonId].time;
                int wtHealer = waitTimesHealerStore[dungeonId].time;
                int wtDps    = waitTimesDpsStore[dungeonId].time;
                int wtAvg    = waitTimesAvgStore[dungeonId].time;

                foreach (var itPlayer in queueinfo.roles)
                {
                    role |= itPlayer.Value;
                }
                role &= ~LfgRoles.Leader;

                switch (role)
                {
                case LfgRoles.None:                                    // Should not happen - just in case
                    waitTime = -1;
                    break;

                case LfgRoles.Tank:
                    waitTime = wtTank;
                    break;

                case LfgRoles.Healer:
                    waitTime = wtHealer;
                    break;

                case LfgRoles.Damage:
                    waitTime = wtDps;
                    break;

                default:
                    waitTime = wtAvg;
                    break;
                }

                if (string.IsNullOrEmpty(queueinfo.bestCompatible))
                {
                    FindBestCompatibleInQueue(itQueue.Key, itQueue.Value);
                }

                LfgQueueStatusData queueData = new(queueId, dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps);
                foreach (var itPlayer in queueinfo.roles)
                {
                    ObjectGuid pguid = itPlayer.Key;
                    Global.LFGMgr.SendLfgQueueStatus(pguid, queueData);
                }
            }
        }