public override void OnResponse(int hue) { if (m_Player == null || m_Player.Deleted) { return; } ChatPersistance.CheckAndCreateWorldChatAccountEntry(m_Player); m_Player.m_WorldChatAccountEntry.GlobalTextHue = hue; if (m_Player.HasGump(typeof(WorldChatGump))) { m_Player.CloseGump(typeof(WorldChatGump)); } m_Player.SendGump(new WorldChatGump(m_Player)); return; }
public HomeController(ILogger <HomeController> logger, ChatPersistance chatPersistance) { _logger = logger; _chatPersistance = chatPersistance; }
public override void OnResponse(Mobile from, string text) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (player.Deleted || !player.Alive) { return; } ChatPersistance.ClearExpiredSquelchEntries(); ChatPersistance.CheckAndCreateWorldChatAccountEntry(player); if (text == "" || text == null) { player.SendMessage("No player by that name has been found."); return; } string playerTargetName = text.ToLower(); Account playerAccount = player.Account as Account; if (playerAccount == null) { return; } if (playerAccount.accountMobiles == null) { return; } for (int a = 0; a < playerAccount.accountMobiles.Length; a++) { PlayerMobile pm_Mobile = playerAccount.accountMobiles[a] as PlayerMobile; if (pm_Mobile == null) { continue; } if (pm_Mobile.RawName == null || pm_Mobile.RawName == "") { continue; } if (pm_Mobile.RawName.ToLower() == playerTargetName) { player.SendMessage("You cannot squelch a player on your own account."); return; } } foreach (Account account in Accounts.GetAccounts()) { if (account == null) { continue; } if (account.accountMobiles == null) { continue; } for (int a = 0; a < account.accountMobiles.Length; a++) { PlayerMobile playerTarget = account.accountMobiles[a] as PlayerMobile; if (playerTarget == null) { continue; } if (playerTarget.RawName == null) { continue; } if (playerTarget.RawName.ToLower() == playerTargetName) { if (playerTarget.AccessLevel >= player.AccessLevel) { player.SendMessage("You must have a higher access level to Squelch that player."); return; } string accountName = ""; Account playerTargetAccount = playerTarget.Account as Account; if (playerTargetAccount == null) { return; } for (int b = 0; b < ChatPersistance.m_PlayersSquelched.Count; b++) { if (ChatPersistance.m_PlayersSquelched[b].m_Player == null) { continue; } Account squelchAccount = ChatPersistance.m_PlayersSquelched[b].m_Player.Account as Account; if (squelchAccount != null) { if (playerTargetAccount == squelchAccount) { accountName = playerTargetAccount.Username; player.SendMessage("That player's account (" + accountName + ") has already been Squelched. Use [WorldChatAdmin to manage current Squelches."); return; } } } ChatPersistance.m_PlayersSquelched.Add(new PlayerSquelchEntry(playerTarget, true, DateTime.UtcNow + TimeSpan.FromHours(24))); player.SendMessage(playerTarget.RawName + " added to WorldChat Squelch List."); switch (ChatPersistance.m_AdminFilterMode) { case WorldChatAccountEntry.FilterMode.Name: ChatPersistance.AdminSortSquelchedPlayersByName(); break; case WorldChatAccountEntry.FilterMode.Date: ChatPersistance.AdminSortSquelchedPlayersByDate(); break; } ChatPersistance.UpdateAdminGumps(); player.CloseGump(typeof(WorldChatAdminGump)); player.SendGump(new WorldChatAdminGump(player)); return; } } } player.SendMessage("No player by the name of " + playerTargetName + " has been found."); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (from == null) { return; } if (from.Deleted) { return; } if (player == null) { return; } if (player.Deleted) { return; } bool resendGump = false; ChatPersistance.CheckAndCreateWorldChatAccountEntry(player); int m_PageNumber = ChatPersistance.m_PlayersSquelchedAdminPage; int TotalPlayersSquelched = ChatPersistance.m_PlayersSquelched.Count; int m_TotalPages = (int)(Math.Ceiling((double)TotalPlayersSquelched / (double)EntriesPerPage)); if (m_TotalPages == 0) { m_TotalPages = 1; } if (m_PageNumber < 1) { m_PageNumber = 1; } if (m_PageNumber > m_TotalPages) { m_PageNumber = m_TotalPages; } ChatPersistance.m_PlayersSquelchedAdminPage = m_PageNumber; //Filter By Name if (info.ButtonID == 1) { if (ChatPersistance.m_AdminFilterMode != WorldChatAccountEntry.FilterMode.Name) { ChatPersistance.m_AdminFilterMode = WorldChatAccountEntry.FilterMode.Name; ChatPersistance.m_PlayersSquelchedAdminPage = 1; ChatPersistance.AdminSortSquelchedPlayersByName(); ChatPersistance.UpdateAdminGumps(); } resendGump = true; } //Filter By Account if (info.ButtonID == 2) { if (ChatPersistance.m_AdminFilterMode != WorldChatAccountEntry.FilterMode.Account) { ChatPersistance.m_AdminFilterMode = WorldChatAccountEntry.FilterMode.Account; ChatPersistance.m_PlayersSquelchedAdminPage = 1; ChatPersistance.AdminSortSquelchedPlayersByAccount(); ChatPersistance.UpdateAdminGumps(); } resendGump = true; } //Filter By Expiration if (info.ButtonID == 3) { if (ChatPersistance.m_AdminFilterMode != WorldChatAccountEntry.FilterMode.Date) { ChatPersistance.m_AdminFilterMode = WorldChatAccountEntry.FilterMode.Date; ChatPersistance.m_PlayersSquelchedAdminPage = 1; ChatPersistance.AdminSortSquelchedPlayersByDate(); ChatPersistance.UpdateAdminGumps(); } resendGump = true; } //Previous if (info.ButtonID == 4) { if (ChatPersistance.m_PlayersSquelchedAdminPage > 1) { ChatPersistance.m_PlayersSquelchedAdminPage--; } ChatPersistance.UpdateAdminGumps(); resendGump = true; } //Next if (info.ButtonID == 5) { if (ChatPersistance.m_PlayersSquelchedAdminPage < m_TotalPages) { ChatPersistance.m_PlayersSquelchedAdminPage++; } resendGump = true; } //Enable World Chat if (info.ButtonID == 6) { ChatPersistance.Enabled = !ChatPersistance.Enabled; if (ChatPersistance.Enabled) { player.SendMessage("WorldChat has been enabled for all players."); } else { player.SendMessage("WorldChat has been disabled for all players."); } ChatPersistance.UpdateAdminGumps(); resendGump = true; } //Squelch Player By Target if (info.ButtonID == 7) { ChatPersistance.WorldChatAdminSquelch(player, TimeSpan.FromHours(24)); resendGump = false; } //Squelch Player By Name if (info.ButtonID == 8) { player.SendMessage("Please enter the name of the player to add to the Squelched List."); player.Prompt = new WorldChatAdminSquelchPlayerPrompt(player); resendGump = true; } //Remove Entry if (info.ButtonID >= 10 && info.ButtonID <= 19) { PlayerSquelchEntry squelchEntry = null; int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 10); if (entryIndex < ChatPersistance.m_PlayersSquelched.Count) { ChatPersistance.m_PlayersSquelched.RemoveAt(entryIndex); } ChatPersistance.UpdateAdminGumps(); resendGump = true; } //24 Hour Squelch if (info.ButtonID >= 20 && info.ButtonID <= 29) { PlayerSquelchEntry squelchEntry = null; int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 20); if (entryIndex < ChatPersistance.m_PlayersSquelched.Count) { ChatPersistance.m_PlayersSquelched[entryIndex].m_SquelchExpiration = DateTime.UtcNow + TimeSpan.FromHours(24); } ChatPersistance.UpdateAdminGumps(); resendGump = true; } //1 Week Squelch if (info.ButtonID >= 30 && info.ButtonID <= 39) { PlayerSquelchEntry squelchEntry = null; int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 30); if (entryIndex < ChatPersistance.m_PlayersSquelched.Count) { ChatPersistance.m_PlayersSquelched[entryIndex].m_SquelchExpiration = DateTime.UtcNow + TimeSpan.FromDays(7); } ChatPersistance.UpdateAdminGumps(); resendGump = true; } //1 Month Squelch if (info.ButtonID >= 40 && info.ButtonID <= 49) { PlayerSquelchEntry squelchEntry = null; int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 40); if (entryIndex < ChatPersistance.m_PlayersSquelched.Count) { ChatPersistance.m_PlayersSquelched[entryIndex].m_SquelchExpiration = DateTime.UtcNow + TimeSpan.FromDays(30); } ChatPersistance.UpdateAdminGumps(); resendGump = true; } //1 Year Squelch if (info.ButtonID >= 50 && info.ButtonID <= 59) { PlayerSquelchEntry squelchEntry = null; int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 50); if (entryIndex < ChatPersistance.m_PlayersSquelched.Count) { ChatPersistance.m_PlayersSquelched[entryIndex].m_SquelchExpiration = DateTime.UtcNow + TimeSpan.FromDays(365); } ChatPersistance.UpdateAdminGumps(); resendGump = true; } if (resendGump) { player.CloseGump(typeof(WorldChatAdminGump)); player.SendGump(new WorldChatAdminGump(player)); } }
public WorldChatAdminGump(PlayerMobile pm_Mobile) : base(10, 10) { if (pm_Mobile == null) { return; } if (pm_Mobile.Deleted) { return; } player = pm_Mobile; ChatPersistance.ClearExpiredSquelchEntries(); ChatPersistance.CheckAndCreateWorldChatAccountEntry(player); if (player.m_WorldChatAccountEntry == null) { return; } Closable = true; Disposable = true; Dragable = true; Resizable = false; int whiteTextHue = 2655; int greenTextHue = 2599; AddPage(0); AddImage(305, 0, 201); AddImageTiled(186, 44, 546, 424, 200); AddImage(308, 468, 233); AddImage(0, 44, 202); AddImage(44, 0, 201); AddImage(0, 0, 206); AddImage(0, 468, 204); AddImage(731, 1, 207); AddImage(731, 468, 205); AddImage(44, 468, 233); AddImage(731, 45, 203); AddImageTiled(44, 44, 546, 424, 200); AddImage(0, 152, 202); AddImage(163, 0, 201); AddImage(166, 468, 233); AddImage(731, 152, 203); AddImage(31, 427, 3001); AddImage(274, 427, 3001); AddImage(355, 427, 3001); AddImage(29, 68, 3001); AddImage(272, 68, 3001); AddImage(353, 68, 3001); AddImage(498, 68, 3001); AddImage(482, 427, 3001); AddLabel(302, 17, 149, "World Chat Administration"); AddLabel(323, 41, 2606, "Squelched Players"); //------------------------------- int m_PageNumber = ChatPersistance.m_PlayersSquelchedAdminPage; int TotalPlayersSquelched = ChatPersistance.m_PlayersSquelched.Count; int m_TotalPages = (int)(Math.Ceiling((double)TotalPlayersSquelched / (double)EntriesPerPage)); if (m_TotalPages == 0) { m_TotalPages = 1; } if (m_PageNumber < 1) { m_PageNumber = 1; } if (m_PageNumber > m_TotalPages) { m_PageNumber = m_TotalPages; } ChatPersistance.m_PlayersSquelchedAdminPage = m_PageNumber; if (TotalPlayersSquelched > 0) { AddLabel(30, 123, 149, "Remove"); AddLabel(102, 123, 149, "Player Name"); AddLabel(229, 123, 149, "Account Name"); AddLabel(376, 123, 149, "Time Remaining"); AddLabel(512, 123, 149, "24 Hours"); AddLabel(583, 123, 149, "1 Week"); AddLabel(642, 123, 149, "1 Month"); AddLabel(706, 123, 149, "1 Year"); switch (ChatPersistance.m_AdminFilterMode) { case WorldChatAccountEntry.FilterMode.Name: AddButton(29, 84, 2154, 2151, 1, GumpButtonType.Reply, 0); AddLabel(70, 87, greenTextHue, "Filter Entries by Player Name"); AddButton(283, 84, 2151, 2154, 2, GumpButtonType.Reply, 0); AddLabel(317, 87, whiteTextHue, "Filter Entries by Account"); AddButton(506, 84, 2151, 2154, 3, GumpButtonType.Reply, 0); AddLabel(540, 87, whiteTextHue, "Filter Entries by Time Remaining"); break; case WorldChatAccountEntry.FilterMode.Account: AddButton(29, 84, 2151, 2154, 1, GumpButtonType.Reply, 0); AddLabel(70, 87, whiteTextHue, "Filter Entries by Player Name"); AddButton(283, 84, 2154, 2151, 2, GumpButtonType.Reply, 0); AddLabel(317, 87, greenTextHue, "Filter Entries by Account"); AddButton(506, 84, 2151, 2154, 3, GumpButtonType.Reply, 0); AddLabel(540, 87, whiteTextHue, "Filter Entries by Time Remaining"); break; case WorldChatAccountEntry.FilterMode.Date: AddButton(29, 84, 2151, 2154, 1, GumpButtonType.Reply, 0); AddLabel(70, 87, whiteTextHue, "Filter Entries by Player Name"); AddButton(283, 84, 2151, 2154, 2, GumpButtonType.Reply, 0); AddLabel(317, 87, whiteTextHue, "Filter Entries by Account"); AddButton(506, 84, 2154, 2151, 3, GumpButtonType.Reply, 0); AddLabel(540, 87, greenTextHue, "Filter Entries by Time Remaining"); break; } } if (ChatPersistance.m_PlayersSquelchedAdminPage > 1) { AddButton(127, 399, 4014, 4016, 4, GumpButtonType.Reply, 0); AddLabel(162, 399, whiteTextHue, "Previous"); } if (ChatPersistance.m_PlayersSquelchedAdminPage < m_TotalPages) { AddButton(608, 399, 4005, 4007, 5, GumpButtonType.Reply, 0); AddLabel(648, 399, whiteTextHue, "Next"); } if (ChatPersistance.Enabled) { AddLabel(45, 436, 168, "World Chat Enabled"); AddButton(91, 459, 2154, 2151, 6, GumpButtonType.Reply, 0); } else { AddLabel(45, 436, whiteTextHue, "World Chat Disabled"); AddButton(91, 459, 2151, 2154, 6, GumpButtonType.Reply, 0); } AddLabel(207, 436, 1164, "Squelch Player by Name"); AddButton(466, 463, 4010, 4007, 7, GumpButtonType.Reply, 0); AddLabel(404, 436, 2599, "Target Player to Squelch"); AddButton(266, 463, 4010, 4007, 8, GumpButtonType.Reply, 0); //--------------- int iStartY = 151; if (TotalPlayersSquelched > 0) { int startIndex = (m_PageNumber - 1) * EntriesPerPage; int endIndex = startIndex + EntriesPerPage; if (endIndex > TotalPlayersSquelched) { endIndex = TotalPlayersSquelched; } int buttonIndex = 0; for (int a = startIndex; a < endIndex; a++) { if (a < ChatPersistance.m_PlayersSquelched.Count) { PlayerSquelchEntry squelchEntry = ChatPersistance.m_PlayersSquelched[a]; string playerName = ""; string accountName = ""; string squelchExpiration = DateTime.UtcNow.ToShortDateString(); if (squelchEntry != null) { if (squelchEntry.m_Player != null) { playerName = squelchEntry.m_Player.RawName; Account account = squelchEntry.m_Player.Account as Account; accountName = account.Username; squelchExpiration = Utility.CreateTimeRemainingString(DateTime.UtcNow, squelchEntry.m_SquelchExpiration, true, true, true, true, false); } AddButton(36, iStartY + 3, 4004, 4007, 10 + buttonIndex, GumpButtonType.Reply, 0); //Remove AddLabel(Utility.CenteredTextOffset(136, playerName), iStartY, whiteTextHue, playerName); AddLabel(Utility.CenteredTextOffset(269, accountName), iStartY, whiteTextHue, accountName); AddLabel(Utility.CenteredTextOffset(425, squelchExpiration), iStartY, whiteTextHue, squelchExpiration); AddButton(523, iStartY + 3, 4029, 4029, 20 + buttonIndex, GumpButtonType.Reply, 0); AddButton(589, iStartY + 3, 4029, 4029, 30 + buttonIndex, GumpButtonType.Reply, 0); AddButton(648, iStartY + 3, 4029, 4029, 40 + buttonIndex, GumpButtonType.Reply, 0); AddButton(711, iStartY + 3, 4029, 4029, 50 + buttonIndex, GumpButtonType.Reply, 0); iStartY += 32; } } buttonIndex++; } } }
public override void OnResponse(Mobile from, string text) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (player.Deleted || !player.Alive) { return; } ChatPersistance.CheckAndCreateWorldChatAccountEntry(player); if (text == "" || text == null) { player.SendMessage("No player by that name has been found."); return; } string playerTargetName = text.ToLower(); Account playerAccount = player.Account as Account; if (playerAccount == null) { return; } if (playerAccount.accountMobiles == null) { return; } for (int a = 0; a < playerAccount.accountMobiles.Length; a++) { PlayerMobile pm_Mobile = playerAccount.accountMobiles[a] as PlayerMobile; if (pm_Mobile == null) { continue; } if (pm_Mobile.RawName == null || pm_Mobile.RawName == "") { continue; } if (pm_Mobile.RawName.ToLower() == playerTargetName) { player.SendMessage("You cannot ignore a player on your own account."); return; } } foreach (Account account in Accounts.GetAccounts()) { if (account == null) { continue; } if (account.accountMobiles == null) { continue; } for (int a = 0; a < account.accountMobiles.Length; a++) { PlayerMobile playerTarget = account.accountMobiles[a] as PlayerMobile; if (playerTarget == null) { continue; } if (playerTarget.RawName == null) { continue; } if (playerTarget.RawName.ToLower() == playerTargetName) { bool foundMatch = false; for (int b = 0; b < player.m_WorldChatAccountEntry.m_PlayersSquelched.Count; b++) { if (playerTarget == player.m_WorldChatAccountEntry.m_PlayersSquelched[b].m_Player) { player.SendMessage("That character is already on your WorldChat Ignore List."); return; } } player.m_WorldChatAccountEntry.m_PlayersSquelched.Add(new PlayerSquelchEntry(playerTarget, true, DateTime.UtcNow)); player.SendMessage(playerTarget.RawName + " added to WorldChat Ignore List."); switch (player.m_WorldChatAccountEntry.m_FilterMode) { case WorldChatAccountEntry.FilterMode.Name: ChatPersistance.SortSquelchedPlayersByName(player.m_WorldChatAccountEntry); break; case WorldChatAccountEntry.FilterMode.Date: ChatPersistance.SortSquelchedPlayersByDate(player.m_WorldChatAccountEntry); break; } if (player.HasGump(typeof(WorldChatGump))) { player.CloseGump(typeof(WorldChatGump)); player.SendGump(new WorldChatGump(player)); } return; } } } player.SendMessage("No player by the name of " + playerTargetName + " has been found."); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (from == null) { return; } if (from.Deleted) { return; } if (player == null) { return; } if (player.Deleted) { return; } bool resendGump = false; ChatPersistance.CheckAndCreateWorldChatAccountEntry(player); int m_PageNumber = player.m_WorldChatAccountEntry.m_PlayersSquelchedPage; int TotalPlayersSquelched = player.m_WorldChatAccountEntry.m_PlayersSquelched.Count; int m_TotalPages = (int)(Math.Ceiling((double)TotalPlayersSquelched / (double)EntriesPerPage)); if (m_TotalPages == 0) { m_TotalPages = 1; } if (m_PageNumber < 1) { m_PageNumber = 1; } if (m_PageNumber > m_TotalPages) { m_PageNumber = m_TotalPages; } player.m_WorldChatAccountEntry.m_PlayersSquelchedPage = m_PageNumber; //Filter By Name if (info.ButtonID == 1) { if (player.m_WorldChatAccountEntry.m_FilterMode != WorldChatAccountEntry.FilterMode.Name) { player.m_WorldChatAccountEntry.m_FilterMode = WorldChatAccountEntry.FilterMode.Name; player.m_WorldChatAccountEntry.m_PlayersSquelchedPage = 1; ChatPersistance.SortSquelchedPlayersByName(player.m_WorldChatAccountEntry); } resendGump = true; } //Filter By Date Squelched if (info.ButtonID == 2) { if (player.m_WorldChatAccountEntry.m_FilterMode != WorldChatAccountEntry.FilterMode.Date) { player.m_WorldChatAccountEntry.m_FilterMode = WorldChatAccountEntry.FilterMode.Date; player.m_WorldChatAccountEntry.m_PlayersSquelchedPage = 1; ChatPersistance.SortSquelchedPlayersByDate(player.m_WorldChatAccountEntry); } resendGump = true; } //Previous if (info.ButtonID == 3) { if (player.m_WorldChatAccountEntry.m_PlayersSquelchedPage > 1) { player.m_WorldChatAccountEntry.m_PlayersSquelchedPage--; } resendGump = true; } //Next if (info.ButtonID == 4) { if (player.m_WorldChatAccountEntry.m_PlayersSquelchedPage < m_TotalPages) { player.m_WorldChatAccountEntry.m_PlayersSquelchedPage++; } resendGump = true; } //Enable World Chat if (info.ButtonID == 5) { player.m_WorldChatAccountEntry.Enabled = !player.m_WorldChatAccountEntry.Enabled; if (player.m_WorldChatAccountEntry.Enabled) { player.SendMessage("WorldChat is now enabled."); } else { player.SendMessage("WorldChat is now disabled. You will no longer hear WorldChat messages."); } resendGump = true; } //Add if (info.ButtonID == 6) { player.SendMessage("Please enter the name of the player to add to your World Chat Ignore List."); player.Prompt = new WorldChatSquelchPlayerPrompt(player); resendGump = true; } //Set Font Color if (info.ButtonID == 7) { if (player.NetState != null) { from.CloseGump(typeof(WorldChatGump)); from.SendGump(new WorldChatGump(player)); new WorldChatGlobalTextHuePicker(player).SendTo(player.NetState); return; } } //Remove Entry if (info.ButtonID >= 10 && info.ButtonID <= 19) { PlayerSquelchEntry squelchEntry = null; int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 10); if (entryIndex < player.m_WorldChatAccountEntry.m_PlayersSquelched.Count) { player.m_WorldChatAccountEntry.m_PlayersSquelched.RemoveAt(entryIndex); } resendGump = true; } //Squelch By Account if (info.ButtonID >= 20 && info.ButtonID <= 29) { PlayerSquelchEntry squelchEntry = null; int entryIndex = (m_PageNumber - 1) * EntriesPerPage + (info.ButtonID - 20); if (entryIndex < player.m_WorldChatAccountEntry.m_PlayersSquelched.Count) { squelchEntry = player.m_WorldChatAccountEntry.m_PlayersSquelched[entryIndex]; squelchEntry.m_SquelchEntireAccount = !squelchEntry.m_SquelchEntireAccount; } resendGump = true; } //-------------------- if (resendGump) { from.CloseGump(typeof(WorldChatGump)); from.SendGump(new WorldChatGump(player)); } }
public WorldChatGump(PlayerMobile pm_Mobile) : base(10, 10) { if (pm_Mobile == null) { return; } if (pm_Mobile.Deleted) { return; } player = pm_Mobile; ChatPersistance.CheckAndCreateWorldChatAccountEntry(player); if (player.m_WorldChatAccountEntry == null) { return; } Closable = true; Disposable = true; Dragable = true; Resizable = false; int whiteTextHue = 2655; int greenTextHue = 2599; AddPage(0); AddImage(0, 44, 202); AddImage(44, 0, 201); AddImage(0, 0, 206); AddImage(0, 468, 204); AddImage(590, 1, 207); AddImage(590, 468, 205); AddImage(44, 468, 233); AddImage(590, 45, 203); AddImageTiled(44, 44, 546, 424, 200); AddImage(0, 152, 202); AddImage(163, 0, 201); AddImage(166, 468, 233); AddImage(590, 152, 203); AddImage(31, 427, 3001); AddImage(274, 427, 3001); AddImage(355, 427, 3001); AddImage(29, 68, 3001); AddImage(272, 68, 3001); AddImage(353, 68, 3001); AddLabel(287, 17, 149, "World Chat"); AddLabel(274, 41, 2550, "Ignored Players"); //------------------------------- int m_PageNumber = player.m_WorldChatAccountEntry.m_PlayersSquelchedPage; int TotalPlayersSquelched = player.m_WorldChatAccountEntry.m_PlayersSquelched.Count; int m_TotalPages = (int)(Math.Ceiling((double)TotalPlayersSquelched / (double)EntriesPerPage)); if (m_TotalPages == 0) { m_TotalPages = 1; } if (m_PageNumber < 1) { m_PageNumber = 1; } if (m_PageNumber > m_TotalPages) { m_PageNumber = m_TotalPages; } player.m_WorldChatAccountEntry.m_PlayersSquelchedPage = m_PageNumber; if (TotalPlayersSquelched > 0) { switch (player.m_WorldChatAccountEntry.m_FilterMode) { case WorldChatAccountEntry.FilterMode.Name: AddLabel(70, 87, greenTextHue, "Filter Entries by Player Name"); AddButton(29, 84, 2154, 2151, 1, GumpButtonType.Reply, 0); AddLabel(419, 87, whiteTextHue, "Filter Entries by Date Added"); AddButton(385, 84, 2151, 2154, 2, GumpButtonType.Reply, 0); break; case WorldChatAccountEntry.FilterMode.Date: AddLabel(70, 87, whiteTextHue, "Filter Entries by Player Name"); AddButton(29, 84, 2151, 2154, 1, GumpButtonType.Reply, 0); AddLabel(419, 87, greenTextHue, "Filter Entries by Date Added"); AddButton(385, 84, 2154, 2151, 2, GumpButtonType.Reply, 0); break; } AddLabel(71, 123, 149, "Remove Entry"); AddLabel(189, 123, 149, "Ignore All on Account"); AddLabel(358, 123, 149, "Player Name"); AddLabel(488, 123, 149, "Date Added"); } if (player.m_WorldChatAccountEntry.m_PlayersSquelchedPage > 1) { AddButton(127, 399, 4014, 4016, 3, GumpButtonType.Reply, 0); AddLabel(162, 399, whiteTextHue, "Previous"); } if (player.m_WorldChatAccountEntry.m_PlayersSquelchedPage < m_TotalPages) { AddButton(438, 399, 4005, 4007, 4, GumpButtonType.Reply, 0); AddLabel(478, 399, whiteTextHue, "Next"); } if (player.m_WorldChatAccountEntry.Enabled) { AddLabel(45, 436, 168, "World Chat Enabled"); AddButton(91, 459, 2154, 2151, 5, GumpButtonType.Reply, 0); } else { AddLabel(45, 436, whiteTextHue, "World Chat Disabled"); AddButton(91, 459, 2151, 2154, 5, GumpButtonType.Reply, 0); } AddLabel(241, 436, 1164, "Add Player to Ignore List"); AddButton(299, 463, 4008, 4010, 6, GumpButtonType.Reply, 0); int globalTextHue = ChatPersistance.GlobalTextHue; if (player.m_WorldChatAccountEntry.GlobalTextHue != -1) { globalTextHue = player.m_WorldChatAccountEntry.GlobalTextHue; } AddLabel(480, 436, globalTextHue - 1, "Chat Text Color"); AddButton(502, 465, 2118, 2117, 7, GumpButtonType.Reply, 0); AddItem(510, 459, 4011, globalTextHue - 1); //--------------- int iStartY = 151; if (TotalPlayersSquelched > 0) { int startIndex = (m_PageNumber - 1) * EntriesPerPage; int endIndex = startIndex + EntriesPerPage; if (endIndex > TotalPlayersSquelched) { endIndex = TotalPlayersSquelched; } int buttonIndex = 0; for (int a = startIndex; a < endIndex; a++) { if (a < player.m_WorldChatAccountEntry.m_PlayersSquelched.Count) { PlayerSquelchEntry squelchEntry = player.m_WorldChatAccountEntry.m_PlayersSquelched[a]; string playerName = ""; string squelchDate = DateTime.UtcNow.ToShortDateString(); if (squelchEntry != null) { playerName = squelchEntry.m_Player.RawName; squelchDate = squelchEntry.m_SquelchExpiration.ToShortDateString(); //Remove AddButton(100, iStartY + 3, 4002, 4004, 10 + buttonIndex, GumpButtonType.Reply, 0); //Ignore Account if (squelchEntry.m_SquelchEntireAccount) { AddButton(240, iStartY + 3, 2154, 2151, 20 + buttonIndex, GumpButtonType.Reply, 0); } else { AddButton(240, iStartY + 3, 2151, 2154, 20 + buttonIndex, GumpButtonType.Reply, 0); } AddLabel(Utility.CenteredTextOffset(395, playerName), iStartY, whiteTextHue, playerName); AddLabel(Utility.CenteredTextOffset(525, squelchDate), iStartY, whiteTextHue, squelchDate); iStartY += 32; } } buttonIndex++; } } }
public void SendIgnorableMessage(int number, ChatUser from, string param1, string param2) { PlayerMobile player = from.Mobile as PlayerMobile; if (player == null) { return; } if (!ChatPersistance.Enabled) { player.SendMessage("World Chat system is currently offline."); return; } if (player.RawName == "Generic Player") { player.SendMessage("You must change your name before you may use the World Chat system."); return; } ChatPersistance.CheckAndCreateWorldChatAccountEntry(player); Account playerAccount = player.Account as Account; if (playerAccount == null) { return; } bool removeSquelch = false; PlayerSquelchEntry squelchEntryToRemove = null; ChatPersistance.ClearExpiredSquelchEntries(); foreach (PlayerSquelchEntry entry in ChatPersistance.m_PlayersSquelched) { if (entry.m_Player == null) { continue; } if (entry.m_Player.Account == null) { continue; } if (playerAccount == entry.m_Player.Account) { if (entry.m_SquelchExpiration >= DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, entry.m_SquelchExpiration, false, true, true, true, true); player.SendMessage("Your WorldChat privileges have been revoked and will be restored in " + timeRemaining + "."); return; } } } if (DateTime.UtcNow < player.m_WorldChatAccountEntry.LastMessageSent + ChatPersistance.ChatMessageCooldown) { player.SendMessage("You must wait another moment before posting another WorldChat message."); return; } player.m_WorldChatAccountEntry.LastMessageSent = DateTime.UtcNow; string message = "[WorldChat: " + player.Name + "] " + param2; if (player.Young) { message = "[WorldChat (Young) " + player.Name + "] " + param2; } if (player.Companion) { message = "[WorldChat (Companion) " + player.Name + "] " + param2; } int textHue = ChatPersistance.GlobalTextHue; if (player.m_WorldChatAccountEntry.GlobalTextHue != -1) { textHue = player.m_WorldChatAccountEntry.GlobalTextHue; } player.SendMessage(textHue, message); for (int a = 0; a < m_Users.Count; ++a) { ChatUser user = m_Users[a]; PlayerMobile otherPlayer = user.Mobile as PlayerMobile; if (otherPlayer == null) { continue; } if (otherPlayer == player) { continue; } if (otherPlayer.NetState == null) { continue; } ChatPersistance.CheckAndCreateWorldChatAccountEntry(otherPlayer); if (!otherPlayer.m_WorldChatAccountEntry.Enabled) { continue; } if (ChatPersistance.IsPlayerSquelched(player, otherPlayer)) { continue; } textHue = ChatPersistance.GlobalTextHue; if (otherPlayer.m_WorldChatAccountEntry.GlobalTextHue != -1) { textHue = otherPlayer.m_WorldChatAccountEntry.GlobalTextHue; } otherPlayer.SendMessage(textHue, message); //user.SendMessage(number, from.Mobile, param1, param2); } }