public static int DetermineStartingGuildTabPage(PlayerMobile player) { CheckCreateGuildGuildSettings(player); GuildGumpCheckGuild(player); List <GuildGumpPageType> validGuildTabs = Guilds.GetGuildPageTypeList(player); if (validGuildTabs.Count == 0) { return(0); } int GuildTabsPerPage = 4; int TotalGuildTabs = validGuildTabs.Count; int TotalGuildTabPages = (int)(Math.Ceiling((double)TotalGuildTabs / (double)GuildTabsPerPage)); if (validGuildTabs.Contains(player.m_GuildGumpSettings.m_GuildGumpPage)) { int tabIndex = validGuildTabs.IndexOf(player.m_GuildGumpSettings.m_GuildGumpPage); return((int)(Math.Floor((double)tabIndex / (double)TotalGuildTabPages))); } return(0); }
public static void SendGuildGump(PlayerMobile player, int guildTabPage) { if (player == null) { return; } CheckCreateGuildGuildSettings(player); GuildGumpCheckGuild(player); List <GuildGumpPageType> validGuildTabs = Guilds.GetGuildPageTypeList(player); if (validGuildTabs.Count == 0) { return; } int GuildTabsPerPage = 4; int TotalGuildTabs = validGuildTabs.Count; int TotalGuildTabPages = (int)(Math.Ceiling((double)TotalGuildTabs / (double)GuildTabsPerPage)); if (guildTabPage >= TotalGuildTabPages) { guildTabPage = TotalGuildTabPages - 1; } if (guildTabPage < 0) { guildTabPage = 0; } if (!validGuildTabs.Contains(player.m_GuildGumpSettings.m_GuildGumpPage)) { player.m_GuildGumpSettings.m_GuildGumpPage = validGuildTabs[0]; guildTabPage = 0; } player.CloseGump(typeof(GuildGump)); player.SendGump(new GuildGump(player, guildTabPage)); }