Пример #1
0
        public void UpdateBestCompatibleInQueue(ObjectGuid guid, LfgQueueData queueData, string key, Dictionary <ObjectGuid, LfgRoles> roles)
        {
            byte storedSize = (byte)(string.IsNullOrEmpty(queueData.bestCompatible) ? 0 : queueData.bestCompatible.Count(p => p == '|') + 1);

            byte size = (byte)(key.Count(p => p == '|') + 1);

            if (size <= storedSize)
            {
                return;
            }

            Log.outDebug(LogFilter.Lfg, "UpdateBestCompatibleInQueue: Changed ({0}) to ({1}) as best compatible group for {2}",
                         queueData.bestCompatible, key, guid);

            queueData.bestCompatible = key;
            queueData.tanks          = SharedConst.LFGTanksNeeded;
            queueData.healers        = SharedConst.LFGHealersNeeded;
            queueData.dps            = SharedConst.LFGDPSNeeded;
            foreach (var it in roles)
            {
                LfgRoles role = it.Value;
                if (role.HasAnyFlag(LfgRoles.Tank))
                {
                    --queueData.tanks;
                }
                else if (role.HasAnyFlag(LfgRoles.Healer))
                {
                    --queueData.healers;
                }
                else
                {
                    --queueData.dps;
                }
            }
        }
Пример #2
0
        public static string GetRolesString(LfgRoles roles)
        {
            StringBuilder rolesstr = new();

            if (roles.HasAnyFlag(LfgRoles.Tank))
            {
                rolesstr.Append("Tank");
            }

            if (roles.HasAnyFlag(LfgRoles.Healer))
            {
                if (rolesstr.Capacity != 0)
                {
                    rolesstr.Append(", ");
                }
                rolesstr.Append("Healer");
            }

            if (roles.HasAnyFlag(LfgRoles.Damage))
            {
                if (rolesstr.Capacity != 0)
                {
                    rolesstr.Append(", ");
                }
                rolesstr.Append("Damage");
            }

            if (roles.HasAnyFlag(LfgRoles.Leader))
            {
                if (rolesstr.Capacity != 0)
                {
                    rolesstr.Append(", ");
                }
                rolesstr.Append("Leader");
            }

            if (rolesstr.Capacity == 0)
            {
                rolesstr.Append("None");
            }

            return(rolesstr.ToString());
        }