Commit 3010968d by 周君强

1.部分日志调整;

2.帮助模块的部分实现; 3.动态词组更新。
parent 4cec3c0e
......@@ -141,6 +141,14 @@ public class Constants {
/**
* --------------------操作ID,用于记录每轮操作-------------------
* 园丁升级
*/
public static final Integer PLANT_SEED= 1001;
/**
* 园丁升级
*/
public static final Integer GARDENER_UPGRADE = 2001;
/**
* 宠物删除
*/
public static final Integer PET_DELETE = 3004;
......@@ -171,7 +179,7 @@ public class Constants {
/**
* 事件ID
* ----------------------------事件ID----------------------
* 播种
*/
public static final int SEEDING_EVENT = 1;
......@@ -290,6 +298,10 @@ public class Constants {
* 防守成功-1
*/
public static final Integer DEFEND_SUCCESS = 1;
/**
* 偷菜方不战而胜-2
*/
public static final Integer DEFEND_FAIL_NO_FIGHT = 2;
/**
......
......@@ -28,6 +28,7 @@ public class InitSysServlet implements InitializingBean {
private NurseryMapper nurseryMapper;
private PlantPeriodMapper plantPeriodMapper;
private PlantMapper plantMapper;
private PlantTypeMapper plantTypeMapper;
private AttributeMapper attributeMapper;
private AddItemSetMapper addItemSetMapper;
private AddItemMapper addItemMapper;
......@@ -62,6 +63,12 @@ public class InitSysServlet implements InitializingBean {
this.plantMapper = plantMapper;
}
@Autowired
public void setPlantTypeMapper(PlantTypeMapper plantTypeMapper) {
this.plantTypeMapper = plantTypeMapper;
}
@Autowired
public void setAttributeMapper(AttributeMapper attributeMapper) {
this.attributeMapper = attributeMapper;
......@@ -157,7 +164,7 @@ public class InitSysServlet implements InitializingBean {
*/
@Override
public void afterPropertiesSet() throws Exception {
//缓存花圃配置信息
//--------------------------缓存花圃配置信息----------------------
log.info("开始缓存花圃配置信息到缓存");
Map<Integer, NurseryPojo> nurseryPojoMap = new ConcurrentHashMap<>();
List<NurseryPojo> nurseryPojoList = nurseryMapper.findAll();
......@@ -168,7 +175,7 @@ public class InitSysServlet implements InitializingBean {
log.info("缓存中花圃配置信息:" + TimingAcquisition.nurseryConfigMap);
log.info("花圃配置信息缓存完成");
//缓存植物生长周期信息
//------------------------缓存植物生长周期信息---------------------
log.info("开始缓存植物生长周期信息到缓存");
Map<Integer, PlantPeriodPojo> plantPeriodPojoMap = new ConcurrentHashMap<>();
List<PlantPeriodPojo> plantPeriodPojoList = plantPeriodMapper.searchAll();
......@@ -179,7 +186,7 @@ public class InitSysServlet implements InitializingBean {
log.info("缓存中植物生长周期信息:" + TimingAcquisition.plantPeriodMap);
log.info("植物生长周期信息缓存完成");
//缓存植物配置信息
//-----------------------缓存植物配置信息-----------------------
log.info("开始缓存植物配置信息");
Map<Integer, PlantPojo> plantPojoMap = new ConcurrentHashMap<>();
List<PlantPojo> plantPojoList = plantMapper.searchAll();
......@@ -190,7 +197,18 @@ public class InitSysServlet implements InitializingBean {
log.info("缓存中植物配置信息:" + TimingAcquisition.plantMap);
log.info("植物配置缓存完成");
//缓存属性配置信息
//---------------------缓存植物类型配置信息-----------------------
log.info("开始缓存植物类型配置信息");
Map<Integer, PlantTypePojo> plantTypeMap = new ConcurrentHashMap<>();
List<PlantTypePojo> plantTypeList = plantTypeMapper.findAll();
for (PlantTypePojo plantType : plantTypeList) {
plantTypeMap.put(plantType.getId(), plantType);
}
TimingAcquisition.plantTypeMap.putAll(plantTypeMap);
log.info("缓存中植物类型配置信息:" + TimingAcquisition.plantTypeMap);
log.info("植物类型配置缓存完成");
//----------------------缓存属性配置信息---------------------
Map<Integer, AttributePojo> attributePojoMap = new ConcurrentHashMap<>();
List<AttributePojo> attributeList = attributeMapper.searchAll();
for (AttributePojo attribute : attributeList) {
......@@ -200,7 +218,7 @@ public class InitSysServlet implements InitializingBean {
log.info("缓存中植物属性配置信息:" + TimingAcquisition.attributeMap);
log.info("植物属性配置缓存完成");
//缓存植物生长周期信息
//----------------------缓存植物生长周期信息-------------------------
Map<Integer, Map<Integer, PlantPeriodDto>> periodTempMap = new ConcurrentHashMap<>();
for (PlantPojo plantPojo : TimingAcquisition.plantMap.values()) {
Map<Integer, PlantPeriodDto> periodMap = new ConcurrentHashMap<>();
......@@ -437,5 +455,8 @@ public class InitSysServlet implements InitializingBean {
log.info("缓存中玩家地址对应的地区信息" + TimingAcquisition.addressMap);
log.info("玩家地址对应的地区信息缓存完成");
//----------------------更新动态词组到bot服务器------------------------
TimingAcquisition.updatePhraseToBotServer();
}
}
......@@ -7,6 +7,8 @@ import com.qiwuai.garden.common.utils.YamlUtil;
import com.qiwuai.garden.dto.GardenerDto;
import com.qiwuai.garden.dto.base.CommonResponse;
import com.qiwuai.garden.dto.request.OperationRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.lang.reflect.InvocationHandler;
......@@ -15,6 +17,7 @@ import java.lang.reflect.Proxy;
import java.util.Map;
public class ProxyFactory {
Logger log = LoggerFactory.getLogger(ProxyFactory.class);
//从yml配置文件中取出对话过期时间
String offlineTime = YamlUtil.getValueByKey("offlineTime");
......@@ -53,8 +56,20 @@ public class ProxyFactory {
commonResponse.getData().getVars().set后台附加返回("无效返回");
}
}
String feedContent = "后台返回参数 = [" +
"code:" + commonResponse.getCode() +
", msg:" + commonResponse.getMsg() +
", 反馈ID:" + commonResponse.getData().getVars().get反馈ID() +
", 反馈文本:" + commonResponse.getData().getVars().get反馈文本() +
", 后台附加返回:" + commonResponse.getData().getVars().get后台附加返回() +
", 后台附加返回2:" + commonResponse.getData().getVars().get后台附加返回2() +
", 消息推送附加返回:" + commonResponse.getData().getVars().get消息推送附加返回() +
", 玩家当前地址:" + commonResponse.getData().getVars().get玩家当前位置() +
", 消息提醒:" + commonResponse.getData().getVars().get消息提醒() +
", 任务完成:" + commonResponse.getData().getVars().get任务完成() +
"]";
//玩家有新消息提示
System.out.println("增加参数返回,var:" + var);
log.info(feedContent);
return var;
}
}
......
......@@ -99,6 +99,29 @@ public class DateUtil {
}
/**
* 将秒换算成单位为天/时/分/秒
* @param time
* @return String
*/
public static String timeToDate(Long time) throws ParseException {
String result = null;
long days = time / (60 * 60 * 24);
long hours = (time % (60 * 60 * 24)) / (60 * 60);
long minutes = (time % (60 * 60)) / 60;
long seconds = time % 60;
if (days > 0) {
result = days + "天" + hours + "小时" + minutes + "分钟";
} else if (hours > 0) {
result = hours + "小时" + minutes + "分钟";
} else if (minutes > 0) {
result = minutes + "分钟" + seconds + "秒";
} else {
result = seconds + "秒";
}
return result;
}
/**
* 计算时间差(time1 - time2),返回单位为天
* @param time1
* @param time2
......
package com.qiwuai.garden.common.utils;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.qiwuai.garden.dto.request.PhraseRequest;
import com.qiwuai.garden.dto.response.PhraseResponse;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
public class HttpUtil {
//动态词组更新秘钥
public static String appSecret = YamlUtil.getValueByKey("appSecret");
public static PhraseResponse doPut(String phraseName, String phraseContent) {
RestTemplate template = new RestTemplate();
// String url = "http://hw-gz24.heyqiwu.cn:8082/out/phrase";
String url = "fake";
//获取时间戳
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(url, HttpMethod.PUT, request, PhraseResponse.class);
System.out.println("动态词组更新后的返回结果" + forObject);
return forObject.getBody();
}
}
......@@ -10,12 +10,15 @@ import com.qiwuai.garden.pojo.ItemPojo;
import com.qiwuai.garden.pojo.PlantPojo;
import com.qiwuai.garden.service.gardenerService.GardenerService;
import com.qiwuai.garden.service.gardenerService.impl.GardenerServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
public class RequestConversionUtil {
Logger log = LoggerFactory.getLogger(RequestConversionUtil.class);
/**
* 将请求的中文转成系统数据
* @param
......@@ -90,7 +93,9 @@ public class RequestConversionUtil {
number = TypeConvertUtil.extractNum(nurseryName);
}
if (number == Constants.REQ_NON) {
operationRequest.setNurseryId(Constants.REQ_NON);
//再次判断避免没有花圃类型id
nurseryId = TimingAcquisition.getNurseryIdByName(nurseryName);
operationRequest.setNurseryId(nurseryId);
} else {
operationRequest.setRank(number);
}
......@@ -339,6 +344,17 @@ public class RequestConversionUtil {
Integer status = TypeConvertUtil.readChineseToInteger(reportStatus);
operationRequest.setReportStatus(status);
}
//----------存在战斗轮次------------
String fightRound = callRequest.get战斗轮次();
if (!StringUtils.isEmpty(fightRound)) {
//将中文转换成数字
Integer number = TypeConvertUtil.change2Integer(fightRound);
//中文中不包含中文数字时,提取阿拉伯数字
if (number == 0) {
number = TypeConvertUtil.extractNum(fightRound);
}
operationRequest.setFightRound(number);
}
//----------存在离线时长------------
String offlineDays = callRequest.get离线时长();
if (!StringUtils.isEmpty(offlineDays)) {
......
......@@ -91,6 +91,20 @@ public class SpeechUtil {
}
/**
* 从任务模块话术获取话术
* @param someone
* @param feedText
* @return String
*/
public static String getHelpSpeech(String someone, String feedText) {
String result = "";
List<String> speech = TimingAcquisition.helpSpeechMap.get(someone).get(feedText);
Integer i = RandomDropUtil.getRandomNum(0, speech.size());
result = speech.get(i);
return result;
}
/**
* 替换话术中的一个数字
* @param one
* @return String
......@@ -177,6 +191,43 @@ public class SpeechUtil {
.replace("【4】", four).replace("【5】", five).replace("【6】", six).replace("【7】", seven);
}
/**
* 替换话术中的八个数字
* @param one
* @param two
* @param three
* @param four
* @param five
* @param six
* @param seven
* @param eight
* @return String
*/
public static String speechReplaceNum(String text, String one, String two, String three, String four, String five, String six, String seven, String eight) {
return text.replace("【1】", one).replace("【2】", two).replace("【3】", three)
.replace("【4】", four).replace("【5】", five).replace("【6】", six)
.replace("【7】", seven).replace("【8】", eight);
}
/**
* 替换话术中的九个数字
* @param one
* @param two
* @param three
* @param four
* @param five
* @param six
* @param seven
* @param eight
* @param nine
* @return String
*/
public static String speechReplaceNum(String text, String one, String two, String three, String four, String five, String six, String seven, String eight, String nine) {
return text.replace("【1】", one).replace("【2】", two).replace("【3】", three)
.replace("【4】", four).replace("【5】", five).replace("【6】", six)
.replace("【7】", seven).replace("【8】", eight).replace("【9】", nine);
}
public static void main(String[] args) {
String s = "我已经按照你的吩咐,在【1】花圃种上了【2】植物。";
System.out.println("转化结果:" + speechReplaceNum(s, "2"));
......
......@@ -123,6 +123,23 @@ public class YamlUtil {
}
/**
* 将帮助话术转成map格式
* @param
* @return Map<String, Map<String, List<String>>>
*/
public static Map<String, Map<String, List<String>>> helpSpeechToMap() {
Map<String, Map<String, List<String>>> speechMap = new HashMap<>();
try {
InputStream in = new FileInputStream(speechFilePath + "help.yaml");
Yaml yaml = new Yaml();
speechMap = yaml.load(in);
} catch (Exception e) {
e.printStackTrace();
}
return speechMap;
}
/**
* 读取配置文件yml中的某个值,只支持取第一层的值
* @param
* @return Map<String, Map<String, List<String>>>
......
package com.qiwuai.garden.controller;
import com.qiwuai.garden.common.Constants;
import com.qiwuai.garden.common.ProxyFactory;
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.CommonResponse;
import com.qiwuai.garden.dto.base.ResultResponse;
import com.qiwuai.garden.dto.base.ResultVarsResponse;
import com.qiwuai.garden.dto.request.OperationRequest;
import com.qiwuai.garden.service.backPackService.BackPackService;
import com.qiwuai.garden.service.backPackService.impl.BackPackServiceImpl;
import com.qiwuai.garden.service.gardenerService.GardenerService;
import com.qiwuai.garden.service.gardenerService.impl.GardenerServiceImpl;
import com.qiwuai.garden.service.helpService.HelpService;
import com.qiwuai.garden.service.helpService.impl.HelpServiceImpl;
import com.qiwuai.garden.service.marketService.MarketService;
import com.qiwuai.garden.service.marketService.impl.MarketServiceImpl;
import com.qiwuai.garden.service.nurseryService.NurseryService;
......@@ -22,7 +28,10 @@ import com.qiwuai.garden.service.socialService.SocialService;
import com.qiwuai.garden.service.socialService.impl.SocialServiceImpl;
import com.qiwuai.garden.service.taskService.TaskService;
import com.qiwuai.garden.service.taskService.impl.TaskServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -30,22 +39,12 @@ import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
@RestController
@RequestMapping("/secretGarden")
public class CommonController {
// @Autowired
// private GardenerService gardenerService;
// @Autowired
// private NurseryService nurseryService;
// @Autowired
// private PlantService plantService;
// @Autowired
// private BackPackService backPackService;
// @Autowired
// private PetService petService;
// @Autowired
// private MarketService marketService;
Logger log = LoggerFactory.getLogger(CommonController.class);
//种植模块动态代理
PlantService plantService = new PlantServiceImpl();
PlantService plantServiceProxy = (PlantService) new ProxyFactory(plantService).getProxyInstance();
......@@ -70,12 +69,31 @@ public class CommonController {
//任务模块动态代理
TaskService taskService = new TaskServiceImpl();
TaskService taskServiceProxy = (TaskService) new ProxyFactory(taskService).getProxyInstance();
//帮助模块动态代理
HelpService helpService = new HelpServiceImpl();
HelpService helpServiceProxy = (HelpService) new ProxyFactory(helpService).getProxyInstance();
@PostMapping(value = "/call", produces = "application/json;charset=UTF-8")
public CommonResponse createGardener(@RequestBody CommonRequest commonRequest) throws ParseException {
public CommonResponse startGame(@RequestBody CommonRequest commonRequest) throws ParseException {
log.info(commonRequest.getUid() + "当前操作的原始请求参数:" + commonRequest.getVars());
OperationRequest operationReq = RequestConversionUtil.request2Operation(commonRequest);
CommonResponse result = new CommonResponse();
switch (commonRequest.getVars().get操作名()) {
String operateName = commonRequest.getVars().get操作名();
log.info(operationReq.getUid() + "开始执行操作:【" + operateName + "】, 请求参数:" + operationReq);
//操作名为null
if (StringUtils.isEmpty(operateName)) {
log.info(operationReq.getUid() + "未提供操作名,无法操作");
ResultVarsResponse resultVarsResponse = new ResultVarsResponse();
ResultResponse resultResponse = new ResultResponse();
result.setCode(1);
result.setMsg("成功");
resultResponse.set反馈ID(100000);
resultResponse.set反馈文本("【旁白@正常】你想做什么呢?");
resultVarsResponse.setVars(resultResponse);
result.setData(resultVarsResponse);
return result;
}
switch (operateName) {
case "进入游戏":
result = gardenerServiceProxy.enterGame(operationReq);
break;
......@@ -377,6 +395,12 @@ public class CommonController {
case "获取战斗详情":
result = socialServiceProxy.getFightDetail(operationReq);
break;
case "查看战斗轮次":
result = socialServiceProxy.checkFightRound(operationReq);
break;
case "获取战斗轮次":
result = socialServiceProxy.getFightRound(operationReq);
break;
case "删除简报":
result = socialServiceProxy.deleteReportCheck(operationReq);
break;
......@@ -440,7 +464,74 @@ public class CommonController {
case "查询任务":
result = taskServiceProxy.checkTask(operationReq);
break;
case "打开帮助菜单":
result = helpServiceProxy.openHelpMenu(operationReq);
break;
case "帮助-花圃类型":
result = helpServiceProxy.nurseryTypeCheck(operationReq);
break;
case "帮助-花圃升级路线":
result = helpServiceProxy.nurseryTypeGetCheck(operationReq);
break;
case "帮助-花圃详情":
result = helpServiceProxy.nurseryTypeInfoCheck(operationReq);
break;
case "帮助-花圃等级上限":
result = helpServiceProxy.nurseryLevelMaxCheck(operationReq);
break;
case "帮助-升级花圃":
result = helpServiceProxy.nurseryLevelUpCheck(operationReq);
break;
case "帮助-花圃重置":
result = helpServiceProxy.nurseryLevelResetCheck(operationReq);
break;
case "帮助-花圃数量":
result = helpServiceProxy.nurseryNumCheck(operationReq);
break;
case "帮助-开启花圃":
result = helpServiceProxy.nurseryReclaimRuleCheck(operationReq);
break;
case "帮助-花圃宠物":
result = helpServiceProxy.nurseryPetRuleCheck(operationReq);
break;
case "帮助-花圃宠物数量":
result = helpServiceProxy.nurseryPetNumRuleCheck(operationReq);
break;
case "帮助-花圃无法升级":
result = helpServiceProxy.nurseryUpgradeFailReasonCheck(operationReq);
break;
case "帮助-花圃无法开启":
result = helpServiceProxy.nurseryReclaimFailReasonCheck(operationReq);
break;
case "帮助-花圃宠物无法放置":
result = helpServiceProxy.nurseryPetFailReasonCheck(operationReq);
break;
case "帮助-如何种植":
result = helpServiceProxy.PlantingRuleCheck(operationReq);
break;
case "帮助-生长阶段":
result = helpServiceProxy.PlantPeriodRuleCheck(operationReq);
break;
case "帮助-收取果实":
result = helpServiceProxy.PlantHarvestRuleCheck(operationReq);
break;
case "帮助-植物成熟时间":
result = helpServiceProxy.PlantMatureTimeRuleCheck(operationReq);
break;
case "帮助-铲除植物":
result = helpServiceProxy.PlantClearRuleCheck(operationReq);
break;
case "帮助-植物详情":
result = helpServiceProxy.PlantInfoRuleCheck(operationReq);
break;
case "帮助-种植条件":
result = helpServiceProxy.PlantConditionCheck(operationReq);
break;
case "帮助-植物对应宠物":
result = helpServiceProxy.PlantAttractPetCheck(operationReq);
break;
}
log.info(operationReq.getUid() + "已完成操作:【" + commonRequest.getVars().get操作名() + "】");
return result;
}
}
package com.qiwuai.garden.dao;
import com.qiwuai.garden.pojo.PlantTypePojo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface PlantTypeMapper {
List<PlantTypePojo> findAll();
}
......@@ -85,6 +85,10 @@ public class GardenerDto implements Cloneable{
*/
private List<HelpReportDto> helpReportList;
/**
* 帮助简报编号
*/
private Integer helpReportNum = 1;
/**
* 今日已偷取的陌生人, Map<陌生人玩家地址,StrangerDto>
*/
private Map<String, StrangerDto> strangerMap;
......@@ -93,6 +97,10 @@ public class GardenerDto implements Cloneable{
*/
private List<StealReportDto> stealReportList;
/**
* 偷菜简报编号
*/
private Integer stealReportNum = 1;
/**
* 好友申请:<玩家地址, AddFriendAskDto>
*/
private Map<String, AddFriendAskDto> addFriendAskMap;
......
package com.qiwuai.garden.dto;
import lombok.Data;
import java.util.List;
@Data
public class PetFightDetailDto {
/**
* 这一轮的回合次数
*/
private Integer round;
/**
* 我方宠物
*/
private Integer pet;
/**
* 对方宠物
*/
private Integer petSide;
/**
* 我方宠物的宠物栏位置
*/
private Integer petPos;
/**
* 对方宠物的宠物栏位置
*/
private Integer petPosSide;
/**
* 我方宠物属性克制对方宠物-2, 相互不克制-1,对方宠物属性克制我方宠物-0
*/
private Integer petRestrain = 1;
/**
* 我方宠物造成的伤害
*/
private Integer petHarm;
/**
* 对方宠物造成的伤害
*/
private Integer petSideHarm;
/**
* 我方宠物剩余生命
*/
private Integer petHp;
/**
* 对方宠物剩余生命
*/
private Integer petSideHp;
/**
* 本轮战斗结果:0-胜利,1-战败,2-平局
*/
private Integer fightResult;
}
......@@ -3,6 +3,7 @@ package com.qiwuai.garden.dto;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class StealReportDto {
......@@ -31,6 +32,22 @@ public class StealReportDto {
*/
private Integer fightResult;
/**
* 我方宠物
*/
private List<Integer> petList;
/**
* 对方宠物
*/
private List<Integer> petSideList;
/**
* 战斗轮次
*/
private Map<Integer, PetFightDetailDto> roundFightMap;
/**
* 宠物战斗结果记录
*/
private String fightResultText;
/**
* 宠物战斗详情
*/
private String fightDetail;
......
......@@ -24,6 +24,10 @@ public class StrangerDto {
*/
private String fightDetail;
/**
* 对方生成的偷菜简报名称,用于获取战斗详情
*/
private String stealReportName;
/**
* 偷菜判断,可偷菜则返回true,否则返回false
*/
public boolean stealAble(){
......
......@@ -49,6 +49,7 @@ public class CallRequest {
/**
* 园丁性别
*/
@JsonProperty(value = "GB_园丁性别")
private String 园丁性别;
/**
* 所属地区
......@@ -115,6 +116,10 @@ public class CallRequest {
*/
private String 简报状态;
/**
* 战斗轮次
*/
private String 战斗轮次;
/**
* 离线时长
*/
private String 离线时长;
......
package com.qiwuai.garden.dto.request;
import com.qiwuai.garden.dto.PetFightDetailDto;
import lombok.Data;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
@Data
public class OperationRequest {
......@@ -125,6 +127,14 @@ public class OperationRequest {
*/
private List<String> strList;
/**
* 上轮对话保存的战斗详情Map
*/
private Map<Integer, PetFightDetailDto> roundFightMap;
/**
* 战斗轮次
*/
private Integer fightRound;
/**
* 顺序的第XX位
*/
private Integer rank;
......
package com.qiwuai.garden.dto.request;
import lombok.Data;
@Data
public class PhraseRequest {
/**
* 作品名称
*/
private String workName;
/**
* 词组名称
*/
private String phraseName;
/**
* 词组内容:"小狗+小猫+小鸟"
*/
private String phraseContent;
}
package com.qiwuai.garden.dto.response;
import lombok.Data;
@Data
public class PhraseResponse {
/**
* 第三方请求返回码
*/
private Integer code;
/**
* 第三方请求返回信息
*/
private String msg;
/**
* 第三方请求返回数据
*/
private String data;
}
......@@ -10,6 +10,7 @@ import com.qiwuai.garden.dto.base.ResultResponse;
import com.qiwuai.garden.dto.base.ResultVarsResponse;
import com.qiwuai.garden.dto.request.OperationRequest;
import com.qiwuai.garden.pojo.ItemPojo;
import com.qiwuai.garden.pojo.ItemTypePojo;
import com.qiwuai.garden.pojo.PlantPojo;
import com.qiwuai.garden.pojo.QuantityRangePojo;
import com.qiwuai.garden.service.backPackService.BackPackService;
......@@ -21,6 +22,7 @@ import org.springframework.util.StringUtils;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Service
public class BackPackServiceImpl implements BackPackService {
......@@ -85,10 +87,15 @@ public class BackPackServiceImpl implements BackPackService {
log.info(uid + "开始根据物品种类查看背包详情");
//园丁性别
String gender = TimingAcquisition.getGardenerGender(uid);
//物品种类
List<String> itemTypeList = TimingAcquisition.itemTypeMap.values().stream().map(ItemTypePojo::getDescription).collect(Collectors.toList());
String itemTypes = String.join("、", itemTypeList);
//玩家没提供物品类型
if (StringUtils.isEmpty(itemTypeId)) {
//获取对应话术
String text = SpeechUtil.getGardenerSpeech(gender, "view_back_pack_item_fail_no_type");
String text = SpeechUtil.getGardenerSpeech(Constants.SPEECH_ASIDE, "view_back_pack_item_fail_no_type");
text = SpeechUtil.speechReplaceNum(text, itemTypes);
text += SpeechUtil.getGardenerSpeech(gender, "view_back_pack_item_fail_no_type");
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(200403);
......@@ -104,6 +111,7 @@ public class BackPackServiceImpl implements BackPackService {
if (!itemTypeIdSet.contains(itemTypeId)) {
//获取对应话术
String text = SpeechUtil.getGardenerSpeech(Constants.SPEECH_ASIDE, "view_back_pack_item_fail_not_exist");
text = SpeechUtil.speechReplaceNum(text, itemTypes);
text += SpeechUtil.getGardenerSpeech(gender, "view_back_pack_item_fail_not_exist");
commonResponse.setCode(1);
commonResponse.setMsg("成功");
......@@ -123,9 +131,8 @@ public class BackPackServiceImpl implements BackPackService {
//种类对应物品为空
if (bag.size() == 0) {
//获取对应话术
String text = SpeechUtil.getGardenerSpeech(Constants.SPEECH_ASIDE, "view_back_pack_item");
text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.itemTypeMap.get(itemTypeId).getDescription(), "0个");
text += SpeechUtil.getGardenerSpeech(gender, "view_back_pack_item");
String text = SpeechUtil.getGardenerSpeech(Constants.SPEECH_ASIDE, "view_back_pack_item_none");
text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.itemTypeMap.get(itemTypeId).getDescription());
commonResponse.setCode(1);
commonResponse.setMsg("成功");
resultResponse.set反馈ID(200402);
......
package com.qiwuai.garden.service.helpService;
import com.qiwuai.garden.dto.base.CommonResponse;
import com.qiwuai.garden.dto.request.OperationRequest;
import java.text.ParseException;
public interface HelpService {
/**
* 打开帮助菜单
* @param operationReq
* @return CommonResponse
*/
CommonResponse openHelpMenu(OperationRequest operationReq);
/**
* 帮助-花圃类型
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryTypeCheck(OperationRequest operationReq);
/**
* 帮助-花圃升级路线
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryTypeGetCheck(OperationRequest operationReq);
/**
* 帮助-花圃详情
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryTypeInfoCheck(OperationRequest operationReq);
/**
* 帮助-花圃详情
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryLevelMaxCheck(OperationRequest operationReq);
/**
* 帮助-升级花圃,查看升级操作方法
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryLevelUpCheck(OperationRequest operationReq);
/**
* 帮助-花圃重置
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryLevelResetCheck(OperationRequest operationReq);
/**
* 帮助-花圃数量
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryNumCheck(OperationRequest operationReq);
/**
* 帮助-开启花圃
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryReclaimRuleCheck(OperationRequest operationReq);
/**
* 帮助-花圃宠物
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryPetRuleCheck(OperationRequest operationReq);
/**
* 帮助-花圃宠物数量
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryPetNumRuleCheck(OperationRequest operationReq);
/**
* 帮助-花圃无法升级
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryUpgradeFailReasonCheck(OperationRequest operationReq);
/**
* 帮助-花圃无法开启
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryReclaimFailReasonCheck(OperationRequest operationReq);
/**
* 帮助-花圃宠物无法放置
* @param operationReq
* @return CommonResponse
*/
CommonResponse nurseryPetFailReasonCheck(OperationRequest operationReq);
/**
* 帮助-如何种植
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantingRuleCheck(OperationRequest operationReq);
/**
* 帮助-如何种植
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantPeriodRuleCheck(OperationRequest operationReq);
/**
* 帮助-如何种植
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantHarvestRuleCheck(OperationRequest operationReq);
/**
* 帮助-植物成熟时间
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantMatureTimeRuleCheck(OperationRequest operationReq);
/**
* 帮助-铲除植物
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantClearRuleCheck(OperationRequest operationReq);
/**
* 帮助-植物详情
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantInfoRuleCheck(OperationRequest operationReq) throws ParseException;
/**
* 帮助-种植条件
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantConditionCheck(OperationRequest operationReq);
/**
* 帮助-植物对应宠物
* @param operationReq
* @return CommonResponse
*/
CommonResponse PlantAttractPetCheck(OperationRequest operationReq);
}
......@@ -348,7 +348,8 @@ public class NurseryServiceImpl implements NurseryService {
gardenerText = SpeechUtil.getPlantSpeech(gender, "nursery_all_fail_no_plant");
resultResponse.set后台附加返回("查看花圃状态回复2");
} else { //花圃中有植物时
//所有花圃未种植时,旁白的回复
//花圃中有植物时,旁白的回复
feedText.deleteCharAt(feedText.length() - 1);
text = feedText.toString();
//花圃中有植物时,园丁的回复
gardenerText = SpeechUtil.getPlantSpeech(gender, "nursery_status");
......
......@@ -163,12 +163,24 @@ public interface SocialService {
*/
CommonResponse checkFightDetail(OperationRequest operationReq);
/**
* 查看战斗详情
* 获取战斗详情
* @param operationReq
* @return CommonResponse
*/
CommonResponse getFightDetail(OperationRequest operationReq);
/**
* 查看战斗轮次
* @param operationReq
* @return CommonResponse
*/
CommonResponse checkFightRound(OperationRequest operationReq);
/**
* 获取战斗轮次
* @param operationReq
* @return CommonResponse
*/
CommonResponse getFightRound(OperationRequest operationReq);
/**
* 删除简报
* @param operationReq
* @return CommonResponse
......
......@@ -59,4 +59,9 @@ speechFilePath: /home/secretGarden/secretGardenSpeech/
configFilePath: /home/secretGarden/config/
messageFilePath: /home/secretGarden/message/
\ No newline at end of file
messageFilePath: /home/secretGarden/message/
reportFilePath: /home/secretGarden/report/
#动态词组更新秘钥
appSecret: nnPGsrbMriXdrRNISQeb
\ No newline at end of file
......@@ -59,4 +59,9 @@ speechFilePath: /home/secretGarden/secretGardenSpeech/
configFilePath: /home/secretGarden/config/
messageFilePath: /home/secretGarden/message/
\ No newline at end of file
messageFilePath: /home/secretGarden/message/
reportFilePath: /home/secretGarden/report/
#动态词组更新秘钥
appSecret: nnPGsrbMriXdrRNISQeb
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiwuai.garden.dao.PlantTypeMapper">
<select id="findAll" resultType="com.qiwuai.garden.pojo.PlantTypePojo">
select
id, description
from
plant_type
</select>
</mapper>
\ No newline at end of file
......@@ -2,7 +2,7 @@
aside:
#进入游戏
enter_game:
- 【旁白@正常】欢迎进入秘密花园。
- 【旁白@正常】欢迎进入追梦花园。
#园丁升级
gardener_level_check:
- 【旁白@正常】园丁目前的等级为【1】级。
......@@ -22,9 +22,17 @@ aside:
learn_skill_check:
- 【旁白@正常】【1】,【2】,确定选择这个技能吗?
learn_skill_success:
- 【旁白@正常】已成功学习。
- 【旁白@正常】已成功学习【1】。
learn_skill_check_fail_no_pre:
- 【旁白@正常】你还没有进行园丁升级或技能重置,请先执行其中一个后再学习技能。
learn_skill_check_fail_no_need:
- 【旁白@正常】你已学习完所有技能。
learn_skill_fail_had:
- 【旁白@正常】已学习过该技能。已为您找到【1】。
learn_skill_fail_no_skill:
- 【旁白@正常】还没提供技能名称,无法学习。目前有【1】。
learn_skill_fail_no_pre:
- 【旁白@正常】你还没有选择技能进行学习。
learn_skill_fail_no_exist:
- 【旁白@正常】不存在该技能。已为您找到【1】。
learn_skill_fail_not_allow:
......@@ -64,8 +72,12 @@ aside:
- 【旁白@正常】目前背包里有物品类共【1】种,拥有【2】,物种丰富,是否要查看特定种类的详情?
view_back_pack_item:
- 【旁白@正常】目前拥有的【1】,一共有【2】。
view_back_pack_item_none:
- 【旁白@正常】目前背包还没有【1】。
view_back_pack_item_fail_no_type:
- 【旁白@正常】你还未提供物品种类,目前有【1】。
view_back_pack_item_fail_not_exist:
- 【旁白@正常】物品种类不存在。
- 【旁白@正常】物品种类不存在,目前有【1】。
#查看货币
view_money:
- 【旁白@正常】目前拥有的【1】数量为【2】。
......
......@@ -449,7 +449,7 @@ woman:
pet_check_by_num_fail_wrong_num:
- 【女园丁@正常】没有这样的花圃呢,换一个试试吧。
pet_check_by_num_fail_no_pet:
- 【女园丁@正常】哎呀,花圃【1】中还没有宠物,主人可以将宠物栏中的宠物放在这个花圃中,或是等待植物成熟后看看有没有宠物被吸引过来吧。
- 【女园丁@正常】哎呀,花圃中还没有宠物,主人可以将宠物栏中的宠物放在这个花圃中,或是等待植物成熟后看看有没有宠物被吸引过来吧。
pet_check_by_num_sure:
- 【女园丁@正常】还行还行,主人继续加油哦。
pet_check_by_num_cancel:
......
......@@ -7,6 +7,8 @@ aside:
- 【旁白@正常】已为你取消在花圃【1】种植【2】。
plant_success:
- 【旁白@正常】我已经按照你的吩咐,在花圃【1】种上了【2】植物。
plant_success_fail_no_pre:
- 【旁白@正常】你还未检查种植条件,请先确定你想种植的植物是否能在指定花圃中种植。
plant_fail_no_nursery:
- 【旁白@正常】你还没有提供花圃编号,无法种植。目前有【1】。
plant_fail_seed_none:
......@@ -20,7 +22,7 @@ aside:
plant_fail_nursery_level:
- 【旁白@正常】花圃种植【1】需要达到等级【2】,目前花圃等级为【3】,种植失败。
plant_fail_nursery_type:
- 【旁白@正常】【1】植物只能种植在【2】花圃上,种植失败。
- 【旁白@正常】【1】植物只能种植在【2】上,种植失败。
plant_fail_material:
- 【旁白@正常】种植【1】植物所需的【2】材料库存为【3】个,需要消耗【4】个才能种植,种植失败。
plant_fail_near_plant:
......@@ -110,7 +112,7 @@ aside:
- 【旁白@正常】花圃【1】的果实已经成熟可以摘取!
- 【旁白@正常】花圃【1】硕果累累,可以摘取了!
nursery_pet:
- 【旁白@正常】【1】来了【2】只神秘的动物。
- 【旁白@正常】,【1】来了【2】只神秘的动物。
nursery_level:
- 【旁白@正常】花圃【1】的等级目前为【2】级,类型为【3】。
nursery_fail_no_nursery:
......
......@@ -69,21 +69,23 @@ aside:
- 【旁白@正常】目前背包仅有【1】【2】,无法前往查看。
#偷菜
steal_success:
- 【旁白@正常】成功在花圃【1】偷取了【2】,需要查看战斗简报吗?
- 【旁白@正常】成功在【1】的花圃【2】偷取了【3】,需要查看战斗简报吗?
steal_success_no_items:
- 【旁白@正常】在花圃【1】没有偷取到东西,需要查看战斗简报吗?
steal_fail_not_exist:
- 【旁白@正常】这里没有这个花圃。
- 【旁白@正常】【1】这里没有这个花圃。
steal_fail_unusable:
- 【旁白@正常】这个花圃还未开启。
steal_fail_fight:
- 【旁白@正常】本次偷菜失败,是否查看战斗简报?
- 【旁白@正常】本次在【1】的花圃【2】偷菜失败,是否查看战斗简报?
steal_fail_no_plant:
- 【旁白@正常】花圃【1】暂时无法进行偷菜。
- 【旁白@正常】【1】的花圃【2】暂时无法进行偷菜。
steal_fail_had:
- 【旁白@正常】这里已经偷取过一次,暂时无法再偷取。
- 【旁白@正常】【1】这里已经偷取过一次,暂时无法再偷取。
steal_fail_no_times:
- 【旁白@正常】今日的偷菜次数已用尽,偷取失败。
steal_fail_no_mature:
- 【旁白@正常】这个花圃的植物尚未成熟,暂时无法偷取。
- 【旁白@正常】花圃【1】的【2】尚未成熟,暂时无法偷取。
steal_fail_self:
- 【旁白@正常】无法在本人的花园偷取。
steal_fail_friend:
......@@ -99,12 +101,12 @@ aside:
steal_random_fail_fight:
- 【旁白@正常】宠物们状态不是很好,对花圃【1】的偷菜失败,要查看战斗简报吗?
steal_random_fail_no_mature:
- 【旁白@正常】这里没有成熟的植物可偷。
- 【旁白@正常】【1】这里没有成熟的植物可偷。
steal_random_fail_no_people:
- 【旁白@正常】【1】不存在。
#帮助好友
help_friend_success:
- 【旁白@正常】成功帮【1】收取花圃【2】的果实,共帮助好友收获【3】。
- 【旁白@正常】成功帮【1】收取花圃【2】的果实,对方作为答谢,你获得了【3】。
help_friend_fail_no_people:
- 【旁白@正常】不存在好友【1】。
help_friend_fail_no_help_times:
......@@ -115,6 +117,8 @@ aside:
- 【旁白@正常】花圃【1】不存在。
help_friend_fail_no_times:
- 【旁白@正常】同一好友每天只能帮忙收取一次。
help_friend_fail_no_friends:
- 【旁白@正常】你目前还没有好友,无法帮助好友。可以先添加好友。
help_fail_address_not_exist:
- 【旁白@正常】不存在玩家【1】,无法帮助好友。
help_cross_cost:
......@@ -223,8 +227,30 @@ aside:
#战斗详情播放
fight_detail_play:
- 【旁白@正常】【1】
fight_detail_check:
- 【旁白@正常】本次战斗我方上阵宠物【1】只,【2】对方上阵宠物【3】只,【4】一共进行了【5】轮次,【6】获得了胜利。
fight_detail_check_fail_no_pre:
- 【旁白@正常】暂时无法查看战斗详情,请先查看偷菜简报。
fight_detail_play_fail_none:
- 【旁白@正常】没有找到该战斗简报。
#获取战斗详情
fight_detail_get_no_address:
- 【旁白@正常】你还未提供对方的玩家地址,目前无法查看战斗简报。
fight_detail_get_no_report:
- 【旁白@正常】无法查看,偷菜后才能接着获取战斗详情。
fight_detail_get_fail_none:
- 【旁白@正常】没有找到该战斗简报,无法查看。
#查看战斗轮次
fight_round_fight_check_no_pre:
- 【旁白@正常】你还没未查看战斗详情,请查看后再查看战斗轮次。
fight_round_fight_check_no_num:
- 【旁白@正常】你还没提供轮次,你可以在轮次1至【1】之间选择一个进行查看。
fight_round_fight_check_wrong_num:
- 【旁白@正常】本场战斗没有这个轮次,你可以在轮次1至【1】之间选择一个进行查看。
fight_round_fight_check_no_num_one:
- 【旁白@正常】你还没提供轮次,目前仅有轮次1,可以选择这个进行查看。
fight_round_fight_check_wrong_num_one:
- 【旁白@正常】本场战斗没有这个轮次,目前仅有轮次1,可以选择这个进行查看。
#停止播报
stop_report:
- 【旁白@正常】好的,要看看其他的简报吗?
......@@ -504,6 +530,8 @@ man:
#战斗详情播放
fight_detail_play:
- 【男园丁@正常】真是一场精彩的战斗,宠物们也在战斗中变得越来越强了呢!
fight_detail_check:
- 【男园丁@正常】可以告诉我想要看第几个轮次,我会告诉你那个轮次的详细情况。
#好友列表查询
all_friend_num_check_none:
- 【男园丁@正常】主人,下次有机会我们先加些好友吧。
......@@ -713,6 +741,8 @@ woman:
#战斗详情播放
fight_detail_play:
- 【女园丁@正常】好精彩的战斗,我感觉我们的宠物也在战斗中成长的越来越厉害了!
fight_detail_check:
- 【女园丁@正常】主人你可以告诉我想看哪轮的战斗,马上为你播报哦。
#好友列表查询
all_friend_num_check_none:
- 【女园丁@正常】主人,那我们先去加好友吧,嘻嘻。
......
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