public static void Password_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; Account acct = from.Account as Account; if (acct == null) { return; } IPAddress[] accessList = acct.LoginIPs; if (accessList.Length == 0) { return; } NetState ns = from.NetState; if (ns == null) { return; } if (e.Length == 0) { from.SendMessage("You must specify the new password."); return; } else if (e.Length == 1) { from.SendMessage("To prevent potential typing mistakes, you must type the password twice. Use the format:"); from.SendMessage("Password \"(newPassword)\" \"(repeated)\""); return; } string pass = e.GetString(0); string pass2 = e.GetString(1); if (pass != pass2) { from.SendMessage("The passwords do not match."); return; } bool isSafe = true; for (int i = 0; isSafe && i < pass.Length; ++i) { isSafe = (pass[i] >= 0x20 && pass[i] < 0x80); } if (!isSafe) { from.SendMessage("That is not a valid password."); return; } try { IPAddress ipAddress = ns.Address; if (Utility.IPMatchClassC(accessList[0], ipAddress)) { acct.SetPassword(pass); from.SendMessage("The password to your account has changed."); } else { PageEntry entry = PageQueue.GetEntry(from); if (entry != null) { if (entry.Message.StartsWith("[Automated: Change Password]")) { from.SendMessage("You already have a password change request in the help system queue."); } else { from.SendMessage("Your IP address does not match that which created this account."); } } else if (PageQueue.CheckAllowedToPage(from)) { from.SendMessage("Your IP address does not match that which created this account. A page has been entered into the help system on your behalf."); from.SendLocalizedMessage(501234, "", 0x35); /* The next available Counselor/Game Master will respond as soon as possible. * Please check your Journal for messages every few minutes. */ PageQueue.Enqueue(new PageEntry(from, String.Format("[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0]), PageType.Account)); } } } catch { } }
public static void Next(string input) { if (Core.Crashed) { return; } input = input.ToLower(); if (input.StartsWith("bc")) { var sub = input.Replace("bc", ""); BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Admin] {0}", sub)); Console.WriteLine("Players will see: {0}", sub); } else if (input.StartsWith("sc")) { var sub = input.Replace("staff", ""); BroadcastMessage(AccessLevel.Counselor, 0x32, String.Format("[Admin] {0}", sub)); Console.WriteLine("Staff will see: {0}", sub); } else if (input.StartsWith("ban")) { var sub = input.Replace("ban", ""); var states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no players online."); } foreach (var t in states) { var a = t.Account as Account; if (a == null) { continue; } var m = t.Mobile; if (m == null) { continue; } sub = sub.ToLower(); if (m.Name.ToLower() != sub.Trim()) { continue; } var m_ns = m.NetState; Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username); a.Banned = true; m_ns.Dispose(); Console.WriteLine("Banning complete."); } } else if (input.StartsWith("kick")) { var sub = input.Replace("kick", ""); var states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no players online."); } foreach (var t in states) { var a = t.Account as Account; if (a == null) { continue; } var m = t.Mobile; if (m == null) { continue; } sub = sub.ToLower(); if (m.Name.ToLower() != sub.Trim()) { continue; } var m_ns = m.NetState; Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username); m_ns.Dispose(); Console.WriteLine("Kicking complete."); } } else { switch (input.Trim()) { case "shutdown": { AutoSave.Save(); Core.Kill(false); } break; case "shutdown nosave": { Core.Kill(false); } break; case "restart": { AutoSave.Save(); Core.Kill(true); } break; case "restart nosave": { Core.Kill(true); } break; case "online": { var states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no users online at this time."); } foreach (var t in states) { var a = t.Account as Account; if (a == null) { continue; } var m = t.Mobile; if (m != null) { Console.WriteLine("- Account: {0}, Name: {1}, IP: {2}", a.Username, m.Name, t); } } } break; case "save": World.Save(); break; case "hear": //credit to Zippy for the HearAll script! { _HearConsole = !_HearConsole; Console.WriteLine( _HearConsole ? "Now sending all speech to the console." : "No longer sending speech to the console."); } break; case "pages": { Paging = true; var list = PageQueue.List; PageEntry e; for (var i = 0; i < list.Count;) { e = (PageEntry)list[i]; if (e.Sender.Deleted || e.Sender.NetState == null) { e.AddResponse(e.Sender, "[Logout]"); PageQueue.Remove(e); } else { ++i; } } _List = (PageEntry[])list.ToArray(typeof(PageEntry)); if (_List.Length > 0) { for (var i = 0; i < _List.Length; ++i) { e = _List[i]; var type = PageQueue.GetPageTypeName(e.Type); Console.WriteLine("--------------Page Number: " + i + " --------------------"); Console.WriteLine("Player :" + e.Sender.Name); Console.WriteLine("Catagory :" + type); Console.WriteLine("Message :" + e.Message); } Console.WriteLine("Type the number of the page to respond to."); ThreadPool.QueueUserWorkItem(PageResp, new object[] { 1, 2 }); } else { Console.WriteLine("No pages to display."); Paging = false; } } break; //case "help": //case "list": default: { Console.WriteLine(" "); Console.WriteLine("Commands:"); Console.WriteLine("save - Performs a save."); Console.WriteLine("shutdown - Performs a save, then shuts down the server"); Console.WriteLine("shutdown nosave - Shuts down the server without saving"); Console.WriteLine("restart - Performs a save, then restarts the server"); Console.WriteLine("restart nosave - Restarts the server without saving"); Console.WriteLine("online - Shows a list of every person online:"); Console.WriteLine(" Account, Char Name, IP"); Console.WriteLine("bc <message> - Sends a message to all players"); Console.WriteLine("sc <message> - Sends a message to all staff"); Console.WriteLine("hear - Forwards all local speech to this console:"); Console.WriteLine(" Char Name (Region name): Speech"); Console.WriteLine("pages - Manage help pages"); Console.WriteLine("ban <name> - Kicks and bans the user"); Console.WriteLine("kick <name> - Kicks the user"); Console.WriteLine("list or help - Shows this list"); Console.WriteLine(" "); } break; } } if (!Paging) { ThreadPool.QueueUserWorkItem(ConsoleListen); } }
public static void PageResp(object obj) { if (Core.Crashed) { return; } Paging = true; var objects = (object[])obj; var w = (int)objects[0]; var pag = (int)objects[1]; int paG; if (w == 1) { up: try { paG = Convert.ToInt32(Console.ReadLine()); } catch { Console.WriteLine("Thats not a number,try again."); goto up; } Console.WriteLine("Type your response"); ThreadPool.QueueUserWorkItem(PageResp, new object[] { 2, paG }); } else { var resp = Console.ReadLine(); var list = PageQueue.List; _List = (PageEntry[])list.ToArray(typeof(PageEntry)); if (_List.Length > 0) { if (pag > _List.Length) { Console.WriteLine("Error: Not a valid page number"); } else { for (var i = 0; i < _List.Length; ++i) { var e = _List[i]; if (i != pag) { continue; } e.Sender.SendGump(new MessageSentGump(e.Sender, "Admin", resp)); PageQueue.Remove(e); Console.WriteLine("Message Sent..."); } } } else { Console.WriteLine("There are no pages to display."); } } Paging = false; ThreadPool.QueueUserWorkItem(ConsoleListen); }
private static void HandlePaging(string sub) { if (sub.StartsWith("help", StringComparison.OrdinalIgnoreCase) || sub.StartsWith("?", StringComparison.OrdinalIgnoreCase)) { DisplayPagingHelp(); HandlePaging(String.Empty); return; } if (PageQueue.List.Count == 0) { Console.WriteLine("There are no pages in the queue."); if (_Pages != null) { _Pages = null; Console.WriteLine("[Pages]: Disabled page mode."); } return; } if (String.IsNullOrWhiteSpace(sub)) { if (_Pages == null) { Console.WriteLine("[Pages]: Enabled page mode."); DisplayPagingHelp(); } _Pages = PageQueue.List.Cast <PageEntry>().ToArray(); const string format = "{0:D3}:\t{1}\t{2}"; for (int i = 0; i < _Pages.Length; i++) { Console.WriteLine(format, i + 1, _Pages[i].Type, _Pages[i].Sender); } return; } if (sub.StartsWith("exit", StringComparison.OrdinalIgnoreCase)) { if (_Pages != null) { _Pages = null; Console.WriteLine("[Pages]: Disabled page mode."); } return; } if (sub.StartsWith("clear", StringComparison.OrdinalIgnoreCase)) { if (_Pages != null) { foreach (PageEntry page in _Pages) { PageQueue.Remove(page); } Console.WriteLine("[Pages]: Queue cleared."); Array.Clear(_Pages, 0, _Pages.Length); _Pages = null; Console.WriteLine("[Pages]: Disabled page mode."); } return; } if (sub.StartsWith("remove", StringComparison.OrdinalIgnoreCase)) { string[] args; PageEntry page = FindPage(sub, out args); if (page == null) { Console.WriteLine("[Pages]: Invalid page entry."); } else { PageQueue.Remove(page); Console.WriteLine("[Pages]: Removed from queue."); } HandlePaging(String.Empty); return; } if (sub.StartsWith("handle", StringComparison.OrdinalIgnoreCase)) { string[] args; PageEntry page = FindPage(sub, out args); if (page == null) { Console.WriteLine("[Pages]: Invalid page entry."); HandlePaging(String.Empty); return; } if (args.Length <= 0) { Console.WriteLine("[Pages]: Message required."); HandlePaging(String.Empty); return; } page.Sender.SendGump(new MessageSentGump(page.Sender, ServerList.ServerName, String.Join(" ", args))); Console.WriteLine("[Pages]: Message sent."); PageQueue.Remove(page); Console.WriteLine("[Pages]: Removed from queue."); HandlePaging(String.Empty); return; } if (sub.StartsWith("view", StringComparison.OrdinalIgnoreCase)) { string[] args; PageEntry page = FindPage(sub, out args); if (page == null) { Console.WriteLine("[Pages]: Invalid page entry."); HandlePaging(String.Empty); return; } int idx = Array.IndexOf(_Pages, page) + 1; Console.WriteLine("[Pages]: {0:D3}:\t{1}\t{2}", idx, page.Type, page.Sender); if (!String.IsNullOrWhiteSpace(page.Message)) { Console.WriteLine("[Pages]: {0}", page.Message); } else { Console.WriteLine("[Pages]: No message supplied."); } HandlePaging(String.Empty); return; } if (_Pages != null) { string[] args; PageEntry page = FindPage(sub, out args); if (page != null) { int idx = Array.IndexOf(_Pages, page) + 1; Console.WriteLine("[Pages]: {0:D3}:\t{1}\t{2}", idx, page.Type, page.Sender); if (!String.IsNullOrWhiteSpace(page.Message)) { Console.WriteLine("[Pages]: {0}", page.Message); } else { Console.WriteLine("[Pages]: No message supplied."); } HandlePaging(String.Empty); return; } Array.Clear(_Pages, 0, _Pages.Length); _Pages = null; Console.WriteLine("[Pages]: Disabled page mode."); } }
public static void Next(string nput) { string input = nput.ToLower(); if (input.StartsWith("bc")) { string imput = input.Replace("bc", ""); BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Admin] {0}", imput)); Console.WriteLine("Players will see: {0}", imput); } else if (input.StartsWith("sc")) { string imput = input.Replace("staff", ""); BroadcastMessage(AccessLevel.Counselor, 0x32, String.Format("[Admin] {0}", imput)); Console.WriteLine("Staff will see: {0}", imput); } else if (input.StartsWith("ban")) { string imput = input.Replace("ban", ""); ArrayList list = new ArrayList(); List <NetState> states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no players online."); } for (int i = 0; i < states.Count; ++i) { Account a = states[i].Account as Account; if (a == null) { continue; } Mobile m = states[i].Mobile; if (m == null) { continue; } string innput = imput.ToLower(); if (m.Name.ToLower() == innput.Trim()) { NetState m_ns = m.NetState; Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username); a.Banned = true; m_ns.Dispose(); Console.WriteLine("Banning complete."); } } } else if (input.StartsWith("kick")) { string imput = input.Replace("kick", ""); ArrayList list = new ArrayList(); List <NetState> states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no players online."); } for (int i = 0; i < states.Count; ++i) { Account a = states[i].Account as Account; if (a == null) { continue; } Mobile m = states[i].Mobile; if (m == null) { continue; } string innput = imput.ToLower(); if (m.Name.ToLower() == innput.Trim()) { NetState m_ns = m.NetState; Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username); m_ns.Dispose(); Console.WriteLine("Kicking complete."); } } } else { switch (input.Trim()) { case "shutdown": { Misc.AutoSave.Save(); Core.Process.Kill(); break; } case "shutdown nosave": Core.Process.Kill(); break; case "restart": { BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Server] We are restarting...")); Misc.AutoSave.Save(); Process.Start(Core.ExePath, Core.Arguments); Core.Process.Kill(); break; } case "restart nosave": Process.Start(Core.ExePath, Core.Arguments); Core.Process.Kill(); break; case "online": { ArrayList list = new ArrayList(); List <NetState> states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no users online at this time."); } for (int i = 0; i < states.Count; ++i) { Account a = states[i].Account as Account; if (a == null) { continue; } Mobile m = states[i].Mobile; if (m != null) { Console.WriteLine("- Account: {0}, Name: {1}, IP: {2}", a.Username, m.Name, states[i]); } } break; } case "save": Misc.AutoSave.Save(); break; case "hear": //credit to Zippy for the HearAll script! { Hearconsole = !Hearconsole; if (Hearconsole) { Console.WriteLine("Now sending all speech to the console."); } else { Console.WriteLine("No longer sending speech to the console."); } break; } case "pages": { paging = true; ArrayList list = PageQueue.List; PageEntry e; for (int i = 0; i < list.Count;) { e = (PageEntry)list[i]; if (e.Sender.Deleted || e.Sender.NetState == null) { e.AddResponse(e.Sender, "[Logout]"); PageQueue.Remove(e); } else { ++i; } } m_List = (PageEntry[])list.ToArray(typeof(PageEntry)); if (m_List.Length > 0) { for (int i = 0; i < m_List.Length; ++i) { e = m_List[i]; string type = PageQueue.GetPageTypeName(e.Type); Console.WriteLine("--------------Page Number: " + i + " --------------------"); Console.WriteLine("Player :" + e.Sender.Name); Console.WriteLine("Catagory :" + type); Console.WriteLine("Message :" + e.Message); } Console.WriteLine("Type the number of the page to respond to."); object[] oj = new object[] { 1, 2 }; ThreadPool.QueueUserWorkItem(new WaitCallback(PageResp), oj); } else { Console.WriteLine("No pages to display."); paging = false; } break; } case "help": case "list": //Credit to HomeDaddy for this wonderful list! default: { Console.WriteLine(" "); Console.WriteLine("Commands:"); Console.WriteLine("save - Performs a forced save."); Console.WriteLine("shutdown - Performs a forced save then shuts down the server."); Console.WriteLine("shutdown nosave - Shuts down the server without saving."); Console.WriteLine("restart - Sends a message to players informing them that the server is"); Console.WriteLine(" restarting, performs a forced save, then shuts down and"); Console.WriteLine(" restarts the server."); Console.WriteLine("restart nosave - Restarts the server without saving."); Console.WriteLine("online - Shows a list of every person online:"); Console.WriteLine(" Account, Char Name, IP."); Console.WriteLine("bc <message> - Type this command and your message after it. It will then be"); Console.WriteLine(" sent to all players."); Console.WriteLine("sc <message> - Type this command and your message after it.It will then be "); Console.WriteLine(" sent to all staff."); Console.WriteLine("hear - Copies all local speech to this console:"); Console.WriteLine(" Char Name (Region name): Speech."); Console.WriteLine("pages - Shows all the pages in the page queue,you type the page"); Console.WriteLine(" number ,then you type your response to the player."); Console.WriteLine("ban <playername>- Kicks and bans the users account."); Console.WriteLine("kick <playername>- Kicks the user."); Console.WriteLine("list or help - Shows this list."); Console.WriteLine(" "); break; } } } if (!paging) { ThreadPool.QueueUserWorkItem(new WaitCallback(ConsoleListen)); } }
protected override void CompileLayout(SuperGumpLayout layout) { layout.Add( "background", () => { AddImageTiled(40, 80, 44, 458, 202); AddImage(40, 39, 206); AddImageTiled(80, 38, 422, 45, 201); AddImage(40, 538, 204); AddImageTiled(495, 71, 44, 469, 203); AddImage(496, 39, 207); AddImageTiled(84, 539, 417, 43, 233); AddImageTiled(75, 82, 446, 459, 200); AddImage(171, 16, 1419); AddImage(248, -1, 1417); AddImage(257, 8, 5545); AddImage(496, 538, 205); AddImageTiled(81, 92, 420, 12, 50); AddImageTiled(81, 518, 420, 12, 50); }); layout.Add("SideButtons", () => { AddButton(0, 87, 224, 223, b => { new CentralGumpUI(User, CentralGump.EnsureProfile(User), CentralGumpType.News).Send(); }); AddButton(0, 154, 222, 221, b => { new CentralGumpUI(User, CentralGump.EnsureProfile(User), CentralGumpType.Links).Send(); }); AddButton(0, 286, 220, 219, b => { new CentralGumpUI(User, CentralGump.EnsureProfile(User), CentralGumpType.Information).Send(); }); AddButton(0, 352, 218, 217, b => { new CentralGumpUI(User, CentralGump.EnsureProfile(User), CentralGumpType.Commands).Send(); }); AddButton(525, 87, 230, 229, b => { new CentralGumpUI(User, CentralGump.EnsureProfile(User), CentralGumpType.Profile).Send(); }); AddButton(525, 154, 232, 231, b => { new CentralGumpUI(User, CentralGump.EnsureProfile(User), CentralGumpType.Options).Send(); }); AddButton(525, 286, 228, 227, b => { new CentralGumpUI(User, CentralGump.EnsureProfile(User), CentralGumpType.Events).Send(); }); AddButton(525, 352, 234, 234, b => { Refresh(true); }); }); var acct = User.Account as Account; if (acct != null && acct.Young || User.Companion) { layout.Add("Young", () => { if (acct != null && acct.Young || User.AccessLevel >= AccessLevel.GameMaster) { AddHtml(115, 74, 513, 18, String.Format("<BIG>{0}</BIG>", "Ultima Online: Forever - Young Player Program") .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); AddHtml(95, 112, 155, 17, String.Format("<BIG>{0}</BIG>", "Time Left as Young") .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); AddHtml(95, 135, 165, 17, String.Format("<BIG>{0}</BIG>", ((int)Math.Ceiling(acct.GetYoungTime().TotalHours) + "/" + (int)Math.Ceiling(Account.YoungDuration.TotalHours) + " Hours Left")) .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); AddHtml(345, 112, 155, 17, String.Format("<BIG>{0}</BIG>", "Skill Points Left") .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); AddHtml(345, 135, 200, 25, String.Format("<BIG>{0}</BIG>", 600 - User.SkillsTotal / 10 + "/600" + " Skill Points") .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); AddHtml(95, 175, 390, 80, String.Format( "<BIG>You have {0} hours left as a young player. You will also reach mature status if you gain {1} more skill points.</BIG>", (int)Math.Ceiling(acct.GetYoungTime().TotalHours), 600 - (User.SkillsTotal / 10)) .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); if (User.Guild == null) { AddButton(305, 260, 4005, 4007, b => { var g = (Guild)BaseGuild.FindByAbbrev("New"); if (g != null && User.Guild == null) { Refresh(true); User.SendGump(new NewPlayerGuildJoinGump(g, User)); } }); AddLabel(340, 260, 2049, "Join the new player guild?"); } AddButton(305, 285, 4005, 4007, b => { if (Profile.LastBritainTeleport <= DateTime.UtcNow && User.PokerGame == null) { User.Map = Map.Felucca; User.MoveToWorld(new Point3D(1438, 1690, 0), Map.Felucca); User.SendMessage(54, "You have been teleported to the West Britain Bank."); Profile.LastBritainTeleport = DateTime.UtcNow + TimeSpan.FromMinutes(5); } else if (User.PokerGame == null) { User.SendMessage(54, "You cannot teleport to West Britain Bank for another " + (int) Math.Ceiling( (Profile.LastBritainTeleport - DateTime.UtcNow).TotalMinutes) + " minute(s)."); } else { User.SendMessage(61, "You cannot use this while playing a poker game."); } }); AddLabel(340, 285, 2049, "Travel to Britain?"); AddButton(305, 310, 4005, 4007, b => { if (Profile.LastDungeonTeleport <= DateTime.UtcNow && User.PokerGame == null) { User.Map = Map.Ilshenar; User.MoveToWorld(new Point3D(2182, 18, -32), Map.Ilshenar); User.SendMessage(54, "You have been teleported to the New Player Dungeon."); Profile.LastDungeonTeleport = DateTime.UtcNow + TimeSpan.FromMinutes(5); } else if (User.PokerGame == null) { User.SendMessage(54, "You cannot teleport to the New Player Dungeon for another " + (int)Math.Ceiling((Profile.LastDungeonTeleport - DateTime.UtcNow).TotalMinutes) + " minute(s)."); } else { User.SendMessage(61, "You cannot use this while playing a poker game."); } }); AddLabel(340, 310, 2049, "Travel to Young Dungeon?"); AddButton(305, 335, 4005, 4007); AddLabel(340, 335, 2049, "Page a Companion?"); AddButton(305, 360, 4005, 4007, b => { Refresh(true); if (User.NetState.Gumps.OfType <HelpGump>().Any()) { return; } if (!PageQueue.CheckAllowedToPage(User)) { return; } if (PageQueue.Contains(User)) { User.SendMenu(new ContainedMenu(User)); } else { User.SendGump(new Help.HelpGump(User)); } }); AddLabel(340, 360, 2049, "Page a GM?"); AddButton(305, 480, 4005, 4007, b => new DialogGump(User, this, 0, 0, null, null, 7004, a => { acct.Young = false; User.SendMessage(54, "You have successfully left the Young Player Program."); CentralGump.Adventurers.Remove(User); }, c => { Refresh(true); }) { Title = "Leave the Young Player Program?", Html = "Are you sure you wish to leave the Young Player Program?", HtmlColor = DefaultHtmlColor }.Send() ); AddLabel(340, 480, 2049, "Leave the Young Player"); AddLabel(340, 495, 2049, "Program?"); } if (User.Companion && acct != null && !acct.Young) { AddHtml(109, 74, 513, 18, String.Format("<BIG>{0}</BIG>", "Ultima Online: Forever - Companion Control Panel") .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); AddBackground(61, 107, 454, 125, 3500); AddLabel(86, 114, 2049, "Companion Message of the Day"); AddButton(305, 250, 4005, 4007); AddLabel(340, 250, 2049, "Set MotD?"); AddButton(305, 280, 4005, 4007); AddLabel(340, 280, 2049, "Answer Companion Pages?"); } AddBackground(61, 250, 245, 267, 3500); AddLabel(186, 260, 2049, "Join"); AddLabel(85, 260, 2049, "Name"); AddLabel(67, 233, 2049, "Adventuring Partners"); AddLabel(230, 260, 2049, "Members"); if (!CentralGump.Adventurers.Contains(User)) { AddButton(305, 420, 4005, 4007, b => { if (User.Party == null || Party.Get(User).Leader == User) { CentralGump.Adventurers.Add(User); User.SendMessage(54, "You have signed up to start an adventure."); Refresh(true); } else { User.SendMessage(54, "Only the leader of your party may sign up for an adventure."); } }); AddLabel(340, 420, 2049, "Join the adventuring"); AddLabel(340, 435, 2049, "list?"); } else { AddButton(305, 420, 4005, 4007, b => { CentralGump.Adventurers.Remove(User); User.SendMessage(54, "You have removed yourself from the adventuring list."); Refresh(true); }); AddLabel(340, 420, 2049, "Remove yourself from the"); AddLabel(340, 435, 2049, "adventuring list?"); } if (PageCount - 1 > Page) { AddButton(266, 485, 5601, 5605, NextPage); } if (Page > 0) { AddButton(240, 485, 5603, 5607, PreviousPage); } }) ; Dictionary <int, PlayerMobile> range = GetListRange(); if (range.Count > 0) { CompileEntryLayout(layout, range); } } else { AddHtml(116, 74, 513, 18, String.Format("<BIG>{0}</BIG>", "Ultima Online: Forever - Companion Application") .WrapUOHtmlColor(KnownColor.GhostWhite), false, false); } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; PageType type = (PageType)(-1); switch (info.ButtonID) { case 1: { //BaseHouse house = BaseHouse.FindHouseAt(from); //if (house != null && house.IsAosRules) //{ // from.Location = house.BanLocation; //} //else if (from.Region.IsPartOf(typeof(Server.Regions.Jail))) //{ // from.SendLocalizedMessage(1041530, "", 0x35); // You'll need a better jailbreak plan then that! //} //else if (Factions.Sigil.ExistsOn(from)) //{ // from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. //} //else if (from.CanUseStuckMenu() && from.Region.CanUseStuckMenu(from) && !CheckCombat(from) && !from.Frozen && !from.Criminal && (Core.AOS || from.Kills < 5)) //{ // StuckMenu menu = new StuckMenu(from, from, true); // menu.BeginClose(); // from.SendGump(menu); //} //else //{ // type = PageType.Stuck; //} if (from.Region.IsPartOf(typeof(Server.Regions.Jail))) { from.SendLocalizedMessage(1041530, "", 0x35); // You'll need a better jailbreak plan then that! return; } from.SendMessage("Voce sera Teleportado para StarRoom em aproximadamente 2 minutos."); new TeleportTimer(from, TimeSpan.FromMinutes(2.5)).Start(); break; } case 2: type = PageType.Question; break; case 3: type = PageType.Bug; break; case 4: caller.LaunchBrowser(@"http://www.dimensnewage.com.br"); break; case 0: default: break; } if (type != (PageType)(-1) && PageQueue.CheckAllowedToPage(caller)) { caller.SendGump(new PagePromptGump(caller, type)); } }
/// <summary> /// Constructor /// </summary> public PageManager(SceneNode rootNode) { if (instance != null) { throw new ApplicationException("PageManager.Constructor() called twice!"); } instance = this; sceneRoot = rootNode; currentCameraPageX = 0; currentCameraPageZ = 0; currentCameraTileX = 0; currentCameraTileZ = 0; lastCameraPageState = CameraPageState.Change; lastCameraPos = new Vector3(-999999, 9999999, -999999); pause = 99; width = Options.Instance.World_Width; heigth = Options.Instance.World_Height; pageLoadQueue = new PageQueue(); pageUnloadQueue = new PageQueue(); pagePreloadQueue = new PageQueue(); pagePostunloadQueue = new PageQueue(); //setup the page array. // mPages.reserve (mWidth); // mPages.resize (mWidth); pages = new Pages(width); for (long i = 0; i < width; i++) { PageRow pr = new PageRow(heigth); // mPages[ i ].reserve (mHeigth); // mPages[ i ].resize (mHeigth); for (long j = 0; j < heigth; j++) { pr.Add(new Page(i, j)); } pages.Add(pr); } for (long j = 0; j < heigth; j++) { for (long i = 0; i < width; i++) { if (j != heigth - 1) { pages[i][j].SetNeighbor(Neighbor.South, pages[i][j + 1]); pages[i][j + 1].SetNeighbor(Neighbor.North, pages[i][j]); } if (i != width - 1) { pages[i][j].SetNeighbor(Neighbor.East, pages[i + 1][j]); pages[i + 1][j].SetNeighbor(Neighbor.West, pages[i][j]); } } } }
private static void Pages(NetState state, PacketReader pvSrc) // 0x08 { ArrayList list = PageQueue.List; int identifier = pvSrc.ReadInt32(); byte subID = pvSrc.ReadByte(); Mobile sender = World.FindMobile(identifier); if (sender == null) { return; } PageEntry e = PageQueue.GetEntry(sender); if (e == null) // no such page { return; } switch (subID) { case 0x01: // Handle { bool handle = pvSrc.ReadBoolean(); Mobile from = RemoteAdminHandlers.ConfirmMobile((Account)state.Account, pvSrc.ReadInt32()); if (from != null && (e.Handler == null || e.Handler == from)) { e.Handler = handle ? from : null; } //Console.WriteLine( "Handle: {0} handler: {1}", handle, from != null ? from.Name : "none" ); break; } case 0x02: // Remove { PageQueue.Remove(e); break; } case 0x03: // Predefined { byte messageIndex = pvSrc.ReadByte(); Mobile from = RemoteAdminHandlers.ConfirmMobile((Account)state.Account, pvSrc.ReadInt32()); ArrayList preresp = PredefinedResponse.List; if (from != null && messageIndex >= 0 && messageIndex < preresp.Count) { e.Sender.SendGump(new MessageSentGump(e.Sender, from.Name, ((PredefinedResponse)preresp[messageIndex]).Message)); } break; } case 0x04: // Answer { Mobile from = RemoteAdminHandlers.ConfirmMobile((Account)state.Account, pvSrc.ReadInt32()); string message = pvSrc.ReadString(); if (from != null) { e.Sender.SendGump(new MessageSentGump(e.Sender, from.Name, message)); } break; } } }
public static void Next(string input) { input = input.ToLower(); if (input.StartsWith("bc")) { string sub = input.Replace("bc", ""); BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Admin] {0}", sub)); Console.WriteLine("Players will see: {0}", sub); } else if (input.StartsWith("sc")) { string sub = input.Replace("staff", ""); BroadcastMessage(AccessLevel.Counselor, 0x32, String.Format("[Admin] {0}", sub)); Console.WriteLine("Staff will see: {0}", sub); } else if (input.StartsWith("ban")) { string sub = input.Replace("ban", ""); var states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no players online."); } foreach (NetState t in states) { Account a = t.Account as Account; if (a == null) { continue; } Mobile m = t.Mobile; if (m == null) { continue; } sub = sub.ToLower(); if (m.Name.ToLower() != sub.Trim()) { continue; } NetState m_ns = m.NetState; Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username); a.Banned = true; m_ns.Dispose(); Console.WriteLine("Banning complete."); } } else if (input.StartsWith("kick")) { string sub = input.Replace("kick", ""); var states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no players online."); } foreach (NetState t in states) { Account a = t.Account as Account; if (a == null) { continue; } Mobile m = t.Mobile; if (m == null) { continue; } sub = sub.ToLower(); if (m.Name.ToLower() != sub.Trim()) { continue; } NetState m_ns = m.NetState; Console.WriteLine("Mobile name: '{0}' Account name: '{1}'", m.Name, a.Username); m_ns.Dispose(); Console.WriteLine("Kicking complete."); } } else { switch (input.Trim()) { case "shutdown": { AutoSave.Save(); Core.Process.Kill(); } break; case "shutdown nosave": Core.Process.Kill(); break; case "restart": { BroadcastMessage(AccessLevel.Player, 0x35, String.Format("[Server] We are restarting...")); AutoSave.Save(); // this really should call Core.Kill rather than Core.Process.Kill // to avoid duplicating logic --sith Core.Kill(true); } break; case "restart nosave": { Core.Kill(true); } break; case "online": { var states = NetState.Instances; if (states.Count == 0) { Console.WriteLine("There are no users online at this time."); } foreach (NetState t in states) { Account a = t.Account as Account; if (a == null) { continue; } Mobile m = t.Mobile; if (m != null) { Console.WriteLine("- Account: {0}, Name: {1}, IP: {2}", a.Username, m.Name, t); } } } break; case "save": AutoSave.Save(); break; case "hear": { _HearConsole = !_HearConsole; Console.WriteLine( _HearConsole ? "Now sending all speech to the console." : "No longer sending speech to the console."); } break; case "pages": { Paging = true; ArrayList list = PageQueue.List; PageEntry e; for (int i = 0; i < list.Count;) { e = (PageEntry)list[i]; if (e.Sender.Deleted || e.Sender.NetState == null) { e.AddResponse(e.Sender, "[Logout]"); PageQueue.Remove(e); } else { ++i; } } _List = (PageEntry[])list.ToArray(typeof(PageEntry)); if (_List.Length > 0) { for (int i = 0; i < _List.Length; ++i) { e = _List[i]; string type = PageQueue.GetPageTypeName(e.Type); Console.WriteLine("--------------Page Number: " + i + " --------------------"); Console.WriteLine("Player :" + e.Sender.Name); Console.WriteLine("Category :" + type); Console.WriteLine("Message :" + e.Message); } Console.WriteLine("Type the number of the page to respond to."); ThreadPool.QueueUserWorkItem(PageResp, new object[] { 1, 2 }); } else { Console.WriteLine("No pages to display."); Paging = false; } } break; //case "help": //case "list": default: { Console.WriteLine(" "); Console.WriteLine("Commands:"); Console.WriteLine("save - Performs a forced save."); Console.WriteLine("shutdown - Performs a forced save then shuts down the server."); Console.WriteLine("shutdown nosave - Shuts down the server without saving."); Console.WriteLine( "restart - Sends a message to players informing them that the server is"); Console.WriteLine( " restarting, performs a forced save, then shuts down and"); Console.WriteLine(" restarts the server."); Console.WriteLine("restart nosave - Restarts the server without saving."); Console.WriteLine("online - Shows a list of every person online:"); Console.WriteLine(" Account, Char Name, IP."); Console.WriteLine( "bc <message> - Type this command and your message after it. It will then be"); Console.WriteLine(" sent to all players."); Console.WriteLine( "sc <message> - Type this command and your message after it.It will then be "); Console.WriteLine(" sent to all staff."); Console.WriteLine("hear - Copies all local speech to this console:"); Console.WriteLine(" Char Name (Region name): Speech."); Console.WriteLine("pages - Shows all the pages in the page queue,you type the page"); Console.WriteLine(" number ,then you type your response to the player."); Console.WriteLine("ban <playername>- Kicks and bans the users account."); Console.WriteLine("kick <playername>- Kicks the user."); Console.WriteLine("list or help - Shows this list."); Console.WriteLine(" "); } break; } } if (!Paging) { ThreadPool.QueueUserWorkItem(ConsoleListen); } }