From d4c7ebca0bcafad3cdb63dd28392eeab63d323b8 Mon Sep 17 00:00:00 2001 From: zhoujunqiang Date: Tue, 3 Jan 2023 09:49:33 +0800 Subject: [PATCH] 1.推理项目第一版 --- pom.xml | 5 +++++ src/main/java/com/qiwu/inference/InferenceApplication.java | 9 ++++++++- src/main/java/com/qiwu/inference/common/InitSysServlet.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/TimingAcquisition.java | 31 +++++++++++++++++++++++++++++-- src/main/java/com/qiwu/inference/common/cache/TaskTipsThread.java | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java | 15 +++++++++++---- src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java | 852 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------- src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java | 8 +++++++- src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java | 718 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- src/main/java/com/qiwu/inference/controller/CommonController.java | 24 +++++++++++++++++++++++- src/main/java/com/qiwu/inference/dao/EndGoalMapper.java | 4 +++- src/main/java/com/qiwu/inference/dto/BarrierTaskKeyDto.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/ClueDto.java | 37 ++++++++++++++++++++++++++++--------- src/main/java/com/qiwu/inference/dto/DemandTaskDto.java | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------- src/main/java/com/qiwu/inference/dto/LocationInfoDto.java | 24 ++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/PersonInfoDto.java | 8 ++++++++ src/main/java/com/qiwu/inference/dto/Player.java | 67 ++++++++++++++++++++++++++++++++++++++++++++++++------------------- src/main/java/com/qiwu/inference/dto/PostTaskDto.java | 17 +++++++++++++++++ src/main/java/com/qiwu/inference/dto/PostTaskRecordDto.java | 27 +++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/dto/TaskStatusDto.java | 15 +++++++++++++++ src/main/java/com/qiwu/inference/pojo/ChatSpeech.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/ClueSpeech.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/EndGoal.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- src/main/java/com/qiwu/inference/pojo/Location.java | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------- src/main/java/com/qiwu/inference/pojo/PersonSpeech.java | 26 ++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/TaskSpeech.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/pojo/TipSpeech.java | 23 +++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java | 10 ---------- src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- src/main/java/com/qiwu/inference/service/chat/ChatService.java | 9 +++++++++ src/main/java/com/qiwu/inference/service/chat/impl/ChatServiceImpl.java | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------- src/main/java/com/qiwu/inference/service/common/CommonService.java | 9 +++++++++ src/main/java/com/qiwu/inference/service/login/LoginService.java | 2 ++ src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java | 2478 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ src/main/resources/application-pro.yml | 35 +++++++++++++++++++++++++++++++++++ src/main/resources/application.yml | 2 +- src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml | 4 ++++ src/main/resources/speech/ask.yaml | 66 ++++++++++++++++++++++++++++++++++++++++-------------------------- src/main/resources/speech/barrier.yaml | 8 +++++--- src/main/resources/speech/check.yaml | 15 ++++++++++++--- src/main/resources/speech/task.yaml | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------- 43 files changed, 4174 insertions(+), 1618 deletions(-) create mode 100644 src/main/java/com/qiwu/inference/common/cache/TaskTipsThread.java create mode 100644 src/main/java/com/qiwu/inference/dto/BarrierTaskKeyDto.java create mode 100644 src/main/java/com/qiwu/inference/dto/LocationInfoDto.java create mode 100644 src/main/java/com/qiwu/inference/dto/PersonInfoDto.java create mode 100644 src/main/java/com/qiwu/inference/dto/PostTaskDto.java create mode 100644 src/main/java/com/qiwu/inference/dto/PostTaskRecordDto.java create mode 100644 src/main/java/com/qiwu/inference/dto/TaskStatusDto.java create mode 100644 src/main/java/com/qiwu/inference/pojo/ChatSpeech.java create mode 100644 src/main/java/com/qiwu/inference/pojo/ClueSpeech.java create mode 100644 src/main/java/com/qiwu/inference/pojo/PersonSpeech.java create mode 100644 src/main/java/com/qiwu/inference/pojo/TaskSpeech.java create mode 100644 src/main/java/com/qiwu/inference/pojo/TipSpeech.java create mode 100644 src/main/java/com/qiwu/inference/service/chat/ChatService.java create mode 100644 src/main/java/com/qiwu/inference/service/chat/impl/ChatServiceImpl.java diff --git a/pom.xml b/pom.xml index 8817018..2bc6cd5 100644 --- a/pom.xml +++ b/pom.xml @@ -117,6 +117,11 @@ hutool-all 5.8.8 + + org.apache.poi + poi-ooxml + 4.1.2 + diff --git a/src/main/java/com/qiwu/inference/InferenceApplication.java b/src/main/java/com/qiwu/inference/InferenceApplication.java index a29e282..9b015a7 100644 --- a/src/main/java/com/qiwu/inference/InferenceApplication.java +++ b/src/main/java/com/qiwu/inference/InferenceApplication.java @@ -1,6 +1,7 @@ package com.qiwu.inference; -import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.cache.ExpireThread; +import com.qiwu.inference.common.cache.TaskTipsThread; import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -10,5 +11,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class InferenceApplication { public static void main(String[] args) { SpringApplication.run(InferenceApplication.class, args); + ExpireThread expireThread = new ExpireThread(); + Thread thread = new Thread(expireThread); + thread.start(); +// TaskTipsThread taskTipsThread = new TaskTipsThread(); +// Thread taskThread = new Thread(taskTipsThread); +// taskThread.start(); } } diff --git a/src/main/java/com/qiwu/inference/common/InitSysServlet.java b/src/main/java/com/qiwu/inference/common/InitSysServlet.java index 204e432..6d1dc71 100644 --- a/src/main/java/com/qiwu/inference/common/InitSysServlet.java +++ b/src/main/java/com/qiwu/inference/common/InitSysServlet.java @@ -3,7 +3,9 @@ package com.qiwu.inference.common; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.qiwu.inference.common.utils.PersistenceUtil; +import com.qiwu.inference.common.utils.SpeechUtil; import com.qiwu.inference.dao.*; +import com.qiwu.inference.dto.BarrierTaskKeyDto; import com.qiwu.inference.dto.Person; import com.qiwu.inference.dto.Player; import com.qiwu.inference.pojo.*; @@ -40,6 +42,8 @@ public class InitSysServlet implements InitializingBean { private DemandTaskMapper demandTaskMapper; @Autowired private DispositionMapper dispositionMapper; + @Autowired + private EndGoalMapper endGoalMapper; /** * 保存配置信息到缓存 @@ -53,6 +57,17 @@ public class InitSysServlet implements InitializingBean { TimingAcquisition.gateInfoMap.putAll(gateInfoMap); log.info("关卡数据缓存完成"); + for (Map.Entry> entry : gateInfoMap.entrySet()) { + String gateNo = entry.getKey(); + //-------------------------缓存关卡攻略数据--------------------- + log.info("开始缓存关卡攻略数据"); + String barrierTaskKey = PersistenceUtil.getConfigFromFile(configFilePath, "results_final_task.json"); + List barrierTaskKeyList = JSON.parseObject(barrierTaskKey, new TypeReference>(){}); + Map> barrierTaskKeyMap = new ConcurrentHashMap<>(); + barrierTaskKeyMap.put(gateNo, barrierTaskKeyList); + TimingAcquisition.barrierTaskKeyMap.putAll(barrierTaskKeyMap); + log.info("关卡攻略数据缓存完成"); + } //--------------------------加载玩家数据---------------------- @@ -79,6 +94,35 @@ public class InitSysServlet implements InitializingBean { //--------------------加载话术----------------- TimingAcquisition.speechLoading(speechFilePath); + //--------------------加载闲聊话术的excel表---------------- + log.info("加载闲聊话术"); + Map> chatSpeechMap = SpeechUtil.getChatSpeechModel(speechFilePath); + TimingAcquisition.chatSpeechMap.putAll(chatSpeechMap); + log.info("闲聊话术加载完成"); + + //--------------------加载线索成功话术的excel表---------------- + log.info("加载线索成功话术"); + Map> clueSpeechMap = SpeechUtil.getClueSpeechModel(speechFilePath); + TimingAcquisition.successClueSpeechMap.putAll(clueSpeechMap); + log.info("线索成功话术加载完成"); + + //--------------------加载任务成功话术的excel表---------------- + log.info("加载任务成功话术"); + Map> taskSpeechMap = SpeechUtil.getTaskSpeechModel(speechFilePath); + TimingAcquisition.successTaskSpeechMap.putAll(taskSpeechMap); + log.info("任务成功话术加载完成"); + + //--------------------加载任务成功话术的excel表---------------- + log.info("加载任务提示话术"); + Map> tipSpeechMap = SpeechUtil.getTipSpeechModel(speechFilePath); + TimingAcquisition.tipSpeechMap.putAll(tipSpeechMap); + log.info("任务提示话术加载完成"); + + //--------------------加载人物见面话术的excel表---------------- + log.info("加载人物见面话术"); + Map> personSpeechMap = SpeechUtil.getPersonSpeechModel(speechFilePath); + TimingAcquisition.personSpeechMap.putAll(personSpeechMap); + log.info("人物见面话术加载完成"); //-----------------缓存场所信息------------------ @@ -134,5 +178,14 @@ public class InitSysServlet implements InitializingBean { } TimingAcquisition.systemConfigMap.putAll(systemConfigMap); log.info("系统配置信息缓存完成"); + + //-----------------缓存结局目标配置信息------------------ + Map endGoalMap = new ConcurrentHashMap<>(); + List endGoalList = endGoalMapper.findAll(); + for (EndGoal endGoal : endGoalList) { + endGoalMap.put(endGoal.getId(), endGoal); + } + TimingAcquisition.endGoalMap.putAll(endGoalMap); + log.info("结局目标配置信息缓存完成"); } } diff --git a/src/main/java/com/qiwu/inference/common/TimingAcquisition.java b/src/main/java/com/qiwu/inference/common/TimingAcquisition.java index 8e669b1..8e15c08 100644 --- a/src/main/java/com/qiwu/inference/common/TimingAcquisition.java +++ b/src/main/java/com/qiwu/inference/common/TimingAcquisition.java @@ -1,13 +1,12 @@ package com.qiwu.inference.common; import com.qiwu.inference.common.utils.PersistenceUtil; -import com.qiwu.inference.common.utils.YamlUtil; +import com.qiwu.inference.dto.BarrierTaskKeyDto; import com.qiwu.inference.dto.Person; import com.qiwu.inference.dto.Player; import com.qiwu.inference.pojo.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; @@ -23,6 +22,10 @@ public class TimingAcquisition { */ public volatile static Map> gateInfoMap = new ConcurrentHashMap<>(); /** + * 关卡攻略信息,Map<关卡编号, List<攻略任务>> + */ + public volatile static Map> barrierTaskKeyMap = new ConcurrentHashMap<>(); + /** * 用户id跟关卡编号对应关系 */ public volatile static Map uidGateNoMap = new ConcurrentHashMap<>(); @@ -55,6 +58,10 @@ public class TimingAcquisition { * 系统配置信息 */ public volatile static Map systemConfigMap = new ConcurrentHashMap<>(); + /** + * 结局目标配置信息 + */ + public volatile static Map endGoalMap = new ConcurrentHashMap<>(); /** * 询问模块话术 @@ -72,6 +79,26 @@ public class TimingAcquisition { * 查看模块话术 */ public volatile static Map>> barrierSpeechMap = new ConcurrentHashMap<>(); + /** + * 闲聊模块话术,Map<意图, List<话术配置>> + */ + public volatile static Map> chatSpeechMap = new ConcurrentHashMap<>(); + /** + * 线索成功话术,Map<线索id, List<话术配置>> + */ + public volatile static Map> successClueSpeechMap = new ConcurrentHashMap<>(); + /** + * 任务成功话术,Map<任务id, List<话术配置>> + */ + public volatile static Map> successTaskSpeechMap = new ConcurrentHashMap<>(); + /** + * 任务提示话术,Map<任务id, List<话术配置>> + */ + public volatile static Map> tipSpeechMap = new ConcurrentHashMap<>(); + /** + * 人物见面话术,Map<人物名称, List<话术配置>> + */ + public volatile static Map> personSpeechMap = new ConcurrentHashMap<>(); /** * 通过yaml文件加载所有话术到缓存中 diff --git a/src/main/java/com/qiwu/inference/common/cache/TaskTipsThread.java b/src/main/java/com/qiwu/inference/common/cache/TaskTipsThread.java new file mode 100644 index 0000000..bfe0b53 --- /dev/null +++ b/src/main/java/com/qiwu/inference/common/cache/TaskTipsThread.java @@ -0,0 +1,68 @@ +package com.qiwu.inference.common.cache; + +import com.qiwu.inference.common.Constants; +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.utils.DateUtil; +import com.qiwu.inference.dto.Player; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 任务提示线程 + */ +@EnableAsync +@Component +public class TaskTipsThread implements Runnable{ + @Override + public void run() { + while (true) { + try { + //每60秒检测一次 + TimeUnit.SECONDS.sleep(60); + checkTaskTips(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + /** + * 检测是否需要任务提示 + */ + public void checkTaskTips() throws ParseException { + Map playerMap = TimingAcquisition.playerMap; + String nowTime = DateUtil.getCurrentTime(); + String tipTime = TimingAcquisition.systemConfigMap.get("tipTime").getValue(); + for (Map.Entry entry : playerMap.entrySet()) { + Player player = entry.getValue(); + //在线玩家 + if (player.getStatus().equals(Constants.ONLINE)) { + //上次提示时间已超过规定时间 + if (DateUtil.subTime(nowTime, player.getNumUpdateTime()) >= Long.parseLong(tipTime)) { + Map> taskMap = player.getTaskMap(); + //该玩家已完成任务个数 + int num = 0; + for (Map.Entry> mapEntry : taskMap.entrySet()) { + num += mapEntry.getValue().size(); + } + //第一次更新,不需要提示。做完了第一个任务之后再去提示 + if (num == 0) { + continue; + } + if (num > player.getFinishedTaskNum()) { + player.setFinishedTaskNum(num); + } else { + //规定时间内没有完成新的任务,需要提示一个攻略 + player.setTipFlag(true); + } + player.setNumUpdateTime(nowTime); + } + } + } + } +} diff --git a/src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java b/src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java index 66fb81f..f37ba3a 100644 --- a/src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/DataTrimUtil.java @@ -34,10 +34,10 @@ public class DataTrimUtil { public static void AdjustStatus(String uid, String offlineTime) throws ParseException { //玩家当前为离线状态 Player player = TimingAcquisition.playerMap.get(uid); - //操作日期为今天之前,需更改为在线状态 + //上次操作时间过期,需更改为在线状态 String nowTime = DateUtil.getCurrentTime(); if (!StringUtils.isEmpty(player.getOnlineTime())) { - if (DateUtil.compare(nowTime, player.getOnlineTime()) == 1) { + if (DateUtil.subTime(nowTime, player.getOnlineTime()) > (Long.parseLong(offlineTime) / 1000)) { //更新玩家在线状态 statusUpdate(uid); } @@ -65,7 +65,7 @@ public class DataTrimUtil { /** * 判断整数尾数是否为1 */ - public static CommonResult AdjustParams(CommonResult result) { + public static CommonResult AdjustParams(String uid, CommonResult result) { if (StringUtils.isEmpty(result)) { return CommonResult.failed("操作失败"); } @@ -88,7 +88,14 @@ public class DataTrimUtil { ", 后台附加返回:" + data.getVars().get后台附加返回() + ", 后台附加返回2:" + data.getVars().get后台附加返回2() + "]"; - //玩家有新消息提示 + //需要给玩家提示任务线索 +// if (TimingAcquisition.playerMap.get(uid).isTipFlag()) { +// String addText = PlayerUtil.getClueFromTaskKey(uid); +// if (!StringUtils.isEmpty(addText)) { +// TimingAcquisition.playerMap.get(uid).setTipFlag(false); +// data.getVars().set反馈文本(data.getVars().get反馈文本() + "【寒烟@正常】" + addText); +// } +// } log.info(feedContent); } return result; diff --git a/src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java b/src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java index 53530e3..00aa571 100644 --- a/src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/PlayerUtil.java @@ -3,13 +3,77 @@ package com.qiwu.inference.common.utils; import com.qiwu.inference.common.Constants; import com.qiwu.inference.common.TimingAcquisition; import com.qiwu.inference.dto.*; +import com.qiwu.inference.pojo.Location; import org.springframework.util.StringUtils; +import java.io.*; import java.util.*; import java.util.concurrent.ConcurrentHashMap; public class PlayerUtil { /** + * 通过角色身份找到对应的人物名称 + * @param name + */ + public static String getName(String uid, String name) { + Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + Person person = entry.getValue(); + //name为身份或人物名称 + if (person.getIdentityName().equals(name) || person.getName().equals(name)) { + return person.getName(); + } + } + return name; + } + + /** + * 查询符合条件的线索 + * @param current + * @param subject + * @param type + * @return + */ + public static List findClues(Person current,Person subject,Integer type){ + List result = new ArrayList<>(); + if(!StringUtils.isEmpty(current)){ + List clueList =current.getClues(); + for (int i= 0;i checkThreshold(Person person, List clueList){ + List result = new ArrayList<>(); + for (int i= 0;i= clue.getTrustDegree()||person.getDeterrenceDegree() >= clue.getThreaten()){ + flag = true; + } + if(flag){ //符合阈值要求 + result.add(clue); + } + } + return result; + } + + /** * 获取玩家关卡中人物所在的所有场所 */ public static List getLocationByUid(String uid) { @@ -42,19 +106,12 @@ public class PlayerUtil { */ public static String getLocations(String uid) { StringBuilder text = new StringBuilder(); - List locationIdList = new ArrayList<>(); - Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); - for (Map.Entry entry : personMap.entrySet()) { - Person person = entry.getValue(); - if (!StringUtils.isEmpty(person.getLocation())) { - if (!locationIdList.contains(person.getLocation())) { - locationIdList.add(person.getLocation()); - } + Map locationMap = TimingAcquisition.playerMap.get(uid).getLocationMap(); + for (Map.Entry entry : locationMap.entrySet()) { + if (!"1".equals(entry.getValue().getIsHidden())) { + text.append(TimingAcquisition.locationMap.get(entry.getKey()).getName()).append("、"); } } - for (String locationId : locationIdList) { - text.append(TimingAcquisition.locationMap.get(locationId).getName()).append("、"); - } if (text.length() != 0) { text.deleteCharAt(text.length() - 1); } @@ -65,11 +122,12 @@ public class PlayerUtil { * 通过场所id找到场所的所有人物 */ public static List getPersonsByLocationId(String uid, String locationId) { - List personIdList = new ArrayList<>(); - Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); - for (Map.Entry entry : personMap.entrySet()) { - if (locationId.equals(entry.getValue().getLocation())) { - personIdList.add(entry.getKey()); + List personIdList = null; + Map locationMap = TimingAcquisition.playerMap.get(uid).getLocationMap(); + if (!StringUtils.isEmpty(locationMap.get(locationId))) { + Map personIdMap = locationMap.get(locationId).getPersonInfoMap(); + if (personIdMap.size() != 0) { + personIdList = new ArrayList<>(personIdMap.keySet()); } } return personIdList; @@ -110,12 +168,16 @@ public class PlayerUtil { /** * 记录玩家已获得线索 */ - public static void recordClue(String uid, Integer personId, Integer clueTypeId, ClueDto clue) { + public static void recordClue(String uid, Integer sourceId, Integer personId, Integer clueTypeId, ClueDto clue) { Map>> clueMap = TimingAcquisition.playerMap.get(uid).getClueMap(); Map> clueListMap = new ConcurrentHashMap<>(); List clueList = new ArrayList<>(); + //线索来源的人物id + List sourceIdList = new ArrayList<>(); + sourceIdList.add(sourceId); //玩家还没有收集此人的线索 if (StringUtils.isEmpty(clueMap.get(personId))) { + clue.setSourceIdList(sourceIdList); clueList.add(clue); clueListMap.put(clueTypeId, clueList); clueMap.put(personId, clueListMap); @@ -123,6 +185,7 @@ public class PlayerUtil { } //玩家还没有收集到此人这类的线索 if (StringUtils.isEmpty(clueMap.get(personId).get(clueTypeId))) { + clue.setSourceIdList(sourceIdList); clueList.add(clue); clueListMap.put(clueTypeId, clueList); clueMap.get(personId).putAll(clueListMap); @@ -132,12 +195,19 @@ public class PlayerUtil { List clues = clueMap.get(personId).get(clueTypeId); boolean have = false; for (ClueDto c : clues) { - if (c.getClueId().equals(clue.getClueId())) { + if (c.getClueId() == clue.getClueId()) { + //找到了同样的线索,则新增来源 + //不为同一个人 + if (!c.getSourceIdList().contains(sourceId)) { + c.getSourceIdList().add(sourceId); + } have = true; + break; } } //没有找到则新增一条线索 if (!have) { + clue.setSourceIdList(sourceIdList); clues.add(clue); } } @@ -182,23 +252,48 @@ public class PlayerUtil { /** * 找到人物对应线索类型,且符合任务目的线索 - * @param uid - * @param personId + * @param current + * @param subject * @param taskTarget 1 信任度提升 2 信任度降低 3 威慑度提升 4 威慑度降低 */ - public static List getCluesByType(String uid, Integer personId, Integer taskTarget) { + public static List getCluesByType(Person current, Person subject, Integer taskTarget) { List result = new ArrayList<>(); - Person person = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId); - if(!StringUtils.isEmpty(person)){ - //找到玩家能达到目的任务 - List demandTaskList = findTasks(person, taskTarget); - //遍历任务,找到对应的任务线索 - for (DemandTaskDto demandTask : demandTaskList) { - Integer clueId = demandTask.getClueId(); - //找到对应线索 - ClueDto clue = getClueById(uid, personId, clueId); - if (!StringUtils.isEmpty(clue)) { - result.add(clue); + List clueList = current.getClues(); + //找到玩家能达到目的任务的线索 + for (ClueDto clue : clueList) { + //线索为任务类型 + if (clue.getSubject() == subject.getId() && clue.getType() == 6) { + //通过线索id找主体对象身上的任务 + DemandTaskDto demandTask = getDemandTaskByClueId(subject, clue.getClueId()); + if (!StringUtils.isEmpty(demandTask)) { + //增加信任值 + if (taskTarget == 1) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree > 0) { + result.add(clue); + } + } + //降低信任值 + if (taskTarget == 2) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree < 0) { + result.add(clue); + } + } + //提升威慑度 + if (taskTarget == 3) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree > 0) { + result.add(clue); + } + } + //降低威慑度 + if (taskTarget == 4) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree < 0) { + result.add(clue); + } + } } } } @@ -212,10 +307,11 @@ public class PlayerUtil { */ public static List getClueByTypeAndTaskId(String uid, Integer personId, String taskId) { List result = new ArrayList<>(); - Person person = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId); - if(!StringUtils.isEmpty(person)){ + Integer currentId = TimingAcquisition.playerMap.get(uid).getPersonId(); + Person current = TimingAcquisition.playerMap.get(uid).getPersonMap().get(currentId); + if(!StringUtils.isEmpty(current)){ //通过任务条件id找到玩家需求任务集合 - List demandTaskList = findDemandsByTaskId(person, taskId); + List demandTaskList = findDemandsByTaskId(current, personId, taskId); for (DemandTaskDto demandTask : demandTaskList) { //找到对应的任务线索 Integer clueId = demandTask.getClueId(); @@ -240,32 +336,34 @@ public class PlayerUtil { if(!StringUtils.isEmpty(person)){ List demandTaskList = person.getDemandTasks(); for (DemandTaskDto demandTask : demandTaskList) { - if (taskTarget == 1) { - if (Objects.equals(demandTask.getSubject(), person.getId())) { - String trustDegree = demandTask.getTrustDegree(); - if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) > 0) { - result.add(demandTask); + if (demandTask.getType() == 6) { + if (taskTarget == 1) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree > 0) { + result.add(demandTask); + } } - } - } else if (taskTarget == 2) { - if (Objects.equals(demandTask.getSubject(), person.getId())) { - String trustDegree = demandTask.getTrustDegree(); - if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) < 0) { - result.add(demandTask); + } else if (taskTarget == 2) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree < 0) { + result.add(demandTask); + } } - } - } else if (taskTarget == 3) { - if (Objects.equals(demandTask.getSubject(), person.getId())) { - String deterrenceDegree = demandTask.getDeterrenceDegree(); - if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) > 0) { - result.add(demandTask); + } else if (taskTarget == 3) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree > 0) { + result.add(demandTask); + } } - } - } else if (taskTarget == 4) { - if (Objects.equals(demandTask.getSubject(), person.getId())) { - String deterrenceDegree = demandTask.getDeterrenceDegree(); - if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) < 0) { - result.add(demandTask); + } else if (taskTarget == 4) { + if (Objects.equals(demandTask.getSubject(), person.getId())) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree < 0) { + result.add(demandTask); + } } } } @@ -277,14 +375,22 @@ public class PlayerUtil { /** * 通过任务条件id找到对应的需求任务id */ - public static List findDemandsByTaskId(Person person, String taskId) { + public static List findDemandsByTaskId(Person person, Integer personId, String taskConditionId) { List result = new ArrayList<>(); List demandTaskList = person.getDemandTasks(); for (DemandTaskDto demandTask : demandTaskList) { String condition1 = demandTask.getCondition1(); String[] taskIdTimes = condition1.split("\\|"); - if (taskId.equals(taskIdTimes[0])) { - result.add(demandTask); + if (taskConditionId.equals(taskIdTimes[0]) && demandTask.getType() == 6) { + if (demandTask.getObject() != 0) { + if (personId == demandTask.getObject()) { + result.add(demandTask); + } + } else { + if (personId == demandTask.getSubject()) { + result.add(demandTask); + } + } } } return result; @@ -292,6 +398,24 @@ public class PlayerUtil { /** * 通过线索id找到对应线索 + * @param current + * @param clueId + */ + public static ClueDto getClueById(Person current, Integer clueId) { + List clueList = current.getClues(); + for (ClueDto clue : clueList) { + if (clueId.equals(clue.getClueId())) { + return clue; + } + } + return null; + } + + /** + * 通过线索id找到对应线索 + * @param uid + * @param personId + * @param clueId */ public static ClueDto getClueById(String uid, Integer personId, Integer clueId) { List clueList = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getClues(); @@ -317,6 +441,100 @@ public class PlayerUtil { } /** + * 查询符合条件的任务 + * @param demandTaskList + * @param clue + * @return + */ + private static DemandTaskDto findTasks(List demandTaskList, ClueDto clue) { + DemandTaskDto result = null; + for (DemandTaskDto demandTask : demandTaskList) { + if (Objects.equals(demandTask.getClueId(), clue.getClueId()) && Objects.equals(demandTask.getType(), clue.getType())) { + result = demandTask; + break; + } + } + if (!StringUtils.isEmpty(result)) { + for (DemandTaskDto demandTask:demandTaskList) { + if (demandTask.getDemandTaskId() == result.getDemandTaskId() && demandTask.getType() == 6 && result.getSubject() == demandTask.getSubject()) { + return demandTask; + } + } + } + return null; + } + + /** + * 通过任务id找到对应的任务 + */ + public static DemandTaskDto getDemandTaskById(String uid, Integer personId, Integer taskId) { + List demandTaskList = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getDemandTasks(); + for (DemandTaskDto demandTask:demandTaskList) { + if (demandTask.getDemandTaskId() == taskId && demandTask.getType() == 6 && demandTask.getSubject() == personId) { + return demandTask; + } + } + return null; + } + + /** + * 根据线索找到对应任务,判断任务是否需要解锁,需要则改为解锁状态 + */ + public static void unlockTask(String uid, Person person, ClueDto clue) { + List demandTaskList = person.getDemandTasks(); + String postTaskId = null; + //本人身上该任务解锁 + for (DemandTaskDto demandTask : demandTaskList) { + if (demandTask.getClueId() == clue.getClueId() && demandTask.getType() == clue.getType()) { + //需解锁任务 + if (demandTask.getClueSwitch() == 1) { + demandTask.setClueSwitch(2); + postTaskId = demandTask.getPostTask(); + for (DemandTaskDto task : demandTaskList) { + if (task.getDemandTaskId() == demandTask.getDemandTaskId()) { + task.setClueSwitch(2); + } + } + } + } + } + if (!StringUtils.isEmpty(postTaskId)) { + //线索对应人物解锁 + int objectId = clue.getSubject(); + if (person.getId() == clue.getSubject()) { + objectId = clue.getObject(); + } + List demandTaskObjectList = TimingAcquisition.playerMap.get(uid).getPersonMap().get(objectId).getDemandTasks(); + //客体身上该任务解锁 + for (DemandTaskDto demandTask : demandTaskObjectList) { + if (demandTask.getDemandTaskId() == Integer.parseInt(postTaskId)) { + //需解锁任务 + if (demandTask.getClueSwitch() == 1) { + demandTask.setClueSwitch(2); + } + } + } + } + } + + /** + * 根据线索找到对应任务,判断任务是否需要解锁,需要则改为解锁状态 + */ + public static void unlockTask(String uid, ClueDto clue) { + Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + Person person = entry.getValue(); + DemandTaskDto demandTask = getDemandTaskByClueId(person, clue.getClueId()); + if (!StringUtils.isEmpty(demandTask)) { + //需解锁任务 + if (demandTask.getClueSwitch() == 1) { + demandTask.setClueSwitch(2); + } + } + } + } + + /** * 判断线索是否符合阈值需求 * @param uid * @param clueList @@ -339,42 +557,40 @@ public class PlayerUtil { /** * 查找任务目的为对应类型线索 - * @param uid - * @param personId + * @param person * @param clueList * @param taskTarget 1 信任度提升 2 信任度降低 3 威慑度提升 4 威慑度降低 */ - public static List getCluesIsType(String uid, Integer personId, List clueList, Integer taskTarget) { + public static List getCluesIsType(Person person, List clueList, Integer taskTarget) { List result = new ArrayList<>(); - Person person = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId); for (ClueDto clue : clueList) { DemandTaskDto demandTask = getDemandTaskByClueId(person, clue.getClueId()); if (!StringUtils.isEmpty(demandTask)) { if (taskTarget == 1) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String trustDegree = demandTask.getTrustDegree(); - if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) > 0) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree > 0) { result.add(clue); } } } else if (taskTarget == 2) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String trustDegree = demandTask.getTrustDegree(); - if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) < 0) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree < 0) { result.add(clue); } } } else if (taskTarget == 3) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String deterrenceDegree = demandTask.getDeterrenceDegree(); - if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) > 0) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree > 0) { result.add(clue); } } } else if (taskTarget == 4) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String deterrenceDegree = demandTask.getDeterrenceDegree(); - if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) < 0) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree < 0) { result.add(clue); } } @@ -415,22 +631,22 @@ public class PlayerUtil { * @param demandTask */ public static void addThreshold(Person subject, DemandTaskDto demandTask) { - if(!StringUtils.isEmpty(demandTask.getTrustDegree())) { - if(subject.getTrustDegree() < 100) { - if((subject.getTrustDegree() + Integer.parseInt(demandTask.getTrustDegree()) ) > 100) { + if(demandTask.getTrustDegree() != 0) { + if(subject.getTrustDegree() <= 100) { + if((subject.getTrustDegree() + demandTask.getTrustDegree() ) > 100) { subject.setTrustDegree(100); } else { - subject.setTrustDegree(subject.getTrustDegree() + Integer.parseInt(demandTask.getTrustDegree())); + subject.setTrustDegree(Math.max((subject.getTrustDegree() + demandTask.getTrustDegree()), 0)); } } } - if(!StringUtils.isEmpty(demandTask.getDeterrenceDegree())) { - if(subject.getDeterrenceDegree() < 100) { - if((subject.getDeterrenceDegree() + Integer.parseInt(demandTask.getDeterrenceDegree())) > 100){ + if(demandTask.getDeterrenceDegree() != 0) { + if(subject.getDeterrenceDegree() <= 100) { + if((subject.getDeterrenceDegree() + demandTask.getDeterrenceDegree()) > 100){ subject.setDeterrenceDegree(100); } else { - subject.setDeterrenceDegree(subject.getDeterrenceDegree() + Integer.parseInt(demandTask.getDeterrenceDegree())); + subject.setDeterrenceDegree(Math.max((subject.getDeterrenceDegree() + demandTask.getDeterrenceDegree()), 0)); } } } @@ -462,4 +678,478 @@ public class PlayerUtil { player.setCurrency(0.0); player.setPoint(0); } + + /** + * 判断数组A是否为数组B的子集 + */ + public static boolean checkSubset(List listA, List listB) { + for (Integer a : listA) { + if (!listB.contains(a)) { + return false; + } + } + return true; + } + + /** + * 生成场所表 + */ + public static Map makeLocationMap(Map> locationPersonMap) { + Map locationInfoMap = new HashMap<>(); + Map locationMap = TimingAcquisition.locationMap; + //遍历所有场所,找到所有已知和必现场所 + for (Map.Entry entry : locationMap.entrySet()) { + LocationInfoDto locationInfo = new LocationInfoDto(); + String locationId = entry.getKey(); + List personIdList = locationPersonMap.get(locationId); + //该场所已有玩家 + if (!StringUtils.isEmpty(personIdList)) { + Map personInfoMap = new HashMap<>(); + for (Integer personId : personIdList) { + personInfoMap.put(personId, 0); + } + String isHidden = entry.getValue().getIsHidden(); + locationInfo.setIsHidden(isHidden); + locationInfo.setPersonInfoMap(personInfoMap); + locationInfoMap.put(entry.getKey(), locationInfo); + } else { + //该场所为必现场所 + if ("1".equals(entry.getValue().getIsAppear())) { + String isHidden = entry.getValue().getIsHidden(); + locationInfo.setIsHidden(isHidden); + locationInfoMap.put(entry.getKey(), locationInfo); + } + } + } + return locationInfoMap; + } + + /** + * 判断玩家是否获得了对应人物的场所线索 + * @param clueMap + * @param personId + */ + public static boolean checkLocationClue(Map>> clueMap, Integer personId) { + Map> personClueMap = clueMap.get(personId); + //有这个人的线索 + if (!StringUtils.isEmpty(personClueMap)) { + List clueList = personClueMap.get(2); + //有这个人场所线索 + return !StringUtils.isEmpty(clueList); + } + return false; + } + + /** + * 解锁场所 + * @param locationMap + * @param locationId + */ + public static void unlockLocation(Map locationMap, String locationId) { + //场所未解锁 + String isHidden = locationMap.get(locationId).getIsHidden(); + if ("1".equals(isHidden)) { + locationMap.get(locationId).setIsHidden("1"); + } + } + + /** + * 查找有前置任务的任务 + */ + public static List getDemandTaskHavePre(String uid, List personIdList) { + List postTaskStatusList = new ArrayList<>(); + //所有人物 + Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); + //遍历所有人物 + for (Integer personId : personIdList) { + //该人物身上挂的任务 + List demandTasks = personMap.get(personId).getDemandTasks(); + PostTaskDto postTask = new PostTaskDto(); + postTask.setPersonId(personId); + Map taskStatusMap = new HashMap<>(); + //判断任务是否有前置任务 + for (DemandTaskDto demandTask : demandTasks) { + //该任务有前置任务,则为后置任务 + if (!StringUtils.isEmpty(demandTask.getPostTask())) { + //判断后置任务是否已经完成 + int flag = checkTaskStatus(uid, personId, demandTask.getDemandTaskId()); + //未完成 + if (flag == 0) { + TaskStatusDto taskStatus = new TaskStatusDto(); + //判断前置任务是否已经完成 + Integer postTaskId = Integer.valueOf(demandTask.getPostTask()); + int finished = checkTaskStatus(uid, demandTask.getObject(), postTaskId); + taskStatus.setTaskId(postTaskId); + taskStatus.setStatus(finished); + taskStatusMap.put(demandTask.getDemandTaskId(), taskStatus); + } + } + } + if (taskStatusMap.size() != 0) { + postTask.setTaskStatusMap(taskStatusMap); + postTaskStatusList.add(postTask); + } + } + return postTaskStatusList; + } + + /** + * 查找单个人有前置任务的任务 + */ + public static List getDemandTaskHavePre(String uid, Integer personId) { + List postTaskStatusList = new ArrayList<>(); + //该人物身上挂的任务 + List demandTasks = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getDemandTasks(); + PostTaskDto postTask = new PostTaskDto(); + postTask.setPersonId(personId); + Map taskStatusMap = new HashMap<>(); + //判断任务是否有前置任务 + for (DemandTaskDto demandTask : demandTasks) { + //该任务有前置任务,则为后置任务 + if (!StringUtils.isEmpty(demandTask.getPostTask())) { + //判断后置任务是否已经完成 + int flag = checkTaskStatus(uid, personId, demandTask.getDemandTaskId()); + //未完成 + if (flag == 0) { + TaskStatusDto taskStatus = new TaskStatusDto(); + //判断前置任务是否已经完成 + Integer postTaskId = Integer.valueOf(demandTask.getPostTask()); + int finished = checkTaskStatus(uid, demandTask.getObject(), postTaskId); + taskStatus.setTaskId(postTaskId); + taskStatus.setStatus(finished); + taskStatusMap.put(demandTask.getDemandTaskId(), taskStatus); + } + } + } + if (taskStatusMap.size() != 0) { + postTask.setTaskStatusMap(taskStatusMap); + postTaskStatusList.add(postTask); + } + return postTaskStatusList; + } + + /** + * 判断任务是否已经完成,0-未完成,1-已完成 + */ + public static int checkTaskStatus(String uid, Integer personId, Integer taskId) { + Map taskStatusMap = TimingAcquisition.playerMap.get(uid).getTaskMap().get(personId); + if (!StringUtils.isEmpty(taskStatusMap.get(taskId))) { + return 1; + } + return 0; + } + + /** + * 后置任务的提示按优先级查找 + */ + public static PostTaskRecordDto getPostTask(String uid, List postTaskList) { + PostTaskRecordDto postTaskRecord = new PostTaskRecordDto(); + List postTaskRecordList = new ArrayList<>(); + //遍历每个人 + for (PostTaskDto postTask : postTaskList) { + Map taskStatusMap = postTask.getTaskStatusMap(); + for (Map.Entry entry : taskStatusMap.entrySet()) { + Integer postTaskId = entry.getKey(); + TaskStatusDto taskStatus = entry.getValue(); + DemandTaskDto demandTask = getDemandTaskInfo(uid, postTask.getPersonId(), postTaskId); + //有前置任务已完成 + if (taskStatus.getStatus() == 1) { + if (!StringUtils.isEmpty(demandTask)) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + //任务条件为“70043” + if ("70043".equals(condition1[0])) { + postTaskRecord.setPersonId(postTask.getPersonId()); + postTaskRecord.setPostTaskId(postTaskId); + postTaskRecord.setPreTaskId(taskStatus.getTaskId()); + postTaskRecord.setStatus(taskStatus.getStatus()); + boolean flag = checkTaskSelf(uid, postTask.getPersonId(), demandTask.getClueId()); + if (flag) { + postTaskRecord.setLevel(1); //前置任务已完成且是自己发布 + } else { + postTaskRecord.setLevel(2); //前置任务已完成且不是自己发布 + } + return postTaskRecord; + } + } + } + //前置任务为本人发布 + if (!StringUtils.isEmpty(demandTask)) { + boolean flag = checkTaskSelf(uid, postTask.getPersonId(), demandTask.getClueId()); + if (flag) { + PostTaskRecordDto postTaskRecordCopy = new PostTaskRecordDto(); + postTaskRecordCopy.setPersonId(postTask.getPersonId()); + postTaskRecordCopy.setPostTaskId(postTaskId); + postTaskRecordCopy.setPreTaskId(taskStatus.getTaskId()); + postTaskRecordCopy.setStatus(taskStatus.getStatus()); + postTaskRecordCopy.setLevel(3); //任务为本人发布 + postTaskRecordList.add(postTaskRecordCopy); + } + } + } + } + if (postTaskRecordList.size() != 0) { + return postTaskRecordList.get(0); + } + return null; + } + + /** + * 通过人物的任务id找到任务信息 + * @param uid + * @param personId + * @param taskId + */ + public static DemandTaskDto getDemandTaskInfo(String uid, Integer personId, Integer taskId) { + List demandTasks = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getDemandTasks(); + for (DemandTaskDto demandTask : demandTasks) { + if (demandTask.getDemandTaskId() == taskId) { + return demandTask; + } + } + return null; + } + + /** + * 验证任务是否为本人发布 + * @param uid + * @param personId + * @param clueId + */ + public static boolean checkTaskSelf(String uid, Integer personId, Integer clueId) { + Map>> clueMap = TimingAcquisition.playerMap.get(uid).getClueMap(); + //有收集到线索 + if (clueMap.size() != 0) { + //有收集到这个人的线索 + Map> clueTypeMap = clueMap.get(personId); + if (!StringUtils.isEmpty(clueTypeMap)) { + for (Map.Entry> entry : clueTypeMap.entrySet()) { + List clueList = entry.getValue(); + for (ClueDto clue : clueList) { + if (clue.getClueId() == clueId && clue.getSourceIdList().contains(personId)) { + return true; + } + } + } + } + } + return false; + } + + /** + * 根据玩家任务进度,给玩家提供建议 + * @param uid + */ + public static String getClueFromTaskKey(String uid) { + String gateNo = TimingAcquisition.playerMap.get(uid).getGateNo(); + //攻略任务 + List barrierTaskKeyList = TimingAcquisition.barrierTaskKeyMap.get(gateNo); + //玩家已完成的任务 + Map> taskMap = TimingAcquisition.playerMap.get(uid).getTaskMap(); + for (BarrierTaskKeyDto barrierTaskKey : barrierTaskKeyList) { + Map taskStatusMap = taskMap.get(barrierTaskKey.getSubject()); + //有完成的任务 + if (!StringUtils.isEmpty(taskStatusMap)) { + //该任务已经完成,查找下一个 + if (StringUtils.isEmpty(taskStatusMap.get(barrierTaskKey.getDemandTaskId()))) { + Integer clueId = barrierTaskKey.getClueId(); + Integer subjectId = barrierTaskKey.getSubject(); + ClueDto clue = getClueById(uid, subjectId, clueId); + if (!StringUtils.isEmpty(clue)) { + return clue.getClueTemplate() + "这条线索可能对你比较重要。"; + } + } + } + } + return null; + } + + /** + * 找到白名单内该人的任务中已解锁或无需解锁的任务对应的提示 + */ + public static String getTipInChat(String uid, Person person) { + List demandTaskList = person.getDemandTasks(); + Player player = TimingAcquisition.playerMap.get(uid); + String gateNo = player.getGateNo(); + //攻略任务(白名单) + List barrierTaskKeyList = TimingAcquisition.barrierTaskKeyMap.get(gateNo); + int count = 0; //统计已完成次数 + //信任值 + Integer trustDegree = person.getTrustDegree(); + //威慑度 + Integer deterrenceDegree = person.getDeterrenceDegree(); + String text = ""; + for (DemandTaskDto demandTask : demandTaskList) { + //判断这个任务是否在白名单内 + for (BarrierTaskKeyDto barrierTaskKey : barrierTaskKeyList) { + //任务在白名单中 + if (barrierTaskKey.getId().equals(demandTask.getId())) { + //该任务已解锁或无需解锁 + if (demandTask.getClueSwitch() != 1) { + //任务是否已经完成 + int taskStatus = checkTaskStatus(uid, person.getId(), demandTask.getDemandTaskId()); + //未完成 + if (taskStatus == 0) { + if (trustDegree >= demandTask.getTrustStart() || deterrenceDegree >= demandTask.getDeterrenceStart()) { + return SpeechUtil.getTipSpeech(uid, demandTask, 0, 1); + } + } + } else { //任务需要解锁,找到能解锁任务的线索 + //能解锁任务的线索在哪个人身上 + List personIdList = getPersonIdByClueId(uid, demandTask.getClueId(), demandTask.getSubject()); + //线索挂在NPC本人身上 + if (personIdList.contains(person.getId())) { + ClueDto clue = getClueById(uid, person.getId(), demandTask.getClueId()); + if (!StringUtils.isEmpty(clue)) { + if (trustDegree >= clue.getTrustDegree() || deterrenceDegree >= clue.getThreaten()) { + return SpeechUtil.getTipSpeech(uid, demandTask, 0, 2); + } + } + } + } + count++; + } + } + } + //该NPC身上有其他人的线索且在白名单 + List clueList = person.getClues(); + for (BarrierTaskKeyDto barrierTaskKey : barrierTaskKeyList) { + List clueIdList = getClueByTaskId(player.getPersonMap().get(barrierTaskKey.getSubject()), barrierTaskKey.getDemandTaskId()); + for (ClueDto clue : clueList) { + if (clueIdList.contains(clue.getClueId()) && clue.getSubject() == barrierTaskKey.getSubject()) { + //任务是否已经完成 +// int taskStatus = checkTaskStatus(uid, barrierTaskKey.getSubject(), barrierTaskKey.getDemandTaskId()); + //任务是否已经解锁 + DemandTaskDto demandTask = getDemandTaskInfo(uid, barrierTaskKey.getSubject(), barrierTaskKey.getDemandTaskId()); + //未解锁 + if (!StringUtils.isEmpty(demandTask)) { + //未完成 + if (demandTask.getClueSwitch() == 1) { + if (trustDegree >= clue.getTrustDegree() || deterrenceDegree >= clue.getThreaten()) { + //----------------记录线索-------------- + recordClue(uid, person.getId(), barrierTaskKey.getSubject(), clue.getType(), clue); + return SpeechUtil.getTipSpeech(uid, barrierTaskKey, person.getId()); + } + } + } + count++; + } + } + } + if (count > 0) { + return "我们走吧,这人暂时问不出更重要的消息了,去先找别人问问吧。"; + } + return "算了吧,估计这个人问不出什么东西来。去问问其他人吧。"; + } + + /** + * 通过线索id找到挂线索的人物 + */ + public static List getPersonIdByClueId(String uid, Integer clueId, Integer subjectId) { + List personIdList = new ArrayList<>(); + Map personMap = TimingAcquisition.playerMap.get(uid).getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + Person person = entry.getValue(); + List clueList = person.getClues(); + for (ClueDto clue : clueList) { + if (clueId.equals(clue.getClueId()) && subjectId.equals(clue.getSubject())) { + if (!personIdList.contains(entry.getKey())) { + personIdList.add(entry.getKey()); + } + } + } + } + return personIdList; + } + + /** + * 找到NPC身上的某个任务对应的所有线索 + */ + public static List getClueByTaskId(Person person, Integer demandTaskId) { + List clueIdList = new ArrayList<>(); + List demandTaskList = person.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (demandTask.getDemandTaskId() == demandTaskId && demandTask.getSubject() == person.getId()) { + clueIdList.add(demandTask.getClueId()); + } + } + return clueIdList; + } + + /** + * 判断该人物是否是第一次见面 + * @param uid + * @param locationId + * @param personId + */ + public static boolean isFirstMeet(String uid, String locationId, Integer personId) { + Map personInfoMap = TimingAcquisition.playerMap.get(uid).getLocationMap().get(locationId).getPersonInfoMap(); + int times = personInfoMap.get(personId); + return times == 0; + } + + /** + * 更新玩家跟人物的见面次数 + */ + public static void updateMeetTimes(String uid, String locationId, Integer personId) { + Map personInfoMap = TimingAcquisition.playerMap.get(uid).getLocationMap().get(locationId).getPersonInfoMap(); + int times = personInfoMap.get(personId) + 1; + personInfoMap.put(personId, times); + } + + /** + * 扣除玩家的货币 + */ + public static void updateMoneyNum(String uid, int num) { + int money = TimingAcquisition.playerMap.get(uid).getCurrency().intValue(); + if (money > num) { + TimingAcquisition.playerMap.get(uid).setCurrency((double) (money - num)); + } else { + TimingAcquisition.playerMap.get(uid).setCurrency((double) (0)); + } + } + + /** + * 增加玩家的货币 + */ + public static void addMoneyNum(String uid, int num) { + int money = TimingAcquisition.playerMap.get(uid).getCurrency().intValue(); + TimingAcquisition.playerMap.get(uid).setCurrency((double) (money + num)); + } + + /** + * 深拷贝list + */ + public static List deepCopyList(List src) + { + List dest = null; + try { + ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(byteOut); + out.writeObject(src); + ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray()); + ObjectInputStream in = new ObjectInputStream(byteIn); + dest = (List) in.readObject(); + } catch (ClassNotFoundException | IOException e) { + e.printStackTrace(); + } + return dest; + } + + /** + * 过滤到已经完成任务对应的线索 + */ + public static List getUndoClueList(String uid, Person person, List clueList) { + List result = new ArrayList<>(); + for (ClueDto clue : clueList) { + DemandTaskDto demandTask = getDemandTaskByClueId(person, clue.getClueId()); + if (!StringUtils.isEmpty(demandTask)) { + int taskStatus = checkTaskStatus(uid, person.getId(), demandTask.getDemandTaskId()); + if (taskStatus == 1) { + continue; + } + } + result.add(clue); + } + return result; + } } diff --git a/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java b/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java index 1d1b63a..72bc67a 100644 --- a/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/RequestConversionUtil.java @@ -33,6 +33,8 @@ public class RequestConversionUtil { String[] name = subjectName.split("\\+"); subjectName = name[0]; } + //通过身份找到对应人物名称 + subjectName = PlayerUtil.getName(commonRequest.getUid(), subjectName); operationRequest.setSubjectName(subjectName); Integer subjectId = TimingAcquisition.getPersonIdByName(commonRequest.getUid(), subjectName); operationRequest.setSubjectId(subjectId); @@ -52,7 +54,11 @@ public class RequestConversionUtil { objectName = objectName.replace(subjectName, ""); objectName = objectName.replace("+", ""); } - operationRequest.setObjectName(objectName); + if (!objectName.equals(subjectName)) { + //通过身份找到对应人物名称 + objectName = PlayerUtil.getName(commonRequest.getUid(), objectName); + operationRequest.setObjectName(objectName); + } } //---------------------存在"性格类型"----------------------- String dispositionType = callRequest.get性格类型(); diff --git a/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java b/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java index 5c08642..12759dc 100644 --- a/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java +++ b/src/main/java/com/qiwu/inference/common/utils/SpeechUtil.java @@ -1,10 +1,16 @@ package com.qiwu.inference.common.utils; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; import com.qiwu.inference.common.TimingAcquisition; -import com.qiwu.inference.pojo.DemandTask; +import com.qiwu.inference.dto.*; +import com.qiwu.inference.pojo.*; +import org.springframework.util.StringUtils; -import java.util.List; -import java.util.Random; +import java.io.File; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; public class SpeechUtil { /** @@ -254,4 +260,710 @@ public class SpeechUtil { public static String replaceHeader(String text, String name) { return text.replaceAll("【人物名称", "【" + name); } + + /** + * 添加人物名称 + * @param text + * @return String + */ + public static String addHeader(String text, String name) { + text = "【" + name + "@正常】" + text; + return text; + } + + /** + * 加载闲聊话术 + */ + public static Map> getChatSpeechModel(String speechFilePath) { + String chatPath = speechFilePath + "chat.xlsx"; + ExcelReader reader = ExcelUtil.getReader(new File(chatPath)); + reader.addHeaderAlias("意图反馈", "methodId"); + reader.addHeaderAlias("身份", "identity"); + reader.addHeaderAlias("人物ID", "personId"); + reader.addHeaderAlias("性别", "gender"); + reader.addHeaderAlias("年龄段", "age"); + reader.addHeaderAlias("性格A", "dispositionIds"); + reader.addHeaderAlias("行为", "behaviour"); + reader.addHeaderAlias("任务状态", "taskStatus"); + reader.addHeaderAlias("关系", "degree"); + reader.addHeaderAlias("文本内容", "answer"); + reader.addHeaderAlias("通用标签", "flag"); + List chatList = reader.readAll(ChatSpeech.class); + reader.close(); + Map> chatSpeechMap = new ConcurrentHashMap<>(); + for (ChatSpeech chat : chatList) { + if (StringUtils.isEmpty(chatSpeechMap.get(chat.getMethodId()))) { + List chats = new ArrayList<>(); + chats.add(chat); + chatSpeechMap.put(chat.getMethodId(), chats); + } else { + chatSpeechMap.get(chat.getMethodId()).add(chat); + } + } + return chatSpeechMap; + } + + /** + * 加载线索成功的话术 + */ + public static Map> getClueSpeechModel(String speechFilePath) { + String clueSpeechPath = speechFilePath + "clue_success.xlsx"; + ExcelReader reader = ExcelUtil.getReader(new File(clueSpeechPath)); + reader.addHeaderAlias("线索ID", "clueId"); + reader.addHeaderAlias("任务名称", "taskName"); + reader.addHeaderAlias("身份1", "identity"); + reader.addHeaderAlias("性别", "gender"); + reader.addHeaderAlias("人物ID", "personId"); + reader.addHeaderAlias("年龄段", "age"); + reader.addHeaderAlias("性格A", "dispositionIds"); + reader.addHeaderAlias("行为", "behaviour"); + reader.addHeaderAlias("任务状态", "status"); + reader.addHeaderAlias("线索文本", "answer"); + reader.addHeaderAlias("自身线索文本", "answerSelf"); + reader.addHeaderAlias("通用标签", "flag"); + List clueSpeechList = reader.readAll(ClueSpeech.class); + reader.close(); + Map> clueSpeechMap = new ConcurrentHashMap<>(); + for (ClueSpeech clueSpeech : clueSpeechList) { + if (StringUtils.isEmpty(clueSpeechMap.get(clueSpeech.getClueId()))) { + List clueSpeeches = new ArrayList<>(); + clueSpeeches.add(clueSpeech); + clueSpeechMap.put(clueSpeech.getClueId(), clueSpeeches); + } else { + clueSpeechMap.get(clueSpeech.getClueId()).add(clueSpeech); + } + } + return clueSpeechMap; + } + + /** + * 加载任务成功的话术 + */ + public static Map> getTaskSpeechModel(String speechFilePath) { + String taskSpeechPath = speechFilePath + "task_success.xlsx"; + ExcelReader reader = ExcelUtil.getReader(new File(taskSpeechPath)); + reader.addHeaderAlias("线索ID", "demandTaskId"); + reader.addHeaderAlias("任务名称", "taskName"); + reader.addHeaderAlias("身份1", "identity"); + reader.addHeaderAlias("性别", "gender"); + reader.addHeaderAlias("人物ID", "personId"); + reader.addHeaderAlias("年龄段", "age"); + reader.addHeaderAlias("性格A", "dispositionIds"); + reader.addHeaderAlias("行为", "behaviour"); + reader.addHeaderAlias("任务状态", "status"); + reader.addHeaderAlias("进行中任务询问", "doingAsk"); + reader.addHeaderAlias("进行中任务完成提醒", "doingFinishedAnswer"); + reader.addHeaderAlias("未进行中任务完成提醒", "noDoingFinishedAnswer"); + reader.addHeaderAlias("完成对话文本", "answer"); + reader.addHeaderAlias("通用标签", "flag"); + List taskSpeechList = reader.readAll(TaskSpeech.class); + reader.close(); + Map> taskSpeechMap = new ConcurrentHashMap<>(); + for (TaskSpeech taskSpeech : taskSpeechList) { + if (StringUtils.isEmpty(taskSpeechMap.get(taskSpeech.getDemandTaskId()))) { + List taskSpeeches = new ArrayList<>(); + taskSpeeches.add(taskSpeech); + taskSpeechMap.put(taskSpeech.getDemandTaskId(), taskSpeeches); + } else { + taskSpeechMap.get(taskSpeech.getDemandTaskId()).add(taskSpeech); + } + } + return taskSpeechMap; + } + + /** + * 加载人物见面成功的话术 + */ + public static Map> getPersonSpeechModel(String speechFilePath) { + String personSpeechPath = speechFilePath + "person.xlsx"; + ExcelReader reader = ExcelUtil.getReader(new File(personSpeechPath)); + reader.addHeaderAlias("ID", "personId"); + reader.addHeaderAlias("人物名称", "name"); + reader.addHeaderAlias("人物描述", "description"); + reader.addHeaderAlias("首次回复", "firstAnswer"); + reader.addHeaderAlias("回复", "answer"); + List personSpeechList = reader.readAll(PersonSpeech.class); + reader.close(); + Map> personSpeechMap = new ConcurrentHashMap<>(); + for (PersonSpeech personSpeech : personSpeechList) { + if (StringUtils.isEmpty(personSpeechMap.get(personSpeech.getName()))) { + List personSpeeches = new ArrayList<>(); + personSpeeches.add(personSpeech); + personSpeechMap.put(personSpeech.getName(), personSpeeches); + } else { + personSpeechMap.get(personSpeech.getName()).add(personSpeech); + } + } + return personSpeechMap; + } + + /** + * 加载任务提示的话术 + */ + public static Map> getTipSpeechModel(String speechFilePath) { + String tipSpeechPath = speechFilePath + "tip.xlsx"; + ExcelReader reader = ExcelUtil.getReader(new File(tipSpeechPath)); + reader.addHeaderAlias("ID", "demandTaskId"); + reader.addHeaderAlias("关于自身线索的指引", "selfClue"); + reader.addHeaderAlias("关于他人线索的指引", "otherClue"); + reader.addHeaderAlias("关于任务的指引", "taskClue"); + List tipSpeechList = reader.readAll(TipSpeech.class); + reader.close(); + Map> tipSpeechMap = new ConcurrentHashMap<>(); + for (TipSpeech tipSpeech : tipSpeechList) { + if (StringUtils.isEmpty(tipSpeechMap.get(tipSpeech.getDemandTaskId()))) { + List tipSpeeches = new ArrayList<>(); + tipSpeeches.add(tipSpeech); + tipSpeechMap.put(tipSpeech.getDemandTaskId(), tipSpeeches); + } else { + tipSpeechMap.get(tipSpeech.getDemandTaskId()).add(tipSpeech); + } + } + return tipSpeechMap; + } + + /** + * 获取闲聊的话术 + * @param uid + * @param person + * @param methodId + */ + public static String getChatSpeech(String uid, Person person, String methodId) { + String text = ""; + Map countMap = new HashMap<>(); + List chatList = TimingAcquisition.chatSpeechMap.get(Integer.valueOf(methodId)); + String gender = person.getGender() == 1 ? "男" : "女"; + boolean flag = false; //有条件标记 + int num = 0; + for (int i = 0; i < chatList.size(); i++) { + ChatSpeech chatSpeech = chatList.get(i); + if (StringUtils.isEmpty(chatSpeech.getIdentity()) && StringUtils.isEmpty(chatSpeech.getGender()) + && StringUtils.isEmpty(chatSpeech.getAge()) && StringUtils.isEmpty(chatSpeech.getDispositionIds())) { + flag = true; + num = i; + continue; + } + int count = 0; + //符合身份 + if (!StringUtils.isEmpty(chatSpeech.getIdentity())) { + if (person.getIdentityName().equals(chatSpeech.getIdentity())) { + count++; + } else { + continue; + } + } + //符合性别 + if (!StringUtils.isEmpty(chatSpeech.getGender())) { + if (gender.equals(chatSpeech.getGender())) { + count++; + } else { + continue; + } + } + //符合年龄 + if (!StringUtils.isEmpty(chatSpeech.getAge())) { + String[] ageRange = chatSpeech.getAge().split("\\|"); + if(NumberUtil.inNumRange(person.getAge(),"["+ageRange[0]+","+ageRange[1]+"]")) { + count++; + } else { + continue; + } + } + //符合性格 + if (!StringUtils.isEmpty(chatSpeech.getDispositionIds())) { + String[] dispositionIds = chatSpeech.getDispositionIds().split("\\|"); + //话术的性格要求 + List dispositionIdList = Arrays.stream(dispositionIds).map(Integer::new).collect(Collectors.toList()); + //对话人的性格要求 + List dispositionPerson = person.getDispositions().stream().map(DispositionDto::getDispositionId).collect(Collectors.toList()); + //所有性格都符合 + if (PlayerUtil.checkSubset(dispositionIdList, dispositionPerson)) { + count++; + } else { + continue; + } + } + countMap.put(i, count); + } + int max = 0; + int index = 0; + //找到命中次数最多的索引 + for (Map.Entry entry : countMap.entrySet()) { + if (entry.getValue() > max) { + max = entry.getValue(); + index = entry.getKey(); + } + } + if (max == 0) { + //有配置但是没有找到对应的话术 + if (!flag) { + //没有对应话术时,采用笼统的回复 + List normalChatList = TimingAcquisition.chatSpeechMap.get(9002); + for (ChatSpeech speech : normalChatList) { + //符合身份 + if (!StringUtils.isEmpty(speech.getIdentity())) { + if (person.getIdentityName().equals(speech.getIdentity())) { + //获取对应话术 + text = speech.getAnswer(); + break; + } + } + } + } else { //通用的话术 + //获取对应话术 + text = chatList.get(num).getAnswer(); + } + } else { + //获取对应话术 + text = chatList.get(index).getAnswer(); + } + return text; + } + + + /** + * 获取线索成功的话术 + * @param uid + * @param person + * @param clue + */ + public static String getSuccessClueSpeech(String uid, Person person, ClueDto clue) { + String text = ""; + Map countMap = new HashMap<>(); + Map> successClueSpeechMap = TimingAcquisition.successClueSpeechMap; + List clueSpeechList = successClueSpeechMap.get(clue.getClueId()); + String gender = person.getGender() == 1 ? "男" : "女"; + for (int i = 1; i < clueSpeechList.size(); i++) { + ClueSpeech clueSpeech = clueSpeechList.get(i); + int count = 0; + //符合身份 + if (!StringUtils.isEmpty(clueSpeech.getIdentity())) { + if (person.getIdentityName().equals(clueSpeech.getIdentity())) { + count++; + } else { + continue; + } + } + //符合性别 + if (!StringUtils.isEmpty(clueSpeech.getGender())) { + if (gender.equals(clueSpeech.getGender())) { + count++; + } else { + continue; + } + } + //符合年龄 + if (!StringUtils.isEmpty(clueSpeech.getAge())) { + String[] ageRange = clueSpeech.getAge().split("\\|"); + if(NumberUtil.inNumRange(person.getAge(),"["+ageRange[0]+","+ageRange[1]+"]")) { + count++; + } else { + continue; + } + } + //符合性格 + if (!StringUtils.isEmpty(clueSpeech.getDispositionIds())) { + String[] dispositionIds = clueSpeech.getDispositionIds().split("\\|"); + //话术的性格要求 + List dispositionIdList = Arrays.stream(dispositionIds).map(Integer::new).collect(Collectors.toList()); + //对话人的性格要求 + List dispositionPerson = person.getDispositions().stream().map(DispositionDto::getDispositionId).collect(Collectors.toList()); + //所有性格都符合 + if (PlayerUtil.checkSubset(dispositionIdList, dispositionPerson)) { + count++; + } else { + continue; + } + } + countMap.put(i, count); + } + int max = 0; + int index = 0; + //找到命中次数最多的索引 + for (Map.Entry entry : countMap.entrySet()) { + if (entry.getValue() > max) { + max = entry.getValue(); + index = entry.getKey(); + } + } + if (max == 0) { + //获取对应话术 + if (!person.getId().equals(clue.getSubject())) { + text = clueSpeechList.get(0).getAnswer(); + } else { + text = clueSpeechList.get(0).getAnswerSelf(); + } + } else { + //获取对应话术 + if (!person.getId().equals(clue.getSubject())) { + text = clueSpeechList.get(index).getAnswer(); + } else { + text = clueSpeechList.get(index).getAnswerSelf(); + } + } + //话术中配置数据替换 + if (text.contains("【A】")) { + text = text.replace("【A】", TimingAcquisition.getNameByPersonId(uid, clue.getSubject())); + } + if (text.contains("【B】")) { + text = text.replace("【B】", TimingAcquisition.getNameByPersonId(uid, clue.getObject())); + } + if (text.contains("【第三人称】")) { + String call = (TimingAcquisition.playerMap.get(uid).getPersonMap().get(clue.getSubject()).getGender() == 1) ? "他" : "她"; + text = text.replace("【第三人称】", call); + } + if (text.contains("A")) { + text = text.replace("A", TimingAcquisition.getNameByPersonId(uid, clue.getSubject())); + } + if (text.contains("B")) { + text = text.replace("B", TimingAcquisition.getNameByPersonId(uid, clue.getObject())); + } + return text; + } + + /** + * 获取任务成功的话术 + * @param uid + * @param person + * @param demandTask + */ + public static String getSuccessTaskSpeech(String uid, Person person, DemandTaskDto demandTask) { + String text = ""; + Map countMap = new HashMap<>(); + Map> successTaskSpeechMap = TimingAcquisition.successTaskSpeechMap; + List taskSpeechList = successTaskSpeechMap.get(demandTask.getDemandTaskId()); + String gender = person.getGender() == 1 ? "男" : "女"; + for (int i = 1; i < taskSpeechList.size(); i++) { + TaskSpeech taskSpeech = taskSpeechList.get(i); + int count = 0; + //符合身份 + if (!StringUtils.isEmpty(taskSpeech.getIdentity())) { + if (person.getIdentityName().equals(taskSpeech.getIdentity())) { + count++; + } else { + continue; + } + } + //符合性别 + if (!StringUtils.isEmpty(taskSpeech.getGender())) { + if (gender.equals(taskSpeech.getGender())) { + count++; + } else { + continue; + } + } + //符合年龄 + if (!StringUtils.isEmpty(taskSpeech.getAge())) { + String[] ageRange = taskSpeech.getAge().split("\\|"); + if(NumberUtil.inNumRange(person.getAge(),"["+ageRange[0]+","+ageRange[1]+"]")) { + count++; + } else { + continue; + } + } + //符合性格 + if (!StringUtils.isEmpty(taskSpeech.getDispositionIds())) { + String[] dispositionIds = taskSpeech.getDispositionIds().split("\\|"); + //话术的性格要求 + List dispositionIdList = Arrays.stream(dispositionIds).map(Integer::new).collect(Collectors.toList()); + //对话人的性格要求 + List dispositionPerson = person.getDispositions().stream().map(DispositionDto::getDispositionId).collect(Collectors.toList()); + //所有性格都符合 + if (PlayerUtil.checkSubset(dispositionIdList, dispositionPerson)) { + count++; + } else { + continue; + } + } + countMap.put(i, count); + } + int max = 0; + int index = 0; + //找到命中次数最多的索引 + for (Map.Entry entry : countMap.entrySet()) { + if (entry.getValue() > max) { + max = entry.getValue(); + index = entry.getKey(); + } + } + if (max == 0) { + //获取对应话术 + text = taskSpeechList.get(0).getAnswer(); + } else { + //获取对应话术 + text = taskSpeechList.get(index).getAnswer(); + } + //话术中配置数据替换 + if (text.contains("【A】")) { + text = text.replace("【A】", TimingAcquisition.getNameByPersonId(uid, demandTask.getSubject())); + } + if (text.contains("【B】")) { + text = text.replace("【B】", TimingAcquisition.getNameByPersonId(uid, demandTask.getObject())); + } + if (text.contains("【第三人称】")) { + String call = (TimingAcquisition.playerMap.get(uid).getPersonMap().get(demandTask.getSubject()).getGender() == 1) ? "他" : "她"; + text = text.replace("【第三人称】", call); + } + if (text.contains("【条件2】")) { + if (!StringUtils.isEmpty(demandTask.getCondition2())) { + text = text.replace("【条件2】", demandTask.getCondition2()); + } + } + if (text.contains("【奖励】")) { + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + if (!"0".equals(demandTask.getCompletionReward())) { + PlayerUtil.addMoneyNum(uid, Integer.parseInt(demandTask.getCompletionReward())); + text = text.replace("【奖励】", demandTask.getCompletionReward()); + } + } + } + if (text.contains("A")) { + text = text.replace("A", TimingAcquisition.getNameByPersonId(uid, demandTask.getSubject())); + } + if (text.contains("B")) { + text = text.replace("B", TimingAcquisition.getNameByPersonId(uid, demandTask.getObject())); + } + //补充信任值和威慑度增减的回复 + String addText = "【旁白@正常】【1】对你的信任达到【2】,对你的畏惧达到【3】。"; + addText = speechReplaceNum(addText, person.getName(), String.valueOf(person.getTrustDegree()), String.valueOf(person.getDeterrenceDegree())); +// if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { +// if (!"0".equals(demandTask.getCompletionReward())) { +// addText += "你获得" + demandTask.getCompletionReward() + "文酬劳。"; +// } +// } + text += addText; + text = text.replace("\n", ""); + return text; + } + + /** + * 获取前后置任务成功的话术 + * @param uid + * @param person + * @param demandTask + */ + public static String getPreSuccessTaskSpeech(String uid, Person person, DemandTaskDto demandTask, int level) { + String text = ""; + Map countMap = new HashMap<>(); + Map> successTaskSpeechMap = TimingAcquisition.successTaskSpeechMap; + List taskSpeechList = successTaskSpeechMap.get(demandTask.getDemandTaskId()); + String gender = person.getGender() == 1 ? "男" : "女"; + for (int i = 1; i < taskSpeechList.size(); i++) { + TaskSpeech taskSpeech = taskSpeechList.get(i); + int count = 0; + //符合身份 + if (!StringUtils.isEmpty(taskSpeech.getIdentity())) { + if (person.getIdentityName().equals(taskSpeech.getIdentity())) { + count++; + } else { + continue; + } + } + //符合性别 + if (!StringUtils.isEmpty(taskSpeech.getGender())) { + if (gender.equals(taskSpeech.getGender())) { + count++; + } else { + continue; + } + } + //符合年龄 + if (!StringUtils.isEmpty(taskSpeech.getAge())) { + String[] ageRange = taskSpeech.getAge().split("\\|"); + if(NumberUtil.inNumRange(person.getAge(),"["+ageRange[0]+","+ageRange[1]+"]")) { + count++; + } else { + continue; + } + } + //符合性格 + if (!StringUtils.isEmpty(taskSpeech.getDispositionIds())) { + String[] dispositionIds = taskSpeech.getDispositionIds().split("\\|"); + //话术的性格要求 + List dispositionIdList = Arrays.stream(dispositionIds).map(Integer::new).collect(Collectors.toList()); + //对话人的性格要求 + List dispositionPerson = person.getDispositions().stream().map(DispositionDto::getDispositionId).collect(Collectors.toList()); + //所有性格都符合 + if (PlayerUtil.checkSubset(dispositionIdList, dispositionPerson)) { + count++; + } else { + continue; + } + } + countMap.put(i, count); + } + int max = 0; + int index = 0; + //找到命中次数最多的索引 + for (Map.Entry entry : countMap.entrySet()) { + if (entry.getValue() > max) { + max = entry.getValue(); + index = entry.getKey(); + } + } + String addText = ""; + if (max == 0) { + //获取对应话术 + if (level == 1) { + text = taskSpeechList.get(0).getDoingFinishedAnswer(); + text += taskSpeechList.get(0).getAnswer(); + } + if (level == 2) { + text = taskSpeechList.get(0).getNoDoingFinishedAnswer(); + text += taskSpeechList.get(0).getAnswer(); + } + if (level == 3) { + text = taskSpeechList.get(0).getDoingAsk(); + } + } else { + //获取对应话术 + if (level == 1) { + text = taskSpeechList.get(index).getDoingFinishedAnswer(); + text += taskSpeechList.get(index).getAnswer(); + //补充信任值和威慑度增减的回复 + addText = "【旁白@正常】【1】对你的信任达到【2】,对你的畏惧达到【3】。"; + addText = speechReplaceNum(addText, person.getName(), String.valueOf(person.getTrustDegree()), String.valueOf(person.getDeterrenceDegree())); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + if (!"0".equals(demandTask.getCompletionReward())) { + addText += "你获得" + demandTask.getCompletionReward() + "文酬劳。"; + } + } + } + if (level == 2) { + text = taskSpeechList.get(index).getNoDoingFinishedAnswer(); + text += taskSpeechList.get(index).getAnswer(); + //补充信任值和威慑度增减的回复 + addText = "【旁白@正常】【1】对你的信任达到【2】,对你的畏惧达到【3】。"; + addText = speechReplaceNum(addText, person.getName(), String.valueOf(person.getTrustDegree()), String.valueOf(person.getDeterrenceDegree())); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + if (!"0".equals(demandTask.getCompletionReward())) { + addText += "你获得" + demandTask.getCompletionReward() + "文酬劳。"; + } + } + } + if (level == 3) { + text = taskSpeechList.get(index).getDoingAsk(); + } + } + text = addHeader(text, person.getName()); + //话术中配置数据替换 + if (text.contains("【A】")) { + text = text.replace("【A】", TimingAcquisition.getNameByPersonId(uid, demandTask.getSubject())); + } + if (text.contains("【B】")) { + text = text.replace("【B】", TimingAcquisition.getNameByPersonId(uid, demandTask.getObject())); + } + if (text.contains("【第三人称】")) { + String call = (TimingAcquisition.playerMap.get(uid).getPersonMap().get(demandTask.getSubject()).getGender() == 1) ? "他" : "她"; + text = text.replace("【第三人称】", call); + } + if (text.contains("【条件2】")) { + if (!StringUtils.isEmpty(demandTask.getCondition2())) { + text = text.replace("【条件2】", demandTask.getCondition2()); + } + } + if (text.contains("【奖励】")) { + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + if (!"0".equals(demandTask.getCompletionReward())) { + PlayerUtil.addMoneyNum(uid, Integer.parseInt(demandTask.getCompletionReward())); + text = text.replace("【奖励】", demandTask.getCompletionReward()); + } + } + } + if (text.contains("A")) { + text = text.replace("A", TimingAcquisition.getNameByPersonId(uid, demandTask.getSubject())); + } + if (text.contains("B")) { + text = text.replace("B", TimingAcquisition.getNameByPersonId(uid, demandTask.getObject())); + } + text += addText; + text = text.replace("\n", ""); + return text; + } + + /** + * 获取自身任务线索提示的话术 + * @param uid + * @param demandTask + * @param personId + * @param source + */ + public static String getTipSpeech(String uid, DemandTaskDto demandTask, Integer personId, int source) { + String text = ""; + Map> tipSpeechMap = TimingAcquisition.tipSpeechMap; + List tipSpeechList = tipSpeechMap.get(demandTask.getDemandTaskId()); + //当前能做的任务线索 + if (source == 1) { + //获取对应话术 + text = tipSpeechList.get(0).getTaskClue(); + } + //自身能解锁任务的线索 + if (source == 2) { + //获取对应话术 + text = tipSpeechList.get(0).getSelfClue(); + } + //他人能解锁任务的线索 + if (source == 3) { + //获取对应话术 + text = tipSpeechList.get(0).getOtherClue(); + } + //话术中配置数据替换 + if (text.contains("【A】")) { + text = text.replace("【A】", TimingAcquisition.getNameByPersonId(uid, demandTask.getSubject())); + } + if (text.contains("【B】")) { + text = text.replace("【B】", TimingAcquisition.getNameByPersonId(uid, demandTask.getObject())); + } + if (personId != 0) { + if (text.contains("【C】")) { + text = text.replace("【C】", TimingAcquisition.getNameByPersonId(uid, personId)); + } + } + text = text.replace("\n", ""); + return text; + } + + /** + * 获取他人线索提示的话术 + * @param uid + * @param barrierTaskKey + * @param personId + */ + public static String getTipSpeech(String uid, BarrierTaskKeyDto barrierTaskKey, Integer personId) { + String text = ""; + Map> tipSpeechMap = TimingAcquisition.tipSpeechMap; + List tipSpeechList = tipSpeechMap.get(barrierTaskKey.getDemandTaskId()); + //他人能解锁任务的线索 + //获取对应话术 + text = tipSpeechList.get(0).getOtherClue(); + //话术中配置数据替换 + if (text.contains("【A】")) { + text = text.replace("【A】", TimingAcquisition.getNameByPersonId(uid, personId)); + } + if (personId != 0) { + if (text.contains("【C】")) { + text = text.replace("【C】", TimingAcquisition.getNameByPersonId(uid, barrierTaskKey.getSubject())); + } + } + text = text.replace("\n", ""); + return text; + } + + /** + * 获取人物见面时的话术 + */ + public static String getPersonSpeech(String uid, String locationId, Integer personId) { + String text = ""; + String name = TimingAcquisition.playerMap.get(uid).getPersonMap().get(personId).getName(); + //判断该人物是否是第一次见面 + boolean isFirstMeet = PlayerUtil.isFirstMeet(uid, locationId, personId); + if (isFirstMeet) { + String asideText = "【旁白@正常】" + TimingAcquisition.personSpeechMap.get(name).get(0).getDescription(); + String personText = "【人物名称@正常】" + TimingAcquisition.personSpeechMap.get(name).get(0).getFirstAnswer(); + text = asideText + personText; + } else { + text = "【人物名称@正常】" + TimingAcquisition.personSpeechMap.get(name).get(0).getAnswer(); + } + return text; + } } diff --git a/src/main/java/com/qiwu/inference/controller/CommonController.java b/src/main/java/com/qiwu/inference/controller/CommonController.java index bac25e8..1cca389 100644 --- a/src/main/java/com/qiwu/inference/controller/CommonController.java +++ b/src/main/java/com/qiwu/inference/controller/CommonController.java @@ -11,6 +11,7 @@ import com.qiwu.inference.dto.response.ResultResponse; import com.qiwu.inference.dto.response.ResultVarsResponse; import com.qiwu.inference.service.ask.AskService; import com.qiwu.inference.service.barrier.BarrierService; +import com.qiwu.inference.service.chat.ChatService; import com.qiwu.inference.service.check.CheckService; import com.qiwu.inference.service.login.LoginService; import com.qiwu.inference.service.task.TaskService; @@ -49,6 +50,9 @@ public class CommonController { @Autowired private BarrierService barrierService; + @Autowired + private ChatService chatService; + @PostMapping(value = "/ask", produces = "application/json;charset=UTF-8") public CommonResult startGame(@RequestBody CommonRequest commonRequest) throws ParseException { log.info(commonRequest.getUid() + "当前操作的原始请求参数:" + commonRequest.getVars()); @@ -78,7 +82,22 @@ public class CommonController { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //统计玩家闲聊次数 + if ("闲聊".equals(operateName)) { + int chatTimes = TimingAcquisition.playerMap.get(uid).getChatTimes(); + int times = Integer.parseInt(TimingAcquisition.systemConfigMap.get("chatTimes").getValue()); + if (chatTimes > times) { + TimingAcquisition.playerMap.get(uid).setChatTimes(0); + } else { + TimingAcquisition.playerMap.get(uid).setChatTimes(TimingAcquisition.playerMap.get(uid).getChatTimes() + 1); + } + } else { + TimingAcquisition.playerMap.get(uid).setChatTimes(0); + } switch (operateName) { + case "开始游戏": + result = loginService.startGame(operationReq); + break; case "询问操作": result = askService.ask(operationReq); break; @@ -94,8 +113,11 @@ public class CommonController { case "取消操作指令": result = barrierService.cancel(operationReq); break; + case "闲聊": + result = chatService.operate(operationReq); + break; } log.info(uid + "已完成操作:【" + operateName + "】"); - return DataTrimUtil.AdjustParams(result); + return DataTrimUtil.AdjustParams(uid, result); } } diff --git a/src/main/java/com/qiwu/inference/dao/EndGoalMapper.java b/src/main/java/com/qiwu/inference/dao/EndGoalMapper.java index dd6bd3d..94ca505 100755 --- a/src/main/java/com/qiwu/inference/dao/EndGoalMapper.java +++ b/src/main/java/com/qiwu/inference/dao/EndGoalMapper.java @@ -5,6 +5,8 @@ import com.qiwu.inference.pojo.EndGoal; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; +import java.util.List; + /** *

* Mapper 接口 @@ -16,5 +18,5 @@ import org.springframework.stereotype.Repository; @Mapper @Repository public interface EndGoalMapper extends BaseMapper { - + List findAll(); } diff --git a/src/main/java/com/qiwu/inference/dto/BarrierTaskKeyDto.java b/src/main/java/com/qiwu/inference/dto/BarrierTaskKeyDto.java new file mode 100644 index 0000000..3524176 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/BarrierTaskKeyDto.java @@ -0,0 +1,39 @@ +package com.qiwu.inference.dto; + +import lombok.Data; + +@Data +public class BarrierTaskKeyDto { + /** + * id唯一标识 + */ + private Integer id; + /** + * 需求任务id + */ + private Integer demandTaskId; + /** + * 任务主体 + */ + private Integer subject; + /** + * 任务客体 + */ + private Integer object; + /** + * 线索id + */ + private Integer clueId; + /** + * 线索类型 + */ + private Integer type; + /** + * 任务标签 + */ + private Integer taskLabel; + /** + * 后置任务 + */ + private String postTask; +} diff --git a/src/main/java/com/qiwu/inference/dto/ClueDto.java b/src/main/java/com/qiwu/inference/dto/ClueDto.java index e2f1309..2c68351 100755 --- a/src/main/java/com/qiwu/inference/dto/ClueDto.java +++ b/src/main/java/com/qiwu/inference/dto/ClueDto.java @@ -4,6 +4,8 @@ import lombok.Getter; import lombok.Setter; import java.io.Serializable; +import java.util.List; +import java.util.Objects; @Getter @@ -15,11 +17,11 @@ public class ClueDto implements Serializable { /** * id */ - private Integer id; + private int id; /** * 线索id */ - private Integer clueId; + private int clueId; /** * 线索名称 @@ -28,11 +30,11 @@ public class ClueDto implements Serializable { /** * 主体 */ - private Integer subject; + private int subject; /** * 客体 */ - private Integer object; + private int object; /** * 描述 */ @@ -40,15 +42,15 @@ public class ClueDto implements Serializable { /** * 类型: 1:身份 2:场所 3:性格爱好 4:行为 5:关系 6:任务 9: 关键线索 */ - private Integer type; + private int type; /** * 信息级别 */ - private Integer infoLevel; + private int infoLevel; /** * 关联人物 */ - private Integer associatedPerson; + private int associatedPerson; /** * 线索模板 */ @@ -57,12 +59,29 @@ public class ClueDto implements Serializable { /** * 信任度 */ - private Integer trustDegree; + private int trustDegree=100; /** * 威胁 */ - private Integer threaten; + private int threaten=100; + /** + * 线索来源 + */ + private List sourceIdList; + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ClueDto clue = (ClueDto) o; + return id == clue.id && clueId == clue.clueId && subject == clue.subject && clueName.equals(clue.clueName); + } + @Override + public int hashCode() { + return Objects.hash(id, clueId, clueName, subject); + } } diff --git a/src/main/java/com/qiwu/inference/dto/DemandTaskDto.java b/src/main/java/com/qiwu/inference/dto/DemandTaskDto.java index 641ed36..2bd785a 100755 --- a/src/main/java/com/qiwu/inference/dto/DemandTaskDto.java +++ b/src/main/java/com/qiwu/inference/dto/DemandTaskDto.java @@ -1,9 +1,11 @@ package com.qiwu.inference.dto; +import com.qiwu.inference.pojo.DemandTask; import lombok.Getter; import lombok.Setter; import java.io.Serializable; +import java.util.Objects; @Getter @@ -14,12 +16,12 @@ public class DemandTaskDto implements Serializable { /** * id */ - private Integer id; + private int id; /** * demandTaskId */ - private Integer demandTaskId; + private int demandTaskId; /** * 名称 @@ -34,22 +36,44 @@ public class DemandTaskDto implements Serializable { /** * 主体 */ - private Integer subject; + private int subject; /** * 客体 */ - private Integer object; + private int object; + + + /** + * 开启条件信任度的开始 + */ + private int trustStart=100; + + /** + * 开启条件信任度的结束 + */ + private int trustEnd=100; + + + /** + * 开启条件威胁度的开始 + */ + private int deterrenceStart=100; + + /** + * 开启条件威胁度的结束 + */ + private int deterrenceEnd=100; /** - * 开启条件信任度 + * 后置任务 */ - private String trustCondition; + private String postTask; /** - * 开启条件威慑度 + * 线索开关 0 代表不需要线索就可执行,1 代表需要线索才能执行此任务 2 代表任务已解锁(操作添加,非ai) */ - private String deterrenceCondition; + private int clueSwitch; /** * 条件1|次数 @@ -64,12 +88,12 @@ public class DemandTaskDto implements Serializable { /** * 信任度增减 */ - private String trustDegree; + private int trustDegree; /** * 威慑度增减 */ - private String deterrenceDegree; + private int deterrenceDegree; /** * 完成奖励 @@ -82,29 +106,40 @@ public class DemandTaskDto implements Serializable { /** * 有效次数 */ - private String effectiveDegree; - /** - * 后置任务 - */ - private String postTask; + private int effectiveDegree; /** * 类型: 1:身份 2:场所 3:性格爱好 4:行为 5:关系 6:任务 9:关键线索 */ - private Integer type; + private int type; /** * 线索id */ - private Integer clueId; + private int clueId; /** * 信息级别 */ - private Integer infoLevel; + private int infoLevel; /** * 任务标签 1普通任务 2关键任务 3目标任 */ - private Integer taskLabel; + private int taskLabel; + + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DemandTaskDto that = (DemandTaskDto) o; + return id == that.id && demandTaskId == that.demandTaskId && subject == that.subject && type == that.type && clueId == that.clueId && name.equals(that.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, demandTaskId, name, subject, type, clueId); + } } diff --git a/src/main/java/com/qiwu/inference/dto/LocationInfoDto.java b/src/main/java/com/qiwu/inference/dto/LocationInfoDto.java new file mode 100644 index 0000000..bdc9656 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/LocationInfoDto.java @@ -0,0 +1,24 @@ +package com.qiwu.inference.dto; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Data +public class LocationInfoDto { + /** + * 场所隐藏状态 + */ + private String isHidden; + /** + * 该场所的所有人物id + */ +// List personIdList = new ArrayList<>(); + /** + * 该场所的所有人物id和见面次数 + */ + Map personInfoMap = new HashMap<>(); +} diff --git a/src/main/java/com/qiwu/inference/dto/PersonInfoDto.java b/src/main/java/com/qiwu/inference/dto/PersonInfoDto.java new file mode 100644 index 0000000..84d569f --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/PersonInfoDto.java @@ -0,0 +1,8 @@ +package com.qiwu.inference.dto; + +import lombok.Data; + +@Data +public class PersonInfoDto { + +} diff --git a/src/main/java/com/qiwu/inference/dto/Player.java b/src/main/java/com/qiwu/inference/dto/Player.java index 758a6f8..211e196 100755 --- a/src/main/java/com/qiwu/inference/dto/Player.java +++ b/src/main/java/com/qiwu/inference/dto/Player.java @@ -37,9 +37,9 @@ public class Player { */ private String total; /** - * 当前关卡已完成次数 + * 当前关卡完成状态:0-未完成,1-已完成 */ - private String finished; + private int finished = 0; /** * 玩家在线状态 */ @@ -63,16 +63,16 @@ public class Player { /** * 人物集合 */ - private Map personMap; + private Map personMap = new HashMap<>(); /** * 人物的姓名和编号转换 map */ - private Map name2IdMap; + private Map name2IdMap = new HashMap<>(); /** * 当前关卡的货币 */ - private Double currency = 1000.0; + private Double currency = 3000.0; /** * 当前关卡的积分 */ @@ -93,6 +93,11 @@ public class Player { private Map>> clueMap = new HashMap<>(); /** + * 场所表 + */ + private Map locationMap = new HashMap<>(); + + /** * 线索集合表 */ private List clues = new ArrayList<>(); @@ -102,21 +107,45 @@ public class Player { */ private Map> taskMap = new HashMap<>(); + /** + * 已完成任务个数 + */ + private int finishedTaskNum = 0; - public Player(){ - //初始化推理游戏人物 - List keys = new ArrayList<>(TimingAcquisition.gateInfoMap.keySet()); - int index = RandomUtil.randomInt(keys.size()); - this.gateNo = keys.get(index); - List personList = TimingAcquisition.gateInfoMap.get(keys.get(index)); - personMap = new HashMap<>(); - name2IdMap = new HashMap<>(); - for (Person person : personList) { - taskMap.put(person.getId(), new HashMap<>()); - personMap.put(person.getId(), person); - name2IdMap.put(person.getName(), person.getId()); - } - } + /** + * 任务个数更新时间 + */ + private String numUpdateTime; + + /** + * 需要提示任务线索的标识 + */ + private boolean tipFlag = false; + + /** + * 记录玩家当前闲聊次数 + */ + private int chatTimes = 0; + +// public Player(){ +// //初始化推理游戏人物 +// List keys = new ArrayList<>(TimingAcquisition.gateInfoMap.keySet()); +// int index = RandomUtil.randomInt(keys.size()); +// this.gateNo = keys.get(index); +// List personList = TimingAcquisition.gateInfoMap.get(keys.get(index)); +// List personCopyList = new ArrayList<>(personList); +// Map> taskMapCopy = new HashMap<>(); +// Map personMapCopy = new HashMap<>(); +// Map name2IdMapCopy = new HashMap<>(); +// for (Person person : personCopyList) { +// taskMapCopy.put(person.getId(), new HashMap<>()); +// personMapCopy.put(person.getId(), person); +// name2IdMapCopy.put(person.getName(), person.getId()); +// } +// taskMap.putAll(taskMapCopy); +// personMap.putAll(personMapCopy); +// name2IdMap.putAll(name2IdMapCopy); +// } /** * 读取json文件数据 diff --git a/src/main/java/com/qiwu/inference/dto/PostTaskDto.java b/src/main/java/com/qiwu/inference/dto/PostTaskDto.java new file mode 100644 index 0000000..2d22c10 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/PostTaskDto.java @@ -0,0 +1,17 @@ +package com.qiwu.inference.dto; + +import lombok.Data; + +import java.util.Map; + +@Data +public class PostTaskDto { + /** + * 人物id + */ + private Integer personId; + /** + * 后置任务的前置任务完成情况: Map<后置任务id, Map<前置任务id, 完成状态>> + */ + Map taskStatusMap; +} diff --git a/src/main/java/com/qiwu/inference/dto/PostTaskRecordDto.java b/src/main/java/com/qiwu/inference/dto/PostTaskRecordDto.java new file mode 100644 index 0000000..2f9206b --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/PostTaskRecordDto.java @@ -0,0 +1,27 @@ +package com.qiwu.inference.dto; + +import lombok.Data; + +@Data +public class PostTaskRecordDto { + /** + * 人物id + */ + private Integer personId; + /** + * 后置任务id + */ + private Integer postTaskId; + /** + * 前置任务id + */ + private Integer preTaskId; + /** + * 完成状态: 0-未完成, 1-已完成 + */ + private Integer status; + /** + * 优先级标记 + */ + private Integer level; +} diff --git a/src/main/java/com/qiwu/inference/dto/TaskStatusDto.java b/src/main/java/com/qiwu/inference/dto/TaskStatusDto.java new file mode 100644 index 0000000..6769c03 --- /dev/null +++ b/src/main/java/com/qiwu/inference/dto/TaskStatusDto.java @@ -0,0 +1,15 @@ +package com.qiwu.inference.dto; + +import lombok.Data; + +@Data +public class TaskStatusDto { + /** + * 任务id + */ + private Integer taskId; + /** + * 完成状态 + */ + private Integer status; +} diff --git a/src/main/java/com/qiwu/inference/pojo/ChatSpeech.java b/src/main/java/com/qiwu/inference/pojo/ChatSpeech.java new file mode 100644 index 0000000..bd4ed20 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/ChatSpeech.java @@ -0,0 +1,44 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ChatSpeech implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("意图反馈") + private Integer methodId; + + @ApiModelProperty("身份") + private String identity; + + @ApiModelProperty("人物ID") + private Integer personId; + + @ApiModelProperty("性别") + private String gender; + + @ApiModelProperty("年龄段") + private String age; + + @ApiModelProperty("性格A") + private String dispositionIds; + + @ApiModelProperty("行为") + private String behaviour; + + @ApiModelProperty("任务状态") + private String taskStatus; + + @ApiModelProperty("关系") + private String degree; + + @ApiModelProperty("文本内容") + private String answer; + + @ApiModelProperty("通用标签") + private String flag; +} diff --git a/src/main/java/com/qiwu/inference/pojo/ClueSpeech.java b/src/main/java/com/qiwu/inference/pojo/ClueSpeech.java new file mode 100644 index 0000000..7480bd7 --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/ClueSpeech.java @@ -0,0 +1,47 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ClueSpeech implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("线索ID") + private Integer clueId; + + @ApiModelProperty("任务名称") + private String taskName; + + @ApiModelProperty("身份1") + private String identity; + + @ApiModelProperty("性别") + private String gender; + + @ApiModelProperty("人物ID") + private Integer personId; + + @ApiModelProperty("年龄段") + private String age; + + @ApiModelProperty("性格A") + private String dispositionIds; + + @ApiModelProperty("行为") + private String behaviour; + + @ApiModelProperty("任务状态") + private Integer status; + + @ApiModelProperty("线索文本") + private String answer; + + @ApiModelProperty("自身线索文本") + private String answerSelf; + + @ApiModelProperty("通用标签") + private Integer flag; +} diff --git a/src/main/java/com/qiwu/inference/pojo/EndGoal.java b/src/main/java/com/qiwu/inference/pojo/EndGoal.java index fee059d..216dfde 100755 --- a/src/main/java/com/qiwu/inference/pojo/EndGoal.java +++ b/src/main/java/com/qiwu/inference/pojo/EndGoal.java @@ -1,47 +1,50 @@ -package com.qiwu.inference.pojo; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.Setter; - -import java.io.Serializable; -import java.util.Date; - -/** - *

- * - *

- * - * @author xingxing.ye - * @since 2022-11-02 - */ -@Getter -@Setter -@TableName("end_goal") -@ApiModel(value = "EndGoal对象", description = "") -public class EndGoal implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("结局目标id") - private Integer id; - - @ApiModelProperty("目标名称") - private String name; - - @ApiModelProperty("目标描述") - private String description; - - @ApiModelProperty("组合表:1|2|3|4|5") - private String clueGroup; - - @ApiModelProperty("创建时间") - private Date createTime; - - @ApiModelProperty("更新时间") - private Date updateTime; - - -} +package com.qiwu.inference.pojo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@TableName("end_goal") +@ApiModel(value = "EndGoal对象", description = "") +public class EndGoal implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("结局目标id") + private Integer id; + + @ApiModelProperty("目标名称") + private String name; + + @ApiModelProperty("目标描述") + private String description; + + @ApiModelProperty("组合表:1|2|3|4|5") + private String clueGroup; + + @ApiModelProperty("关键任务id:60034|60043") + private String associatedTaskId; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/Location.java b/src/main/java/com/qiwu/inference/pojo/Location.java index c79300f..22435bf 100755 --- a/src/main/java/com/qiwu/inference/pojo/Location.java +++ b/src/main/java/com/qiwu/inference/pojo/Location.java @@ -1,51 +1,54 @@ -package com.qiwu.inference.pojo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.Setter; - -import java.io.Serializable; -import java.util.Date; - -/** - *

- * - *

- * - * @author xingxing.ye - * @since 2022-11-02 - */ -@Getter -@Setter -@ApiModel(value = "Location对象", description = "") -public class Location implements Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty("场所id") - private Integer id; - - @ApiModelProperty("场所名称") - private String name; - - @ApiModelProperty("描述") - private String description; - - @ApiModelProperty("关键场所") - private String keyLocation; - - @ApiModelProperty("是否隐藏") - private String isHidden; - - @ApiModelProperty("对应线索模板:") - private String clueTemplate; - - @ApiModelProperty("创建时间") - private Date createTime; - - @ApiModelProperty("更新时间") - private Date updateTime; - - -} +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author xingxing.ye + * @since 2022-11-02 + */ +@Getter +@Setter +@ApiModel(value = "Location对象", description = "") +public class Location implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("场所id") + private Integer id; + + @ApiModelProperty("场所名称") + private String name; + + @ApiModelProperty("描述") + private String description; + + @ApiModelProperty("关键场所") + private String keyLocation; + + @ApiModelProperty("是否隐藏") + private String isHidden; + + @ApiModelProperty("是否必现") + private String isAppear; + + @ApiModelProperty("对应线索模板:") + private String clueTemplate; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + +} diff --git a/src/main/java/com/qiwu/inference/pojo/PersonSpeech.java b/src/main/java/com/qiwu/inference/pojo/PersonSpeech.java new file mode 100644 index 0000000..480d59b --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/PersonSpeech.java @@ -0,0 +1,26 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PersonSpeech implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Integer personId; + + @ApiModelProperty("人物名称") + private String name; + + @ApiModelProperty("人物描述") + private String description; + + @ApiModelProperty("首次回复") + private String firstAnswer; + + @ApiModelProperty("回复") + private String answer; +} diff --git a/src/main/java/com/qiwu/inference/pojo/TaskSpeech.java b/src/main/java/com/qiwu/inference/pojo/TaskSpeech.java new file mode 100644 index 0000000..58dd45a --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/TaskSpeech.java @@ -0,0 +1,53 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TaskSpeech implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("线索ID") + private Integer demandTaskId; + + @ApiModelProperty("任务名称") + private String taskName; + + @ApiModelProperty("身份1") + private String identity; + + @ApiModelProperty("性别") + private String gender; + + @ApiModelProperty("人物ID") + private Integer personId; + + @ApiModelProperty("年龄段") + private String age; + + @ApiModelProperty("性格A") + private String dispositionIds; + + @ApiModelProperty("行为") + private String behaviour; + + @ApiModelProperty("任务状态") + private Integer status; + + @ApiModelProperty("进行中任务询问") + private String doingAsk; + + @ApiModelProperty("进行中任务完成提醒") + private String doingFinishedAnswer; + + @ApiModelProperty("未进行中任务完成提醒") + private String noDoingFinishedAnswer; + + @ApiModelProperty("完成对话文本") + private String answer; + + @ApiModelProperty("通用标签") + private Integer flag; +} diff --git a/src/main/java/com/qiwu/inference/pojo/TipSpeech.java b/src/main/java/com/qiwu/inference/pojo/TipSpeech.java new file mode 100644 index 0000000..489b3ae --- /dev/null +++ b/src/main/java/com/qiwu/inference/pojo/TipSpeech.java @@ -0,0 +1,23 @@ +package com.qiwu.inference.pojo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TipSpeech implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("ID") + private Integer demandTaskId; + + @ApiModelProperty("关于自身线索的指引") + private String selfClue; + + @ApiModelProperty("关于他人线索的指引") + private String otherClue; + + @ApiModelProperty("关于任务的指引") + private String taskClue; +} diff --git a/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java b/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java index ab3245d..a4a8900 100644 --- a/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java +++ b/src/main/java/com/qiwu/inference/service/ask/impl/AskServiceImpl.java @@ -30,16 +30,6 @@ public class AskServiceImpl implements AskService { @Override public CommonResult ask(OperationRequest operationReq) { String uid = operationReq.getUid(); - String subjectName = operationReq.getSubjectName(); //人物名称1 - String objectName = operationReq.getObjectName(); //人物名称2 - //当前玩家上一轮的请求信息 - OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); - if (!StringUtils.isEmpty(lastReq)) { - subjectName = (subjectName == null) ? lastReq.getSubjectName() : subjectName; - objectName = (objectName == null) ? lastReq.getObjectName() : objectName; - } - operationReq.setSubjectName(subjectName); - operationReq.setObjectName(objectName); //----------------记录见过的人-------------- PlayerUtil.recordClue(uid, TimingAcquisition.playerMap.get(uid).getPersonId()); diff --git a/src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java b/src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java index e4166b6..174a9fe 100644 --- a/src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java +++ b/src/main/java/com/qiwu/inference/service/barrier/impl/BarrierServiceImpl.java @@ -8,7 +8,10 @@ import com.qiwu.inference.common.utils.CacheUtil; import com.qiwu.inference.common.utils.PlayerUtil; import com.qiwu.inference.common.utils.RandomUtil; import com.qiwu.inference.common.utils.SpeechUtil; +import com.qiwu.inference.dto.DemandTaskDto; import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.PostTaskDto; +import com.qiwu.inference.dto.PostTaskRecordDto; import com.qiwu.inference.dto.request.OperationRequest; import com.qiwu.inference.dto.response.ResultResponse; import com.qiwu.inference.dto.response.ResultVarsResponse; @@ -22,6 +25,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import java.util.List; +import java.util.Map; @Service public class BarrierServiceImpl implements BarrierService { @@ -56,6 +60,17 @@ public class BarrierServiceImpl implements BarrierService { String subjectName = PlayerUtil.getNameByPersonId(uid, subjectId); //场所移动 if ("4001".equals(methodId)) { + //离开,或者没有说明去哪和找谁 + if (StringUtils.isEmpty(subjectId) && StringUtils.isEmpty(locationId)) { + String locationText = PlayerUtil.getLocations(uid); + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400105); + text = SpeechUtil.speechReplaceNum(text, locationText); + resultResponse.set反馈ID(400105); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } //玩家提供的人物名称 if (!StringUtils.isEmpty(subjectId)) { //获取人物所在场所 @@ -71,7 +86,7 @@ public class BarrierServiceImpl implements BarrierService { return CommonResult.success(resultVarsResponse); } List personIdList = PlayerUtil.getPersonsByLocationId(uid, locationId); - if (personIdList.size() == 0) { + if (StringUtils.isEmpty(personIdList)) { //获取对应话术 String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400104); resultResponse.set反馈ID(400104); @@ -79,12 +94,68 @@ public class BarrierServiceImpl implements BarrierService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //查找所有每个人物的后置任务情况 + List postTaskList = PlayerUtil.getDemandTaskHavePre(uid, personIdList); + if (postTaskList.size() != 0) { + //找到优先级高的任务 + PostTaskRecordDto postTaskRecord = PlayerUtil.getPostTask(uid, postTaskList); + //存在优先级高的任务 + if (!StringUtils.isEmpty(postTaskRecord)) { + //前置任务已完成 + if (postTaskRecord.getLevel() == 1 || postTaskRecord.getLevel() == 2) { + subjectId = postTaskRecord.getPersonId(); + //----------------记录见过的人-------------- + PlayerUtil.recordClue(uid, subjectId); + //任务自动完成 + Map> taskMap = player.getTaskMap(); + Map map = taskMap.get(subjectId); + map.put(postTaskRecord.getPostTaskId(), 1); + player.setLocation(locationId); + player.setPersonId(subjectId); + DemandTaskDto demandTask = PlayerUtil.getDemandTaskById(uid, subjectId, postTaskRecord.getPostTaskId()); + if (!StringUtils.isEmpty(demandTask)) { + PlayerUtil.addThreshold(player.getPersonMap().get(subjectId), demandTask); + String text = ""; + if (postTaskRecord.getLevel() == 1) { + //获取对应话术 + text = SpeechUtil.getPreSuccessTaskSpeech(uid, player.getPersonMap().get(subjectId), demandTask, 1); + resultResponse.set反馈ID(400105); + } + if (postTaskRecord.getLevel() == 2) { + //获取对应话术 + text = SpeechUtil.getPreSuccessTaskSpeech(uid, player.getPersonMap().get(subjectId), demandTask, 2); + resultResponse.set反馈ID(400106); + } + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + //任务是本人发布的 + if (postTaskRecord.getLevel() == 3) { + subjectId = postTaskRecord.getPersonId(); + player.setLocation(locationId); + player.setPersonId(subjectId); + DemandTaskDto demandTask = PlayerUtil.getDemandTaskById(uid, subjectId, postTaskRecord.getPostTaskId()); + String text = ""; + if (!StringUtils.isEmpty(demandTask)) { + text = SpeechUtil.getPreSuccessTaskSpeech(uid, player.getPersonMap().get(subjectId), demandTask, 3); + } + //----------------记录见过的人-------------- + PlayerUtil.recordClue(uid, subjectId); + resultResponse.set反馈ID(400107); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } int index = RandomUtil.randomInt(personIdList.size()); subjectId = personIdList.get(index); subjectName = PlayerUtil.getNameByPersonId(uid, subjectId); } - //场所为隐藏 - if (Constants.IS_HIDDEN.equals(TimingAcquisition.locationMap.get(locationId).getIsHidden())) { + //场所为隐藏,还未解锁 + if (Constants.IS_HIDDEN.equals(player.getLocationMap().get(locationId).getIsHidden())) { //获取对应话术 String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400102); resultResponse.set反馈ID(400102); @@ -97,14 +168,20 @@ public class BarrierServiceImpl implements BarrierService { //----------------记录见过的人-------------- PlayerUtil.recordClue(uid, subjectId); //获取对应话术 - String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400101); - text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.locationMap.get(locationId).getName(), subjectName); + String text = SpeechUtil.getPersonSpeech(uid, locationId, subjectId); + text = SpeechUtil.replaceHeader(text, subjectName); + //更新见面次数 + PlayerUtil.updateMeetTimes(uid, locationId, subjectId); +// String call = (player.getPersonMap().get(subjectId).getGender() == 1) ? "他" : "她"; + //获取对应话术 +// String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400101); +// text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.locationMap.get(locationId).getName(), subjectName, call); resultResponse.set反馈ID(400101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - //场所移动 + //直接找人 if ("4002".equals(methodId)) { //关卡中没有这个人物 if (StringUtils.isEmpty(player.getPersonMap().get(subjectId))) { @@ -119,23 +196,100 @@ public class BarrierServiceImpl implements BarrierService { if (StringUtils.isEmpty(player.getPersonMap().get(subjectId).getLocation())) { //获取对应话术 String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400204); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(400204); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //查找所有这个人物的后置任务情况 + List postTaskList = PlayerUtil.getDemandTaskHavePre(uid, subjectId); + if (postTaskList.size() != 0) { + //找到优先级高的任务 + PostTaskRecordDto postTaskRecord = PlayerUtil.getPostTask(uid, postTaskList); + //存在优先级高的任务 + if (!StringUtils.isEmpty(postTaskRecord)) { + //前置任务已完成 + if (postTaskRecord.getLevel() == 1 || postTaskRecord.getLevel() == 2) { + subjectId = postTaskRecord.getPersonId(); + //----------------记录见过的人-------------- + PlayerUtil.recordClue(uid, subjectId); + //任务自动完成 + Map> taskMap = player.getTaskMap(); + Map map = taskMap.get(subjectId); + map.put(postTaskRecord.getPostTaskId(), 1); + player.setLocation(locationId); + player.setPersonId(subjectId); + DemandTaskDto demandTask = PlayerUtil.getDemandTaskById(uid, subjectId, postTaskRecord.getPostTaskId()); + if (!StringUtils.isEmpty(demandTask)) { + PlayerUtil.addThreshold(player.getPersonMap().get(subjectId), demandTask); + String text = ""; + if (postTaskRecord.getLevel() == 1) { + //获取对应话术 + text = SpeechUtil.getPreSuccessTaskSpeech(uid, player.getPersonMap().get(subjectId), demandTask, 1); + resultResponse.set反馈ID(400105); + } + if (postTaskRecord.getLevel() == 2) { + //获取对应话术 + text = SpeechUtil.getPreSuccessTaskSpeech(uid, player.getPersonMap().get(subjectId), demandTask, 2); + resultResponse.set反馈ID(400106); + } + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + //任务是本人发布的 + if (postTaskRecord.getLevel() == 3) { + subjectId = postTaskRecord.getPersonId(); + player.setLocation(locationId); + player.setPersonId(subjectId); + DemandTaskDto demandTask = PlayerUtil.getDemandTaskById(uid, subjectId, postTaskRecord.getPostTaskId()); + String text = ""; + if (!StringUtils.isEmpty(demandTask)) { + text = SpeechUtil.getPreSuccessTaskSpeech(uid, player.getPersonMap().get(subjectId), demandTask, 3); + } + //----------------记录见过的人-------------- + PlayerUtil.recordClue(uid, subjectId); + resultResponse.set反馈ID(400107); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } //获取人物所在场所 locationId = player.getPersonMap().get(subjectId).getLocation(); - //跟玩家在同一场所,直接打招呼 + //跟玩家在同一场所 if (player.getLocation().equals(locationId)) { - operationReq.setMethodId("2002"); player.setPersonId(subjectId); + operationReq.setMethodId("2002"); operationReq.setTaskConditionId("70004"); //执行打招呼任务 //----------------记录见过的人-------------- PlayerUtil.recordClue(uid, subjectId); + //更新见面次数 + PlayerUtil.updateMeetTimes(uid, locationId, subjectId); return commonService.operate(operationReq); + //获取对应话术 +// String text = SpeechUtil.getPersonSpeech(uid, locationId, subjectId); +// text = SpeechUtil.replaceHeader(text, subjectName); +// resultResponse.set反馈ID(400206); +// resultResponse.set反馈文本(text); +// resultVarsResponse.setVars(resultResponse); +// return CommonResult.success(resultVarsResponse); } //不在同一场所 + //判断玩家是否已经获得了该人物的场所线索 + boolean flag = PlayerUtil.checkLocationClue(player.getClueMap(), subjectId); + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getBarrierSpeech(Constants.SPEECH_ASIDE, 400204); + text = SpeechUtil.speechReplaceNum(text, subjectName); + resultResponse.set反馈ID(400205); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } //保存本轮对话 operationReq.setSubjectId(subjectId); operationReq.setMethodId("4001"); diff --git a/src/main/java/com/qiwu/inference/service/chat/ChatService.java b/src/main/java/com/qiwu/inference/service/chat/ChatService.java new file mode 100644 index 0000000..64b7cd4 --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/chat/ChatService.java @@ -0,0 +1,9 @@ +package com.qiwu.inference.service.chat; + +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultVarsResponse; + +public interface ChatService { + CommonResult operate(OperationRequest operationReq); +} diff --git a/src/main/java/com/qiwu/inference/service/chat/impl/ChatServiceImpl.java b/src/main/java/com/qiwu/inference/service/chat/impl/ChatServiceImpl.java new file mode 100644 index 0000000..b5e071f --- /dev/null +++ b/src/main/java/com/qiwu/inference/service/chat/impl/ChatServiceImpl.java @@ -0,0 +1,57 @@ +package com.qiwu.inference.service.chat.impl; + +import com.qiwu.inference.common.TimingAcquisition; +import com.qiwu.inference.common.api.CommonResult; +import com.qiwu.inference.common.utils.NumberUtil; +import com.qiwu.inference.common.utils.PlayerUtil; +import com.qiwu.inference.common.utils.SpeechUtil; +import com.qiwu.inference.dto.BarrierTaskKeyDto; +import com.qiwu.inference.dto.DispositionDto; +import com.qiwu.inference.dto.Person; +import com.qiwu.inference.dto.Player; +import com.qiwu.inference.dto.request.OperationRequest; +import com.qiwu.inference.dto.response.ResultResponse; +import com.qiwu.inference.dto.response.ResultVarsResponse; +import com.qiwu.inference.pojo.ChatSpeech; +import com.qiwu.inference.service.chat.ChatService; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class ChatServiceImpl implements ChatService { + + @Override + public CommonResult operate(OperationRequest operationReq) { + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = operationReq.getUid(); + String methodId = operationReq.getMethodId(); //方法编号 + Player player = TimingAcquisition.playerMap.get(uid); + //对话人的信息 + Person current = player.getPersonMap().get(player.getPersonId()); + //获取对应话术 + String text = SpeechUtil.getChatSpeech(uid, current, methodId); + text = SpeechUtil.addHeader(text, current.getName()); + //闲聊连续对话次数超过指定次数,任务白名单中有该人已解锁或无需解锁的任务则进行提示 + int chatTimes = Integer.parseInt(TimingAcquisition.systemConfigMap.get("chatTimes").getValue()); + if (player.getChatTimes() >= chatTimes) { + //找到白名单内该人的任务中已解锁或无需解锁的任务 + String addText = PlayerUtil.getTipInChat(uid, current); + if (!StringUtils.isEmpty(addText)) { + addText = "【寒烟@正常】" + addText; + text += addText; + } + } + resultResponse.set反馈ID(600101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } +} diff --git a/src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java b/src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java index 9a712d0..e1dfc7e 100644 --- a/src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java +++ b/src/main/java/com/qiwu/inference/service/check/impl/CheckServiceImpl.java @@ -40,6 +40,62 @@ public class CheckServiceImpl implements CheckService { Integer subjectId = operationReq.getSubjectId(); //人物名称id Integer clueTypeId = operationReq.getClueTypeId(); //线索类型id boolean hadTalk = false; + //该关卡没有这个人物 + if (!StringUtils.isEmpty(subjectId)) { + if(subjectId == Constants.REQ_NON){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100008); + resultResponse.set反馈ID(300008); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + operationReq.setOperate(Constants.OPERATE_CHECK); + Player player = TimingAcquisition.playerMap.get(uid); + if ("3001".equals(methodId)) { + //玩家已对话过的人物 + List personList = new ArrayList<>(player.getClueMap().keySet()); + //玩家还没有获得线索 + if (personList.size() == 0) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30010101); + resultResponse.set反馈ID(30010101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + StringBuilder personText = new StringBuilder(); + for (Integer personId : personList) { + personText.append(PlayerUtil.getNameByPersonId(uid, personId)).append("、"); + } + if (personText.length() != 0) { + personText.deleteCharAt(personText.length() - 1); + } + //未提供人物名称 + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = ""; + if (personList.size() == 1) { + //人物信息 + Person person = player.getPersonMap().get(personList.get(0)); + String call = (person.getGender() == 1) ? "他" : "她"; + text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 30010102); + text = SpeechUtil.speechReplaceNum(text, personText.toString(), call); + //保存本轮对话 + operationReq.setSubjectId(personList.get(0)); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); + } else { + text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300101); + text = SpeechUtil.speechReplaceNum(text, personText.toString()); + } + resultResponse.set反馈ID(300101); + resultResponse.set反馈文本(text); + resultResponse.set后台附加返回("查看人物列表1"); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } //当前玩家上一轮的请求信息 OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); if (!StringUtils.isEmpty(lastReq)) { @@ -49,10 +105,8 @@ public class CheckServiceImpl implements CheckService { hadTalk = true; } } - operationReq.setOperate(Constants.OPERATE_CHECK); - Player player = TimingAcquisition.playerMap.get(uid); //查看人物列表 - if ("3001".equals(methodId) || "3002".equals(methodId)) { + if ("300102".equals(methodId) || "3002".equals(methodId)) { //玩家已对话过的人物 List personList = new ArrayList<>(player.getClueMap().keySet()); //玩家还没有获得线索 @@ -115,6 +169,9 @@ public class CheckServiceImpl implements CheckService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //保存本轮对话 + operationReq.setSubjectId(subjectId); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); //人物信息 Person person = player.getPersonMap().get(subjectId); String call = (person.getGender() == 1) ? "他" : "她"; @@ -175,16 +232,19 @@ public class CheckServiceImpl implements CheckService { if (entry.getKey() == 9) { clueText.append("关键线索: "); } - clueText.append(clues.size()).append("、"); + clueText.append(clues.size()).append("条、"); } if (clueText.length() != 0) { clueText.deleteCharAt(clueText.length() - 1); + //保存本轮对话 + operationReq.setSubjectId(subjectId); + CacheUtil.put(uid, operationReq, Long.parseLong(expireTime)); //获取对应话术 String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300103); - text = SpeechUtil.speechReplaceNum(text, clueText.toString()); + text = SpeechUtil.speechReplaceNum(text, PlayerUtil.getNameByPersonId(uid, subjectId), clueText.toString()); resultResponse.set反馈ID(300103); resultResponse.set反馈文本(text); - resultResponse.set后台附加返回("查看人物列表2"); + resultResponse.set后台附加返回("查看线索3"); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } @@ -222,8 +282,12 @@ public class CheckServiceImpl implements CheckService { if ("3005".equals(methodId)) { int clueSize = 0; for (Map.Entry>> entry : player.getClueMap().entrySet()) { - for (Map.Entry> listEntry : entry.getValue().entrySet()) { - clueSize += listEntry.getValue().size(); + Map> clueMap = entry.getValue(); + //遍历该人物所有类型的线索 + if (!StringUtils.isEmpty(clueMap)) { + for (Map.Entry> listEntry : clueMap.entrySet()) { + clueSize += listEntry.getValue().size(); + } } } //获取对应话术 @@ -254,20 +318,27 @@ public class CheckServiceImpl implements CheckService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //有线索人物的人数统计 + int count = 0; for (Map.Entry>> entry : player.getClueMap().entrySet()) { - clueNumText.append(player.getPersonMap().get(entry.getKey()).getName()).append("有"); int size = 0; - for (Map.Entry> listEntry : entry.getValue().entrySet()) { - size += listEntry.getValue().size(); + Map> clueMap = entry.getValue(); + //遍历该人物所有类型的线索 + if (!StringUtils.isEmpty(clueMap)) { + clueNumText.append(player.getPersonMap().get(entry.getKey()).getName()).append("有"); + for (Map.Entry> listEntry : clueMap.entrySet()) { + size += listEntry.getValue().size(); + count++; + } + clueNumText.append(size).append("条线索、"); } - clueNumText.append(size).append("条线索、"); } if (clueNumText.length() != 0) { clueNumText.deleteCharAt(clueNumText.length() - 1); } //获取对应话术 String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300502); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(player.getClueMap().size()), clueNumText.toString()); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(count), clueNumText.toString()); resultResponse.set反馈ID(300502); resultResponse.set反馈文本(text); resultResponse.set后台附加返回("查看线索2"); @@ -279,9 +350,13 @@ public class CheckServiceImpl implements CheckService { StringBuilder clueText = new StringBuilder(); Map clueNumMap = new HashMap<>(); for (Map.Entry>> entry : player.getClueMap().entrySet()) { - for (Map.Entry> listEntry : entry.getValue().entrySet()) { - int size = (clueNumMap.get(listEntry.getKey()) == null) ? 0 : clueNumMap.get(listEntry.getKey()); - clueNumMap.put(listEntry.getKey(), size + listEntry.getValue().size()); + Map> clueMap = entry.getValue(); + //遍历该人物所有类型的线索 + if (!StringUtils.isEmpty(clueMap)) { + for (Map.Entry> listEntry : clueMap.entrySet()) { + int size = (clueNumMap.get(listEntry.getKey()) == null) ? 0 : clueNumMap.get(listEntry.getKey()); + clueNumMap.put(listEntry.getKey(), size + listEntry.getValue().size()); + } } } //玩家没有收集到线索 @@ -417,11 +492,15 @@ public class CheckServiceImpl implements CheckService { StringBuilder clueText = new StringBuilder(); int size = 0; for (Map.Entry>> entry : player.getClueMap().entrySet()) { - clueText.append(player.getPersonMap().get(entry.getKey()).getName()).append("有"); - for (Map.Entry> listEntry : entry.getValue().entrySet()) { - if (clueTypeId.equals(listEntry.getKey())) { - size += listEntry.getValue().size(); - clueText.append(listEntry.getValue().size()).append("条、"); + Map> clueMap = entry.getValue(); + //遍历该人物所有类型的线索 + if (!StringUtils.isEmpty(clueMap)) { + clueText.append(player.getPersonMap().get(entry.getKey()).getName()).append("有"); + for (Map.Entry> listEntry : clueMap.entrySet()) { + if (clueTypeId.equals(listEntry.getKey())) { + size += listEntry.getValue().size(); + clueText.append(listEntry.getValue().size()).append("条、"); + } } } } @@ -476,6 +555,8 @@ public class CheckServiceImpl implements CheckService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + subjectId = (subjectId == null) ? lastReq.getSubjectId() : subjectId; + clueTypeId = (clueTypeId == null) ? lastReq.getClueTypeId() : clueTypeId; } //没有提供人物名称 if (StringUtils.isEmpty(subjectId)) { @@ -560,6 +641,72 @@ public class CheckServiceImpl implements CheckService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //查看某人的模糊操作 + if ("3101".equals(methodId)) { + //没有提供人物名称 + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 310101); + resultResponse.set反馈ID(310101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //提供的人物名称不存在 + if (subjectId == Constants.REQ_NON) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 310102); + resultResponse.set反馈ID(310102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Person current = player.getPersonMap().get(player.getPersonId()); + Person subject = player.getPersonMap().get(subjectId); + //查找符合条件的线索 + List clueList = PlayerUtil.findClues(current, subject, 1); + //检查是否符合阈值要求 + clueList = PlayerUtil.checkThreshold(current, clueList); + //有身份线索 + if (clueList.size() != 0) { + int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); + //获取对应话术 + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); + resultResponse.set反馈ID(310105); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //玩家已对话过的人物 + List personList = new ArrayList<>(player.getClueMap().keySet()); + //人物未知,则提供基本线信息 + if (!personList.contains(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 310103); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), subject.getAge().toString(), + (subject.getGender() == 1) ? "男" : "女", subject.getIdentityName()); + resultResponse.set反馈ID(310103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } else { + String call = (subject.getGender() == 1) ? "他" : "她"; + //获取对应话术 + String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 310104); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), subject.getAge().toString(), + (subject.getGender() == 1) ? "男" : "女", subject.getIdentityName(), call, + subject.getTrustDegree().toString(), subject.getDeterrenceDegree().toString()); + resultResponse.set反馈ID(310104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } //获取对应话术 String text = SpeechUtil.getCheckSpeech(Constants.SPEECH_ASIDE, 300001); resultResponse.set反馈ID(300001); diff --git a/src/main/java/com/qiwu/inference/service/common/CommonService.java b/src/main/java/com/qiwu/inference/service/common/CommonService.java index 66dc27d..eda8a57 100644 --- a/src/main/java/com/qiwu/inference/service/common/CommonService.java +++ b/src/main/java/com/qiwu/inference/service/common/CommonService.java @@ -49,6 +49,8 @@ public class CommonService { case "1026": return playerService.askLocation(request); case "1027": + case "1028": + case "1029": return playerService.askPrompt(request); case "2001": case "2003": @@ -91,6 +93,13 @@ public class CommonService { case "2039": case "2040": case "2041": + case "2101": + case "2102": + case "2104": + case "2106": + case "2107": + case "2108": + case "2109": return playerService.performTask(request); } return null; diff --git a/src/main/java/com/qiwu/inference/service/login/LoginService.java b/src/main/java/com/qiwu/inference/service/login/LoginService.java index e85c0dc..f7173dd 100644 --- a/src/main/java/com/qiwu/inference/service/login/LoginService.java +++ b/src/main/java/com/qiwu/inference/service/login/LoginService.java @@ -7,4 +7,6 @@ import com.qiwu.inference.dto.response.ResultVarsResponse; public interface LoginService { CommonResult login(String uid); + + CommonResult startGame(OperationRequest operationReq); } diff --git a/src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java b/src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java index a924649..c7b4f7c 100644 --- a/src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java +++ b/src/main/java/com/qiwu/inference/service/login/impl/LoginServiceImpl.java @@ -6,19 +6,18 @@ import com.qiwu.inference.common.Constants; import com.qiwu.inference.common.TimingAcquisition; import com.qiwu.inference.common.api.CommonResult; import com.qiwu.inference.common.utils.*; +import com.qiwu.inference.dto.LocationInfoDto; import com.qiwu.inference.dto.Person; import com.qiwu.inference.dto.Player; import com.qiwu.inference.dto.request.OperationRequest; import com.qiwu.inference.dto.response.*; +import com.qiwu.inference.pojo.EndGoal; import com.qiwu.inference.service.login.LoginService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; @Service @@ -35,11 +34,29 @@ public class LoginServiceImpl implements LoginService { ResultResponse resultResponse = new ResultResponse(); //存放玩家数据 Map sidGateNoMap = new ConcurrentHashMap<>(); - + String nowTime = DateUtil.getCurrentTime(); Player player = new Player(); player.setSid(uid); player.setStatus(Constants.ONLINE); - player.setOnlineTime(DateUtil.getCurrentTime()); + player.setOnlineTime(nowTime); + //初始化推理游戏人物 + List keys = new ArrayList<>(TimingAcquisition.gateInfoMap.keySet()); + int random = RandomUtil.randomInt(keys.size()); + player.setGateNo(keys.get(random)); + List personsCopy = TimingAcquisition.gateInfoMap.get(keys.get(random)); + //深拷贝list + List personCopyList = PlayerUtil.deepCopyList(personsCopy); + Map> taskMapCopy = new HashMap<>(); + Map personMapCopy = new HashMap<>(); + Map name2IdMapCopy = new HashMap<>(); + for (Person person : personCopyList) { + taskMapCopy.put(person.getId(), new HashMap<>()); + personMapCopy.put(person.getId(), person); + name2IdMapCopy.put(person.getName(), person.getId()); + } + player.setTaskMap(taskMapCopy); + player.setPersonMap(personMapCopy); + player.setName2IdMap(name2IdMapCopy); //给玩家分配场所和对话人物 Map> locationPersonMap = new HashMap<>(); Map personMap = player.getPersonMap(); @@ -67,6 +84,11 @@ public class LoginServiceImpl implements LoginService { List personList = locationPersonMap.get(locationId); int num = RandomUtil.randomInt(personList.size()); player.setPersonId(personList.get(num)); + //生成场所表,包含场所隐藏状态和必现场所 + Map locationMap = PlayerUtil.makeLocationMap(locationPersonMap); + player.setLocationMap(locationMap); + //记录玩家第一次的任务个数更新时间 + player.setNumUpdateTime(nowTime); TimingAcquisition.playerMap.put(uid, player); String playerStr = JSON.toJSONString(player); //持久化玩家数据 @@ -79,4 +101,89 @@ public class LoginServiceImpl implements LoginService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + + @Override + public CommonResult startGame(OperationRequest operationReq) { + ResultVarsResponse resultVarsResponse = new ResultVarsResponse(); + ResultResponse resultResponse = new ResultResponse(); + + String uid = operationReq.getUid(); + String text = ""; + Player player = TimingAcquisition.playerMap.get(uid); + //数据重置 + if (player.getFinished() == 1) { + //初始化推理游戏人物 + List keys = new ArrayList<>(TimingAcquisition.gateInfoMap.keySet()); + int random = RandomUtil.randomInt(keys.size()); + player.setGateNo(keys.get(random)); + List personsCopy = TimingAcquisition.gateInfoMap.get(keys.get(random)); + //深拷贝list + List personCopyList = PlayerUtil.deepCopyList(personsCopy); + Map> taskMapCopy = new HashMap<>(); + Map personMapCopy = new HashMap<>(); + Map name2IdMapCopy = new HashMap<>(); + for (Person person : personCopyList) { + taskMapCopy.put(person.getId(), new HashMap<>()); + personMapCopy.put(person.getId(), person); + name2IdMapCopy.put(person.getName(), person.getId()); + } + player.setTaskMap(taskMapCopy); + player.setPersonMap(personMapCopy); + player.setName2IdMap(name2IdMapCopy); + player.setCurrency(3000.0); + //给玩家分配场所和对话人物 + Map> locationPersonMap = new HashMap<>(); + Map personMap = player.getPersonMap(); + for (Map.Entry entry : personMap.entrySet()) { + Person person = entry.getValue(); + if (!StringUtils.isEmpty(person.getLocation())) { + //没有当前场所 + if (StringUtils.isEmpty(locationPersonMap.get(person.getLocation()))) { + List personList = new ArrayList<>(); + personList.add(entry.getKey()); + locationPersonMap.put(person.getLocation(), personList); + } + //有当前场所,但是没有这个人 + List persons = locationPersonMap.get(person.getLocation()); + if (!persons.contains(entry.getKey())) { + persons.add(entry.getKey()); + } + } + } + List locationList = new ArrayList<>(locationPersonMap.keySet()); + int index = RandomUtil.randomInt(locationList.size()); + String locationId = locationList.get(index); + player.setLocation(locationId); + //随机分配人物 + List personList = locationPersonMap.get(locationId); + int num = RandomUtil.randomInt(personList.size()); + player.setPersonId(personList.get(num)); + //生成场所表,包含场所隐藏状态和必现场所 + Map locationMap = PlayerUtil.makeLocationMap(locationPersonMap); + player.setLocationMap(locationMap); + } + //关卡编号 + String gateNo = player.getGateNo(); + int size = TimingAcquisition.barrierTaskKeyMap.get(gateNo).size(); + Integer demandTaskId = TimingAcquisition.barrierTaskKeyMap.get(gateNo).get(size - 1).getDemandTaskId(); + Map endGoalMap = TimingAcquisition.endGoalMap; + for (Map.Entry entry : endGoalMap.entrySet()) { + EndGoal endGoal = entry.getValue(); + List associatedTaskIds = Arrays.asList(endGoal.getAssociatedTaskId().split("\\|")); + if (associatedTaskIds.contains(demandTaskId.toString())) { + text = "【旁白@正常】" + endGoal.getName(); + text += "【旁白@正常】" + endGoal.getDescription(); + text += SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 103001); + text += SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 103002); + String location = TimingAcquisition.locationMap.get(TimingAcquisition.playerMap.get(uid).getLocation()).getName(); + String name = PlayerUtil.getNameByPersonId(uid, TimingAcquisition.playerMap.get(uid).getPersonId()); + text = SpeechUtil.speechReplaceNum(text, location, name); + break; + } + } + resultResponse.set反馈ID(100009); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } } diff --git a/src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java b/src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java index 292166a..14cc6f9 100644 --- a/src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java +++ b/src/main/java/com/qiwu/inference/service/player/impl/PlayerServiceImpl.java @@ -44,13 +44,35 @@ public class PlayerServiceImpl implements PlayerService { String uid = request.getUid(); String methodId = request.getMethodId(); - String subjectName = request.getSubjectName(); + String subjectName = request.getSubjectName(); //人物名称1 String type = request.getDispositionType(); String dispositionName = request.getDispositionName(); + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if ("她".equals(subjectName) || "他".equals(subjectName) || "它".equals(subjectName)) { + subjectName = lastReq.getSubjectName(); + } + } + Player player = TimingAcquisition.playerMap.get(uid); //当前对话的人物 Person current = player.getPersonMap().get(player.getPersonId()); + //没提供人物名称时 + if (StringUtils.isEmpty(subjectName)) { + subjectName = current.getName(); + } + //该关卡没有这个人物 + if(StringUtils.isEmpty(player.getName2IdMap().get(subjectName))){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100008); + text = SpeechUtil.replaceHeader(text, current.getName()); + resultResponse.set反馈ID(100008); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } if("1001".equals(methodId)){ if(StringUtils.isEmpty(subjectName)){ @@ -79,6 +101,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100103); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(100103); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -115,11 +138,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, personId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), personId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100101); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -149,6 +173,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100204); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(100204); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -172,25 +197,28 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + int num = RandomUtil.randomInt(clueList.size()); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //查找符合条件的线索 clueList = findClues(clueList,dispositionName); if(clueList.size() == 0){ //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100204); + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100202); text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, dispositionName); - resultResponse.set反馈ID(100204); + text = SpeechUtil.speechReplaceNum(text, context); + resultResponse.set反馈ID(100202); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, personId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), personId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100201); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -214,9 +242,19 @@ public class PlayerServiceImpl implements PlayerService { String objectName = request.getObjectName(); String relationName = request.getRelationName(); + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if ("她".equals(subjectName) || "他".equals(subjectName) || "它".equals(subjectName)) { + subjectName = lastReq.getSubjectName(); + objectName = lastReq.getObjectName(); + } + } + Player player = TimingAcquisition.playerMap.get(uid); if (StringUtils.isEmpty(objectName)) { - objectName = TimingAcquisition.getTalkName(uid); //当前正在对话的人 + objectName = subjectName; + subjectName = TimingAcquisition.getTalkName(uid); //当前正在对话的人 } //当前对话的人物 Person current = player.getPersonMap().get(player.getPersonId()); @@ -273,17 +311,14 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } -// StringBuilder builder = new StringBuilder(); -// for (ClueDto clue : clueList) { -// builder.append(clue.getClueTemplate()); -// } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100301); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -333,7 +368,7 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //查找符合条件的线索 clueList = findClues(clueList, relationName); if(clueList.size() == 0){ @@ -348,11 +383,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100401); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -384,6 +420,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100503); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName, relationName); resultResponse.set反馈ID(100503); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -406,6 +443,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100503); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName, relationName); resultResponse.set反馈ID(100503); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -414,13 +452,14 @@ public class PlayerServiceImpl implements PlayerService { StringBuilder builder = new StringBuilder(); for (ClueDto clue : clueList) { if (!StringUtils.isEmpty(clue.getObject())) { - builder.append(player.getPersonMap().get(clue.getObject()).getName() + "跟" + subjectName + "有" + clue.getClueName() + "关系。"); + builder.append(player.getPersonMap().get(clue.getObject()).getName()).append("跟").append(subjectName).append("有").append(clue.getClueName()).append("关系。"); } } if(StringUtils.isEmpty(builder.toString())){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100503); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName, relationName); resultResponse.set反馈ID(100503); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -428,11 +467,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100501); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -446,9 +486,8 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - StringBuilder builder = new StringBuilder(); List clueList = new ArrayList<>(); - for(Integer key:player.getPersonMap().keySet()){ + for(Integer key : player.getPersonMap().keySet()){ Person person = player.getPersonMap().get(key); clueList.addAll(findClues(person,5)); } @@ -456,6 +495,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100603); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, relationName); resultResponse.set反馈ID(100603); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -473,27 +513,26 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } //查找符合条件的线索 - clueList=findClues(clueList,relationName); + clueList = findClues(clueList, relationName); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100603); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, relationName); resultResponse.set反馈ID(100603); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - for (ClueDto clue : clueList) { - builder.append(clue.getClueTemplate()); - } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, clueList.get(index).getSubject(), clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), clueList.get(index).getSubject(), clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100601); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); - resultResponse.set反馈ID(100602); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); + resultResponse.set反馈ID(100601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); @@ -517,6 +556,27 @@ public class PlayerServiceImpl implements PlayerService { String behaviourName = request.getBehaviourName(); Player player = TimingAcquisition.playerMap.get(uid); + //人物名称不存在 + if (!StringUtils.isEmpty(subjectName)) { + Integer subjectId = player.getName2IdMap().get(subjectName); + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100008); + resultResponse.set反馈ID(100008); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if ("她".equals(subjectName) || "他".equals(subjectName) || "它".equals(subjectName)) { + subjectName = lastReq.getSubjectName(); + objectName = lastReq.getObjectName(); + } + } //当前对话的人物 Person current = player.getPersonMap().get(player.getPersonId()); //询问当前对话的人 @@ -534,7 +594,6 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } Integer subjectId = player.getName2IdMap().get(subjectName); - Person person =player.getPersonMap().get(subjectId); Person subject =player.getPersonMap().get(subjectId); //查找符合条件的线索 List clueList = findClues(current, subject,4); @@ -542,6 +601,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100703); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(100703); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -560,16 +620,20 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100701); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); }else if("1008".equals(methodId)){ + if (StringUtils.isEmpty(objectName)) { + objectName = current.getName(); + } if(StringUtils.isEmpty(subjectName)||StringUtils.isEmpty(objectName)){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); @@ -607,11 +671,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100801); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -641,6 +706,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100903); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName, behaviourName); resultResponse.set反馈ID(100903); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -662,6 +728,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100903); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName, behaviourName); resultResponse.set反馈ID(100903); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -669,11 +736,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 100901); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(100901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -702,6 +770,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101004); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName, behaviourName); resultResponse.set反馈ID(101004); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -719,7 +788,7 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //查找符合条件的线索 clueList = findClues(clueList, behaviourName); if(clueList.size() == 0){ @@ -734,17 +803,21 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101001); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(101001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); }else if("1011".equals(methodId)){ - if(StringUtils.isEmpty(subjectName)||StringUtils.isEmpty(objectName)){ + if (StringUtils.isEmpty(objectName)) { + objectName = current.getName(); + } + if(StringUtils.isEmpty(subjectName) || StringUtils.isEmpty(objectName)){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100001); resultResponse.set反馈ID(100001); @@ -771,6 +844,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101104); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, behaviourName); resultResponse.set反馈ID(101104); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -788,7 +862,7 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //查找符合条件的线索 clueList = findClues(clueList, behaviourName); if(clueList.size() == 0){ @@ -803,11 +877,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101101); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(101101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -829,6 +904,14 @@ public class PlayerServiceImpl implements PlayerService { String subjectName = request.getSubjectName(); String taskConditionId = request.getTaskConditionId(); + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if ("她".equals(subjectName) || "他".equals(subjectName) || "它".equals(subjectName)) { + subjectName = lastReq.getSubjectName(); + } + } + Player player = TimingAcquisition.playerMap.get(uid); //当前对话的人物 Person current = player.getPersonMap().get(player.getPersonId()); @@ -837,11 +920,32 @@ public class PlayerServiceImpl implements PlayerService { subjectName = current.getName(); } Integer subjectId = player.getName2IdMap().get(subjectName); - Person person = player.getPersonMap().get(subjectId); + //该关卡没有这个人物 + if(StringUtils.isEmpty(subjectId)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100008); + resultResponse.set反馈ID(100008); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Person subject = player.getPersonMap().get(subjectId); if("1015".equals(methodId)){ //查找符合条件的任务 - List clueList = PlayerUtil.getCluesByType(uid, subjectId, 1); + List clueList = PlayerUtil.getCluesByType(current, subject, 1); + if(clueList.size() == 0){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101504); + text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); + resultResponse.set反馈ID(101504); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //过滤掉已经完成的任务对应的线索 + clueList = PlayerUtil.getUndoClueList(uid, subject, clueList); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101503); @@ -862,22 +966,35 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - int index = RandomUtil.randomInt(clueList.size()); +// int index = RandomUtil.randomInt(clueList.size()); + int index = 0; + //当前玩家上一轮的请求信息 + Integer num = (Integer) CacheUtil.get(uid + "-" + subjectId); + if (!StringUtils.isEmpty(num)) { + if (num < clueList.size()) { + index = num; + } + } + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); + CacheUtil.put(uid + "-" + subjectId, index + 1, 60000); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101501); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(101501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); }else if("1016".equals(methodId)){ //查找符合条件的任务 - List clueList = PlayerUtil.getCluesByType(uid, subjectId, 3); + List clueList = PlayerUtil.getCluesByType(current, subject, 3); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101603); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(101603); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -895,10 +1012,13 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101601); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(101601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -935,9 +1055,9 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //判断任务是否为提升信任值 - clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 1); + clueList = PlayerUtil.getCluesIsType(current, clueList, 1); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101702); @@ -949,10 +1069,13 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, current, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101701); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(101701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -972,6 +1095,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101804); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(101804); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -989,9 +1113,9 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //判断任务是否为提升信任值 - clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 3); + clueList = PlayerUtil.getCluesIsType(current, clueList, 3); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101802); @@ -1003,21 +1127,25 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101801); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(101801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); }else if("1019".equals(methodId)){ //查找符合条件的任务 - List clueList = PlayerUtil.getCluesByType(uid, subjectId, 2); + List clueList = PlayerUtil.getCluesByType(current, subject, 2); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101903); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(101903); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1035,21 +1163,25 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 101901); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(101901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); }else if("1020".equals(methodId)){ //查找符合条件的任务 - List clueList = PlayerUtil.getCluesByType(uid, subjectId, 4); + List clueList = PlayerUtil.getCluesByType(current, subject, 4); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102003); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(102003); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1067,10 +1199,13 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102001); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(102001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1091,6 +1226,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102104); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(102104); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1108,9 +1244,9 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //判断任务是否为提升信任值 - clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 2); + clueList = PlayerUtil.getCluesIsType(current, clueList, 2); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102102); @@ -1122,10 +1258,13 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102101); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(102101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1145,6 +1284,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102204); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(102204); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1162,9 +1302,9 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //判断任务是否为提升信任值 - clueList = PlayerUtil.getCluesIsType(uid, subjectId, clueList, 4); + clueList = PlayerUtil.getCluesIsType(current, clueList, 4); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102202); @@ -1176,10 +1316,13 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int index = RandomUtil.randomInt(clueList.size()); + //----------------记录线索-------------- + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102201); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(102201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1203,8 +1346,32 @@ public class PlayerServiceImpl implements PlayerService { String identityName = request.getIdentityName(); Player player = TimingAcquisition.playerMap.get(uid); + //人物名称不存在 + if (!StringUtils.isEmpty(subjectName)) { + Integer subjectId = player.getName2IdMap().get(subjectName); + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100008); + resultResponse.set反馈ID(100008); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + + //当前玩家上一轮的请求信息 + OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); + if (!StringUtils.isEmpty(lastReq)) { + if ("她".equals(subjectName) || "他".equals(subjectName) || "它".equals(subjectName)) { + subjectName = lastReq.getSubjectName(); + } + } //当前对话的人物 Person current = player.getPersonMap().get(player.getPersonId()); + //询问对象为对话人 + if(StringUtils.isEmpty(subjectName)){ + subjectName = current.getName(); + } if("1023".equals(methodId)){ if(StringUtils.isEmpty(subjectName)){ @@ -1216,6 +1383,14 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } Integer subjectId = player.getName2IdMap().get(subjectName); + if(StringUtils.isEmpty(subjectId)){ + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100008); + resultResponse.set反馈ID(100008); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } Person subject =player.getPersonMap().get(subjectId); //查找符合条件的线索 List clueList = findClues(current,subject,1); @@ -1223,6 +1398,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102303); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(102303); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1241,11 +1417,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102301); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(102301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1275,6 +1452,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102404); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, identityName); resultResponse.set反馈ID(102404); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1292,7 +1470,7 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //查找符合条件的线索 clueList = findClues(clueList, identityName); if(clueList.size() == 0){ @@ -1307,11 +1485,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁任务------------- + PlayerUtil.unlockTask(uid, subject, clueList.get(index)); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102401); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(102401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1336,8 +1515,24 @@ public class PlayerServiceImpl implements PlayerService { String locationName = request.getLocationName(); Player player = TimingAcquisition.playerMap.get(uid); + //人物名称不存在 + if (!StringUtils.isEmpty(subjectName)) { + Integer subjectId = player.getName2IdMap().get(subjectName); + if (StringUtils.isEmpty(subjectId)) { + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_ASIDE, 100008); + resultResponse.set反馈ID(100008); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } //当前对话的人物 Person current = player.getPersonMap().get(player.getPersonId()); + //询问对象为对话人本身 + if (StringUtils.isEmpty(subjectName)) { + subjectName = current.getName(); + } if("1025".equals(methodId)){ if(StringUtils.isEmpty(subjectName)){ @@ -1356,6 +1551,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102503); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(102503); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1374,11 +1570,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁场所------------- + PlayerUtil.unlockLocation(player.getLocationMap(), subject.getLocation()); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102501); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(102501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1409,6 +1606,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102604); text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.speechReplaceNum(text, subjectName); resultResponse.set反馈ID(102604); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1426,9 +1624,9 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } int num = RandomUtil.randomInt(clueList.size()); - String context = clueList.get(num).getClueTemplate(); + String context = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(num)); //查找符合条件的线索 - clueList=findClues(clueList,locationName); + clueList = findClues(clueList,locationName); if(clueList.size() == 0){ //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102602); @@ -1441,11 +1639,12 @@ public class PlayerServiceImpl implements PlayerService { } int index = RandomUtil.randomInt(clueList.size()); //----------------记录线索-------------- - PlayerUtil.recordClue(uid, subjectId, clueList.get(index).getType(), clueList.get(index)); + PlayerUtil.recordClue(uid, current.getId(), subjectId, clueList.get(index).getType(), clueList.get(index)); + //----------------是否解锁场所------------- + PlayerUtil.unlockLocation(player.getLocationMap(), subject.getLocation()); //获取对应话术 - String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102601); - text = SpeechUtil.replaceHeader(text, current.getName()); - text = SpeechUtil.speechReplaceNum(text, clueList.get(index).getClueTemplate()); + String text = SpeechUtil.getSuccessClueSpeech(uid, current, clueList.get(index)); + text = SpeechUtil.addHeader(text, current.getName()); resultResponse.set反馈ID(102601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1467,23 +1666,12 @@ public class PlayerServiceImpl implements PlayerService { String uid = request.getUid(); String methodId = request.getMethodId(); - String subjectName = request.getSubjectName(); Player player = TimingAcquisition.playerMap.get(uid); //当前对话的人物 Person current = player.getPersonMap().get(player.getPersonId()); request.setOperate(Constants.OPERATE_ASK); if("1027".equals(methodId)){ -// if(StringUtils.isEmpty(subjectName)){ -// return CommonResult.failed("用户名称不能为空!"); -// } -// Integer subjectId = player.getName2IdMap().get(subjectName); -// Person subject =player.getPersonMap().get(subjectId); -// //查找符合条件的线索 -// List clueList = findClues(current, subject,5); -// //检查是否符合阈值要求 -// clueList = checkThreshold(current, clueList); -// if(clueList.size() == 0){ //当前玩家上一轮的请求信息 OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid); if (!StringUtils.isEmpty(lastReq)) { @@ -1499,7 +1687,7 @@ public class PlayerServiceImpl implements PlayerService { CacheUtil.put(uid, request, Long.parseLong(expireTime)); //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102701); - text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.replaceHeader(text, "寒烟"); text = SpeechUtil.speechReplaceNum(text, objectName); resultResponse.set反馈ID(102701); resultResponse.set反馈文本(text); @@ -1512,7 +1700,7 @@ public class PlayerServiceImpl implements PlayerService { if (personIdList.size() == 0) { //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102702); - text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.replaceHeader(text, "寒烟"); resultResponse.set反馈ID(102702); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1527,13 +1715,44 @@ public class PlayerServiceImpl implements PlayerService { CacheUtil.put(uid, request, Long.parseLong(expireTime)); //获取对应话术 String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102701); - text = SpeechUtil.replaceHeader(text, current.getName()); + text = SpeechUtil.replaceHeader(text, "寒烟"); text = SpeechUtil.speechReplaceNum(text, objectName); resultResponse.set反馈ID(102701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //询问攻略提示 + if ("1028".equals(methodId)) { + Map> taskMap = player.getTaskMap(); + //该玩家已完成任务个数 + int num = 0; + for (Map.Entry> mapEntry : taskMap.entrySet()) { + num += mapEntry.getValue().size(); + } + //需要给玩家提示任务线索 + String addText = PlayerUtil.getClueFromTaskKey(uid); + if (!StringUtils.isEmpty(addText)) { + TimingAcquisition.playerMap.get(uid).setTipFlag(false); + TimingAcquisition.playerMap.get(uid).setNumUpdateTime(DateUtil.getCurrentTime()); + TimingAcquisition.playerMap.get(uid).setFinishedTaskNum(num); + resultResponse.set反馈ID(102801); + resultResponse.set反馈文本("【寒烟@正常】" + addText); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + //询问本人地址 + if ("1029".equals(methodId)) { + //获取对应话术 + String text = SpeechUtil.getAskSpeech(Constants.SPEECH_PERSON, 102901); + text = SpeechUtil.replaceHeader(text, "寒烟"); + text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.locationMap.get(player.getLocation()).getName()); + resultResponse.set反馈ID(102901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } return CommonResult.failed("询问提示失败!"); } @@ -1562,33 +1781,33 @@ public class PlayerServiceImpl implements PlayerService { String call = (gender == 1) ? "他" : "她"; //货币配置名称 String moneyName = TimingAcquisition.systemConfigMap.get("money").getValue(); - if(StringUtils.isEmpty(taskConditionId)){ - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(200001); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } +// if(StringUtils.isEmpty(taskConditionId)){ +// //获取对应话术 +// String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200001); +// text = SpeechUtil.replaceHeader(text, subject.getName()); +// resultResponse.set反馈ID(200001); +// resultResponse.set反馈文本(text); +// resultVarsResponse.setVars(resultResponse); +// return CommonResult.success(resultVarsResponse); +// } if("2001".equals(methodId)){ if(!StringUtils.isEmpty(subject)){ List demandTaskList = subject.getDemandTasks(); for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200104); text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, String.valueOf((int) value), moneyName); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), moneyName); resultResponse.set反馈ID(200104); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1596,9 +1815,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition,deterrenceCondition,subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -1612,6 +1829,8 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否已达次数上限 Map> taskMap = player.getTaskMap(); if (taskMap.containsKey(subjectId)) { + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); Map map = taskMap.get(subjectId); if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); @@ -1634,10 +1853,7 @@ public class PlayerServiceImpl implements PlayerService { // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200101); - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200101); - text = SpeechUtil.replaceHeader(personText, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), personText, String.valueOf(value), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1649,10 +1865,7 @@ public class PlayerServiceImpl implements PlayerService { // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200101); - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200101); - text = SpeechUtil.replaceHeader(personText, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), personText, String.valueOf(value), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1677,12 +1890,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -1717,10 +1928,7 @@ public class PlayerServiceImpl implements PlayerService { //ThreadLocalUtil.add(sid,player); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200201); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200201); - text = SpeechUtil.replaceHeader(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1730,10 +1938,7 @@ public class PlayerServiceImpl implements PlayerService { map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200201); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200201); - text = SpeechUtil.replaceHeader(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1756,13 +1961,13 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200303); @@ -1775,9 +1980,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -1791,6 +1994,8 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否已达次数上限 Map> taskMap = player.getTaskMap(); if (taskMap.containsKey(subjectId)) { + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); Map map = taskMap.get(subjectId); if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); @@ -1812,10 +2017,7 @@ public class PlayerServiceImpl implements PlayerService { //ThreadLocalUtil.add(sid,player); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200301); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1826,9 +2028,7 @@ public class PlayerServiceImpl implements PlayerService { addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200301); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); text = SpeechUtil.speechReplaceNum(text, subject.getName()); resultResponse.set反馈ID(200301); resultResponse.set反馈文本(text); @@ -1853,13 +2053,13 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200403); @@ -1872,9 +2072,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -1901,29 +2099,27 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200401); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200401); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1947,12 +2143,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -1984,8 +2178,7 @@ public class PlayerServiceImpl implements PlayerService { addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200501); - text = SpeechUtil.replaceHeader(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -1996,8 +2189,7 @@ public class PlayerServiceImpl implements PlayerService { addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200501); - text = SpeechUtil.replaceHeader(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2020,12 +2212,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2065,10 +2255,7 @@ public class PlayerServiceImpl implements PlayerService { } // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200601); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), demandTask.getDeterrenceDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2082,10 +2269,7 @@ public class PlayerServiceImpl implements PlayerService { } // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200601); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), demandTask.getDeterrenceDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2097,7 +2281,7 @@ public class PlayerServiceImpl implements PlayerService { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200604); text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(200603); + resultResponse.set反馈ID(200604); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); @@ -2108,13 +2292,13 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200703); @@ -2128,9 +2312,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2149,9 +2331,11 @@ public class PlayerServiceImpl implements PlayerService { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 if (num >= Integer.parseInt(condition1[1])) { + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200702); - text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); text += SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200702); text = SpeechUtil.replaceHeader(text, subject.getName()); resultResponse.set反馈ID(200702); @@ -2159,29 +2343,27 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200701); - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200701); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), personText, demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200701); - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200701); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), personText, demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2204,7 +2386,7 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); @@ -2222,9 +2404,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2240,6 +2420,8 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否已达次数上限 Map> taskMap = player.getTaskMap(); if (taskMap.containsKey(subjectId)) { + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); Map map = taskMap.get(subjectId); if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); @@ -2260,10 +2442,7 @@ public class PlayerServiceImpl implements PlayerService { addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200801); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200801); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName(), personText, demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2274,10 +2453,7 @@ public class PlayerServiceImpl implements PlayerService { addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200801); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200801); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName(), personText, demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2300,12 +2476,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2340,10 +2514,7 @@ public class PlayerServiceImpl implements PlayerService { //玩家数据持久化 // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200901); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2355,10 +2526,7 @@ public class PlayerServiceImpl implements PlayerService { //玩家数据持久化 // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 200901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 200901); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(200901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2381,12 +2549,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2406,6 +2572,8 @@ public class PlayerServiceImpl implements PlayerService { value = Integer.parseInt(completionReward); } if (taskMap.containsKey(subjectId)) { + //增加货币 + PlayerUtil.addMoneyNum(sid, value); Map map = taskMap.get(subjectId); if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); @@ -2424,13 +2592,15 @@ public class PlayerServiceImpl implements PlayerService { // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); + for (DemandTaskDto task : demandTaskList) { + if (task.getDemandTaskId() == demandTask.getDemandTaskId()) { + map.put(demandTask.getDemandTaskId(), num + 1); + } + } //玩家数据持久化 // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201001); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), String.valueOf(value)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2439,12 +2609,14 @@ public class PlayerServiceImpl implements PlayerService { // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); + for (DemandTaskDto task : demandTaskList) { + if (task.getDemandTaskId() == demandTask.getDemandTaskId()) { + map.put(demandTask.getDemandTaskId(), 1); + } + } // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201001); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree(), String.valueOf(value)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2467,12 +2639,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2505,10 +2675,7 @@ public class PlayerServiceImpl implements PlayerService { //------玩家数据持久化------ // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201101); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201101); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2520,10 +2687,7 @@ public class PlayerServiceImpl implements PlayerService { //------玩家数据持久化------ // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201101); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201101); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2542,17 +2706,25 @@ public class PlayerServiceImpl implements PlayerService { } }else if("2012".equals(methodId)){ if(!StringUtils.isEmpty(subject)){ - List demandTaskList = subject.getDemandTasks(); + List demandTaskList = PlayerUtil.findDemandsByTaskId(subject, subjectId, taskConditionId); + int count = 0; for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { + count++; + if (count < demandTaskList.size()) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 1) { + continue; + } + } //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201203); @@ -2563,9 +2735,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2579,6 +2749,8 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否已达次数上限 Map> taskMap = player.getTaskMap(); if (taskMap.containsKey(subjectId)) { + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); Map map = taskMap.get(subjectId); if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); @@ -2599,10 +2771,7 @@ public class PlayerServiceImpl implements PlayerService { addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201201); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201201); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2613,10 +2782,7 @@ public class PlayerServiceImpl implements PlayerService { addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201201); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201201); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2639,13 +2805,13 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201303); @@ -2660,9 +2826,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2689,29 +2853,27 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201301); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201301); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2734,13 +2896,13 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201403); @@ -2752,9 +2914,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2781,30 +2941,28 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201401); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); //-------玩家数据持久化-------- // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201401); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2827,13 +2985,13 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201503); @@ -2845,9 +3003,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2876,30 +3032,28 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); //------玩家数据持久化-------- // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201501); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201501); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201501); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201501); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(value), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -2922,13 +3076,13 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201603); @@ -2941,9 +3095,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -2970,31 +3122,29 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); //------玩家数据持久化------ // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201601); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); //------玩家数据持久化------ // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201601); - text = SpeechUtil.speechReplaceNum(text, String.valueOf(value), subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3017,12 +3167,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3055,11 +3203,7 @@ public class PlayerServiceImpl implements PlayerService { //------玩家数据持久化------- // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201701); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201701); - text = SpeechUtil.speechReplaceNum(text, personText, subject.getName(), call, - demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3071,11 +3215,7 @@ public class PlayerServiceImpl implements PlayerService { //------玩家数据持久化------- // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201701); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201701); - text = SpeechUtil.speechReplaceNum(text, personText, subject.getName(), call, - demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3098,12 +3238,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3136,10 +3274,7 @@ public class PlayerServiceImpl implements PlayerService { //-----玩家数据持久化----- // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201801); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201801); - text = SpeechUtil.speechReplaceNum(personText, subject.getName(), call, demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3151,10 +3286,7 @@ public class PlayerServiceImpl implements PlayerService { //-----玩家数据持久化----- // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String personText = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201801); - personText = SpeechUtil.replaceHeader(personText, subject.getName()); - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201801); - text = SpeechUtil.speechReplaceNum(personText, subject.getName(), call, demandTask.getDeterrenceDegree(), demandTask.getTrustDegree()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3177,12 +3309,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3215,10 +3345,7 @@ public class PlayerServiceImpl implements PlayerService { //------玩家数据持久化------- // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201901); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3231,10 +3358,7 @@ public class PlayerServiceImpl implements PlayerService { // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //ThreadLocalUtil.add(sid,player); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 201901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text += SpeechUtil.getTaskSpeech(Constants.SPEECH_ASIDE, 201901); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(201901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3257,12 +3381,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3280,7 +3402,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202002); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -3295,15 +3417,17 @@ public class PlayerServiceImpl implements PlayerService { if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } + //最终任务完成 + player.setFinished(1); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //最终任务完成 + player.setFinished(1); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); @@ -3311,9 +3435,7 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3336,12 +3458,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3359,7 +3479,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202102); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -3368,6 +3488,8 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //最终任务完成 + player.setFinished(1); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); @@ -3375,14 +3497,14 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202101); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //最终任务完成 + player.setFinished(1); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); @@ -3390,9 +3512,7 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202101); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3415,12 +3535,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3438,7 +3556,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202202); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -3447,6 +3565,8 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //最终任务完成 + player.setFinished(1); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); @@ -3454,14 +3574,14 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202201); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //最终任务完成 + player.setFinished(1); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); @@ -3469,9 +3589,7 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202201); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3494,12 +3612,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3517,7 +3633,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202302); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -3526,6 +3642,8 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //最终任务完成 + player.setFinished(1); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); @@ -3533,14 +3651,14 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //最终任务完成 + player.setFinished(1); // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); addThreshold(subject, demandTask); @@ -3548,9 +3666,7 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3573,17 +3689,18 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否满足货币消费条件 String condition2 = demandTask.getCondition2(); - double value = 0.0; + int value = 0; if (!StringUtils.isEmpty(condition2)) { - value = Double.parseDouble(condition2); + value = Integer.parseInt(condition2); if (player.getCurrency() < value) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202403); text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); resultResponse.set反馈ID(202403); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3591,9 +3708,7 @@ public class PlayerServiceImpl implements PlayerService { } } // 2. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3611,7 +3726,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(condition1[1])) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202402); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -3632,9 +3747,7 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, TimingAcquisition.getNameByPersonId(sid, demandTask.getObject())); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3651,9 +3764,7 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3676,12 +3787,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3698,69 +3807,30 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否完成后置任务 if (taskMap.containsKey(subjectId)) { Map subjectMap = taskMap.get(subjectId); - int num = subjectMap.get(demandTask.getDemandTaskId()); - //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202502); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202502); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - if (!StringUtils.isEmpty(demandTask.getPostTask())) { - if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { - String[] postTasks = demandTask.getPostTask().split("\\|"); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= demandTask.getEffectiveDegree()) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202502); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202502); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202501); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), call); - resultResponse.set反馈ID(202501); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } - //符合阈值需求,后置任务没有完成 //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202503); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202503); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202501); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); - resultResponse.set反馈ID(202501); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(202501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); @@ -3775,6 +3845,29 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(202501); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202503); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202503); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -3793,12 +3886,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3815,68 +3906,29 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否完成后置任务 if (taskMap.containsKey(subjectId)) { Map subjectMap = taskMap.get(subjectId); - int num = subjectMap.get(demandTask.getDemandTaskId()); - //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202602); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202602); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - if (!StringUtils.isEmpty(demandTask.getPostTask())) { - if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { - String[] postTasks = demandTask.getPostTask().split("\\|"); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= demandTask.getEffectiveDegree()) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202602); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202602); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); - resultResponse.set反馈ID(202601); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202603); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202603); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -3892,6 +3944,32 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } } + String[] postTasks = demandTask.getPostTask().split("\\|"); + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + for (String postTask : postTasks) { + if (objectMap.containsKey(Integer.parseInt(postTask))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(202601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } } } } @@ -3910,12 +3988,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -3932,70 +4008,29 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否完成后置任务 if (taskMap.containsKey(subjectId)) { Map subjectMap = taskMap.get(subjectId); - int num = subjectMap.get(demandTask.getDemandTaskId()); - //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202702); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202702); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - if (!StringUtils.isEmpty(demandTask.getPostTask())) { - if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { - String[] postTasks = demandTask.getPostTask().split("\\|"); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= demandTask.getEffectiveDegree()) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202702); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202702); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202701); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); - resultResponse.set反馈ID(202701); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202703); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202703); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } - List list = new ArrayList<>(); - list.add(demandTask); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202701); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4011,6 +4046,31 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + List list = new ArrayList<>(); + list.add(demandTask); + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(202701); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202703); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202703); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -4030,12 +4090,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4052,68 +4110,29 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否完成后置任务 if (taskMap.containsKey(subjectId)) { Map subjectMap = taskMap.get(subjectId); - int num = subjectMap.get(demandTask.getDemandTaskId()); - //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202802); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202802); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - if (!StringUtils.isEmpty(demandTask.getPostTask())) { - if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { - String[] postTasks = demandTask.getPostTask().split("\\|"); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= demandTask.getEffectiveDegree()) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202802); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202802); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202801); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); - resultResponse.set反馈ID(202801); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202803); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202803); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202801); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4129,6 +4148,29 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(202801); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -4147,12 +4189,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4167,70 +4207,29 @@ public class PlayerServiceImpl implements PlayerService { //2.符合阈值需求,判断是否完成后置任务 if (taskMap.containsKey(subjectId)) { Map subjectMap = taskMap.get(subjectId); - int num = subjectMap.get(demandTask.getDemandTaskId()); - //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202902); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202902); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - if (!StringUtils.isEmpty(demandTask.getPostTask())) { - if (!subjectMap.containsKey(demandTask.getDemandTaskId())) { - String[] postTasks = demandTask.getPostTask().split("\\|"); + if (subjectMap.containsKey(demandTask.getDemandTaskId())) { + int num = subjectMap.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + if (num >= demandTask.getEffectiveDegree()) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202902); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202902); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + if (!StringUtils.isEmpty(demandTask.getPostTask())) { Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - call, demandTask.getCompletionReward(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); - resultResponse.set反馈ID(202901); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202903); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(202903); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - call, demandTask.getCompletionReward(), String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(202901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4246,6 +4245,29 @@ public class PlayerServiceImpl implements PlayerService { return CommonResult.success(resultVarsResponse); } } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(202901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 202903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(202903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -4264,12 +4286,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4287,7 +4307,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203002); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -4298,17 +4318,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4316,17 +4331,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4335,6 +4345,14 @@ public class PlayerServiceImpl implements PlayerService { } } } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203004); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName()); + resultResponse.set反馈ID(203004); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } }else if("2031".equals(methodId)){ if(!StringUtils.isEmpty(subject)){ @@ -4342,12 +4360,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4365,7 +4381,7 @@ public class PlayerServiceImpl implements PlayerService { if (subjectMap.containsKey(demandTask.getDemandTaskId())) { int num = subjectMap.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203102); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -4374,57 +4390,16 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203101); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), - String.valueOf(deterrenceDegree), demandTask.getCompletionReward()); - resultResponse.set反馈ID(203101); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203103); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(203103); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203101); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), String.valueOf(trustDegree), - String.valueOf(deterrenceDegree), demandTask.getCompletionReward()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4439,7 +4414,29 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(203101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -4458,12 +4455,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4483,7 +4478,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203202); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -4494,18 +4489,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203201); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4513,18 +4502,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203201); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203201); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4547,12 +4530,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4570,7 +4551,7 @@ public class PlayerServiceImpl implements PlayerService { if (subjectMap.containsKey(demandTask.getDemandTaskId())) { int num = subjectMap.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203302); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -4579,59 +4560,16 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); - resultResponse.set反馈ID(203301); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203303); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(203303); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203301); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203301); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4646,6 +4584,29 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(203301); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203303); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203303); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -4664,12 +4625,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4689,7 +4648,7 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203402); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -4700,18 +4659,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4719,18 +4672,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203401); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), call, - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203401); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4753,12 +4700,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4778,16 +4723,13 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (num >= demandTask.getEffectiveDegree()) { addThreshold(subject, demandTask); //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203502); text = SpeechUtil.replaceHeader(text, subject.getName()); text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + String.valueOf(subject.getTrustDegree()), String.valueOf(subject.getDeterrenceDegree()), demandTask.getCompletionReward()); resultResponse.set反馈ID(203502); resultResponse.set反馈文本(text); @@ -4804,11 +4746,7 @@ public class PlayerServiceImpl implements PlayerService { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203501); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4816,19 +4754,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(),1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject,demandTask); if(!StringUtils.isEmpty(demandTask.getCompletionReward())){ player.setCurrency(player.getCurrency()+Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203501); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203501); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4851,12 +4782,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4875,73 +4804,27 @@ public class PlayerServiceImpl implements PlayerService { int num = subjectMap.get(demandTask.getDemandTaskId()); Integer objectId = demandTask.getObject(); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203602); text = SpeechUtil.replaceHeader(text, subject.getName()); text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), + String.valueOf(subject.getTrustDegree()), String.valueOf(subject.getDeterrenceDegree()), demandTask.getCompletionReward()); resultResponse.set反馈ID(203602); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); - resultResponse.set反馈ID(203601); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203603); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(203603); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203601); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203601); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -4956,6 +4839,29 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(203601); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203603); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203603); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -4974,12 +4880,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -4997,15 +4901,12 @@ public class PlayerServiceImpl implements PlayerService { if (map.containsKey(demandTask.getDemandTaskId())) { int num = map.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203702); text = SpeechUtil.replaceHeader(text, subject.getName()); text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String.valueOf(subject.getTrustDegree()), String.valueOf(subject.getDeterrenceDegree())); resultResponse.set反馈ID(203702); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -5013,18 +4914,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203701); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, call, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -5032,18 +4927,12 @@ public class PlayerServiceImpl implements PlayerService { } // 3.信任阈值提升 map.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203701); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, call, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203701); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -5066,12 +4955,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -5089,7 +4976,7 @@ public class PlayerServiceImpl implements PlayerService { if (subjectMap.containsKey(demandTask.getDemandTaskId())) { int num = subjectMap.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203802); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -5098,57 +4985,16 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203801); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); - resultResponse.set反馈ID(203801); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203803); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(203803); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203801); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -5156,14 +5002,36 @@ public class PlayerServiceImpl implements PlayerService { } //符合阈值需求,后置任务没有完成 //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203803); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(203803); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(203801); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203803); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203803); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -5182,12 +5050,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -5205,7 +5071,7 @@ public class PlayerServiceImpl implements PlayerService { if (subjectMap.containsKey(demandTask.getDemandTaskId())) { int num = subjectMap.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203902); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -5214,57 +5080,16 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); - resultResponse.set反馈ID(203901); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203903); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(203903); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203901); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(203901); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -5279,6 +5104,29 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(203901); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 203903); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(203903); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -5297,12 +5145,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -5320,7 +5166,7 @@ public class PlayerServiceImpl implements PlayerService { if (subjectMap.containsKey(demandTask.getDemandTaskId())) { int num = subjectMap.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204002); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -5331,59 +5177,16 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - demandTask.getCompletionReward(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); - resultResponse.set反馈ID(204001); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - //符合阈值需求,后置任务没有完成 - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204003); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(204003); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); - } - } - String[] postTasks = demandTask.getPostTask().split("\\|"); - Integer objectId = demandTask.getObject(); - Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); addThreshold(subject, demandTask); if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204001); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), PlayerUtil.getNameByPersonId(sid, objectId), - demandTask.getCompletionReward(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree)); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); resultResponse.set反馈ID(204001); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); @@ -5398,6 +5201,29 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + Integer objectId = demandTask.getObject(); + Map objectMap = taskMap.get(objectId); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(204001); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204003); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204003); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } } } @@ -5416,12 +5242,10 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (subjectId.equals(demandTask.getSubject())) { String[] condition1 = demandTask.getCondition1().split("\\|"); - if (taskConditionId.equals(condition1[0])) { + if (taskConditionId.equals(condition1[0]) && demandTask.getClueSwitch() != 1) { //条件判断 // 1. 判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); - boolean flag = checkThreshold(trustCondition, deterrenceCondition, subject); + boolean flag = checkThreshold(demandTask, subject); //不符合阈值需求 if (!flag) { //获取对应话术 @@ -5439,7 +5263,7 @@ public class PlayerServiceImpl implements PlayerService { if (subjectMap.containsKey(demandTask.getDemandTaskId())) { int num = subjectMap.get(demandTask.getDemandTaskId()); //符合阈值需求,已达次数上限 - if (num >= Integer.parseInt(demandTask.getEffectiveDegree())) { + if (num >= demandTask.getEffectiveDegree()) { //获取对应话术 String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204102); text = SpeechUtil.replaceHeader(text, subject.getName()); @@ -5448,69 +5272,144 @@ public class PlayerServiceImpl implements PlayerService { resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), num + 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); - } - //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204101); - text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); - resultResponse.set反馈ID(204101); - resultResponse.set反馈文本(text); - resultVarsResponse.setVars(resultResponse); - return CommonResult.success(resultVarsResponse); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); } - //符合阈值需求,后置任务没有完成 //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204103); - text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(204103); + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(204101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } - String[] postTasks = demandTask.getPostTask().split("\\|"); Integer objectId = demandTask.getObject(); Map objectMap = taskMap.get(objectId); - for (String postTask : postTasks) { - if (objectMap.containsKey(Integer.parseInt(postTask))) { - subjectMap.put(demandTask.getDemandTaskId(), 1); - int trustDegree = subject.getTrustDegree(); - int deterrenceDegree = subject.getDeterrenceDegree(); - double currency = player.getCurrency(); - addThreshold(subject, demandTask); - if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { - player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + if (objectMap.containsKey(Integer.parseInt(demandTask.getPostTask()))) { + subjectMap.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); + if (!StringUtils.isEmpty(demandTask.getCompletionReward())) { + player.setCurrency(player.getCurrency() + Double.parseDouble(demandTask.getCompletionReward())); + } + //获取对应话术 + String text = SpeechUtil.getSuccessTaskSpeech(sid, subject, demandTask); + resultResponse.set反馈ID(204101); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + //符合阈值需求,后置任务没有完成 + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + } + } + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204105); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(204105); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } else if ("2101".equals(methodId)) { + if(!StringUtils.isEmpty(subject)){ + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String taskName = demandTask.getName(); + if (taskName.contains("买") || taskName.contains("获赠")) { + //条件判断 + // 1. 判断是否满足货币消费条件 + String condition2 = demandTask.getCondition2(); + int value = 0; + if (!StringUtils.isEmpty(condition2)) { + value = Integer.parseInt(condition2); + if (player.getCurrency() < value) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 210103); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, String.valueOf(value)); + resultResponse.set反馈ID(210103); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } + } + // 2. 判断是否符合阈值需求 + boolean flag = checkThreshold(demandTask, subject); + //不符合阈值需求 + if (!flag) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 210104); + text = SpeechUtil.replaceHeader(text, subject.getName()); + resultResponse.set反馈ID(210104); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); + } else { + //2.符合阈值需求,判断是否已达次数上限 + Map> taskMap = player.getTaskMap(); + if (taskMap.containsKey(subjectId)) { + Map map = taskMap.get(subjectId); + if (map.containsKey(demandTask.getDemandTaskId())) { + int num = map.get(demandTask.getDemandTaskId()); + //符合阈值需求,已达次数上限 + String[] condition1 = demandTask.getCondition1().split("\\|"); + if (num >= Integer.parseInt(condition1[1])) { + //获取对应话术 + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 210102); + text = SpeechUtil.replaceHeader(text, subject.getName()); + text = SpeechUtil.speechReplaceNum(text, subject.getName(), text); + resultResponse.set反馈ID(210102); + resultResponse.set反馈文本(text); + resultVarsResponse.setVars(resultResponse); + return CommonResult.success(resultVarsResponse); } + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), num + 1); + addThreshold(subject, demandTask); + //ThreadLocalUtil.add(sid,player); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204101); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 210101); text = SpeechUtil.replaceHeader(text, subject.getName()); - text = SpeechUtil.speechReplaceNum(text, subject.getName(), - String.valueOf(trustDegree), String.valueOf(deterrenceDegree), - demandTask.getCompletionReward()); - resultResponse.set反馈ID(204101); + resultResponse.set反馈ID(210101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } - //符合阈值需求,后置任务没有完成 + //扣除货币 + PlayerUtil.updateMoneyNum(sid, value); + // 3.信任阈值提升 + map.put(demandTask.getDemandTaskId(), 1); + addThreshold(subject, demandTask); +// PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204103); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 210101); text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(204103); + resultResponse.set反馈ID(210101); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); @@ -5520,13 +5419,115 @@ public class PlayerServiceImpl implements PlayerService { } } //获取对应话术 - String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 204105); + String text = SpeechUtil.getTaskSpeech(Constants.SPEECH_PERSON, 210105); text = SpeechUtil.replaceHeader(text, subject.getName()); - resultResponse.set反馈ID(204105); + resultResponse.set反馈ID(210105); resultResponse.set反馈文本(text); resultVarsResponse.setVars(resultResponse); return CommonResult.success(resultVarsResponse); } + } else if ("2104".equals(methodId)) { + if(!StringUtils.isEmpty(subject)) { + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + //催账完成 + if ("70031".equals(condition1[0])) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 1) { + continue; + } + request.setMethodId("2029"); + request.setTaskConditionId("70031"); + return performTask(request); + } + //催账 + if ("70032".equals(condition1[0])) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 1) { + continue; + } + request.setMethodId("2030"); + request.setTaskConditionId("70032"); + return performTask(request); + } + } + } + } + } else if ("2106".equals(methodId)) { + if(!StringUtils.isEmpty(subject)) { + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + //探听身家 + if ("70021".equals(condition1[0])) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 0) { + request.setMethodId("2019"); + request.setTaskConditionId("70021"); + return performTask(request); + } + } + //打探肥羊完成 + if ("70030".equals(condition1[0])) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 0) { + request.setMethodId("2028"); + request.setTaskConditionId("70030"); + return performTask(request); + } + } + //打探隐私完成 + if ("70035".equals(condition1[0])) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 0) { + request.setMethodId("2032"); + request.setTaskConditionId("70035"); + return performTask(request); + } + } + //打探隐私完成 + if ("70036".equals(condition1[0])) {int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 0) { + request.setMethodId("2034"); + request.setTaskConditionId("70036"); + return performTask(request); + } + } + } + } + } + } else if ("2107".equals(methodId)) { + if(!StringUtils.isEmpty(subject)) { + List demandTaskList = subject.getDemandTasks(); + for (DemandTaskDto demandTask : demandTaskList) { + if (subjectId.equals(demandTask.getSubject())) { + String[] condition1 = demandTask.getCondition1().split("\\|"); + //证据账本完成 + if ("70038".equals(condition1[0])) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 1) { + continue; + } + request.setMethodId("2036"); + request.setTaskConditionId("70038"); + return performTask(request); + } + //证据账本 + if ("70039".equals(condition1[0])) { + int taskStatus = PlayerUtil.checkTaskStatus(sid, subjectId, demandTask.getDemandTaskId()); + if (taskStatus == 1) { + continue; + } + request.setMethodId("2037"); + request.setTaskConditionId("70039"); + return performTask(request); + } + } + } + } } // PersistenceUtil.saveDataToFile(userFilePath, sid, JSON.toJSONString(player)); return CommonResult.failed("任务执行失败!"); @@ -5546,29 +5547,29 @@ public class PlayerServiceImpl implements PlayerService { for (DemandTaskDto demandTask : demandTaskList) { if (type == 1) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String trustDegree = demandTask.getTrustDegree(); - if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) > 0) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree > 0) { result.add(demandTask); } } } else if (type == 2) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String trustDegree = demandTask.getTrustDegree(); - if (!StringUtils.isEmpty(trustDegree) && Integer.parseInt(trustDegree) < 0) { + int trustDegree = demandTask.getTrustDegree(); + if (!StringUtils.isEmpty(trustDegree) && trustDegree < 0) { result.add(demandTask); } } } else if (type == 3) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String deterrenceDegree = demandTask.getDeterrenceDegree(); - if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) > 0) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree > 0) { result.add(demandTask); } } } else if (type == 4) { if (Objects.equals(demandTask.getSubject(), person.getId())) { - String deterrenceDegree = demandTask.getDeterrenceDegree(); - if (!StringUtils.isEmpty(deterrenceDegree) && Integer.parseInt(deterrenceDegree) < 0) { + int deterrenceDegree = demandTask.getDeterrenceDegree(); + if (!StringUtils.isEmpty(deterrenceDegree) && deterrenceDegree < 0) { result.add(demandTask); } } @@ -5682,7 +5683,7 @@ public class PlayerServiceImpl implements PlayerService { if(clue.getClueName().equals("追回失踪的货款")&&type==9&&subject.getId()==1){ System.out.println("----------"); } - if(type.equals(clue.getType()) && clue.getSubject().equals(subject.getId())){ + if(type.equals(clue.getType()) && clue.getSubject() == subject.getId()){ result.add(clue); } } @@ -5704,7 +5705,8 @@ public class PlayerServiceImpl implements PlayerService { for (int i= 0;i result = new ArrayList<>(); for (DemandTaskDto demandTask : demandTaskList) { //判断是否符合阈值需求 - String trustCondition = demandTask.getTrustCondition(); - String deterrenceCondition = demandTask.getDeterrenceCondition(); boolean flag = true; - if (!StringUtils.isEmpty(trustCondition)) { - String[] trustConditions = trustCondition.split("\\|"); - if (!NumberUtil.inNumRange(person.getTrustDegree(), "[" + trustConditions[0] + "," + trustConditions[1] + "]")) { - flag = false; - } + if (!NumberUtil.inNumRange(person.getTrustDegree(), "[" + demandTask.getTrustStart() + "," + demandTask.getTrustEnd() + "]")) { + flag = false; } - if (!StringUtils.isEmpty(deterrenceCondition)) { - String[] deterrenceConditions = deterrenceCondition.split("\\|"); - if (!NumberUtil.inNumRange(person.getDeterrenceDegree(), "[" + deterrenceConditions[0] + "," + deterrenceConditions[1] + "]")) { - flag = false; - } + if (!NumberUtil.inNumRange(person.getDeterrenceDegree(), "[" + demandTask.getDeterrenceStart() + "," + demandTask.getDeterrenceEnd() + "]")) { + flag = false; } if (flag) { //符合阈值要求 result.add(demandTask); @@ -5813,23 +5807,23 @@ public class PlayerServiceImpl implements PlayerService { /** * 判断是否符合阈值需求 - * @param trustCondition - * @param deterrenceCondition + * @param demandTask * @param subject * @return */ - private boolean checkThreshold(String trustCondition,String deterrenceCondition,Person subject){ + private boolean checkThreshold(DemandTaskDto demandTask, Person subject){ boolean flag = false; - if(!StringUtils.isEmpty(trustCondition)){ - String[] trustConditions = trustCondition.split("\\|"); - if(NumberUtil.inNumRange(subject.getTrustDegree(),"["+trustConditions[0]+","+trustConditions[1]+"]")){ - flag = true; + //任务无需解锁或者任务已解锁 + if (demandTask.getClueSwitch() == 0 || demandTask.getClueSwitch() == 2) { + if(demandTask.getTrustStart() >=0 && demandTask.getTrustEnd() > 0) { + if(NumberUtil.inNumRange(subject.getTrustDegree(),"["+demandTask.getTrustStart()+","+demandTask.getTrustEnd()+"]")) { + flag = true; + } } - } - if(!StringUtils.isEmpty(deterrenceCondition)){ - String[] deterrenceConditions = deterrenceCondition.split("\\|"); - if(NumberUtil.inNumRange(subject.getDeterrenceDegree(),"["+deterrenceConditions[0]+","+deterrenceConditions[1]+"]")){ - flag = true; + if(demandTask.getDeterrenceStart() >= 0 && demandTask.getDeterrenceEnd() > 0) { + if(NumberUtil.inNumRange(subject.getDeterrenceDegree(),"["+demandTask.getDeterrenceStart()+","+demandTask.getDeterrenceEnd()+"]")) { + flag = true; + } } } return flag; diff --git a/src/main/resources/application-pro.yml b/src/main/resources/application-pro.yml index e69de29..10a7bd1 100644 --- a/src/main/resources/application-pro.yml +++ b/src/main/resources/application-pro.yml @@ -0,0 +1,35 @@ +server: + port: 60018 + serlvet: + context-type:/inference + +#设置当前服务名 +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/inference_game?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC + username: root + password: dgKNTmt2iLHNjEQajkDEZkq8 + type: com.alibaba.druid.pool.DruidDataSource + druid: + initial-size: 5 + min-idle: 5 + max-active: 20 + max-wait: 60000 + #配置间隔多久才进行一次检测,检测需要关闭的空闲连接 + time-between-eviction-runs-millis: 20000 + #配置一个连接在池中最小生存的时间 + min-evictable-idle-time-millis: 300000 + +#对话过期时间 +expireTime: 180000 + +#玩家无操作时长,默认下线 +offlineTime: 180000 + +speechFilePath: /home/jiaoyou/projects/inferenceGame/speech/ + +configFilePath: /home/jiaoyou/projects/inferenceGame/config/ + +userFilePath: /home/jiaoyou/projects/inferenceGame/user/ + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index caf4dfc..fc3033b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: dev \ No newline at end of file + active: pro \ No newline at end of file diff --git a/src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml b/src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml index 80e13df..5bf41ea 100755 --- a/src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml +++ b/src/main/resources/com/qiwu/inference/dao/EndGoalMapper.xml @@ -8,8 +8,12 @@ + + diff --git a/src/main/resources/speech/ask.yaml b/src/main/resources/speech/ask.yaml index 09e4e2a..2baabcb 100755 --- a/src/main/resources/speech/ask.yaml +++ b/src/main/resources/speech/ask.yaml @@ -14,6 +14,8 @@ aside: - 【旁白@正常】您想打听什么身份呢。 100007: - 【旁白@正常】您想打听什么地方呢。 + 100008: + - 【旁白@正常】现在没有这个人哦。 #1001: 询问A的性格 100101: - 【旁白@正常】【1】。 @@ -171,7 +173,7 @@ person: 10010201: - 【人物名称@正常】我又不认识你,为什么要告诉你关于我的事。 100103: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】的性格。 100104: - 【人物名称@正常】 100105: @@ -186,9 +188,9 @@ person: 100203: - 【人物名称@正常】我又不认识你,为什么要告诉你? 10020301: - - 【人物名称@正常】我又不认识你,为什么要告诉你我喜欢什么? + - 【人物名称@正常】我又不认识你,为什么要告诉你我的事? 100204: - - 【人物名称@正常】不好意思,我不知道。 + - 【人物名称@正常】不好意思,我不知道【1】的性格。 #1003: 询问A和B是什么关系 100301: - 【人物名称@正常】【1】 @@ -197,7 +199,7 @@ person: 10030201: - 【人物名称@正常】我又不认识你,为什么要告诉你我们的关系? 100303: - - 【人物名称@正常】不好意思,我不知道。 + - 【人物名称@正常】不好意思,我不知道他们的关系。 10030301: - 【人物名称@正常】【1】吗?我好像不认识这个人啊 #1004: 询问A和B是不是某个关系 @@ -208,42 +210,42 @@ person: 100403: - 【人物名称@正常】我又不认识你,为什么要告诉你? 100404: - - 【人物名称@正常】不好意思,我不知道。 + - 【人物名称@正常】不好意思,我不知道他们的关系。 #1005: 询问和A有某个关系的人是谁 100501: - 【人物名称@正常】【1】 100502: - 【人物名称@正常】我又不认识你,为什么要告诉你? 100503: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】【2】是谁。 #1006: 询问谁和谁有某个关系 100601: - 【人物名称@正常】【1】 100602: - 【人物名称@正常】我又不认识你,为什么要告诉你? 100603: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道有【1】关系的人。 #1007: 询问A有过什么行为 100701: - 【人物名称@正常】【1】 100702: - 【人物名称@正常】我又不认识你,为什么要告诉你? 100703: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】干过什么。 #1008: 询问A和B有什么行为 100801: - 【人物名称@正常】【1】 100802: - 【人物名称@正常】我又不认识你,为什么要告诉你? 100803: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道他们干过什么。 #1009: 询问A和谁有了某个行为 100901: - 【人物名称@正常】【1】 100902: - 【人物名称@正常】我又不认识你,为什么要告诉你? 100903: - - 【人物名称@正常】不好意思,我不知道。 + - 【人物名称@正常】不好意思,我不知道【1】和谁【2】了。 #1010: 询问A有没有发生过某个行为 101001: - 【人物名称@正常】是的,【1】 @@ -252,7 +254,7 @@ person: 101003: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101004: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】有没有【2】过。 #1011: 询问A和B有没有发生过某个行为 101101: - 【人物名称@正常】是的,【1】 @@ -261,14 +263,14 @@ person: 101103: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101104: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道他们有没有【1】过。 #1012: 询问A知道/看见了B和C的什么行为 101201: - 【人物名称@正常】【1】 101202: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101203: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道。 #1013: 询问A有没有看到B和C发生了某个行为 101301: - 【人物名称@正常】是的,【1】 @@ -284,21 +286,23 @@ person: 101402: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101403: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】。 #1015: 询问A的提升信任度任务 101501: - 【人物名称@正常】【1】 101502: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101503: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】你想知道的我都已经告诉过你了。 + 101504: + - 【人物名称@正常】不好意思,我不知道【1】想干什么。 #1016: 询问A的提升威慑度任务 101601: - 【人物名称@正常】【1】 101602: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101603: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】怕什么。 #1017: 询问A是否有某个提升信任度的任务 101701: - 【人物名称@正常】是的,【1】 @@ -307,7 +311,7 @@ person: 101703: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101704: - - 【人物名称@正常】不好意思,我不知道。 + - 【人物名称@正常】不好意思,我不知道可不可以。 #1018: 询问A是否有某个提升威慑度的任务 101801: - 【人物名称@正常】是的,【1】 @@ -316,21 +320,21 @@ person: 101803: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101804: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道这样【1】会不会怕你。 #1019: 询问A降低信任度的任务 101901: - 【人物名称@正常】【1】 101902: - 【人物名称@正常】我又不认识你,为什么要告诉你? 101903: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道这样【1】会不会不喜欢你。 #1020: 询问A降低威慑度的任务 102001: - 【人物名称@正常】【1】 102002: - 【人物名称@正常】我又不认识你,为什么要告诉你? 102003: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】会不会对你改观。 #1021: 询问A是否有某个降低信任度的任务 102101: - 【人物名称@正常】是的,【1】 @@ -339,7 +343,7 @@ person: 102103: - 【人物名称@正常】我又不认识你,为什么要告诉你? 102104: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道这样【1】会不会不喜欢你。 #1022: 询问A是否有某个降低威慑度的任务 102201: - 【人物名称@正常】是的,【1】 @@ -348,28 +352,30 @@ person: 102203: - 【人物名称@正常】我又不认识你,为什么要告诉你? 102204: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道能不能让【1】不讨厌你。 #1023: 询问A是什么身份 102301: - 【人物名称@正常】【1】 102302: - 【人物名称@正常】我又不认识你,为什么要告诉你? 102303: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】的身份。 #1024: 询问A是不是某个身份 102401: - 【人物名称@正常】是的,【1】 102402: - 【人物名称@正常】不是,【1】 102403: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】我又不认识你,为什么要告诉你? + 102404: + - 【人物名称@正常】不好意思,我不知道是不是【1】。 #1025: 询问A在哪个场所 102501: - 【人物名称@正常】【1】 102502: - 【人物名称@正常】我又不认识你,为什么要告诉你? 102503: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】在哪。 #1026: 询问A是不是在某个场所 102601: - 【人物名称@正常】是的,【1】 @@ -378,9 +384,17 @@ person: 102603: - 【人物名称@正常】我又不认识你,为什么要告诉你? 102604: - - 【人物名称@正常】不好意思,我不知道 + - 【人物名称@正常】不好意思,我不知道【1】在哪。 #1027: 询问提示 102701: - 【人物名称@正常】你可以去问问【1】,他可能知道点什么。 102702: - 【人物名称@正常】抱歉,爱莫能助。 + #1029: 询问玩家所在场所 + 102901: + - 【人物名称@正常】主人,我们在【1】呀。 + #1030: 搭档说话 + 103001: + - 【寒烟@正常】这个县城里有各色各样的人物,您可以试着从打招呼、送小费开始,到帮助对方解决麻烦,来拉进和对方的关系,或者使用暴力,让对方畏惧于你,以逐步挖掘更深的线索,并最终找出目标。如果一开始没有头绪,少主也可以四处走走,多跟人聊聊天,搜集一下信息。您想去哪里或者找谁,直接说就好。如果发现了任何蛛丝马迹,我会及时提醒少主的。另外,关于人物、地点和关系,如果少主不记得了,也可以随时向我提问。 + 103002: + - 【寒烟@正常】我们现在在【1】,看到【2】了,我们过去打个招呼吧。 diff --git a/src/main/resources/speech/barrier.yaml b/src/main/resources/speech/barrier.yaml index 0eb4297..5b5f4e8 100644 --- a/src/main/resources/speech/barrier.yaml +++ b/src/main/resources/speech/barrier.yaml @@ -4,13 +4,15 @@ aside: - 【旁白@正常】好的,已为您取消操作。 #4001: 场所移动 400101: - - 【旁白@正常】您来到了【1】,【2】在这里,他对你微笑点头。 + - 【旁白@正常】您来到了【1】,【2】在这里,【3】对你微笑点头。 400102: - 【旁白@正常】还不知道这个地方在哪,找个人问问吧。 400103: - 【旁白@正常】不知道您说的这个地方在哪呢。 400104: - 【旁白@正常】这个地方没有你要找的人。 + 400105: + - 【旁白@正常】你想要去哪里呢?目前已知场所有:【1】。 #4002: 开启对话 400201: - 【旁白@正常】【1】当前线索有:【2】,您要详细查看哪一类的线索呢? @@ -43,9 +45,9 @@ aside: person: #4001: 场所移动 400101: - - 【人物名称@正常】 + - 【人物名称@正常】听说你已经把事办好了,不错不错。 400102: - - 【人物名称@正常】 + - 【人物名称@正常】那件事办好了吗? #4002: 开启对话 400201: - 【人物名称@正常】【1】 diff --git a/src/main/resources/speech/check.yaml b/src/main/resources/speech/check.yaml index ab25cd5..9b90051 100644 --- a/src/main/resources/speech/check.yaml +++ b/src/main/resources/speech/check.yaml @@ -10,13 +10,13 @@ aside: 30010102: - 【旁白@正常】当前已知人物有:【1】,需要查看【2】的详情呢? 300102: - - 【旁白@正常】【1】,年龄【2】,性别【3】,【4】对你的信任度为:【5】、威慑度为:【6】,要查看他的相关线索吗? + - 【旁白@正常】【1】,年龄【2】,性别【3】,【4】对你的信任度为:【5】、威慑度为:【6】,要查看【4】的相关线索吗? 30010201: - 【旁白@正常】【1】,年龄不详,性别不明,可以去找找这个人。 300103: - 【旁白@正常】【1】当前线索有:【2】,您要详细查看哪一类的线索呢? 30010301: - - 【旁白@正常】您还告诉我想看哪个人的线索呢。 + - 【旁白@正常】您没还告诉我想看哪个人的线索呢。 30010302: - 【旁白@正常】您只见过这个人,还没有收集到线索。 300104: @@ -51,7 +51,7 @@ aside: 30050501: - 【旁白@正常】您当前还没有【1】线索。 300506: - - 【旁白@正常】【1】的【2】线索共【3】条,第【4】条:【5】。 + - 【旁白@正常】【1】的【2】线索共【3】条,第【4】条:【5】要查看下一条吗? 30050601: - 【旁白@正常】您当前还没有收集到【1】的【2】线索。 30050602: @@ -65,5 +65,14 @@ aside: #3006: 询问谁和谁有某个关系 300601: - 【旁白@正常】您当前排名积分为:【1】。 + #3101: 询问某人的模糊处理操作 + 310101: + - 【寒烟@正常】您还没告诉要看谁的呢。 + 310102: + - 【寒烟@正常】没有您说的这个人哦。 + 310103: + - 【寒烟@正常】【1】,年龄【2】,性别【3】,身份【4】,其他信息不详。 + 310104: + - 【寒烟@正常】【1】,年龄【2】,性别【3】,身份【4】,【5】对你的信任度为:【6】、威慑度为:【7】。 diff --git a/src/main/resources/speech/task.yaml b/src/main/resources/speech/task.yaml index 628fad3..9c6313a 100644 --- a/src/main/resources/speech/task.yaml +++ b/src/main/resources/speech/task.yaml @@ -304,7 +304,7 @@ person: 200105: - 【人物名称@正常】这酒还是算了吧。 200106: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】谢谢,我不喝酒。 #2002: 打招呼 200201: - 【人物名称@正常】幸会幸会。不知您找在下有什么事情? @@ -324,7 +324,7 @@ person: 200304: - 【人物名称@正常】我们好像不熟吧?抱歉这是我心爱之物,不能随意割爱。 200305: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】抱歉,我这不买这东西。 #2004: 买药 200401: - 【人物名称@正常】自无不可。 @@ -335,7 +335,7 @@ person: 200404: - 【人物名称@正常】我的药不卖给险恶之人。快走快走。 200405: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】抱歉,我没有药可卖。 #2005: 获赠金疮药 200501: - 【人物名称@正常】以你我的交情,还谈什么钱。这份金疮药我送你了。 @@ -344,7 +344,7 @@ person: 200503: - 【人物名称@正常】我这金疮药得来不易,以你我的交情,还不足以让我割爱。 200504: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我没有金疮药,卖不了。 #2006: 揍人 200601: - 【人物名称@正常】我和你无冤无仇……哎哟!哎哟! @@ -353,7 +353,7 @@ person: 200603: - 【人物名称@正常】呸,凭你的细胳膊细腿也配和我动手?找死。 200604: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】别动手啊,告诉你,打我也没用。 #2007: 请吃饭 200701: - 【人物名称@正常】盛情难却,这次让你破费了。感谢,感谢。 @@ -364,7 +364,7 @@ person: 200704: - 【人物名称@正常】你的饭菜,我可吃不起。 200705: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我不饿,你也别请了,请客对我没用。 #2008: 好处费 200801: - 【人物名称@正常】哎哟,这,这多不好意思的。 @@ -373,7 +373,7 @@ person: 200804: - 【人物名称@正常】哎哟,您的钱我可不敢收,怕烫手。 200805: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我不收礼,没用的,放弃吧。 #2009: 帮挑水 200901: - 【人物名称@正常】这可太感谢你了。 @@ -382,7 +382,7 @@ person: 200903: - 【人物名称@正常】非亲非故的,不敢劳驾你。 200904: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】家里不缺水,不用你给挑。 #2010: 一起钓鱼 201001: - 【人物名称@正常】正合我意。走! @@ -391,7 +391,7 @@ person: 201003: - 【人物名称@正常】钓鱼须得三五好友,情投意合才有乐趣。我跟你个陌生人去钓什么鱼! 201004: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我不钓鱼,你找别人吧。 #2011: 送货 201101: - 【人物名称@正常】谢谢,货物我就收下了。 @@ -400,7 +400,7 @@ person: 201103: - 【人物名称@正常】我看你面目可憎,这货我是不敢收的。回去换个人给我送吧。 201104: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我没有东西要收,你找错人了吧。 #2012: 给钱 201201: - 【人物名称@正常】太客气了太客气了。 @@ -409,7 +409,7 @@ person: 201204: - 【人物名称@正常】你这是干什么?非亲非故送人钱财,怕是不安好心。收回去吧。 201205: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我差这么点钱吗,别给我来这套。 #2013: 邀请医生 201301: - 【人物名称@正常】医者父母心,我这就陪你走一趟。诊金么,先预付个【1】文吧。 @@ -420,8 +420,8 @@ person: 201304: - 【人物名称@正常】话不投机,想要我陪你去却是万万不能。 201305: - - 【人物名称@正常】不好意思,我很忙。 - #2014: 给钱买药 + - 【人物名称@正常】不好意思,你另请高明吧。 + #2014: 给钱买茶具 201401: - 【人物名称@正常】也罢。钱给我,这茶具你拿去吧。 201402: @@ -431,7 +431,7 @@ person: 201404: - 【人物名称@正常】别以为有两个破钱就了不起。这药不卖! 201405: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我没有茶具这东西,你找别人问问吧。 #2015: 开怀畅饮 201501: - 【人物名称@正常】好酒!好酒!劳您破费了,咱们不醉不归! @@ -442,7 +442,7 @@ person: 201504: - 【人物名称@正常】咱们不熟,这顿酒还是免了吧。 201505: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】谢谢啊,我真不喝酒。 #2016: 买回钗子 201601: - 【人物名称@正常】行吧,一手交钱一手交货,钗子给你。 @@ -453,7 +453,7 @@ person: 201604: - 【人物名称@正常】休想。这可是美人儿贴身的钗子,怎么能卖给你。 201605: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】别问我,我这真没钗子这样的东西。 #2017: 抢回钗子 201701: - 【人物名称@正常】别,别动手,钗子在这里。给你给你。 @@ -462,7 +462,7 @@ person: 201703: - 【人物名称@正常】想得美!想要回钗子,让她自己来跟我说! 201704: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】抢没用,我这没有钗子。 #2018: 追回私吞款项 201801: - 【人物名称@正常】别,别动手,有话好好说,钱,钱我这就给你。 @@ -471,7 +471,7 @@ person: 201803: - 【人物名称@正常】就凭你?也敢找我追账?知道死字怎么写吗? 201804: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】你找我追什么帐,你找其他人吧。 #2019: 探听身家 201901: - 【人物名称@正常】别看我平时低调,悄悄跟你说,我的身家,最少有这个数,嘿嘿。 @@ -480,7 +480,7 @@ person: 201903: - 【人物名称@正常】你打听这个作什么?无可奉告! 201904: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我这没什么可问的。 #2020:解救被绑女孩 202001: - 【人物名称@正常】你,你怎么知道的? @@ -491,7 +491,7 @@ person: 202003: - 【人物名称@正常】你在说什么,我完全听不懂! 202004: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】你找错人了吧。 #2021:审问罪犯供出老巢 202101: - 【人物名称@正常】别动手,别动手,我说。 @@ -501,7 +501,7 @@ person: 202103: - 【人物名称@正常】呸,你休想知道。 202104: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】此事与我无关,不知道你在说什么。 #2022:交出藏宝图 202201: - 【人物名称@正常】想不到你居然能打听到如此隐秘之事。 @@ -511,7 +511,7 @@ person: 202203: - 【人物名称@正常】我的秘药可不是随便给人用的。告辞! 202204: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】不好意思,我没有这东西。 #2023:抓捕人犯 202301: - 【人物名称@正常】我自以为天衣无缝,居然还是被你发现了。天意啊,天意。 @@ -521,8 +521,8 @@ person: 202303: - 【人物名称@正常】就凭你,还不足以让我认罪。给我滚! 202304: - - 【人物名称@正常】不好意思,我很忙。 - #2024:抓捕人犯 + - 【人物名称@正常】拜托你别乱抓人好不好,别逮谁都像坏人。 + #2024:购买犯人信息 202401: - 【人物名称@正常】嘿嘿,这还差不多,我告诉你啊,那天我刚好路过,听到一声惨叫,偷偷探头一看,发现【1】满脸鲜血,正在行凶! 202402: @@ -532,7 +532,7 @@ person: 202404: - 【人物名称@正常】我跟你很熟吗?这钱我可不敢要。 202405: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】抱歉,我没有这消息。 #2025:购买物品完成 202501: - 【人物名称@正常】且让我看看。这,这正是我所需之物。感激不尽。 @@ -546,11 +546,11 @@ person: 202505: - 【人物名称@正常】且让我看看。这,这根本是假货啊!你被人骗了!算了,算了。你辛苦一场,也不容易。这点钱你收下。 202506: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】你找错人了吧,我可没叫你帮我带东西。 #2026:大夫出诊完成 202601: - 【人物名称@正常】大夫刚才已经来过,我感觉好多了。请受我一拜。 - 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 【旁白@正常】你与【1】的友好度变为【2】点,威慑度变为【3】点。 202602: - 【人物名称@正常】正如刚才所言,大夫已经来过了。大恩不言谢,以后有什么困难可以找我。 202603: @@ -558,11 +558,11 @@ person: 202604: - 【人物名称@正常】大夫虽然来过,但是不是你请回来的我可不确定。 202605: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】抱歉,我不是大夫。你找错人了。 #2027:寻回物品完成 202701: - 【人物名称@正常】哎呀,这正是我丢失的。太谢谢你了。 - 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 【旁白@正常】你与【1】的友好度变为【2】点,威慑度变为【3】点。 202702: - 【人物名称@正常】我不明白你的意思。之前丢的东西你不是已经帮我找回来了吗? 202703: @@ -570,11 +570,11 @@ person: 202704: - 【人物名称@正常】虽然我一直想寻回此物,但是你给的我可不敢收。 202705: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我没有让你找东西啊,你问错人了吧。 #2028:打探肥羊完成 202801: - 【人物名称@正常】想不到你还挺能干。很好。 - 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 【旁白@正常】你与【1】的友好度变为【2】点,威慑度变为【3】点。 202802: - 【人物名称@正常】知道了,你不是说过了吗? 202803: @@ -582,12 +582,12 @@ person: 202804: - 【人物名称@正常】以我俩的交情,你这话的的真假,可说不准啊。 202805: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我没有让你去问啊,你搞错了吧。 #2029:催账完成 202901: - 【人物名称@正常】你居然帮我把那个老赖的钱收回来了?这是一点点感谢,不成敬意。 【旁白@正常】你帮【1】收回了【2】的欠款,【3】对你满口感谢,并递给你【4】文钱作为谢礼。 - 【旁白@正常】你与【1】的友好度改变【5】点,威慑度改变【6】点。 + 【旁白@正常】你与【1】的友好度变为【5】点,威慑度变为【6】点。 202902: - 【人物名称@正常】你刚才不是已经给我了吗? 202903: @@ -595,7 +595,7 @@ person: 202904: - 【人物名称@正常】无事献殷勤,来历不明的钱我可不敢收。 202905: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】别人没欠我钱,你问错人啦。 #2030:催账 203001: - 【人物名称@正常】我给,我给。别动手。 @@ -605,11 +605,11 @@ person: 203003: - 【人物名称@正常】你算老几,敢来找我要钱。 203004: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】别找我,我可没欠任何人钱。 #2031:砸场子完成 203101: - 【人物名称@正常】哈哈哈,太好了。你果然没让我失望。这点钱你收下,就当是辛苦费。 - 【旁白@正常】你帮【1】大大出了一口气,你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文作为辛苦费。 + 【旁白@正常】你帮【1】大大出了一口气,你与【1】的友好度变为【2】点,威慑度变为【3】点。你获得【4】文作为辛苦费。 203102: - 【人物名称@正常】知道了,不是给过你钱了吗? 203103: @@ -617,24 +617,24 @@ person: 203104: - 【人物名称@正常】你自己做下的事情,与我何干。我们很熟吗? 203105: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】没有这事,你看错人了吧。 #2032:砸场子 203201: - 【人物名称@正常】你,你欺人太甚!快住手。 【旁白@正常】你无视【1】的阻拦,将眼前一切可以砸的都砸了个稀巴烂。 - 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 【旁白@正常】你与【1】的友好度变为【2】点,威慑度变为【3】点。 203202: - 【人物名称@正常】你,你还来做什么,这里还有什么可以砸的吗? 203203: - 【人物名称@正常】就凭你那三脚猫的功夫也敢来找死? 203204: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】别乱来,你找错人了。 #2033:探听隐私完成 203301: - 【人物名称@正常】什,什么,竟有此事? 【旁白@正常】【1】大惊失色。 【人物名称@正常】此事关联甚大。这点钱财你先收下。此事隐秘,切记不要乱传。 - 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文酬劳。 + 【旁白@正常】你与【1】的友好度变为【2】点,威慑度变为【3】点。你获得【4】文酬劳。 203302: - 【人物名称@正常】你已经告知过我了,此事关联甚大,千万不要乱传。 203303: @@ -642,51 +642,51 @@ person: 203304: - 【人物名称@正常】只凭你我关系,还不足以让我信任于你。 203305: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我没有让你去问吧,你搞错了。 #2034:探听隐私 203401: - 【人物名称@正常】莫名其妙。 【旁白@正常】【1】警惕地扫了你一眼,转身离去。你小心翼翼观察了下周围,远远跟在了【2】身后。 【旁白@正常】太阳渐渐落山,月亮爬上来了。 【旁白@正常】你悄悄爬上屋顶,掀开一片瓦片,烛光下,【1】对着镜子,正轻轻把自己的脸皮撕了下来。那居然是一张人皮面具!面具下,是一张陌生的人脸!震惊之下,你赶紧溜下了屋檐。 - 【旁白@正常】你成功打探到了【1】的隐私!你与【1】的友好度改变【3】点,威慑度改变【4】点。 + 【旁白@正常】你成功打探到了【1】的隐私!你与【1】的友好度变为【3】点,威慑度变为【4】点。 203402: - 【人物名称@正常】你已经知道他的隐私了。 203403: - 【人物名称@正常】就凭你那三脚猫的功夫也敢来找死? 203404: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我没什么可说,你找其他人吧。 #2035:试药 203501: - 【人物名称@正常】太好了。我正在找敢试药的人呢。你且来试试。先说好,出问题了可不关我事。 【旁白@正常】你一脸视死如归地接过了那鸽蛋大的药丸,张口就吞了下去。 【旁白@正常】你满面红光,感到浑身充满了力量。 【人物名称@正常】成,成功了??太好了。这是你的报酬。拿了钱,以后有什么头疼胸闷啥的可不许赖我。 - 【旁白@正常】你勇敢地帮【1】试药成功,你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文酬劳。 + 【旁白@正常】你勇敢地帮【1】试药成功,你与【1】的友好度变为【2】点,威慑度变为【3】点。你获得【4】文酬劳。 203502: - 【人物名称@正常】太好了。我正在找敢试药的人呢。你且来试试。先说好,出问题了可不关我事。 【旁白@正常】你一脸视死如归地接过了那鸽蛋大的药丸,张口就吞了下去。 【旁白@正常】你眼前一黑,一头栽倒在地。 【旁白@正常】过了很久,你才悠悠醒过来,感到浑身像散架了一样。 【人物名称@正常】这,这可是你自愿的。不关我事,这点钱拿着,就算我给你的补偿。 - 【旁白@正常】很遗憾,你帮【1】试药失败,你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得【4】文补偿。 + 【旁白@正常】很遗憾,你帮【1】试药失败,你与【1】的友好度变为【2】点,威慑度变为【3】点。你获得【4】文补偿。 203503: - 【人物名称@正常】你,你还来做什么,我没有药可以试了,快走快走。 203504: - 【人物名称@正常】我们很熟吗? 203505: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】我药都没有,来我这试什么药。 #2036:证据账本完成 203601: - 【人物名称@正常】快让我看看。 【旁白@正常】【1】接过账本,翻看几下,大笑起来。 【人物名称@正常】好,好,好,【2】你这次在劫难逃!壮士果然身手不凡。小小心意,还请收下。 - 【旁白@正常】你与【1】的友好度改变【3】点,威慑度改变【4】点。你获得【5】文酬劳。 + 【旁白@正常】你与【1】的友好度变为【3】点,威慑度变为【4】点。你获得【5】文酬劳。 203602: - 【人物名称@正常】快让我看看。 【旁白@正常】【1】接过账本,翻看几下,脸色难看起来。 【人物名称@正常】此物是假的。看来【2】早有准备。再去也无益。罢了。无论如何,多谢壮士相助,壮士身手不凡,这点心意还请收下。 - 【旁白@正常】你与【1】的友好度改变【3】点,威慑度改变【4】点。你获得【5】文酬劳。 + 【旁白@正常】你与【1】的友好度变为【3】点,威慑度变为【4】点。你获得【5】文酬劳。 203603: - 【人物名称@正常】你不是已经给过我了吗?此事关联甚大,千万不要乱传。 203604: @@ -694,22 +694,22 @@ person: 203605: - 【人物名称@正常】只凭你我关系,还不足以让我认定此物真假。 203606: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】你搞错了吧,我没让你去查这个啊。 #2037:证据账本 203701: - 【人物名称@正常】你说什么? 【旁白@正常】你趁【1】不注意,一掌打晕了【2】。然后翻箱倒柜。 - 【旁白@正常】你成功偷取到了【2】的账本!你与【2】的友好度改变【3】点,威慑度改变【4】点。 + 【旁白@正常】你成功偷取到了【2】的账本!你与【2】的友好度变为【3】点,威慑度变为【4】点。 203702: - 【人物名称@正常】你说什么? 【旁白@正常】你假装离去,趁夜摸进了【1】的密室,翻箱倒柜。 - 【旁白@正常】你成功偷取到了【1】的账本!你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 【旁白@正常】你成功偷取到了【1】的账本!你与【1】的友好度变为【2】点,威慑度变为【3】点。 203703: - 【人物名称@正常】你已经知道他的隐私了。 203704: - 【人物名称@正常】就凭你那三脚猫的功夫也敢来找死? 203705: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】不好意思,我这没有这东西。 #2038:证据账本类型2完成 203801: - 【人物名称@正常】快让我看看。 @@ -717,7 +717,7 @@ person: 【人物名称@正常】好,好,好,你可以滚了。 【旁白@正常】【1】将账本藏在身后,突然间变了脸色。 【人物名称@正常】账本?什么账本。我没见到!再说话我连你一起告! - 【旁白@正常】【1】不由分说将你轰出了大门。你与【1】的友好度改变【2】点,威慑度改变【3】点。 + 【旁白@正常】【1】不由分说将你轰出了大门。你与【1】的友好度变为【2】点,威慑度变为【3】点。 203802: - 【人物名称@正常】无凭无据,说话小心点,再纠结此事,小心我连你一起送官。 203803: @@ -725,13 +725,13 @@ person: 203804: - 【人物名称@正常】凭你我关系,如何才能让我相信这是真的呢? 203805: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】你搞错了,我可没让你帮我找这个。 #2039:栽赃陷害完成 203901: - 【人物名称@正常】此事当真?好,好,好! 【旁白@正常】【1】不住点头。 【人物名称@正常】我这就去报官!【2】这次不死也得给我扒一层皮!这是你的报酬,记得把嘴给我闭紧点! - 【旁白@正常】你帮【1】完成了给【1】栽赃的任务,你与【1】的友好度改变【3】点,威慑度改变【4】点。 + 【旁白@正常】你帮【1】完成了给【1】栽赃的任务,你与【1】的友好度变为【3】点,威慑度变为【4】点。 203902: - 【人物名称@正常】你在胡说什么!不是叫你把嘴闭紧点吗? 203903: @@ -739,7 +739,7 @@ person: 203904: - 【人物名称@正常】凭你我关系,如何才能让我相信这是真的呢? 203905: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】什么事?都不知道你在说什么,你找其他人吧。 #2040:栽赃陷害类型2完成 204001: - 【人物名称@正常】此事当真?好,好,好! @@ -748,7 +748,7 @@ person: 【旁白@正常】【1】突然露出一副奸计得逞的表情,上前一把扭住了你。 【人物名称@正常】你来历不明,还偷偷给【2】送钱,狼狈为奸,肯定是一伙的。走,跟我见官去!! 【旁白@正常】你被【1】送到了官府。公堂上,你百口莫辩,被迫交出了【3】文钱才勉强脱身。 - 【旁白@正常】你被【1】这个卑鄙小人算计了!你与【1】的友好度改变【4】点,威慑度改变【5】点。 + 【旁白@正常】你被【1】这个卑鄙小人算计了!你与【1】的友好度变为【4】点,威慑度变为【5】点。 204002: - 【人物名称@正常】你在胡说什么!怎么,还想再上一次公堂? 204003: @@ -756,11 +756,11 @@ person: 204004: - 【人物名称@正常】凭你我关系,如何才能让我相信这是真的呢? 204005: - - 【人物名称@正常】不好意思,我很忙。 + - 【人物名称@正常】什么事?都不知道你在说什么,你找其他人吧。 #2041:栽赃陷害类型2完成 204101: - 【人物名称@正常】我已知晓此事,辛苦你了。 - 【旁白@正常】你与【1】的友好度改变【2】点,威慑度改变【3】点。你获得了【4】文辛苦费。 + 【旁白@正常】你与【1】的友好度变为【2】点,威慑度变为【3】点。你获得了【4】文辛苦费。 204102: - 【人物名称@正常】此事你已经跟我说过了。 204103: @@ -769,4 +769,16 @@ person: - 【人物名称@正常】凭你我关系,我可不敢相信。 204105: - 【人物名称@正常】不好意思,我很忙。 + #2101:买东西 + 210101: + - 【人物名称@正常】既然出得起价钱,就卖给你了。 + 【旁白@正常】你从【1】手上买下了。 + 210102: + - 【人物名称@正常】你不是已经买过了吗。 + 210103: + - 【人物名称@正常】【1】文,不能再少了。你身上的钱可不够。 + 210104: + - 【人物名称@正常】抱歉,不卖给信不过的人。 + 210105: + - 【人物名称@正常】不好意思,我这不卖东西。 -- libgit2 0.27.1