public void UpdateTaskState(uint nTaskID, uint nState) { QuestTraceInfo quest = QuestTranceManager.Instance.GetQuestTraceInfo(nTaskID); if (quest == null) { Engine.Utility.Log.Error("GET QuestTrace is null {0}", nTaskID); return; } quest.state = nState; //必须刷新追踪描述 if (quest.state != 0) { quest.UpdateDesc(); } else { ShowRewardTips(nTaskID); AddCompleteTask(nTaskID, true); QuestTranceManager.Instance.RemoveTaskTrack(nTaskID); if (quest.taskType == TaskType.TaskType_Token) { m_RewardMisssionMgr.DeleteTask(nTaskID); } } //更新追踪任务UI UpdateTaskTraceUI(nTaskID); }
public void UpdateTaskOperate(uint nTaskID, uint nOperate) { QuestTraceInfo quest = QuestTranceManager.Instance.GetQuestTraceInfo(nTaskID); if (quest == null) { Engine.Utility.Log.Error("GET QuestTrace is null {0}", nTaskID); return; } quest.operate = nOperate; { quest.time = UnityEngine.Time.realtimeSinceStartup; //必须刷新追踪描述 才能做下一步 quest.UpdateDesc(); if (quest.GetTaskProcess() == TaskProcess.TaskProcess_CanDone) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_CANSUBMIT, new Client.stTaskCanSubmit() { taskid = nTaskID, desc = quest.strDesc, state = quest.state, oprate = quest.operate }); } if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MissionAndTeamPanel)) { DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MissionAndTeamPanel, UIMsgID.eTask_Refresh_QuestInfo, nTaskID); } } }
/// <summary> /// 刷新令牌悬赏任务CD /// </summary> void RefreshTokenTaskCD() { if (m_tokenQuestTraceItem != null) { QuestTraceInfo questTraceInfo = m_tokenQuestTraceItem.GetTask(); if (questTraceInfo != null) { questTraceInfo.UpdateDesc(); m_tokenQuestTraceItem.UpdateUI(questTraceInfo); } } }
//----------------------------------------------------------------------------------------------- /// <summary> /// 添加接受的任务 /// </summary> /// <param name="taskid"></param> /// <param name="state"></param> /// <param name="operate"></param> public QuestTraceInfo AddReceivedTask(uint taskid, uint state, uint operate, bool bUpdateCanReceive = true) { table.QuestDataBase questdb = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(taskid); if (questdb == null) { Engine.Utility.Log.Error(" get quest null {0}", taskid); return(null); } for (int k = 0; k < m_lstCanReceive.Count; k++) { if (m_lstCanReceive[k].taskId == taskid) { m_lstCanReceive.RemoveAt(k); break; } } QuestTraceInfo cri = new QuestTraceInfo(questdb, state, operate, true); if (cri.dynamicTrance) { Protocol.Instance.RequestTaskTip(taskid); } else { cri.UpdateDesc(); } //请求任务奖励 Protocol.Instance.RequestTaskReward(taskid); Engine.Utility.Log.LogGroup("LCY", "添加的 taskId ={0}", taskid); m_lstReceivedTask.Add(cri); if (bUpdateCanReceive) { UpdateCanReceiveTask(); } return(cri); }
/// <summary> /// 更新动态任务追踪 /// </summary> public void UpdateTaskTrace(uint nTaskID, uint nTextID, List <string> lstParams) { QuestTraceInfo quest = QuestTranceManager.Instance.GetQuestTraceInfo(nTaskID); if (quest != null) { string strDesc = LangTalkData.GetTextById(nTextID); strDesc = strDesc.Replace("\n", ""); if (quest.taskSubType == TaskSubType.DeliverItem) { if (lstParams.Count > (int)GameCmd.RandomParamType.SubmitItemID - 1) { quest.QuestTable.usecommitItemID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.SubmitItemID - 1]); table.QuestItemDataBase questItemDb = GameTableManager.Instance.GetTableItem <table.QuestItemDataBase>(quest.QuestTable.usecommitItemID); if (questItemDb != null && questItemDb.dwSubType == (uint)TaskSubType.DeliverItem) { quest.QuestTable.destMapID = questItemDb.destMapID; quest.QuestTable.monster_npc = questItemDb.monster_npc; quest.QuestTable.dwDoingNpc = questItemDb.monster_npc; } } } else if (quest.taskSubType == TaskSubType.UseItem) { if (lstParams.Count > (int)GameCmd.RandomParamType.UseItemID - 1) { quest.QuestTable.usecommitItemID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.UseItemID - 1]); } quest.QuestTable.destMapID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.JumpMap - 1]); } else if (quest.taskSubType == TaskSubType.KillMonster /*|| quest.taskSubType == TaskSubType.KillMonsterCollect */ || quest.taskSubType == TaskSubType.CallMonster) { if (lstParams.Count > (int)GameCmd.RandomParamType.KillNpcMap - 1) { quest.QuestTable.destMapID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.KillNpcMap - 1]); } if (lstParams.Count > (int)GameCmd.RandomParamType.KillNpcID - 1) { quest.QuestTable.monster_npc = uint.Parse(lstParams[(int)GameCmd.RandomParamType.KillNpcID - 1]); } } else if (quest.taskSubType == TaskSubType.KillMonsterCollect) { if (quest.taskType == TaskType.TaskType_Loop) { quest.QuestTable.destMapID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.JumpMap - 1]); quest.QuestTable.usecommitItemID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.KillDropItemID - 1]); quest.QuestTable.monster_npc = uint.Parse(lstParams[(int)GameCmd.RandomParamType.KillDropNpcID - 1]); //uint.Parse(lstParams[(int)GameCmd.RandomParamType.KillDropNum - 1]); } else { if (lstParams.Count > (int)GameCmd.RandomParamType.KillNpcMap - 1) { quest.QuestTable.destMapID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.KillNpcMap - 1]); } if (lstParams.Count > (int)GameCmd.RandomParamType.KillNpcID - 1) { quest.QuestTable.monster_npc = uint.Parse(lstParams[(int)GameCmd.RandomParamType.KillNpcID - 1]); } } } else if (quest.taskSubType == TaskSubType.Collection) { if (lstParams.Count > (int)GameCmd.RandomParamType.CollectNpcMap - 1) { quest.QuestTable.destMapID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.CollectNpcMap - 1]); } if (lstParams.Count > (int)GameCmd.RandomParamType.CollectNpcID - 1) { quest.QuestTable.collect_npc = uint.Parse(lstParams[(int)GameCmd.RandomParamType.CollectNpcID - 1]); } //if (lstParams.Count>2) //{ // quest.QuestTable.coll //} } else if (quest.taskSubType == TaskSubType.Talk) { if (lstParams.Count > (int)GameCmd.RandomParamType.TalkNpcMap - 1) { quest.QuestTable.submitMapID = uint.Parse(lstParams[(int)GameCmd.RandomParamType.TalkNpcMap - 1]); } if (lstParams.Count > (int)GameCmd.RandomParamType.TalkNpcID - 1) { quest.QuestTable.dwEndNpc = uint.Parse(lstParams[(int)GameCmd.RandomParamType.TalkNpcID - 1]); } } quest.dynamicTranceUpdate = true; quest.QuestTable.strTaskTraceBegin = strDesc; quest.UpdateDesc(); if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MissionAndTeamPanel)) { DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MissionAndTeamPanel, UIMsgID.eUpdateTaskList, null); } if (FirstLoginSuccess) { if (!quest.QuestTable.dwAuto)//如果非自动 则不发送做任务消息 { return; } if (m_bReconnect) { m_bReconnect = false; return; } Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_DONING, new Client.stDoingTask() { taskid = quest.taskId, state = quest.state, oprate = quest.operate, desc = strDesc }); } } }
/// <summary> /// 升级 删除 或者接取任务的时候刷新可以接取任务 /// </summary> public void UpdateCanReceiveTask() { if (m_lstCanReceive == null) { m_lstCanReceive = new List <QuestTraceInfo>(); } //m_lstCanReceive.Clear(); if (Client.ClientGlobal.Instance().MainPlayer == null) { return; } int playerLevel = Client.ClientGlobal.Instance().MainPlayer.GetProp((int)Client.CreatureProp.Level); int job = Client.ClientGlobal.Instance().MainPlayer.GetProp((int)Client.PlayerProp.Job); List <table.QuestDataBase> allTableQuest = GameTableManager.Instance.GetTableList <table.QuestDataBase>(); table.QuestDataBase stTask = null; TaskDataManager taskMgr = DataManager.Manager <TaskDataManager>(); for (int i = 0, imax = allTableQuest.Count; i < allTableQuest.Count; i++) { stTask = allTableQuest[i]; bool contain = false; for (int k = 0; k < m_lstCanReceive.Count; k++) { if (m_lstCanReceive[k].taskId == stTask.dwID) { contain = true; break; } } if (contain) { continue; } if (taskMgr.CheckTaskFinished(stTask.dwID)) { continue; } //职业限制 if (stTask.job != 0 && stTask.job != job) { continue; } //不能接的任务 if (playerLevel < stTask.dwMinLevel || playerLevel > stTask.dwMaxLevel) { continue; } //前置任务没完成直接跳过 if (!string.IsNullOrEmpty(stTask.dwPreTask)) { if (stTask.Type != GameCmd.TaskType.TaskType_Loop && !taskMgr.CheckTaskFinished(stTask.dwPreTask)) { continue; } } //环任务不主动添加,由服务器下发 if (stTask.Type == GameCmd.TaskType.TaskType_Loop) { continue; } //已经接了 if (CheckTaskAccepted(stTask.dwID)) { continue; } if (stTask.dwMinLevel > playerLevel) { continue; } if (taskMgr.CheckTaskFinished(stTask.dwID)) //完成过的任务 { continue; } QuestTraceInfo questTranceInfo = new QuestTraceInfo(stTask, 0, 0, false); questTranceInfo.UpdateDesc(); m_lstCanReceive.Add(questTranceInfo); if (DataManager.Manager <TaskDataManager>().FirstLoginSuccess) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.TASK_CANACCEPT, stTask.dwID); } //引导任务 if (stTask.dwSubType == (uint)TaskSubType.Guild) { if (stTask.startStatus == 2)//主动接取 { Protocol.Instance.RequestAcceptTask(stTask.dwID); } } } }