Exemplo n.º 1
0
 public ShipUpgradeTarget(PlayerMobile player, ShipUpgradeGumpObject shipUpgradeGumpObject) : base(1, false, TargetFlags.None, false)
 {
     m_Player = player;
     m_ShipUpgradeGumpObject = shipUpgradeGumpObject;
 }
Exemplo n.º 2
0
        public ShipUpgradeGump(PlayerMobile player, ShipUpgradeGumpObject shipUpgradeGumpObject) : base(325, 150)
        {
            m_Player = player;
            m_ShipUpgradeGumpObject = shipUpgradeGumpObject;

            if (m_Player == null)
            {
                return;
            }
            if (m_Player.Deleted)
            {
                return;
            }
            if (m_ShipUpgradeGumpObject == null)
            {
                return;
            }

            BaseShip     ship     = m_ShipUpgradeGumpObject.m_Ship;
            BaseShipDeed shipDeed = m_ShipUpgradeGumpObject.m_ShipDeed;

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

            int startX = 0;
            int startY = 0;

            #region Background

            AddImage(275, 9, 103);
            AddImage(275, 106, 103);
            AddImage(275, 149, 103);
            AddImage(145, 9, 103);
            AddImage(145, 106, 103);
            AddImage(146, 149, 103);
            AddImage(10, 148, 103);
            AddImage(10, 9, 103);
            AddImage(10, 106, 103);

            AddImage(20, 108, 3604, 2052);
            AddImage(145, 109, 3604, 2052);
            AddImage(20, 19, 3604, 2052);
            AddImage(140, 19, 3604, 2052);
            AddImage(236, 18, 3604, 2052);
            AddImage(280, 18, 3604, 2052);
            AddImage(236, 109, 3604, 2052);
            AddImage(280, 109, 3604, 2052);

            AddImage(33, 68, 2328);
            AddItem(82, 173, 2539);

            #endregion

            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;
            }

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

            AddLabel(143, 20, 149, "Ship Outfitting Upgrade");
            AddLabel(Utility.CenteredTextOffset(210, upgradeDetail.m_UpgradeName), 40, WhiteTextHue, upgradeDetail.m_UpgradeName);

            AddLabel(26, 170, 149, "Base Cost:");
            AddLabel(114, 170, WhiteTextHue, doubloonBaseCost.ToString());

            double doubloonMultiplier = shipStatsProfile.UpgradeDoubloonMultiplier;

            if (m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.DeedAttemptInstall || m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.InstalledOnShip)
            {
                if (replaceExistingUpgrade && m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.DeedAttemptInstall)
                {
                    AddLabel(26, 190, 149, "Will Replace Existing Upgrade");
                    AddLabel(213, 190, 2550, "(at no cost)");
                }

                else
                {
                    AddLabel(26, 190, 149, "Ship Type Multiplier:");
                    AddLabel(151, 190, WhiteTextHue, Utility.CreateDecimalString(doubloonMultiplier, 1) + "x");
                }

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

                if (replaceExistingUpgrade && m_ShipUpgradeGumpObject.m_UpgradeDisplayMode == UpgradeDisplayMode.DeedAttemptInstall)
                {
                    doubloonAdjustedCost = 0;
                }

                AddLabel(26, 210, 149, "Adjusted Cost:");
                AddItem(112, 213, 2539);
                AddLabel(143, 210, 63, doubloonAdjustedCost.ToString());
            }

            startY = 65;
            int rowSpacing = 20;

            for (int a = 0; a < upgradeDetail.m_SpecialEffects.Count; a++)
            {
                KeyValuePair <string, ShipUpgradeDetail.UpgradeEffectType> descriptionLine = upgradeDetail.m_SpecialEffects[a];

                AddLabel(125, startY, upgradeDetail.GetHue(descriptionLine.Value), descriptionLine.Key);
                startY += rowSpacing;
            }

            int offsetX = -32;
            int offsetY = -22;

            AddGumpCollection(GumpCollections.GetGumpCollection(upgradeDetail.GumpCollectionId, -1), offsetX + 33, offsetY + 68);

            //Guide
            AddButton(6, 7, 2094, 2095, 0, GumpButtonType.Reply, 0);
            AddLabel(1, -2, 149, "Guide");

            switch (m_ShipUpgradeGumpObject.m_UpgradeDisplayMode)
            {
            case UpgradeDisplayMode.DeedUse:
                AddLabel(250, 209, 63, "Select Target Ship");
                AddButton(372, 206, 2151, 2151, 2, GumpButtonType.Reply, 0);
                break;

            case UpgradeDisplayMode.DeedAttemptInstall:
                AddLabel(211, 209, 63, "Confirm Ship Installation");
                AddButton(372, 206, 2151, 2151, 2, GumpButtonType.Reply, 0);
                break;

            case UpgradeDisplayMode.InstalledOnShip:
                break;
            }
        }