Пример #1
0
        public virtual void Deserialize(GenericReader reader)
        {
            int version = reader.ReadEncodedInt();

            switch (reader.ReadInt())
            {
            case 0x0: m_Quester = null; break;

            case 0x1: m_Quester = reader.ReadMobile() as MondainQuester; break;

            case 0x2: m_Quester = reader.ReadItem() as BaseQuestItem; break;
            }

            if (m_Quester is BaseEscort)
            {
                BaseEscort escort = (BaseEscort)m_Quester;

                escort.Quest = this;
            }
            else if (m_Quester is BaseQuestItem)
            {
                BaseQuestItem item = (BaseQuestItem)m_Quester;

                item.Quest = this;
            }

            for (int i = 0; i < m_Objectives.Count; i++)
            {
                BaseObjective objective = m_Objectives[i];

                objective.Deserialize(reader);
            }
        }
Пример #2
0
        public virtual void Deserialize(GenericReader reader)
        {
            int version = reader.ReadEncodedInt();

            if (version > 0)
            {
                string questerType = reader.ReadString();

                if (questerType != null)
                {
                    m_QuesterType = ScriptCompiler.FindTypeByName(questerType);
                }
            }

            switch (reader.ReadInt())
            {
            case 0x0:
                m_Quester = null;
                break;

            case 0x1:
                m_Quester = reader.ReadMobile() as NewQuester;
                break;

            case 0x2:
                m_Quester = reader.ReadItem() as BaseQuestItem;
                break;
            }

            /*
             * if (m_Quester is BaseEscort)
             * {
             *      BaseEscort escort = (BaseEscort)m_Quester;
             *
             *      escort.Quest = this;
             * }
             */
            if (m_Quester is BaseQuestItem)
            {
                BaseQuestItem item = (BaseQuestItem)m_Quester;

                item.Quest = this;
            }

            if (version == 0 && m_Quester != null)
            {
                m_QuesterType = m_Quester.GetType();
            }

            for (int i = 0; i < m_Objectives.Count; i++)
            {
                BaseObjective objective = m_Objectives[i];

                objective.Deserialize(reader);
            }
        }