Ejemplo n.º 1
0
    private void OnCommitTask(QuestTraceInfo taskInfo)
    {
        table.QuestDataBase questDB = taskInfo.QuestTable;
        if (questDB == null)
        {
            Engine.Utility.Log.Error("QuestTable is null");
            return;
        }

        if (taskInfo.taskSubType == TaskSubType.Guild)
        {
            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MissionMessagePanel, data: taskInfo.taskId);
            return;
        }

        PanelID pid;
        int     tab    = 0;
        int     copyId = 0;

        uint jumpId;

        if (taskInfo.IsOpenUI(out jumpId))
        {
            ItemManager.DoJump(jumpId);
            return;
        }
        else if (taskInfo.IsChangeBodyTask())
        {
            //bool isChange = (bool)Client.ClientGlobal.Instance().MainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsChange, null);
            //if (!isChange)
            //{
            //    m_nDoingTaskID = taskInfo.taskId;
            //    if (m_bAddChangeListener)
            //    {
            //        return;
            //    }

            //    m_bAddChangeListener = true;
            //    Engine.Utility.Log.Info("{0}CanDone 等待.......变身回来 执行任务{1}", TAG, m_nDoingTaskID);
            //    Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_CHANGE, OnEvent);
            //    return;
            //}

            m_nDoingTaskID = taskInfo.taskId;
            if (false == m_bAddChangeListener && false == MainPlayerIsChangeBody())
            {
                m_bAddChangeListener = true;
                Engine.Utility.Log.Info("{0}CanDone 等待.......变身回来 执行任务{1}", TAG, m_nDoingTaskID);
                Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_CHANGE, OnEvent);
            }

            VisitNpc(questDB.dwHelpCommit, questDB.submitMapID, questDB.dwEndNpc, questDB.dwID);
            return;
        }
        uint npcid = 0;

        if (taskInfo.IsKillMonster(out npcid))
        {
            Client.ISkillPart skillPart = Client.ClientGlobal.Instance().MainPlayer.GetPart(Client.EntityPart.Skill) as Client.ISkillPart;
            if (skillPart != null)
            {
                if (skillPart.GetCurSkillState() != (int)Client.SkillState.None)
                {
                    m_nDoingTaskID = taskInfo.taskId;
                    Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.SKILLNONESTATE_ENTER, OnEvent);
                    Engine.Utility.Log.Info("等待.......技能播放完毕 执行任务{0}", m_nDoingTaskID);
                    return;
                }
            }
        }

        //令牌悬赏无交任务npc
        if (taskInfo.taskType != GameCmd.TaskType.TaskType_Token)
        {
            DataManager.Manager <RideManager>().TryUsingRide(delegate(object o)
            {
                VisitNpc(questDB.dwHelpCommit, questDB.submitMapID, questDB.dwEndNpc, questDB.dwID);
            }, null);
        }
    }