Commit c77a567b by 周君强

1.反馈问题修复;

2.建议系统实现
parent c9096bbd
...@@ -505,8 +505,9 @@ public class InitSysServlet implements InitializingBean { ...@@ -505,8 +505,9 @@ public class InitSysServlet implements InitializingBean {
// //所有玩家地区 // //所有玩家地区
// List<String> addressRegionList = regionIPMap.values().stream().map(RegionPojo::getPlace).collect(Collectors.toList()); // List<String> addressRegionList = regionIPMap.values().stream().map(RegionPojo::getPlace).collect(Collectors.toList());
// String regions = String.join("+", addressRegionList); // String regions = String.join("+", addressRegionList);
// regions += "+本地";
// HttpUtil.doPut("项目词组玩家地址", regions); // HttpUtil.doPut("项目词组玩家地址", regions);
// HttpUtil.doPutCrazyGardener("项目词组玩家地址", regions);
// HttpUtil.doPutAngelLoveMe("项目词组玩家地址", regions);
// } // }
} }
} }
...@@ -62,11 +62,22 @@ public class ProxyFactory { ...@@ -62,11 +62,22 @@ public class ProxyFactory {
if (StringUtils.isEmpty(data.getVars().get后台附加返回2())) { if (StringUtils.isEmpty(data.getVars().get后台附加返回2())) {
data.getVars().set后台附加返回2("无效返回"); data.getVars().set后台附加返回2("无效返回");
} }
} //替换话术词汇
//替换话术里的{花圃称呼}
if (!StringUtils.isEmpty(data)) {
String text = data.getVars().get反馈文本(); String text = data.getVars().get反馈文本();
if (!StringUtils.isEmpty(text)) { if (!StringUtils.isEmpty(text)) {
//替换话术的【男园丁】或【女园丁】
String gardenerName = request.getGardenerName();
if (!StringUtils.isEmpty(gardenerName)) {
if (text.contains("【男园丁@正常】")) {
text = text.replace("【男园丁@正常】", "【" + gardenerName + "@正常】");
}
if (text.contains("【女园丁@正常】")) {
text = text.replace("【女园丁@正常】", "【" + gardenerName + "@正常】");
}
text = text.replace("园丁", gardenerName);
data.getVars().set反馈文本(text);
}
//替换话术里的{花圃称呼}
if (text.contains("{花圃称呼}")) { if (text.contains("{花圃称呼}")) {
data.getVars().set反馈文本(SpeechUtil.replaceNurseryName(text)); data.getVars().set反馈文本(SpeechUtil.replaceNurseryName(text));
} }
......
...@@ -12,12 +12,9 @@ import com.qiwuai.garden.dto.base.ResultVarsResponse; ...@@ -12,12 +12,9 @@ import com.qiwuai.garden.dto.base.ResultVarsResponse;
import com.qiwuai.garden.dto.request.OperationRequest; import com.qiwuai.garden.dto.request.OperationRequest;
import com.qiwuai.garden.pojo.*; import com.qiwuai.garden.pojo.*;
import com.qiwuai.garden.service.plantService.PlantService; import com.qiwuai.garden.service.plantService.PlantService;
import com.sun.java.swing.plaf.windows.WindowsTextAreaUI;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -58,9 +55,9 @@ public class TimingAcquisition { ...@@ -58,9 +55,9 @@ public class TimingAcquisition {
*/ */
public volatile static Map<String, Map<String, RegionDto>> addressMap = new ConcurrentHashMap<>(); public volatile static Map<String, Map<String, RegionDto>> addressMap = new ConcurrentHashMap<>();
/** /**
* 玩家的建议中所有操作和变量保存 * 给玩家的建议中所有操作和变量保存: Map<uid, 操作列表>
*/ */
public volatile static Map<String, Map<String, RegionDto>> adviseOperateMap = new ConcurrentHashMap<>(); public volatile static Map<String, List<AdviseOperateDto>> adviseOperateMap = new ConcurrentHashMap<>();
/** /**
* 地区与服务器对应的配置信息 * 地区与服务器对应的配置信息
...@@ -324,35 +321,28 @@ public class TimingAcquisition { ...@@ -324,35 +321,28 @@ public class TimingAcquisition {
continue; continue;
} }
//该地区人数未满 //该地区人数未满
int randomNum = 0;
HashSet<Integer> numSet = new HashSet<>();
numSet.add(randomNum);
while (true) {
for (int i = 0; i < numSet.size(); i++) {
randomNum = RandomDropUtil.getRandomNum(0, regionIP.getNumMax()); //随机生成一个编号
if (!numSet.add(randomNum)) {
i--;
} else {
break;
}
}
String numStr = String.format("%04d", randomNum); //1转成0001
String address = regionIP.getPlace() + numStr; //生成的玩家地址
//校验该玩家地址是否已存在
Map<String, RegionDto> regionMap = addressMap.get(regionIP.getPlace()); Map<String, RegionDto> regionMap = addressMap.get(regionIP.getPlace());
//新生成的玩家地址还未存在,玩家地址生成成功 //所有门牌号
if (StringUtils.isEmpty(regionMap.get(address))) { List<Integer> allNumList = new ArrayList<>();
for (int i = 1; i <= regionIP.getNumMax(); i++) {
allNumList.add(i);
}
//统计该地区所有空闲的玩家地址
for (Map.Entry<String, RegionDto> entry : regionMap.entrySet()) {
Integer num = TypeConvertUtil.extractNum(entry.getKey());
allNumList.removeIf(num::equals);
}
if (allNumList.size() != 0) {
int randomNum = RandomDropUtil.getRandomNum(0, allNumList.size()); //随机生成一个编号
int num = allNumList.get(randomNum);
String numStr = String.format("%04d", num); //1转成0001
String address = regionIP.getPlace() + numStr; //生成的玩家地址
//更新json文件信息 //更新json文件信息
regionIP.setPopulation(regionIP.getPopulation() + 1); regionIP.setPopulation(regionIP.getPopulation() + 1);
//保存到json文件中 //保存到json文件中
String IPRegions = JSON.toJSONString(IPRegionsMap); String IPRegions = JSON.toJSONString(IPRegionsMap);
PersistenceUtil.saveConfigToFile("region.json", IPRegions); PersistenceUtil.saveConfigToFile("region.json", IPRegions);
result = address; result = address;
end = true;
break;
}
}
if (end) {
break; break;
} }
} }
...@@ -1166,6 +1156,11 @@ public class TimingAcquisition { ...@@ -1166,6 +1156,11 @@ public class TimingAcquisition {
CallNamePojo callName = TimingAcquisition.getCallNameByUid(uid); CallNamePojo callName = TimingAcquisition.getCallNameByUid(uid);
String taskName = ""; //任务名称 String taskName = ""; //任务名称
String result = ""; String result = "";
//取出当前等级的“今日任务”
TaskPojo dailyTask = dailyTaskList.stream().filter(taskPojo -> (Constants.DAILY_TASK_EVENT == taskPojo.getEventId())).findAny().orElse(null);
if (StringUtils.isEmpty(dailyTask)) {
return taskResult;
}
//该每日任务还未标记完成 //该每日任务还未标记完成
if (Constants.TASK_FINISH_NO.equals(dailyTaskFinishMap.get(task.getId()))) { if (Constants.TASK_FINISH_NO.equals(dailyTaskFinishMap.get(task.getId()))) {
//当前任务名称 //当前任务名称
...@@ -1184,6 +1179,8 @@ public class TimingAcquisition { ...@@ -1184,6 +1179,8 @@ public class TimingAcquisition {
} }
} }
feedText.deleteCharAt(feedText.length() - 1); feedText.deleteCharAt(feedText.length() - 1);
//--------------“今日任务”累计一次----------------
dailyTaskCountMap.put(dailyTask.getEventId(), dailyTaskCountMap.get(dailyTask.getEventId()) + 1);
//玩家只完成了日常任务中某一项 //玩家只完成了日常任务中某一项
log.info(uid + "的日常任务:" + taskName + "已经完成"); log.info(uid + "的日常任务:" + taskName + "已经完成");
result = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, "daily_task_finished"); result = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, "daily_task_finished");
...@@ -1195,15 +1192,11 @@ public class TimingAcquisition { ...@@ -1195,15 +1192,11 @@ public class TimingAcquisition {
taskResult.setFinished(true); taskResult.setFinished(true);
} }
} }
//取出当前等级的“今日任务”
TaskPojo dailyTask = dailyTaskList.stream().filter(taskPojo -> (Constants.DAILY_TASK_EVENT == taskPojo.getEventId())).findAny().orElse(null);
if (StringUtils.isEmpty(dailyTask)) {
return taskResult;
}
//已完成所有今日的日常任务 //已完成所有今日的日常任务
if (Constants.TASK_FINISH_NO.equals(dailyTaskFinishMap.get(dailyTask.getId()))) { if (Constants.TASK_FINISH_NO.equals(dailyTaskFinishMap.get(dailyTask.getId()))) {
//今日任务已完成 //今日任务已完成
if (dailyTaskCountMap.get(eventId) >= dailyTask.getTimes()) { if (dailyTaskCountMap.get(dailyTask.getEventId()) >= dailyTask.getTimes()) {
//任务名称 //任务名称
String dailyTaskName = dailyTask.getName(); String dailyTaskName = dailyTask.getName();
log.info(uid + "的任务:" + dailyTaskName + "已完成,所有日常任务已完成"); log.info(uid + "的任务:" + dailyTaskName + "已完成,所有日常任务已完成");
...@@ -1388,7 +1381,7 @@ public class TimingAcquisition { ...@@ -1388,7 +1381,7 @@ public class TimingAcquisition {
if (playerList.size() != 0) { if (playerList.size() != 0) {
for (String address : playerList) { for (String address : playerList) {
String uidSide = TimingAcquisition.addressMap.get(placeSide).get(address).getUid(); //对方uid String uidSide = TimingAcquisition.addressMap.get(placeSide).get(address).getUid(); //对方uid
//玩家没有成熟的植物 //玩家有成熟的植物
if (havaNurseryMaturePlant(uidSide)) { if (havaNurseryMaturePlant(uidSide)) {
maturePlantPlayerList.add(address); maturePlantPlayerList.add(address);
} }
...@@ -1415,7 +1408,7 @@ public class TimingAcquisition { ...@@ -1415,7 +1408,7 @@ public class TimingAcquisition {
if (playerList.size() != 0) { if (playerList.size() != 0) {
for (String address : playerList) { for (String address : playerList) {
String uidSide = TimingAcquisition.addressMap.get(placeSide).get(address).getUid(); //对方uid String uidSide = TimingAcquisition.addressMap.get(placeSide).get(address).getUid(); //对方uid
//玩家没有成熟的植物 //玩家有成熟的植物
if (havaNurseryMaturePlant(uidSide)) { if (havaNurseryMaturePlant(uidSide)) {
maturePlantPlayerList.add(address); maturePlantPlayerList.add(address);
} }
...@@ -1429,7 +1422,7 @@ public class TimingAcquisition { ...@@ -1429,7 +1422,7 @@ public class TimingAcquisition {
if (maturePlantPlayerList.size() == 0) { if (maturePlantPlayerList.size() == 0) {
return null; return null;
} }
//随机取一个本地区非好友的玩家 //随机取一个非好友的玩家
int randomNum = RandomDropUtil.getRandomNum(0, maturePlantPlayerList.size()); int randomNum = RandomDropUtil.getRandomNum(0, maturePlantPlayerList.size());
return maturePlantPlayerList.get(randomNum); return maturePlantPlayerList.get(randomNum);
} }
...@@ -1810,6 +1803,32 @@ public class TimingAcquisition { ...@@ -1810,6 +1803,32 @@ public class TimingAcquisition {
} }
/** /**
* 判断玩家是否有指定成熟植物的花圃
* @param uid
* @param plantId
* @return boolean
*/
public static boolean havaMaturePlantWithPlantId(String uid, Integer plantId) {
//玩家所有花圃
Map<Integer, NurseryInfoDto> nurseryMap = gardenerMap.get(uid).getGarden().getNurseryInfos();
for (Map.Entry<Integer, NurseryInfoDto> entry : nurseryMap.entrySet()) {
NurseryInfoDto nurseryInfo = entry.getValue();
//花圃中有种植植物
if (!StringUtils.isEmpty(nurseryInfo.getPlantId())) {
if (nurseryInfo.getPlantId().equals(plantId)) {
if (!StringUtils.isEmpty(nurseryInfo.getPlantTime())) {
//植物已成熟
if (DateUtil.getCurrentTime().compareTo(nurseryInfo.getPlantTime().getMatureTime()) >= 0) {
return true;
}
}
}
}
}
return false;
}
/**
* 查询玩家是否有日常任务 * 查询玩家是否有日常任务
* @param uid * @param uid
* @return boolean * @return boolean
......
...@@ -32,7 +32,7 @@ public class ScheduleTask { ...@@ -32,7 +32,7 @@ public class ScheduleTask {
Logger log = LoggerFactory.getLogger(ScheduleTask.class); Logger log = LoggerFactory.getLogger(ScheduleTask.class);
//定时喂养宠物,消耗物品 //定时喂养宠物,消耗物品
@Scheduled(cron = "0 0 1 * * ?") // @Scheduled(cron = "0 0 1 * * ?")
// @Scheduled(cron = "0/60 * * * * ?") // @Scheduled(cron = "0/60 * * * * ?")
public void petFeeding() { public void petFeeding() {
log.info("开始喂养所有宠物"); log.info("开始喂养所有宠物");
......
...@@ -56,7 +56,7 @@ public class HttpUtil { ...@@ -56,7 +56,7 @@ public class HttpUtil {
log.info(phraseName + "的动态词组更新结果:" + forObject.getBody()); log.info(phraseName + "的动态词组更新结果:" + forObject.getBody());
} }
//更新动态词组 //更新"园丁也疯狂"的动态词组
public static void doPutCrazyGardener(String phraseName, String phraseContent) { public static void doPutCrazyGardener(String phraseName, String phraseContent) {
RestTemplate template = new RestTemplate(); RestTemplate template = new RestTemplate();
//获取时间戳 //获取时间戳
...@@ -83,6 +83,33 @@ public class HttpUtil { ...@@ -83,6 +83,33 @@ public class HttpUtil {
log.info("《园丁也疯狂》" + phraseName + "的动态词组更新结果:" + forObject.getBody()); log.info("《园丁也疯狂》" + phraseName + "的动态词组更新结果:" + forObject.getBody());
} }
//更新"花仙爱上我"的动态词组
public static void doPutAngelLoveMe(String phraseName, String phraseContent) {
RestTemplate template = new RestTemplate();
//获取时间戳
long timestamp = System.currentTimeMillis();
//签名
String authorization = DigestUtils.md5Hex(appSecret + ":" + timestamp);
//设置请求体
PhraseRequest phraseRequest = new PhraseRequest();
phraseRequest.setWorkName("花仙爱上我");
phraseRequest.setPhraseName(phraseName);
phraseRequest.setPhraseContent(phraseContent);
JSONObject object = new JSONObject();
object.put("workName", "花仙爱上我");
object.put("phraseName", phraseName);
object.put("phraseContent", phraseContent);
//设置请求头
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set("Content-Type", "application/json;charset=utf-8");
httpHeaders.set("Timestamp", String.valueOf(timestamp));
httpHeaders.set("Authorization", authorization);
HttpEntity<JSONObject> request = new HttpEntity<>(object, httpHeaders);
ResponseEntity<PhraseResponse> forObject = template.exchange(updatePhraseUrl, HttpMethod.PUT, request, PhraseResponse.class);
log.info("《花仙爱上我》" + phraseName + "的动态词组更新结果:" + forObject.getBody());
}
//获取app用户关联id //获取app用户关联id
public static List<Object> getInviteUid(String uid) { public static List<Object> getInviteUid(String uid) {
RestTemplate template = new RestTemplate(); RestTemplate template = new RestTemplate();
......
...@@ -8,6 +8,7 @@ import com.qiwuai.garden.dto.request.CallRequest; ...@@ -8,6 +8,7 @@ import com.qiwuai.garden.dto.request.CallRequest;
import com.qiwuai.garden.dto.request.OperationRequest; import com.qiwuai.garden.dto.request.OperationRequest;
import com.qiwuai.garden.pojo.AttributePojo; import com.qiwuai.garden.pojo.AttributePojo;
import com.qiwuai.garden.pojo.ItemPojo; import com.qiwuai.garden.pojo.ItemPojo;
import com.qiwuai.garden.pojo.PetPojo;
import com.qiwuai.garden.pojo.PlantPojo; import com.qiwuai.garden.pojo.PlantPojo;
import com.qiwuai.garden.service.gardenerService.GardenerService; import com.qiwuai.garden.service.gardenerService.GardenerService;
import com.qiwuai.garden.service.gardenerService.impl.GardenerServiceImpl; import com.qiwuai.garden.service.gardenerService.impl.GardenerServiceImpl;
...@@ -30,7 +31,7 @@ public class RequestConversionUtil { ...@@ -30,7 +31,7 @@ public class RequestConversionUtil {
OperationRequest operationRequest = new OperationRequest(); OperationRequest operationRequest = new OperationRequest();
CallRequest callRequest = commonRequest.getVars(); CallRequest callRequest = commonRequest.getVars();
operationRequest.setUid(commonRequest.getUid()); operationRequest.setUid(commonRequest.getUid());
//---------------新的uid则创建用户-------------------------- //----------------------新的uid则创建用户--------------------------
GardenerDto gardener = TimingAcquisition.gardenerMap.get(commonRequest.getUid()); GardenerDto gardener = TimingAcquisition.gardenerMap.get(commonRequest.getUid());
if (StringUtils.isEmpty(gardener)) { if (StringUtils.isEmpty(gardener)) {
//给新玩家分配姓名 //给新玩家分配姓名
...@@ -43,6 +44,11 @@ public class RequestConversionUtil { ...@@ -43,6 +44,11 @@ public class RequestConversionUtil {
GardenerService gardenerService = new GardenerServiceImpl(); GardenerService gardenerService = new GardenerServiceImpl();
gardenerService.create(operationReq); gardenerService.create(operationReq);
} }
//---------------------存在GB_园丁姓名-----------------------
String gardenerName = callRequest.getGB_园丁姓名();
if (!StringUtils.isEmpty(gardenerName)) {
operationRequest.setGardenerName(gardenerName);
}
//---------------------存在花圃编号-------------------------- //---------------------存在花圃编号--------------------------
String nurseryNum = callRequest.get花圃编号(); String nurseryNum = callRequest.get花圃编号();
if (!StringUtils.isEmpty(nurseryNum)) { if (!StringUtils.isEmpty(nurseryNum)) {
...@@ -319,6 +325,9 @@ public class RequestConversionUtil { ...@@ -319,6 +325,9 @@ public class RequestConversionUtil {
//----------宠物栏中宠物位置信息1------------ //----------宠物栏中宠物位置信息1------------
String petPos1 = callRequest.get位置信息1(); String petPos1 = callRequest.get位置信息1();
if (!StringUtils.isEmpty(petPos1)) { if (!StringUtils.isEmpty(petPos1)) {
//判断宠物是否为宠物名称
Integer petId = TimingAcquisition.getPetIdByName(petPos1);
if (petId == Constants.REQ_NON) {
String[] pos1 = petPos1.split("\\+"); String[] pos1 = petPos1.split("\\+");
petPos1 = pos1[0]; petPos1 = pos1[0];
//找到中文数字对应的阿拉伯数字 //找到中文数字对应的阿拉伯数字
...@@ -333,10 +342,16 @@ public class RequestConversionUtil { ...@@ -333,10 +342,16 @@ public class RequestConversionUtil {
} else { } else {
operationRequest.setPetPos1(number.toString()); operationRequest.setPetPos1(number.toString());
} }
} else {
operationRequest.setPetPos1(petPos1);
}
} }
//-----------宠物栏中宠物位置信息2------------ //-----------宠物栏中宠物位置信息2------------
String petPos2 = callRequest.get位置信息2(); String petPos2 = callRequest.get位置信息2();
if (!StringUtils.isEmpty(petPos2)) { if (!StringUtils.isEmpty(petPos2)) {
//判断宠物是否为宠物名称
Integer petId = TimingAcquisition.getPetIdByName(petPos2);
if (petId == Constants.REQ_NON) {
petPos2 = petPos2.replace("+" + petPos1, ""); petPos2 = petPos2.replace("+" + petPos1, "");
//找到中文数字对应的阿拉伯数字 //找到中文数字对应的阿拉伯数字
Integer number = TypeConvertUtil.change2Integer(petPos2); Integer number = TypeConvertUtil.change2Integer(petPos2);
...@@ -350,6 +365,9 @@ public class RequestConversionUtil { ...@@ -350,6 +365,9 @@ public class RequestConversionUtil {
} else { } else {
operationRequest.setPetPos2(number.toString()); operationRequest.setPetPos2(number.toString());
} }
} else {
operationRequest.setPetPos2(petPos2);
}
} }
//-------------存在玩家地址------------ //-------------存在玩家地址------------
String address = callRequest.get玩家地址(); String address = callRequest.get玩家地址();
......
...@@ -250,4 +250,22 @@ public class SpeechUtil { ...@@ -250,4 +250,22 @@ public class SpeechUtil {
String nurseryName = TimingAcquisition.systemConfigMap.get("nursery_name").getValue(); String nurseryName = TimingAcquisition.systemConfigMap.get("nursery_name").getValue();
return text.replace("{花圃称呼}", nurseryName); return text.replace("{花圃称呼}", nurseryName);
} }
/**
* 删除话术的开头“【旁白@正常】”
* @param text
*/
public static String deleteAsideHead(String text) {
return text.replaceAll("【(.+)@(.+)】", "");
}
/**
* 合并话术
* @param text1
* @param text2
*/
public static String mergeSpeech(String text1, String text2) {
text2 = deleteAsideHead(text2);
return text1 + text2;
}
} }
package com.qiwuai.garden.controller; package com.qiwuai.garden.controller;
import com.qiwuai.garden.common.Constants;
import com.qiwuai.garden.common.ProxyFactory; import com.qiwuai.garden.common.ProxyFactory;
import com.qiwuai.garden.common.utils.RequestConversionUtil; import com.qiwuai.garden.common.utils.RequestConversionUtil;
import com.qiwuai.garden.common.utils.SpeechUtil;
import com.qiwuai.garden.common.utils.YamlUtil;
import com.qiwuai.garden.dto.base.CommonRequest; import com.qiwuai.garden.dto.base.CommonRequest;
import com.qiwuai.garden.dto.base.CommonResponse; import com.qiwuai.garden.dto.base.CommonResponse;
import com.qiwuai.garden.dto.base.ResultResponse; import com.qiwuai.garden.dto.base.ResultResponse;
...@@ -32,7 +29,6 @@ import com.qiwuai.garden.service.taskService.TaskService; ...@@ -32,7 +29,6 @@ import com.qiwuai.garden.service.taskService.TaskService;
import com.qiwuai.garden.service.taskService.impl.TaskServiceImpl; import com.qiwuai.garden.service.taskService.impl.TaskServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -41,8 +37,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -41,8 +37,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException; import java.text.ParseException;
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
@RestController @RestController
@RequestMapping("/secretGarden") @RequestMapping("/secretGarden")
public class CommonController { public class CommonController {
...@@ -452,6 +446,9 @@ public class CommonController { ...@@ -452,6 +446,9 @@ public class CommonController {
case "查询本人地址": case "查询本人地址":
result = socialServiceProxy.checkLocationSelf(operationReq); result = socialServiceProxy.checkLocationSelf(operationReq);
break; break;
case "随机获取玩家地址":
result = socialServiceProxy.getRandomAddress(operationReq);
break;
case "查看简报": case "查看简报":
result = socialServiceProxy.checkReport(operationReq); result = socialServiceProxy.checkReport(operationReq);
break; break;
...@@ -722,7 +719,7 @@ public class CommonController { ...@@ -722,7 +719,7 @@ public class CommonController {
case "询问建议": case "询问建议":
result = adviseServiceProxy.adviseWithout(operationReq); result = adviseServiceProxy.adviseWithout(operationReq);
break; break;
case "种植建议指令": case "询问种植建议":
result = adviseServiceProxy.adviseByPlant(operationReq); result = adviseServiceProxy.adviseByPlant(operationReq);
break; break;
} }
......
package com.qiwuai.garden.dto;
import lombok.Data;
@Data
public class AdviseOperateDto {
/**
* 操作名
*/
private String operateName;
/**
* 操作变量
*/
private String operationReq;
}
...@@ -63,6 +63,11 @@ public class ResultResponse { ...@@ -63,6 +63,11 @@ public class ResultResponse {
* 是否开启日常任务,bot话题模块需要该变量 * 是否开启日常任务,bot话题模块需要该变量
*/ */
private String 是否开启日常任务 = "否"; private String 是否开启日常任务 = "否";
/**
* GB_随机玩家地址,bot新手y引导用于保存
*/
@JsonProperty("GB_随机玩家地址")
private String GB_随机玩家地址;
/***************************用于清空bot端保留的变量***********************************/ /***************************用于清空bot端保留的变量***********************************/
/** /**
......
...@@ -181,4 +181,9 @@ public class CallRequest { ...@@ -181,4 +181,9 @@ public class CallRequest {
* 时长 * 时长
*/ */
private String 时长; private String 时长;
/**
* GB_园丁姓名
*/
@JsonProperty(value = "GB_园丁姓名")
private String GB_园丁姓名;
} }
...@@ -187,6 +187,10 @@ public class OperationRequest { ...@@ -187,6 +187,10 @@ public class OperationRequest {
*/ */
private Integer time; private Integer time;
/** /**
* GB_园丁姓名
*/
private String gardenerName;
/**
* 本轮操作标识 * 本轮操作标识
*/ */
private Integer operationLabel; private Integer operationLabel;
......
package com.qiwuai.garden.pojo; package com.qiwuai.garden.pojo;
import com.qiwuai.garden.dto.GardenerDto;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@Data @Data
public class PetPojo { public class PetPojo implements Cloneable {
/** /**
* 动物id * 动物id
*/ */
...@@ -86,4 +87,19 @@ public class PetPojo { ...@@ -86,4 +87,19 @@ public class PetPojo {
* 修改时间 * 修改时间
*/ */
private String updateTime; private String updateTime;
/**
* 深拷贝宠物栏
*/
@Override
public PetPojo clone() {
try {
PetPojo clone = (PetPojo) super.clone();
clone.setHp(this.hp);
clone.setFc(this.fc);
return clone;
} catch (CloneNotSupportedException e) {
throw new AssertionError();
}
}
} }
...@@ -253,18 +253,19 @@ public class GardenerServiceImpl implements GardenerService { ...@@ -253,18 +253,19 @@ public class GardenerServiceImpl implements GardenerService {
TimingAcquisition.addressMap.get(region).put(location, regionTmp); TimingAcquisition.addressMap.get(region).put(location, regionTmp);
} }
//---------------------更新玩家地址的动态词组------------------- //---------------------更新玩家地址的动态词组-------------------
Map<String, Map<String, RegionDto>> addressMap = TimingAcquisition.addressMap; // Map<String, Map<String, RegionDto>> addressMap = TimingAcquisition.addressMap;
if (addressMap.size() != 0 ) { // if (addressMap.size() != 0 ) {
//所有玩家地址 // //所有玩家地址
List<String> playerList = new ArrayList<>(); // List<String> playerList = new ArrayList<>();
for (String address : addressMap.keySet()) { // for (String address : addressMap.keySet()) {
List<String> regionPlayerList = new ArrayList<>(addressMap.get(address).keySet()); // List<String> regionPlayerList = new ArrayList<>(addressMap.get(address).keySet());
playerList.addAll(regionPlayerList); // playerList.addAll(regionPlayerList);
} // }
String address = String.join("+", playerList); // String address = String.join("+", playerList);
HttpUtil.doPut("项目词组玩家地址", address); // HttpUtil.doPut("项目词组玩家地址", address);
HttpUtil.doPutCrazyGardener("项目词组玩家地址", address); // HttpUtil.doPutCrazyGardener("项目词组玩家地址", address);
} // HttpUtil.doPutAngelLoveMe("项目词组玩家地址", address);
// }
//玩家初始宠物id //玩家初始宠物id
String initialPet = TimingAcquisition.systemConfigMap.get("initial_pet").getValue(); String initialPet = TimingAcquisition.systemConfigMap.get("initial_pet").getValue();
//初始化宠物栏 //初始化宠物栏
......
...@@ -1032,6 +1032,7 @@ public class MarketServiceImpl implements MarketService { ...@@ -1032,6 +1032,7 @@ public class MarketServiceImpl implements MarketService {
commonResponse.setMsg("成功"); commonResponse.setMsg("成功");
resultResponse.set反馈ID(400306); resultResponse.set反馈ID(400306);
resultResponse.set反馈文本(text); resultResponse.set反馈文本(text);
resultResponse.set后台附加返回("查看商品回复2");
resultVarsResponse.setVars(resultResponse); resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse); commonResponse.setData(resultVarsResponse);
return commonResponse; return commonResponse;
......
...@@ -257,7 +257,8 @@ public class NurseryServiceImpl implements NurseryService { ...@@ -257,7 +257,8 @@ public class NurseryServiceImpl implements NurseryService {
//获取玩家所有花圃信息 //获取玩家所有花圃信息
Map<Integer, NurseryInfoDto> nurseryInfoMap = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos(); Map<Integer, NurseryInfoDto> nurseryInfoMap = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos();
//统计空闲花圃个数
int freeNurseryCount = 0;
for (Map.Entry<Integer, NurseryInfoDto> entry : nurseryInfoMap.entrySet()) { for (Map.Entry<Integer, NurseryInfoDto> entry : nurseryInfoMap.entrySet()) {
NurseryInfoDto nurseryInfo = entry.getValue(); NurseryInfoDto nurseryInfo = entry.getValue();
String nowTime = DateUtil.getCurrentTime(); String nowTime = DateUtil.getCurrentTime();
...@@ -278,6 +279,8 @@ public class NurseryServiceImpl implements NurseryService { ...@@ -278,6 +279,8 @@ public class NurseryServiceImpl implements NurseryService {
} else { } else {
seedingNumList.add(entry.getKey()); seedingNumList.add(entry.getKey());
} }
} else {
freeNurseryCount++;
} }
//有新来宠物的花圃统计 //有新来宠物的花圃统计
if (nurseryInfo.getPetCheck() == Constants.PET_UNCHECK && !StringUtils.isEmpty(nurseryInfo.getPetField())) { if (nurseryInfo.getPetCheck() == Constants.PET_UNCHECK && !StringUtils.isEmpty(nurseryInfo.getPetField())) {
...@@ -358,6 +361,12 @@ public class NurseryServiceImpl implements NurseryService { ...@@ -358,6 +361,12 @@ public class NurseryServiceImpl implements NurseryService {
text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "nursery_all_check"); text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "nursery_all_check");
text = SpeechUtil.speechReplaceNum(text, String.valueOf(nurseryInfoMap.size()), feedText.toString()); text = SpeechUtil.speechReplaceNum(text, String.valueOf(nurseryInfoMap.size()), feedText.toString());
text = SpeechUtil.speechReplaceNum(text, "植物"); text = SpeechUtil.speechReplaceNum(text, "植物");
//存在空闲花圃
if (freeNurseryCount > 0) {
String freeNurseryText = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "nursery_have_free");
freeNurseryText = SpeechUtil.speechReplaceNum(freeNurseryText, String.valueOf(freeNurseryCount));
text += freeNurseryText;
}
//花圃中有植物时,园丁的回复 //花圃中有植物时,园丁的回复
gardenerText = SpeechUtil.getPlantSpeech(gender, "nursery_status"); gardenerText = SpeechUtil.getPlantSpeech(gender, "nursery_status");
} }
...@@ -1426,6 +1435,19 @@ public class NurseryServiceImpl implements NurseryService { ...@@ -1426,6 +1435,19 @@ public class NurseryServiceImpl implements NurseryService {
} }
//玩家花圃信息 //玩家花圃信息
NurseryInfoDto nurseryInfo = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos().get(nurseryNum); NurseryInfoDto nurseryInfo = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos().get(nurseryNum);
//花圃已经是初始类型
if (nurseryInfo.getId() == Constants.NURSERY_INIT_ID) {
//获取对应话术
String text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "nursery_reset_fail_nursery_no_need");
text = SpeechUtil.speechReplaceNum(text, nurseryNum.toString(), TimingAcquisition.nurseryConfigMap.get(nurseryInfo.getId()).getName());
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(100709);
resultResponse.set反馈文本(text);
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
//花圃已重置次数 //花圃已重置次数
int resetTimes = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryResetTimes(); int resetTimes = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryResetTimes();
//货币配置信息 //货币配置信息
......
...@@ -287,8 +287,6 @@ public class PlantServiceImpl implements PlantService { ...@@ -287,8 +287,6 @@ public class PlantServiceImpl implements PlantService {
operationReq.setPlantId(null); //清空该植物名称 operationReq.setPlantId(null); //清空该植物名称
operationReq.setNurseryNum(nurseryNum); operationReq.setNurseryNum(nurseryNum);
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//保存玩家这轮的请求信息
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术 //获取对应话术
String text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "plant_fail_plant_not_exist"); String text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "plant_fail_plant_not_exist");
text += SpeechUtil.getPlantSpeech(gender, "plant_fail_plant_not_exist"); text += SpeechUtil.getPlantSpeech(gender, "plant_fail_plant_not_exist");
...@@ -2017,6 +2015,9 @@ public class PlantServiceImpl implements PlantService { ...@@ -2017,6 +2015,9 @@ public class PlantServiceImpl implements PlantService {
NurseryInfoDto nurseryInfo = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos().get(nurseryNum); NurseryInfoDto nurseryInfo = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos().get(nurseryNum);
//该花圃配置信息 //该花圃配置信息
NurseryPojo nurseryConfig = TimingAcquisition.nurseryConfigMap.get(nurseryInfo.getId()); NurseryPojo nurseryConfig = TimingAcquisition.nurseryConfigMap.get(nurseryInfo.getId());
//货币配置信息
Integer moneyId = Integer.parseInt(TimingAcquisition.systemConfigMap.get("money").getValue());
ItemPojo moneyConfig = TimingAcquisition.itemConfigMap.get(moneyId);
//获取花圃置空所需消费的系统参数 //获取花圃置空所需消费的系统参数
SystemConfigPojo clearCost = TimingAcquisition.systemConfigMap.get("clear_cost"); SystemConfigPojo clearCost = TimingAcquisition.systemConfigMap.get("clear_cost");
//花圃未种植植物 //花圃未种植植物
...@@ -2040,7 +2041,7 @@ public class PlantServiceImpl implements PlantService { ...@@ -2040,7 +2041,7 @@ public class PlantServiceImpl implements PlantService {
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术 //获取对应话术
String text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "clear_plant_check"); String text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "clear_plant_check");
text = SpeechUtil.speechReplaceNum(text, clearCost.getValue(), nurseryNum.toString()); text = SpeechUtil.speechReplaceNum(text, clearCost.getValue(), moneyConfig.getName(), nurseryNum.toString());
text += SpeechUtil.getPlantSpeech(gender, "clear_plant_check"); text += SpeechUtil.getPlantSpeech(gender, "clear_plant_check");
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName()); text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse.setCode(1); commonResponse.setCode(1);
...@@ -2056,7 +2057,7 @@ public class PlantServiceImpl implements PlantService { ...@@ -2056,7 +2057,7 @@ public class PlantServiceImpl implements PlantService {
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术 //获取对应话术
String text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "clear_plant_check"); String text = SpeechUtil.getPlantSpeech(Constants.SPEECH_ASIDE, "clear_plant_check");
text = SpeechUtil.speechReplaceNum(text, clearCost.getValue(), nurseryNum.toString()); text = SpeechUtil.speechReplaceNum(text, clearCost.getValue(), moneyConfig.getName(), nurseryNum.toString());
text += SpeechUtil.getPlantSpeech(gender, "clear_plant_check_mature"); text += SpeechUtil.getPlantSpeech(gender, "clear_plant_check_mature");
//花圃中的植物已成熟 //花圃中的植物已成熟
commonResponse.setCode(1); commonResponse.setCode(1);
...@@ -2255,9 +2256,9 @@ public class PlantServiceImpl implements PlantService { ...@@ -2255,9 +2256,9 @@ public class PlantServiceImpl implements PlantService {
int result = cancelAfterHarvestUpdate(uid, nurseryInfo, itemConfigMap, fruit, dropItems); int result = cancelAfterHarvestUpdate(uid, nurseryInfo, itemConfigMap, fruit, dropItems);
//玩家货币不够,铲除植物失败 //玩家货币不够,铲除植物失败
if (result == 0) { if (result == 0) {
feedText.append(",背包中的货币不够,铲除植物失败");
//货币id //货币id
Integer moneyId = Integer.parseInt(TimingAcquisition.systemConfigMap.get("money").getValue()); Integer moneyId = Integer.parseInt(TimingAcquisition.systemConfigMap.get("money").getValue());
feedText.append(",背包中的").append(TimingAcquisition.itemConfigMap.get(moneyId).getName()).append("不够,铲除植物失败");
//获取对应话术 //获取对应话术
String text = SpeechUtil.getPlantSpeech(gender, "clear_plant_fail_money"); String text = SpeechUtil.getPlantSpeech(gender, "clear_plant_fail_money");
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName(), TimingAcquisition.itemConfigMap.get(moneyId).getName()); text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName(), TimingAcquisition.itemConfigMap.get(moneyId).getName());
...@@ -2458,6 +2459,10 @@ public class PlantServiceImpl implements PlantService { ...@@ -2458,6 +2459,10 @@ public class PlantServiceImpl implements PlantService {
} }
} }
} }
//随机一个花圃
if (nurseryNum == Constants.REQ_RANDOM) {
nurseryNum= RandomDropUtil.getRandomNum(1, nurserySize + 1);
}
NurseryInfoDto nurseryInfo = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos().get(nurseryNum); NurseryInfoDto nurseryInfo = TimingAcquisition.gardenerMap.get(uid).getGarden().getNurseryInfos().get(nurseryNum);
//1.花圃还未种植植物 //1.花圃还未种植植物
if (StringUtils.isEmpty(nurseryInfo.getPlantId())) { if (StringUtils.isEmpty(nurseryInfo.getPlantId())) {
......
...@@ -151,6 +151,12 @@ public interface SocialService { ...@@ -151,6 +151,12 @@ public interface SocialService {
*/ */
CommonResponse checkLocationSelf(OperationRequest operationReq); CommonResponse checkLocationSelf(OperationRequest operationReq);
/** /**
* 随机获取玩家地址
* @param operationReq
* @return CommonResponse
*/
CommonResponse getRandomAddress(OperationRequest operationReq);
/**
* 查看简报 * 查看简报
* @param operationReq * @param operationReq
* @return CommonResponse * @return CommonResponse
......
...@@ -1445,7 +1445,7 @@ public class SocialServiceImpl implements SocialService { ...@@ -1445,7 +1445,7 @@ public class SocialServiceImpl implements SocialService {
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术 //获取对应话术
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "visit_stranger_check_cross"); String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "visit_stranger_check_cross");
text = SpeechUtil.speechReplaceNum(text, friendName, Integer.toString(crossRegionCost), moneyConfig.getName()); text = SpeechUtil.speechReplaceNum(text, friendPlace, Integer.toString(crossRegionCost), moneyConfig.getName());
commonResponse.setCode(1); commonResponse.setCode(1);
commonResponse.setMsg("成功"); commonResponse.setMsg("成功");
resultResponse.set反馈ID(500102); resultResponse.set反馈ID(500102);
...@@ -1495,7 +1495,7 @@ public class SocialServiceImpl implements SocialService { ...@@ -1495,7 +1495,7 @@ public class SocialServiceImpl implements SocialService {
//玩家还没有好友 //玩家还没有好友
if (StringUtils.isEmpty(friendList)) { if (StringUtils.isEmpty(friendList)) {
//获取对应话术 //获取对应话术
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "delete_friend_fail_none"); String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "delete_friend_fail_no_friend");
text += SpeechUtil.getSocialSpeech(gender, "delete_friend_fail_none"); text += SpeechUtil.getSocialSpeech(gender, "delete_friend_fail_none");
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName()); text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse.setCode(1); commonResponse.setCode(1);
...@@ -1520,14 +1520,14 @@ public class SocialServiceImpl implements SocialService { ...@@ -1520,14 +1520,14 @@ public class SocialServiceImpl implements SocialService {
commonResponse.setData(resultVarsResponse); commonResponse.setData(resultVarsResponse);
return commonResponse; return commonResponse;
} }
String person = (name == null) ? address : name; // String person = (name == null) ? address : name;
//好友列表中没有指定好友 //好友列表中没有指定好友
List<String> addressList = friendList.stream().map(FriendDto::getAddress).collect(Collectors.toList()); List<String> addressList = friendList.stream().map(FriendDto::getAddress).collect(Collectors.toList());
List<String> nameList = friendList.stream().map(FriendDto::getName).collect(Collectors.toList()); List<String> nameList = friendList.stream().map(FriendDto::getName).collect(Collectors.toList());
if (!addressList.contains(address) && !nameList.contains(name)) { if (!addressList.contains(address) && !nameList.contains(name)) {
//获取对应话术 //获取对应话术
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "delete_friend_fail_none"); String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "delete_friend_fail_none");
text = SpeechUtil.speechReplaceNum(text, person); text = SpeechUtil.speechReplaceNum(text, address);
text += SpeechUtil.getSocialSpeech(gender, "delete_friend_fail_none"); text += SpeechUtil.getSocialSpeech(gender, "delete_friend_fail_none");
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName()); text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse.setCode(1); commonResponse.setCode(1);
...@@ -1542,7 +1542,7 @@ public class SocialServiceImpl implements SocialService { ...@@ -1542,7 +1542,7 @@ public class SocialServiceImpl implements SocialService {
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术 //获取对应话术
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "delete_friend_check"); String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "delete_friend_check");
text = SpeechUtil.speechReplaceNum(text, person); text = SpeechUtil.speechReplaceNum(text, address);
text += SpeechUtil.getSocialSpeech(gender, "delete_friend_check"); text += SpeechUtil.getSocialSpeech(gender, "delete_friend_check");
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName()); text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse.setCode(1); commonResponse.setCode(1);
...@@ -3666,6 +3666,42 @@ public class SocialServiceImpl implements SocialService { ...@@ -3666,6 +3666,42 @@ public class SocialServiceImpl implements SocialService {
} }
@Override @Override
public CommonResponse getRandomAddress(OperationRequest operationReq) {
CommonResponse commonResponse = new CommonResponse();
ResultVarsResponse resultVarsResponse = new ResultVarsResponse();
ResultResponse resultResponse = new ResultResponse();
String uid = operationReq.getUid(); //本人uid
String location = TimingAcquisition.gardenerMap.get(uid).getLocation(); //玩家本人地址
String place = TypeConvertUtil.extractChinese(location);
//玩家所在地区的所有玩家
List<String> playerList = new ArrayList<>(TimingAcquisition.addressMap.get(place).keySet());
//当前玩家所有好友
List<FriendDto> friendList = TimingAcquisition.gardenerMap.get(uid).getFriendList();
//取出该地区所有非好友玩家
if (!StringUtils.isEmpty(friendList)) {
List<String> friendAddressList = new ArrayList<>();
for (FriendDto friend : friendList) {
friendAddressList.add(friend.getAddress());
}
playerList.removeIf(friendAddressList::contains);
}
//去除玩家本人
playerList.removeIf(location::contains);
//随机取一个本地区非好友的玩家
int randomNum = RandomDropUtil.getRandomNum(0, playerList.size());
String address = playerList.get(randomNum);
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(501002);
resultResponse.set反馈文本("随机获取到的玩家地址:" + address);
resultResponse.setGB_随机玩家地址(address);
resultVarsResponse.setVars(resultResponse);
commonResponse.setData(resultVarsResponse);
return commonResponse;
}
@Override
public CommonResponse checkReport(OperationRequest operationReq) { public CommonResponse checkReport(OperationRequest operationReq) {
CommonResponse commonResponse = new CommonResponse(); CommonResponse commonResponse = new CommonResponse();
ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); ResultVarsResponse resultVarsResponse = new ResultVarsResponse();
...@@ -6030,7 +6066,7 @@ public class SocialServiceImpl implements SocialService { ...@@ -6030,7 +6066,7 @@ public class SocialServiceImpl implements SocialService {
//当前玩家上一轮的请求信息 //当前玩家上一轮的请求信息
OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid);
if (!StringUtils.isEmpty(lastReq)) { if (!StringUtils.isEmpty(lastReq)) {
if (!Constants.LEAVE_MESSAGE.equals(lastReq.getOperationLabel())) { if (Constants.LEAVE_MESSAGE.equals(lastReq.getOperationLabel())) {
address = lastReq.getAddress(); //好友的玩家地址 address = lastReq.getAddress(); //好友的玩家地址
message = lastReq.getMessage(); //好友留言 message = lastReq.getMessage(); //好友留言
} }
...@@ -7079,8 +7115,8 @@ public class SocialServiceImpl implements SocialService { ...@@ -7079,8 +7115,8 @@ public class SocialServiceImpl implements SocialService {
if (!StringUtils.isEmpty(petFieldSides) && !StringUtils.isEmpty(petFields)) { if (!StringUtils.isEmpty(petFieldSides) && !StringUtils.isEmpty(petFields)) {
int i = 0; //防守方宠物栏的起始位置 int i = 0; //防守方宠物栏的起始位置
int j = 0; //挑战方宠物栏的起始位置 int j = 0; //挑战方宠物栏的起始位置
//宠物配置信息 //宠物配置信息,深拷贝,避免改动配置的数据
Map<Integer, PetPojo> petConfigMap = TimingAcquisition.petConfigMap; Map<Integer, PetPojo> petConfigMap = new ConcurrentHashMap<>(TimingAcquisition.petConfigMap);
//稀有度配置信息 //稀有度配置信息
Map<Integer, RarityPojo> rarityMap = TimingAcquisition.rarityMap; Map<Integer, RarityPojo> rarityMap = TimingAcquisition.rarityMap;
//属性配置信息 //属性配置信息
...@@ -7117,10 +7153,12 @@ public class SocialServiceImpl implements SocialService { ...@@ -7117,10 +7153,12 @@ public class SocialServiceImpl implements SocialService {
//宠物攻击力增幅计算 //宠物攻击力增幅计算
double attackFcTimes = 1; //攻击方宠物攻击的原始倍数 double attackFcTimes = 1; //攻击方宠物攻击的原始倍数
double defendFcTimes = 1; //防守方宠物攻击的原始倍数 double defendFcTimes = 1; //防守方宠物攻击的原始倍数
//防守方对应位置的宠物 //防守方对应位置的宠物,深拷贝,避免改动配置的数据
PetPojo petSide = petConfigMap.get(petFieldSides.get(i)); PetPojo petSideCopy = petConfigMap.get(petFieldSides.get(i));
//挑战方对应位置的宠物 PetPojo petSide = petSideCopy.clone();
PetPojo pet = petConfigMap.get(petFields.get(j)); //挑战方对应位置的宠物,深拷贝,避免改动配置的数据
PetPojo petCopy = petConfigMap.get(petFields.get(j));
PetPojo pet = petCopy.clone();
//--------------------防守方的技能生命值加成------------- //--------------------防守方的技能生命值加成-------------
BigDecimal addHPProSide = TimingAcquisition.getAddPetHP(uidSide); BigDecimal addHPProSide = TimingAcquisition.getAddPetHP(uidSide);
Integer petSideAddHp = addHPProSide.add(new BigDecimal(1)).multiply(new BigDecimal(petSide.getHp())).intValue(); Integer petSideAddHp = addHPProSide.add(new BigDecimal(1)).multiply(new BigDecimal(petSide.getHp())).intValue();
......
...@@ -178,7 +178,7 @@ public class TaskServiceImpl implements TaskService { ...@@ -178,7 +178,7 @@ public class TaskServiceImpl implements TaskService {
//任务的配置信息 //任务的配置信息
TaskPojo task = TimingAcquisition.taskMap.get(taskId); TaskPojo task = TimingAcquisition.taskMap.get(taskId);
String addText = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, "daily_task_status_unfinished"); String addText = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, "daily_task_status_unfinished");
nameText.append(task.getName()).append("、").append(task.getDescription()); nameText.append(task.getName()).append("——").append(task.getDescription());
//该任务事件已完成次数 //该任务事件已完成次数
Integer finishTimes = gardener.getDailyTaskCountMap().get(task.getEventId()); Integer finishTimes = gardener.getDailyTaskCountMap().get(task.getEventId());
//该任务完成获得的奖励 //该任务完成获得的奖励
...@@ -204,10 +204,11 @@ public class TaskServiceImpl implements TaskService { ...@@ -204,10 +204,11 @@ public class TaskServiceImpl implements TaskService {
taskName.append(TimingAcquisition.taskMap.get(taskId).getName()).append("、"); taskName.append(TimingAcquisition.taskMap.get(taskId).getName()).append("、");
} }
taskName.deleteCharAt(taskName.length() - 1); taskName.deleteCharAt(taskName.length() - 1);
text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, "check_update_task_status_unfinished"); text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, "check_daily_task_status_unfinished");
text = SpeechUtil.speechReplaceNum(text, taskName.toString(), taskText.toString()); text = SpeechUtil.speechReplaceNum(text, taskName.toString(), taskText.toString());
text += SpeechUtil.getTaskSpeech(gender, "check_daily_task_status_unfinished");
} }
text += SpeechUtil.getTaskSpeech(gender, "check_update_task_status_unfinished"); text += SpeechUtil.getTaskSpeech(gender, "check_daily_task_status_unfinished");
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName()); text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse.setCode(1); commonResponse.setCode(1);
commonResponse.setMsg("成功"); commonResponse.setMsg("成功");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
aside: aside:
#进入游戏 #进入游戏
enter_game: enter_game:
- 【旁白@正常】欢迎进入追梦花园。 - 【旁白@正常】欢迎进入新世界。
#更改称呼 #更改称呼
gardener_call_name_change_fail_not_exist: gardener_call_name_change_fail_not_exist:
- 【旁白@正常】没有你提供的称呼,目前有【1】。 - 【旁白@正常】没有你提供的称呼,目前有【1】。
......
...@@ -144,9 +144,9 @@ aside: ...@@ -144,9 +144,9 @@ aside:
pet_rarity_check: pet_rarity_check:
- 【旁白@正常】宠物的稀有度决定了宠物出现的概率,稀有度等级越高的,出现概率就越低,但同时战斗力也会更高。稀有度等级如下:【1】。 - 【旁白@正常】宠物的稀有度决定了宠物出现的概率,稀有度等级越高的,出现概率就越低,但同时战斗力也会更高。稀有度等级如下:【1】。
pet_info_check: pet_info_check:
- 【旁白@正常】【1】 【2】,稀有度为【3】,属性【4】,生命【5】,攻击【6】,在{花圃称呼}中可能会遗留【7】,喜欢植物:【8】。 - 【旁白@正常】【1】 【2】,稀有度为【3】,属性【4】,生命值【5】,攻击值【6】,在{花圃称呼}中可能会遗留【7】,喜欢植物:【8】。
pet_info_check_none: pet_info_check_none:
- 【旁白@正常】【1】 【2】,稀有度为【3】,属性【4】,生命【5】,攻击【6】,不会在{花圃称呼}中遗留物品,喜欢植物:【7】。 - 【旁白@正常】【1】 【2】,稀有度为【3】,属性【4】,生命值【5】,攻击值【6】,不会在{花圃称呼}中遗留物品,喜欢植物:【7】。
pet_cost_check: pet_cost_check:
- 【旁白@正常】【1】需要每天消耗【2】。 - 【旁白@正常】【1】需要每天消耗【2】。
pet_cost_check_none: pet_cost_check_none:
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
aside: aside:
#宠物查询 #宠物查询
pet_view_nursery_one: pet_view_nursery_one:
- 【旁白@正常】已为你查询,【1】【2】,目前该宠物正养在【3】号{花圃称呼}中。 - 【旁白@正常】【1】【2】,属性:【3】,生命值:【4】,攻击值:【5】,目前该宠物正养在【6】号{花圃称呼}中。
pet_view_field_one: pet_view_field_one:
- 【旁白@正常】已为你查询,【1】【2】,目前该宠物正在宠物栏里。 - 【旁白@正常】【1】【2】,属性:【3】,生命值:【4】,攻击值:【5】,目前该宠物正在宠物栏里。
pet_view_nursery_more: pet_view_nursery_more:
- 【旁白@正常】已为你查询,【1】【2】,目前有【3】只,该宠物正养在【4】中。 - 【旁白@正常】【1】【2】,属性:【3】,生命值:【4】,攻击值:【5】,目前有【6】只,该宠物正养在【7】中。
pet_view_field_more: pet_view_field_more:
- 【旁白@正常】已为你查询,【1】【2】,目前有【3】只,该宠物正在宠物栏里。 - 【旁白@正常】【1】【2】,属性:【3】,生命值:【4】,攻击值:【5】,目前有【6】只,该宠物正在宠物栏里。
pet_view_both: pet_view_both:
- 【旁白@正常】已为你查询,【1】【2】,目前有【3】只该宠物正在宠物栏里,有【4】只该宠物正养在【5】中。 - 【旁白@正常】【1】【2】,属性:【3】,生命值:【4】,攻击值:【5】,目前有【6】只该宠物正在宠物栏里,有【7】只该宠物正养在【8】中。
pet_view_no_pet: pet_view_no_pet:
- 【旁白@正常】已为你查询,{花圃称呼}、宠物栏内没有该宠物。我们还没有这个宠物,可以通过种植【1】,以一定几率获得 - 【旁白@正常】{花圃称呼}、宠物栏内没有该宠物。我们还没有这个宠物,可以通过种植【1】,以一定几率获得
pet_view_no_exist: pet_view_no_exist:
- 【旁白@正常】不存在该宠物。 - 【旁白@正常】不存在该宠物。
#宠物移动 #宠物移动
...@@ -22,6 +22,10 @@ aside: ...@@ -22,6 +22,10 @@ aside:
- 【旁白@正常】【1】号{花圃称呼}中已有【2】,无需移动。 - 【旁白@正常】【1】号{花圃称呼}中已有【2】,无需移动。
pet_move_nursery_fail_pet: pet_move_nursery_fail_pet:
- 【旁白@正常】【1】号{花圃称呼}里已有宠物,移动宠物失败。 - 【旁白@正常】【1】号{花圃称呼}里已有宠物,移动宠物失败。
pet_move_field_to_nursery:
- 【旁白@正常】已将宠物栏中的【1】与【2】号{花圃称呼}中的【3】交换位置。
pet_move_nursery_to_nursery:
- 【旁白@正常】已将【1】号{花圃称呼}中的【2】与【3】号{花圃称呼}中的【4】交换位置。
pet_move_nursery_fail_no_pet: pet_move_nursery_fail_no_pet:
- 【旁白@正常】宠物栏和{花圃称呼}中没有找到【1】。 - 【旁白@正常】宠物栏和{花圃称呼}中没有找到【1】。
pet_move_nursery_fail_no_exist: pet_move_nursery_fail_no_exist:
...@@ -112,7 +116,7 @@ aside: ...@@ -112,7 +116,7 @@ aside:
- 【旁白@正常】宠物栏为空,当前位置上限【1】,还有【1】个空位。 - 【旁白@正常】宠物栏为空,当前位置上限【1】,还有【1】个空位。
#查看花圃宠物状况 #查看花圃宠物状况
nursery_pet_check: nursery_pet_check:
- 【旁白@正常】花园目前有宠物的{花圃称呼}一共有【1】块,【2】块{花圃称呼}空闲可放置宠物。 - 【旁白@正常】花园目前有宠物的{花圃称呼}一共有【1】个,【2】个{花圃称呼}空闲可放置宠物。
nursery_pet_check_new_pet: nursery_pet_check_new_pet:
- 【旁白@正常】你{花圃称呼}中的植物成熟后共吸引来【1】只宠物,【2】。 - 【旁白@正常】你{花圃称呼}中的植物成熟后共吸引来【1】只宠物,【2】。
nursery_pet_check_no_new_pet: nursery_pet_check_no_new_pet:
...@@ -174,6 +178,8 @@ man: ...@@ -174,6 +178,8 @@ man:
- 【男园丁@正常】一个{花圃称呼}里只能放一只宠物哦! - 【男园丁@正常】一个{花圃称呼}里只能放一只宠物哦!
- 【男园丁@正常】如果放两只宠物在同一个地方它们会挤不下的。 - 【男园丁@正常】如果放两只宠物在同一个地方它们会挤不下的。
- 【男园丁@正常】我们的宠物已经够多了【1】……。 - 【男园丁@正常】我们的宠物已经够多了【1】……。
pet_move_field_to_nursery:
- 【男园丁@正常】它们换地方了,我们先让这两只小家伙适应地方吧。
pet_move_nursery_fail_no_nursery: pet_move_nursery_fail_no_nursery:
- 【男园丁@正常】【1】【2】还没说{花圃称呼}编号。 - 【男园丁@正常】【1】【2】还没说{花圃称呼}编号。
pet_move_nursery_fail_no_pet: pet_move_nursery_fail_no_pet:
...@@ -343,6 +349,8 @@ woman: ...@@ -343,6 +349,8 @@ woman:
- 【女园丁@正常】没有空闲宠物栏,看来我们养的宠物已经够多了。 - 【女园丁@正常】没有空闲宠物栏,看来我们养的宠物已经够多了。
- 【女园丁@正常】我们的宠物栏都满员了…… - 【女园丁@正常】我们的宠物栏都满员了……
- 【女园丁@正常】不如暂时就先维持原样吧! - 【女园丁@正常】不如暂时就先维持原样吧!
pet_move_field_to_nursery:
- 【女园丁@正常】已经换好位置啦,接下来就让它们好好适应吧。
pet_move_nursery_fail_no_nursery: pet_move_nursery_fail_no_nursery:
- 【女园丁@正常】【1】是说的哪个{花圃称呼}呀? - 【女园丁@正常】【1】是说的哪个{花圃称呼}呀?
pet_move_nursery_fail_no_pet: pet_move_nursery_fail_no_pet:
......
...@@ -122,7 +122,7 @@ aside: ...@@ -122,7 +122,7 @@ aside:
nursery_all_fail_no_plant: nursery_all_fail_no_plant:
- 【旁白@正常】所有{花圃称呼}还未种植。 - 【旁白@正常】所有{花圃称呼}还未种植。
nursery_all_check: nursery_all_check:
- 【旁白@正常】一共有【1】个苗圃,【2】,其它苗圃还空闲着。 - 【旁白@正常】一共有【1】个苗圃,【2】。
nursery_all_seeding: nursery_all_seeding:
- 中的【1】刚刚播种了, - 中的【1】刚刚播种了,
nursery_all_sowing: nursery_all_sowing:
...@@ -133,9 +133,11 @@ aside: ...@@ -133,9 +133,11 @@ aside:
- 中的【1】已经开花, - 中的【1】已经开花,
nursery_all_mature: nursery_all_mature:
- 中的【1】已经成熟,可以收取果实了。 - 中的【1】已经成熟,可以收取果实了。
nursery_have_free:
- 有【1】个{花圃称呼}还空闲着。
#铲除植物 #铲除植物
clear_plant_check: clear_plant_check:
- 【旁白@正常】确定消耗【1】个货币,铲除【2】号{花圃称呼}上的植物吗? - 【旁白@正常】确定消耗【1】个【2】,铲除【3】号{花圃称呼}上的植物吗?
clear_plant_check_fail_error: clear_plant_check_fail_error:
- 【旁白@正常】{花圃称呼}编号不存在。 - 【旁白@正常】{花圃称呼}编号不存在。
clear_plant_check_fail_over: clear_plant_check_fail_over:
...@@ -194,6 +196,8 @@ aside: ...@@ -194,6 +196,8 @@ aside:
- 【旁白@正常】已取消重置{花圃称呼}。 - 【旁白@正常】已取消重置{花圃称呼}。
nursery_reset_fail_nursery_no_exist: nursery_reset_fail_nursery_no_exist:
- 【旁白@正常】不存在该{花圃称呼}。 - 【旁白@正常】不存在该{花圃称呼}。
nursery_reset_fail_nursery_no_need:
- 【旁白@正常】【1】号{花圃称呼}为【2】,无需重置。
#开启花圃 #开启花圃
nursery_reclaim_check: nursery_reclaim_check:
- 【旁白@正常】目前可开启【1】号{花圃称呼},需要消费【2】【3】,要开启这个{花圃称呼}吗? - 【旁白@正常】目前可开启【1】号{花圃称呼},需要消费【2】【3】,要开启这个{花圃称呼}吗?
...@@ -476,7 +480,7 @@ woman: ...@@ -476,7 +480,7 @@ woman:
plant_fail_planted_no_free: plant_fail_planted_no_free:
- 【女园丁@正常】【1】太勤奋了,所有{花圃称呼}都已经种满了耶。 - 【女园丁@正常】【1】太勤奋了,所有{花圃称呼}都已经种满了耶。
plant_fail_nursery_level: plant_fail_nursery_level:
- 【女园丁@正常】我们的{花圃称呼}等级还差一点点就够升级了……主要我会陪【2】一起加油升级的! - 【女园丁@正常】我们的{花圃称呼}等级还差一点点就够升级了……【1】我会陪【2】一起加油升级的!
- 【女园丁@正常】不要灰心!我会陪着【1】一起给{花圃称呼}升级的! - 【女园丁@正常】不要灰心!我会陪着【1】一起给{花圃称呼}升级的!
- 【女园丁@正常】没关系,只要【1】每天都来管理{花圃称呼},我相信再过不久{花圃称呼}就能升级了! - 【女园丁@正常】没关系,只要【1】每天都来管理{花圃称呼},我相信再过不久{花圃称呼}就能升级了!
plant_fail_nursery_type: plant_fail_nursery_type:
...@@ -556,7 +560,7 @@ woman: ...@@ -556,7 +560,7 @@ woman:
- 【女园丁@正常】看见花园被打理的这么好,我真的很开心。 - 【女园丁@正常】看见花园被打理的这么好,我真的很开心。
- 【女园丁@正常】听我说谢谢你,因为有【1】【2】,我们的花园变得越来越美丽! - 【女园丁@正常】听我说谢谢你,因为有【1】【2】,我们的花园变得越来越美丽!
nursery_pet: nursery_pet:
- 我们的{花圃称呼}吸引来了一只神秘动物,不知道长什么样,真是让人觉得好奇…… - 我们的{花圃称呼}吸引来了神秘动物,不知道长什么样,真是让人觉得好奇……
- 我希望来的能是可爱的动物,嘿嘿。 - 我希望来的能是可爱的动物,嘿嘿。
- 真想去看看是什么动物,【1】我们去吧! - 真想去看看是什么动物,【1】我们去吧!
nursery_level: nursery_level:
...@@ -638,7 +642,7 @@ woman: ...@@ -638,7 +642,7 @@ woman:
nursery_reset_fail_usable: nursery_reset_fail_usable:
- 【女园丁@正常】【1】,这个{花圃称呼}还没开启呢,可以不用重置哦。 - 【女园丁@正常】【1】,这个{花圃称呼}还没开启呢,可以不用重置哦。
nursery_reset_fail_no_nursery: nursery_reset_fail_no_nursery:
- 【女园丁@正常】【1】【2】现在拥有【1】块{花圃称呼},是想重置哪一块? - 【女园丁@正常】【1】【2】现在拥有【3】块{花圃称呼},是想重置哪一块?
nursery_reset_fail_nursery_no_exist: nursery_reset_fail_nursery_no_exist:
- 【女园丁@正常】【1】,没有这样的{花圃称呼},重置不了呀。 - 【女园丁@正常】【1】,没有这样的{花圃称呼},重置不了呀。
#开启花圃 #开启花圃
......
...@@ -52,6 +52,8 @@ aside: ...@@ -52,6 +52,8 @@ aside:
- 【旁白@正常】已将好友【1】从你的好友列表中移除。 - 【旁白@正常】已将好友【1】从你的好友列表中移除。
delete_friend_fail_none: delete_friend_fail_none:
- 【旁白@正常】好友列表里没有【1】这个人。 - 【旁白@正常】好友列表里没有【1】这个人。
delete_friend_fail_no_friend:
- 【旁白@正常】你暂时还没有好友,无需删除。
delete_friend_cancel: delete_friend_cancel:
- 【旁白@正常】好的,已为你取消删除好友【1】。 - 【旁白@正常】好的,已为你取消删除好友【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