Exemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            //Version 0
            if (version >= 0)
            {
                m_UpgradeType = (ShipUpgrades.UpgradeType)reader.ReadInt();

                m_ThemeUpgrade       = (ShipUpgrades.ThemeType)reader.ReadInt();
                m_PaintUpgrade       = (ShipUpgrades.PaintType)reader.ReadInt();
                m_CannonMetalUpgrade = (ShipUpgrades.CannonMetalType)reader.ReadInt();

                m_OutfittingUpgrade = (ShipUpgrades.OutfittingType)reader.ReadInt();
                m_BannerUpgrade     = (ShipUpgrades.BannerType)reader.ReadInt();
                m_CharmUpgrade      = (ShipUpgrades.CharmType)reader.ReadInt();

                m_MinorAbilityUpgrade = (ShipUpgrades.MinorAbilityType)reader.ReadInt();
                m_MajorAbilityUpgrade = (ShipUpgrades.MajorAbilityType)reader.ReadInt();
                m_EpicAbilityUpgrade  = (ShipUpgrades.EpicAbilityType)reader.ReadInt();
            }
        }
        public static ShipStatsProfile ApplyUpgradeModifiers(BaseShipDeed shipDeed, BaseShip ship, ShipStatsProfile shipStatsProfile)
        {
            if (shipStatsProfile == null)
            {
                return(shipStatsProfile);
            }

            List <ShipUpgradeDetail> m_UpgradeDetails = new List <ShipUpgradeDetail>();

            ShipUpgrades.ThemeType       m_ThemeUpgrade       = ShipUpgrades.ThemeType.None;
            ShipUpgrades.PaintType       m_PaintUpgrade       = ShipUpgrades.PaintType.None;
            ShipUpgrades.CannonMetalType m_CannonMetalUpgrade = ShipUpgrades.CannonMetalType.None;

            ShipUpgrades.OutfittingType m_OutfittingUpgrade = ShipUpgrades.OutfittingType.None;
            ShipUpgrades.BannerType     m_BannerUpgrade     = ShipUpgrades.BannerType.None;
            ShipUpgrades.CharmType      m_CharmUpgrade      = ShipUpgrades.CharmType.None;

            ShipUpgrades.MinorAbilityType m_MinorAbilityUpgrade = ShipUpgrades.MinorAbilityType.None;
            ShipUpgrades.MajorAbilityType m_MajorAbilityUpgrade = ShipUpgrades.MajorAbilityType.None;
            ShipUpgrades.EpicAbilityType  m_EpicAbilityUpgrade  = ShipUpgrades.EpicAbilityType.None;

            #region Get Properties

            if (shipDeed != null)
            {
                m_ThemeUpgrade       = shipDeed.m_ThemeUpgrade;
                m_PaintUpgrade       = shipDeed.m_PaintUpgrade;
                m_CannonMetalUpgrade = shipDeed.m_CannonMetalUpgrade;

                m_OutfittingUpgrade = shipDeed.m_OutfittingUpgrade;
                m_BannerUpgrade     = shipDeed.m_BannerUpgrade;
                m_CharmUpgrade      = shipDeed.m_CharmUpgrade;

                m_MinorAbilityUpgrade = shipDeed.m_MinorAbilityUpgrade;
                m_MajorAbilityUpgrade = shipDeed.m_MajorAbilityUpgrade;
                m_EpicAbilityUpgrade  = shipDeed.m_EpicAbilityUpgrade;
            }

            if (ship != null)
            {
                m_ThemeUpgrade       = ship.m_ThemeUpgrade;
                m_PaintUpgrade       = ship.m_PaintUpgrade;
                m_CannonMetalUpgrade = ship.m_CannonMetalUpgrade;

                m_OutfittingUpgrade = ship.m_OutfittingUpgrade;
                m_BannerUpgrade     = ship.m_BannerUpgrade;
                m_CharmUpgrade      = ship.m_CharmUpgrade;

                m_MinorAbilityUpgrade = ship.m_MinorAbilityUpgrade;
                m_MajorAbilityUpgrade = ship.m_MajorAbilityUpgrade;
                m_EpicAbilityUpgrade  = ship.m_EpicAbilityUpgrade;
            }

            #endregion

            #region Apply Upgrades

            m_UpgradeDetails.Add(ShipUpgrades.GetThemeDetail(m_ThemeUpgrade));
            m_UpgradeDetails.Add(ShipUpgrades.GetPaintDetail(m_PaintUpgrade));
            m_UpgradeDetails.Add(ShipUpgrades.GetCannonMetalDetail(m_CannonMetalUpgrade));

            m_UpgradeDetails.Add(ShipUpgrades.GetOutfittingDetail(m_OutfittingUpgrade));
            m_UpgradeDetails.Add(ShipUpgrades.GetBannerDetail(m_BannerUpgrade));
            m_UpgradeDetails.Add(ShipUpgrades.GetCharmDetail(m_CharmUpgrade));

            m_UpgradeDetails.Add(ShipUpgrades.GetMinorAbilityDetail(m_MinorAbilityUpgrade));
            m_UpgradeDetails.Add(ShipUpgrades.GetMajorAbilityDetail(m_MajorAbilityUpgrade));
            m_UpgradeDetails.Add(ShipUpgrades.GetEpicAbilityDetail(m_EpicAbilityUpgrade));

            foreach (ShipUpgradeDetail shipUpgradeDetail in m_UpgradeDetails)
            {
                if (shipUpgradeDetail == null)
                {
                    continue;
                }

                shipStatsProfile.HoldSizeUpgradeModifier += shipUpgradeDetail.HoldCapacity;

                shipStatsProfile.MaxHitPointsUpgradeModifier  += shipUpgradeDetail.MaxHitPoints;
                shipStatsProfile.MaxSailPointsUpgradeModifier += shipUpgradeDetail.MaxSailPoints;
                shipStatsProfile.MaxGunPointsUpgradeModifier  += shipUpgradeDetail.MaxGunPoints;

                shipStatsProfile.ForwardSpeedUpgradeModifier        += shipUpgradeDetail.ForwardSpeed;
                shipStatsProfile.DriftSpeedUpgradeModifier          += shipUpgradeDetail.DriftSpeed;
                shipStatsProfile.SlowdownModePenaltyUpgradeModifier += shipUpgradeDetail.SlowdownModePenalty;

                shipStatsProfile.CannonAccuracyUpgradeModifier       += shipUpgradeDetail.CannonAccuracy;
                shipStatsProfile.CannonDamageUpgradeModifier         += shipUpgradeDetail.CannonDamage;
                shipStatsProfile.CannonRangeUpgradeModifier          += shipUpgradeDetail.CannonRange;
                shipStatsProfile.CannonReloadDurationUpgradeModifier += shipUpgradeDetail.CannonReloadTime;

                shipStatsProfile.MinorAbilityCooldownDurationUpgradeModifier += shipUpgradeDetail.MinorAbilityCooldown;
                shipStatsProfile.MajorAbilityCooldownDurationUpgradeModifier += shipUpgradeDetail.MajorAbilityCooldown;
                shipStatsProfile.EpicAbilityCooldownDurationUpgradeModifier  += shipUpgradeDetail.EpicAbilityCooldown;

                shipStatsProfile.RepairCooldownDurationUpgradeModifier += shipUpgradeDetail.RepairCooldown;
                shipStatsProfile.BoardingChanceUpgradeModifier         += shipUpgradeDetail.BoardingChance;

                shipStatsProfile.CannonEnemyCrewDamageUpgradeModifier  += shipUpgradeDetail.CannonEnemyCrewDamage;
                shipStatsProfile.CannonHitPointsDamageUpgradeModifier  += shipUpgradeDetail.CannonHitPointsDamage;
                shipStatsProfile.CannonSailPointsDamageUpgradeModifier += shipUpgradeDetail.CannonSailPointsDamage;
                shipStatsProfile.CannonGunPointsDamageUpgradeModifier  += shipUpgradeDetail.CannonGunPointsDamage;

                shipStatsProfile.CrewDamageMeleeDamageDealtUpgradeModifier += shipUpgradeDetail.CrewDamageMeleeDamageDealt;
                shipStatsProfile.CrewDamageSpellDamageDealtUpgradeModifier += shipUpgradeDetail.CrewDamageSpellDamageDealt;

                shipStatsProfile.CrewDamageMeleeDamageReceivedUpgradeModifier  += shipUpgradeDetail.CrewDamageMeleeDamageReceived;
                shipStatsProfile.CrewDamageSpellDamageReceivedUpgradeModifier  += shipUpgradeDetail.CrewDamageSpellDamageReceived;
                shipStatsProfile.CrewDamageCannonDamageReceivedUpgradeModifier += shipUpgradeDetail.CrewDamageCannonDamageReceived;

                shipStatsProfile.RepairHitPointsBonusUpgradeModifier     += shipUpgradeDetail.RepairHitPointsBonus;
                shipStatsProfile.RepairSailPointsBonusUpgradeModifier    += shipUpgradeDetail.RepairSailPointsBonus;
                shipStatsProfile.RepairGunPointsBonusUpgradeModifier     += shipUpgradeDetail.RepairGunPointsBonus;
                shipStatsProfile.RepairMaterialsReductionUpgradeModifier += shipUpgradeDetail.RepairMaterialsReduction;

                shipStatsProfile.MinorAbilityEffectivenessUpgradeModifier += shipUpgradeDetail.MinorAbilityEffectiveness;
                shipStatsProfile.MajorAbilityEffectivenessUpgradeModifier += shipUpgradeDetail.MajorAbilityEffectiveness;
                shipStatsProfile.EpicAbilityEffectivenessUpgradeModifier  += shipUpgradeDetail.EpicAbilityEffectiveness;

                shipStatsProfile.CrewHealingReceivedUpgradeModifier += shipUpgradeDetail.CrewHealingReceived;

                shipStatsProfile.DoubloonsEarnedFromEnemyCrewUpgradeModifier  += shipUpgradeDetail.DoubloonsEarnedFromEnemyCrew;
                shipStatsProfile.DoubloonsEarnedFromEnemyShipsUpgradeModifier += shipUpgradeDetail.DoubloonsEarnedFromEnemyShips;

                shipStatsProfile.FishingSuccessUpgradeModifier += shipUpgradeDetail.FishingSuccess;

                shipStatsProfile.SpyglassAccuracyUpgradeModifier += shipUpgradeDetail.SpyglassAccuracy;
            }

            #endregion

            return(shipStatsProfile);
        }
