Commit 4f3041ac by zhaoguojun

支持QA停留

parent 84a2ab40
...@@ -214,6 +214,7 @@ public class PlotConstructor2 extends ElementConstructor { ...@@ -214,6 +214,7 @@ public class PlotConstructor2 extends ElementConstructor {
Boolean curAutoJump, nextAutoJump = false, prevAutoJump, moveWithPlot = false; Boolean curAutoJump, nextAutoJump = false, prevAutoJump, moveWithPlot = false;
StringBuffer skipText = new StringBuffer(), extraUK = new StringBuffer(), extraHP = new StringBuffer(), extraFT = new StringBuffer(), arriveUK = new StringBuffer(); StringBuffer skipText = new StringBuffer(), extraUK = new StringBuffer(), extraHP = new StringBuffer(), extraFT = new StringBuffer(), arriveUK = new StringBuffer();
JSONArray branch = null; JSONArray branch = null;
Boolean preferQA = false;
int branchSize; int branchSize;
...@@ -278,6 +279,8 @@ public class PlotConstructor2 extends ElementConstructor { ...@@ -278,6 +279,8 @@ public class PlotConstructor2 extends ElementConstructor {
curAutoJump = node.getBoolean("autoJump"); curAutoJump = node.getBoolean("autoJump");
prevAutoJump = node.getBoolean("prevAutoJump"); prevAutoJump = node.getBoolean("prevAutoJump");
curUnknownText = (String) node.get("unknownText"); curUnknownText = (String) node.get("unknownText");
//preferQA = node.getBoolean("remain");
//剧情状态的名字,任务线xxx的进度 //剧情状态的名字,任务线xxx的进度
taskLineName = String.format(TASK_LINE, location); taskLineName = String.format(TASK_LINE, location);
...@@ -305,6 +308,7 @@ public class PlotConstructor2 extends ElementConstructor { ...@@ -305,6 +308,7 @@ public class PlotConstructor2 extends ElementConstructor {
nextId = branchNode.getString("nextPlotId"); nextId = branchNode.getString("nextPlotId");
preferQA = branchNode.getBoolean("remain");
//是否将玩家移动到下个剧情所在地点 //是否将玩家移动到下个剧情所在地点
moveWithPlot = branchNode.getBoolean("moveWithPlot"); moveWithPlot = branchNode.getBoolean("moveWithPlot");
...@@ -543,13 +547,23 @@ public class PlotConstructor2 extends ElementConstructor { ...@@ -543,13 +547,23 @@ public class PlotConstructor2 extends ElementConstructor {
//当剧情没有条件限制时的操作(条件剧情) 需要顺便激活qa、地图、物品的查询配置文件, 额外要求当前剧情不是自动跳转(当前剧情不是合并剧情) //当剧情没有条件限制时的操作(条件剧情) 需要顺便激活qa、地图、物品的查询配置文件, 额外要求当前剧情不是自动跳转(当前剧情不是合并剧情)
if (curPremiseList.size() == 0 && historyPremiseList.size() == 0 && !curAutoJump){ if (curPremiseList.size() == 0 && historyPremiseList.size() == 0 && !curAutoJump){
if(preferQA != null && preferQA) {
ConfigTermText termText1, termText2, tmpTermText;
tmpTermText = configTermText;
termText1 = createTermExtra1(configTermText);
termText2 = createTermExtra2(configTermText);
configTermText = alterTerm(configTermText);
configTermTextList.add(termText1);
configTermTextList.add(termText2);
}
else {
Boolean activateFlag = false; Boolean activateFlag = false;
//有activate意味着下一步剧情是合并剧情 //有activate意味着下一步剧情是合并剧情
if(extraFT.indexOf("activate") != -1) if(extraFT.indexOf("activate") != -1)
activateFlag = true; activateFlag = true;
unconditionalPlotProcess(configTermText, nextCondition, activateFlag); unconditionalPlotProcess(configTermText, nextCondition, activateFlag);
} }
}
if (branchNode.getBoolean("higherPriority") != null && branchNode.getBoolean("higherPriority")) if (branchNode.getBoolean("higherPriority") != null && branchNode.getBoolean("higherPriority"))
configTermText.setAuxiliaryPriority("3"); configTermText.setAuxiliaryPriority("3");
...@@ -959,6 +973,48 @@ public class PlotConstructor2 extends ElementConstructor { ...@@ -959,6 +973,48 @@ public class PlotConstructor2 extends ElementConstructor {
// } // }
/**
* @param term 原始的配置数据
* @return 生成的用于QA的配置
*/
private ConfigTermText alterTerm(ConfigTermText term) {
ConfigTermText newTerm = (ConfigTermText)term.clone();
newTerm.setUpdateKnowledge("");
String stemStr = newTerm.getConfigName();
String feature = newTerm.getFeature();
feature = feature + ",activate,post::gameQA(" + QA_URL + ")";
newTerm.setFeature(feature);
newTerm.setNextStep(stemStr+"_qa1,"+stemStr+"_qa2");
return newTerm;
}
private ConfigTermText createTermExtra1(ConfigTermText term) {
String hPremise = "qa_score::number-Bigger=90";
String featureStr = "match,activate,return-0";
String nextStr = "map*,item*,npc*";
String knowledgeStr = UNKNOWN_COUNTER_NAME+":+1";
String configName = term.getConfigName()+"_qa1";
ConfigTermText newTerm = new ConfigTermText(" ", hPremise, featureStr, "", nextStr, knowledgeStr);
newTerm.setConfigName(configName, false);
newTerm.setStatus("sleeping");
return newTerm;
}
private ConfigTermText createTermExtra2(ConfigTermText term) {
String hPremise = "qa_score::number-Smaller=90";
String featureStr = "match,activate";
String nextStr = "map*,item*,npc*";
String configName = term.getConfigName()+"_qa2";
if(term.getFeature().indexOf("activate") != -1) {
nextStr = term.getNextStep() + "," + nextStr;
}
ConfigTermText newTerm = (ConfigTermText)term.clone();
newTerm.setHisPremise(hPremise);
newTerm.setConfigName(configName, false);
newTerm.setFeature(featureStr);
newTerm.setNextStep(nextStr);
newTerm.setStatus("sleeping");
return newTerm;
}
} }
...@@ -230,7 +230,7 @@ public class FormsPoster { ...@@ -230,7 +230,7 @@ public class FormsPoster {
Pattern findTalker = Pattern.compile(TALKER); Pattern findTalker = Pattern.compile(TALKER);
if ((Integer) textscore.get(1) > 90) { if ((Integer) textscore.get(1) > 98) {
Matcher m = findTalker.matcher((String) textscore.get(0)); Matcher m = findTalker.matcher((String) textscore.get(0));
if (m.find()) { if (m.find()) {
npc = m.group(1); npc = m.group(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment