コード例 #1
0
ファイル: Controller.cs プロジェクト: mikkelhartmann/ServUO
        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);
                        }
                    }
                }
            }
        }
コード例 #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);
                        }
                    }
                }
            }
        }