Exemple #1
0
        public static bool FirstChainQuest(BaseQuest quest, object quester)
        {
            Type[] quests = null;

            if (quester is MondainQuester)
            {
                MondainQuester mQuester = (MondainQuester)quester;

                quests = mQuester.Quests;
            }
            else if (quester is BaseQuestItem)
            {
                BaseQuestItem iQuester = (BaseQuestItem)quester;

                quests = iQuester.Quests;
            }

            if (quests != null)
            {
                for (int i = 0; i < quests.Length; i++)
                {
                    if (quests[i] == quest.GetType())
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        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);
            }
        }
Exemple #3
0
        public static Type FindFirstChainQuest(BaseQuest quest)
        {
            if (quest == null)
                return null;
				
            Type[] quests = null;
		
            if (quest.Quester is MondainQuester)
            {
                MondainQuester mQuester = (MondainQuester)quest.Quester;
				
                quests = mQuester.Quests;
            }
            else if (quest.Quester is BaseQuestItem)
            {
                BaseQuestItem iQuester = (BaseQuestItem)quest.Quester;
				
                quests = iQuester.Quests;
            }
			
            if (quests != null)
            {
                for (int i = 0; i < quests.Length; i ++)
                {
                    BaseQuest fQuest = Construct(quests[i]) as BaseQuest;
					
                    if (fQuest != null && fQuest.ChainID == quest.ChainID)
                        return fQuest.GetType();
                }
            }
			
            return null;
        }
        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);
            }
        }