コード例 #1
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0); //Version

            Guilds.Serialize(writer);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            Movable = false;

            Guilds.PersistanceItem = this;
            Guilds.Deserialize(reader);
        }
コード例 #4
0
        public static void GuildCommand(CommandEventArgs e)
        {
            PlayerMobile player = e.Mobile as PlayerMobile;

            if (player == null)
            {
                return;
            }

            int startingGuildTabPage = Guilds.DetermineStartingGuildTabPage(player);

            Guilds.SendGuildGump(player, startingGuildTabPage);
        }
コード例 #5
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));
        }