Exemple #1
0
        public static void Deserialize(GenericReader reader, int version)
        {
            MLQuest quest      = MLQuestSystem.ReadQuestRef(reader);
            int     oldVersion = reader.ReadInt();

            if (quest == null)
            {
                return;                 // not saved or no longer exists
            }
            quest.Refresh(oldVersion);
            quest.m_Deserialized = true;
        }
        public MLQuestContext(IGenericReader reader, int version)
        {
            Owner          = reader.ReadMobile <PlayerMobile>();
            QuestInstances = new List <MLQuestInstance>();
            m_DoneQuests   = new List <MLDoneQuestInfo>();
            ChainOffers    = new List <MLQuest>();

            int instances = reader.ReadInt();

            for (int i = 0; i < instances; ++i)
            {
                MLQuestInstance instance = MLQuestInstance.Deserialize(reader, version, Owner);

                if (instance != null)
                {
                    QuestInstances.Add(instance);
                }
            }

            int doneQuests = reader.ReadInt();

            for (int i = 0; i < doneQuests; ++i)
            {
                MLDoneQuestInfo info = MLDoneQuestInfo.Deserialize(reader, version);

                if (info != null)
                {
                    m_DoneQuests.Add(info);
                }
            }

            int chainOffers = reader.ReadInt();

            for (int i = 0; i < chainOffers; ++i)
            {
                MLQuest quest = MLQuestSystem.ReadQuestRef(reader);

                if (quest?.IsChainTriggered == true)
                {
                    ChainOffers.Add(quest);
                }
            }

            m_Flags = (MLQuestFlag)reader.ReadEncodedInt();
        }