Commit fd4c3d2e by hxw2303632

修改话术变量

parent e829dd3f
...@@ -23,7 +23,7 @@ public class WorldController { ...@@ -23,7 +23,7 @@ public class WorldController {
public String worldOperation(GameEnv gameEnv, String varName, String varValue, Map<String, String> currentInfoPoint, Map<String, String>historyInfoPoint){ public String worldOperation(GameEnv gameEnv, String varName, String varValue, Map<String, String> currentInfoPoint, Map<String, String>historyInfoPoint){
String moduleName = "", valuePair[] = varValue.split(":", 2), returnStr="", owner; String moduleName = "", valuePair[] = varValue.split(":", 2), returnStr="", owner;
String namePair[] = varName.split("_"); String namePair[] = varName.split("_"), dontFound = "", nothingFound;
boolean operationFlag = true; boolean operationFlag = true;
List<String> textList = null; List<String> textList = null;
String subValuePair[] = null; String subValuePair[] = null;
...@@ -31,11 +31,26 @@ public class WorldController { ...@@ -31,11 +31,26 @@ public class WorldController {
logWriter.record(String.format("---------------------key:%s, value:%s", varName, varValue), 0); logWriter.record(String.format("---------------------key:%s, value:%s", varName, varValue), 0);
if(userInfo.varInitialMap.get("DONT_FOUND") != null){
dontFound = userInfo.varInitialMap.get("DONT_FOUND");
}else{
dontFound = DONT_FOUND;
}
if(userInfo.varInitialMap.get("NOTHING_FOUND") != null){
nothingFound = userInfo.varInitialMap.get("NOTHING_FOUND");
}else{
nothingFound = DONT_FOUND;
}
String location = "", value = ""; String location = "", value = "";
if(valuePair[0].startsWith("query")){ //查询专用 if(valuePair[0].startsWith("query")){ //查询专用
String itemName = ""; String itemName = "";
String currentLocation; String currentLocation;
if(varName.startsWith("goods_")) { if(varName.startsWith("goods_")) {
currentLocation = historyInfoPoint.get("site"); currentLocation = historyInfoPoint.get("site");
switch (valuePair[0]) { switch (valuePair[0]) {
...@@ -48,7 +63,7 @@ public class WorldController { ...@@ -48,7 +63,7 @@ public class WorldController {
itemName = currentInfoPoint.get(valuePair[1]).split(":", 2)[1]; itemName = currentInfoPoint.get(valuePair[1]).split(":", 2)[1];
returnStr = gameEnv.queryGoodsIntroByGoodsName(itemName); returnStr = gameEnv.queryGoodsIntroByGoodsName(itemName);
if(returnStr == null ) if(returnStr == null )
returnStr = DONT_FOUND; returnStr = dontFound;
else{ else{
returnStr = format.replace(ITEM_NAME_SLOT, itemName).replace(ATTR_VALUE_SLOT, returnStr); returnStr = format.replace(ITEM_NAME_SLOT, itemName).replace(ATTR_VALUE_SLOT, returnStr);
} }
...@@ -60,7 +75,7 @@ public class WorldController { ...@@ -60,7 +75,7 @@ public class WorldController {
value = gameEnv.queryGoodsAttrByGoodsName(subValuePair[0], subValuePair[1]); value = gameEnv.queryGoodsAttrByGoodsName(subValuePair[0], subValuePair[1]);
if(returnStr == null) { if(returnStr == null) {
returnStr = DONT_FOUND; returnStr = dontFound;
}else{ }else{
returnStr = userInfo.varInitialMap.get("GET_ITEM_ATTR").replace(ITEM_NAME_SLOT, subValuePair[0]).replace(ATTR_NAME_SLOT, subValuePair[1]).replace(ATTR_VALUE_SLOT, value); returnStr = userInfo.varInitialMap.get("GET_ITEM_ATTR").replace(ITEM_NAME_SLOT, subValuePair[0]).replace(ATTR_NAME_SLOT, subValuePair[1]).replace(ATTR_VALUE_SLOT, value);
...@@ -69,7 +84,7 @@ public class WorldController { ...@@ -69,7 +84,7 @@ public class WorldController {
case "queryAllAttrByGoodsName": case "queryAllAttrByGoodsName":
textList = gameEnv.queryGoodsAllAttrByGoodsName(varName); textList = gameEnv.queryGoodsAllAttrByGoodsName(varName);
if(textList == null || textList.size() == 0) if(textList == null || textList.size() == 0)
returnStr = DONT_FOUND; returnStr = dontFound;
else { else {
for (String site : textList) for (String site : textList)
returnStr += "、" + site; returnStr += "、" + site;
...@@ -79,7 +94,7 @@ public class WorldController { ...@@ -79,7 +94,7 @@ public class WorldController {
case "queryAroundGoodsByClassName": case "queryAroundGoodsByClassName":
textList = gameEnv.queryGoodsByClassAndSite(namePair[1], historyInfoPoint.get("site")); textList = gameEnv.queryGoodsByClassAndSite(namePair[1], historyInfoPoint.get("site"));
if(textList == null || textList.size() == 0) if(textList == null || textList.size() == 0)
returnStr = DONT_FOUND; returnStr = dontFound;
else { else {
for (String site : textList) for (String site : textList)
returnStr += "、" + site; returnStr += "、" + site;
...@@ -97,7 +112,7 @@ public class WorldController { ...@@ -97,7 +112,7 @@ public class WorldController {
} else if(returnStr.equals("是")){ } else if(returnStr.equals("是")){
location = gameEnv.queryGoodsAttrByGoodsName(itemName, "location"); location = gameEnv.queryGoodsAttrByGoodsName(itemName, "location");
if(location == null){ if(location == null){
returnStr = DONT_FOUND; returnStr = dontFound;
}else{ }else{
owner = gameEnv.queryGoodsAttrByGoodsName(itemName, "owner"); owner = gameEnv.queryGoodsAttrByGoodsName(itemName, "owner");
//logWriter.record(ItemName + "-owner:" + owner, 0); //logWriter.record(ItemName + "-owner:" + owner, 0);
...@@ -124,7 +139,7 @@ public class WorldController { ...@@ -124,7 +139,7 @@ public class WorldController {
String player = gameEnv.queryPlayerName(); String player = gameEnv.queryPlayerName();
textList = gameEnv.queryGoodsByNpcName(player); textList = gameEnv.queryGoodsByNpcName(player);
if(textList == null || textList.size() == 0) if(textList == null || textList.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
for (String site : textList) for (String site : textList)
returnStr += "、" + site; returnStr += "、" + site;
...@@ -140,11 +155,11 @@ public class WorldController { ...@@ -140,11 +155,11 @@ public class WorldController {
itemName = currentInfoPoint.get(valuePair[1]).split(":")[1]; itemName = currentInfoPoint.get(valuePair[1]).split(":")[1];
returnStr = gameEnv.queryGoodsAttrByGoodsName(itemName, "可被询问"); returnStr = gameEnv.queryGoodsAttrByGoodsName(itemName, "可被询问");
if(returnStr == null || returnStr.equals("否")){ if(returnStr == null || returnStr.equals("否")){
returnStr = DONT_FOUND; returnStr = dontFound;
} else if(returnStr.equals("是")){ } else if(returnStr.equals("是")){
location = gameEnv.queryGoodsAttrByGoodsName(itemName, "location"); location = gameEnv.queryGoodsAttrByGoodsName(itemName, "location");
if(location == null){ if(location == null){
returnStr = DONT_FOUND; returnStr = dontFound;
}else{ }else{
returnStr = userInfo.varInitialMap.get("FIND_ITEM_WAY").replace(ITEM_NAME_SLOT, itemName).replace(SITE_SLOT, location); returnStr = userInfo.varInitialMap.get("FIND_ITEM_WAY").replace(ITEM_NAME_SLOT, itemName).replace(SITE_SLOT, location);
} }
...@@ -165,7 +180,7 @@ public class WorldController { ...@@ -165,7 +180,7 @@ public class WorldController {
NPCName = currentInfoPoint.get(valuePair[1]).split(":", 2)[1]; NPCName = currentInfoPoint.get(valuePair[1]).split(":", 2)[1];
returnStr = gameEnv.queryNpcIntroByNpcName(NPCName); returnStr = gameEnv.queryNpcIntroByNpcName(NPCName);
if(returnStr == null ) if(returnStr == null )
returnStr = DONT_FOUND; returnStr = dontFound;
else{ else{
returnStr = format.replace(NPC_NAME_SLOT, NPCName).replace(ATTR_VALUE_SLOT, returnStr); returnStr = format.replace(NPC_NAME_SLOT, NPCName).replace(ATTR_VALUE_SLOT, returnStr);
} }
...@@ -178,7 +193,7 @@ public class WorldController { ...@@ -178,7 +193,7 @@ public class WorldController {
subValuePair[0] = subValuePair[0].replace("哪里", "location"); subValuePair[0] = subValuePair[0].replace("哪里", "location");
value = gameEnv.queryNpcAttrByNpcName(subValuePair[0], subValuePair[1]); value = gameEnv.queryNpcAttrByNpcName(subValuePair[0], subValuePair[1]);
if(value == null) { if(value == null) {
returnStr = DONT_FOUND; returnStr = dontFound;
}else{ }else{
returnStr = userInfo.varInitialMap.get("GET_NPC_ATTR").replace(NPC_NAME_SLOT, subValuePair[0]).replace(ATTR_NAME_SLOT, subValuePair[1]).replace(ATTR_VALUE_SLOT, value); returnStr = userInfo.varInitialMap.get("GET_NPC_ATTR").replace(NPC_NAME_SLOT, subValuePair[0]).replace(ATTR_NAME_SLOT, subValuePair[1]).replace(ATTR_VALUE_SLOT, value);
...@@ -191,7 +206,7 @@ public class WorldController { ...@@ -191,7 +206,7 @@ public class WorldController {
location = gameEnv.queryNpcAttrByNpcName(valuePair[1], "location"); location = gameEnv.queryNpcAttrByNpcName(valuePair[1], "location");
if(location == null){ if(location == null){
returnStr = DONT_FOUND; returnStr = dontFound;
}else{ }else{
returnStr = location; returnStr = location;
} }
...@@ -205,13 +220,13 @@ public class WorldController { ...@@ -205,13 +220,13 @@ public class WorldController {
System.out.println(NPCName); System.out.println(NPCName);
returnStr = gameEnv.queryNpcAttrByNpcName(NPCName, "可被询问"); returnStr = gameEnv.queryNpcAttrByNpcName(NPCName, "可被询问");
if(returnStr == null || returnStr.equals("否")){ if(returnStr == null || returnStr.equals("否")){
returnStr = DONT_FOUND; returnStr = dontFound;
} else if(returnStr.equals("是")){ } else if(returnStr.equals("是")){
location = gameEnv.queryNpcAttrByNpcName(NPCName, "location"); location = gameEnv.queryNpcAttrByNpcName(NPCName, "location");
if(location == null){ if(location == null){
returnStr = DONT_FOUND; returnStr = dontFound;
}else{ }else{
returnStr = userInfo.varInitialMap.get("FIND_NPC_LOCATION").replace(NPC_NAME_SLOT, NPCName).replace(SITE_SLOT2, location); returnStr = userInfo.varInitialMap.get("FIND_NPC_LOCATION").replace(NPC_NAME_SLOT, NPCName).replace(SITE_SLOT2, location);
} }
...@@ -224,11 +239,11 @@ public class WorldController { ...@@ -224,11 +239,11 @@ public class WorldController {
NPCName = currentInfoPoint.get(valuePair[1]).split(":")[1]; NPCName = currentInfoPoint.get(valuePair[1]).split(":")[1];
returnStr = gameEnv.queryNpcAttrByNpcName(NPCName, "可被询问"); returnStr = gameEnv.queryNpcAttrByNpcName(NPCName, "可被询问");
if(returnStr == null || returnStr.equals("否")){ if(returnStr == null || returnStr.equals("否")){
returnStr = DONT_FOUND; returnStr = dontFound;
} else if(returnStr.equals("是")){ } else if(returnStr.equals("是")){
location = gameEnv.queryNpcAttrByNpcName(NPCName, "location"); location = gameEnv.queryNpcAttrByNpcName(NPCName, "location");
if(location == null){ if(location == null){
returnStr = DONT_FOUND; returnStr = dontFound;
}else{ }else{
returnStr = userInfo.varInitialMap.get("FIND_NPC_WAY").replace(NPC_NAME_SLOT, NPCName).replace(SITE_SLOT2, location); returnStr = userInfo.varInitialMap.get("FIND_NPC_WAY").replace(NPC_NAME_SLOT, NPCName).replace(SITE_SLOT2, location);
} }
...@@ -264,7 +279,7 @@ public class WorldController { ...@@ -264,7 +279,7 @@ public class WorldController {
sites = gameEnv.queryAroundAllBySite(historyInfoPoint.get("site")); sites = gameEnv.queryAroundAllBySite(historyInfoPoint.get("site"));
if(sites == null || sites.size() == 0) if(sites == null || sites.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
...@@ -282,7 +297,7 @@ public class WorldController { ...@@ -282,7 +297,7 @@ public class WorldController {
sites = gameEnv.queryAroundNpcBySite(historyInfoPoint.get("site")); sites = gameEnv.queryAroundNpcBySite(historyInfoPoint.get("site"));
if(sites == null || sites.size() == 0) if(sites == null || sites.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
...@@ -300,7 +315,7 @@ public class WorldController { ...@@ -300,7 +315,7 @@ public class WorldController {
sites = gameEnv.queryAroundGoodsBySite(historyInfoPoint.get("site")); sites = gameEnv.queryAroundGoodsBySite(historyInfoPoint.get("site"));
if(sites == null || sites.size() == 0) if(sites == null || sites.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
if(sites.size() > 0) { if(sites.size() > 0) {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
...@@ -414,7 +429,7 @@ public class WorldController { ...@@ -414,7 +429,7 @@ public class WorldController {
sites = gameEnv.queryAroundNpcBySite(historyInfoPoint.get("site")); sites = gameEnv.queryAroundNpcBySite(historyInfoPoint.get("site"));
if(sites == null || sites.size() == 0) if(sites == null || sites.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
...@@ -453,7 +468,7 @@ public class WorldController { ...@@ -453,7 +468,7 @@ public class WorldController {
sites = gameEnv.queryAroundGoodsBySite(destination); sites = gameEnv.queryAroundGoodsBySite(destination);
if(sites == null || sites.size() == 0) if(sites == null || sites.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
if(sites.size() > 0) { if(sites.size() > 0) {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
...@@ -474,7 +489,7 @@ public class WorldController { ...@@ -474,7 +489,7 @@ public class WorldController {
destination = currentInfoPoint.get(valuePair[1]).split(":")[0]; destination = currentInfoPoint.get(valuePair[1]).split(":")[0];
sites = gameEnv.queryAroundNpcBySite(destination); sites = gameEnv.queryAroundNpcBySite(destination);
if(sites == null || sites.size() == 0) if(sites == null || sites.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
...@@ -497,7 +512,7 @@ public class WorldController { ...@@ -497,7 +512,7 @@ public class WorldController {
sites = gameEnv.queryAroundAllBySite(destination); sites = gameEnv.queryAroundAllBySite(destination);
if(sites == null || sites.size() == 0) if(sites == null || sites.size() == 0)
returnStr = NOTHING_FOUND; returnStr = nothingFound;
else { else {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
......
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