Exemplo n.º 1
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0); //Version

            Guilds.Serialize(writer);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            Movable = false;

            Guilds.PersistanceItem = this;
            Guilds.Deserialize(reader);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }