Exemple #1
0
        private static void OnLogin(LoginEventArgs e)
        {
            Mobile m = e.Mobile;

            if (m.AccessLevel > AccessLevel.GameMaster)
            {
                return;
            }

            ShadowguardInstance inst = GetInstance(m.Location, m.Map);

            if (inst != null)
            {
                ShadowguardEncounter encounter = inst.Encounter;

                if (encounter == null)
                {
                    ShadowguardEncounter.MovePlayer(m, Instance.KickLocation, true);
                }
                else if (m != encounter.PartyLeader)
                {
                    Party p = Party.Get(encounter.PartyLeader);

                    if (p == null || !p.Contains(m))
                    {
                        ShadowguardEncounter.MovePlayer(m, Instance.KickLocation, true);
                    }
                }
            }
        }
Exemple #2
0
        private static void OnLogin(LoginEventArgs e)
        {
            Mobile m = e.Mobile;

            if (m.AccessLevel > AccessLevel.GameMaster)
            {
                return;
            }

            ShadowguardInstance inst = GetInstance(m.Location, m.Map);

            if (inst != null)
            {
                ShadowguardEncounter encounter = inst.Encounter;

                if (encounter == null)
                {
                    StormLevelGump menu = new StormLevelGump(m);
                    menu.BeginClose();
                    m.SendGump(menu);
                }
                else if (m != encounter.PartyLeader)
                {
                    Party p = Party.Get(encounter.PartyLeader);

                    if (p == null || !p.Contains(m))
                    {
                        StormLevelGump menu = new StormLevelGump(m);
                        menu.BeginClose();
                        m.SendGump(menu);
                    }
                }
            }
        }
Exemple #3
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);
                        }
                    }
                }
            }
        }
Exemple #4
0
        public ShadowguardInstance GetAvailableInstance(EncounterType type)
        {
            if (RandomInstances)
            {
                List <ShadowguardInstance> instances;

                if (type == EncounterType.Roof)
                {
                    instances = Instances.Where(e => e.IsRoof && !e.InUse).ToList();
                }
                else
                {
                    instances = Instances.Where(e => !e.IsRoof && !e.InUse).ToList();
                }

                ShadowguardInstance inst = null;

                if (instances.Count > 0)
                {
                    inst = instances[Utility.Random(instances.Count)];
                }

                ColUtility.Free(instances);
                return(inst);
            }

            if (type == EncounterType.Roof)
            {
                return(Instances.FirstOrDefault(e => e.IsRoof && !e.InUse));
            }

            return(Instances.FirstOrDefault(e => !e.IsRoof && !e.InUse));
        }
Exemple #5
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);
                        }
                    }
                }
            }
        }
        public ShadowguardEncounter(EncounterType encounter, ShadowguardInstance instance = null)
        {
            Encounter = encounter;
            Instance  = instance;

            if (instance != null)
            {
                instance.Encounter = this;
            }
        }
Exemple #7
0
        public override void OnClick()
        {
            ShadowguardInstance instance = ShadowguardController.GetInstance(_From.Location, _From.Map);

            if (instance != null && instance.Region.Contains(_From.Location))
            {
                ShadowguardEncounter.MovePlayer(_From, ShadowguardController.Instance.KickLocation);

                if (instance.Encounter != null)
                {
                    instance.Encounter.CheckPlayerStatus(_From);
                }
            }
        }
Exemple #8
0
        public static void Initialize()
        {
            if (ShadowguardController.Instance == null)
            {
                return;
            }

            ColUtility.ForEach(ShadowguardController.Instance.Addons.Where(addon => addon.Map != Map.Internal), addon =>
            {
                ShadowguardInstance instance = ShadowguardController.GetInstance(addon.Location, addon.Map);

                if (instance != null && !instance.InUse)
                {
                    instance.ClearRegion();
                }
            });
        }
Exemple #9
0
        private static void OnLogin(LoginEventArgs e)
        {
            Mobile m = e.Mobile;

            if (m.AccessLevel > AccessLevel.GameMaster)
            {
                return;
            }

            ShadowguardInstance inst = GetInstance(m.Location, m.Map);

            if (inst != null)
            {
                ShadowguardEncounter encounter = inst.Encounter;

                if (encounter == null)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(1), mob =>
                    {
                        ShadowguardEncounter.MovePlayer(mob, Instance.KickLocation, true);

                        /*StormLevelGump menu = new StormLevelGump(mob);
                         * menu.BeginClose();
                         * mob.SendGump(menu);*/
                    }, m);
                }
                else if (m != encounter.PartyLeader)
                {
                    Party p = Party.Get(encounter.PartyLeader);

                    if (m is PlayerMobile && !encounter.Participants.Contains((PlayerMobile)m))
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(1), mob =>
                        {
                            ShadowguardEncounter.MovePlayer(mob, Instance.KickLocation, true);

                            /*StormLevelGump menu = new StormLevelGump(mob);
                             * menu.BeginClose();
                             * mob.SendGump(menu);*/
                        }, m);
                    }
                }
            }
        }
Exemple #10
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");
                    }
                });
            }
        }
Exemple #11
0
 public FountainEncounter(ShadowguardInstance instance)
     : base(EncounterType.Fountain, instance)
 {
 }
Exemple #12
0
 public ArmoryEncounter(ShadowguardInstance instance)
     : base(EncounterType.Armory, instance)
 {
 }
Exemple #13
0
 public BarEncounter(ShadowguardInstance instance)
     : base(EncounterType.Bar, instance)
 {
 }
Exemple #14
0
 public OrchardEncounter(ShadowguardInstance instance)
     : base(EncounterType.Orchard, instance)
 {
 }
Exemple #15
0
 public RoofEncounter(ShadowguardInstance instance)
     : base(EncounterType.Roof, instance)
 {
 }
Exemple #16
0
 public BelfryEncounter(ShadowguardInstance instance)
     : base(EncounterType.Belfry, instance)
 {
 }
Exemple #17
0
 public ShadowguardRegion(Rectangle2D bounds, string regionName, ShadowguardInstance instance)
     : base(String.Format("Shadowguard_{0}", regionName), Map.TerMur, Region.DefaultPriority, bounds)
 {
     Instance = instance;
 }
Exemple #18
0
        public ShadowguardInstance GetAvailableInstance(EncounterType type)
        {
            if (RandomInstances)
            {
                List <ShadowguardInstance> instances;

                if (type == EncounterType.Roof)
                {
                    instances = new List <ShadowguardInstance>();

                    for (var index = 0; index < Instances.Count; index++)
                    {
                        var e = Instances[index];

                        if (e.IsRoof && !e.InUse)
                        {
                            instances.Add(e);
                        }
                    }
                }
                else
                {
                    instances = new List <ShadowguardInstance>();

                    for (var index = 0; index < Instances.Count; index++)
                    {
                        var e = Instances[index];

                        if (!e.IsRoof && !e.InUse)
                        {
                            instances.Add(e);
                        }
                    }
                }

                ShadowguardInstance inst = null;

                if (instances.Count > 0)
                {
                    inst = instances[Utility.Random(instances.Count)];
                }

                ColUtility.Free(instances);
                return(inst);
            }

            if (type == EncounterType.Roof)
            {
                for (var index = 0; index < Instances.Count; index++)
                {
                    var e = Instances[index];

                    if (e.IsRoof && !e.InUse)
                    {
                        return(e);
                    }
                }

                return(null);
            }

            for (var index = 0; index < Instances.Count; index++)
            {
                var e = Instances[index];

                if (!e.IsRoof && !e.InUse)
                {
                    return(e);
                }
            }

            return(null);
        }