Exemple #1
0
 public static void CheckConfig(Mobile user)
 {
     if (user != null && !user.Deleted && user.AccessLevel >= Access)
     {
         (SuperGump.EnumerateInstances <DonationAdminUI>(user).FirstOrDefault(g => g != null && !g.IsDisposed) ??
          new DonationAdminUI(user)).Refresh(true);
     }
 }
Exemple #2
0
        public static void OnDetected(FastWalkEventArgs e)
        {
            if (!(e.NetState.Mobile is PlayerMobile))
            {
                return;
            }

            PlayerMobile pm = (PlayerMobile)e.NetState.Mobile;

            Console.WriteLine("Client: {0}: Speed exploit detected: {1}", e.NetState, pm);

            if (CMOptions.DetectAction == SpeedhackAction.None)
            {
                return;
            }

            if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Block))
            {
                e.Blocked = true;
            }

            if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Warn))
            {
                NoticeDialogGump g =
                    SuperGump.EnumerateInstances <NoticeDialogGump>(pm, true)
                    .FirstOrDefault(d => !d.IsDisposed && d.Title == "Speed Exploit Detection") ?? new NoticeDialogGump(pm)
                {
                    CanClose      = false,
                    CanDispose    = false,
                    Width         = 420,
                    Height        = 420,
                    Modal         = true,
                    BlockMovement = true,
                    Icon          = 7000,
                    Title         = "Speed Exploit Detection",
                    Html          =
                        "You seem to be moving faster than the universe allows, that isn't a good thing!" +
                        "\nIf you defy the laws of physics, bad things can happen." +
                        "\nYou don't want to end up in a black hole, unable to return to the universe, do you?" +
                        "\nI didn't think so." + "\nPlay fair and disable any artificial speed exploits that you may be using.",
                    AcceptHandler = b =>
                    {
                        if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Kick))
                        {
                            e.NetState.Dispose(true);
                        }
                    }
                };

                g.Refresh(true);
            }
            else if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Kick))
            {
                e.NetState.Dispose(true);
            }
        }
        protected virtual void ProcessLoot()
        {
            if (_ProcessingLoot || Loot == null || Loot.Count == 0)
            {
                return;
            }

            _ProcessingLoot = true;

            Loot.RemoveAll(
                e =>
            {
                if (e == null)
                {
                    return(true);
                }

                if (!e.Valid || e.HasWinner)
                {
                    e.Free();
                    return(true);
                }

                return(false);
            });

            if (Loot.Count == 0)
            {
                Loot.Free(false);

                _ProcessingLoot = false;
                return;
            }

            var now     = DateTime.UtcNow;
            var players = new List <PlayerMobile>();

            var count = Loot.Count;

            while (--count >= 0)
            {
                var e = Loot[count];

                if (e.Process(e.Expire < now))
                {
                    Loot.Remove(e);

                    e.Free();
                }
                else
                {
                    DungeonLootUI dui;

                    foreach (
                        var kv in e.Rolls.Where(kv => kv.Value == null && kv.Key != null && !kv.Key.Deleted && !players.Contains(kv.Key)))
                    {
                        dui = SuperGump.EnumerateInstances <DungeonLootUI>(kv.Key).FirstOrDefault(ui => ui != null && !ui.IsDisposed);

                        if (dui == null || dui.Dungeon != this)
                        {
                            players.AddOrReplace(kv.Key);
                        }

                        if (dui == null)
                        {
                            continue;
                        }

                        if (!Loot.Where(loot => loot.Rolls.ContainsKey(kv.Key) && loot.Rolls[kv.Key] == null).All(dui.List.Contains))
                        {
                            players.AddOrReplace(kv.Key);
                        }
                    }
                }
            }

            players.ForEach(m => DungeonLootUI.DisplayTo(m, false, this));
            players.Free(true);

            _ProcessingLoot = false;
        }