/** 完成任务以及前置(gm) */ private void toCompleteQuestByGm(int id) { if (isQuestComplete(id)) { return; } QuestConfig config = QuestConfig.get(id); //前置任务 foreach (int v in config.preQuests) { toCompleteQuestByGm(v); } //完成当前 QuestData qData = _d.accepts.get(id); if (qData == null) { doAcceptQuest(config); qData = _d.accepts.get(id); //已自动完成 if (qData == null) { return; } } toCommitQuest(qData, true); }
public void makeConfig() { if (config == null) { config = QuestConfig.get(id); } }
/// <summary> /// 接取任务(执行数据) /// </summary> public void acceptQuest(int id) { if (_d.accepts.contains(id)) { me.warnLog("接任务时,任务已接", id); return; } if (isQuestComplete(id)) { me.warnLog("接任务时,任务已完成", id); return; } QuestConfig config = QuestConfig.get(id); //任务失败了 QuestCompleteData cData; if ((cData = _d.completeQuestsDic.get(id)) != null && !cData.isSuccess) { //不可接取失败 if (!config.cantAcceptFailed) { me.warnLog("接任务时,不可接取已失败的任务", id); return; } } foreach (int v in config.preQuests) { if (!isQuestComplete(v)) { me.warnLog("接任务时,前置任务未完成", id, v); return; } } if (!checkAcceptConditions(config, true)) { me.warnLog("接任务时,条件不满足", id); return; } //接任务给任务道具 DIntData[] questItem = config.questItem; if (questItem.Length > 0) { //检测是否有足够的格子放置任务道具 if (!me.bag.hasItemPlace(questItem)) { me.warnLog("背包没有足够的位置放任务道具", id); return; } } preDoAcceptQuest(config); }
/** 检查等待接取组受到完成任务的影响 */ private void checkWaitAcceptQuestByComplete(QuestConfig config) { bool hasSee = false; bool hasAccept = false; int[] values = config.afterQuests.getValues(); QuestConfig qConfig; for (int i = 0, len = config.afterQuests.size(); i < len; ++i) { //可接 if (checkQuestCanAcceptFirst(qConfig = QuestConfig.get(values[i]))) { _waitAcceptQuests.put(qConfig.id, qConfig); if (checkSeeConditions(qConfig)) { _canSeeQuests.put(qConfig.id, qConfig); hasSee = true; } if (checkAcceptConditions(qConfig, false)) { _canAcceptQuests.put(qConfig.id, qConfig); hasAccept = true; } } } if (hasSee) { me.dispatch(GameEventType.RefreshCanSeeQuests); } if (hasAccept) { me.dispatch(GameEventType.RefreshCanAcceptQuests); } checkAutoAccept(); }
/// <summary> /// 接任务(gm指令)(并完成所有前置) /// </summary> public void acceptQuestByGM(int id, bool needPre) { if (_d.accepts.contains(id)) { me.warnLog("gm接任务时,任务已接", id); return; } if (isQuestComplete(id)) { me.warnLog("gm接任务时,任务已完成", id); return; } if (needPre) { toCompleteQuestByGm(id); } doAcceptQuest(QuestConfig.get(id)); }
public override void onNewCreate() { _d.clientTaskInstanceIDIndex = ShineSetting.indexMaxHalf; //接取首次任务 IntList list = QuestConfig.initQuests; if (!list.isEmpty()) { int[] values = list.getValues(); QuestConfig config; for (int i = 0, len = list.size(); i < len; ++i) { config = QuestConfig.get(values[i]); if (me.role.checkRoleConditions(config.acceptConditions, false)) { doAcceptQuest(config); } } } }
/// <summary> /// 获取某任务是否完成 /// </summary> public bool isQuestComplete(int id) { return(isQuestComplete(QuestConfig.get(id))); }
/// <summary> /// 检查单个角色条件 /// </summary> public virtual bool checkOneRoleCondition(int[] args, bool needNotice) { switch (args[0]) { case RoleConditionType.Level: { if (me.role.getLevel() < args[1]) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needLevel); } return(false); } } break; case RoleConditionType.FunctionOpen: { if (!me.func.isFunctionOpen(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_functionNotOpen, FunctionConfig.get(args[1]).showName); } return(false); } } break; case RoleConditionType.NeedUnion: { if (!me.union.hasUnion()) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needUnion); } return(false); } } break; case RoleConditionType.QuestComplete: { if (!me.quest.isQuestComplete(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needCompleteQuest, QuestConfig.get(args[1]).name); } return(false); } } break; case RoleConditionType.OnStatus: { if (!me.character.getCurrentCharacterUseLogic().getFightLogic().status.getStatus(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needOnStatus, StatusConfig.getShowName(args[1])); } return(false); } } break; case RoleConditionType.OffStatus: { if (me.character.getCurrentCharacterUseLogic().getFightLogic().status.getStatus(args[1])) { if (needNotice) { me.showInfoCode(InfoCodeType.Condition_needOffStatus, StatusConfig.getShowName(args[1])); } return(false); } } break; } return(true); }