Esempio n. 1
0
        public StableGump(Mobile vendor, PlayerMobile player, int page) : base(10, 10)
        {
            if (vendor == null)
            {
                return;
            }
            if (player == null)
            {
                return;
            }

            m_Vendor = vendor;
            m_Player = player;

            m_Page = page;

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            #region Images

            AddPage(0);

            AddImage(3, 369, 103);
            AddImage(2, 262, 103);
            AddImage(2, 3, 103);
            AddImage(131, 3, 103);
            AddImage(2, 97, 103);
            AddImage(134, 97, 103);
            AddImage(264, 288, 103);
            AddImage(133, 368, 103);
            AddImage(265, 3, 103);
            AddImage(265, 98, 103);
            AddImage(265, 193, 103);
            AddImage(2, 194, 103);
            AddImage(265, 368, 103);
            AddImage(394, 288, 103);
            AddImage(395, 3, 103);
            AddImage(395, 98, 103);
            AddImage(395, 193, 103);
            AddImage(395, 368, 103);
            AddImage(527, 288, 103);
            AddImage(528, 3, 103);
            AddImage(528, 98, 103);
            AddImage(528, 193, 103);
            AddImage(528, 368, 103);

            AddBackground(11, 106, 647, 352, 3000);
            AddBackground(11, 14, 647, 84, 3000);

            AddItem(133, 10, 3892);
            AddItem(142, 43, 3892);
            AddItem(142, 43, 3892);
            AddItem(113, 49, 3892);
            AddItem(101, 15, 3892);
            AddItem(71, 47, 3892);
            AddItem(71, 47, 3892);
            AddItem(96, 29, 3892);
            AddItem(177, 60, 3899);
            AddItem(114, 12, 3896);
            AddItem(177, 19, 3894);
            AddItem(120, 15, 3898);
            AddItem(100, 84, 3899);
            AddItem(77, 32, 3894);
            AddItem(139, 28, 5368);
            AddItem(580, 30, 2604);
            AddItem(586, 29, 4030);
            AddItem(599, 36, 4031);
            AddItem(479, 48, 2602);
            AddItem(550, 15, 2651);
            AddItem(534, 42, 2650);
            AddItem(537, 35, 2707, 2118);
            AddItem(496, 17, 2868);
            AddItem(499, 21, 2479);
            AddItem(485, 24, 2542);
            AddItem(493, 28, 2575);

            #endregion

            int usedStableSlots = Stables.GetUsedStableSlots(m_Player);
            int maxStableSlots  = Stables.GetMaxStableSlots(m_Player);

            int totalFollowers = m_Player.Stabled.Count;
            int totalPages     = (int)(Math.Ceiling((double)totalFollowers / (double)FollowersPerPage));

            if (m_Page >= totalPages)
            {
                m_Page = 0;
            }

            if (m_Page < 0)
            {
                m_Page = 0;
            }

            int creatureStartIndex = m_Page * FollowersPerPage;
            int creatureEndIndex   = (m_Page * FollowersPerPage) + (FollowersPerPage - 1);

            if (creatureEndIndex >= totalFollowers)
            {
                creatureEndIndex = totalFollowers - 1;
            }

            int WhiteTextHue = 2655; //2036

            AddLabel(24, 112, 2599, "Claim");
            AddLabel(75, 112, 2599, "Slots");
            AddLabel(126, 112, 2599, "Claim Cost");
            AddLabel(310, 112, 2599, "Follower");
            AddLabel(455, 112, 2599, "Lore");
            AddLabel(498, 112, 2599, "Level");
            AddLabel(556, 112, 2599, "Exp");
            AddLabel(602, 112, 2599, "Dismiss");

            //Guide
            AddButton(10, 11, 2094, 2095, 1, GumpButtonType.Reply, 0);
            AddLabel(7, 0, 149, "Guide");

            AddLabel(304, 27, 2201, "Claim Followers");
            AddLabel(282, 62, 2610, "Stable Slots Used:");
            AddLabel(402, 62, WhiteTextHue, usedStableSlots.ToString() + " / " + maxStableSlots.ToString());

            int startY      = 142;
            int itemSpacing = 40;

            int creatureCount = creatureEndIndex - creatureStartIndex;

            for (int a = 0; a < creatureCount + 1; a++)
            {
                int creatureIndex       = creatureStartIndex + a;
                int creatureButtonIndex = (10 * (creatureIndex + 1));

                if (creatureIndex >= m_Player.Stabled.Count)
                {
                    continue;
                }

                BaseCreature bc_Creature = m_Player.Stabled[creatureIndex] as BaseCreature;

                if (bc_Creature == null)
                {
                    continue;
                }

                string controlSlots = bc_Creature.ControlSlots.ToString();
                string claimCost    = Stables.GetClaimCost(m_Vendor, m_Player, bc_Creature).ToString();
                string followerName = bc_Creature.GetTamedDisplayName();

                int aliveTextHue     = WhiteTextHue;
                int claimCostTextHue = WhiteTextHue;

                string experienceLevel = bc_Creature.ExperienceLevel.ToString();
                string experience      = bc_Creature.Experience.ToString() + "/" + BaseCreature.GetMaxLevelExperience(bc_Creature.ExperienceLevel);

                AddButton(24, startY - 5, 2151, 2152, creatureButtonIndex, GumpButtonType.Reply, 0);        //Claim Button
                AddLabel(Utility.CenteredTextOffset(90, controlSlots), startY, WhiteTextHue, controlSlots); //Slots
                AddItem(117, startY - 5, 3823);                                                             //Gold Image
                AddLabel(160, startY, claimCostTextHue, claimCost.ToString());                              //Claim Cost
                AddLabel(Utility.CenteredTextOffset(335, followerName), startY, 2603, followerName);        //Follower Name

                AddButton(455, startY - 5, 9721, 9724, creatureButtonIndex + 1, GumpButtonType.Reply, 0);

                AddLabel(Utility.CenteredTextOffset(515, experienceLevel), startY, WhiteTextHue, experienceLevel);
                AddLabel(Utility.CenteredTextOffset(565, experience), startY, WhiteTextHue, experience);
                AddButton(611, startY - 5, 2472, 2473, creatureButtonIndex + 2, GumpButtonType.Reply, 0);

                startY += itemSpacing;
            }

            //Previous Page
            if (m_Page > 0)
            {
                AddButton(24, 408, 4014, 4016, 2, GumpButtonType.Reply, 0);
                AddLabel(61, 409, WhiteTextHue, "Previous Page");
            }

            //Stable Follower
            AddButton(180, 408, 4002, 4004, 3, GumpButtonType.Reply, 0);
            AddLabel(217, 409, 63, "Stable Follower");

            //Retrieve Lost Followers
            AddButton(343, 408, 4029, 4031, 5, GumpButtonType.Reply, 0);
            AddLabel(380, 409, 2606, "Retrieve Lost Followers");

            //Next Page
            if (m_Page < totalPages - 1)
            {
                AddLabel(547, 408, WhiteTextHue, "Next Page");
                AddButton(616, 409, 4005, 4007, 4, GumpButtonType.Reply, 0);
            }

            AddLabel(19, 433, 149, "Claim Cost:");
            AddLabel(96, 433, 2550, "Days Housed X Control Slots X " + Stables.GoldCostPerControlSlotPerDay.ToString());

            AddLabel(358, 433, 149, "Retrieval Cost:");
            AddLabel(457, 433, 2550, "Adds " + Stables.RetireveFollowerDaysAdded.ToString() + " Days Worth of Housing");
        }