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))); } }
public void HandleAdminCommand(CommandEventArgs e) { if (e.Mobile != null && !e.Mobile.Deleted && e.Mobile is PlayerMobile) { SuperGump.Send(new EquipmentSetsAdminUI((PlayerMobile)e.Mobile)); } }
public static void SendCentralGump(this PlayerMobile user) { if (user != null && !user.Deleted && user.NetState != null) { SuperGump.Send(new CentralGumpUI(user, EnsureProfile(user), CentralGumpType.News)); } }
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); })); }
public static void SendCentralGump(this PlayerMobile user) { if (user != null && !user.Deleted && user.NetState != null && CMOptions.ModuleEnabled) { SuperGump.Send(new UOFCentralGump(user, State.Root)); } }
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); }
public void HandleConfigCommand(CommandEventArgs e) { PlayerMobile pm = e.Mobile as PlayerMobile; if (pm != null && !pm.Deleted && pm.Alive) { SuperGump.Send(new MOTDMessageListGump(pm)); } }
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)); } }
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.")); }); }
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()); } }
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)); } }
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)); }
private static void CMInvoke() { CommandUtility.Register( "AntiAds", Access, e => { if (e.Mobile is PlayerMobile) { SuperGump.Send(new AntiAvertsReportsGump((PlayerMobile)e.Mobile)); } }); }
private static void CSConfig() { CommandUtility.Register( "Schedules", Access, e => { if (e != null && e.Mobile is PlayerMobile) { SuperGump.Send(new ScheduleListGump((PlayerMobile)e.Mobile)); } }); }
public static void Initialize() { CommandSystem.Register( "MyCommands", AccessLevel.Player, e => { if (e != null && e.Mobile is PlayerMobile) { SuperGump.Send(new MyCommandsGump((PlayerMobile)e.Mobile)); } }); }
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; })); }
protected virtual void OnBattlesCommand(CommandEventArgs e) { if (e.Mobile == null || e.Mobile.Deleted || !(e.Mobile is PlayerMobile)) { return; } if (!AutoPvP.CMOptions.ModuleEnabled && e.Mobile.AccessLevel < AutoPvP.Access) { return; } SuperGump.Send(new PvPBattlesUI(e.Mobile)); }
private static void CSConfig() { Core.CrashedHandler = OnServerCrashed; EventSink.Crashed += e => { if (!World.Loading && !World.Saving) { NotifyPlayers(); } }; BackupSource = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Saves/"); BackupTarget = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Backups/Crashed/"); ReportTarget = IOUtility.EnsureDirectory(Core.BaseDirectory + "/Reports/"); _CrashState = IOUtility.EnsureFile(VitaNexCore.CacheDirectory + "/CrashState.bin"); _LastOnline = new List <PlayerMobile>(); _CrashNotes = new List <CrashNote>(); CommandUtility.Register( "CrashGuard", Access, e => { if (e.Mobile is PlayerMobile) { SuperGump.Send(new CrashNoteListGump((PlayerMobile)e.Mobile)); } }); CommandUtility.Register( "Crash", AccessLevel.Administrator, e => { if (e.Mobile is PlayerMobile) { SuperGump.Send( new ConfirmDialogGump((PlayerMobile)e.Mobile) { Title = "Force Crash", Html = "Click OK to force the server to crash.", AcceptHandler = b => { throw new Exception("Forced Crash Exception"); } }); } }); }
public static void Initialize() { CommandSystem.Register( "MyCommands", AccessLevel.Player, e => { if (e == null || e.Mobile == null || !(e.Mobile is PlayerMobile)) { return; } SuperGump.Send(new MyCommandsGump(e.Mobile as PlayerMobile)); }); }
protected virtual bool PerformInquisition(PlayerMobile m, TimeSpan duration) { if (!Inquisition || m == null) { return(false); } SuperGump ig = CreateInquisitionGump(m, duration); if (ig != null) { return(ig.Send() == ig); } return(false); }
private static bool HandlePopupRequest(PlayerMobile user, MOTDMessage message) { if (user == null || user.Deleted) { return(false); } if (message == null) { user.SendMessage(0x22, "No message to display."); return(false); } SuperGump.Send(new MOTDMessageOverviewGump(user, selected: message)); return(true); }
public void HandleVoteCommand(CommandEventArgs e) { var m = e.Mobile as PlayerMobile; if (m == null || m.Deleted || m.NetState == null) { return; } if (ModuleEnabled || m.AccessLevel >= Voting.Access) { SuperGump.Send(new VoteGump(m)); } else { m.SendMessage(0x22, "Voting is currently out of service."); } }
public void HandleProfilesCommand(CommandEventArgs e) { var m = e.Mobile as PlayerMobile; if (m == null || m.Deleted || m.NetState == null) { return; } if (ModuleEnabled || m.AccessLevel >= TrashCollection.Access) { SuperGump.Send(new TrashCollectionProfilesGump(m)); } else { m.SendMessage(0x22, "Trash Collection is currently out of service."); } }
public virtual void Edit(ToolbarGump toolbar, Point loc, GumpButton clicked) { if (toolbar == null) { return; } PlayerMobile user = toolbar.State.User; if (user == null || user.Deleted || user.NetState == null) { return; } if (CanEdit || user.AccessLevel >= Toolbars.Access) { SuperGump.Send(new MenuGump(user, toolbar.Refresh(), GetOptions(toolbar, clicked, loc), clicked)); } }
public override void OnDoubleClick(Mobile from) { var voter = from as PlayerMobile; if (voter == null || voter.Deleted) { return; } var site = Voting.FindSite(SiteUID); if (site != null) { site.Vote(voter); } else if (voter.AccessLevel >= Voting.Access) { SuperGump.Send(new VoteAdminGump(voter)); } }
private static void OnLogin(PlayerMobile m) { if (m == null || !_LastOnline.Contains(m)) { return; } _LastOnline.Remove(m); if (!CSOptions.Notes || m.Deleted || !m.IsOnline()) { return; } var sb = new StringBuilder(); sb.AppendLine("{0} crashed while you were playing.", ServerList.ServerName); sb.AppendLine(); sb.AppendLine("We know this can be frustrating, but we are working hard to keep the server bug-free."); sb.AppendLine(); sb.AppendLine("If you have an idea as to what may have caused the last crash, please let us know!"); sb.AppendLine(); sb.AppendLine("Click OK to fill in a crash note, or Cancel to ignore this message."); string html = sb.ToString(); VitaNexCore.TryCatch( () => Timer.DelayCall( TimeSpan.FromSeconds(3.0), () => SuperGump.Send( new ConfirmDialogGump(m) { Title = "Crash Note", Html = html, Modal = false, CanDispose = false, CanMove = false, AcceptHandler = b1 => SuperGump.Send(new CrashNoteSubmitGump(m)) })), CSOptions.ToConsole); }
public void HandlePopupCommand(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; } SuperGump.Send(Toolbars.EnsureState(user).GetToolbarGump()); }
protected virtual void OnBattlesCommand(CommandEventArgs e) { if (e.Mobile == null || e.Mobile.Deleted || !(e.Mobile is PlayerMobile)) { return; } if (!AutoPvP.CMOptions.ModuleEnabled && e.Mobile.AccessLevel < AutoPvP.Access) { return; } if (AutoPvP.CMOptions.Advanced.Misc.UseCategories) { SuperGump.Send(new PvPBattleCategoryListGump((PlayerMobile)e.Mobile)); } else { SuperGump.Send(new PvPBattleListGump((PlayerMobile)e.Mobile)); } }
public static void HandlePositionCommand(PlayerMobile user) { if (user == null || user.Deleted || user.NetState == null || !CMOptions.ModuleEnabled) { return; } var e = new CastBarRequestEventArgs(user, GetOffset(user)); if (OnCastBarRequest != null) { OnCastBarRequest(e); } if (e.Gump == null) { CastBarRequestHandler(e); } if (e.Gump == null) { return; } e.Gump.Preview = true; SuperGump.Send( new OffsetSelectorGump( user, e.Gump.Refresh(true), e.Location, (self, oldValue) => { SetOffset(self.User, self.Value); self.User.SendMessage(0x55, "Cast-Bar position set to X({0:#,0}), Y({1:#,0}).", self.Value.X, self.Value.Y); e.Gump.X = self.Value.X; e.Gump.Y = self.Value.Y; e.Gump.Refresh(true); })); }
protected void BeginRename(PlayerMobile m) { if (m == null || m.Deleted) { return; } _NameInput = SuperGump.Send( new InputDialogGump(m) { Limit = 16, Title = "Name Your Entity", Html = "Give your talisman entity a name!\n\n" + "Name length must be between 1 and 16 letters and contain no invalid characters, numbers, or white-space.\n\n" + "When you're done, click OK to summon your entity!", AcceptHandler = b => _NameInput = null, CancelHandler = b => { _NameInput = null; m.SendMessage("You decide not to name your entity."); }, Callback = (b, t) => { if (VerifyName(m, t, true) != NameResultMessage.Allowed) { return; } EntityName = t; SummonEntity(m); } }); }