Example #1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            ShadowguardController controller = ShadowguardController.Instance;

            if (info.ButtonID == 123)
            {
                if (controller.RemoveFromQueue(User))
                {
                    User.SendLocalizedMessage(1156248); // You have been removed from all Shadowguard queues
                }
            }
            else if (info.ButtonID > 0)
            {
                int id = info.ButtonID - 1;
                if (id >= 0 && id < _Encounters.Length)
                {
                    EncounterType       type = _Encounters[id];
                    ShadowguardInstance inst = controller.GetAvailableInstance(type);

                    if (controller.CanTryEncounter(User, type))
                    {
                        if (inst == null)
                        {
                            controller.AddToQueue(User, type);
                        }
                        else
                        {
                            inst.TryBeginEncounter(User, false, type);
                            controller.RemoveFromQueue(User);
                        }
                    }
                }
            }
        }
Example #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID > 0)
            {
                int id = info.ButtonID - 1;

                if (id >= 0 && id < _Encounters.Length)
                {
                    ShadowguardController controller = ShadowguardController.Instance;

                    EncounterType       type = _Encounters[id];
                    ShadowguardInstance inst = controller.GetAvailableInstance(type);

                    if (controller.CanTryEncounter(User, type))
                    {
                        if (inst == null)
                        {
                            controller.AddToQueue(User, type);
                        }
                        else
                        {
                            inst.TryBeginEncounter(User, false, type);
                            controller.RemoveFromQueue(User);
                        }
                    }
                }
            }
        }
Example #3
0
        public void CheckQueue()
        {
            if (Queue.Count == 0)
            {
                return;
            }

            bool message = false;

            List <Mobile> copy = new List <Mobile>(Queue.Keys);

            for (int i = 0; i < copy.Count; i++)
            {
                Mobile m = copy[i];

                if (m.Map != Map.TerMur || m.NetState == null)
                {
                    RemoveFromQueue(m);

                    if (i == 0)
                    {
                        message = true;
                    }

                    continue;
                }

                foreach (ShadowguardEncounter inst in Encounters.Where(inst => inst.PartyLeader == m))
                {
                    if (i == 0)
                    {
                        message = true;
                    }

                    RemoveFromQueue(m);
                    continue;
                }

                if (Queue.Count > 0)
                {
                    message = true;

                    Timer.DelayCall(TimeSpan.FromMinutes(2), () =>
                    {
                        EncounterType type           = Queue[m];
                        ShadowguardInstance instance = GetAvailableInstance(type);

                        if (instance != null && instance.TryBeginEncounter(m, true, type))
                        {
                            RemoveFromQueue(m);
                        }
                    });
                }

                break;
            }

            if (message && Queue.Count > 0)
            {
                ColUtility.For(Queue.Keys, (i, mob) =>
                {
                    Party p = Party.Get(mob);

                    if (p != null)
                    {
                        p.Members.ForEach(info => info.Mobile.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next"));
                    }
                    //A Shadowguard encounter has opened. You are currently ~1_NUM~ in the
                    //queue. If you are next, you may proceed to the entry stone to join.
                    else
                    {
                        mob.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next");
                    }
                });
            }
        }