Пример #1
0
        public static void Serialize( GenericWriter writer, LoyaltyInfo info )
        {
            writer.WriteEncodedInt( (int) 0 ); // version

            int length = info.m_Values.Length;
            writer.WriteEncodedInt( length );

            for ( int i = 0; i < length; i++ )
                writer.WriteEncodedInt( info.m_Values[i] );
        }
Пример #2
0
        public static void Serialize(GenericWriter writer, LoyaltyInfo info)
        {
            writer.WriteEncodedInt((int)0);                // version

            int length = info.m_Values.Length;

            writer.WriteEncodedInt(length);

            for (int i = 0; i < length; i++)
            {
                writer.WriteEncodedInt(info.m_Values[i]);
            }
        }
Пример #3
0
        public PlayerMobile()
        {
            m_CollectionTitles = new ArrayList();
            m_CollectionTitles.Add( 1073995 ); // [No Title]

            m_AutoStabledPets = new ArrayList();

            #region ML Quest System
            m_Quests = new List<BaseQuest>();
            m_Chains = new Dictionary<QuestChain, BaseChain>();
            m_DoneQuests = new List<QuestRestartInfo>();
            #endregion

            m_VisList = new ArrayList();
            m_PermaFlags = new ArrayList();
            m_AntiMacroTable = new Hashtable();

            m_BOBFilter = new Engines.BulkOrders.BOBFilter();

            m_GameTime = TimeSpan.Zero;
            m_ShortTermElapse = TimeSpan.FromHours( 8.0 );
            m_LongTermElapse = TimeSpan.FromHours( 40.0 );

            m_JusticeProtectors = new ArrayList();

            m_LoyaltyInfo = new LoyaltyInfo();
            m_TieredQuestInfo = new TieredQuestInfo();

            InvalidateMyRunUO();
        }