Exemplo n.º 3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            //Version 0
            if (version >= 0)
            {
                m_MultiID = reader.ReadInt();
                m_Offset  = reader.ReadPoint3D();

                //-----

                m_Registered = reader.ReadBool();

                m_ShipName = reader.ReadString();
                m_Owner    = (PlayerMobile)reader.ReadMobile();

                int StoredHitPoints  = reader.ReadInt();
                int StoredSailPoints = reader.ReadInt();
                int StoredGunPoints  = reader.ReadInt();

                MaxHitPointsCreationModifier  = reader.ReadDouble();
                MaxSailPointsCreationModifier = reader.ReadDouble();
                MaxGunPointsCreationModifier  = reader.ReadDouble();

                ForwardSpeedCreationModifier        = reader.ReadDouble();
                DriftSpeedCreationModifier          = reader.ReadDouble();
                SlowdownModePenaltyCreationModifier = reader.ReadDouble();

                CannonAccuracyCreationModifier       = reader.ReadDouble();
                CannonDamageCreationModifier         = reader.ReadDouble();
                CannonRangeCreationModifier          = reader.ReadDouble();
                CannonReloadDurationCreationModifier = reader.ReadDouble();

                MinorAbilityCooldownDurationCreationModifier = reader.ReadDouble();
                MajorAbilityCooldownDurationCreationModifier = reader.ReadDouble();
                EpicAbilityCooldownDurationCreationModifier  = reader.ReadDouble();

                RepairCooldownDurationCreationModifier = reader.ReadDouble();
                BoardingChanceCreationModifier         = reader.ReadDouble();

                m_TargetingMode = (TargetingMode)reader.ReadInt();

                m_IPAsCoOwners    = reader.ReadBool();
                m_GuildAsCoOwners = reader.ReadBool();
                m_IPAsFriends     = reader.ReadBool();
                m_GuildAsFriends  = reader.ReadBool();

                m_ThemeUpgrade        = (ShipUpgrades.ThemeType)reader.ReadInt();
                m_PaintUpgrade        = (ShipUpgrades.PaintType)reader.ReadInt();
                m_CannonMetalUpgrade  = (ShipUpgrades.CannonMetalType)reader.ReadInt();
                m_OutfittingUpgrade   = (ShipUpgrades.OutfittingType)reader.ReadInt();
                m_BannerUpgrade       = (ShipUpgrades.BannerType)reader.ReadInt();
                m_CharmUpgrade        = (ShipUpgrades.CharmType)reader.ReadInt();
                m_MinorAbilityUpgrade = (ShipUpgrades.MinorAbilityType)reader.ReadInt();
                m_MajorAbilityUpgrade = (ShipUpgrades.MajorAbilityType)reader.ReadInt();
                m_EpicAbilityUpgrade  = (ShipUpgrades.EpicAbilityType)reader.ReadInt();

                m_MinorAbilityLastActivated = reader.ReadDateTime();
                m_MajorAbilityLastActivated = reader.ReadDateTime();
                m_EpicAbilityLastActivated  = reader.ReadDateTime();

                m_TimeLastRepaired = reader.ReadDateTime();

                int coOwnerCount = reader.ReadInt();
                for (int a = 0; a < coOwnerCount; a++)
                {
                    m_CoOwners.Add(reader.ReadMobile());
                }

                int friendCount = reader.ReadInt();
                for (int a = 0; a < friendCount; a++)
                {
                    m_Friends.Add(reader.ReadMobile());
                }

                //-----

                m_ShipStatsProfile = ShipUniqueness.GetShipStatsProfile(this, null, true, true);

                HitPoints  = StoredHitPoints;
                SailPoints = StoredSailPoints;
                GunPoints  = StoredGunPoints;
            }
        }