Commit 98a7786c by 赵国君

快速开始

parent 04bd4be9
package com.qiwu.chatbotbackend.GameEnvironment;
public class Test {
public static void main(String[] args) throws Exception {
GameEnv gameEnv = new GameEnv("7011489633");
// System.out.println(gameEnv.queryNpcAttrByNpcName("武士", "热度"));
System.out.println(gameEnv.queryGlobalAttr("啦啦"));
}
}
...@@ -52,16 +52,17 @@ public class PlotConstructor2 extends ElementConstructor { ...@@ -52,16 +52,17 @@ public class PlotConstructor2 extends ElementConstructor {
} }
public void construct(JSONObject jsonObject, UserInfo userinfo) { public void construct(JSONObject jsonObject, UserInfo userinfo) {
Integer startOption = jsonObject.getInteger("startOption");
try { try {
addGameStartPlot(jsonObject, keywordMap); if(startOption != null && startOption.equals(2)) {
} else {
addGameStartPlot(jsonObject, keywordMap);
}
JSONArray plots = jsonObject.getJSONArray("plots"); JSONArray plots = jsonObject.getJSONArray("plots");
String start = (String) jsonObject.get("start"), startCondition; String start = (String) jsonObject.get("start"), startCondition;
JSONObject returnMessage = null; JSONObject returnMessage = null;
this.plots = plots; this.plots = plots;
constructAdjList(plots); constructAdjList(plots);
...@@ -737,10 +738,7 @@ public class PlotConstructor2 extends ElementConstructor { ...@@ -737,10 +738,7 @@ public class PlotConstructor2 extends ElementConstructor {
jsonStr = jsonStr.replace("startId", gameElements.getString("start")); jsonStr = jsonStr.replace("startId", gameElements.getString("start"));
jsonStr = jsonStr.replace("site_list", keywordMap.get("site_list").toString()); jsonStr = jsonStr.replace("site_list", keywordMap.get("site_list").toString());
//System.out.println("JSONSTR ------------------------------\n" + jsonStr);
JSONObject config = JSONObject.parseObject(jsonStr); JSONObject config = JSONObject.parseObject(jsonStr);
gameElements.getJSONArray("plots").addAll(config.getJSONArray("gameStart")); gameElements.getJSONArray("plots").addAll(config.getJSONArray("gameStart"));
gameElements.put("start", "start1"); gameElements.put("start", "start1");
gameElements.put("firstUnknownText", GAME_START_HINT); gameElements.put("firstUnknownText", GAME_START_HINT);
......
...@@ -829,7 +829,7 @@ public class ActionMatcher { ...@@ -829,7 +829,7 @@ public class ActionMatcher {
poster.postTerm(curInfoPoint, historyInfoPoint, ans, ansAction, url); poster.postTerm(curInfoPoint, historyInfoPoint, ans, ansAction, url);
}else if(postType.equals("gameQA")){ }else if(postType.equals("gameQA")){
System.out.println("提交表单" + gameEnv); System.out.println("提交表单" + gameEnv);
poster.postGameQA(curInfoPoint, historyInfoPoint, ans, gameEnv, worldController, url, userinfo); poster.postGameQA(curInfoPoint, historyInfoPoint, ans, gameEnv, worldController, url, userinfo);
} }
return ans; return ans;
......
package com.qiwu.chatbotbackend.servlet; package com.qiwu.chatbotbackend.servlet;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.qiwu.chatbotbackend.actiongenerate.DB.EngineUtils;
import com.qiwu.chatbotbackend.entity.Action; import com.qiwu.chatbotbackend.entity.Action;
import com.qiwu.chatbotbackend.entity.ChatCache; import com.qiwu.chatbotbackend.entity.ChatCache;
import com.qiwu.chatbotbackend.entity.Solution; import com.qiwu.chatbotbackend.entity.Solution;
...@@ -17,6 +18,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -17,6 +18,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.sql.SQLException;
import java.text.ParseException; import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -44,11 +46,29 @@ public class GetAnswerServlet extends HttpServlet { ...@@ -44,11 +46,29 @@ public class GetAnswerServlet extends HttpServlet {
if(tmpStr == null || tmpStr.equals("")) if(tmpStr == null || tmpStr.equals(""))
continue; continue;
tmpStr = tmpStr.replace("qiwu", "我"); tmpStr = tmpStr.replace("qiwu", "我");
//tmpStr = tmpStr.replace("qiwu", "你");
receiveParamters.put(entry.getKey(), tmpStr); receiveParamters.put(entry.getKey(), tmpStr);
} }
} }
String botName = receiveParamters.get("bot_name"); String botName = receiveParamters.get("bot_name");
/*
EngineUtils engineDBConn = null;
try {
engineDBConn = new EngineUtils();
String nickname = engineDBConn.queryBotNickNameByName(botName);
} catch (SQLException e1) {
e1.printStackTrace();
} finally {
engineDBConn.destroy();
}
Set<Entry<String, String>> entrySet2 = receiveParamters.entrySet();
for(Entry<String, String> entry : entrySet2) {
String value = entry.getValue();
if(value.indexOf("")) {
}
}
*/
Map<String ,String> curInfoPoint = new HashMap<String, String>(); Map<String ,String> curInfoPoint = new HashMap<String, String>();
Solution bestMatch = null; Solution bestMatch = null;
......
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