Пример #4
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            m_CollectionTitles = new ArrayList();

            switch ( version )
            {
                case 56:
                    {
                        bool hasAnyBardMastery = reader.ReadBool();

                        if ( hasAnyBardMastery )
                        {
                            m_BardMastery = BardMastery.GetFromId( reader.ReadEncodedInt() );
                            m_BardElementDamage = (ResistanceType) reader.ReadEncodedInt();
                            m_NextBardMasterySwitch = reader.ReadDateTime();
                            m_BardMasteryLearnedMask = reader.ReadEncodedInt();
                        }

                        goto case 55;
                    }
                case 55:
                    {
                        m_NextAnkhPendantUse = reader.ReadDateTime();

                        goto case 54;
                    }
                case 54:
                    {
                        m_NextTenthAnniversarySculptureUse = reader.ReadDateTime();

                        goto case 53;
                    }
                case 53:
                    {
                        m_LastForgedPardonUse = reader.ReadDateTime();

                        goto case 52;
                    }
                case 52:
                    {
                        m_DoomCredits = reader.ReadInt();

                        m_TieredQuestInfo = new TieredQuestInfo( reader );

                        m_LoyaltyInfo = new LoyaltyInfo( reader );

                        m_FloorTrapsPlaced = reader.ReadInt();

                        m_NextPuzzleAttempt = reader.ReadDateTime();

                        m_NextDrinkExplodingTarPotion = reader.ReadDateTime();

                        m_NextLuckyCoinWish = reader.ReadDateTime();

                        m_NextSilverSaplingUse = reader.ReadDateTime();

                        m_SacredQuestNextChance = reader.ReadDateTime();

                        m_HumilityQuestStatus = (HumilityQuestStatus) reader.ReadInt();
                        m_HumilityQuestNextChance = reader.ReadDateTime();

                        m_NextGemOfSalvationUse = reader.ReadDateTime();

                        m_AnkhNextUse = reader.ReadDateTime();

                        m_Quests = QuestReader.Quests( reader, this );
                        m_Chains = QuestReader.Chains( reader );

                        m_TenthAnniversaryCredits = reader.ReadDouble();

                        m_KRStartingQuestStep = reader.ReadByte();

                        m_CurrentCollectionTitle = reader.ReadInt();
                        int titlecount = reader.ReadInt();

                        for ( int i = 0; i < titlecount; i++ )
                        {
                            int title = reader.ReadInt();
                            m_CollectionTitles.Add( title );
                        }

                        int recipeCount = reader.ReadInt();

                        if ( recipeCount > 0 )
                        {
                            m_AcquiredRecipes = new Hashtable();

                            for ( int i = 0; i < recipeCount; i++ )
                            {
                                int r = reader.ReadInt();
                                if ( reader.ReadBool() )	//Don't add in recipies which we haven't gotten or have been removed
                                    m_AcquiredRecipes.Add( r, true );
                            }
                        }

                        m_AutoStabledPets = reader.ReadMobileList();

                        ACState = (AdvancedCharacterState) reader.ReadInt();

                        Deaths = reader.ReadInt();

                        NextDrinkConflagrationPotion = reader.ReadTimeSpan();
                        NextDrinkMaskOfDeathPotion = reader.ReadTimeSpan();
                        NextDrinkConfusionPotion = reader.ReadTimeSpan();

                        m_GuildRank = reader.ReadInt();

                        m_LastLogin = reader.ReadDateTime();

                        m_ToTItemsTurnedIn = reader.ReadInt();
                        m_ToTTotalMonsterFame = reader.ReadDouble();

                        LastTierLoss = reader.ReadDeltaTime();

                        LastChampionTierLoss = reader.ReadDeltaTime();

                        LastSuperChampionTierLoss = reader.ReadDeltaTime();

                        int length_super = reader.ReadInt();

                        for ( int i = 0; i < length_super; i++ )
                            SuperChampionTiers[i] = reader.ReadInt();

                        int length = reader.ReadInt();

                        for ( int i = 0; i < length; i++ )
                            ChampionTiers[i] = reader.ReadDouble();

                        m_LastValorLoss = reader.ReadDeltaTime();

                        m_LastHonorLoss = reader.ReadDeltaTime();
                        m_SolenFriendship = (SolenFriendship) reader.ReadEncodedInt();

                        m_Quest = QuestSerializer.DeserializeQuest( reader );

                        if ( m_Quest != null )
                            m_Quest.From = this;

                        int count = reader.ReadEncodedInt();

                        if ( count > 0 )
                        {
                            m_DoneQuests = new List<QuestRestartInfo>();

                            for ( int i = 0; i < count; ++i )
                            {
                                Type questType = QuestSerializer.ReadType( QuestSystem.QuestTypes, reader );
                                DateTime restartTime = reader.ReadDateTime();

                                m_DoneQuests.Add( new QuestRestartInfo( questType, restartTime ) );
                            }
                        }

                        m_Profession = reader.ReadEncodedInt();

                        m_LastCompassionLoss = reader.ReadDeltaTime();

                        m_CompassionGains = reader.ReadEncodedInt();

                        if ( m_CompassionGains > 0 )
                            m_NextCompassionDay = reader.ReadDeltaTime();

                        m_BOBFilter = new Engines.BulkOrders.BOBFilter( reader );

                        if ( reader.ReadBool() )
                        {
                            m_HairModID = reader.ReadInt();
                            m_HairModHue = reader.ReadInt();
                            m_BeardModID = reader.ReadInt();
                            m_BeardModHue = reader.ReadInt();

                            // We cannot call SetHairMods( -1, -1 ) here because the items have not yet loaded
                            Timer.DelayCall( TimeSpan.Zero, new TimerCallback( RevertHair ) );
                        }

                        SavagePaintExpiration = reader.ReadTimeSpan();

                        if ( SavagePaintExpiration > TimeSpan.Zero )
                        {
                            BodyMod = ( Female ? 184 : 183 );
                            HueMod = 0;
                        }

                        m_NpcGuild = (NpcGuild) reader.ReadInt();
                        m_NpcGuildJoinTime = reader.ReadDateTime();
                        m_NpcGuildGameTime = reader.ReadTimeSpan();

                        m_PermaFlags = reader.ReadMobileList();

                        NextTailorBulkOrder = reader.ReadTimeSpan();

                        NextSmithBulkOrder = reader.ReadTimeSpan();

                        m_LastJusticeLoss = reader.ReadDeltaTime();
                        m_JusticeProtectors = reader.ReadMobileList();

                        m_LastSacrificeGain = reader.ReadDeltaTime();
                        m_LastSacrificeLoss = reader.ReadDeltaTime();
                        m_AvailableResurrects = reader.ReadInt();

                        m_Flags = (PlayerFlag) reader.ReadInt();

                        m_LongTermElapse = reader.ReadTimeSpan();
                        m_ShortTermElapse = reader.ReadTimeSpan();
                        m_GameTime = reader.ReadTimeSpan();

                        break;
                    }
            }

            #region ML Quest System
            if ( m_Quests == null )
                m_Quests = new List<BaseQuest>();

            if ( m_Chains == null )
                m_Chains = new Dictionary<QuestChain, BaseChain>();

            if ( m_DoneQuests == null )
                m_DoneQuests = new List<QuestRestartInfo>();
            #endregion

            if ( this != null && this.Region.IsPartOf( typeof( DoomLampRoom ) ) )
            {
                Rectangle2D rect = new Rectangle2D( 342, 168, 16, 16 );

                int x = Utility.Random( rect.X, rect.Width );
                int y = Utility.Random( rect.Y, rect.Height );

                if ( x >= 345 && x <= 352 && y >= 173 && y <= 179 )
                {
                    x = 353;
                    y = 172;
                }

                this.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
            }

            // Professions weren't verified on 1.0 RC0
            if ( !CharacterCreation.VerifyProfession( m_Profession ) )
                m_Profession = 0;

            if ( m_PermaFlags == null )
                m_PermaFlags = new ArrayList();

            if ( m_JusticeProtectors == null )
                m_JusticeProtectors = new ArrayList();

            if ( m_BOBFilter == null )
                m_BOBFilter = new Engines.BulkOrders.BOBFilter();

            if ( m_LoyaltyInfo == null )
                m_LoyaltyInfo = new LoyaltyInfo();

            if ( m_TieredQuestInfo == null )
                m_TieredQuestInfo = new TieredQuestInfo();

            List<Mobile> list = this.Stabled;

            for ( int i = 0; i < list.Count; ++i )
            {
                BaseCreature bc = list[i] as BaseCreature;

                if ( bc != null )
                    bc.IsStabled = true;
            }

            if ( Hidden ) // Hiding is the only buff where it has an effect that's serialized.
                this.AddBuff( new BuffInfo( BuffIcon.HidingAndOrStealth, 1075655 ) );
        }