예제 #1
0
 public void HandleAdminCommand(CommandEventArgs e)
 {
     if (e.Mobile != null && !e.Mobile.Deleted && e.Mobile is PlayerMobile)
     {
         SuperGump.Send(new EquipmentSetsAdminUI((PlayerMobile)e.Mobile));
     }
 }
예제 #2
0
        private static void SpotCheck(PlayerMobile user)
        {
            if (user == null || user.Deleted || !user.IsOnline() || !user.Alive || CMOptions.Status != DataStoreStatus.Idle ||
                CMOptions.CurrencyType == null || CMOptions.ExchangeRate <= 0)
            {
                return;
            }

            DonationProfile profile = Find(user.Account);

            if (profile == null)
            {
                return;
            }

            if (profile.Any(trans => !trans.Hidden && trans.State == DonationTransactionState.Processed))
            {
                SuperGump.Send(
                    new ConfirmDialogGump(
                        user,
                        null,
                        title: "You Have Rewards!",
                        html: "You have unclaimed donation rewards!\nWould you like to view them now?",
                        onAccept: b => CheckDonate(user)));
            }
        }
예제 #3
0
        public static void MoveLastAddedToBack(this SuperGump gump)
        {
            var btn = gump.Entries.Last();

            gump.Entries.Remove(btn);
            gump.Entries.Insert(0, btn);
        }
예제 #4
0
 public static void CheckConfig(Mobile user)
 {
     if (user != null && !user.Deleted && user.AccessLevel >= Access)
     {
         (SuperGump.GetInstance <DonationAdminUI>(user) ?? new DonationAdminUI(user)).Refresh(true);
     }
 }
예제 #5
0
        public static void RefreshUI(PlayerMobile cam)
        {
            if (cam == null)
            {
                return;
            }

            if (!IsCamera(cam))
            {
                CloseUI(cam);
                return;
            }

            bool refreshed = false;

            foreach (ActionCamUI g in SuperGump.GetInstances <ActionCamUI>(cam, true).Where(g => !g.IsDisposed))
            {
                g.Refresh(true);
                refreshed = true;
            }

            if (!refreshed)
            {
                new ActionCamUI(cam).Send();
            }
        }
예제 #6
0
 public void CompileControlPanel(SuperGump g, int x, int y, int w, int h)
 {
     if (Options != null)
     {
         Options.CompileControlPanel(g, x, y, w, h);
     }
 }
예제 #7
0
        public void HandlePositionCommand(CommandEventArgs e)
        {
            var user = e.Mobile as PlayerMobile;

            if (user == null || user.Deleted || user.NetState == null || !ModuleEnabled)
            {
                return;
            }

            if (user.AccessLevel < Access)
            {
                if (user.AccessLevel > AccessLevel.Player)
                {
                    user.SendMessage("You do not have access to that command.");
                }

                return;
            }

            var tb = Toolbars.EnsureState(user).GetToolbarGump();

            SuperGump.Send(
                new OffsetSelectorGump(
                    user,
                    tb.Refresh(true),
                    Toolbars.GetOffset(user),
                    (self, oldValue) =>
            {
                Toolbars.SetOffset(user, self.Value);
                tb.X = self.Value.X;
                tb.Y = self.Value.Y;
                tb.Refresh(true);
            }));
        }
예제 #8
0
 public static void CloseCentralGump(this PlayerMobile user)
 {
     foreach (CentralGumpUI g in SuperGump.GetInstances <CentralGumpUI>(user))
     {
         g.Close(true);
     }
 }
예제 #9
0
        protected override void RegisterSubCommands()
        {
            base.RegisterSubCommands();

            RegisterSubCommand(
                "templates",
                e =>
            {
                PvPTemplates.DisplayManagerGump(e.Mobile);
                return(true);
            },
                "Opens your PvP template manager.",
                "",
                AccessLevel.Player);

            RegisterSubCommand(
                "scoreboard",
                state =>
            {
                if (state == null || state.Mobile == null || state.Mobile.Deleted)
                {
                    return(false);
                }

                SuperGump g = CreateResultsGump(state.Mobile).Send();

                return(true);
            },
                "Displays the battles scores.",
                "",
                AccessLevel.Player);

            RegisterSubCommandAlias("score");
        }
예제 #10
0
 public static void SendCentralGump(this PlayerMobile user)
 {
     if (user != null && !user.Deleted && user.NetState != null)
     {
         SuperGump.Send(new CentralGumpUI(user, EnsureProfile(user), CentralGumpType.News));
     }
 }
예제 #11
0
 public static void SendCentralGump(this PlayerMobile user)
 {
     if (user != null && !user.Deleted && user.NetState != null && CMOptions.ModuleEnabled)
     {
         SuperGump.Send(new UOFCentralGump(user, State.Root));
     }
 }
예제 #12
0
 public static void CloseUI(PlayerMobile cam)
 {
     foreach (ActionCamUI g in SuperGump.GetInstances <ActionCamUI>(cam, true))
     {
         g.Close(true);
     }
 }
예제 #13
0
파일: MobileExt.cs 프로젝트: ruaduck/Core
        public static bool RefreshGump <T>(this Mobile m)
            where T : Gump
        {
            if (m == null)
            {
                return(false);
            }

            var t = typeof(T);

            if (t.IsEqualOrChildOf <SuperGump>())
            {
                return(SuperGump.RefreshInstances(m, t, true) > 0);
            }

            var g = m.FindGump(t);

            if (g == null)
            {
                return(false);
            }

            m.CloseGump(t);

            return(m.SendGump(g));
        }
예제 #14
0
        public static void RefreshGumps(PlayerMobile pm)
        {
            if (!CMOptions.ModuleEnabled || pm == null)
            {
                return;
            }

            if (CMOptions.UseCategories)
            {
                foreach (var g in SuperGump.GetInstances <ConquestStatesGump>(pm, true).Where(g => !g.IsDisposed && g.IsOpen))
                {
                    g.Refresh(true);
                }
            }
            else
            {
                foreach (var g in SuperGump.GetInstances <ConquestStateListGump>(pm, true).Where(g => !g.IsDisposed && g.IsOpen))
                {
                    g.Refresh(true);
                }
            }

            foreach (var g in SuperGump.GetInstances <ConquestStateGump>(pm, true).Where(g => !g.IsDisposed && g.IsOpen))
            {
                g.Refresh(true);
            }
        }
예제 #15
0
        private static void NotifyPlayers()
        {
            VitaNexCore.TryCatch(
                () =>
            {
                CSOptions.ToConsole("Notifying Players...");

                var sb = new StringBuilder();
                sb.AppendLine(
                    new[] { "Oops! {0} attempted to divide by zero, the Universe said NO!" }.GetRandom(), ServerList.ServerName);

                if (CSOptions.Email && !String.IsNullOrWhiteSpace(CSOptions.EmailOptions.From) &&
                    !String.IsNullOrWhiteSpace(CSOptions.EmailOptions.To))
                {
                    sb.AppendLine();
                    sb.AppendLine("Relax, the staff will be notified.");
                }

                if (CSOptions.Restart)
                {
                    sb.AppendLine();
                    sb.AppendLine(
                        "{0} will attempt to restart itself, {1} if it is successful.",
                        ServerList.ServerName,
                        CSOptions.RestartDebug ? "it could take a few minutes" : "it shouldn't take long");
                    sb.AppendLine(
                        "So... now would be a great time to {0}.",
                        new[]
                    {
                        "solve world hunger", "visit the moon", "stare at this message", "practise licking your elbow",
                        "clean your keyboard", "clear your history", "tweet an annoying status", "listen to a Bieber song",
                        "poke dead things with a stick", "twerk", "plank", "laugh maniacally", "discover a heavy element",
                        "avast your mateys", "spam login requests", "fing those fingers"
                    }.GetRandom());
                }

                sb.AppendLine();
                sb.AppendLine("We are sorry for the inconvenience!");
                sb.AppendLine("- {0} Team", ServerList.ServerName);

                string html = sb.ToString();

                NetState.Instances.AsParallel()
                .Where(s => s != null && s.Socket != null && s.Mobile is PlayerMobile)
                .ForEach(
                    s => SuperGump.Send(
                        new NoticeDialogGump((PlayerMobile)s.Mobile)
                {
                    Width   = 500,
                    Height  = 350,
                    CanMove = false,
                    Title   = "Oops!",
                    Html    = html
                }));

                CSOptions.ToConsole("Done");
            },
                CSOptions.ToConsole);
        }
