Пример #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 1:
                int doubloonsInBank = Banker.GetUniqueCurrencyBalance(from, typeof(Doubloon));

                if (doubloonsInBank >= m_BaseBoatDeed.DoubloonCost)
                {
                    if (Banker.WithdrawUniqueCurrency(m_Player, typeof(Doubloon), m_BaseBoatDeed.DoubloonCost))
                    {
                        Doubloon doubloonPile = new Doubloon(m_BaseBoatDeed.DoubloonCost);
                        from.SendSound(doubloonPile.GetDropSound());
                        doubloonPile.Delete();

                        m_BaseBoatDeed.PlayerClassOwner = m_Player;
                        m_Player.SendMessage("You claim the boat as your own.");
                    }

                    else
                    {
                        m_Player.SendMessage("You no longer have the required doubloons in your bank box to claim this boat.");
                    }
                }

                else
                {
                    m_Player.SendMessage("You no longer have the required doubloons in your bank box to claim this boat.");
                }
                break;
            }
        }
Пример #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Player == null)
            {
                return;
            }
            if (!m_Player.Alive)
            {
                return;
            }
            if (m_Player.Backpack == null)
            {
                return;
            }

            bool closeGump = true;

            int totalCategories    = DonationShop.DonationCategories.Count;
            int totalCategoryPages = (int)(Math.Ceiling((double)totalCategories / (double)CategoriesPerPage));

            if (m_CategoryPage >= totalCategoryPages)
            {
                m_CategoryPage = 0;
            }

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

            int categoryStartIndex = m_CategoryPage * CategoriesPerPage;
            int categoryEndIndex   = (m_CategoryPage * CategoriesPerPage) + (CategoriesPerPage - 1);

            if (categoryEndIndex >= totalCategories)
            {
                categoryEndIndex = totalCategories - 1;
            }

            if (m_CategorySelected >= totalCategories)
            {
                m_CategorySelected = 0;
            }

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

            DonationCategory donationCategory = DonationShop.DonationCategories[m_CategorySelected];

            if (donationCategory == null)
            {
                return;
            }

            List <DonationItem> itemList = DonationShop.DonationShopList[donationCategory];

            int totalItems     = itemList.Count;
            int totalItemPages = (int)(Math.Ceiling((double)totalItems / (double)ItemsPerPage));

            if (m_ItemPage >= totalItemPages)
            {
                m_ItemPage = 0;
            }

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

            int itemStartIndex = m_ItemPage * ItemsPerPage;
            int itemEndIndex   = (m_ItemPage * ItemsPerPage) + (ItemsPerPage - 1);

            if (itemEndIndex >= totalItems)
            {
                itemEndIndex = totalItems - 1;
            }

            int donationCurrencyInBank = Banker.GetUniqueCurrencyBalance(m_Player, DonationShop.DonationCurrencyType);

            switch (info.ButtonID)
            {
            //Guide
            case 1:
                closeGump = false;
                break;

            //Make Donation
            case 2:
                closeGump = false;
                break;

            //Previous Item Page
            case 3:
                if (m_ItemPage > 0)
                {
                    m_ItemPage--;
                    m_Player.SendSound(ChangePageSound);
                }

                closeGump = false;
                break;

            //Next Item Page
            case 4:
                if (m_ItemPage < totalItemPages - 1)
                {
                    m_ItemPage++;
                    m_Player.SendSound(ChangePageSound);
                }

                closeGump = false;
                break;

            //Previous Category Page
            case 5:
                if (m_CategoryPage > 0)
                {
                    m_CategoryPage--;
                    m_Player.SendSound(ChangePageSound);
                }

                closeGump = false;
                break;

            //Next Category Page
            case 6:
                if (m_CategoryPage < totalCategoryPages - 1)
                {
                    m_CategoryPage++;
                    m_Player.SendSound(ChangePageSound);
                }

                closeGump = false;
                break;
            }

            //Item Selection
            if (info.ButtonID >= 20 && info.ButtonID < 40)
            {
                int itemSelectionIndex = info.ButtonID - 20;
                int itemSelected       = (m_ItemPage * ItemsPerPage) + itemSelectionIndex;

                if (itemSelected >= totalItems)
                {
                    itemSelected = 0;
                }

                //Purchase Item
                DonationItem item = itemList[itemSelected];

                if (item == null)
                {
                    return;
                }

                bool purchaseAllowed = true;

                if (!purchaseAllowed)
                {
                    m_Player.SendMessage("Donation shop purchases are not allowed in this area.");

                    m_Player.CloseGump(typeof(DonationShopGump));
                    m_Player.SendGump(new DonationShopGump(m_Player, m_CategoryPage, m_CategorySelected, m_ItemPage));

                    return;
                }

                if (item.ItemCost > donationCurrencyInBank && m_Player.AccessLevel < AccessLevel.GameMaster)
                {
                    m_Player.SendMessage("You do not have enough " + DonationShop.DonationCurrencyName + " in your bank to purchase this item.");

                    m_Player.CloseGump(typeof(DonationShopGump));
                    m_Player.SendGump(new DonationShopGump(m_Player, m_CategoryPage, m_CategorySelected, m_ItemPage));

                    return;
                }

                Item donationItem = (Item)Activator.CreateInstance(item.ItemType);

                if (donationItem == null)
                {
                    m_Player.CloseGump(typeof(DonationShopGump));
                    m_Player.SendGump(new DonationShopGump(m_Player, m_CategoryPage, m_CategorySelected, m_ItemPage));

                    return;
                }

                if (m_Player.Backpack.TotalItems + donationItem.TotalItems > m_Player.Backpack.MaxItems)
                {
                    donationItem.Delete();

                    m_Player.SendMessage("Your backpack contains too many items to purchase this item. Please remove some items and try again.");

                    m_Player.CloseGump(typeof(DonationShopGump));
                    m_Player.SendGump(new DonationShopGump(m_Player, m_CategoryPage, m_CategorySelected, m_ItemPage));

                    return;
                }

                if (m_Player.Backpack.TotalWeight + donationItem.TotalWeight > m_Player.MaxWeight)
                {
                    donationItem.Delete();

                    m_Player.SendMessage("Your backpack is too heavy to purchase this item. Please remove some items and try again.");

                    m_Player.CloseGump(typeof(DonationShopGump));
                    m_Player.SendGump(new DonationShopGump(m_Player, m_CategoryPage, m_CategorySelected, m_ItemPage));

                    return;
                }

                m_Player.SendMessage("You purchase the donation item.");

                donationItem.ItemGroup = ItemGroupType.Donation;

                m_Player.Backpack.DropItem(donationItem);

                Banker.WithdrawUniqueCurrency(m_Player, DonationShop.DonationCurrencyType, item.ItemCost, true);

                closeGump = false;
            }

            //Category Selection
            if (info.ButtonID >= 40 && info.ButtonID < 60)
            {
                int categorySelectionIndex = info.ButtonID - 40;
                int categorySelected       = (m_CategoryPage * CategoriesPerPage) + categorySelectionIndex;

                if (categorySelected >= totalCategories)
                {
                    categorySelected = 0;
                }

                m_Player.SendSound(SelectionSound);

                m_CategorySelected = categorySelected;
                m_ItemPage         = 0;

                closeGump = false;
            }

            if (!closeGump)
            {
                m_Player.CloseGump(typeof(DonationShopGump));
                m_Player.SendGump(new DonationShopGump(m_Player, m_CategoryPage, m_CategorySelected, m_ItemPage));
            }

            else
            {
                m_Player.SendSound(CloseGumpSound);
            }
        }
Пример #3
0
        public DonationShopGump(PlayerMobile player, int categoryPage, int categorySelected, int itemPage) : base(10, 10)
        {
            if (player == null)
            {
                return;
            }

            m_Player           = player;
            m_CategoryPage     = categoryPage;
            m_CategorySelected = categorySelected;
            m_ItemPage         = itemPage;

            if (DonationShop.DonationCategories == null)
            {
                return;
            }
            if (DonationShop.DonationCategories.Count == 0)
            {
                return;
            }

            int totalCategories    = DonationShop.DonationCategories.Count;
            int totalCategoryPages = (int)(Math.Ceiling((double)totalCategories / (double)CategoriesPerPage));

            if (m_CategoryPage >= totalCategoryPages)
            {
                m_CategoryPage = 0;
            }

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

            int categoryStartIndex = m_CategoryPage * CategoriesPerPage;
            int categoryEndIndex   = (m_CategoryPage * CategoriesPerPage) + (CategoriesPerPage - 1);

            if (categoryEndIndex >= totalCategories)
            {
                categoryEndIndex = totalCategories - 1;
            }

            if (m_CategorySelected >= totalCategories)
            {
                m_CategorySelected = 0;
            }

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

            DonationCategory donationCategory = DonationShop.DonationCategories[m_CategorySelected];

            if (donationCategory == null)
            {
                return;
            }

            List <DonationItem> itemList = new List <DonationItem>();

            foreach (DonationItem itemListing in DonationShop.DonationShopList[donationCategory])
            {
                itemList.Add(itemListing);
            }

            int totalItems     = itemList.Count;
            int totalItemPages = (int)(Math.Ceiling((double)totalItems / (double)ItemsPerPage));

            if (m_ItemPage >= totalItemPages)
            {
                m_ItemPage = 0;
            }

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

            int itemStartIndex = m_ItemPage * ItemsPerPage;
            int itemEndIndex   = (m_ItemPage * ItemsPerPage) + (ItemsPerPage - 1);

            if (itemStartIndex >= totalItems)
            {
                itemStartIndex = totalItems - 1;
            }

            if (itemEndIndex >= totalItems)
            {
                itemEndIndex = totalItems - 1;
            }

            int donationCurrencyInBank = Banker.GetUniqueCurrencyBalance(m_Player, DonationShop.DonationCurrencyType);

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

            int WhiteTextHue = 2036; //2655;

            AddPage(0);

            #region Images

            AddImage(13, 5, 206, 2419);
            AddImage(645, 5, 207, 2419);
            AddImage(13, 169, 202, 2419);
            AddImage(517, 361, 200, 2419);
            AddImage(389, 361, 200, 2419);
            AddImage(312, 361, 200, 2419);
            AddImage(184, 361, 200, 2419);
            AddImage(56, 361, 200, 2419);
            AddImage(518, 240, 200, 2419);
            AddImage(519, 170, 200, 2419);
            AddImage(518, 49, 200, 2419);
            AddImage(395, 240, 200, 2419);
            AddImage(312, 240, 200, 2419);
            AddImage(184, 240, 200, 2419);
            AddImage(56, 240, 200, 2419);
            AddImage(56, 170, 200, 2419);
            AddImage(184, 170, 200, 2419);
            AddImage(312, 170, 200, 2419);
            AddImage(398, 170, 200, 2419);
            AddImage(56, 49, 200, 2419);
            AddImage(184, 49, 200, 2419);
            AddImage(312, 49, 200, 2419);
            AddImage(390, 49, 200, 2419);
            AddImage(57, 485, 233, 2419);
            AddImage(56, 5, 201, 2419);
            AddImage(13, 49, 202, 2419);
            AddImage(646, 49, 203, 2419);
            AddImage(645, 485, 205, 2419);
            AddImage(13, 485, 204, 2419);
            AddImage(218, 5, 201, 2419);
            AddImage(218, 485, 233, 2419);
            AddImage(645, 169, 203, 2419);

            AddImage(31, 22, 9002, 2412);
            AddImage(223, 27, 1143, 2499);

            AddItem(546, 251, 2760);
            AddItem(524, 229, 2760);
            AddItem(545, 208, 2760);
            AddItem(502, 251, 2768);
            AddItem(523, 272, 2768);
            AddItem(566, 198, 2766);
            AddItem(525, 194, 2765);
            AddItem(630, 254, 2764);
            AddItem(590, 252, 2760);
            AddItem(568, 273, 2760);
            AddItem(568, 229, 2760);
            AddItem(589, 218, 2766);
            AddItem(544, 186, 2762);
            AddItem(502, 216, 2765);
            AddItem(608, 237, 2766);
            AddItem(544, 292, 2768);
            AddItem(481, 233, 2763);
            AddItem(611, 271, 2767);
            AddItem(590, 293, 2767);
            AddItem(566, 314, 2761);
            AddItem(505, 149, 3225);
            AddItem(618, 175, 3229);
            AddItem(482, 175, 3228);
            AddItem(475, 218, 555);
            AddItem(484, 166, 9);
            AddItem(605, 241, 3651);
            AddItem(491, 237, 554);
            AddItem(508, 254, 554);
            AddItem(556, 300, 554);
            AddItem(570, 313, 555, 2415);
            AddItem(586, 295, 555);
            AddItem(496, 196, 555);
            AddItem(517, 173, 555);
            AddItem(604, 274, 555);
            AddItem(525, 166, 555);
            AddItem(567, 168, 554);
            AddItem(584, 184, 554);
            AddItem(599, 198, 554);
            AddItem(616, 214, 554);
            AddItem(640, 237, 554);
            AddItem(484, 140, 9);
            AddItem(543, 111, 9);
            AddItem(543, 54, 9);
            AddItem(630, 186, 9);
            AddItem(630, 129, 9);
            AddItem(618, 259, 555);
            AddItem(538, 186, 3644);
            AddItem(540, 178, 3647);
            AddItem(506, 32, 1539, 149);
            AddItem(486, 50, 1561, 149);
            AddItem(467, 80, 1561, 149);
            AddItem(526, 23, 1536, 149);
            AddItem(530, 54, 1539, 2500);
            AddItem(510, 72, 1561, 2500);
            AddItem(491, 102, 1561, 2500);
            AddItem(550, 45, 1536, 2500);
            AddItem(552, 77, 1539, 149);
            AddItem(532, 95, 1561, 149);
            AddItem(513, 125, 1561, 149);
            AddItem(572, 68, 1536, 149);
            AddItem(573, 99, 1539, 2500);
            AddItem(553, 117, 1561, 2500);
            AddItem(534, 147, 1561, 2500);
            AddItem(593, 90, 1536, 2500);
            AddItem(594, 122, 1539, 149);
            AddItem(575, 139, 1561, 149);
            AddItem(614, 113, 1536, 149);
            AddItem(615, 143, 1539, 2500);
            AddItem(595, 161, 1561, 2500);
            AddItem(635, 134, 1536, 2500);
            AddItem(524, 215, 2818);
            AddItem(547, 236, 2817);
            AddItem(568, 258, 2816);
            AddItem(532, 215, 3656);
            AddItem(512, 226, 3628);
            AddItem(557, 279, 5452, 2500);
            AddItem(552, 222, 4644);
            AddItem(538, 238, 5357);
            AddItem(522, 234, 3838);
            AddItem(553, 256, 2886, 2606);
            AddItem(574, 261, 3629, 2500);
            AddItem(552, 244, 2586, 2587);
            AddItem(564, 245, 9);
            AddItem(564, 210, 9);
            AddItem(573, 314, 554);
            AddItem(582, 288, 3228);
            AddItem(555, 170, 1561, 149);
            AddItem(576, 190, 1561, 2500);

            #endregion

            //Header
            AddLabel(314, 29, 149, "Donation Shop");

            //Guide
            AddButton(29, 10, 2094, 2095, 1, GumpButtonType.Reply, 0);
            AddLabel(56, 19, WhiteTextHue, "Guide");

            //Bank Account
            AddItem(467, 337, 3823, 2500);
            AddLabel(Utility.CenteredTextOffset(490, Utility.CreateCurrencyString(donationCurrencyInBank)), 366, WhiteTextHue, Utility.CreateCurrencyString(donationCurrencyInBank));
            AddLabel(440, 386, 149, DonationShop.DonationCurrencyName + " in Bank");

            //Make Donation
            AddLabel(570, 386, 169, "Make Donation");
            AddButton(598, 409, 2152, 2151, 2, GumpButtonType.Reply, 0);

            //Scroll Items
            if (m_ItemPage > 0)
            {
                AddButton(436, 224, 9900, 9900, 3, GumpButtonType.Reply, 0);
            }

            if (m_ItemPage < totalItemPages - 1)
            {
                AddButton(436, 265, 9906, 9906, 4, GumpButtonType.Reply, 0);
            }

            //Item
            int startX      = 75;
            int startY      = 70;
            int itemSpacing = 125;

            int itemCount = itemEndIndex - itemStartIndex;

            for (int a = 0; a < itemCount + 1; a++)
            {
                if (totalItems == 0)
                {
                    continue;
                }

                int itemIndex       = itemStartIndex + a;
                int itemButtonIndex = 20 + a;

                if (itemIndex >= itemList.Count)
                {
                    continue;
                }

                DonationItem item = itemList[itemIndex];

                if (item == null)
                {
                    continue;
                }

                #region Images

                int borderHue      = 2412;
                int innerRegionHue = 2052;

                AddImage(startX + 202, startY + 12, 103, borderHue);
                AddImage(startX + 0, startY + 12, 103, borderHue);
                AddImage(startX + 103, startY + 12, 103, borderHue);
                AddImage(startX + 0, startY + 0, 103, borderHue);
                AddImage(startX + 131, startY + 0, 103, borderHue);
                AddImage(startX + 202, startY + 0, 103, borderHue);

                AddImage(startX + 10, startY + 10, 5104, innerRegionHue);
                AddImage(startX + 89, startY + 10, 5104, innerRegionHue);
                AddImage(startX + 132, startY + 10, 5104, innerRegionHue);
                AddImage(startX + 196, startY + 10, 5104, innerRegionHue);
                AddImage(startX + 245, startY + 10, 5104, innerRegionHue);

                #endregion

                //-32, 6

                //AddItem(startX + 15 + item.ItemIconOffsetX, startY + 30 + item.ItemIconOffsetY, item.ItemIconItemId, item.ItemIconHue);
                AddItem(startX - 26 + item.ItemIconOffsetX, startY + 6 + item.ItemIconOffsetY, item.ItemIconItemId, item.ItemIconHue);
                AddLabel(Utility.CenteredTextOffset(startX + 185, item.ItemName), startY + 8, 149, item.ItemName);

                if (item.ItemDescription != null)
                {
                    for (int b = 0; b < item.ItemDescription.Count; b++)
                    {
                        AddLabel(Utility.CenteredTextOffset(startX + 205, item.ItemDescription[b]), startY + 28 + (b * 20), 2550, item.ItemDescription[b]);
                    }
                }

                AddItem(startX + 75, startY + 91, 3823, 2500);
                AddLabel(startX + 116, startY + 93, 149, Utility.CreateCurrencyString(item.ItemCost));

                AddButton(startX + 196, startY + 90, 2152, 2154, itemButtonIndex, GumpButtonType.Reply, 0);
                AddLabel(startX + 229, startY + 93, 63, "Purchase");

                startY += itemSpacing;
            }

            //Categories
            startX = 120;
            int categorySpacing = 100;

            int categoryCount = categoryEndIndex - categoryStartIndex;

            for (int a = 0; a < categoryCount + 1; a++)
            {
                int categoryIndex       = categoryStartIndex + a;
                int categoryButtonIndex = 40 + categoryIndex;

                if (categoryStartIndex >= totalCategories)
                {
                    continue;
                }

                DonationCategory category = DonationShop.DonationCategories[categoryIndex];

                if (donationCategory == null)
                {
                    continue;
                }

                AddItem(startX + category.CategoryIconOffsetX, 470 + category.CategoryIconOffsetY, category.CategoryIconItemId, category.CategoryIconHue);

                if (categoryIndex == m_CategorySelected)
                {
                    AddLabel(Utility.CenteredTextOffset(startX + 45, category.CategoryName), 445, 149, category.CategoryName);
                    AddButton(startX + 45, 475, 9724, 9721, categoryButtonIndex, GumpButtonType.Reply, 0);
                }

                else
                {
                    AddLabel(Utility.CenteredTextOffset(startX + 45, category.CategoryName), 445, WhiteTextHue, category.CategoryName);
                    AddButton(startX + 45, 475, 9721, 9724, categoryButtonIndex, GumpButtonType.Reply, 0);
                }

                startX += categorySpacing;
            }

            //Previous Category
            if (categoryPage > 0)
            {
                AddButton(77, 475, 4014, 4016, 5, GumpButtonType.Reply, 0);
            }

            //Next Category
            if (categoryPage < totalCategoryPages - 1)
            {
                AddButton(609, 475, 4005, 4007, 6, GumpButtonType.Reply, 0);
            }
        }
Пример #4
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm_From = from as PlayerMobile;

            if (pm_From == null)
            {
                return;
            }

            if (PlayerClassRestricted)
            {
                if (PlayerClassOwner == null)
                {
                    int doubloonsInBank = Banker.GetUniqueCurrencyBalance(from, typeof(Doubloon));

                    if (doubloonsInBank >= DoubloonCost)
                    {
                        from.CloseAllGumps();
                        from.SendGump(new BindBaseBoatDeedGump(this, pm_From));
                    }

                    else
                    {
                        from.SendMessage("You must have at least " + DoubloonCost.ToString() + " doubloons in your bank to claim this ship as your own.");
                    }
                }

                else
                {
                    if (PlayerClassOwner == from)
                    {
                        if (!IsChildOf(from.Backpack))
                        {
                            from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                        }
                        else if (from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas))
                        {
                            from.SendLocalizedMessage(1010567, null, 0x25); // You may not place a boat from this location.
                        }
                        else
                        {
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502482); // Where do you wish to place the ship?
                            from.Target = new InternalTarget(this);
                        }
                    }

                    else
                    {
                        PlayerClassOwner = from;
                        from.SendMessage("You claim the ship deed as your own.");
                    }
                }
            }

            else
            {
                if (!IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
                }
                else if (from.AccessLevel < AccessLevel.GameMaster && (from.Map == Map.Ilshenar || from.Map == Map.Malas))
                {
                    from.SendLocalizedMessage(1010567, null, 0x25); // You may not place a boat from this location.
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502482); // Where do you wish to place the ship?
                    from.Target = new InternalTarget(this);
                }
            }
        }
Пример #5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Player == null)
            {
                return;
            }
            if (m_Player.Deleted)
            {
                return;
            }
            if (m_Player.Backpack == null)
            {
                return;
            }
            if (m_ShipUpgradeGumpObject == null)
            {
                return;
            }

            bool closeGump = true;

            BaseShip        ship            = m_ShipUpgradeGumpObject.m_Ship;
            BaseShipDeed    shipDeed        = m_ShipUpgradeGumpObject.m_ShipDeed;
            ShipUpgradeDeed shipUpgradeDeed = m_ShipUpgradeGumpObject.m_ShipUpgradeDeed;

            ShipStatsProfile shipStatsProfile = ShipUniqueness.GetShipStatsProfile(shipDeed, ship, true, true);

            ShipUpgradeDetail upgradeDetail = null;

            bool replaceExistingUpgrade = false;

            #region Upgrade Type

            switch (m_ShipUpgradeGumpObject.m_UpgradeType)
            {
            case ShipUpgrades.UpgradeType.Theme:
                if (ship != null)
                {
                    if (ship.m_ThemeUpgrade != ShipUpgrades.ThemeType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_ThemeUpgrade != ShipUpgrades.ThemeType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetThemeDetail(m_ShipUpgradeGumpObject.m_Theme);
                break;

            case ShipUpgrades.UpgradeType.Paint:
                if (ship != null)
                {
                    if (ship.m_PaintUpgrade != ShipUpgrades.PaintType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_PaintUpgrade != ShipUpgrades.PaintType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetPaintDetail(m_ShipUpgradeGumpObject.m_Paint);
                break;

            case ShipUpgrades.UpgradeType.CannonMetal:
                if (ship != null)
                {
                    if (ship.m_CannonMetalUpgrade != ShipUpgrades.CannonMetalType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_CannonMetalUpgrade != ShipUpgrades.CannonMetalType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetCannonMetalDetail(m_ShipUpgradeGumpObject.m_CannonMetal);
                break;

            case ShipUpgrades.UpgradeType.Outfitting:
                if (ship != null)
                {
                    if (ship.m_OutfittingUpgrade != ShipUpgrades.OutfittingType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_OutfittingUpgrade != ShipUpgrades.OutfittingType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetOutfittingDetail(m_ShipUpgradeGumpObject.m_Outfitting);
                break;

            case ShipUpgrades.UpgradeType.Banner:
                if (ship != null)
                {
                    if (ship.m_BannerUpgrade != ShipUpgrades.BannerType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_BannerUpgrade != ShipUpgrades.BannerType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetBannerDetail(m_ShipUpgradeGumpObject.m_Banner);
                break;

            case ShipUpgrades.UpgradeType.Charm:
                if (ship != null)
                {
                    if (ship.m_CharmUpgrade != ShipUpgrades.CharmType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_CharmUpgrade != ShipUpgrades.CharmType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetCharmDetail(m_ShipUpgradeGumpObject.m_Charm);
                break;

            case ShipUpgrades.UpgradeType.MinorAbility:
                if (ship != null)
                {
                    if (ship.m_MinorAbilityUpgrade != ShipUpgrades.MinorAbilityType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_MinorAbilityUpgrade != ShipUpgrades.MinorAbilityType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetMinorAbilityDetail(m_ShipUpgradeGumpObject.m_MinorAbility);
                break;

            case ShipUpgrades.UpgradeType.MajorAbility:
                if (ship != null)
                {
                    if (ship.m_MajorAbilityUpgrade != ShipUpgrades.MajorAbilityType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_MajorAbilityUpgrade != ShipUpgrades.MajorAbilityType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetMajorAbilityDetail(m_ShipUpgradeGumpObject.m_MajorAbility);
                break;

            case ShipUpgrades.UpgradeType.EpicAbility:
                if (ship != null)
                {
                    if (ship.m_EpicAbilityUpgrade != ShipUpgrades.EpicAbilityType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                if (shipDeed != null)
                {
                    if (shipDeed.m_EpicAbilityUpgrade != ShipUpgrades.EpicAbilityType.None)
                    {
                        replaceExistingUpgrade = true;
                    }
                }

                upgradeDetail = ShipUpgrades.GetEpicAbilityDetail(m_ShipUpgradeGumpObject.m_EpicAbility);
                break;
            }

            #endregion

            if (upgradeDetail == null)
            {
                return;
            }

            switch (info.ButtonID)
            {
            //Guide
            case 1:
                closeGump = false;
                break;

            //Install
            case 2:
                switch (m_ShipUpgradeGumpObject.m_UpgradeDisplayMode)
                {
                case UpgradeDisplayMode.DeedUse:
                    if (shipUpgradeDeed == null)
                    {
                        m_Player.SendMessage("That deed is no longer accessible.");
                    }

                    else if (shipUpgradeDeed.Deleted)
                    {
                        m_Player.SendMessage("That deed is no longer accessible.");
                    }

                    else if (!shipUpgradeDeed.IsChildOf(m_Player.Backpack))
                    {
                        m_Player.SendMessage("That deed is no longer accessible.");
                    }

                    else
                    {
                        m_Player.SendMessage("Which ship do you wish to install this upgrade into?");
                        m_Player.Target = new ShipUpgradeTarget(m_Player, m_ShipUpgradeGumpObject);

                        return;
                    }
                    break;

                case UpgradeDisplayMode.DeedAttemptInstall:
                    if (shipUpgradeDeed == null)
                    {
                        m_Player.SendMessage("That upgrade deed is no longer accessible.");
                    }

                    else if (shipUpgradeDeed.Deleted)
                    {
                        m_Player.SendMessage("That upgrade deed is no longer accessible.");
                    }

                    else if (!shipUpgradeDeed.IsChildOf(m_Player.Backpack))
                    {
                        m_Player.SendMessage("That upgrade deed is no longer accessible.");
                    }

                    else if (shipDeed == null)
                    {
                        m_Player.SendMessage("That ship token is no longer accessible.");
                    }

                    else if (shipDeed.Deleted)
                    {
                        m_Player.SendMessage("That ship token is no longer accessible.");
                    }

                    else if (!shipDeed.IsChildOf(m_Player.Backpack))
                    {
                        m_Player.SendMessage("That ship token is no longer accessible.");
                    }

                    else
                    {
                        int doubloonBaseCost = ShipUniqueness.GetShipUpgradeBaseDoubloonCost(upgradeDetail.m_UpgradeType);

                        double doubloonMultiplier   = shipStatsProfile.UpgradeDoubloonMultiplier;
                        int    doubloonAdjustedCost = (int)(Math.Round((double)doubloonBaseCost * (double)doubloonMultiplier));

                        if (replaceExistingUpgrade)
                        {
                            doubloonAdjustedCost = 0;
                        }

                        int doubloonBalance = Banker.GetUniqueCurrencyBalance(m_Player, typeof(Doubloon));

                        if (doubloonBalance >= doubloonAdjustedCost)
                        {
                            if (doubloonAdjustedCost > 0)
                            {
                                Banker.WithdrawUniqueCurrency(m_Player, typeof(Doubloon), doubloonAdjustedCost, true);
                            }

                            switch (upgradeDetail.m_UpgradeType)
                            {
                            case ShipUpgrades.UpgradeType.Theme: shipDeed.m_ThemeUpgrade = shipUpgradeDeed.m_ThemeUpgrade; break;

                            case ShipUpgrades.UpgradeType.Paint: shipDeed.m_PaintUpgrade = shipUpgradeDeed.m_PaintUpgrade; break;

                            case ShipUpgrades.UpgradeType.CannonMetal: shipDeed.m_CannonMetalUpgrade = shipUpgradeDeed.m_CannonMetalUpgrade; break;

                            case ShipUpgrades.UpgradeType.Outfitting: shipDeed.m_OutfittingUpgrade = shipUpgradeDeed.m_OutfittingUpgrade; break;

                            case ShipUpgrades.UpgradeType.Banner: shipDeed.m_BannerUpgrade = shipUpgradeDeed.m_BannerUpgrade; break;

                            case ShipUpgrades.UpgradeType.Charm: shipDeed.m_CharmUpgrade = shipUpgradeDeed.m_CharmUpgrade; break;

                            case ShipUpgrades.UpgradeType.MinorAbility: shipDeed.m_MinorAbilityUpgrade = shipUpgradeDeed.m_MinorAbilityUpgrade; break;

                            case ShipUpgrades.UpgradeType.MajorAbility: shipDeed.m_MajorAbilityUpgrade = shipUpgradeDeed.m_MajorAbilityUpgrade; break;

                            case ShipUpgrades.UpgradeType.EpicAbility: shipDeed.m_EpicAbilityUpgrade = shipUpgradeDeed.m_EpicAbilityUpgrade; break;
                            }

                            if (m_Player.HasGump(typeof(ShipGump)))
                            {
                                m_Player.CloseGump(typeof(ShipGump));
                            }

                            ShipGumpObject shipGumpObject = new ShipGumpObject(m_Player, null, shipDeed);

                            shipGumpObject.m_ShipPage = ShipGump.ShipPageType.Upgrades;

                            m_Player.SendGump(new ShipGump(m_Player, shipGumpObject));

                            if (replaceExistingUpgrade)
                            {
                                m_Player.SendMessage("You place an upgrade onto your ship, overriding the existing one.");
                            }
                            else
                            {
                                m_Player.SendMessage("You place an upgrade onto your ship.");
                            }

                            m_Player.SendSound(0x23D);

                            m_ShipUpgradeGumpObject.m_ShipUpgradeDeed.Delete();

                            return;
                        }

                        else
                        {
                            m_Player.SendMessage("You do not have the neccessary " + doubloonAdjustedCost.ToString() + " doubloons in your bank box to install this upgrade.");
                        }
                    }
                    break;

                case UpgradeDisplayMode.InstalledOnShip:
                    break;
                }

                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_Player.CloseGump(typeof(ShipUpgradeGump));
                m_Player.SendGump(new ShipUpgradeGump(m_Player, m_ShipUpgradeGumpObject));
            }
            else
            {
                m_Player.SendSound(CloseGumpSound);
            }
        }