예제 #16
0
 private void HandleGumpClose(SuperGump g, bool all)
 {
     if (_Gump == g && all)
     {
         _Gump.OnActionClose -= HandleGumpClose;
         _Gump = null;
     }
 }
예제 #17
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);
     }
 }
예제 #18
0
파일: SystemOpts.cs 프로젝트: LordEnigma/UO
        public void HandleConfigCommand(CommandEventArgs e)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm != null && !pm.Deleted && pm.Alive)
            {
                SuperGump.Send(new MOTDMessageListGump(pm));
            }
        }
예제 #19
0
        public override void OnDelete()
        {
            base.OnDelete();

            _Gump   = null;
            _Target = null;

            Names.Free(true);
        }
예제 #20
0
 public override void OnResponse(int hue)
 {
     if (User != null)
     {
         User.SendMessage(hue, "Your alliance messages will now appear in this hue.");
         User.AllianceMessageHue = hue;
         SuperGump.Send(new CentralGumpUI(User, Profile, CentralGumpType.Information));
     }
 }
예제 #21
0
        public static void Configure()
        {
            CommandSystem.Register(
                "FixMe",
                AccessLevel.Player,
                e =>
            {
                if (e == null || !(e.Mobile is PlayerMobile))
                {
                    return;
                }

                var g = SuperGump.Send(new FixMeGump((PlayerMobile)e.Mobile));

                if (OnGumpSend != null)
                {
                    OnGumpSend(g);
                }
            });

            CommandSystem.Register(
                "FixThem",
                AccessLevel.GameMaster,
                e =>
            {
                if (e == null || !(e.Mobile is PlayerMobile))
                {
                    return;
                }

                e.Mobile.SendMessage(0x22, "Target an online player to send them the FixMe gump.");
                e.Mobile.Target = new MobileSelectTarget <PlayerMobile>(
                    (m, target) =>
                {
                    if (target == null || target.Deleted)
                    {
                        return;
                    }

                    if (!target.IsOnline())
                    {
                        m.SendMessage(0x22, "{0} must be online.", target.RawName);
                        return;
                    }

                    m.SendMessage(0x55, "Opening FixMe gump for {0}...", target.RawName);

                    var g = SuperGump.Send(new FixMeGump(target));

                    if (OnGumpSend != null)
                    {
                        OnGumpSend(g);
                    }
                },
                    m => m.SendMessage(0x22, "Target an on-line player to send them the FixMe gump."));
            });
        }
예제 #22
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);
            }
        }
예제 #23
0
        private static void OnLogin(LoginEventArgs e)
        {
            var user = e.Mobile as PlayerMobile;

            if (user != null && !user.Deleted && user.NetState != null && user.AccessLevel >= CMOptions.Access &&
                CMOptions.LoginPopup)
            {
                SuperGump.Send(EnsureState(user).GetToolbarGump());
            }
        }
예제 #24
0
        protected virtual void OnProfilesCommand(CommandEventArgs e)
        {
            if (e.Mobile == null || e.Mobile.Deleted || !(e.Mobile is PlayerMobile))
            {
                return;
            }

            if (AutoPvP.CMOptions.ModuleEnabled || e.Mobile.AccessLevel >= AutoPvP.Access)
            {
                SuperGump.Send(new PvPProfileListGump((PlayerMobile)e.Mobile, null));
            }
        }
예제 #25
0
        protected override void CompileOptions(ToolbarGump toolbar, GumpButton clicked, Point loc, MenuGumpOptions opts)
        {
            if (toolbar == null)
            {
                return;
            }

            base.CompileOptions(toolbar, clicked, loc, opts);

            PlayerMobile user = toolbar.User;

            if (!CanEdit && user.AccessLevel < Toolbars.Access)
            {
                return;
            }

            opts.Replace(
                "Set Value",
                new ListGumpEntry(
                    "Set Command",
                    b => SuperGump.Send(
                        new InputDialogGump(user, toolbar)
            {
                Title     = "Set Command",
                Html      = "Set the command for this Command entry.",
                InputText = base.Value,
                Callback  = (cb, text) =>
                {
                    Value = text;
                    toolbar.Refresh(true);
                }
            }),
                    toolbar.HighlightHue));

            opts.AppendEntry(
                new ListGumpEntry(
                    "Set Args",
                    b => SuperGump.Send(
                        new InputDialogGump(user, toolbar)
            {
                Title     = "Set Command Arguments",
                Html      = "Set the Arguments for this Command entry.\nSeparate your entries with a semi-colon- ;",
                InputText = String.Join(";", Args),
                Callback  = (cb, text) =>
                {
                    Args.Clear();
                    Args.AddRange(text.Split(';'));
                    toolbar.Refresh(true);
                }
            }),
                    toolbar.HighlightHue));
        }
예제 #26
0
 private static void CMInvoke()
 {
     CommandUtility.Register(
         "AntiAds",
         Access,
         e =>
     {
         if (e.Mobile is PlayerMobile)
         {
             SuperGump.Send(new AntiAvertsReportsGump((PlayerMobile)e.Mobile));
         }
     });
 }
예제 #27
0
 private static void CSConfig()
 {
     CommandUtility.Register(
         "Schedules",
         Access,
         e =>
     {
         if (e != null && e.Mobile is PlayerMobile)
         {
             SuperGump.Send(new ScheduleListGump((PlayerMobile)e.Mobile));
         }
     });
 }
예제 #28
0
 public static void Initialize()
 {
     CommandSystem.Register(
         "MyCommands",
         AccessLevel.Player,
         e =>
     {
         if (e != null && e.Mobile is PlayerMobile)
         {
             SuperGump.Send(new MyCommandsGump((PlayerMobile)e.Mobile));
         }
     });
 }
예제 #29
0
        public override void OnDoubleClick(Mobile m)
        {
            if (!this.CheckDoubleClick(m, true, false, 2, true) || !(m is PlayerMobile))
            {
                return;
            }

            if (TitleHue == null)
            {
                m.SendMessage(0x22, "This ancient scroll has lost whatever power it once had.");
                m.PrivateOverheadMessage(MessageType.Label, 1287, true, "*The scroll disintegrates in your hands*", m.NetState);

                LoggingCustom.Log("HueScrollsInvalid.txt", String.Format("{0} -> {1} ({2})", m, this, TitleHue));

                Delete();

                return;
            }

            if (!CanConsume((PlayerMobile)m, true))
            {
                return;
            }

            var pm = (PlayerMobile)m;

            TitleProfile p = CustomTitles.EnsureProfile(pm);

            if (p == null)
            {
                return;
            }

            if (_Gump != null)
            {
                _Gump.Close(true);
                _Gump = null;
            }

            _Gump = SuperGump.Send(
                new ScrollConfirmGump(
                    pm,
                    null,
                    TitleHue,
                    b => GrantHue(pm, p),
                    b =>
            {
                pm.SendMessage(0x55, "You choose to not use the title hue scroll.");
                _Gump = null;
            }));
        }
예제 #30
0
        public virtual SuperGump GetToolbarGump()
        {
            if (User == null || User.Deleted || User.NetState == null)
            {
                if (_ToolbarGump != null)
                {
                    _ToolbarGump.Dispose();
                }

                return(_ToolbarGump = null);
            }

            return(_ToolbarGump == null || _ToolbarGump.IsDisposed ? (_ToolbarGump = new ToolbarGump(this)) : _ToolbarGump);
        }