Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
secret-garden-game
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周君强
secret-garden-game
Commits
62ae40e0
Commit
62ae40e0
authored
May 11, 2023
by
周君强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.数据同步到关卡;
2.建议系统优化
parent
9855819a
Hide whitespace changes
Inline
Side-by-side
Showing
57 changed files
with
4683 additions
and
317 deletions
+4683
-317
pom.xml
pom.xml
+5
-0
Constants.java
src/main/java/com/qiwuai/garden/common/Constants.java
+9
-6
InitSysServlet.java
src/main/java/com/qiwuai/garden/common/InitSysServlet.java
+64
-17
TimingAcquisition.java
...main/java/com/qiwuai/garden/common/TimingAcquisition.java
+49
-2
CacheUtil.java
src/main/java/com/qiwuai/garden/common/cache/CacheUtil.java
+1
-1
RedisConfig.java
...ain/java/com/qiwuai/garden/common/config/RedisConfig.java
+49
-0
ScheduleTask.java
.../java/com/qiwuai/garden/common/schedule/ScheduleTask.java
+32
-3
AdviseUtil.java
src/main/java/com/qiwuai/garden/common/utils/AdviseUtil.java
+214
-7
DataTrimUtil.java
...ain/java/com/qiwuai/garden/common/utils/DataTrimUtil.java
+17
-0
PersistenceUtil.java
.../java/com/qiwuai/garden/common/utils/PersistenceUtil.java
+36
-0
RankingUtil.java
...main/java/com/qiwuai/garden/common/utils/RankingUtil.java
+1
-1
RedisUtil.java
src/main/java/com/qiwuai/garden/common/utils/RedisUtil.java
+65
-0
RequestConversionUtil.java
...com/qiwuai/garden/common/utils/RequestConversionUtil.java
+27
-5
SpeechUtil.java
src/main/java/com/qiwuai/garden/common/utils/SpeechUtil.java
+14
-0
CommonController.java
...n/java/com/qiwuai/garden/controller/CommonController.java
+56
-2
PlayerController.java
...n/java/com/qiwuai/garden/controller/PlayerController.java
+146
-39
CopyPetMapper.java
src/main/java/com/qiwuai/garden/dao/CopyPetMapper.java
+13
-0
CopyPetDto.java
src/main/java/com/qiwuai/garden/dto/CopyPetDto.java
+22
-0
CopyTimeDto.java
src/main/java/com/qiwuai/garden/dto/CopyTimeDto.java
+19
-0
GardenerDto.java
src/main/java/com/qiwuai/garden/dto/GardenerDto.java
+23
-0
ItemNumDto.java
src/main/java/com/qiwuai/garden/dto/ItemNumDto.java
+19
-0
MessageTimeDto.java
src/main/java/com/qiwuai/garden/dto/MessageTimeDto.java
+4
-0
NurseryInfoDto.java
src/main/java/com/qiwuai/garden/dto/NurseryInfoDto.java
+4
-0
PartnerItemDto.java
src/main/java/com/qiwuai/garden/dto/PartnerItemDto.java
+22
-0
PlayerSeriesDto.java
src/main/java/com/qiwuai/garden/dto/PlayerSeriesDto.java
+32
-0
ReputationDto.java
src/main/java/com/qiwuai/garden/dto/ReputationDto.java
+18
-0
ResultResponse.java
src/main/java/com/qiwuai/garden/dto/base/ResultResponse.java
+64
-0
CallRequest.java
src/main/java/com/qiwuai/garden/dto/request/CallRequest.java
+17
-0
OperationRequest.java
.../java/com/qiwuai/garden/dto/request/OperationRequest.java
+44
-0
PlayerRequest.java
...ain/java/com/qiwuai/garden/dto/request/PlayerRequest.java
+11
-0
CallResponse.java
...ain/java/com/qiwuai/garden/dto/response/CallResponse.java
+21
-0
CopyPetPojo.java
src/main/java/com/qiwuai/garden/pojo/CopyPetPojo.java
+19
-0
RarityPojo.java
src/main/java/com/qiwuai/garden/pojo/RarityPojo.java
+4
-0
RegionPojo.java
src/main/java/com/qiwuai/garden/pojo/RegionPojo.java
+8
-8
AdviseServiceImpl.java
.../garden/service/adviseService/impl/AdviseServiceImpl.java
+17
-2
BackPackService.java
...iwuai/garden/service/backPackService/BackPackService.java
+12
-0
BackPackServiceImpl.java
...den/service/backPackService/impl/BackPackServiceImpl.java
+119
-5
GardenerServiceImpl.java
...den/service/gardenerService/impl/GardenerServiceImpl.java
+124
-11
HelpServiceImpl.java
...wuai/garden/service/helpService/impl/HelpServiceImpl.java
+10
-5
MarketServiceImpl.java
.../garden/service/marketService/impl/MarketServiceImpl.java
+42
-1
PetService.java
...java/com/qiwuai/garden/service/petService/PetService.java
+42
-0
PetServiceImpl.java
...qiwuai/garden/service/petService/impl/PetServiceImpl.java
+486
-2
SocialService.java
...om/qiwuai/garden/service/socialService/SocialService.java
+6
-0
MessageServiceImpl.java
...garden/service/socialService/impl/MessageServiceImpl.java
+1908
-0
SocialServiceImpl.java
.../garden/service/socialService/impl/SocialServiceImpl.java
+450
-170
application-dev.yml
src/main/resources/application-dev.yml
+11
-1
application-pro.yml
src/main/resources/application-pro.yml
+11
-1
application-uat.yml
src/main/resources/application-uat.yml
+10
-0
CopyPetMapper.xml
src/main/resources/com/qiwuai/garden/dao/CopyPetMapper.xml
+10
-0
RarityMapper.xml
src/main/resources/com/qiwuai/garden/dao/RarityMapper.xml
+1
-1
advise.yaml
src/main/resources/speech/advise.yaml
+2
-0
gardener.yaml
src/main/resources/speech/gardener.yaml
+8
-4
market.yaml
src/main/resources/speech/market.yaml
+4
-0
message.yaml
src/main/resources/speech/message.yaml
+213
-0
pet.yaml
src/main/resources/speech/pet.yaml
+24
-1
plant.yaml
src/main/resources/speech/plant.yaml
+17
-17
social.yaml
src/main/resources/speech/social.yaml
+7
-5
No files found.
pom.xml
View file @
62ae40e0
...
@@ -99,6 +99,11 @@
...
@@ -99,6 +99,11 @@
<artifactId>
jxl
</artifactId>
<artifactId>
jxl
</artifactId>
<version>
2.6.12
</version>
<version>
2.6.12
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
<version>
2.6.5
</version>
</dependency>
</dependencies>
</dependencies>
<properties>
<properties>
...
...
src/main/java/com/qiwuai/garden/common/Constants.java
View file @
62ae40e0
...
@@ -161,6 +161,10 @@ public class Constants {
...
@@ -161,6 +161,10 @@ public class Constants {
*/
*/
public
static
final
Integer
GARDENER_UPGRADE
=
2001
;
public
static
final
Integer
GARDENER_UPGRADE
=
2001
;
/**
/**
* 查看背包物品
*/
public
static
final
Integer
CHECK_BAG
=
2002
;
/**
* 查看技能
* 查看技能
*/
*/
public
static
final
Integer
SKILL_CHECK
=
2010
;
public
static
final
Integer
SKILL_CHECK
=
2010
;
...
@@ -225,13 +229,17 @@ public class Constants {
...
@@ -225,13 +229,17 @@ public class Constants {
*/
*/
public
static
final
Integer
CHECK_STEAL_REPORT
=
5014
;
public
static
final
Integer
CHECK_STEAL_REPORT
=
5014
;
/**
/**
*
消息推送
*
查看提示
*/
*/
public
static
final
Integer
CHECK_NOTICE
=
5018
;
public
static
final
Integer
CHECK_NOTICE
=
5018
;
/**
/**
* 消息推送
* 消息推送
*/
*/
public
static
final
Integer
ADVISE
=
9001
;
public
static
final
Integer
ADVISE
=
9001
;
/**
* 套圈
*/
public
static
final
Integer
PITCH_PET
=
11001
;
/**
/**
...
@@ -559,9 +567,4 @@ public class Constants {
...
@@ -559,9 +567,4 @@ public class Constants {
*/
*/
public
static
final
Integer
PAGE_NUM
=
3
;
public
static
final
Integer
PAGE_NUM
=
3
;
/**
* 数据存放地址
*/
public
static
final
String
userFilePath
=
"/home/qwyf14/dataBackup/"
;
}
}
src/main/java/com/qiwuai/garden/common/InitSysServlet.java
View file @
62ae40e0
...
@@ -2,10 +2,7 @@ package com.qiwuai.garden.common;
...
@@ -2,10 +2,7 @@ package com.qiwuai.garden.common;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.qiwuai.garden.common.utils.HttpUtil
;
import
com.qiwuai.garden.common.utils.*
;
import
com.qiwuai.garden.common.utils.PersistenceUtil
;
import
com.qiwuai.garden.common.utils.RankingUtil
;
import
com.qiwuai.garden.common.utils.TypeConvertUtil
;
import
com.qiwuai.garden.dao.*
;
import
com.qiwuai.garden.dao.*
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.pojo.*
;
import
com.qiwuai.garden.pojo.*
;
...
@@ -18,6 +15,7 @@ import org.springframework.stereotype.Component;
...
@@ -18,6 +15,7 @@ import org.springframework.stereotype.Component;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -55,10 +53,11 @@ public class InitSysServlet implements InitializingBean {
...
@@ -55,10 +53,11 @@ public class InitSysServlet implements InitializingBean {
private
ItemTypeMapper
itemTypeMapper
;
private
ItemTypeMapper
itemTypeMapper
;
private
GoodsMapper
goodsMapper
;
private
GoodsMapper
goodsMapper
;
private
QuantityRangeMapper
quantityRangeMapper
;
private
QuantityRangeMapper
quantityRangeMapper
;
private
RegionMapper
regionMapper
;
//
private RegionMapper regionMapper;
private
RarityMapper
rarityMapper
;
private
RarityMapper
rarityMapper
;
private
TaskTypeMapper
taskTypeMapper
;
private
TaskTypeMapper
taskTypeMapper
;
private
CallNameMapper
callNameMapper
;
private
CallNameMapper
callNameMapper
;
private
CopyPetMapper
copyPetMapper
;
@Autowired
@Autowired
public
void
setNurseryMapper
(
NurseryMapper
nurseryMapper
)
{
public
void
setNurseryMapper
(
NurseryMapper
nurseryMapper
)
{
...
@@ -161,10 +160,10 @@ public class InitSysServlet implements InitializingBean {
...
@@ -161,10 +160,10 @@ public class InitSysServlet implements InitializingBean {
this
.
quantityRangeMapper
=
quantityRangeMapper
;
this
.
quantityRangeMapper
=
quantityRangeMapper
;
}
}
@Autowired
//
@Autowired
public
void
setRegionMapper
(
RegionMapper
regionMapper
)
{
//
public void setRegionMapper(RegionMapper regionMapper) {
this
.
regionMapper
=
regionMapper
;
//
this.regionMapper = regionMapper;
}
//
}
@Autowired
@Autowired
public
void
setRarityMapper
(
RarityMapper
rarityMapper
)
{
public
void
setRarityMapper
(
RarityMapper
rarityMapper
)
{
...
@@ -181,6 +180,11 @@ public class InitSysServlet implements InitializingBean {
...
@@ -181,6 +180,11 @@ public class InitSysServlet implements InitializingBean {
this
.
callNameMapper
=
callNameMapper
;
this
.
callNameMapper
=
callNameMapper
;
}
}
@Autowired
public
void
setCopyPetMapper
(
CopyPetMapper
copyPetMapper
)
{
this
.
copyPetMapper
=
copyPetMapper
;
}
/**
/**
* 保存配置信息到缓存
* 保存配置信息到缓存
*/
*/
...
@@ -433,14 +437,29 @@ public class InitSysServlet implements InitializingBean {
...
@@ -433,14 +437,29 @@ public class InitSysServlet implements InitializingBean {
// log.info("缓存中数量范围配置信息" + TimingAcquisition.quantityRangeMap);
// log.info("缓存中数量范围配置信息" + TimingAcquisition.quantityRangeMap);
log
.
info
(
"数量范围配置信息缓存完成"
);
log
.
info
(
"数量范围配置信息缓存完成"
);
//----------------------缓存地区与服务器对应信息--------------------------
// //----------------------缓存地区与服务器对应信息--------------------------
// Map<String, RegionPojo> regionIPMap = new ConcurrentHashMap<>();
// List<RegionPojo> regionList = regionMapper.findAll();
// for (RegionPojo region : regionList) {
// regionIPMap.put(region.getPlace(), region);
// }
// TimingAcquisition.regionIPMap.putAll(regionIPMap);
// log.info("地区与服务器对应信息缓存完成");
Map
<
String
,
RegionPojo
>
regionIPMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
RegionPojo
>
regionIPMap
=
new
ConcurrentHashMap
<>();
List
<
RegionPojo
>
regionList
=
regionMapper
.
findAll
();
String
fileName
=
"region.json"
;
for
(
RegionPojo
region
:
regionList
)
{
String
s
=
PersistenceUtil
.
getConfigFromFile
(
configFilePath
,
fileName
);
regionIPMap
.
put
(
region
.
getPlace
(),
region
);
Map
<
String
,
List
<
RegionIPDto
>>
IPRegionsMap
=
JSON
.
parseObject
(
s
,
new
TypeReference
<
Map
<
String
,
List
<
RegionIPDto
>>>(){});
for
(
Map
.
Entry
<
String
,
List
<
RegionIPDto
>>
entry
:
IPRegionsMap
.
entrySet
())
{
List
<
RegionIPDto
>
regionIPList
=
entry
.
getValue
();
for
(
RegionIPDto
regionIP
:
regionIPList
)
{
RegionPojo
regionPojo
=
new
RegionPojo
();
regionPojo
.
setId
(
regionIP
.
getId
());
regionPojo
.
setPlace
(
regionIP
.
getPlace
());
regionPojo
.
setServerIP
(
regionIP
.
getServerIP
());
regionIPMap
.
put
(
regionIP
.
getPlace
(),
regionPojo
);
}
}
}
TimingAcquisition
.
regionIPMap
.
putAll
(
regionIPMap
);
TimingAcquisition
.
regionIPMap
.
putAll
(
regionIPMap
);
// log.info("缓存中地区与服务器对应信息" + TimingAcquisition.regionIPMap);
log
.
info
(
"地区与服务器对应信息缓存完成"
);
log
.
info
(
"地区与服务器对应信息缓存完成"
);
//----------------------缓存任务类型对应信息--------------------------
//----------------------缓存任务类型对应信息--------------------------
...
@@ -473,6 +492,15 @@ public class InitSysServlet implements InitializingBean {
...
@@ -473,6 +492,15 @@ public class InitSysServlet implements InitializingBean {
// log.info("缓存中新手引导玩家称呼对应信息" + TimingAcquisition.callNameGuideMap);
// log.info("缓存中新手引导玩家称呼对应信息" + TimingAcquisition.callNameGuideMap);
log
.
info
(
"新手引导玩家称呼对应信息缓存完成"
);
log
.
info
(
"新手引导玩家称呼对应信息缓存完成"
);
//----------------------缓存副本信息--------------------------
Map
<
Integer
,
CopyPetPojo
>
copyPetPojoMap
=
new
ConcurrentHashMap
<>();
List
<
CopyPetPojo
>
copyPetPojoList
=
copyPetMapper
.
findAll
();
for
(
CopyPetPojo
copyPet
:
copyPetPojoList
)
{
copyPetPojoMap
.
put
(
copyPet
.
getId
(),
copyPet
);
}
TimingAcquisition
.
copyPetPojoMap
.
putAll
(
copyPetPojoMap
);
log
.
info
(
"副本信息缓存完成"
);
//----------------------缓存玩家地址对应的地区信息----------------------------
//----------------------缓存玩家地址对应的地区信息----------------------------
Map
<
String
,
Map
<
String
,
RegionDto
>>
addressMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
Map
<
String
,
RegionDto
>>
addressMap
=
new
ConcurrentHashMap
<>();
Map
<
String
,
RegionPojo
>
regionPojoMap
=
TimingAcquisition
.
regionIPMap
;
Map
<
String
,
RegionPojo
>
regionPojoMap
=
TimingAcquisition
.
regionIPMap
;
...
@@ -527,9 +555,6 @@ public class InitSysServlet implements InitializingBean {
...
@@ -527,9 +555,6 @@ public class InitSysServlet implements InitializingBean {
List
<
PlayerTimesDto
>
friendshipRankingList
=
RankingUtil
.
friendshipRankingListSort
();
List
<
PlayerTimesDto
>
friendshipRankingList
=
RankingUtil
.
friendshipRankingListSort
();
TimingAcquisition
.
friendshipRankingList
.
addAll
(
friendshipRankingList
);
TimingAcquisition
.
friendshipRankingList
.
addAll
(
friendshipRankingList
);
//获取所有地区
//获取所有地区
String
fileName
=
"region.json"
;
String
s
=
PersistenceUtil
.
getConfigFromFile
(
configFilePath
,
fileName
);
Map
<
String
,
List
<
RegionIPDto
>>
IPRegionsMap
=
JSON
.
parseObject
(
s
,
new
TypeReference
<
Map
<
String
,
List
<
RegionIPDto
>>>(){});
for
(
Map
.
Entry
<
String
,
List
<
RegionIPDto
>>
entry
:
IPRegionsMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
RegionIPDto
>>
entry
:
IPRegionsMap
.
entrySet
())
{
List
<
RegionIPDto
>
regionIPList
=
entry
.
getValue
();
List
<
RegionIPDto
>
regionIPList
=
entry
.
getValue
();
for
(
RegionIPDto
regionIP
:
regionIPList
)
{
for
(
RegionIPDto
regionIP
:
regionIPList
)
{
...
@@ -548,6 +573,28 @@ public class InitSysServlet implements InitializingBean {
...
@@ -548,6 +573,28 @@ public class InitSysServlet implements InitializingBean {
}
}
}
}
//----------------------缓存排行榜信息----------------------------
String
copyPetName
=
"copyPet.json"
;
Map
<
Integer
,
CopyPetDto
>
copyPetMap
=
new
HashMap
<>();
CopyPetDto
copyPet
=
new
CopyPetDto
();
String
copyPetStr
=
PersistenceUtil
.
getConfigFromFile
(
configFilePath
,
copyPetName
);
if
(
StringUtils
.
isEmpty
(
copyPetStr
))
{
Map
<
Integer
,
CopyPetPojo
>
copyPetInfoMap
=
TimingAcquisition
.
copyPetPojoMap
;
for
(
Map
.
Entry
<
Integer
,
CopyPetPojo
>
entry
:
copyPetInfoMap
.
entrySet
())
{
CopyPetPojo
copyPetPojo
=
entry
.
getValue
();
List
<
Integer
>
copyPetList
=
AdviseUtil
.
updateCopyPet
(
copyPetPojo
,
1
);
copyPet
.
setNum
(
1
);
copyPet
.
setCopyPetList
(
copyPetList
);
copyPet
.
setTime
(
DateUtil
.
getCurrentTime
());
copyPetMap
.
put
(
entry
.
getKey
(),
copyPet
);
}
//保存到json文件中
String
copyPetMapStr
=
JSON
.
toJSONString
(
copyPetMap
);
PersistenceUtil
.
saveToFile
(
configFilePath
+
"copyPet.json"
,
copyPetMapStr
);
}
else
{
copyPetMap
=
JSON
.
parseObject
(
copyPetStr
,
new
TypeReference
<
Map
<
Integer
,
CopyPetDto
>>(){});
}
TimingAcquisition
.
copyPetMap
.
putAll
(
copyPetMap
);
//----------------------更新动态词组到bot服务器------------------------
//----------------------更新动态词组到bot服务器------------------------
// log.info("开始更新所有动态词组");
// log.info("开始更新所有动态词组");
...
...
src/main/java/com/qiwuai/garden/common/TimingAcquisition.java
View file @
62ae40e0
...
@@ -90,6 +90,10 @@ public class TimingAcquisition {
...
@@ -90,6 +90,10 @@ public class TimingAcquisition {
* 敏感词
* 敏感词
*/
*/
public
volatile
static
List
<
String
>
sensitiveWordList
=
new
ArrayList
<>();
public
volatile
static
List
<
String
>
sensitiveWordList
=
new
ArrayList
<>();
/**
* 副本宠物
*/
public
volatile
static
Map
<
Integer
,
CopyPetDto
>
copyPetMap
=
new
ConcurrentHashMap
();
/**
/**
...
@@ -204,6 +208,10 @@ public class TimingAcquisition {
...
@@ -204,6 +208,10 @@ public class TimingAcquisition {
* 新手引导玩家称呼配置信息
* 新手引导玩家称呼配置信息
*/
*/
public
volatile
static
Map
<
Integer
,
CallNameGuidePojo
>
callNameGuideMap
=
new
ConcurrentHashMap
<>();
public
volatile
static
Map
<
Integer
,
CallNameGuidePojo
>
callNameGuideMap
=
new
ConcurrentHashMap
<>();
/**
* 新手引导玩家称呼配置信息
*/
public
volatile
static
Map
<
Integer
,
CopyPetPojo
>
copyPetPojoMap
=
new
ConcurrentHashMap
<>();
/**
/**
...
@@ -242,6 +250,10 @@ public class TimingAcquisition {
...
@@ -242,6 +250,10 @@ public class TimingAcquisition {
* 排行榜模块话术
* 排行榜模块话术
*/
*/
public
volatile
static
Map
<
String
,
Map
<
String
,
List
<
String
>>>
rankingSpeechMap
=
new
ConcurrentHashMap
<>();
public
volatile
static
Map
<
String
,
Map
<
String
,
List
<
String
>>>
rankingSpeechMap
=
new
ConcurrentHashMap
<>();
/**
* 留言模块话术
*/
public
volatile
static
Map
<
String
,
Map
<
String
,
List
<
String
>>>
messageSpeechMap
=
new
ConcurrentHashMap
<>();
/**
/**
...
@@ -280,6 +292,7 @@ public class TimingAcquisition {
...
@@ -280,6 +292,7 @@ public class TimingAcquisition {
Map
<
String
,
Map
<
String
,
List
<
String
>>>
helpSpeech
=
new
HashMap
<>();
Map
<
String
,
Map
<
String
,
List
<
String
>>>
helpSpeech
=
new
HashMap
<>();
Map
<
String
,
Map
<
String
,
List
<
String
>>>
adviseSpeech
=
new
HashMap
<>();
Map
<
String
,
Map
<
String
,
List
<
String
>>>
adviseSpeech
=
new
HashMap
<>();
Map
<
String
,
Map
<
String
,
List
<
String
>>>
rankingSpeech
=
new
HashMap
<>();
Map
<
String
,
Map
<
String
,
List
<
String
>>>
rankingSpeech
=
new
HashMap
<>();
Map
<
String
,
Map
<
String
,
List
<
String
>>>
messageSpeech
=
new
HashMap
<>();
try
{
try
{
plantSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"plant.yaml"
);
plantSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"plant.yaml"
);
gardenerSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"gardener.yaml"
);
gardenerSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"gardener.yaml"
);
...
@@ -290,6 +303,7 @@ public class TimingAcquisition {
...
@@ -290,6 +303,7 @@ public class TimingAcquisition {
helpSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"help.yaml"
);
helpSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"help.yaml"
);
adviseSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"advise.yaml"
);
adviseSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"advise.yaml"
);
rankingSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"ranking.yaml"
);
rankingSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"ranking.yaml"
);
messageSpeech
=
YamlUtil
.
loadSpeechToMap
(
speechFilePath
,
"message.yaml"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -303,6 +317,7 @@ public class TimingAcquisition {
...
@@ -303,6 +317,7 @@ public class TimingAcquisition {
helpSpeechMap
.
putAll
(
helpSpeech
);
helpSpeechMap
.
putAll
(
helpSpeech
);
adviseSpeechMap
.
putAll
(
adviseSpeech
);
adviseSpeechMap
.
putAll
(
adviseSpeech
);
rankingSpeechMap
.
putAll
(
rankingSpeech
);
rankingSpeechMap
.
putAll
(
rankingSpeech
);
messageSpeechMap
.
putAll
(
messageSpeech
);
log
.
info
(
"---------加载话术到缓存的操作完成---------"
);
log
.
info
(
"---------加载话术到缓存的操作完成---------"
);
}
}
...
@@ -775,7 +790,6 @@ public class TimingAcquisition {
...
@@ -775,7 +790,6 @@ public class TimingAcquisition {
*/
*/
public
static
Integer
getItemIdByName
(
String
itemName
)
{
public
static
Integer
getItemIdByName
(
String
itemName
)
{
Iterator
<
Map
.
Entry
<
Integer
,
ItemPojo
>>
iterator
=
itemConfigMap
.
entrySet
().
iterator
();
Iterator
<
Map
.
Entry
<
Integer
,
ItemPojo
>>
iterator
=
itemConfigMap
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
while
(
iterator
.
hasNext
())
{
Map
.
Entry
<
Integer
,
ItemPojo
>
entry
=
iterator
.
next
();
Map
.
Entry
<
Integer
,
ItemPojo
>
entry
=
iterator
.
next
();
ItemPojo
item
=
entry
.
getValue
();
ItemPojo
item
=
entry
.
getValue
();
...
@@ -1039,6 +1053,32 @@ public class TimingAcquisition {
...
@@ -1039,6 +1053,32 @@ public class TimingAcquisition {
}
}
/**
/**
* 获取副本id
*/
public
static
Integer
getCopyId
(
String
copyName
)
{
for
(
Map
.
Entry
<
Integer
,
CopyPetPojo
>
entry
:
copyPetPojoMap
.
entrySet
())
{
if
(
entry
.
getValue
().
getCopyName
().
equals
(
copyName
))
{
return
entry
.
getKey
();
}
}
return
null
;
}
/**
* 获取所有副本名称
*/
public
static
String
getCopyNames
()
{
StringBuilder
result
=
new
StringBuilder
();
for
(
Map
.
Entry
<
Integer
,
CopyPetPojo
>
entry
:
copyPetPojoMap
.
entrySet
())
{
result
.
append
(
entry
.
getValue
().
getCopyName
()).
append
(
"、"
);
}
if
(
result
.
length
()
>
0
)
{
result
.
deleteCharAt
(
result
.
length
()
-
1
);
}
return
result
.
toString
();
}
/**
* 通过园丁名称找到玩家地址
* 通过园丁名称找到玩家地址
* @param name
* @param name
* @return String
* @return String
...
@@ -1801,7 +1841,14 @@ public class TimingAcquisition {
...
@@ -1801,7 +1841,14 @@ public class TimingAcquisition {
//找到对应的称呼id
//找到对应的称呼id
List
<
CallNamePojo
>
callNamePojoList
=
callNameMap
.
values
().
stream
().
filter
(
callNamePojo
->
gender
.
equals
(
callNamePojo
.
getGender
())).
collect
(
Collectors
.
toList
());
List
<
CallNamePojo
>
callNamePojoList
=
callNameMap
.
values
().
stream
().
filter
(
callNamePojo
->
gender
.
equals
(
callNamePojo
.
getGender
())).
collect
(
Collectors
.
toList
());
List
<
String
>
callNameList
=
callNamePojoList
.
stream
().
map
(
CallNamePojo:
:
getName
).
collect
(
Collectors
.
toList
());
List
<
String
>
callNameList
=
callNamePojoList
.
stream
().
map
(
CallNamePojo:
:
getName
).
collect
(
Collectors
.
toList
());
return
String
.
join
(
"、"
,
callNameList
);
StringBuilder
text
=
new
StringBuilder
();
for
(
String
name
:
callNameList
)
{
text
.
append
(
"🅰"
).
append
(
name
).
append
(
"🅱"
).
append
(
"、"
);
}
if
(
text
.
length
()
!=
0
)
{
text
.
deleteCharAt
(
text
.
length
()
-
1
);
}
return
text
.
toString
();
}
}
/**
/**
...
...
src/main/java/com/qiwuai/garden/common/cache/CacheUtil.java
View file @
62ae40e0
...
@@ -20,7 +20,7 @@ public class CacheUtil {
...
@@ -20,7 +20,7 @@ public class CacheUtil {
MyCache
myCache
=
CacheGlobal
.
concurrentMap
.
get
(
key
);
MyCache
myCache
=
CacheGlobal
.
concurrentMap
.
get
(
key
);
myCache
.
setHitCount
(
myCache
.
getHitCount
()
+
1
);
myCache
.
setHitCount
(
myCache
.
getHitCount
()
+
1
);
myCache
.
setLastTime
(
System
.
currentTimeMillis
());
myCache
.
setLastTime
(
System
.
currentTimeMillis
());
myCache
.
setExpireTime
(
System
.
currentTimeMillis
()
);
myCache
.
setExpireTime
(
expire
);
myCache
.
setValue
(
value
);
myCache
.
setValue
(
value
);
}
}
MyCache
myCache
=
new
MyCache
();
MyCache
myCache
=
new
MyCache
();
...
...
src/main/java/com/qiwuai/garden/common/config/RedisConfig.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
common
.
config
;
import
com.fasterxml.jackson.annotation.JsonAutoDetect
;
import
com.fasterxml.jackson.annotation.JsonTypeInfo
;
import
com.fasterxml.jackson.annotation.PropertyAccessor
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator
;
import
org.springframework.cache.annotation.CachingConfigurerSupport
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
@Configuration
public
class
RedisConfig
extends
CachingConfigurerSupport
{
@Bean
public
RedisTemplate
<
String
,
Object
>
redisTemplate
(
RedisConnectionFactory
redisConnectionFactory
)
{
RedisTemplate
<
String
,
Object
>
redisTemplate
=
new
RedisTemplate
<>();
redisTemplate
.
setConnectionFactory
(
redisConnectionFactory
);
Jackson2JsonRedisSerializer
<
Object
>
jackson2JsonRedisSerializer
=
new
Jackson2JsonRedisSerializer
<>(
Object
.
class
);
ObjectMapper
om
=
new
ObjectMapper
();
om
.
setVisibility
(
PropertyAccessor
.
ALL
,
JsonAutoDetect
.
Visibility
.
ANY
);
om
.
activateDefaultTyping
(
LaissezFaireSubTypeValidator
.
instance
,
ObjectMapper
.
DefaultTyping
.
NON_FINAL
,
JsonTypeInfo
.
As
.
PROPERTY
);
jackson2JsonRedisSerializer
.
setObjectMapper
(
om
);
StringRedisSerializer
stringRedisSerializer
=
new
StringRedisSerializer
();
// key采用String的序列化方式
redisTemplate
.
setKeySerializer
(
stringRedisSerializer
);
// hash的key也采用String的序列化方式
redisTemplate
.
setHashKeySerializer
(
stringRedisSerializer
);
// value序列化方式采用jackson
redisTemplate
.
setValueSerializer
(
jackson2JsonRedisSerializer
);
// hash的value序列化方式采用jackson
redisTemplate
.
setHashValueSerializer
(
jackson2JsonRedisSerializer
);
redisTemplate
.
afterPropertiesSet
();
return
redisTemplate
;
}
@Bean
public
StringRedisTemplate
stringRedisTemplate
(
RedisConnectionFactory
redisConnectionFactory
){
StringRedisTemplate
stringRedisTemplate
=
new
StringRedisTemplate
();
stringRedisTemplate
.
setConnectionFactory
(
redisConnectionFactory
);
return
stringRedisTemplate
;
}
}
src/main/java/com/qiwuai/garden/common/schedule/ScheduleTask.java
View file @
62ae40e0
...
@@ -5,10 +5,9 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,10 +5,9 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.utils.PersistenceUtil
;
import
com.qiwuai.garden.common.utils.*
;
import
com.qiwuai.garden.common.utils.RankingUtil
;
import
com.qiwuai.garden.common.utils.TypeConvertUtil
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.pojo.CopyPetPojo
;
import
com.qiwuai.garden.pojo.ItemPojo
;
import
com.qiwuai.garden.pojo.ItemPojo
;
import
com.qiwuai.garden.pojo.PetPojo
;
import
com.qiwuai.garden.pojo.PetPojo
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -21,6 +20,8 @@ import org.springframework.scheduling.annotation.Scheduled;
...
@@ -21,6 +20,8 @@ import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
...
@@ -146,6 +147,34 @@ public class ScheduleTask {
...
@@ -146,6 +147,34 @@ public class ScheduleTask {
log
.
info
(
"----------------排行榜更新完成----------------"
);
log
.
info
(
"----------------排行榜更新完成----------------"
);
}
}
@Scheduled
(
cron
=
"0 0 3 * * 1"
)
// @Scheduled(cron = "2 * * * * *")
public
void
updateCopyPet
()
{
log
.
info
(
"----------------开始刷新每周副本的宠物----------------"
);
Map
<
Integer
,
CopyPetDto
>
copyPetMap
=
new
HashMap
<>();
CopyPetDto
copyPet
=
new
CopyPetDto
();
Map
<
Integer
,
CopyPetPojo
>
copyPetInfoMap
=
TimingAcquisition
.
copyPetPojoMap
;
for
(
Map
.
Entry
<
Integer
,
CopyPetPojo
>
entry
:
copyPetInfoMap
.
entrySet
())
{
CopyPetPojo
copyPetPojo
=
entry
.
getValue
();
int
num
=
TimingAcquisition
.
copyPetMap
.
get
(
entry
.
getKey
()).
getNum
()
+
1
;
List
<
Integer
>
copyPetList
=
AdviseUtil
.
updateCopyPet
(
copyPetPojo
,
num
);
String
[]
copyPets
=
copyPetPojo
.
getCopyPets
().
split
(
"\\|"
);
if
(
num
>
copyPets
.
length
)
{
num
=
1
;
}
copyPet
.
setNum
(
num
);
copyPet
.
setCopyPetList
(
copyPetList
);
copyPet
.
setTime
(
DateUtil
.
getCurrentTime
());
copyPetMap
.
put
(
entry
.
getKey
(),
copyPet
);
}
//更新缓存
TimingAcquisition
.
copyPetMap
.
putAll
(
copyPetMap
);
//保存到json文件中
String
copyPetMapStr
=
JSON
.
toJSONString
(
copyPetMap
);
PersistenceUtil
.
saveConfigToFile
(
"copyPet.json"
,
copyPetMapStr
);
log
.
info
(
"----------------每周副本的宠物刷新完成----------------"
);
}
/**
/**
* 喂养宠物栏中的宠物
* 喂养宠物栏中的宠物
* @param uid
* @param uid
...
...
src/main/java/com/qiwuai/garden/common/utils/AdviseUtil.java
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
common
.
utils
;
package
com
.
qiwuai
.
garden
.
common
.
utils
;
import
com.alibaba.fastjson.JSON
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.dto.*
;
...
@@ -113,7 +114,7 @@ public class AdviseUtil {
...
@@ -113,7 +114,7 @@ public class AdviseUtil {
if
(!
nurseryNumList
.
contains
(
nurseryNum
))
{
if
(!
nurseryNumList
.
contains
(
nurseryNum
))
{
return
false
;
return
false
;
}
}
//玩家园丁和背包状态是否满足种植
//玩家园丁和背包状态是否满足种植
,允许果实数量不够
if
(!
checkCanPlantItems
(
uid
,
nurseryNum
,
plantId
))
{
if
(!
checkCanPlantItems
(
uid
,
nurseryNum
,
plantId
))
{
return
false
;
return
false
;
}
}
...
@@ -448,6 +449,7 @@ public class AdviseUtil {
...
@@ -448,6 +449,7 @@ public class AdviseUtil {
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
//该花圃存在
//该花圃存在
if
(!
StringUtils
.
isEmpty
(
nurseryInfo
))
{
if
(!
StringUtils
.
isEmpty
(
nurseryInfo
))
{
//找到可以种的植物
plantIdList
=
findPlantIdsByNurseryId
(
nurseryInfo
.
getId
());
plantIdList
=
findPlantIdsByNurseryId
(
nurseryInfo
.
getId
());
}
}
return
plantIdList
;
return
plantIdList
;
...
@@ -519,7 +521,7 @@ public class AdviseUtil {
...
@@ -519,7 +521,7 @@ public class AdviseUtil {
//植物i的等级
//植物i的等级
plantILevel
=
TimingAcquisition
.
plantMap
.
get
(
plantIdList
.
get
(
i
)).
getGardenerLevel
();
plantILevel
=
TimingAcquisition
.
plantMap
.
get
(
plantIdList
.
get
(
i
)).
getGardenerLevel
();
//植物j的等级
//植物j的等级
plant
ILevel
=
TimingAcquisition
.
plantMap
.
get
(
plantIdList
.
get
(
i
)).
getGardenerLevel
();
plant
JLevel
=
TimingAcquisition
.
plantMap
.
get
(
plantIdList
.
get
(
j
)).
getGardenerLevel
();
}
}
Collections
.
swap
(
plantIdList
,
start
,
i
);
Collections
.
swap
(
plantIdList
,
start
,
i
);
plantIdQuickSort
(
plantIdList
,
start
,
j
-
1
);
plantIdQuickSort
(
plantIdList
,
start
,
j
-
1
);
...
@@ -717,8 +719,12 @@ public class AdviseUtil {
...
@@ -717,8 +719,12 @@ public class AdviseUtil {
List
<
Integer
>
plantIdList
=
findPlantIdToNursery
(
uid
,
nurseryNum
);
List
<
Integer
>
plantIdList
=
findPlantIdToNursery
(
uid
,
nurseryNum
);
if
(
plantIdList
.
size
()
!=
0
)
{
if
(
plantIdList
.
size
()
!=
0
)
{
for
(
Integer
canPlantId
:
plantIdList
)
{
for
(
Integer
canPlantId
:
plantIdList
)
{
//在花圃nurseryNum是否可种植plantId
//在花圃nurseryNum是否可种植plantId,果实需要必须满足
if
(
checkPlantToNurseryNum
(
uid
,
nurseryNum
,
canPlantId
))
{
// if (checkPlantToNurseryNum(uid, nurseryNum, canPlantId)) {
// canPlantIdList.add(canPlantId);
// }
//在花圃nurseryNum是否可种植plantId,不考虑果实数量
if
(
checkCanPlantToNurseryNum
(
uid
,
nurseryNum
,
canPlantId
))
{
canPlantIdList
.
add
(
canPlantId
);
canPlantIdList
.
add
(
canPlantId
);
}
}
}
}
...
@@ -1100,6 +1106,7 @@ public class AdviseUtil {
...
@@ -1100,6 +1106,7 @@ public class AdviseUtil {
*/
*/
public
static
List
<
ItemDto
>
getPlantLackMaterials
(
String
uid
,
Integer
plantId
)
{
public
static
List
<
ItemDto
>
getPlantLackMaterials
(
String
uid
,
Integer
plantId
)
{
List
<
ItemDto
>
plantLackMaterialList
=
new
ArrayList
<>();
List
<
ItemDto
>
plantLackMaterialList
=
new
ArrayList
<>();
List
<
ItemDto
>
costItemList
=
new
ArrayList
<>();
//植物所需消耗物品
//植物所需消耗物品
String
costItemNums
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getCostItemNums
();
String
costItemNums
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getCostItemNums
();
//获取当前玩家的背包
//获取当前玩家的背包
...
@@ -1107,11 +1114,10 @@ public class AdviseUtil {
...
@@ -1107,11 +1114,10 @@ public class AdviseUtil {
if
(!
StringUtils
.
isEmpty
(
costItemNums
)
&&
!
Constants
.
NON_STR
.
equals
(
costItemNums
))
{
if
(!
StringUtils
.
isEmpty
(
costItemNums
)
&&
!
Constants
.
NON_STR
.
equals
(
costItemNums
))
{
//货币配置信息
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
List
<
ItemDto
>
costItemList
=
TypeConvertUtil
.
itemString2List
(
costItemNums
);
costItemList
=
TypeConvertUtil
.
itemString2List
(
costItemNums
);
costItemList
.
removeIf
(
itemDto
->
moneyId
.
equals
(
itemDto
.
getItemId
()));
costItemList
.
removeIf
(
itemDto
->
moneyId
.
equals
(
itemDto
.
getItemId
()));
plantLackMaterialList
=
TypeConvertUtil
.
listMerge
(
costItemList
,
plantLackMaterialList
);
}
}
for
(
ItemDto
item
:
plantLackMaterial
List
)
{
for
(
ItemDto
item
:
costItem
List
)
{
Integer
itemType
=
TimingAcquisition
.
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
Integer
itemType
=
TimingAcquisition
.
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
//背包中对应种类的袋子
//背包中对应种类的袋子
ItemBagDto
itemBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
itemType
);
ItemBagDto
itemBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
itemType
);
...
@@ -3473,4 +3479,205 @@ public class AdviseUtil {
...
@@ -3473,4 +3479,205 @@ public class AdviseUtil {
Collections
.
swap
(
itemList
,
i
,
right
);
Collections
.
swap
(
itemList
,
i
,
right
);
return
i
;
return
i
;
}
}
/**
* 判断是否开启发放关键物品的任务
*/
public
static
boolean
updateLevelCheck
(
String
uid
)
{
boolean
result
=
true
;
//园丁基本信息
GardenerInfoDto
gardenerInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
();
//园丁下个等级配置信息
GardenerLevelPojo
gardenerLevelConfig
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
gardenerInfo
.
getLevel
()
+
1
);
//升级所需物品
List
<
ItemDto
>
itemList
=
TypeConvertUtil
.
itemString2List
(
gardenerLevelConfig
.
getCostItemNums
());
//物品配置信息
Map
<
Integer
,
ItemPojo
>
itemConfigMap
=
TimingAcquisition
.
itemConfigMap
;
//已完成任务清单详情
Map
<
Integer
,
Integer
>
taskCountMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getTaskCountMap
();
//玩家当前所有养成任务
Map
<
Integer
,
Integer
>
updateTaskFinishMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getTaskFinishMap
();
String
[]
taskIdList
=
gardenerLevelConfig
.
getTaskIds
().
split
(
"\\|"
);
//遍历下一等级需完成的任务
for
(
String
taskIdStr
:
taskIdList
)
{
int
taskId
=
Integer
.
parseInt
(
taskIdStr
);
//还没有的养成任务
if
(
Constants
.
TASK_FINISH_NO
.
equals
(
updateTaskFinishMap
.
get
(
taskId
)))
{
//任务的配置信息
TaskPojo
task
=
TimingAcquisition
.
taskMap
.
get
(
taskId
);
//该任务事件已完成次数
Integer
finishTimes
=
taskCountMap
.
get
(
task
.
getEventId
());
//配置修改后,任务已完成
if
(
task
.
getTimes
()
<=
finishTimes
)
{
updateTaskFinishMap
.
put
(
taskId
,
Constants
.
TASK_FINISH_YES
);
}
else
{
return
false
;
}
}
}
//遍历所有升级所需物品
for
(
ItemDto
item
:
itemList
)
{
//物品对应种类
Integer
itemType
=
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
//背包中对应种类的袋子
ItemBagDto
itemBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
itemType
);
//关键物品为bot发放的关键物品,不考虑
if
(
itemType
!=
Constants
.
ITEM_TYPE_OTHER
)
{
if
(
StringUtils
.
isEmpty
(
itemBag
))
{
return
false
;
}
if
(
StringUtils
.
isEmpty
(
itemBag
.
getItems
(
item
.
getItemId
())))
{
return
false
;
}
if
(
item
.
getItemNum
()
>
itemBag
.
getItems
(
item
.
getItemId
()).
getItemNum
())
{
return
false
;
}
}
else
{
if
(!
StringUtils
.
isEmpty
(
itemBag
))
{
if
(!
StringUtils
.
isEmpty
(
itemBag
.
getItems
(
item
.
getItemId
())))
{
if
(
item
.
getItemNum
()
<=
itemBag
.
getItems
(
item
.
getItemId
()).
getItemNum
())
{
result
=
false
;
}
}
}
}
}
return
result
;
}
/**
* 添加通知bot发放关键物品的话术
*/
public
static
String
addGiveKeyItemTip
(
String
uid
,
String
text
)
{
Integer
level
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
();
Integer
gender
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getGender
();
switch
(
level
)
{
case
1
:
break
;
case
2
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:春街小雨润如酥◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:又是一年春好处◄"
;
}
break
;
case
3
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:一醉江湖三十春◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:最甜故乡水◄"
;
}
break
;
case
4
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:倾君半生承一诺◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:最美故乡月◄"
;
}
break
;
case
5
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品: 劝君更尽一杯酒◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:神里凌华不会歪◄"
;
}
break
;
case
6
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:西出阳关无故人◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:莫愁前路无知己◄"
;
}
break
;
case
7
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:江山代有才人出◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:青山一道同云雨◄"
;
}
break
;
case
8
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:各领风骚数百年◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:明月何曾是两乡 ◄"
;
}
break
;
case
9
:
if
(
gender
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:我本将心向明月◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:奈何明月照沟渠◄"
;
}
break
;
}
return
text
;
}
/**
* 副本宠物刷新
* @param copyPetPojo
* @param num
*/
public
static
List
<
Integer
>
updateCopyPet
(
CopyPetPojo
copyPetPojo
,
int
num
)
{
String
[]
copyPets
=
copyPetPojo
.
getCopyPets
().
split
(
"\\|"
);
if
(
num
>
copyPets
.
length
)
{
num
=
1
;
}
String
copyPet
=
copyPets
[
num
-
1
];
return
(
List
<
Integer
>)
JSON
.
parse
(
copyPet
);
}
/**
* 选择满足稀有度等级的所有宠物
*/
public
static
List
<
PetPojo
>
getPetByRarity
(
int
rarity
)
{
List
<
PetPojo
>
petList
=
new
ArrayList
<>();
Map
<
Integer
,
PetPojo
>
petPojoMap
=
TimingAcquisition
.
petConfigMap
;
for
(
Map
.
Entry
<
Integer
,
PetPojo
>
entry
:
petPojoMap
.
entrySet
())
{
PetPojo
petPojo
=
entry
.
getValue
();
if
(
petPojo
.
getRarityId
()
<=
rarity
)
{
petList
.
add
(
petPojo
);
}
}
return
petList
;
}
/**
* 判断玩家货币是否足够
*/
public
static
boolean
checkMoney
(
String
uid
,
int
num
)
{
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
//货币对应种类
Integer
moneyType
=
TimingAcquisition
.
itemConfigMap
.
get
(
moneyId
).
getItemTypeId
();
//根据种类id取出背包里的钱
ItemDto
moneyBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
moneyType
).
getItems
(
moneyId
);
Integer
money
=
moneyBag
.
getItemNum
();
return
num
<=
money
;
}
/**
* 将指定宠物放到空位,优先放在宠物栏。有空位则放置并返回位置,没空位返回-1
*/
public
static
int
putPetToSeat
(
String
uid
,
Integer
petId
)
{
//获取玩家的宠物栏位
List
<
Integer
>
petList
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getPetFields
();
//获取玩家所有花圃信息
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
//宠物位置上限
int
posMax
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
()).
getPetNumMax
();
if
(
petList
.
size
()
<
posMax
)
{
petList
.
add
(
petId
);
return
0
;
}
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPetField
()))
{
nurseryInfo
.
setPetField
(
petId
);
return
entry
.
getKey
();
}
}
return
-
1
;
}
}
}
src/main/java/com/qiwuai/garden/common/utils/DataTrimUtil.java
View file @
62ae40e0
...
@@ -5,6 +5,7 @@ import com.qiwuai.garden.common.TimingAcquisition;
...
@@ -5,6 +5,7 @@ import com.qiwuai.garden.common.TimingAcquisition;
import
com.qiwuai.garden.common.cache.CacheUtil
;
import
com.qiwuai.garden.common.cache.CacheUtil
;
import
com.qiwuai.garden.dto.FriendDto
;
import
com.qiwuai.garden.dto.FriendDto
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.NurseryInfoDto
;
import
com.qiwuai.garden.dto.base.CommonResponse
;
import
com.qiwuai.garden.dto.base.CommonResponse
;
import
com.qiwuai.garden.dto.base.ResultVarsResponse
;
import
com.qiwuai.garden.dto.base.ResultVarsResponse
;
import
com.qiwuai.garden.dto.request.OperationRequest
;
import
com.qiwuai.garden.dto.request.OperationRequest
;
...
@@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory;
...
@@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -58,6 +60,19 @@ public class DataTrimUtil {
...
@@ -58,6 +60,19 @@ public class DataTrimUtil {
gardener
.
setStealTimes
(
0
);
gardener
.
setStealTimes
(
0
);
//重置“今日已偷取的陌生人”
//重置“今日已偷取的陌生人”
gardener
.
setStrangerMap
(
null
);
gardener
.
setStrangerMap
(
null
);
//今日问候次数重置为0
Map
<
String
,
Integer
>
helloSignMap
=
gardener
.
getHelloSignMap
();
if
(!
StringUtils
.
isEmpty
(
helloSignMap
))
{
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
helloSignMap
.
entrySet
())
{
entry
.
setValue
(
0
);
}
}
//花圃记录的上一次收益比例重置
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
gardener
.
getGarden
().
getNurseryInfos
();
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
nurseryInfo
.
setLastEarnRate
(
null
);
}
//更新玩家在线状态
//更新玩家在线状态
statusUpdate
(
uid
);
statusUpdate
(
uid
);
}
}
...
@@ -124,6 +139,7 @@ public class DataTrimUtil {
...
@@ -124,6 +139,7 @@ public class DataTrimUtil {
Integer
moneyNum
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
()
Integer
moneyNum
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
()
.
get
(
Constants
.
ITEM_TYPE_MONEY
).
getItems
(
moneyId
).
getItemNum
();
.
get
(
Constants
.
ITEM_TYPE_MONEY
).
getItems
(
moneyId
).
getItemNum
();
data
.
getVars
().
set
玩家金币数量
(
moneyNum
);
data
.
getVars
().
set
玩家金币数量
(
moneyNum
);
data
.
getVars
().
set
当前园丁等级
(
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
());
//------------是否有宠物----------
//------------是否有宠物----------
int
petCount
=
TimingAcquisition
.
getPetNum
(
uid
);
int
petCount
=
TimingAcquisition
.
getPetNum
(
uid
);
if
(
petCount
>
0
)
{
if
(
petCount
>
0
)
{
...
@@ -151,6 +167,7 @@ public class DataTrimUtil {
...
@@ -151,6 +167,7 @@ public class DataTrimUtil {
", 消息提醒:"
+
data
.
getVars
().
get
消息提醒
()
+
", 消息提醒:"
+
data
.
getVars
().
get
消息提醒
()
+
", 任务完成:"
+
data
.
getVars
().
get
任务完成
()
+
", 任务完成:"
+
data
.
getVars
().
get
任务完成
()
+
", 玩家金币数量:"
+
data
.
getVars
().
get
玩家金币数量
()
+
", 玩家金币数量:"
+
data
.
getVars
().
get
玩家金币数量
()
+
", 当前园丁等级:"
+
data
.
getVars
().
get
当前园丁等级
()
+
", 是否有宠物:"
+
data
.
getVars
().
get
是否有宠物
()
+
", 是否有宠物:"
+
data
.
getVars
().
get
是否有宠物
()
+
", 是否有植物:"
+
data
.
getVars
().
get
是否有植物
()
+
", 是否有植物:"
+
data
.
getVars
().
get
是否有植物
()
+
", 是否开启日常任务:"
+
data
.
getVars
().
get
是否开启日常任务
()
+
", 是否开启日常任务:"
+
data
.
getVars
().
get
是否开启日常任务
()
+
...
...
src/main/java/com/qiwuai/garden/common/utils/PersistenceUtil.java
View file @
62ae40e0
...
@@ -135,6 +135,38 @@ public class PersistenceUtil {
...
@@ -135,6 +135,38 @@ public class PersistenceUtil {
}
}
}
}
}
}
/**
* 保存各配置信息到json文件
* @param filePath
* @param data
* @return void
*/
public
static
void
saveToFile
(
String
filePath
,
String
data
)
{
BufferedWriter
writer
=
null
;
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
())
{
try
{
file
.
createNewFile
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
try
{
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
file
,
false
),
"UTF-8"
));
writer
.
write
(
data
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
writer
!=
null
)
{
writer
.
close
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
/**
/**
* 从json文件中读取各配置文件的信息
* 从json文件中读取各配置文件的信息
* @param fileName
* @param fileName
...
@@ -143,6 +175,10 @@ public class PersistenceUtil {
...
@@ -143,6 +175,10 @@ public class PersistenceUtil {
public
static
String
getConfigFromFile
(
String
configFilePath
,
String
fileName
)
{
public
static
String
getConfigFromFile
(
String
configFilePath
,
String
fileName
)
{
BufferedReader
reader
=
null
;
BufferedReader
reader
=
null
;
String
lastStr
=
""
;
String
lastStr
=
""
;
File
file
=
new
File
(
configFilePath
+
fileName
);
if
(!
file
.
exists
())
{
return
lastStr
;
}
try
{
try
{
FileInputStream
fileInputStream
=
new
FileInputStream
(
configFilePath
+
fileName
);
FileInputStream
fileInputStream
=
new
FileInputStream
(
configFilePath
+
fileName
);
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
fileInputStream
,
"UTF-8"
);
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
fileInputStream
,
"UTF-8"
);
...
...
src/main/java/com/qiwuai/garden/common/utils/RankingUtil.java
View file @
62ae40e0
...
@@ -325,7 +325,7 @@ public class RankingUtil {
...
@@ -325,7 +325,7 @@ public class RankingUtil {
//没有左右子节点,即最后一个叶子节点
//没有左右子节点,即最后一个叶子节点
if
(
leftIndex
>
maxIndex
)
{
if
(
leftIndex
>
maxIndex
)
{
return
;
return
;
}
else
if
(
rightIndex
>
maxIndex
)
{
}
else
if
(
rightIndex
>
maxIndex
)
{
//仅存在左节点
resultIndex
=
minResult
(
playerTimesList
,
leftIndex
,
parentIndex
);
resultIndex
=
minResult
(
playerTimesList
,
leftIndex
,
parentIndex
);
}
else
{
//左右节点都存在
}
else
{
//左右节点都存在
resultIndex
=
minResult
(
playerTimesList
,
leftIndex
,
rightIndex
);
resultIndex
=
minResult
(
playerTimesList
,
leftIndex
,
rightIndex
);
...
...
src/main/java/com/qiwuai/garden/common/utils/RedisUtil.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
common
.
utils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
java.util.concurrent.TimeUnit
;
@Component
public
class
RedisUtil
{
@Value
(
"${expireTime}"
)
private
String
expireTime
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
public
void
setStr
(
String
key
,
String
value
)
{
//存入redis缓存中,设置过期时间
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
Long
.
parseLong
(
expireTime
),
TimeUnit
.
MILLISECONDS
);
}
public
String
getStr
(
String
key
)
{
//存redis缓存中根据key取出value
return
(
String
)
redisTemplate
.
opsForValue
().
get
(
key
);
}
public
void
setHash
(
String
key
,
String
hk
,
String
hv
)
{
//存入redis缓存中
redisTemplate
.
opsForHash
().
put
(
key
,
hk
,
hv
);
//设置过期时间
redisTemplate
.
opsForHash
().
getOperations
().
expire
(
key
,
Long
.
parseLong
(
expireTime
),
TimeUnit
.
MILLISECONDS
);
}
public
String
getHash
(
String
key
,
String
hk
)
{
//存入redis缓存中
return
(
String
)
redisTemplate
.
opsForHash
().
get
(
key
,
hk
);
}
public
void
delHash
(
String
key
,
String
hk
)
{
redisTemplate
.
opsForHash
().
delete
(
key
,
hk
);
}
//判断key是否存在
public
boolean
keyIsExists
(
String
key
)
{
return
Boolean
.
TRUE
.
equals
(
redisTemplate
.
hasKey
(
key
));
}
//key续期
public
void
renewalStr
(
String
key
,
long
times
,
TimeUnit
timeUnit
)
{
if
(!
StringUtils
.
isEmpty
(
getStr
(
key
)))
{
//设置过期时间
redisTemplate
.
opsForValue
().
getOperations
().
expire
(
key
,
times
,
timeUnit
);
}
}
//key续期
public
void
renewalHash
(
String
key
,
String
hk
,
long
times
,
TimeUnit
timeUnit
)
{
if
(!
StringUtils
.
isEmpty
(
getHash
(
key
,
hk
)))
{
//设置过期时间
redisTemplate
.
opsForHash
().
getOperations
().
expire
(
key
,
times
,
timeUnit
);
}
}
}
src/main/java/com/qiwuai/garden/common/utils/RequestConversionUtil.java
View file @
62ae40e0
...
@@ -26,7 +26,8 @@ public class RequestConversionUtil {
...
@@ -26,7 +26,8 @@ public class RequestConversionUtil {
public
static
OperationRequest
request2Operation
(
CommonRequest
commonRequest
)
{
public
static
OperationRequest
request2Operation
(
CommonRequest
commonRequest
)
{
OperationRequest
operationRequest
=
new
OperationRequest
();
OperationRequest
operationRequest
=
new
OperationRequest
();
CallRequest
callRequest
=
commonRequest
.
getVars
();
CallRequest
callRequest
=
commonRequest
.
getVars
();
operationRequest
.
setUid
(
commonRequest
.
getUid
());
String
uid
=
commonRequest
.
getUid
();
operationRequest
.
setUid
(
uid
);
//---------------------存在GB_园丁姓名-----------------------
//---------------------存在GB_园丁姓名-----------------------
String
gardenerName
=
callRequest
.
getGB_
园丁姓名
();
String
gardenerName
=
callRequest
.
getGB_
园丁姓名
();
if
(!
StringUtils
.
isEmpty
(
gardenerName
))
{
if
(!
StringUtils
.
isEmpty
(
gardenerName
))
{
...
@@ -190,7 +191,7 @@ public class RequestConversionUtil {
...
@@ -190,7 +191,7 @@ public class RequestConversionUtil {
if
(
number
!=
Constants
.
REQ_NON
)
{
if
(
number
!=
Constants
.
REQ_NON
)
{
operationRequest
.
setRank
(
number
);
operationRequest
.
setRank
(
number
);
}
else
{
}
else
{
Integer
callNameId
=
TimingAcquisition
.
getCallNameId
(
commonRequest
.
getUid
()
,
callName
);
Integer
callNameId
=
TimingAcquisition
.
getCallNameId
(
uid
,
callName
);
operationRequest
.
setCallNameId
(
callNameId
);
operationRequest
.
setCallNameId
(
callNameId
);
}
}
}
else
{
}
else
{
...
@@ -396,9 +397,9 @@ public class RequestConversionUtil {
...
@@ -396,9 +397,9 @@ public class RequestConversionUtil {
operationRequest
.
setEarnRate
(
rate
);
operationRequest
.
setEarnRate
(
rate
);
}
}
//----------存在留言内容----------
//----------存在留言内容----------
String
message
=
callRequest
.
get
留言内容
();
String
message
Change
=
callRequest
.
get
留言内容
();
if
(!
StringUtils
.
isEmpty
(
message
))
{
if
(!
StringUtils
.
isEmpty
(
message
Change
))
{
operationRequest
.
setMessage
(
messa
ge
);
operationRequest
.
setMessage
Change
(
messageChan
ge
);
}
}
//----------存在留言序号-----------
//----------存在留言序号-----------
String
messageNum
=
callRequest
.
get
留言序号
();
String
messageNum
=
callRequest
.
get
留言序号
();
...
@@ -533,6 +534,27 @@ public class RequestConversionUtil {
...
@@ -533,6 +534,27 @@ public class RequestConversionUtil {
}
}
operationRequest
.
setRankNumber
(
number
);
operationRequest
.
setRankNumber
(
number
);
}
}
//--------存在下注数额-----------
String
pay
=
callRequest
.
get
下注数额
();
if
(!
StringUtils
.
isEmpty
(
pay
))
{
//找到中文数字对应的阿拉伯数字
Integer
number
=
TypeConvertUtil
.
change2Integer
(
pay
);
//中文中不包含中文数字时,提取阿拉伯数字
if
(
number
==
0
)
{
number
=
TypeConvertUtil
.
extractNum
(
pay
);
}
operationRequest
.
setPay
(
number
);
}
//--------存在留言意图-----------
String
intention
=
callRequest
.
get
留言意图
();
if
(!
StringUtils
.
isEmpty
(
intention
))
{
operationRequest
.
setIntention
(
Integer
.
parseInt
(
intention
));
}
//-------------------存在副本名称---------------
String
copyName
=
callRequest
.
get
副本名称
();
if
(!
StringUtils
.
isEmpty
(
copyName
))
{
operationRequest
.
setCopyName
(
copyName
);
}
return
operationRequest
;
return
operationRequest
;
}
}
}
}
src/main/java/com/qiwuai/garden/common/utils/SpeechUtil.java
View file @
62ae40e0
...
@@ -132,6 +132,20 @@ public class SpeechUtil {
...
@@ -132,6 +132,20 @@ public class SpeechUtil {
}
}
/**
/**
* 从留言模块话术获取话术
* @param someone
* @param feedText
* @return String
*/
public
static
String
getMessageSpeech
(
String
someone
,
Integer
feedText
)
{
String
result
=
""
;
List
<
String
>
speech
=
TimingAcquisition
.
messageSpeechMap
.
get
(
someone
).
get
(
feedText
);
Integer
i
=
RandomDropUtil
.
getRandomNum
(
0
,
speech
.
size
());
result
=
speech
.
get
(
i
);
return
result
;
}
/**
* 替换话术中的一个数字
* 替换话术中的一个数字
* @param one
* @param one
* @return String
* @return String
...
...
src/main/java/com/qiwuai/garden/controller/CommonController.java
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
controller
;
package
com
.
qiwuai
.
garden
.
controller
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.ProxyFactory
;
import
com.qiwuai.garden.common.ProxyFactory
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.cache.CacheUtil
;
import
com.qiwuai.garden.common.utils.DataTrimUtil
;
import
com.qiwuai.garden.common.utils.DataTrimUtil
;
import
com.qiwuai.garden.common.utils.RequestConversionUtil
;
import
com.qiwuai.garden.common.utils.RequestConversionUtil
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.GardenerDto
;
...
@@ -43,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -43,6 +45,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Arrays
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/secretGarden"
)
@RequestMapping
(
"/secretGarden"
)
...
@@ -153,7 +157,6 @@ public class CommonController {
...
@@ -153,7 +157,6 @@ public class CommonController {
}
}
OperationRequest
operationReq
=
RequestConversionUtil
.
request2Operation
(
commonRequest
);
OperationRequest
operationReq
=
RequestConversionUtil
.
request2Operation
(
commonRequest
);
String
operateName
=
commonRequest
.
getVars
().
get
操作名
();
String
operateName
=
commonRequest
.
getVars
().
get
操作名
();
log
.
info
(
uid
+
"开始执行操作:【"
+
operateName
+
"】, 请求参数:"
+
operationReq
);
//操作名为null
//操作名为null
if
(
StringUtils
.
isEmpty
(
operateName
))
{
if
(
StringUtils
.
isEmpty
(
operateName
))
{
log
.
info
(
uid
+
"未提供操作名,无法操作"
);
log
.
info
(
uid
+
"未提供操作名,无法操作"
);
...
@@ -167,9 +170,30 @@ public class CommonController {
...
@@ -167,9 +170,30 @@ public class CommonController {
result
.
setData
(
resultVarsResponse
);
result
.
setData
(
resultVarsResponse
);
return
result
;
return
result
;
}
}
log
.
info
(
uid
+
"开始执行操作:【"
+
operateName
+
"】, 请求参数:"
+
operationReq
);
//套圈游戏时,需要限制操作
//当前玩家上一轮的请求信息
// List<String> operateNameList = Arrays.asList("总览查询指令", "宠物删除指令", "确认宠物删除指令", "取消宠物删除指令");
// OperationRequest lastReq = (OperationRequest) CacheUtil.get(uid + "#pitchPet#");
// if (!StringUtils.isEmpty(lastReq)) {
// if (Constants.PITCH_PET.equals(lastReq.getOperationLabel())) {
// if (!operateNameList.contains(operateName)) {
// String petName = TimingAcquisition.petConfigMap.get(lastReq.getPetId()).getName();
// ResultVarsResponse resultVarsResponse = new ResultVarsResponse();
// ResultResponse resultResponse = new ResultResponse();
// log.info(uid + "执行操作:" + operateName + ",不是套圈过程运行的操作");
// result.setCode(1);
// result.setMsg("成功");
// resultResponse.set反馈ID(100006);
// resultResponse.set反馈文本("【旁白@正常】您想要放弃获取" + petName + "吗?");
// resultVarsResponse.setVars(resultResponse);
// result.setData(resultVarsResponse);
// return result;
// }
// }
// }
//登录玩家,修改在线状态
//登录玩家,修改在线状态
DataTrimUtil
.
AdjustStatus
(
commonRequest
.
getUid
(),
offlineTime
);
DataTrimUtil
.
AdjustStatus
(
commonRequest
.
getUid
(),
offlineTime
);
switch
(
operateName
)
{
switch
(
operateName
)
{
case
"进入游戏"
:
case
"进入游戏"
:
result
=
gardenerService
.
enterGame
(
operationReq
);
result
=
gardenerService
.
enterGame
(
operationReq
);
...
@@ -330,6 +354,12 @@ public class CommonController {
...
@@ -330,6 +354,12 @@ public class CommonController {
case
"分类检索"
:
case
"分类检索"
:
result
=
backPackService
.
viewBackPackItem
(
operationReq
);
result
=
backPackService
.
viewBackPackItem
(
operationReq
);
break
;
break
;
case
"确认查看"
:
result
=
backPackService
.
viewSure
(
operationReq
);
break
;
case
"取消查看"
:
result
=
backPackService
.
viewCancel
(
operationReq
);
break
;
case
"货币检索"
:
case
"货币检索"
:
result
=
backPackService
.
viewMoney
(
operationReq
);
result
=
backPackService
.
viewMoney
(
operationReq
);
break
;
break
;
...
@@ -396,6 +426,27 @@ public class CommonController {
...
@@ -396,6 +426,27 @@ public class CommonController {
case
"升级宠物"
:
case
"升级宠物"
:
result
=
petService
.
updatePet
(
operationReq
);
result
=
petService
.
updatePet
(
operationReq
);
break
;
break
;
case
"宠物比试"
:
result
=
petService
.
petMatch
(
operationReq
);
break
;
case
"玩家选定宠物"
:
result
=
petService
.
petChoose
(
operationReq
);
break
;
case
"宠物比试结果"
:
result
=
petService
.
petMatchResult
(
operationReq
);
break
;
case
"挑战副本"
:
result
=
petService
.
brushCopy
(
operationReq
);
break
;
case
"挑战副本成功"
:
result
=
petService
.
brushCopySuccess
(
operationReq
);
break
;
case
"开始套圈游戏"
:
result
=
petService
.
startRingToss
(
operationReq
);
break
;
case
"重试套圈游戏"
:
result
=
petService
.
retryRingToss
(
operationReq
);
break
;
case
"购买指令"
:
case
"购买指令"
:
result
=
marketService
.
buyCheck
(
operationReq
);
result
=
marketService
.
buyCheck
(
operationReq
);
break
;
break
;
...
@@ -556,6 +607,9 @@ public class CommonController {
...
@@ -556,6 +607,9 @@ public class CommonController {
case
"开始留言"
:
case
"开始留言"
:
result
=
socialService
.
leaveMessageCheck
(
operationReq
);
result
=
socialService
.
leaveMessageCheck
(
operationReq
);
break
;
break
;
case
"留言指令"
:
result
=
socialService
.
leaveMessageCover
(
operationReq
);
break
;
case
"确定该留言"
:
case
"确定该留言"
:
result
=
socialService
.
leaveMessage
(
operationReq
);
result
=
socialService
.
leaveMessage
(
operationReq
);
break
;
break
;
...
...
src/main/java/com/qiwuai/garden/controller/PlayerController.java
View file @
62ae40e0
...
@@ -2,27 +2,38 @@ package com.qiwuai.garden.controller;
...
@@ -2,27 +2,38 @@ package com.qiwuai.garden.controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.config.DynamicFeignClient
;
import
com.qiwuai.garden.common.config.DynamicFeignClient
;
import
com.qiwuai.garden.common.utils.PersistenceUtil
;
import
com.qiwuai.garden.common.utils.PersistenceUtil
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.dto.BackPackDto
;
import
com.qiwuai.garden.common.utils.RedisUtil
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.dto.base.CommonResponse
;
import
com.qiwuai.garden.dto.request.PlayerRequest
;
import
com.qiwuai.garden.dto.response.CallResponse
;
import
com.qiwuai.garden.pojo.ItemPojo
;
import
com.qiwuai.garden.service.gardenerService.CommandService
;
import
com.qiwuai.garden.service.gardenerService.CommandService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
@RestController
@RestController
@RequestMapping
(
"/player"
)
@RequestMapping
(
"/player"
)
public
class
PlayerController
{
public
class
PlayerController
{
Logger
log
=
LoggerFactory
.
getLogger
(
PlayerController
.
class
);
@Autowired
@Autowired
DynamicFeignClient
<
CommandService
>
client
;
//动态更改服务名,进行远程接口调用
DynamicFeignClient
<
CommandService
>
client
;
//动态更改服务名,进行远程接口调用
@Autowired
private
RedisUtil
redisUtil
;
@GetMapping
(
"/login"
)
@GetMapping
(
"/login"
)
public
String
login
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
)
{
public
String
login
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
)
{
// playerService.verify(userName, password);
// playerService.verify(userName, password);
...
@@ -32,42 +43,138 @@ public class PlayerController {
...
@@ -32,42 +43,138 @@ public class PlayerController {
return
"玩家1:"
+
s
;
return
"玩家1:"
+
s
;
}
}
@GetMapping
(
"/notice"
)
/**
public
String
notice
()
{
* 获取背包中的货币数量
//map转JSON
*/
// String s = JSON.toJSONString(map);
@PostMapping
(
"/getMoney"
)
// PersistenceUtil.saveDataToFile("plantA", s);
public
CallResponse
getMoney
(
@RequestBody
PlayerRequest
playerRequest
)
{
String
s1
=
PersistenceUtil
.
getDataFromFile
(
"plantA"
);
CallResponse
callResponse
=
new
CallResponse
();
//JSON转map对象
String
uid
=
playerRequest
.
getUid
();
Map
<
String
,
BackPackDto
>
map1
=
JSON
.
parseObject
(
s1
,
new
TypeReference
<
Map
<
String
,
BackPackDto
>>(){});
log
.
info
(
uid
+
"被获取背包中的货币数量进行同步"
);
BackPackDto
backpack
=
map1
.
get
(
"火精灵3"
);
//货币配置信息
System
.
out
.
println
(
"从文件中取出缓存map1:"
+
map1
);
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
System
.
out
.
println
(
"从背包中拿出火精灵3的东西:"
+
backpack
);
//背包中对应种类的钱袋
System
.
out
.
println
(
"收到通知了"
);
ItemBagDto
moneyBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
Constants
.
ITEM_TYPE_MONEY
);
return
"收到通知了"
;
ItemDto
money
=
moneyBag
.
getItems
(
moneyId
);
log
.
info
(
uid
+
"获取背包中的货币数量完成"
);
callResponse
.
setCode
(
1
);
callResponse
.
setData
(
JSON
.
toJSONString
(
money
.
getItemNum
()));
return
callResponse
;
}
}
@GetMapping
(
"/backPack"
)
/**
public
String
getBackPackInfo
()
{
* 获取背包中的物品
String
s
=
PersistenceUtil
.
getDataFromFile
(
"test-backPack-20220428111643"
);
* @param playerRequest
//JSON转map对象
* @return
System
.
out
.
println
(
"取出的数据:"
+
s
);
*/
Map
<
String
,
BackPackDto
>
backPack
=
JSON
.
parseObject
(
s
,
new
TypeReference
<
Map
<
String
,
BackPackDto
>>(){});
@PostMapping
(
"/getItems"
)
public
CallResponse
getItems
(
@RequestBody
PlayerRequest
playerRequest
)
{
System
.
out
.
println
(
"从文件中取出背包的缓存数据:"
+
backPack
);
CallResponse
callResponse
=
new
CallResponse
();
return
"获取成功"
;
String
uid
=
playerRequest
.
getUid
();
log
.
info
(
uid
+
"开始获取背包中的物品进行同步"
);
List
<
ItemDto
>
itemList
=
new
ArrayList
<>();
Map
<
Integer
,
ItemBagDto
>
itemBagMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
();
for
(
Map
.
Entry
<
Integer
,
ItemBagDto
>
entry
:
itemBagMap
.
entrySet
())
{
if
(
Constants
.
ITEM_TYPE_FRUIT
==
entry
.
getKey
()
||
Constants
.
ITEM_TYPE_MATERIAL
==
entry
.
getKey
())
{
//背包中对应种类的袋子
ItemBagDto
itemBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
entry
.
getKey
());
//袋子中所有物品
Map
<
Integer
,
ItemDto
>
itemMap
=
itemBag
.
getItemBag
();
for
(
Map
.
Entry
<
Integer
,
ItemDto
>
entry1
:
itemMap
.
entrySet
())
{
itemList
.
add
(
entry1
.
getValue
());
}
}
}
log
.
info
(
uid
+
"获取背包中的物品完成"
);
callResponse
.
setCode
(
1
);
callResponse
.
setData
(
JSON
.
toJSONString
(
itemList
));
return
callResponse
;
}
}
@GetMapping
(
"/gardener"
)
/**
public
String
getGardenerInfo
()
{
* 关卡退出后,将关卡的数据同步过来
String
s
=
PersistenceUtil
.
getDataFromFile
(
"test"
);
*/
//JSON转map对象
@PostMapping
(
"/updateItems"
)
System
.
out
.
println
(
"取出的数据:"
+
s
);
public
CallResponse
updateItems
(
@RequestBody
PlayerRequest
playerRequest
)
{
Map
<
String
,
GardenerDto
>
gardener
=
JSON
.
parseObject
(
s
,
new
TypeReference
<
Map
<
String
,
GardenerDto
>>(){});
CallResponse
callResponse
=
new
CallResponse
();
String
uid
=
playerRequest
.
getUid
();
System
.
out
.
println
(
"从文件中取出玩家的缓存数据:"
+
gardener
);
log
.
info
(
uid
+
"开始同步关卡的数据"
);
TimingAcquisition
.
gardenerMap
.
putAll
(
gardener
);
String
result
=
redisUtil
.
getStr
(
"花仙::"
+
uid
);
System
.
out
.
println
(
"内存中玩家的缓存数据:"
+
TimingAcquisition
.
gardenerMap
);
PlayerSeriesDto
playerSeries
=
JSON
.
parseObject
(
result
,
new
TypeReference
<
PlayerSeriesDto
>(){});
return
"获取成功"
;
if
(
StringUtils
.
isEmpty
(
playerSeries
))
{
callResponse
.
setCode
(
0
);
callResponse
.
setMessage
(
"失败"
);
return
callResponse
;
}
boolean
flag
=
false
;
//关卡中货币数量
int
moneyBar
=
playerSeries
.
getMoney
();
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
//背包中对应种类的钱袋
ItemBagDto
moneyBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
Constants
.
ITEM_TYPE_MONEY
);
ItemDto
money
=
moneyBag
.
getItems
(
moneyId
);
//更新背包货币数量
if
(
moneyBar
!=
money
.
getItemNum
())
{
log
.
info
(
uid
+
"的货币更新成功"
);
money
.
setItemNum
(
moneyBar
);
flag
=
true
;
}
//物品配置信息
Map
<
Integer
,
ItemPojo
>
itemConfigMap
=
TimingAcquisition
.
itemConfigMap
;
//玩家的背包
BackPackDto
backPack
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
();
//更新物品数量
Map
<
Integer
,
PartnerItemDto
>
partnerItemMap
=
playerSeries
.
getPartnerItemMap
();
//遍历所有包
for
(
Map
.
Entry
<
Integer
,
PartnerItemDto
>
entry
:
partnerItemMap
.
entrySet
())
{
PartnerItemDto
partnerItem
=
entry
.
getValue
();
Map
<
Integer
,
ItemNumDto
>
itemInfoMap
=
partnerItem
.
getItemInfoMap
();
//遍历所有物品
for
(
Map
.
Entry
<
Integer
,
ItemNumDto
>
entry1
:
itemInfoMap
.
entrySet
())
{
ItemPojo
itemPojo
=
itemConfigMap
.
get
(
entry1
.
getKey
());
if
(
StringUtils
.
isEmpty
(
itemPojo
))
{
continue
;
}
//物品对应种类
Integer
itemType
=
itemPojo
.
getItemTypeId
();
//背包中对应种类的袋子
ItemBagDto
itemBag
=
backPack
.
getItemBags
().
get
(
itemType
);
//背包中没有该种类,则新增袋子
if
(
StringUtils
.
isEmpty
(
itemBag
))
{
itemBag
=
new
ItemBagDto
();
//定义背包里新的袋子
backPack
.
add
(
itemType
,
itemBag
);
itemBag
=
backPack
.
getItemBags
().
get
(
itemType
);
}
//获取袋里的该物品
ItemDto
itemPacket
=
itemBag
.
getItems
(
itemPojo
.
getId
());
//没有该物品,则新增
if
(
StringUtils
.
isEmpty
(
itemPacket
))
{
ItemDto
item
=
new
ItemDto
();
item
.
setItemId
(
entry1
.
getKey
());
item
.
setItemNum
(
entry1
.
getValue
().
getNum
());
itemBag
.
add
(
itemPojo
.
getId
(),
item
);
continue
;
}
//有则更改数量
if
(!
Objects
.
equals
(
itemPacket
.
getItemNum
(),
entry1
.
getValue
().
getNum
()))
{
itemPacket
.
setItemNum
(
entry1
.
getValue
().
getNum
());
if
(!
flag
)
{
flag
=
true
;
}
}
}
}
if
(
flag
)
{
//---------------------------持久化该园丁信息----------------------------
Map
<
String
,
GardenerDto
>
gardenerMap
=
new
ConcurrentHashMap
<>();
gardenerMap
.
put
(
uid
,
TimingAcquisition
.
gardenerMap
.
get
(
uid
));
String
gardenerStr
=
JSON
.
toJSONString
(
gardenerMap
);
PersistenceUtil
.
saveDataToFile
(
uid
,
gardenerStr
);
}
log
.
info
(
uid
+
"同步关卡的数据完成"
);
callResponse
.
setCode
(
1
);
callResponse
.
setMessage
(
"成功"
);
return
callResponse
;
}
}
}
}
src/main/java/com/qiwuai/garden/dao/CopyPetMapper.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dao
;
import
com.qiwuai.garden.pojo.CopyPetPojo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Mapper
@Repository
public
interface
CopyPetMapper
{
List
<
CopyPetPojo
>
findAll
();
}
src/main/java/com/qiwuai/garden/dto/CopyPetDto.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
CopyPetDto
{
/**
* 序号
*/
private
int
num
;
/**
* 当前副本宠物
*/
private
List
<
Integer
>
copyPetList
=
new
ArrayList
<>();
/**
* 刷新时间
*/
private
String
time
;
}
src/main/java/com/qiwuai/garden/dto/CopyTimeDto.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
;
import
lombok.Data
;
@Data
public
class
CopyTimeDto
{
/**
* 该副本通过时间
*/
private
String
passTime
;
/**
* 该副本玩的次数
*/
private
int
count
=
0
;
/**
* 该副本的通过次数
*/
private
int
success
=
0
;
}
src/main/java/com/qiwuai/garden/dto/GardenerDto.java
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
;
package
com
.
qiwuai
.
garden
.
dto
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.pojo.CopyPetPojo
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
@Data
@Data
public
class
GardenerDto
implements
Cloneable
{
public
class
GardenerDto
implements
Cloneable
{
...
@@ -136,6 +140,14 @@ public class GardenerDto implements Cloneable{
...
@@ -136,6 +140,14 @@ public class GardenerDto implements Cloneable{
* 修改时间
* 修改时间
*/
*/
private
String
updateTime
;
private
String
updateTime
;
/**
* 玩家是否有给玩家留言过问候。Map<已留言的玩家地址, 标识>
*/
private
Map
<
String
,
Integer
>
helloSignMap
=
new
HashMap
<>();
/**
* 副本通过时间
*/
private
Map
<
Integer
,
CopyTimeDto
>
copyTimeMap
=
new
HashMap
<>();
/**
/**
* 深拷贝宠物栏
* 深拷贝宠物栏
...
@@ -150,4 +162,15 @@ public class GardenerDto implements Cloneable{
...
@@ -150,4 +162,15 @@ public class GardenerDto implements Cloneable{
throw
new
AssertionError
();
throw
new
AssertionError
();
}
}
}
}
/**
* 初始化副本通过时间
*/
public
void
setCopyTimeMap
()
{
Map
<
Integer
,
CopyPetPojo
>
copyPetInfoMap
=
TimingAcquisition
.
copyPetPojoMap
;
for
(
Map
.
Entry
<
Integer
,
CopyPetPojo
>
entry
:
copyPetInfoMap
.
entrySet
())
{
CopyTimeDto
copyTimeDto
=
new
CopyTimeDto
();
this
.
copyTimeMap
.
put
(
entry
.
getKey
(),
copyTimeDto
);
}
}
}
}
src/main/java/com/qiwuai/garden/dto/ItemNumDto.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
;
import
lombok.Data
;
@Data
public
class
ItemNumDto
{
/**
* 伙伴物品id
*/
private
Integer
id
;
/**
* 伙伴物品个数
*/
private
Integer
num
;
/**
* 伙伴物品使用次数。-1:次数已用完,0:不限次数,大于0:次数
*/
private
int
times
;
}
src/main/java/com/qiwuai/garden/dto/MessageTimeDto.java
View file @
62ae40e0
...
@@ -13,6 +13,10 @@ public class MessageTimeDto {
...
@@ -13,6 +13,10 @@ public class MessageTimeDto {
*/
*/
private
String
content
;
private
String
content
;
/**
/**
* 留言类型
*/
private
Integer
type
;
/**
* 未读-0,已读-1
* 未读-0,已读-1
*/
*/
private
Integer
read
;
private
Integer
read
;
...
...
src/main/java/com/qiwuai/garden/dto/NurseryInfoDto.java
View file @
62ae40e0
...
@@ -68,6 +68,10 @@ public class NurseryInfoDto {
...
@@ -68,6 +68,10 @@ public class NurseryInfoDto {
*/
*/
private
Integer
earnRate
;
private
Integer
earnRate
;
/**
/**
* 记录收益比例更新后,上一次的数据
*/
private
Integer
lastEarnRate
;
/**
* 乐观锁,用于保证该花圃只有一个人操作,操作完必释放: 0-空闲, 1-忙碌
* 乐观锁,用于保证该花圃只有一个人操作,操作完必释放: 0-空闲, 1-忙碌
*/
*/
private
Integer
lock
=
0
;
private
Integer
lock
=
0
;
...
...
src/main/java/com/qiwuai/garden/dto/PartnerItemDto.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
@Data
public
class
PartnerItemDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 数量上限
*/
private
int
max
;
/**
* 背包已有物品
*/
private
Map
<
Integer
,
ItemNumDto
>
itemInfoMap
=
new
HashMap
<>();
}
src/main/java/com/qiwuai/garden/dto/PlayerSeriesDto.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Map
;
@Data
public
class
PlayerSeriesDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 关卡等级
*/
private
int
level
=
1
;
/**
* 当前等级通关总次数
*/
private
int
clearanceNum
=
0
;
/**
* 总货币
*/
private
int
money
;
/**
* 系列总声望值
*/
private
ReputationDto
totalReputation
;
/**
* Map<物品类型, 物品信息>
*/
private
Map
<
Integer
,
PartnerItemDto
>
partnerItemMap
=
new
HashMap
<>();
}
src/main/java/com/qiwuai/garden/dto/ReputationDto.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
ReputationDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 玩家uid
*/
private
String
uid
;
/**
* 声望值
*/
private
int
reputation
=
0
;
}
src/main/java/com/qiwuai/garden/dto/base/ResultResponse.java
View file @
62ae40e0
...
@@ -42,6 +42,10 @@ public class ResultResponse {
...
@@ -42,6 +42,10 @@ public class ResultResponse {
*/
*/
private
Integer
玩家金币数量
;
private
Integer
玩家金币数量
;
/**
/**
* 当前园丁等级,bot话题模块需要该变量
*/
private
Integer
当前园丁等级
;
/**
* 玩家称呼,bot话题模块需要该变量
* 玩家称呼,bot话题模块需要该变量
*/
*/
@JsonProperty
(
"GB_玩家称呼"
)
@JsonProperty
(
"GB_玩家称呼"
)
...
@@ -81,6 +85,61 @@ public class ResultResponse {
...
@@ -81,6 +85,61 @@ public class ResultResponse {
* 建议指令,bot的建议需要该变量
* 建议指令,bot的建议需要该变量
*/
*/
private
String
建议指令
;
private
String
建议指令
;
/**
* 宠物1
*/
@JsonProperty
(
"GB_宠物1"
)
private
String
GB_
宠物
1
;
/**
* 宠物2
*/
@JsonProperty
(
"GB_宠物2"
)
private
String
GB_
宠物
2
;
/**
* 输赢结果
*/
@JsonProperty
(
"GB_输赢结果"
)
private
String
GB_
输赢结果
;
/**
* 副本宠物1
*/
private
String
副本宠物
1
;
/**
* 副本宠物2
*/
private
String
副本宠物
2
;
/**
* 宠物1生命值
*/
private
Integer
宠物
1
生命值
;
/**
* 宠物2生命值
*/
private
Integer
宠物
2
生命值
;
/**
* 总人数
*/
private
Integer
总人数
;
/**
* 总金额
*/
private
Integer
总金额
;
/**
* 人数1
*/
private
Integer
人数
1
;
/**
* 金额1
*/
private
Integer
金额
1
;
/**
* 人数2
*/
private
Integer
人数
2
;
/**
* 金额2
*/
private
Integer
金额
2
;
/***************************用于清空bot端保留的变量***********************************/
/***************************用于清空bot端保留的变量***********************************/
/**
/**
...
@@ -187,4 +246,9 @@ public class ResultResponse {
...
@@ -187,4 +246,9 @@ public class ResultResponse {
* 保存附加返回
* 保存附加返回
*/
*/
private
String
保存附加返回
;
private
String
保存附加返回
;
/**
* GB_周本时间
*/
@JsonProperty
(
"GB_周本时间"
)
private
String
GB_
周本时间
;
}
}
src/main/java/com/qiwuai/garden/dto/request/CallRequest.java
View file @
62ae40e0
...
@@ -202,4 +202,21 @@ public class CallRequest {
...
@@ -202,4 +202,21 @@ public class CallRequest {
* 名次
* 名次
*/
*/
private
String
名次
;
private
String
名次
;
/**
* 下注数额
*/
private
String
下注数额
;
/**
* 输赢结果
*/
@JsonProperty
(
value
=
"GB_输赢结果"
)
private
String
GB_
输赢结果
;
/**
* 留言意图
*/
private
String
留言意图
;
/**
* 副本名称
*/
private
String
副本名称
;
}
}
src/main/java/com/qiwuai/garden/dto/request/OperationRequest.java
View file @
62ae40e0
...
@@ -228,4 +228,48 @@ public class OperationRequest {
...
@@ -228,4 +228,48 @@ public class OperationRequest {
* 待出售物品
* 待出售物品
*/
*/
private
List
<
ItemDto
>
itemList
;
private
List
<
ItemDto
>
itemList
;
/**
* 下注数额
*/
private
int
pay
;
/**
* 宠物1
*/
private
Integer
pet1
;
/**
* 宠物2
*/
private
Integer
pet2
;
/**
* 输赢结果
*/
private
int
petResult
;
/**
* 留言意图
*/
private
int
intention
;
/**
* 留言玩家地址
*/
private
String
messageAddress
;
/**
* 留言类型
*/
private
Integer
messageType
;
/**
* 留言类型
*/
private
String
messageChange
;
/**
* 风国宠物1
*/
private
Integer
copyPet1
;
/**
* 风国宠物2
*/
private
Integer
copyPet2
;
/**
* 副本名称
*/
private
String
copyName
;
}
}
src/main/java/com/qiwuai/garden/dto/request/PlayerRequest.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
.
request
;
import
lombok.Data
;
@Data
public
class
PlayerRequest
{
/**
* uid
*/
private
String
uid
;
}
src/main/java/com/qiwuai/garden/dto/response/CallResponse.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
dto
.
response
;
import
lombok.Data
;
@Data
public
class
CallResponse
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 返回状态码
*/
private
Integer
code
;
/**
* 返回信息
*/
private
String
message
;
/**
* 返回内容
*/
private
String
data
;
}
src/main/java/com/qiwuai/garden/pojo/CopyPetPojo.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
pojo
;
import
lombok.Data
;
@Data
public
class
CopyPetPojo
{
/**
* id唯一标识
*/
private
int
id
;
/**
* 副本名称
*/
private
String
copyName
;
/**
* 副本宠物组
*/
private
String
copyPets
;
}
src/main/java/com/qiwuai/garden/pojo/RarityPojo.java
View file @
62ae40e0
...
@@ -13,6 +13,10 @@ public class RarityPojo {
...
@@ -13,6 +13,10 @@ public class RarityPojo {
*/
*/
private
String
description
;
private
String
description
;
/**
/**
* 套圈命中的概率
*/
private
double
pitchPro
;
/**
* 创建时间
* 创建时间
*/
*/
private
String
createTime
;
private
String
createTime
;
...
...
src/main/java/com/qiwuai/garden/pojo/RegionPojo.java
View file @
62ae40e0
...
@@ -16,12 +16,12 @@ public class RegionPojo {
...
@@ -16,12 +16,12 @@ public class RegionPojo {
* 地区所在服务器ip
* 地区所在服务器ip
*/
*/
private
String
serverIP
;
private
String
serverIP
;
/**
//
/**
* 创建时间
//
* 创建时间
*/
//
*/
private
String
createTime
;
//
private String createTime;
/**
//
/**
* 修改时间
//
* 修改时间
*/
//
*/
private
String
updateTime
;
//
private String updateTime;
}
}
src/main/java/com/qiwuai/garden/service/adviseService/impl/AdviseServiceImpl.java
View file @
62ae40e0
...
@@ -1566,7 +1566,7 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -1566,7 +1566,7 @@ public class AdviseServiceImpl implements AdviseService {
OperationRequest
req
=
new
OperationRequest
();
OperationRequest
req
=
new
OperationRequest
();
req
.
setUid
(
uid
);
req
.
setUid
(
uid
);
req
.
setItemId
(
lackMaterialList
.
get
(
0
).
getItemId
());
req
.
setItemId
(
lackMaterialList
.
get
(
0
).
getItemId
());
CommonResponse
response
=
adviseBy
Money
(
req
);
CommonResponse
response
=
adviseBy
Item
(
req
);
//获取对应话术
//获取对应话术
text
=
SpeechUtil
.
mergeSpeech
(
text
,
response
.
getData
().
getVars
().
get
反馈文本
());
text
=
SpeechUtil
.
mergeSpeech
(
text
,
response
.
getData
().
getVars
().
get
反馈文本
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -2283,9 +2283,22 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -2283,9 +2283,22 @@ public class AdviseServiceImpl implements AdviseService {
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
Integer
canPlantId
=
null
;
//物品名称
//物品名称
String
itemName
=
TimingAcquisition
.
itemConfigMap
.
get
(
itemId
).
getName
();
String
itemName
=
TimingAcquisition
.
itemConfigMap
.
get
(
itemId
).
getName
();
//物品为关键物品类型,为bot发放物品
if
(
TimingAcquisition
.
itemConfigMap
.
get
(
itemId
).
getItemTypeId
()
==
Constants
.
ITEM_TYPE_OTHER
)
{
//获取对应话术
String
text
=
SpeechUtil
.
getAdviseSpeech
(
Constants
.
SPEECH_ASIDE
,
"item_advise_key_item"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemName
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
900412
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
Integer
canPlantId
=
null
;
//货币配置信息
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
//询问物品为货币
//询问物品为货币
...
@@ -2661,6 +2674,8 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -2661,6 +2674,8 @@ public class AdviseServiceImpl implements AdviseService {
List
<
Integer
>
freeNurseryNumList
=
AdviseUtil
.
findFreeNurseryNums
(
uid
);
List
<
Integer
>
freeNurseryNumList
=
AdviseUtil
.
findFreeNurseryNums
(
uid
);
//有空闲花圃
//有空闲花圃
if
(
freeNurseryNumList
.
size
()
!=
0
)
{
if
(
freeNurseryNumList
.
size
()
!=
0
)
{
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
petConfigMap
.
get
(
canPetId
).
getName
(),
itemName
);
//-------------建议:移动宠物,再种植-------------
//-------------建议:移动宠物,再种植-------------
//玩家目前有的可在空闲花圃种植的植物
//玩家目前有的可在空闲花圃种植的植物
int
[]
freeNurseryNum
=
{
1
};
int
[]
freeNurseryNum
=
{
1
};
...
...
src/main/java/com/qiwuai/garden/service/backPackService/BackPackService.java
View file @
62ae40e0
...
@@ -17,6 +17,18 @@ public interface BackPackService {
...
@@ -17,6 +17,18 @@ public interface BackPackService {
*/
*/
CommonResponse
viewBackPackItem
(
OperationRequest
operationReq
);
CommonResponse
viewBackPackItem
(
OperationRequest
operationReq
);
/**
/**
* 分类检索。根据物品种类查看背包中物品详情
* @param operationReq
* @return CommonResponse
*/
CommonResponse
viewSure
(
OperationRequest
operationReq
);
/**
* 确认查看。根据物品种类查看背包中物品详情
* @param operationReq
* @return CommonResponse
*/
CommonResponse
viewCancel
(
OperationRequest
operationReq
);
/**
* 查看货币
* 查看货币
* @param operationReq
* @param operationReq
* @return CommonResponse
* @return CommonResponse
...
...
src/main/java/com/qiwuai/garden/service/backPackService/impl/BackPackServiceImpl.java
View file @
62ae40e0
...
@@ -3,6 +3,8 @@ package com.qiwuai.garden.service.backPackService.impl;
...
@@ -3,6 +3,8 @@ package com.qiwuai.garden.service.backPackService.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.cache.CacheGlobal
;
import
com.qiwuai.garden.common.cache.CacheUtil
;
import
com.qiwuai.garden.common.utils.AdviseUtil
;
import
com.qiwuai.garden.common.utils.AdviseUtil
;
import
com.qiwuai.garden.common.utils.PersistenceUtil
;
import
com.qiwuai.garden.common.utils.PersistenceUtil
;
import
com.qiwuai.garden.common.utils.SpeechUtil
;
import
com.qiwuai.garden.common.utils.SpeechUtil
;
...
@@ -31,6 +33,10 @@ import java.util.stream.Collectors;
...
@@ -31,6 +33,10 @@ import java.util.stream.Collectors;
public
class
BackPackServiceImpl
implements
BackPackService
{
public
class
BackPackServiceImpl
implements
BackPackService
{
private
Logger
log
=
LoggerFactory
.
getLogger
(
BackPackServiceImpl
.
class
);
private
Logger
log
=
LoggerFactory
.
getLogger
(
BackPackServiceImpl
.
class
);
//从yml配置文件中取出对话过期时间
@Value
(
"${expireTime}"
)
private
String
expireTime
;
@Override
@Override
public
CommonResponse
viewBackPack
(
OperationRequest
operationReq
)
{
public
CommonResponse
viewBackPack
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
CommonResponse
commonResponse
=
new
CommonResponse
();
...
@@ -58,7 +64,7 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -58,7 +64,7 @@ public class BackPackServiceImpl implements BackPackService {
//种类名称
//种类名称
String
itemTypeName
=
TimingAcquisition
.
itemTypeMap
.
get
(
entry
.
getKey
()).
getDescription
();
String
itemTypeName
=
TimingAcquisition
.
itemTypeMap
.
get
(
entry
.
getKey
()).
getDescription
();
if
(
count
>
0
)
{
if
(
count
>
0
)
{
feedText
.
append
(
itemTypeName
).
append
(
count
).
append
(
"个
,"
);
feedText
.
append
(
"🅰"
).
append
(
itemTypeName
).
append
(
"🅱🅰"
).
append
(
count
).
append
(
"个"
).
append
(
"🅱
,"
);
}
else
{
}
else
{
itemTypeCount
--;
itemTypeCount
--;
}
}
...
@@ -161,6 +167,8 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -161,6 +167,8 @@ public class BackPackServiceImpl implements BackPackService {
}
}
//包中物品计数
//包中物品计数
int
count
=
0
;
int
count
=
0
;
List
<
ItemDto
>
itemList
=
new
ArrayList
<>();
int
num
=
10
;
for
(
Map
.
Entry
<
Integer
,
ItemDto
>
entry
:
bag
.
entrySet
()){
for
(
Map
.
Entry
<
Integer
,
ItemDto
>
entry
:
bag
.
entrySet
()){
//过滤到没有的物品
//过滤到没有的物品
if
(
StringUtils
.
isEmpty
(
itemConfigMap
.
get
(
entry
.
getKey
())))
{
if
(
StringUtils
.
isEmpty
(
itemConfigMap
.
get
(
entry
.
getKey
())))
{
...
@@ -169,11 +177,18 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -169,11 +177,18 @@ public class BackPackServiceImpl implements BackPackService {
//过滤掉不是对应种类的物品,避免查到脏数据
//过滤掉不是对应种类的物品,避免查到脏数据
if
(
itemConfigMap
.
get
(
entry
.
getKey
()).
getItemTypeId
().
equals
(
itemTypeId
))
{
if
(
itemConfigMap
.
get
(
entry
.
getKey
()).
getItemTypeId
().
equals
(
itemTypeId
))
{
if
(
entry
.
getValue
().
getItemNum
()
!=
0
)
{
if
(
entry
.
getValue
().
getItemNum
()
!=
0
)
{
feedText
.
append
(
itemConfigMap
.
get
(
entry
.
getKey
()).
getName
()).
append
(
entry
.
getValue
().
getItemNum
()).
append
(
"个、"
);
count
+=
entry
.
getValue
().
getItemNum
();
count
+=
entry
.
getValue
().
getItemNum
();
itemList
.
add
(
entry
.
getValue
());
}
}
}
}
}
}
if
(
itemList
.
size
()
<
num
)
{
num
=
itemList
.
size
();
}
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
feedText
.
append
(
"🅰"
).
append
(
itemConfigMap
.
get
(
itemList
.
get
(
i
).
getItemId
()).
getName
()).
append
(
"🅱🅰"
).
append
(
itemList
.
get
(
i
).
getItemNum
()).
append
(
"个"
).
append
(
"🅱、"
);
}
if
(
feedText
.
length
()
!=
0
)
{
if
(
feedText
.
length
()
!=
0
)
{
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
}
else
{
}
else
{
...
@@ -199,7 +214,7 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -199,7 +214,7 @@ public class BackPackServiceImpl implements BackPackService {
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"view_back_pack_item"
);
String
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"view_back_pack_item"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
itemTypeMap
.
get
(
itemTypeId
).
getDescription
(),
feedText
.
toString
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
itemTypeMap
.
get
(
itemTypeId
).
getDescription
(),
String
.
valueOf
(
itemList
.
size
()),
feedText
.
toString
());
//背包物品数量多的情况,园丁的回答
//背包物品数量多的情况,园丁的回答
if
(
count
>
max
)
{
if
(
count
>
max
)
{
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"view_back_pack_item_lot"
);
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"view_back_pack_item_lot"
);
...
@@ -208,7 +223,17 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -208,7 +223,17 @@ public class BackPackServiceImpl implements BackPackService {
resultResponse
.
set
后台附加返回
(
"查看背包回复2"
);
resultResponse
.
set
后台附加返回
(
"查看背包回复2"
);
}
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
log
.
info
(
"物品详情查询结果:"
+
feedText
.
toString
());
if
(
itemList
.
size
()
>
num
)
{
text
+=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"view_back_pack_item_more"
);
resultResponse
.
set
后台附加返回
(
"查看背包回复3"
);
}
//保存玩家这轮的信息
operationReq
.
setItemList
(
itemList
);
operationReq
.
setNumber
(
2
);
operationReq
.
setItemTypeId
(
itemTypeId
);
operationReq
.
setOperationLabel
(
Constants
.
CHECK_BAG
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
log
.
info
(
"物品详情查询结果:"
+
feedText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
200402
);
resultResponse
.
set
反馈
ID
(
200402
);
...
@@ -219,6 +244,87 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -219,6 +244,87 @@ public class BackPackServiceImpl implements BackPackService {
}
}
@Override
@Override
public
CommonResponse
viewSure
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
num
=
0
;
int
max
=
0
;
Integer
itemTypeId
=
0
;
List
<
ItemDto
>
itemList
=
new
ArrayList
<>();
StringBuilder
feedText
=
new
StringBuilder
();
//物品配置信息
Map
<
Integer
,
ItemPojo
>
itemConfigMap
=
TimingAcquisition
.
itemConfigMap
;
//上一轮数据
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(
Constants
.
CHECK_BAG
.
equals
(
lastReq
.
getOperationLabel
()))
{
itemList
=
lastReq
.
getItemList
();
num
=
lastReq
.
getNumber
();
itemTypeId
=
lastReq
.
getItemTypeId
();
max
=
num
*
10
;
}
}
if
(
itemList
.
size
()
<
max
)
{
max
=
itemList
.
size
();
}
for
(
int
i
=
(
num
-
1
)
*
10
;
i
<
max
;
i
++)
{
feedText
.
append
(
"🅰"
).
append
(
itemConfigMap
.
get
(
itemList
.
get
(
i
).
getItemId
()).
getName
()).
append
(
"🅱🅰"
).
append
(
itemList
.
get
(
i
).
getItemNum
()).
append
(
"个"
).
append
(
"🅱、"
);
}
if
(
feedText
.
length
()
!=
0
)
{
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
}
else
{
feedText
.
append
(
0
).
append
(
"个"
);
}
//获取对应话术
String
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"view_back_pack_item"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
itemTypeMap
.
get
(
itemTypeId
).
getDescription
(),
String
.
valueOf
(
itemList
.
size
()),
feedText
.
toString
());
if
(
itemList
.
size
()
>
max
)
{
text
+=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"view_back_pack_item_more"
);
resultResponse
.
set
后台附加返回
(
"查看背包回复3"
);
//保存玩家这轮的信息
operationReq
.
setNumber
(
num
+
1
);
}
else
{
//保存玩家这轮的信息
operationReq
.
setNumber
(
1
);
}
operationReq
.
setItemList
(
itemList
);
operationReq
.
setItemTypeId
(
itemTypeId
);
operationReq
.
setOperationLabel
(
Constants
.
CHECK_BAG
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
log
.
info
(
"物品详情查询结果:"
+
feedText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
200403
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
viewCancel
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
log
.
info
(
uid
+
"取消查看背包剩余物品"
);
//清除缓存,本轮对话结束
CacheGlobal
.
concurrentMap
.
remove
(
uid
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
200404
);
resultResponse
.
set
反馈文本
(
"【旁白@正常】好的。"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
viewMoney
(
OperationRequest
operationReq
)
{
public
CommonResponse
viewMoney
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
...
@@ -390,6 +496,10 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -390,6 +496,10 @@ public class BackPackServiceImpl implements BackPackService {
plantNameText
.
toString
(),
petNameText
.
toString
());
plantNameText
.
toString
(),
petNameText
.
toString
());
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"search_item_info_none_to_plant"
);
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"search_item_info_none_to_plant"
);
}
}
if
(
plantIdList
.
size
()
==
0
&&
petIdList
.
size
()
==
0
)
{
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"search_item_info_none"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemConfig
.
getName
(),
description
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
log
.
info
(
uid
+
"没有检索到物品信息:"
+
itemConfig
.
getName
());
log
.
info
(
uid
+
"没有检索到物品信息:"
+
itemConfig
.
getName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -417,7 +527,11 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -417,7 +527,11 @@ public class BackPackServiceImpl implements BackPackService {
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"search_item_info_none_to_plant_or_pet"
);
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"search_item_info_none_to_plant_or_pet"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemConfig
.
getName
(),
description
,
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemConfig
.
getName
(),
description
,
plantNameText
.
toString
(),
petNameText
.
toString
());
plantNameText
.
toString
(),
petNameText
.
toString
());
text
=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"search_item_info_none_to_plant"
);
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"search_item_info_none_to_plant"
);
}
if
(
plantIdList
.
size
()
==
0
&&
petIdList
.
size
()
==
0
)
{
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"search_item_info_none"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemConfig
.
getName
(),
description
);
}
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
log
.
info
(
uid
+
"没有检索到物品信息:"
+
itemConfig
.
getName
());
log
.
info
(
uid
+
"没有检索到物品信息:"
+
itemConfig
.
getName
());
...
...
src/main/java/com/qiwuai/garden/service/gardenerService/impl/GardenerServiceImpl.java
View file @
62ae40e0
...
@@ -94,6 +94,25 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -94,6 +94,25 @@ public class GardenerServiceImpl implements GardenerService {
}
}
}
}
}
}
//-------------------周本给bot改变值---------------------------
Map
<
Integer
,
CopyPetPojo
>
copyPetInfoMap
=
TimingAcquisition
.
copyPetPojoMap
;
for
(
Map
.
Entry
<
Integer
,
CopyPetPojo
>
entry
:
copyPetInfoMap
.
entrySet
())
{
int
copyId
=
entry
.
getKey
();
//副本刷新时间
String
brushTime
=
TimingAcquisition
.
copyPetMap
.
get
(
copyId
).
getTime
();
if
(
StringUtils
.
isEmpty
(
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
)))
{
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
setCopyTimeMap
();
}
//玩家通过该副本的时间
String
passTime
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
).
getPassTime
();
if
(!
StringUtils
.
isEmpty
(
passTime
))
{
if
(
passTime
.
compareTo
(
brushTime
)
<=
0
)
{
resultResponse
.
setGB_
周本时间
(
"0"
);
}
}
else
{
resultResponse
.
setGB_
周本时间
(
"0"
);
}
}
//清除缓存,本轮对话结束
//清除缓存,本轮对话结束
CacheGlobal
.
concurrentMap
.
remove
(
uid
);
CacheGlobal
.
concurrentMap
.
remove
(
uid
);
//---------------------------持久化该园丁信息----------------------------
//---------------------------持久化该园丁信息----------------------------
...
@@ -102,11 +121,11 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -102,11 +121,11 @@ public class GardenerServiceImpl implements GardenerService {
String
gardenerStr
=
JSON
.
toJSONString
(
gardenerMap
);
String
gardenerStr
=
JSON
.
toJSONString
(
gardenerMap
);
PersistenceUtil
.
saveDataToFile
(
uid
,
gardenerStr
);
PersistenceUtil
.
saveDataToFile
(
uid
,
gardenerStr
);
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"enter_game"
);
//
String text = SpeechUtil.getGardenerSpeech(Constants.SPEECH_ASIDE, "enter_game");
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
100001
);
resultResponse
.
set
反馈
ID
(
100001
);
resultResponse
.
set
反馈文本
(
text
);
//
resultResponse.set反馈文本(text);
resultVarsResponse
.
setVars
(
resultResponse
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
...
@@ -804,8 +823,8 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -804,8 +823,8 @@ public class GardenerServiceImpl implements GardenerService {
int
GardenerLVMax
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"gardener_level_max"
).
getValue
());
int
GardenerLVMax
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"gardener_level_max"
).
getValue
());
if
((
gardenerInfo
.
getLevel
()
+
1
)
>
GardenerLVMax
)
{
//已经达到最大等级
if
((
gardenerInfo
.
getLevel
()
+
1
)
>
GardenerLVMax
)
{
//已经达到最大等级
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"gardener_upgrade_fail_had"
);
//
String text = SpeechUtil.getGardenerSpeech(Constants.SPEECH_ASIDE, "gardener_upgrade_fail_had");
text
+
=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"gardener_upgrade_fail_had"
);
String
text
=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"gardener_upgrade_fail_had"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
...
@@ -814,12 +833,11 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -814,12 +833,11 @@ public class GardenerServiceImpl implements GardenerService {
resultVarsResponse
.
setVars
(
resultResponse
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
//园丁下个等级配置信息
//园丁下个等级配置信息
GardenerLevelPojo
gardenerLevelConfig
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
gardenerInfo
.
getLevel
()
+
1
);
GardenerLevelPojo
gardenerLevelConfig
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
gardenerInfo
.
getLevel
()
+
1
);
//事件配置信息
//事件配置信息
Map
<
Integer
,
EventPojo
>
eventConfigMap
=
TimingAcquisition
.
eventConfigMap
;
//
Map<Integer, EventPojo> eventConfigMap = TimingAcquisition.eventConfigMap;
//升级所需物品
//升级所需物品
List
<
ItemDto
>
itemList
=
TypeConvertUtil
.
itemString2List
(
gardenerLevelConfig
.
getCostItemNums
());
List
<
ItemDto
>
itemList
=
TypeConvertUtil
.
itemString2List
(
gardenerLevelConfig
.
getCostItemNums
());
//物品配置信息
//物品配置信息
...
@@ -837,12 +855,15 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -837,12 +855,15 @@ public class GardenerServiceImpl implements GardenerService {
StringBuilder
moneyText
=
new
StringBuilder
();
StringBuilder
moneyText
=
new
StringBuilder
();
StringBuilder
fruitText
=
new
StringBuilder
();
StringBuilder
fruitText
=
new
StringBuilder
();
StringBuilder
materialText
=
new
StringBuilder
();
StringBuilder
materialText
=
new
StringBuilder
();
StringBuilder
keyItemText
=
new
StringBuilder
();
moneyText
.
append
(
",并花费"
);
moneyText
.
append
(
",并花费"
);
fruitText
.
append
(
","
).
append
(
TimingAcquisition
.
itemTypeMap
.
get
(
Constants
.
ITEM_TYPE_FRUIT
).
getDescription
()).
append
(
":"
);
fruitText
.
append
(
","
).
append
(
TimingAcquisition
.
itemTypeMap
.
get
(
Constants
.
ITEM_TYPE_FRUIT
).
getDescription
()).
append
(
":"
);
materialText
.
append
(
","
).
append
(
TimingAcquisition
.
itemTypeMap
.
get
(
Constants
.
ITEM_TYPE_MATERIAL
).
getDescription
()).
append
(
":"
);
materialText
.
append
(
","
).
append
(
TimingAcquisition
.
itemTypeMap
.
get
(
Constants
.
ITEM_TYPE_MATERIAL
).
getDescription
()).
append
(
":"
);
keyItemText
.
append
(
","
).
append
(
TimingAcquisition
.
itemTypeMap
.
get
(
Constants
.
ITEM_TYPE_OTHER
).
getDescription
()).
append
(
":"
);
boolean
haveMoney
=
false
;
boolean
haveMoney
=
false
;
boolean
haveFruit
=
false
;
boolean
haveFruit
=
false
;
boolean
haveMaterial
=
false
;
boolean
haveMaterial
=
false
;
boolean
haveKeyItem
=
false
;
for
(
ItemDto
item
:
itemList
)
{
for
(
ItemDto
item
:
itemList
)
{
//物品对应种类
//物品对应种类
Integer
itemType
=
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
Integer
itemType
=
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
...
@@ -861,6 +882,11 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -861,6 +882,11 @@ public class GardenerServiceImpl implements GardenerService {
materialText
.
append
(
itemConfigMap
.
get
(
item
.
getItemId
()).
getName
()).
append
(
item
.
getItemNum
()).
append
(
"个、"
);
materialText
.
append
(
itemConfigMap
.
get
(
item
.
getItemId
()).
getName
()).
append
(
item
.
getItemNum
()).
append
(
"个、"
);
haveMaterial
=
true
;
haveMaterial
=
true
;
}
}
//关键物品
if
(
itemType
==
Constants
.
ITEM_TYPE_OTHER
)
{
keyItemText
.
append
(
itemConfigMap
.
get
(
item
.
getItemId
()).
getName
()).
append
(
item
.
getItemNum
()).
append
(
"个、"
);
haveKeyItem
=
true
;
}
}
}
//需要灵石
//需要灵石
if
(
haveMoney
)
{
if
(
haveMoney
)
{
...
@@ -877,6 +903,11 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -877,6 +903,11 @@ public class GardenerServiceImpl implements GardenerService {
materialText
.
deleteCharAt
(
materialText
.
length
()
-
1
);
materialText
.
deleteCharAt
(
materialText
.
length
()
-
1
);
feedText
.
append
(
materialText
);
feedText
.
append
(
materialText
);
}
}
//需要关键物品
if
(
haveKeyItem
)
{
keyItemText
.
deleteCharAt
(
keyItemText
.
length
()
-
1
);
feedText
.
append
(
keyItemText
);
}
//---------------------新手引导的园丁升级至2任务开启,满足条件则开放园丁升级功能------------------------
//---------------------新手引导的园丁升级至2任务开启,满足条件则开放园丁升级功能------------------------
// if (gardenerInfo.getLevel() == 1) {
// if (gardenerInfo.getLevel() == 1) {
// if (!StringUtils.isEmpty(noviceGuide)) {
// if (!StringUtils.isEmpty(noviceGuide)) {
...
@@ -901,6 +932,11 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -901,6 +932,11 @@ public class GardenerServiceImpl implements GardenerService {
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
gardenerInfo
.
getLevel
().
toString
(),
feedText
.
toString
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
gardenerInfo
.
getLevel
().
toString
(),
feedText
.
toString
());
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"gardener_upgrade_check"
);
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"gardener_upgrade_check"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
//------------是否开启发放关键物品任务----------
boolean
giveKeyItemTip
=
AdviseUtil
.
updateLevelCheck
(
uid
);
if
(
giveKeyItemTip
)
{
text
=
AdviseUtil
.
addGiveKeyItemTip
(
uid
,
text
);
}
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
200101
);
resultResponse
.
set
反馈
ID
(
200101
);
...
@@ -1006,8 +1042,18 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1006,8 +1042,18 @@ public class GardenerServiceImpl implements GardenerService {
Integer
itemType
=
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
Integer
itemType
=
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
//背包中对应种类的袋子
//背包中对应种类的袋子
ItemBagDto
itemBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
itemType
);
ItemBagDto
itemBag
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
().
get
(
itemType
);
//所需物品为货币
//还没有这类物品
//获取对应话术
if
(
StringUtils
.
isEmpty
(
itemBag
))
{
success
=
false
;
number
=
200103
;
//获取对应话术
text
=
SpeechUtil
.
getGardenerSpeech
(
Constants
.
SPEECH_ASIDE
,
"gardener_upgrade_fail"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemConfigMap
.
get
(
item
.
getItemId
()).
getName
());
text
+=
SpeechUtil
.
getGardenerSpeech
(
gender
,
"gardener_upgrade_fail"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
resultResponse
.
set
后台附加返回
(
"升级园丁回复2"
);
break
;
}
//获取对应话术
//获取对应话术
if
(
StringUtils
.
isEmpty
(
itemBag
.
getItems
(
item
.
getItemId
())))
{
if
(
StringUtils
.
isEmpty
(
itemBag
.
getItems
(
item
.
getItemId
())))
{
success
=
false
;
success
=
false
;
...
@@ -1047,7 +1093,7 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1047,7 +1093,7 @@ public class GardenerServiceImpl implements GardenerService {
itemPacket
.
setItemNum
(
itemPacket
.
getItemNum
()
-
item
.
getItemNum
());
itemPacket
.
setItemNum
(
itemPacket
.
getItemNum
()
-
item
.
getItemNum
());
}
}
int
level
=
gardenerInfo
.
getLevel
();
int
level
=
gardenerInfo
.
getLevel
();
log
.
info
(
uid
+
"已升级到等级:"
+
+
level
+
",消耗物品:"
+
itemList
);
log
.
info
(
uid
+
"已升级到等级:"
+
level
+
",消耗物品:"
+
itemList
);
//-----------------------玩家新增的养成任务------------------------
//-----------------------玩家新增的养成任务------------------------
//升级至下一等级所需要完成任务的任务ID
//升级至下一等级所需要完成任务的任务ID
String
[]
taskLevelList
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
level
+
1
).
getTaskIds
().
split
(
"\\|"
);
String
[]
taskLevelList
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
level
+
1
).
getTaskIds
().
split
(
"\\|"
);
...
@@ -1117,6 +1163,13 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1117,6 +1163,13 @@ public class GardenerServiceImpl implements GardenerService {
resultResponse
.
set
任务完成
(
"10019"
);
resultResponse
.
set
任务完成
(
"10019"
);
log
.
info
(
uid
+
"新手引导的园丁升级任务10019已完成"
);
log
.
info
(
uid
+
"新手引导的园丁升级任务10019已完成"
);
}
}
if
(
level
==
2
)
{
if
(
gardenerInfo
.
getGender
()
==
1
)
{
text
+=
"【旁白@正常】►打开:当前作品:谁说不是呢我也忙◄"
;
}
else
{
text
+=
"【旁白@正常】►打开:当前作品:今天下午是真的忙◄"
;
}
}
}
}
}
}
//保存玩家这轮的请求信息,用于下一步的操作
//保存玩家这轮的请求信息,用于下一步的操作
...
@@ -1288,7 +1341,7 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1288,7 +1341,7 @@ public class GardenerServiceImpl implements GardenerService {
//查找可选择的技能名称
//查找可选择的技能名称
String
[]
skillIds
=
gardenerLevelConfig
.
getGardenerSkillIds
().
split
(
"\\|"
);
String
[]
skillIds
=
gardenerLevelConfig
.
getGardenerSkillIds
().
split
(
"\\|"
);
for
(
String
skill
:
skillIds
)
{
for
(
String
skill
:
skillIds
)
{
feedText
.
append
(
gardenerSkillMap
.
get
(
Integer
.
parseInt
(
skill
)).
getName
()
).
append
(
"、"
);
feedText
.
append
(
"🅰"
).
append
(
gardenerSkillMap
.
get
(
Integer
.
parseInt
(
skill
)).
getName
()).
append
(
"🅱"
).
append
(
"、"
);
}
}
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
//玩家未提供技能名称
//玩家未提供技能名称
...
@@ -1512,6 +1565,26 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1512,6 +1565,26 @@ public class GardenerServiceImpl implements GardenerService {
operationReq
.
setLevel
(
maxLevel
[
0
]);
operationReq
.
setLevel
(
maxLevel
[
0
]);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
}
}
if
(
level
==
2
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:自助牛肉香火锅◄"
;
}
}
if
(
level
==
3
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:鲲之大一锅炖不下◄"
;
}
}
if
(
level
==
4
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:鹏之大两个烧烤架◄"
;
}
}
if
(
level
==
5
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:零丁洋里叹零丁◄"
;
}
}
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
feedbackId
);
resultResponse
.
set
反馈
ID
(
feedbackId
);
...
@@ -1551,6 +1624,26 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1551,6 +1624,26 @@ public class GardenerServiceImpl implements GardenerService {
operationReq
.
setLevel
(
maxLevel
[
0
]);
operationReq
.
setLevel
(
maxLevel
[
0
]);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
}
}
if
(
level
==
2
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:自助牛肉香火锅◄"
;
}
}
if
(
level
==
3
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:鲲之大一锅炖不下◄"
;
}
}
if
(
level
==
4
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:鹏之大两个烧烤架◄"
;
}
}
if
(
level
==
5
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:零丁洋里叹零丁◄"
;
}
}
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
feedbackId
);
resultResponse
.
set
反馈
ID
(
feedbackId
);
...
@@ -1607,6 +1700,26 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1607,6 +1700,26 @@ public class GardenerServiceImpl implements GardenerService {
operationReq
.
setLevel
(
maxLevel
[
0
]);
operationReq
.
setLevel
(
maxLevel
[
0
]);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
}
}
if
(
level
==
2
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:自助牛肉香火锅◄"
;
}
}
if
(
level
==
3
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:鲲之大一锅炖不下◄"
;
}
}
if
(
level
==
4
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:鹏之大两个烧烤架◄"
;
}
}
if
(
level
==
5
)
{
if
(
gardenerInfo
.
getGender
()
==
2
)
{
text
+=
"【旁白@正常】►打开:当前作品:零丁洋里叹零丁◄"
;
}
}
log
.
info
(
"园丁学习后的技能:"
+
gardenerSkills
);
log
.
info
(
"园丁学习后的技能:"
+
gardenerSkills
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
...
@@ -1822,7 +1935,7 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -1822,7 +1935,7 @@ public class GardenerServiceImpl implements GardenerService {
Map
<
Integer
,
GardenerSkillPojo
>
gardenerSkillMap
=
TimingAcquisition
.
gardenerSkillMap
;
Map
<
Integer
,
GardenerSkillPojo
>
gardenerSkillMap
=
TimingAcquisition
.
gardenerSkillMap
;
String
[]
skillIds
=
gardenerLevelConfig
.
getGardenerSkillIds
().
split
(
"\\|"
);
String
[]
skillIds
=
gardenerLevelConfig
.
getGardenerSkillIds
().
split
(
"\\|"
);
for
(
String
skillId
:
skillIds
)
{
for
(
String
skillId
:
skillIds
)
{
feedText
.
append
(
gardenerSkillMap
.
get
(
Integer
.
parseInt
(
skillId
)).
getName
()
).
append
(
"、"
);
feedText
.
append
(
"🅰"
).
append
(
gardenerSkillMap
.
get
(
Integer
.
parseInt
(
skillId
)).
getName
()).
append
(
"🅱"
).
append
(
"、"
);
}
}
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
//技能重置花费信息
//技能重置花费信息
...
...
src/main/java/com/qiwuai/garden/service/helpService/impl/HelpServiceImpl.java
View file @
62ae40e0
...
@@ -17,6 +17,9 @@ import org.slf4j.LoggerFactory;
...
@@ -17,6 +17,9 @@ import org.slf4j.LoggerFactory;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
...
@@ -837,11 +840,13 @@ public class HelpServiceImpl implements HelpService {
...
@@ -837,11 +840,13 @@ public class HelpServiceImpl implements HelpService {
List
<
String
>
petList
=
new
ArrayList
<>();
List
<
String
>
petList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Integer
,
PetPojo
>
entry
:
TimingAcquisition
.
petConfigMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
PetPojo
>
entry
:
TimingAcquisition
.
petConfigMap
.
entrySet
())
{
PetPojo
pet
=
entry
.
getValue
();
PetPojo
pet
=
entry
.
getValue
();
String
[]
favoritePlantIds
=
pet
.
getFavoritePlantId
().
split
(
"\\|"
);
if
(!
StringUtils
.
isEmpty
(
pet
.
getFavoritePlantId
()))
{
//String[]转Integer[]
String
[]
favoritePlantIds
=
pet
.
getFavoritePlantId
().
split
(
"\\|"
);
List
<
Integer
>
favoritePlantIdList
=
Stream
.
of
(
favoritePlantIds
).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
//String[]转Integer[]
if
(
favoritePlantIdList
.
contains
(
plantId
))
{
List
<
Integer
>
favoritePlantIdList
=
Stream
.
of
(
favoritePlantIds
).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
petList
.
add
(
pet
.
getName
());
if
(
favoritePlantIdList
.
contains
(
plantId
))
{
petList
.
add
(
pet
.
getName
());
}
}
}
}
}
String
plantName
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getName
();
String
plantName
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getName
();
...
...
src/main/java/com/qiwuai/garden/service/marketService/impl/MarketServiceImpl.java
View file @
62ae40e0
...
@@ -141,7 +141,8 @@ public class MarketServiceImpl implements MarketService {
...
@@ -141,7 +141,8 @@ public class MarketServiceImpl implements MarketService {
ItemPojo
moneyConfig
=
TimingAcquisition
.
itemConfigMap
.
get
(
moneyId
);
ItemPojo
moneyConfig
=
TimingAcquisition
.
itemConfigMap
.
get
(
moneyId
);
//园丁等级
//园丁等级
Integer
level
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
();
Integer
level
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
();
//最高等级
String
levelMax
=
TimingAcquisition
.
systemConfigMap
.
get
(
"gardener_level_max"
).
getValue
();
String
goodsName
=
itemConfig
.
getName
();
String
goodsName
=
itemConfig
.
getName
();
BigDecimal
itemPrice
=
new
BigDecimal
(
0
);
//商品价格
BigDecimal
itemPrice
=
new
BigDecimal
(
0
);
//商品价格
//通过物品id找商品时,可能存在多个商品的情况
//通过物品id找商品时,可能存在多个商品的情况
...
@@ -149,6 +150,19 @@ public class MarketServiceImpl implements MarketService {
...
@@ -149,6 +150,19 @@ public class MarketServiceImpl implements MarketService {
for
(
Map
.
Entry
<
Integer
,
GoodsPojo
>
entry
:
goodsConfigMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
GoodsPojo
>
entry
:
goodsConfigMap
.
entrySet
())
{
GoodsPojo
goods
=
entry
.
getValue
();
GoodsPojo
goods
=
entry
.
getValue
();
if
(
goods
.
getItemId
().
equals
(
itemId
))
{
if
(
goods
.
getItemId
().
equals
(
itemId
))
{
if
(
goods
.
getLevel
()
>
Integer
.
parseInt
(
levelMax
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMarketSpeech
(
Constants
.
SPEECH_ASIDE
,
"buy_fail_item_no_exist"
);
text
+=
SpeechUtil
.
getMarketSpeech
(
gender
,
"buy_fail_item_no_exist"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
400109
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//园丁等级不足以购买该物品
//园丁等级不足以购买该物品
if
(
level
<
goods
.
getLevel
())
{
if
(
level
<
goods
.
getLevel
())
{
log
.
info
(
uid
+
"等级为"
+
level
+
",购买"
+
goodsName
+
"所需等级"
+
goods
.
getLevel
()
+
",不能购买"
);
log
.
info
(
uid
+
"等级为"
+
level
+
",购买"
+
goodsName
+
"所需等级"
+
goods
.
getLevel
()
+
",不能购买"
);
...
@@ -560,6 +574,21 @@ public class MarketServiceImpl implements MarketService {
...
@@ -560,6 +574,21 @@ public class MarketServiceImpl implements MarketService {
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
//该物品不能出售
if
(
itemConfig
.
getSalable
()
==
0
)
{
log
.
info
(
uid
+
"的"
+
itemConfig
.
getName
()
+
"不能出售"
);
//获取对应话术
String
text
=
SpeechUtil
.
getMarketSpeech
(
Constants
.
SPEECH_ASIDE
,
"sell_check_fail_salable"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemConfig
.
getName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
400217
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"出售物品回复2"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//玩家还没有提供数量
//玩家还没有提供数量
if
(
StringUtils
.
isEmpty
(
number
))
{
if
(
StringUtils
.
isEmpty
(
number
))
{
log
.
info
(
uid
+
"玩家没提供出售的物品数量"
);
log
.
info
(
uid
+
"玩家没提供出售的物品数量"
);
...
@@ -807,6 +836,18 @@ public class MarketServiceImpl implements MarketService {
...
@@ -807,6 +836,18 @@ public class MarketServiceImpl implements MarketService {
return
commonResponse
;
return
commonResponse
;
}
}
log
.
info
(
uid
+
"开始查询出售所有物品的收益,物品种类id:"
+
itemTypeId
);
log
.
info
(
uid
+
"开始查询出售所有物品的收益,物品种类id:"
+
itemTypeId
);
if
(
itemTypeId
==
Constants
.
ITEM_TYPE_OTHER
)
{
log
.
info
(
uid
+
"的关键物品不能出售"
);
//获取对应话术
String
text
=
SpeechUtil
.
getMarketSpeech
(
Constants
.
SPEECH_ASIDE
,
"sell_all_check_fail_salable"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
反馈
ID
(
400218
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//园丁性别
//园丁性别
String
gender
=
TimingAcquisition
.
getGardenerGender
(
uid
);
String
gender
=
TimingAcquisition
.
getGardenerGender
(
uid
);
//物品配置信息
//物品配置信息
...
...
src/main/java/com/qiwuai/garden/service/petService/PetService.java
View file @
62ae40e0
...
@@ -118,4 +118,46 @@ public interface PetService {
...
@@ -118,4 +118,46 @@ public interface PetService {
* @return CommonResponse
* @return CommonResponse
*/
*/
CommonResponse
updatePet
(
OperationRequest
operationReq
);
CommonResponse
updatePet
(
OperationRequest
operationReq
);
/**
* 宠物比试,返回给bot的每日任务显示
* @param operationReq
* @return CommonResponse
*/
CommonResponse
petMatch
(
OperationRequest
operationReq
);
/**
* 玩家选定宠物,返回给bot的每日任务显示
* @param operationReq
* @return CommonResponse
*/
CommonResponse
petChoose
(
OperationRequest
operationReq
);
/**
* 宠物比试结果,返回给bot的每日任务显示
* @param operationReq
* @return CommonResponse
*/
CommonResponse
petMatchResult
(
OperationRequest
operationReq
);
/**
* 挑战副本
* @param operationReq
* @return CommonResponse
*/
CommonResponse
brushCopy
(
OperationRequest
operationReq
);
/**
* 挑战副本成功
* @param operationReq
* @return CommonResponse
*/
CommonResponse
brushCopySuccess
(
OperationRequest
operationReq
);
/**
* 开始套圈游戏
* @param operationReq
* @return CommonResponse
*/
CommonResponse
startRingToss
(
OperationRequest
operationReq
);
/**
* 重试套圈游戏
* @param operationReq
* @return CommonResponse
*/
CommonResponse
retryRingToss
(
OperationRequest
operationReq
);
}
}
src/main/java/com/qiwuai/garden/service/petService/impl/PetServiceImpl.java
View file @
62ae40e0
...
@@ -8,6 +8,8 @@ import com.qiwuai.garden.common.cache.CacheGlobal;
...
@@ -8,6 +8,8 @@ import com.qiwuai.garden.common.cache.CacheGlobal;
import
com.qiwuai.garden.common.cache.CacheUtil
;
import
com.qiwuai.garden.common.cache.CacheUtil
;
import
com.qiwuai.garden.common.utils.*
;
import
com.qiwuai.garden.common.utils.*
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.ItemBagDto
;
import
com.qiwuai.garden.dto.ItemDto
;
import
com.qiwuai.garden.dto.NurseryInfoDto
;
import
com.qiwuai.garden.dto.NurseryInfoDto
;
import
com.qiwuai.garden.dto.base.CommonResponse
;
import
com.qiwuai.garden.dto.base.CommonResponse
;
import
com.qiwuai.garden.dto.base.ResultResponse
;
import
com.qiwuai.garden.dto.base.ResultResponse
;
...
@@ -913,7 +915,6 @@ public class PetServiceImpl implements PetService {
...
@@ -913,7 +915,6 @@ public class PetServiceImpl implements PetService {
log
.
info
(
uid
+
"不存在该宠物"
);
log
.
info
(
uid
+
"不存在该宠物"
);
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_delete_fail_no_pet"
);
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_delete_fail_no_pet"
);
text
+=
SpeechUtil
.
getPetSpeech
(
gender
,
"pet_delete_fail_no_pet"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
300402
);
resultResponse
.
set
反馈
ID
(
300402
);
...
@@ -2425,7 +2426,6 @@ public class PetServiceImpl implements PetService {
...
@@ -2425,7 +2426,6 @@ public class PetServiceImpl implements PetService {
ResultResponse
resultResponse
=
new
ResultResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"upgrade_pet"
);
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"upgrade_pet"
);
resultResponse
.
set
反馈
ID
(
301007
);
resultResponse
.
set
反馈
ID
(
301007
);
...
@@ -2437,4 +2437,488 @@ public class PetServiceImpl implements PetService {
...
@@ -2437,4 +2437,488 @@ public class PetServiceImpl implements PetService {
return
commonResponse
;
return
commonResponse
;
}
}
@Override
public
CommonResponse
petMatch
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
List
<
Integer
>
petIdList
=
new
ArrayList
<>();
Map
<
Integer
,
PetPojo
>
petMap
=
TimingAcquisition
.
petConfigMap
;
//开放的等级上限
int
levelMax
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"gardener_level_max"
).
getValue
());
//等级上限换算成宠物稀有度上限
int
rarityMax
=
(
levelMax
%
2
>
0
)
?
(
levelMax
/
2
+
1
)
:
(
levelMax
/
2
);
for
(
Map
.
Entry
<
Integer
,
PetPojo
>
entry
:
petMap
.
entrySet
())
{
PetPojo
pet
=
entry
.
getValue
();
if
(
pet
.
getRarityId
()
<=
rarityMax
)
{
petIdList
.
add
(
entry
.
getKey
());
}
}
int
random1
=
RandomDropUtil
.
getRandomNum
(
0
,
petIdList
.
size
());
Integer
petId1
=
petIdList
.
get
(
random1
);
petIdList
.
remove
(
random1
);
int
random2
=
RandomDropUtil
.
getRandomNum
(
0
,
petIdList
.
size
());
Integer
petId2
=
petIdList
.
get
(
random2
);
PetPojo
pet1
=
TimingAcquisition
.
petConfigMap
.
get
(
petId1
);
PetPojo
pet2
=
TimingAcquisition
.
petConfigMap
.
get
(
petId2
);
int
t1
=
pet1
.
getHp
()/
pet1
.
getFc
();
//本轮防守方可承受的攻击次数
int
t2
=
pet2
.
getHp
()/
pet2
.
getFc
();
//本轮挑战方可承受的攻击次数
//防守方能承受更多攻击次数,即能赢
if
(
t1
>
t2
)
{
resultResponse
.
setGB_
输赢结果
(
pet1
.
getName
());
operationReq
.
setPetResult
(
1
);
}
else
{
//挑战方能承受更多攻击次数,即能赢
resultResponse
.
setGB_
输赢结果
(
pet2
.
getName
());
operationReq
.
setPetResult
(
2
);
}
//保存玩家这轮的请求信息
operationReq
.
setPet1
(
petId1
);
operationReq
.
setPet2
(
petId2
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
resultResponse
.
setGB_
宠物
1
(
pet1
.
getName
());
resultResponse
.
setGB_
宠物
2
(
pet2
.
getName
());
resultResponse
.
set
宠物
1
生命值
(
pet1
.
getHp
());
resultResponse
.
set
宠物
2
生命值
(
pet2
.
getHp
());
resultResponse
.
set
反馈
ID
(
301008
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
petChoose
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
Integer
petId
=
operationReq
.
getPetId
();
Integer
pet1
=
operationReq
.
getPet1
();
Integer
pet2
=
operationReq
.
getPet2
();
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
pet1
=
lastReq
.
getPet1
();
pet2
=
lastReq
.
getPet2
();
}
String
petName1
=
TimingAcquisition
.
petConfigMap
.
get
(
pet1
).
getName
();
String
petName2
=
TimingAcquisition
.
petConfigMap
.
get
(
pet2
).
getName
();
String
text
=
"宠物名称正确"
;
if
(!
petId
.
equals
(
pet1
)
&&
!
petId
.
equals
(
pet2
))
{
//获取对应话术
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_choose"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
petName1
,
petName2
);
resultResponse
.
set
后台附加返回
(
"宠物名称错误"
);
}
resultResponse
.
set
反馈
ID
(
301009
);
resultResponse
.
set
反馈文本
(
text
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
petMatchResult
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
int
pay
=
operationReq
.
getPay
();
Integer
petId
=
operationReq
.
getPetId
();
Integer
pet1
=
operationReq
.
getPet1
();
int
petResult
=
operationReq
.
getPetResult
();
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
pet1
=
lastReq
.
getPet1
();
petResult
=
lastReq
.
getPetResult
();
}
int
result
=
1
;
if
(!
petId
.
equals
(
pet1
))
{
result
=
2
;
}
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
//货币名称
String
moneyName
=
TimingAcquisition
.
itemConfigMap
.
get
(
moneyId
).
getName
();
Integer
moneyNum
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
()
.
get
(
Constants
.
ITEM_TYPE_MONEY
).
getItems
(
moneyId
).
getItemNum
();
if
(
pay
>
moneyNum
||
pay
<
0
)
{
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_match_fail"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
moneyNum
.
toString
(),
moneyName
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
301010
);
resultResponse
.
set
后台附加返回
(
"玩家灵石不足"
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
int
num1
=
RandomDropUtil
.
getRandomNum
(
10
,
30
);
int
num2
=
RandomDropUtil
.
getRandomNum
(
10
,
30
);
int
money1
=
0
;
int
money2
=
0
;
int
moneyTotal
=
0
;
for
(
int
i
=
0
;
i
<
num1
;
i
++)
{
int
random
=
RandomDropUtil
.
getRandomNum
(
100
,
500
);
money1
+=
random
;
}
for
(
int
i
=
0
;
i
<
num2
;
i
++)
{
int
random
=
RandomDropUtil
.
getRandomNum
(
100
,
500
);
money2
+=
random
;
}
if
(
result
==
1
)
{
num1
++;
money1
+=
pay
;
}
else
{
num2
++;
money2
+=
pay
;
}
int
total
=
num1
+
num2
;
moneyTotal
=
money1
+
money2
;
//获取背包中的所有袋子
Map
<
Integer
,
ItemBagDto
>
itemBags
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
();
//根据种类id取出背包里的钱袋
ItemDto
money
=
itemBags
.
get
(
Constants
.
ITEM_TYPE_MONEY
).
getItems
(
moneyId
);
String
text
=
""
;
//赢了
if
(
result
==
petResult
)
{
resultResponse
.
set
后台附加返回
(
"玩家胜"
);
if
(
result
==
1
)
{
if
(
pay
==
0
)
{
moneyTotal
+=
100
;
float
num
=
(
float
)
100
/
money1
;
int
win
=
(
int
)
(
money2
*
num
)
==
0
?
2
:
(
int
)
(
money2
*
num
);
//货币增加相应数量
money
.
setItemNum
(
money
.
getItemNum
()
+
win
);
//获取对应话术
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_match_win_cost"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
String
.
valueOf
(
win
-
100
),
moneyName
,
money
.
getItemNum
().
toString
(),
String
.
valueOf
(
100
));
}
else
{
float
num
=
(
float
)
pay
/
money1
;
int
win
=
(
int
)
(
money2
*
num
)
==
0
?
2
:
(
int
)
(
money2
*
num
);
//货币增加相应数量
money
.
setItemNum
(
money
.
getItemNum
()
+
win
);
//获取对应话术
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_match_win"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
String
.
valueOf
(
win
),
moneyName
,
money
.
getItemNum
().
toString
());
}
}
else
{
if
(
pay
==
0
)
{
moneyTotal
+=
100
;
float
num
=
(
float
)
100
/
money2
;
int
win
=
(
int
)
(
money1
*
num
)
==
0
?
2
:
(
int
)
(
money1
*
num
);
//货币增加相应数量
money
.
setItemNum
(
money
.
getItemNum
()
+
win
);
//获取对应话术
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_match_win_cost"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
String
.
valueOf
(
win
-
100
),
moneyName
,
money
.
getItemNum
().
toString
(),
String
.
valueOf
(
100
));
}
else
{
float
num
=
(
float
)
pay
/
money2
;
int
win
=
(
int
)
(
money1
*
num
)
==
0
?
2
:
(
int
)
(
money1
*
num
);
//货币增加相应数量
money
.
setItemNum
(
money
.
getItemNum
()
+
win
);
//获取对应话术
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_match_win"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
String
.
valueOf
(
win
),
moneyName
,
money
.
getItemNum
().
toString
());
}
}
}
else
{
//输了
resultResponse
.
set
后台附加返回
(
"玩家败"
);
//货币扣除相应数量
money
.
setItemNum
(
money
.
getItemNum
()
-
pay
);
//获取对应话术
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"pet_match_lose"
);
if
(
pay
!=
0
)
{
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
String
.
valueOf
(
pay
),
moneyName
,
money
.
getItemNum
().
toString
());
}
else
{
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
""
,
moneyName
,
money
.
getItemNum
().
toString
());
}
}
//清除缓存,本轮对话结束
CacheGlobal
.
concurrentMap
.
remove
(
uid
);
resultResponse
.
set
总人数
(
total
);
resultResponse
.
set
总金额
(
moneyTotal
);
resultResponse
.
set
人数
1
(
num1
);
resultResponse
.
set
金额
1
(
money1
);
resultResponse
.
set
人数
2
(
num2
);
resultResponse
.
set
金额
2
(
money2
);
resultResponse
.
set
反馈
ID
(
301011
);
resultResponse
.
set
反馈文本
(
text
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
brushCopy
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
String
copyName
=
operationReq
.
getCopyName
();
Integer
copyId
=
TimingAcquisition
.
getCopyId
(
copyName
);
if
(
StringUtils
.
isEmpty
(
copyId
))
{
String
copyNames
=
TimingAcquisition
.
getCopyNames
();
//获取对应话术
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"copy_pet_no_name"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
copyNames
);
resultResponse
.
set
反馈
ID
(
301101
);
resultResponse
.
set
反馈文本
(
text
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//副本刷新时间
String
brushTime
=
TimingAcquisition
.
copyPetMap
.
get
(
copyId
).
getTime
();
if
(
StringUtils
.
isEmpty
(
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
)))
{
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
setCopyTimeMap
();
}
//玩家通过该副本的时间
String
passTime
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
).
getPassTime
();
if
(!
StringUtils
.
isEmpty
(
passTime
))
{
if
(
passTime
.
compareTo
(
brushTime
)
>
0
)
{
//获取对应话术
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"copy_pet_finished"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
copyName
);
resultResponse
.
set
反馈
ID
(
301102
);
resultResponse
.
set
反馈文本
(
text
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
}
Integer
copyPet1
=
TimingAcquisition
.
copyPetMap
.
get
(
copyId
).
getCopyPetList
().
get
(
0
);
Integer
copyPet2
=
TimingAcquisition
.
copyPetMap
.
get
(
copyId
).
getCopyPetList
().
get
(
1
);
boolean
pet1Sign
=
false
;
boolean
pet2Sign
=
false
;
String
copyPet1Name
=
TimingAcquisition
.
petConfigMap
.
get
(
copyPet1
).
getName
();
String
copyPet2Name
=
TimingAcquisition
.
petConfigMap
.
get
(
copyPet2
).
getName
();
//玩家玩该副本的次数累加1次
int
count
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
).
getCount
();
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
).
setCount
(
count
+
1
);
//所有花圃
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
//宠物栏
List
<
Integer
>
petFieldList
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getPetFields
();
List
<
Integer
>
petList
=
new
ArrayList
<>(
petFieldList
);
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
if
(!
StringUtils
.
isEmpty
(
nurseryInfo
.
getPetField
()))
{
petList
.
add
(
nurseryInfo
.
getPetField
());
}
}
String
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"copy_pet_lack_success"
);
if
(!
petList
.
contains
(
copyPet1
))
{
pet1Sign
=
true
;
}
if
(!
petList
.
contains
(
copyPet2
))
{
pet2Sign
=
true
;
}
if
(
pet1Sign
&&
!
pet2Sign
)
{
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"copy_pet_lack_one"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
copyName
,
copyPet1Name
,
copyPet2Name
,
copyPet1Name
);
resultResponse
.
set
反馈
ID
(
301103
);
}
if
(!
pet1Sign
&&
pet2Sign
)
{
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"copy_pet_lack_one"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
copyName
,
copyPet1Name
,
copyPet2Name
,
copyPet2Name
);
resultResponse
.
set
反馈
ID
(
301104
);
}
if
(
pet1Sign
&&
pet2Sign
)
{
text
=
SpeechUtil
.
getPetSpeech
(
Constants
.
SPEECH_ASIDE
,
"copy_pet_lack_two"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
copyName
,
copyPet1Name
,
copyPet2Name
);
resultResponse
.
set
反馈
ID
(
301105
);
}
//---------------------持久化该园丁信息--------------------------
Map
<
String
,
GardenerDto
>
gardenerMap
=
new
ConcurrentHashMap
<>();
gardenerMap
.
put
(
uid
,
TimingAcquisition
.
gardenerMap
.
get
(
uid
));
String
gardener
=
JSON
.
toJSONString
(
gardenerMap
);
PersistenceUtil
.
saveDataToFile
(
uid
,
gardener
);
resultResponse
.
set
反馈
ID
(
301106
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
副本宠物
1
(
copyPet1Name
);
resultResponse
.
set
副本宠物
2
(
copyPet2Name
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
brushCopySuccess
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
String
copyName
=
operationReq
.
getCopyName
();
Integer
copyId
=
TimingAcquisition
.
getCopyId
(
copyName
);
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
).
setPassTime
(
DateUtil
.
getCurrentTime
());
int
success
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
).
getSuccess
();
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getCopyTimeMap
().
get
(
copyId
).
setSuccess
(
success
+
1
);
//---------------------持久化该园丁信息--------------------------
Map
<
String
,
GardenerDto
>
gardenerMap
=
new
ConcurrentHashMap
<>();
gardenerMap
.
put
(
uid
,
TimingAcquisition
.
gardenerMap
.
get
(
uid
));
String
gardener
=
JSON
.
toJSONString
(
gardenerMap
);
PersistenceUtil
.
saveDataToFile
(
uid
,
gardener
);
resultResponse
.
set
反馈
ID
(
301201
);
resultResponse
.
set
反馈文本
(
"副本刷新成功!"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
startRingToss
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
//选中的宠物
PetPojo
choosePet
=
null
;
//套圈初始费用
int
pitchPrice
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"pitch_pet_price"
).
getValue
());
//玩家货币不足
if
(!
AdviseUtil
.
checkMoney
(
uid
,
pitchPrice
))
{
resultResponse
.
set
反馈
ID
(
301301
);
resultResponse
.
set
反馈文本
(
"货币不足"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//园丁等级
Integer
level
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
();
//宠物稀有度等级上限
int
petRarityMax
=
(
int
)
Math
.
ceil
(
level
);
//选择满足稀有度等级的所有宠物,进入卡池
List
<
PetPojo
>
petPojoList
=
AdviseUtil
.
getPetByRarity
(
petRarityMax
);
String
pitchPetExclude
=
TimingAcquisition
.
systemConfigMap
.
get
(
"pitch_pet_exclude"
).
getValue
();
List
<
String
>
pitchPetExcludeList
=
Arrays
.
asList
(
pitchPetExclude
.
split
(
"\\|"
));
for
(
PetPojo
petPojo
:
petPojoList
)
{
//统计有概率出现的宠物
Random
random
=
new
Random
();
double
randomProb
=
random
.
nextDouble
();
if
(
randomProb
<
petPojo
.
getAppearProb
().
doubleValue
())
{
if
(!
pitchPetExcludeList
.
contains
(
petPojo
.
getId
().
toString
()))
{
choosePet
=
petPojo
;
}
}
}
//没有宠物进入卡池时,采用稀有度最低的兜底
if
(
StringUtils
.
isEmpty
(
choosePet
))
{
petPojoList
=
AdviseUtil
.
getPetByRarity
(
petRarityMax
);
int
random
=
RandomDropUtil
.
getRandomNum
(
0
,
petPojoList
.
size
());
choosePet
=
petPojoList
.
get
(
random
);
}
//判定宠物是否被套中
//该宠物属性出现的概率
double
pitchPro
=
TimingAcquisition
.
rarityMap
.
get
(
choosePet
.
getRarityId
()).
getPitchPro
();
Random
random
=
new
Random
();
double
randomPro
=
random
.
nextDouble
();
//套中宠物
if
(
randomPro
<
pitchPro
)
{
//放置宠物
}
//扣除费用
TimingAcquisition
.
costMoney
(
uid
,
pitchPrice
);
//保存玩家这轮的信息
operationReq
.
setPetId
(
choosePet
.
getId
());
operationReq
.
setPay
(
pitchPrice
);
operationReq
.
setNumber
(
1
);
operationReq
.
setOperationLabel
(
Constants
.
PITCH_PET
);
CacheUtil
.
put
(
uid
+
"#pitchPet#"
,
operationReq
,
Long
.
parseLong
(
expireTime
));
resultResponse
.
set
反馈
ID
(
301104
);
resultResponse
.
set
反馈文本
(
""
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
@Override
public
CommonResponse
retryRingToss
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
resultResponse
.
set
玩家当前位置
(
""
);
String
uid
=
operationReq
.
getUid
();
Integer
petId
=
null
;
int
pitchPrice
=
0
;
int
num
=
0
;
//上一轮数据
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
+
"#pitchPet#"
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(
Constants
.
PITCH_PET
.
equals
(
lastReq
.
getOperationLabel
()))
{
petId
=
lastReq
.
getPetId
();
pitchPrice
=
lastReq
.
getPay
();
num
=
lastReq
.
getNumber
();
}
}
//判定宠物是否被套中
PetPojo
choosePet
=
TimingAcquisition
.
petConfigMap
.
get
(
petId
);
//该宠物属性出现的概率
double
pitchPro
=
TimingAcquisition
.
rarityMap
.
get
(
choosePet
.
getRarityId
()).
getPitchPro
();
Random
random
=
new
Random
();
double
randomPro
=
random
.
nextDouble
();
//套中宠物
if
(
randomPro
<
pitchPro
)
{
}
double
pitchPriceRise
=
Double
.
parseDouble
(
TimingAcquisition
.
systemConfigMap
.
get
(
"pitch_pet_price_rise"
).
getValue
());
//扣除的费用
pitchPrice
=
(
int
)
(
pitchPrice
+
pitchPrice
*
pitchPriceRise
*
num
);
//扣除费用
TimingAcquisition
.
costMoney
(
uid
,
pitchPrice
);
//保存玩家这轮的信息
operationReq
.
setPetId
(
choosePet
.
getId
());
operationReq
.
setPay
(
pitchPrice
);
operationReq
.
setNumber
(
num
+
1
);
operationReq
.
setOperationLabel
(
Constants
.
PITCH_PET
);
CacheUtil
.
put
(
uid
+
"#pitchPet#"
,
operationReq
,
Long
.
parseLong
(
expireTime
));
resultResponse
.
set
反馈
ID
(
301104
);
resultResponse
.
set
反馈文本
(
""
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
}
}
src/main/java/com/qiwuai/garden/service/socialService/SocialService.java
View file @
62ae40e0
...
@@ -241,6 +241,12 @@ public interface SocialService {
...
@@ -241,6 +241,12 @@ public interface SocialService {
*/
*/
CommonResponse
leaveMessageCheck
(
OperationRequest
operationReq
);
CommonResponse
leaveMessageCheck
(
OperationRequest
operationReq
);
/**
/**
* 留言指令
* @param operationReq
* @return CommonResponse
*/
CommonResponse
leaveMessageCover
(
OperationRequest
operationReq
)
throws
ParseException
;
/**
* 确定该留言
* 确定该留言
* @param operationReq
* @param operationReq
* @return CommonResponse
* @return CommonResponse
...
...
src/main/java/com/qiwuai/garden/service/socialService/impl/MessageServiceImpl.java
0 → 100644
View file @
62ae40e0
package
com
.
qiwuai
.
garden
.
service
.
socialService
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.qiwuai.garden.common.Constants
;
import
com.qiwuai.garden.common.TimingAcquisition
;
import
com.qiwuai.garden.common.cache.CacheUtil
;
import
com.qiwuai.garden.common.utils.DateUtil
;
import
com.qiwuai.garden.common.utils.PersistenceUtil
;
import
com.qiwuai.garden.common.utils.SpeechUtil
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.dto.base.CommonResponse
;
import
com.qiwuai.garden.dto.base.ResultResponse
;
import
com.qiwuai.garden.dto.base.ResultVarsResponse
;
import
com.qiwuai.garden.dto.request.OperationRequest
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
MessageServiceImpl
{
Logger
log
=
LoggerFactory
.
getLogger
(
MessageServiceImpl
.
class
);
//从yml配置文件中取出对话过期时间
@Value
(
"${expireTime}"
)
private
String
expireTime
;
/**
* 问候
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
SayHello
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
// int intention = operationReq.getIntention(); //留言意图
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//玩家有留言过问候的玩家地址与标识
Map
<
String
,
Integer
>
helloSignMap
=
gardener
.
getHelloSignMap
();
Integer
helloSign
=
helloSignMap
.
get
(
messageAddress
);
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//第一次发问候
if
(
StringUtils
.
isEmpty
(
helloSign
))
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202701
);
operationReq
.
setMessageType
(
1200101
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
}
else
{
//当天还没发过问候留言
if
(
helloSign
==
0
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202702
);
operationReq
.
setMessageType
(
1200102
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
}
if
(
helloSign
==
1
)
{
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202703
);
}
}
}
else
{
//是好友
//第一次发问候
if
(
StringUtils
.
isEmpty
(
helloSign
))
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200101
);
operationReq
.
setMessageType
(
1200101
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
}
else
{
//当天还没发过问候留言
if
(
helloSign
==
0
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200102
);
operationReq
.
setMessageType
(
1200102
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
}
if
(
helloSign
==
1
)
{
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200103
);
}
}
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
12001
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求种植
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askPlant
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
Integer
plantId
=
operationReq
.
getPlantId
();
String
text
=
""
;
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200204
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200204
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//未提供植物名称
if
(
StringUtils
.
isEmpty
(
plantId
))
{
log
.
info
(
uid
+
"未提供植物名称"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200203
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200203
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//植物名称不存在
if
(
plantId
==
Constants
.
REQ_NON
)
{
log
.
info
(
uid
+
"提供的植物名称不存在"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200202
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200202
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
//指定植物的名称
String
plantName
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getName
();
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200201
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
plantName
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessage
(
addText
);
operationReq
.
setMessageType
(
12002
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200201
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求帮助
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askHelp
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
Integer
nurseryNum
=
operationReq
.
getNurseryNum
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200304
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200304
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//没有提供花圃编号
if
(
StringUtils
.
isEmpty
(
nurseryNum
))
{
//获取对应话术
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200302
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessage
(
addText
);
operationReq
.
setMessageType
(
12003
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200302
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
//花圃编号不存在
if
(
StringUtils
.
isEmpty
(
nurseryInfo
))
{
//玩家目前的所有花圃
String
nurseryText
=
TimingAcquisition
.
getAllNurseryNum
(
uid
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200303
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200303
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"询问收取苗圃"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200301
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
nurseryNum
.
toString
(),
nurseryInfo
.
getEarnRate
().
toString
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessage
(
addText
);
operationReq
.
setMessageType
(
12003
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200301
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求协助攻打
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askToFight
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
String
address
=
operationReq
.
getAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//未提供玩家地址
if
(
StringUtils
.
isEmpty
(
address
))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200403
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200403
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"询问攻打地址"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//判断提供的玩家地址是否存在
if
(!
TimingAcquisition
.
checkAddress
(
address
))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200402
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200402
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"询问攻打地址"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//不能留言攻打自己
if
(
address
.
equals
(
messageAddress
))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200205
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200205
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"询问攻打地址"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200404
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200404
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200401
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
address
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessage
(
addText
);
operationReq
.
setMessageType
(
12004
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200401
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 问候回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
sayHelloAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
Integer
messageType
=
operationReq
.
getMessageType
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
//第一次问候的回复
if
(
messageType
==
1200101
)
{
//获取对应话术
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200501
);
resultResponse
.
set
反馈
ID
(
1200501
);
}
if
(
messageType
==
1200102
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200502
);
resultResponse
.
set
反馈
ID
(
1200502
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求种植回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askPlantAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
intention
=
operationReq
.
getIntention
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
if
(
intention
==
1200601
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200601
);
resultResponse
.
set
反馈
ID
(
1200601
);
}
if
(
intention
==
1200602
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200602
);
resultResponse
.
set
反馈
ID
(
1200602
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求帮助回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askHelpAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
intention
=
operationReq
.
getIntention
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
if
(
intention
==
1200701
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200701
);
resultResponse
.
set
反馈
ID
(
1200701
);
}
if
(
intention
==
1200702
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200702
);
resultResponse
.
set
反馈
ID
(
1200702
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求协助攻打回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askToFightAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
intention
=
operationReq
.
getIntention
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
if
(
intention
==
1200801
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200801
);
resultResponse
.
set
反馈
ID
(
1200801
);
}
if
(
intention
==
1200802
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200802
);
resultResponse
.
set
反馈
ID
(
1200802
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 种植感谢
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanksPlant
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200902
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200902
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200901
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12012
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1200901
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 帮助感谢
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanksHelp
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201002
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201002
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201001
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12012
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201001
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 协助攻打感谢
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanksToFight
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201102
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201102
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201101
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12012
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201101
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 感谢回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanksAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201202
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201202
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201201
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201201
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求放置宠物
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askToPutPet
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
Integer
petId
=
operationReq
.
getPetId
();
String
text
=
""
;
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201304
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201304
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//未提供植物名称
if
(
StringUtils
.
isEmpty
(
petId
))
{
log
.
info
(
uid
+
"未提供宠物名称"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201303
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201303
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//植物名称不存在
if
(
petId
==
Constants
.
REQ_NON
)
{
log
.
info
(
uid
+
"提供的宠物名称不存在"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201302
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201302
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
//宠物的名称
String
petName
=
TimingAcquisition
.
petConfigMap
.
get
(
petId
).
getName
();
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201301
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
petName
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessage
(
addText
);
operationReq
.
setMessageType
(
12013
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201301
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求放置宠物回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askToPutPetAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
intention
=
operationReq
.
getIntention
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
if
(
intention
==
1201401
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201401
);
resultResponse
.
set
反馈
ID
(
1201401
);
}
if
(
intention
==
1201402
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201402
);
resultResponse
.
set
反馈
ID
(
1201402
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 宠物感谢
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanksToPutPet
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201502
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201502
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201501
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12012
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201501
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 通知种植情况
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
plantNotice
(
OperationRequest
operationReq
)
throws
ParseException
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
Integer
nurseryNum
=
operationReq
.
getNurseryNum
();
String
text
=
""
;
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201605
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201605
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//未提供花圃编号
if
(
StringUtils
.
isEmpty
(
nurseryNum
))
{
log
.
info
(
uid
+
"未提供花圃编号"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201603
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201603
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"改变种植苗圃"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
//花圃编号不存在
if
(
StringUtils
.
isEmpty
(
nurseryInfo
))
{
log
.
info
(
uid
+
"提供的花圃编号不存在"
);
//玩家目前的所有花圃
String
nurseryText
=
TimingAcquisition
.
getAllNurseryNum
(
uid
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201604
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201604
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//苗圃中没有种植
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
log
.
info
(
uid
+
"的花圃编号"
+
nurseryNum
+
"没有植物"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201602
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201602
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"改变种植苗圃"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
String
nowTime
=
DateUtil
.
getCurrentTime
();
//指定植物的名称
String
plantName
=
TimingAcquisition
.
plantMap
.
get
(
nurseryInfo
.
getPlantId
()).
getName
();
if
(
nowTime
.
compareTo
(
nurseryInfo
.
getPlantTime
().
getMatureTime
())
<
0
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201601
);
//剩余成熟时间
String
subTime
=
DateUtil
.
subTimeToDate
(
DateUtil
.
getCurrentTime
(),
nurseryInfo
.
getPlantTime
().
getMatureTime
());
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
nurseryNum
.
toString
(),
plantName
,
subTime
);
}
else
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
120160101
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
nurseryNum
.
toString
(),
plantName
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201601
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 通知宠物放置情况
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
putPetNotice
(
OperationRequest
operationReq
)
throws
ParseException
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
Integer
nurseryNum
=
operationReq
.
getNurseryNum
();
String
text
=
""
;
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201705
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201705
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//未提供花圃编号
if
(
StringUtils
.
isEmpty
(
nurseryNum
))
{
log
.
info
(
uid
+
"未提供花圃编号"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201703
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201703
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
//花圃编号不存在
if
(
StringUtils
.
isEmpty
(
nurseryInfo
))
{
log
.
info
(
uid
+
"提供的花圃编号不存在"
);
//玩家目前的所有花圃
String
nurseryText
=
TimingAcquisition
.
getAllNurseryNum
(
uid
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201704
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201704
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//苗圃中没有放置宠物
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPetField
()))
{
log
.
info
(
uid
+
"的花圃编号"
+
nurseryNum
+
"没有宠物"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201702
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201702
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
//宠物的名称
String
petName
=
TimingAcquisition
.
petConfigMap
.
get
(
nurseryInfo
.
getPetField
()).
getName
();
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201701
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
nurseryNum
.
toString
(),
petName
);
}
else
{
String
nowTime
=
DateUtil
.
getCurrentTime
();
//指定植物的名称
String
plantName
=
TimingAcquisition
.
plantMap
.
get
(
nurseryInfo
.
getPlantId
()).
getName
();
if
(
nowTime
.
compareTo
(
nurseryInfo
.
getPlantTime
().
getMatureTime
())
<
0
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
120170101
);
//剩余成熟时间
String
subTime
=
DateUtil
.
subTimeToDate
(
DateUtil
.
getCurrentTime
(),
nurseryInfo
.
getPlantTime
().
getMatureTime
());
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
nurseryNum
.
toString
(),
petName
,
plantName
,
subTime
);
}
else
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
120170102
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
nurseryNum
.
toString
(),
petName
,
plantName
);
}
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201701
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 通知帮助情况
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
helpNotice
(
OperationRequest
operationReq
)
throws
ParseException
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//获取对应话术
String
text
=
""
;
//对方还不是好友
if
(
StringUtils
.
isEmpty
(
friend
))
{
log
.
info
(
uid
+
"帮助的对象:"
+
messageAddress
+
"还不是好友"
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201803
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201803
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//该好友今天还未帮助过
String
nowTime
=
DateUtil
.
getCurrentTime
();
if
(!
StringUtils
.
isEmpty
(
friend
.
getHelpTime
()))
{
if
(
DateUtil
.
compare
(
friend
.
getHelpTime
(),
nowTime
)
<
0
&&
Constants
.
HELP_HAVE_SIGN
==
friend
.
getHelpTag
())
{
//该好友标记为未帮助
friend
.
setHelpTag
(
Constants
.
HELP_NO_SIGN
);
friend
.
setHelpTime
(
null
);
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201802
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201802
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
}
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201801
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201801
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 通知攻打情况
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
fightNotice
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
String
address
=
operationReq
.
getAddress
();
//攻打的玩家地址
//获取对应话术
String
text
=
""
;
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201904
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201904
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//未提供玩家地址
if
(
StringUtils
.
isEmpty
(
address
))
{
log
.
info
(
uid
+
"未提供玩家地址"
);
operationReq
.
setAddress
(
address
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201903
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201903
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"攻打地址情况"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//该玩家今天还未攻打过
Map
<
String
,
StrangerDto
>
strangerMap
=
gardener
.
getStrangerMap
();
if
(!
StringUtils
.
isEmpty
(
strangerMap
))
{
if
(
StringUtils
.
isEmpty
(
strangerMap
.
get
(
address
)))
{
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201902
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201902
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
}
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1201901
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
address
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1201901
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求提升/降低帮助收益
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askToChange
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
String
messageChange
=
operationReq
.
getMessageChange
();
//留言内容
Integer
earnRate
=
operationReq
.
getEarnRate
();
//收益比例
//花圃收益比例的区间
String
earnRateRange
=
TimingAcquisition
.
systemConfigMap
.
get
(
"earn_rate_range"
).
getValue
();
String
[]
earnRateRangeList
=
earnRateRange
.
split
(
"\\|"
);
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202005
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202005
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
String
addText
=
""
;
//未提供留言内容(提升或降低)
if
(
StringUtils
.
isEmpty
(
messageChange
))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202004
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202004
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"提升或降低"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//玩家未提供收益比例
if
(
StringUtils
.
isEmpty
(
earnRate
))
{
//获取对应话术
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202003
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
messageChange
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
if
(
"提升"
.
equals
(
messageChange
))
{
operationReq
.
setMessageType
(
1202001
);
}
else
{
operationReq
.
setMessageType
(
1202002
);
}
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202003
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//玩家设置的收益比例不在区间内
if
(
earnRate
<
Integer
.
parseInt
(
earnRateRangeList
[
0
])
||
earnRate
>
Integer
.
parseInt
(
earnRateRangeList
[
1
]))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202002
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
earnRateRangeList
[
0
],
earnRateRangeList
[
1
]);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202002
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"选择收益比例"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202001
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
messageChange
,
earnRate
.
toString
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
if
(
"提升"
.
equals
(
messageChange
))
{
operationReq
.
setMessageType
(
1202001
);
}
else
{
operationReq
.
setMessageType
(
1202002
);
}
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202001
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 回复请求提升帮助收益
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askToChangeAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
intention
=
operationReq
.
getIntention
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
Integer
messageType
=
operationReq
.
getMessageType
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
if
(
intention
==
1202101
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202101
);
resultResponse
.
set
反馈
ID
(
1202101
);
}
if
(
intention
==
1202102
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202102
);
resultResponse
.
set
反馈
ID
(
1202102
);
}
if
(
messageType
==
1202001
)
{
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
"提升"
);
}
if
(
messageType
==
1202002
)
{
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
"降低"
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 通知提升/降低帮助收益
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
changeNotice
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//待留言的玩家地址
Integer
nurseryNum
=
operationReq
.
getNurseryNum
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202205
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202205
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//没有提供花圃编号
if
(
StringUtils
.
isEmpty
(
nurseryNum
))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
String
nurseryText
=
TimingAcquisition
.
getAllNurseryNum
(
uid
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202203
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202203
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"改变比例苗圃"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
//花圃编号不存在
if
(
StringUtils
.
isEmpty
(
nurseryInfo
))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//玩家目前的所有花圃
String
nurseryText
=
TimingAcquisition
.
getAllNurseryNum
(
uid
);
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202204
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202204
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"改变比例苗圃"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//指定花圃还没有变更收益
Integer
lastEarnRate
=
nurseryInfo
.
getLastEarnRate
();
if
(
StringUtils
.
isEmpty
(
lastEarnRate
))
{
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202202
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryNum
.
toString
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202202
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"改变比例苗圃"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
Integer
earnRate
=
nurseryInfo
.
getEarnRate
();
String
change
=
""
;
if
(
lastEarnRate
>
earnRate
)
{
change
=
"降低"
;
}
else
{
change
=
"提升"
;
}
//获取对应话术
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202201
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
nurseryNum
.
toString
(),
change
,
earnRate
.
toString
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202201
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 提升/降低帮助请求感谢
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanksToChange
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是陌生人
if
(
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202302
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202302
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202301
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12012
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202301
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求休战
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askTruce
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是好友
if
(!
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202403
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202403
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//-------------------获取uid的所有偷菜简报-------------------
String
stealReports
=
PersistenceUtil
.
getReportFromFile
(
uid
,
"防守简报"
);
List
<
StealReportDto
>
allStealReportList
=
JSON
.
parseObject
(
stealReports
,
new
TypeReference
<
List
<
StealReportDto
>>(){});
boolean
flag
=
false
;
//标记攻打过
if
(!
StringUtils
.
isEmpty
(
allStealReportList
))
{
if
(
allStealReportList
.
size
()
!=
0
)
{
for
(
StealReportDto
stealReport
:
allStealReportList
)
{
if
(
messageAddress
.
equals
(
stealReport
.
getStrangeAddress
()))
{
flag
=
true
;
}
}
}
}
//没有被对方攻打过
if
(!
flag
)
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202402
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202402
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202401
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12024
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202401
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 请求休战回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
askTruceAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
intention
=
operationReq
.
getIntention
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
if
(
intention
==
1202501
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202501
);
resultResponse
.
set
反馈
ID
(
1202501
);
}
if
(
intention
==
1202502
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202502
);
resultResponse
.
set
反馈
ID
(
1202502
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 休战感谢
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanksTruce
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是好友
if
(!
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202602
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202602
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202601
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12012
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202601
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 邀请攻打
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
inviteToFight
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//玩家信息
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
messageAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
}
//对方是好友
if
(!
StringUtils
.
isEmpty
(
friend
))
{
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202802
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202802
);
resultResponse
.
set
反馈文本
(
text
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202801
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12028
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1202801
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 邀请攻打回复
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
inviteToFightAnswer
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
int
intention
=
operationReq
.
getIntention
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
""
;
if
(
intention
==
1202901
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202901
);
resultResponse
.
set
反馈
ID
(
1202901
);
}
if
(
intention
==
1202902
)
{
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1202902
);
resultResponse
.
set
反馈
ID
(
1202902
);
}
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
null
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
/**
* 模糊感谢
* @param operationReq
* @return CommonResponse
*/
public
CommonResponse
thanks
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
messageAddress
=
operationReq
.
getMessageAddress
();
//获取对应话术
String
text
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1200100
);
String
addText
=
SpeechUtil
.
getMessageSpeech
(
Constants
.
SPEECH_ASIDE
,
1203001
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageAddress
,
addText
);
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setMessageType
(
12012
);
operationReq
.
setMessage
(
addText
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
1203001
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"是否确定该留言"
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
}
}
src/main/java/com/qiwuai/garden/service/socialService/impl/SocialServiceImpl.java
View file @
62ae40e0
...
@@ -37,6 +37,8 @@ public class SocialServiceImpl implements SocialService {
...
@@ -37,6 +37,8 @@ public class SocialServiceImpl implements SocialService {
private
String
expireTime
;
private
String
expireTime
;
@Autowired
@Autowired
private
TaskServiceImpl
taskServiceImpl
;
private
TaskServiceImpl
taskServiceImpl
;
@Autowired
private
MessageServiceImpl
messageServiceImpl
;
@Override
@Override
public
CommonResponse
visitStrangerCheck
(
OperationRequest
operationReq
)
{
public
CommonResponse
visitStrangerCheck
(
OperationRequest
operationReq
)
{
...
@@ -264,24 +266,24 @@ public class SocialServiceImpl implements SocialService {
...
@@ -264,24 +266,24 @@ public class SocialServiceImpl implements SocialService {
String
uid
=
operationReq
.
getUid
();
String
uid
=
operationReq
.
getUid
();
String
address
=
operationReq
.
getAddress
();
String
address
=
operationReq
.
getAddress
();
String
name
=
operationReq
.
getName
();
//
String name = operationReq.getName();
//当前玩家上一轮的请求信息
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
.
getAddress
()))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
.
getAddress
()))
{
address
=
lastReq
.
getAddress
();
address
=
lastReq
.
getAddress
();
name
=
lastReq
.
getName
();
//
name = lastReq.getName();
}
}
}
else
{
}
else
{
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"失败,对话已结束"
);
commonResponse
.
setMsg
(
"失败,对话已结束"
);
return
commonResponse
;
return
commonResponse
;
}
}
String
person
=
(
name
==
null
)
?
address
:
name
;
//
String person = (name == null) ? address : name;
log
.
info
(
uid
+
"开始跨地区拜访:"
+
person
);
log
.
info
(
uid
+
"开始跨地区拜访:"
+
address
);
//保存玩家这轮的请求信息,用于下一步操作
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setAddress
(
address
);
operationReq
.
setAddress
(
address
);
operationReq
.
setName
(
name
);
//
operationReq.setName(name);
operationReq
.
setOperationLabel
(
Constants
.
VISIT_STRANGER
);
operationReq
.
setOperationLabel
(
Constants
.
VISIT_STRANGER
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//------------------------扣除玩家跨地区访问费用------------------
//------------------------扣除玩家跨地区访问费用------------------
...
@@ -295,7 +297,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -295,7 +297,7 @@ public class SocialServiceImpl implements SocialService {
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"visit_stranger_cross"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"visit_stranger_cross"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
person
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"visit_stranger_cross"
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"visit_stranger_cross"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -318,15 +320,15 @@ public class SocialServiceImpl implements SocialService {
...
@@ -318,15 +320,15 @@ public class SocialServiceImpl implements SocialService {
String
uid
=
operationReq
.
getUid
();
String
uid
=
operationReq
.
getUid
();
String
address
=
operationReq
.
getAddress
();
//对方的玩家地址
String
address
=
operationReq
.
getAddress
();
//对方的玩家地址
String
name
=
operationReq
.
getName
();
//对方的园丁名称
//
String name = operationReq.getName(); //对方的园丁名称
//当前玩家上一轮的请求信息
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
address
=
lastReq
.
getAddress
();
address
=
lastReq
.
getAddress
();
name
=
lastReq
.
getName
();
//
name = lastReq.getName();
}
}
String
person
=
(
name
==
null
)
?
address
:
name
;
//
String person = (name == null) ? address : name;
log
.
info
(
uid
+
"取消跨地区访问"
+
person
);
log
.
info
(
uid
+
"取消跨地区访问"
+
address
);
//清除缓存,本轮对话结束
//清除缓存,本轮对话结束
CacheGlobal
.
concurrentMap
.
remove
(
uid
);
CacheGlobal
.
concurrentMap
.
remove
(
uid
);
//园丁性别
//园丁性别
...
@@ -335,7 +337,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -335,7 +337,7 @@ public class SocialServiceImpl implements SocialService {
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"visit_stranger_cancel"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"visit_stranger_cancel"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
person
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"visit_stranger_cancel"
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"visit_stranger_cancel"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -854,14 +856,14 @@ public class SocialServiceImpl implements SocialService {
...
@@ -854,14 +856,14 @@ public class SocialServiceImpl implements SocialService {
ResultResponse
resultResponse
=
new
ResultResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
//本人uid
String
uid
=
operationReq
.
getUid
();
//本人uid
String
name
=
operationReq
.
getName
();
//园丁名称
//
String name = operationReq.getName(); //园丁名称
String
address
=
operationReq
.
getAddress
();
//玩家地址
String
address
=
operationReq
.
getAddress
();
//玩家地址
//园丁性别
//园丁性别
String
gender
=
TimingAcquisition
.
getGardenerGender
(
uid
);
String
gender
=
TimingAcquisition
.
getGardenerGender
(
uid
);
//玩家称呼
//玩家称呼
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
//玩家未提供园丁名称或玩家地址
//玩家未提供园丁名称或玩家地址
if
(
StringUtils
.
isEmpty
(
name
)
&&
StringUtils
.
isEmpty
(
address
))
{
if
(
StringUtils
.
isEmpty
(
address
))
{
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
gender
,
"add_friend_check_by_name_fail_no_name"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
gender
,
"add_friend_check_by_name_fail_no_name"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
...
@@ -873,14 +875,13 @@ public class SocialServiceImpl implements SocialService {
...
@@ -873,14 +875,13 @@ public class SocialServiceImpl implements SocialService {
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
String
feedText
=
(
name
==
null
)
?
address
:
name
;
//玩家收到的好友申请
//玩家收到的好友申请
Map
<
String
,
AddFriendAskDto
>
addFriendAskMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getAddFriendAskMap
();
Map
<
String
,
AddFriendAskDto
>
addFriendAskMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getAddFriendAskMap
();
//没有好友申请
//没有好友申请
if
(
StringUtils
.
isEmpty
(
addFriendAskMap
))
{
if
(
StringUtils
.
isEmpty
(
addFriendAskMap
))
{
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"add_friend_check_by_name_fail"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"add_friend_check_by_name_fail"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
feedText
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"add_friend_check_by_name_fail"
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"add_friend_check_by_name_fail"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -892,29 +893,29 @@ public class SocialServiceImpl implements SocialService {
...
@@ -892,29 +893,29 @@ public class SocialServiceImpl implements SocialService {
return
commonResponse
;
return
commonResponse
;
}
}
//玩家提供了园丁名称
//玩家提供了园丁名称
if
(!
StringUtils
.
isEmpty
(
name
))
{
//
if (!StringUtils.isEmpty(name)) {
List
<
String
>
nameList
=
addFriendAskMap
.
values
().
stream
().
map
(
AddFriendAskDto:
:
getName
).
collect
(
Collectors
.
toList
());
//
List<String> nameList = addFriendAskMap.values().stream().map(AddFriendAskDto::getName).collect(Collectors.toList());
//好友申请中存在该园丁名称
//
//好友申请中存在该园丁名称
if
(
nameList
.
contains
(
name
))
{
//
if (nameList.contains(name)) {
log
.
info
(
uid
+
"正在通过指定"
+
name
+
"查看好友申请"
);
//
log.info(uid + "正在通过指定" + name + "查看好友申请");
//保存玩家这轮的请求信息,用于下一步操作
//
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setOperationLabel
(
Constants
.
ADD_FRIEND_CHECK
);
//
operationReq.setOperationLabel(Constants.ADD_FRIEND_CHECK);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术
//
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"add_friend_check_by_name"
);
//
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "add_friend_check_by_name");
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
name
);
//
text = SpeechUtil.speechReplaceNum(text, name);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"add_friend_check_by_name"
);
//
text += SpeechUtil.getSocialSpeech(gender, "add_friend_check_by_name");
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
//
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse
.
setCode
(
1
);
//
commonResponse.setCode(1);
commonResponse
.
setMsg
(
"成功"
);
//
commonResponse.setMsg("成功");
resultResponse
.
set
反馈
ID
(
500905
);
//
resultResponse.set反馈ID(500905);
resultResponse
.
set
反馈文本
(
text
);
//
resultResponse.set反馈文本(text);
resultResponse
.
set
后台附加返回
(
"是否接受好友申请"
);
//
resultResponse.set后台附加返回("是否接受好友申请");
resultVarsResponse
.
setVars
(
resultResponse
);
//
resultVarsResponse.setVars(resultResponse);
commonResponse
.
setData
(
resultVarsResponse
);
//
commonResponse.setData(resultVarsResponse);
return
commonResponse
;
//
return commonResponse;
}
//
}
}
//
}
//玩家提供了玩家地址
//玩家提供了玩家地址
if
(!
StringUtils
.
isEmpty
(
address
))
{
if
(!
StringUtils
.
isEmpty
(
address
))
{
List
<
String
>
addressList
=
addFriendAskMap
.
values
().
stream
().
map
(
AddFriendAskDto:
:
getAddress
).
collect
(
Collectors
.
toList
());
List
<
String
>
addressList
=
addFriendAskMap
.
values
().
stream
().
map
(
AddFriendAskDto:
:
getAddress
).
collect
(
Collectors
.
toList
());
...
@@ -941,7 +942,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -941,7 +942,7 @@ public class SocialServiceImpl implements SocialService {
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"add_friend_check_by_name_fail"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"add_friend_check_by_name_fail"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
feedText
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"add_friend_check_by_name_fail"
);
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"add_friend_check_by_name_fail"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -2187,6 +2188,9 @@ public class SocialServiceImpl implements SocialService {
...
@@ -2187,6 +2188,9 @@ public class SocialServiceImpl implements SocialService {
Integer
nurseryNum
=
lastReq
.
getNurseryNum
();
Integer
nurseryNum
=
lastReq
.
getNurseryNum
();
Integer
earnRate
=
lastReq
.
getEarnRate
();
Integer
earnRate
=
lastReq
.
getEarnRate
();
log
.
info
(
uid
+
"玩家开始设置收益比例,花圃编号"
+
nurseryNum
+
",收益比例"
+
earnRate
);
log
.
info
(
uid
+
"玩家开始设置收益比例,花圃编号"
+
nurseryNum
+
",收益比例"
+
earnRate
);
int
rate
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
).
getEarnRate
();
//设置对应花圃上一次的收益比例
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
).
setLastEarnRate
(
rate
);
//设置对应花圃的收益比例
//设置对应花圃的收益比例
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
).
setEarnRate
(
earnRate
);
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
).
setEarnRate
(
earnRate
);
//园丁性别
//园丁性别
...
@@ -4421,6 +4425,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -4421,6 +4425,7 @@ public class SocialServiceImpl implements SocialService {
log
.
info
(
uid
+
"提供简报序号大于已有简报数量"
);
log
.
info
(
uid
+
"提供简报序号大于已有简报数量"
);
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"steal_report_check_fail_over"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"steal_report_check_fail_over"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
String
.
valueOf
(
stealReportNames
.
size
()));
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
501407
);
resultResponse
.
set
反馈
ID
(
501407
);
...
@@ -5873,19 +5878,22 @@ public class SocialServiceImpl implements SocialService {
...
@@ -5873,19 +5878,22 @@ public class SocialServiceImpl implements SocialService {
ResultResponse
resultResponse
=
new
ResultResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
//本人uid
String
uid
=
operationReq
.
getUid
();
//本人uid
String
message
=
operationReq
.
getMessage
();
//留言内容
//
String message = operationReq.getMessage(); //留言内容
String
address
=
operationReq
.
getAddress
();
//对方的玩家地址
String
address
=
operationReq
.
getAddress
();
//对方的玩家地址
//当前玩家上一轮的请求信息
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
.
getAddress
()))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
.
getMessageAddress
()))
{
address
=
(
address
==
null
)
?
lastReq
.
getMessageAddress
()
:
address
;
//对方的玩家地址
// message = (message == null) ? lastReq.getMessage() : message; //留言内容
}
else
{
address
=
(
address
==
null
)
?
lastReq
.
getAddress
()
:
address
;
//对方的玩家地址
address
=
(
address
==
null
)
?
lastReq
.
getAddress
()
:
address
;
//对方的玩家地址
message
=
(
message
==
null
)
?
lastReq
.
getMessage
()
:
message
;
//留言内容
}
}
}
}
//保存玩家这轮的请求信息,用于下一步操作
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setAddress
(
address
);
operationReq
.
setMessageAddress
(
address
);
operationReq
.
setMessage
(
message
);
operationReq
.
setAddress
(
null
);
// operationReq.setMessage(message);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//园丁性别
//园丁性别
...
@@ -5921,7 +5929,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -5921,7 +5929,7 @@ public class SocialServiceImpl implements SocialService {
}
}
//未提供好友地址
//未提供好友地址
if
(
StringUtils
.
isEmpty
(
address
))
{
if
(
StringUtils
.
isEmpty
(
address
))
{
log
.
info
(
uid
+
"未提供
好友
地址"
);
log
.
info
(
uid
+
"未提供
玩家
地址"
);
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
gender
,
"leave_message_fail_no_address"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
gender
,
"leave_message_fail_no_address"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
...
@@ -5982,93 +5990,93 @@ public class SocialServiceImpl implements SocialService {
...
@@ -5982,93 +5990,93 @@ public class SocialServiceImpl implements SocialService {
return
commonResponse
;
return
commonResponse
;
}
}
//通过玩家地址查看好友列表
//通过玩家地址查看好友列表
FriendDto
friend
=
null
;
//
FriendDto friend = null;
String
finalAddress
=
address
;
//
String finalAddress = address;
if
(!
StringUtils
.
isEmpty
(
gardener
.
getFriendList
()))
{
//
if (!StringUtils.isEmpty(gardener.getFriendList())) {
friend
=
gardener
.
getFriendList
().
stream
().
filter
(
friendDto
->
finalAddress
.
equals
(
friendDto
.
getAddress
())).
findAny
().
orElse
(
null
);
//
friend = gardener.getFriendList().stream().filter(friendDto -> finalAddress.equals(friendDto.getAddress())).findAny().orElse(null);
}
//
}
//对方还不是好友
//
//对方还不是好友
if
(
StringUtils
.
isEmpty
(
friend
))
{
//
if (StringUtils.isEmpty(friend)) {
log
.
info
(
uid
+
"提供的玩家地址:"
+
address
+
"不是玩家好友"
);
//
log.info(uid + "提供的玩家地址:" + address + "不是玩家好友");
//保存玩家这轮的请求信息,用于下一步操作
//
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setAddress
(
null
);
//
operationReq.setAddress(null);
operationReq
.
setMessage
(
message
);
//
operationReq.setMessage(message);
operationReq
.
setOperationLabel
(
Constants
.
LEAVE_MESSAGE
);
//
operationReq.setOperationLabel(Constants.LEAVE_MESSAGE);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//
CacheUtil.put(uid, operationReq, Long.parseLong(expireTime));
//获取对应话术
//
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"leave_message_fail_not_friend"
);
//
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_fail_not_friend");
text
+=
SpeechUtil
.
getSocialSpeech
(
gender
,
"leave_message_fail_not_friend"
);
//
text += SpeechUtil.getSocialSpeech(gender, "leave_message_fail_not_friend");
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
//
text = SpeechUtil.speechReplaceNum(text, callName.getName(), callName.getSubName());
commonResponse
.
setCode
(
1
);
//
commonResponse.setCode(1);
commonResponse
.
setMsg
(
"成功"
);
//
commonResponse.setMsg("成功");
resultResponse
.
set
反馈
ID
(
501104
);
//
resultResponse.set反馈ID(501104);
resultResponse
.
set
反馈文本
(
text
);
//
resultResponse.set反馈文本(text);
resultResponse
.
set
后台附加返回
(
"是否添加好友"
);
//
resultResponse.set后台附加返回("是否添加好友");
resultVarsResponse
.
setVars
(
resultResponse
);
//
resultVarsResponse.setVars(resultResponse);
commonResponse
.
setData
(
resultVarsResponse
);
//
commonResponse.setData(resultVarsResponse);
return
commonResponse
;
//
return commonResponse;
}
//
}
//留言内容为空,提示玩家输入留言内容
//
//留言内容为空,提示玩家输入留言内容
if
(
StringUtils
.
isEmpty
(
message
))
{
//
if (StringUtils.isEmpty(message)) {
//获取对应话术
//
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"leave_message_check_context"
);
//
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_check_context");
commonResponse
.
setCode
(
1
);
//
commonResponse.setCode(1);
commonResponse
.
setMsg
(
"成功"
);
//
commonResponse.setMsg("成功");
resultResponse
.
set
反馈
ID
(
501101
);
//
resultResponse.set反馈ID(501101);
resultResponse
.
set
反馈文本
(
text
);
//
resultResponse.set反馈文本(text);
resultResponse
.
set
后台附加返回
(
"请说明留言内容"
);
//
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse
.
setVars
(
resultResponse
);
//
resultVarsResponse.setVars(resultResponse);
commonResponse
.
setData
(
resultVarsResponse
);
//
commonResponse.setData(resultVarsResponse);
return
commonResponse
;
//
return commonResponse;
}
//
}
//当前留言只允许留qq、微信和电话
//
//当前留言只允许留qq、微信和电话
int
result
=
TypeConvertUtil
.
checkContext
(
message
);
//
int result = TypeConvertUtil.checkContext(message);
//留言内容格式不对
//
//留言内容格式不对
if
(
result
==
4
)
{
//
if (result == 4) {
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"leave_message_check_context"
);
//
String text = SpeechUtil.getSocialSpeech(Constants.SPEECH_ASIDE, "leave_message_check_context");
commonResponse
.
setCode
(
1
);
//
commonResponse.setCode(1);
commonResponse
.
setMsg
(
"成功"
);
//
commonResponse.setMsg("成功");
resultResponse
.
set
反馈
ID
(
501112
);
//
resultResponse.set反馈ID(501112);
resultResponse
.
set
反馈文本
(
text
);
//
resultResponse.set反馈文本(text);
resultResponse
.
set
后台附加返回
(
"请说明留言内容"
);
//
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse
.
setVars
(
resultResponse
);
//
resultVarsResponse.setVars(resultResponse);
commonResponse
.
setData
(
resultVarsResponse
);
//
commonResponse.setData(resultVarsResponse);
return
commonResponse
;
//
return commonResponse;
}
//
}
//微信格式不对
//
//微信格式不对
if
(
result
==
1
)
{
//
if (result == 1) {
commonResponse
.
setCode
(
1
);
//
commonResponse.setCode(1);
commonResponse
.
setMsg
(
"成功"
);
//
commonResponse.setMsg("成功");
resultResponse
.
set
反馈
ID
(
501113
);
//
resultResponse.set反馈ID(501113);
resultResponse
.
set
反馈文本
(
"【旁白@正常】微信号格式不对哦。"
);
//
resultResponse.set反馈文本("【旁白@正常】微信号格式不对哦。");
resultResponse
.
set
后台附加返回
(
"请说明留言内容"
);
//
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse
.
setVars
(
resultResponse
);
//
resultVarsResponse.setVars(resultResponse);
commonResponse
.
setData
(
resultVarsResponse
);
//
commonResponse.setData(resultVarsResponse);
return
commonResponse
;
//
return commonResponse;
}
//
}
//qq格式不对
//
//qq格式不对
if
(
result
==
2
)
{
//
if (result == 2) {
commonResponse
.
setCode
(
1
);
//
commonResponse.setCode(1);
commonResponse
.
setMsg
(
"成功"
);
//
commonResponse.setMsg("成功");
resultResponse
.
set
反馈
ID
(
501114
);
//
resultResponse.set反馈ID(501114);
resultResponse
.
set
反馈文本
(
"【旁白@正常】QQ号格式不对哦。"
);
//
resultResponse.set反馈文本("【旁白@正常】QQ号格式不对哦。");
resultResponse
.
set
后台附加返回
(
"请说明留言内容"
);
//
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse
.
setVars
(
resultResponse
);
//
resultVarsResponse.setVars(resultResponse);
commonResponse
.
setData
(
resultVarsResponse
);
//
commonResponse.setData(resultVarsResponse);
return
commonResponse
;
//
return commonResponse;
}
//
}
//手机号码格式不对
//
//手机号码格式不对
if
(
result
==
3
)
{
//
if (result == 3) {
commonResponse
.
setCode
(
1
);
//
commonResponse.setCode(1);
commonResponse
.
setMsg
(
"成功"
);
//
commonResponse.setMsg("成功");
resultResponse
.
set
反馈
ID
(
501115
);
//
resultResponse.set反馈ID(501115);
resultResponse
.
set
反馈文本
(
"【旁白@正常】手机号码格式不对哦。"
);
//
resultResponse.set反馈文本("【旁白@正常】手机号码格式不对哦。");
resultResponse
.
set
后台附加返回
(
"请说明留言内容"
);
//
resultResponse.set后台附加返回("请说明留言内容");
resultVarsResponse
.
setVars
(
resultResponse
);
//
resultVarsResponse.setVars(resultResponse);
commonResponse
.
setData
(
resultVarsResponse
);
//
commonResponse.setData(resultVarsResponse);
return
commonResponse
;
//
return commonResponse;
}
//
}
message
=
TypeConvertUtil
.
contextChange
(
message
);
//
message = TypeConvertUtil.contextChange(message);
//留言内容包含敏感词汇,判定失败
//留言内容包含敏感词汇,判定失败
// List<String> sensitiveWordList = PersistenceUtil.getContentFromFile("sensitiveWords.xls");
// List<String> sensitiveWordList = PersistenceUtil.getContentFromFile("sensitiveWords.xls");
// for (String sensitive : sensitiveWordList) {
// for (String sensitive : sensitiveWordList) {
...
@@ -6092,19 +6100,143 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6092,19 +6100,143 @@ public class SocialServiceImpl implements SocialService {
// }
// }
// }
// }
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"leave_message_
double_
check"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"leave_message_check"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
message
);
//
text = SpeechUtil.speechReplaceNum(text, message);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
501106
);
resultResponse
.
set
反馈
ID
(
501106
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"
是否确定该留言
"
);
resultResponse
.
set
后台附加返回
(
"
请说明留言内容
"
);
resultVarsResponse
.
setVars
(
resultResponse
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
@Override
@Override
public
CommonResponse
leaveMessageCover
(
OperationRequest
operationReq
)
throws
ParseException
{
CommonResponse
commonResponse
=
new
CommonResponse
();
String
uid
=
operationReq
.
getUid
();
//本人uid
int
intention
=
operationReq
.
getIntention
();
//留言意图
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(
Constants
.
LEAVE_MESSAGE
.
equals
(
lastReq
.
getOperationLabel
())
||
Constants
.
READ_MESSAGE
.
equals
(
lastReq
.
getOperationLabel
()))
{
operationReq
.
setMessageAddress
(
lastReq
.
getMessageAddress
());
//待留言的玩家地址
String
address
=
(
operationReq
.
getAddress
()
==
null
)
?
lastReq
.
getAddress
()
:
operationReq
.
getAddress
();
operationReq
.
setAddress
(
address
);
operationReq
.
setMessageType
(
lastReq
.
getMessageType
());
intention
=
(
intention
==
0
)
?
lastReq
.
getIntention
()
:
intention
;
operationReq
.
setIntention
(
intention
);
String
messageChange
=
(
operationReq
.
getMessageChange
()
==
null
)
?
lastReq
.
getMessageChange
()
:
operationReq
.
getMessageChange
();
operationReq
.
setMessageChange
(
messageChange
);
Integer
nurseryNum
=
(
operationReq
.
getNurseryNum
()
==
null
)
?
lastReq
.
getNurseryNum
()
:
operationReq
.
getNurseryNum
();
operationReq
.
setNurseryNum
(
nurseryNum
);
Integer
earnRate
=
(
operationReq
.
getEarnRate
()
==
null
)
?
lastReq
.
getEarnRate
()
:
operationReq
.
getEarnRate
();
operationReq
.
setEarnRate
(
earnRate
);
}
}
switch
(
intention
)
{
case
12001
:
case
12027
:
commonResponse
=
messageServiceImpl
.
SayHello
(
operationReq
);
break
;
case
12002
:
commonResponse
=
messageServiceImpl
.
askPlant
(
operationReq
);
break
;
case
12003
:
commonResponse
=
messageServiceImpl
.
askHelp
(
operationReq
);
break
;
case
12004
:
commonResponse
=
messageServiceImpl
.
askToFight
(
operationReq
);
break
;
case
12005
:
commonResponse
=
messageServiceImpl
.
sayHelloAnswer
(
operationReq
);
break
;
case
1200601
:
case
1200602
:
commonResponse
=
messageServiceImpl
.
askPlantAnswer
(
operationReq
);
break
;
case
1200701
:
case
1200702
:
commonResponse
=
messageServiceImpl
.
askHelpAnswer
(
operationReq
);
break
;
case
1200801
:
case
1200802
:
commonResponse
=
messageServiceImpl
.
askToFightAnswer
(
operationReq
);
break
;
case
12009
:
commonResponse
=
messageServiceImpl
.
thanksPlant
(
operationReq
);
break
;
case
12010
:
commonResponse
=
messageServiceImpl
.
thanksHelp
(
operationReq
);
break
;
case
12011
:
commonResponse
=
messageServiceImpl
.
thanksToFight
(
operationReq
);
break
;
case
12012
:
commonResponse
=
messageServiceImpl
.
thanksAnswer
(
operationReq
);
break
;
case
12013
:
commonResponse
=
messageServiceImpl
.
askToPutPet
(
operationReq
);
break
;
case
1201401
:
case
1201402
:
commonResponse
=
messageServiceImpl
.
askToPutPetAnswer
(
operationReq
);
break
;
case
12015
:
commonResponse
=
messageServiceImpl
.
thanksToPutPet
(
operationReq
);
break
;
case
12016
:
commonResponse
=
messageServiceImpl
.
plantNotice
(
operationReq
);
break
;
case
12017
:
commonResponse
=
messageServiceImpl
.
putPetNotice
(
operationReq
);
break
;
case
12018
:
commonResponse
=
messageServiceImpl
.
helpNotice
(
operationReq
);
break
;
case
12019
:
commonResponse
=
messageServiceImpl
.
fightNotice
(
operationReq
);
break
;
case
12020
:
commonResponse
=
messageServiceImpl
.
askToChange
(
operationReq
);
break
;
case
1202101
:
case
1202102
:
commonResponse
=
messageServiceImpl
.
askToChangeAnswer
(
operationReq
);
break
;
case
12022
:
commonResponse
=
messageServiceImpl
.
changeNotice
(
operationReq
);
break
;
case
12023
:
commonResponse
=
messageServiceImpl
.
thanksToChange
(
operationReq
);
break
;
case
12024
:
commonResponse
=
messageServiceImpl
.
askTruce
(
operationReq
);
break
;
case
1202501
:
case
1202502
:
commonResponse
=
messageServiceImpl
.
askTruceAnswer
(
operationReq
);
break
;
case
12026
:
commonResponse
=
messageServiceImpl
.
thanksTruce
(
operationReq
);
break
;
case
12028
:
commonResponse
=
messageServiceImpl
.
inviteToFight
(
operationReq
);
break
;
case
1202901
:
case
1202902
:
commonResponse
=
messageServiceImpl
.
inviteToFightAnswer
(
operationReq
);
break
;
case
12030
:
commonResponse
=
messageServiceImpl
.
thanks
(
operationReq
);
break
;
}
return
commonResponse
;
}
@Override
public
CommonResponse
leaveMessage
(
OperationRequest
operationReq
)
{
public
CommonResponse
leaveMessage
(
OperationRequest
operationReq
)
{
CommonResponse
commonResponse
=
new
CommonResponse
();
CommonResponse
commonResponse
=
new
CommonResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
ResultVarsResponse
resultVarsResponse
=
new
ResultVarsResponse
();
...
@@ -6113,17 +6245,19 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6113,17 +6245,19 @@ public class SocialServiceImpl implements SocialService {
String
uid
=
operationReq
.
getUid
();
//本人uid
String
uid
=
operationReq
.
getUid
();
//本人uid
//玩家称呼
//玩家称呼
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
String
a
ddress
=
null
;
String
messageA
ddress
=
null
;
String
message
=
null
;
String
message
=
null
;
Integer
messageType
=
null
;
//当前玩家上一轮的请求信息
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(
Constants
.
LEAVE_MESSAGE
.
equals
(
lastReq
.
getOperationLabel
()))
{
if
(
Constants
.
LEAVE_MESSAGE
.
equals
(
lastReq
.
getOperationLabel
()))
{
address
=
lastReq
.
get
Address
();
//好友的玩家地址
messageAddress
=
lastReq
.
getMessage
Address
();
//好友的玩家地址
message
=
lastReq
.
getMessage
();
//好友留言
message
=
lastReq
.
getMessage
();
//好友留言
messageType
=
lastReq
.
getMessageType
();
//留言类型
}
}
}
}
if
(
StringUtils
.
isEmpty
(
a
ddress
)
||
StringUtils
.
isEmpty
(
message
))
{
if
(
StringUtils
.
isEmpty
(
messageA
ddress
)
||
StringUtils
.
isEmpty
(
message
))
{
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"leave_message_fail_no_pre"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"leave_message_fail_no_pre"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -6134,9 +6268,15 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6134,9 +6268,15 @@ public class SocialServiceImpl implements SocialService {
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
if
(!
StringUtils
.
isEmpty
(
messageType
))
{
if
(
messageType
==
1200101
||
messageType
==
1200102
)
{
//记录当天已经给这个人发过问候留言
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getHelloSignMap
().
put
(
messageAddress
,
1
);
}
}
//好友uid
//好友uid
String
place
=
TypeConvertUtil
.
extractChinese
(
a
ddress
);
String
place
=
TypeConvertUtil
.
extractChinese
(
messageA
ddress
);
String
friendUid
=
TimingAcquisition
.
addressMap
.
get
(
place
).
get
(
a
ddress
).
getUid
();
//对方uid
String
friendUid
=
TimingAcquisition
.
addressMap
.
get
(
place
).
get
(
messageA
ddress
).
getUid
();
//对方uid
//----------------先删除玩家过期留言,并检查对方留言数量是否超过上限,超过则删除最早的------------------
//----------------先删除玩家过期留言,并检查对方留言数量是否超过上限,超过则删除最早的------------------
PersistenceUtil
.
checkMessageFromFile
(
friendUid
);
PersistenceUtil
.
checkMessageFromFile
(
friendUid
);
//留言保存到对方的好友留言中
//留言保存到对方的好友留言中
...
@@ -6146,6 +6286,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6146,6 +6286,7 @@ public class SocialServiceImpl implements SocialService {
MessageTimeDto
messageTime
=
new
MessageTimeDto
();
MessageTimeDto
messageTime
=
new
MessageTimeDto
();
messageTime
.
setTime
(
nowTime
);
messageTime
.
setTime
(
nowTime
);
messageTime
.
setContent
(
message
);
messageTime
.
setContent
(
message
);
messageTime
.
setType
(
messageType
);
messageTime
.
setRead
(
Constants
.
READ_NO
);
messageTime
.
setRead
(
Constants
.
READ_NO
);
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
PersistenceUtil
.
saveMessageToFile
(
friendUid
,
uid
,
nowTime
,
messageTimeStr
);
PersistenceUtil
.
saveMessageToFile
(
friendUid
,
uid
,
nowTime
,
messageTimeStr
);
...
@@ -6214,24 +6355,32 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6214,24 +6355,32 @@ public class SocialServiceImpl implements SocialService {
ResultResponse
resultResponse
=
new
ResultResponse
();
ResultResponse
resultResponse
=
new
ResultResponse
();
String
uid
=
operationReq
.
getUid
();
String
uid
=
operationReq
.
getUid
();
//--------获取有留言的
好友
---------------
//--------获取有留言的
玩家
---------------
List
<
String
>
friendUidList
=
PersistenceUtil
.
getFriendFromFile
(
uid
);
List
<
String
>
friendUidList
=
PersistenceUtil
.
getFriendFromFile
(
uid
);
List
<
String
>
addressList
=
new
ArrayList
<>();
// List<String> addressList = new ArrayList<>();
//玩家信息
Map
<
String
,
MessageTimeDto
>
messageMap
=
new
HashMap
<>();
GardenerDto
gardener
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
);
// //玩家信息
//玩家所有好友
// GardenerDto gardener = TimingAcquisition.gardenerMap.get(uid);
List
<
FriendDto
>
friends
=
gardener
.
getFriendList
();
// //玩家所有好友
if
(!
StringUtils
.
isEmpty
(
friends
))
{
// List<FriendDto> friends = gardener.getFriendList();
//找到所有好友的玩家地址
// if (!StringUtils.isEmpty(friends)) {
for
(
String
friendUid
:
friendUidList
)
{
// //找到所有好友的玩家地址
FriendDto
friend
=
friends
.
stream
().
filter
(
friendDto
->
friendUid
.
equals
(
friendDto
.
getUid
())).
findAny
().
orElse
(
null
);
// for (String friendUid : friendUidList) {
if
(!
StringUtils
.
isEmpty
(
friend
))
{
// FriendDto friend = friends.stream().filter(friendDto -> friendUid.equals(friendDto.getUid())).findAny().orElse(null);
addressList
.
add
(
friend
.
getAddress
());
// if (!StringUtils.isEmpty(friend)) {
}
// addressList.add(friend.getAddress());
}
// }
// }
// }
StringBuilder
addText
=
new
StringBuilder
();
for
(
String
playerUid
:
friendUidList
)
{
messageMap
=
PersistenceUtil
.
getMessageFromFile
(
uid
,
playerUid
);
String
address
=
TimingAcquisition
.
gardenerMap
.
get
(
playerUid
).
getLocation
();
addText
.
append
(
address
).
append
(
"有"
).
append
(
messageMap
.
size
()).
append
(
"条、"
);
// addressList.add(address);
}
}
//没有好友留言
//没有好友留言
if
(
add
ressList
.
size
()
==
0
)
{
if
(
add
Text
.
length
()
==
0
)
{
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"check_message_fail"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"check_message_fail"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
@@ -6242,13 +6391,14 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6242,13 +6391,14 @@ public class SocialServiceImpl implements SocialService {
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
addText
.
deleteCharAt
(
addText
.
length
()
-
1
);
//保存玩家这轮的请求信息,用于下一步操作
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setStrList
(
friendUidList
);
operationReq
.
setStrList
(
friendUidList
);
operationReq
.
setOperationLabel
(
Constants
.
READ_MESSAGE
);
operationReq
.
setOperationLabel
(
Constants
.
READ_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"check_message"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"check_message"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
String
.
join
(
"、"
,
addressList
));
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
addText
.
toString
(
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
501201
);
resultResponse
.
set
反馈
ID
(
501201
);
...
@@ -6273,6 +6423,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6273,6 +6423,7 @@ public class SocialServiceImpl implements SocialService {
List
<
String
>
friendUidList
=
new
ArrayList
<>();
List
<
String
>
friendUidList
=
new
ArrayList
<>();
Map
<
String
,
MessageTimeDto
>
messageMap
=
new
HashMap
<>();
Map
<
String
,
MessageTimeDto
>
messageMap
=
new
HashMap
<>();
String
messageContent
=
""
;
String
messageContent
=
""
;
Integer
messageType
=
null
;
//没有提供留言序号和玩家地址
//没有提供留言序号和玩家地址
if
(
StringUtils
.
isEmpty
(
messageNum
)
&&
StringUtils
.
isEmpty
(
address
))
{
if
(
StringUtils
.
isEmpty
(
messageNum
)
&&
StringUtils
.
isEmpty
(
address
))
{
log
.
info
(
uid
+
"没有提供留言序号和玩家地址"
);
log
.
info
(
uid
+
"没有提供留言序号和玩家地址"
);
...
@@ -6385,6 +6536,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6385,6 +6536,7 @@ public class SocialServiceImpl implements SocialService {
for
(
Map
.
Entry
<
String
,
MessageTimeDto
>
entry
:
messageMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
MessageTimeDto
>
entry
:
messageMap
.
entrySet
())
{
MessageTimeDto
messageTime
=
entry
.
getValue
();
MessageTimeDto
messageTime
=
entry
.
getValue
();
messageContent
=
messageTime
.
getContent
();
messageContent
=
messageTime
.
getContent
();
messageType
=
messageTime
.
getType
();
messageTime
.
setRead
(
Constants
.
READ_YES
);
messageTime
.
setRead
(
Constants
.
READ_YES
);
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
PersistenceUtil
.
saveMessageToFile
(
uid
,
friendUid
,
messageTime
.
getTime
(),
messageTimeStr
);
PersistenceUtil
.
saveMessageToFile
(
uid
,
friendUid
,
messageTime
.
getTime
(),
messageTimeStr
);
...
@@ -6392,16 +6544,52 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6392,16 +6544,52 @@ public class SocialServiceImpl implements SocialService {
}
}
//保存玩家这轮的请求信息,用于下一步操作
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setStrList
(
friendUidList
);
operationReq
.
setStrList
(
friendUidList
);
operationReq
.
setAddress
(
address
);
operationReq
.
setMessageAddress
(
address
);
operationReq
.
setAddress
(
null
);
operationReq
.
setMessageContent
(
messageContent
);
operationReq
.
setMessageContent
(
messageContent
);
operationReq
.
setMessageType
(
messageType
);
operationReq
.
setOperationLabel
(
Constants
.
READ_MESSAGE
);
operationReq
.
setOperationLabel
(
Constants
.
READ_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//根据留言类型返回对应的后台附加返回2
if
(!
StringUtils
.
isEmpty
(
messageType
))
{
if
(
messageType
==
1200101
||
messageType
==
1200102
)
{
resultResponse
.
set
后台附加返回
2
(
"查看问候留言"
);
}
if
(
messageType
==
12002
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求种植留言"
);
}
if
(
messageType
==
12003
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求帮助留言"
);
}
if
(
messageType
==
12004
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求复仇留言"
);
}
if
(
messageType
==
12012
)
{
resultResponse
.
set
后台附加返回
2
(
"查看任意感谢留言"
);
}
if
(
messageType
==
12013
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求宠物放置留言"
);
}
if
(
messageType
==
1202001
||
(
messageType
==
1202002
))
{
resultResponse
.
set
后台附加返回
2
(
"查看请求提升帮助收益留言"
);
}
if
(
messageType
==
12024
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求休战留言"
);
}
if
(
messageType
==
12028
)
{
resultResponse
.
set
后台附加返回
2
(
"查看邀请攻打留言"
);
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_pre"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_pre"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_content"
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_content"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageContent
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageContent
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end"
);
if
(
StringUtils
.
isEmpty
(
resultResponse
.
get
后台附加返回
2
()))
{
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end"
);
}
else
{
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end_answer"
);
}
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
501203
);
resultResponse
.
set
反馈
ID
(
501203
);
...
@@ -6421,18 +6609,66 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6421,18 +6609,66 @@ public class SocialServiceImpl implements SocialService {
String
uid
=
operationReq
.
getUid
();
String
uid
=
operationReq
.
getUid
();
String
messageContent
=
""
;
//上一轮查看的留言内容
String
messageContent
=
""
;
//上一轮查看的留言内容
String
address
=
""
;
//好友的玩家地址
String
address
=
""
;
//好友的玩家地址
Integer
messageNum
=
null
;
//留言序号
Integer
messageType
=
null
;
//留言类型
List
<
String
>
friendUidList
=
new
ArrayList
<>();
//当前玩家上一轮的请求信息
//当前玩家上一轮的请求信息
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
OperationRequest
lastReq
=
(
OperationRequest
)
CacheUtil
.
get
(
uid
);
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
messageNum
=
lastReq
.
getMessageNum
();
friendUidList
=
lastReq
.
getStrList
();
messageContent
=
lastReq
.
getMessageContent
();
messageContent
=
lastReq
.
getMessageContent
();
address
=
lastReq
.
getAddress
();
messageType
=
lastReq
.
getMessageType
();
address
=
lastReq
.
getMessageAddress
();
}
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setStrList
(
friendUidList
);
operationReq
.
setMessageAddress
(
address
);
operationReq
.
setMessageContent
(
messageContent
);
operationReq
.
setMessageNum
(
messageNum
);
operationReq
.
setMessageType
(
messageType
);
operationReq
.
setOperationLabel
(
Constants
.
READ_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//根据留言类型返回对应的后台附加返回2
if
(!
StringUtils
.
isEmpty
(
messageType
))
{
if
(
messageType
==
1200101
||
messageType
==
1200102
)
{
resultResponse
.
set
后台附加返回
2
(
"查看问候留言"
);
}
if
(
messageType
==
12002
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求种植留言"
);
}
if
(
messageType
==
12003
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求帮助留言"
);
}
if
(
messageType
==
12004
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求复仇留言"
);
}
if
(
messageType
==
12012
)
{
resultResponse
.
set
后台附加返回
2
(
"查看任意感谢留言"
);
}
if
(
messageType
==
12013
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求宠物放置留言"
);
}
if
(
messageType
==
1202001
||
(
messageType
==
1202002
))
{
resultResponse
.
set
后台附加返回
2
(
"查看请求提升帮助收益留言"
);
}
if
(
messageType
==
12024
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求休战留言"
);
}
if
(
messageType
==
12028
)
{
resultResponse
.
set
后台附加返回
2
(
"查看邀请攻打留言"
);
}
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_pre"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_pre"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_content"
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_content"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageContent
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageContent
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end"
);
if
(
StringUtils
.
isEmpty
(
resultResponse
.
get
后台附加返回
2
()))
{
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end"
);
}
else
{
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end_answer"
);
}
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
501205
);
resultResponse
.
set
反馈
ID
(
501205
);
...
@@ -6453,6 +6689,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6453,6 +6689,7 @@ public class SocialServiceImpl implements SocialService {
String
address
=
operationReq
.
getAddress
();
//好友的玩家地址
String
address
=
operationReq
.
getAddress
();
//好友的玩家地址
String
messageContent
=
""
;
String
messageContent
=
""
;
Integer
messageNum
=
null
;
//留言序号
Integer
messageNum
=
null
;
//留言序号
Integer
messageType
=
null
;
//留言类型
List
<
String
>
friendUidList
=
new
ArrayList
<>();
List
<
String
>
friendUidList
=
new
ArrayList
<>();
Map
<
String
,
MessageTimeDto
>
messageMap
=
new
HashMap
<>();
Map
<
String
,
MessageTimeDto
>
messageMap
=
new
HashMap
<>();
//当前玩家上一轮的请求信息
//当前玩家上一轮的请求信息
...
@@ -6460,7 +6697,8 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6460,7 +6697,8 @@ public class SocialServiceImpl implements SocialService {
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
if
(!
StringUtils
.
isEmpty
(
lastReq
))
{
messageNum
=
lastReq
.
getMessageNum
();
messageNum
=
lastReq
.
getMessageNum
();
friendUidList
=
lastReq
.
getStrList
();
friendUidList
=
lastReq
.
getStrList
();
address
=
(
address
==
null
)
?
lastReq
.
getAddress
()
:
address
;
address
=
(
address
==
null
)
?
lastReq
.
getMessageAddress
()
:
address
;
messageType
=
lastReq
.
getMessageType
();
}
}
//没有进行上一轮【检查留言】操作
//没有进行上一轮【检查留言】操作
if
(
StringUtils
.
isEmpty
(
messageNum
))
{
if
(
StringUtils
.
isEmpty
(
messageNum
))
{
...
@@ -6477,6 +6715,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6477,6 +6715,7 @@ public class SocialServiceImpl implements SocialService {
}
}
String
friendUid
=
""
;
String
friendUid
=
""
;
int
count
=
0
;
int
count
=
0
;
boolean
flag
=
false
;
//查看任务循环标记
//玩家通过好友的玩家地址查看剩余留言
//玩家通过好友的玩家地址查看剩余留言
if
(!
StringUtils
.
isEmpty
(
address
))
{
if
(!
StringUtils
.
isEmpty
(
address
))
{
//好友uid
//好友uid
...
@@ -6493,6 +6732,15 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6493,6 +6732,15 @@ public class SocialServiceImpl implements SocialService {
}
}
//当前好友没有未读留言,读取下一个好友的留言
//当前好友没有未读留言,读取下一个好友的留言
if
(
messageMap
.
size
()
==
count
)
{
if
(
messageMap
.
size
()
==
count
)
{
//下一个好友uid
messageNum
++;
messageNum
=
(
messageNum
>
friendUidList
.
size
())
?
1
:
messageNum
;
friendUid
=
friendUidList
.
get
(
messageNum
-
1
);
messageMap
=
PersistenceUtil
.
getMessageFromFile
(
uid
,
friendUid
);
address
=
TimingAcquisition
.
gardenerMap
.
get
(
friendUid
).
getLocation
();
//下一个好友的玩家地址
flag
=
true
;
}
if
(
flag
)
{
//当前好友的所有已读消息改为未读
//当前好友的所有已读消息改为未读
for
(
Map
.
Entry
<
String
,
MessageTimeDto
>
entry
:
messageMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
MessageTimeDto
>
entry
:
messageMap
.
entrySet
())
{
MessageTimeDto
messageTime
=
entry
.
getValue
();
MessageTimeDto
messageTime
=
entry
.
getValue
();
...
@@ -6500,12 +6748,6 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6500,12 +6748,6 @@ public class SocialServiceImpl implements SocialService {
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
PersistenceUtil
.
saveMessageToFile
(
uid
,
friendUid
,
messageTime
.
getTime
(),
messageTimeStr
);
PersistenceUtil
.
saveMessageToFile
(
uid
,
friendUid
,
messageTime
.
getTime
(),
messageTimeStr
);
}
}
//下一个好友uid
if
(
messageNum
<=
friendUidList
.
size
())
{
friendUid
=
friendUidList
.
get
(
messageNum
-
1
);
messageMap
=
PersistenceUtil
.
getMessageFromFile
(
uid
,
friendUid
);
address
=
TimingAcquisition
.
gardenerMap
.
get
(
friendUid
).
getLocation
();
//下一个好友的玩家地址
}
}
}
log
.
info
(
uid
+
"开始查看好友:"
+
address
+
"的留言"
);
log
.
info
(
uid
+
"开始查看好友:"
+
address
+
"的留言"
);
//该好友有多条留言
//该好友有多条留言
...
@@ -6513,6 +6755,7 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6513,6 +6755,7 @@ public class SocialServiceImpl implements SocialService {
MessageTimeDto
messageTime
=
entry
.
getValue
();
MessageTimeDto
messageTime
=
entry
.
getValue
();
if
(
Constants
.
READ_NO
.
equals
(
messageTime
.
getRead
()))
{
if
(
Constants
.
READ_NO
.
equals
(
messageTime
.
getRead
()))
{
messageContent
=
messageTime
.
getContent
();
messageContent
=
messageTime
.
getContent
();
messageType
=
messageTime
.
getType
();
messageTime
.
setRead
(
Constants
.
READ_YES
);
messageTime
.
setRead
(
Constants
.
READ_YES
);
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
String
messageTimeStr
=
JSON
.
toJSONString
(
messageTime
);
PersistenceUtil
.
saveMessageToFile
(
uid
,
friendUid
,
messageTime
.
getTime
(),
messageTimeStr
);
PersistenceUtil
.
saveMessageToFile
(
uid
,
friendUid
,
messageTime
.
getTime
(),
messageTimeStr
);
...
@@ -6520,20 +6763,57 @@ public class SocialServiceImpl implements SocialService {
...
@@ -6520,20 +6763,57 @@ public class SocialServiceImpl implements SocialService {
}
}
}
}
if
(
""
.
equals
(
messageContent
))
{
if
(
""
.
equals
(
messageContent
))
{
messageNum
=
null
;
messageNum
=
1
;
}
}
//保存玩家这轮的请求信息,用于下一步操作
//保存玩家这轮的请求信息,用于下一步操作
operationReq
.
setStrList
(
friendUidList
);
operationReq
.
setStrList
(
friendUidList
);
operationReq
.
setAddress
(
address
);
operationReq
.
setMessageAddress
(
address
);
operationReq
.
setAddress
(
null
);
operationReq
.
setMessageContent
(
messageContent
);
operationReq
.
setMessageContent
(
messageContent
);
operationReq
.
setMessageNum
(
messageNum
);
operationReq
.
setMessageNum
(
messageNum
);
operationReq
.
setMessageType
(
messageType
);
operationReq
.
setOperationLabel
(
Constants
.
READ_MESSAGE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//根据留言类型返回对应的后台附加返回2
if
(!
StringUtils
.
isEmpty
(
messageType
))
{
if
(
messageType
==
1200101
||
messageType
==
1200102
)
{
resultResponse
.
set
后台附加返回
2
(
"查看问候留言"
);
}
if
(
messageType
==
12002
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求种植留言"
);
}
if
(
messageType
==
12003
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求帮助留言"
);
}
if
(
messageType
==
12004
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求复仇留言"
);
}
if
(
messageType
==
12012
)
{
resultResponse
.
set
后台附加返回
2
(
"查看任意感谢留言"
);
}
if
(
messageType
==
12013
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求宠物放置留言"
);
}
if
(
messageType
==
1202001
||
(
messageType
==
1202002
))
{
resultResponse
.
set
后台附加返回
2
(
"查看请求提升帮助收益留言"
);
}
if
(
messageType
==
12024
)
{
resultResponse
.
set
后台附加返回
2
(
"查看请求休战留言"
);
}
if
(
messageType
==
12028
)
{
resultResponse
.
set
后台附加返回
2
(
"查看邀请攻打留言"
);
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_pre"
);
String
text
=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_pre"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
address
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_content"
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_content"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageContent
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
messageContent
);
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end"
);
if
(
StringUtils
.
isEmpty
(
resultResponse
.
get
后台附加返回
2
()))
{
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end"
);
}
else
{
text
+=
SpeechUtil
.
getSocialSpeech
(
Constants
.
SPEECH_ASIDE
,
"read_message_end_answer"
);
}
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
501203
);
resultResponse
.
set
反馈
ID
(
501203
);
...
...
src/main/resources/application-dev.yml
View file @
62ae40e0
...
@@ -10,7 +10,7 @@ spring:
...
@@ -10,7 +10,7 @@ spring:
name
:
secret-garden
name
:
secret-garden
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://localhost:3306/secret_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
url
:
jdbc:mysql://localhost:3306/secret_garden
_test
?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username
:
root
username
:
root
password
:
root
password
:
root
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
...
@@ -27,6 +27,16 @@ spring:
...
@@ -27,6 +27,16 @@ spring:
inetutils
:
inetutils
:
#设置主机ip超时时间,默认1秒
#设置主机ip超时时间,默认1秒
timeout-seconds
:
10
timeout-seconds
:
10
#redis配置
redis
:
host
:
localhost
port
:
6379
pool
:
max-active
:
8
max-wait
:
-1
max-idle
:
8
min-idle
:
0
timeout
:
5000
mybatis
:
mybatis
:
type-aliases-package
:
com.qiwuai.garden.pojo
type-aliases-package
:
com.qiwuai.garden.pojo
...
...
src/main/resources/application-pro.yml
View file @
62ae40e0
...
@@ -12,7 +12,7 @@ spring:
...
@@ -12,7 +12,7 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://localhost:3306/secret_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
url
:
jdbc:mysql://localhost:3306/secret_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username
:
root
username
:
root
password
:
R91jKARPj23dtqZ4wfc2F
password
:
dgKNTmt2iLHNjEQajkDEZkq8
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
druid
:
initial-size
:
5
initial-size
:
5
...
@@ -27,6 +27,16 @@ spring:
...
@@ -27,6 +27,16 @@ spring:
inetutils
:
inetutils
:
#设置主机ip超时时间,默认1秒
#设置主机ip超时时间,默认1秒
timeout-seconds
:
10
timeout-seconds
:
10
#redis配置
redis
:
host
:
localhost
port
:
6379
pool
:
max-active
:
8
max-wait
:
-1
max-idle
:
8
min-idle
:
0
timeout
:
5000
mybatis
:
mybatis
:
type-aliases-package
:
com.qiwuai.garden.pojo
type-aliases-package
:
com.qiwuai.garden.pojo
...
...
src/main/resources/application-uat.yml
View file @
62ae40e0
...
@@ -27,6 +27,16 @@ spring:
...
@@ -27,6 +27,16 @@ spring:
inetutils
:
inetutils
:
#设置主机ip超时时间,默认1秒
#设置主机ip超时时间,默认1秒
timeout-seconds
:
10
timeout-seconds
:
10
#redis配置
redis
:
host
:
localhost
port
:
6379
pool
:
max-active
:
8
max-wait
:
-1
max-idle
:
8
min-idle
:
0
timeout
:
5000
mybatis
:
mybatis
:
type-aliases-package
:
com.qiwuai.garden.pojo
type-aliases-package
:
com.qiwuai.garden.pojo
...
...
src/main/resources/com/qiwuai/garden/dao/CopyPetMapper.xml
0 → 100644
View file @
62ae40e0
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.qiwuai.garden.dao.CopyPetMapper"
>
<select
id=
"findAll"
resultType=
"com.qiwuai.garden.pojo.CopyPetPojo"
>
select * from copy_pet
</select>
</mapper>
\ No newline at end of file
src/main/resources/com/qiwuai/garden/dao/RarityMapper.xml
View file @
62ae40e0
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<select
id=
"findAll"
resultType=
"com.qiwuai.garden.pojo.RarityPojo"
>
<select
id=
"findAll"
resultType=
"com.qiwuai.garden.pojo.RarityPojo"
>
select
select
id, description, create_time, update_time
id, description,
pitch_pro,
create_time, update_time
from
from
rarity
rarity
</select>
</select>
...
...
src/main/resources/speech/advise.yaml
View file @
62ae40e0
...
@@ -195,6 +195,8 @@ aside:
...
@@ -195,6 +195,8 @@ aside:
-
【旁白@正常】还有空闲{花圃称呼},【1】可在【2】号{花圃称呼},要种植吗?
-
【旁白@正常】还有空闲{花圃称呼},【1】可在【2】号{花圃称呼},要种植吗?
item_advise_fail_no_pet_drop_item
:
item_advise_fail_no_pet_drop_item
:
-
【旁白@正常】目前还没有宠物可以掉落【1】。
-
【旁白@正常】目前还没有宠物可以掉落【1】。
item_advise_key_item
:
-
【旁白@正常】【1】是花仙升级的剧情道具,必须完成对应的剧情才可以获得噢。
#9005:指定花圃建议
#9005:指定花圃建议
nursery_advise_no_nursery_name
:
nursery_advise_no_nursery_name
:
-
【旁白@正常】你还没有告诉我花圃类型,暂时不能提供建议。
-
【旁白@正常】你还没有告诉我花圃类型,暂时不能提供建议。
...
...
src/main/resources/speech/gardener.yaml
View file @
62ae40e0
...
@@ -95,13 +95,15 @@ aside:
...
@@ -95,13 +95,15 @@ aside:
view_back_pack_fail_none
:
view_back_pack_fail_none
:
-
【旁白@正常】目前背包空空如也。
-
【旁白@正常】目前背包空空如也。
view_back_pack_item
:
view_back_pack_item
:
-
【旁白@正常】目前拥有的【1】,一共有【2】。
-
【旁白@正常】目前拥有的【1】,一共有【2】
种,现有【3】
。
view_back_pack_item_none
:
view_back_pack_item_none
:
-
【旁白@正常】目前背包还没有【1】。
-
【旁白@正常】目前背包还没有【1】。
view_back_pack_item_fail_no_type
:
view_back_pack_item_fail_no_type
:
-
【旁白@正常】你还未提供物品种类,目前有【1】。
-
【旁白@正常】你还未提供物品种类,目前有【1】。
view_back_pack_item_fail_not_exist
:
view_back_pack_item_fail_not_exist
:
-
【旁白@正常】物品种类不存在,目前有【1】。
-
【旁白@正常】物品种类不存在,目前有【1】。
view_back_pack_item_more
:
-
【旁白@正常】还有其他物品是否要继续播报。
#查看货币
#查看货币
view_money
:
view_money
:
-
【旁白@正常】目前拥有的【1】数量为【2】。
-
【旁白@正常】目前拥有的【1】数量为【2】。
...
@@ -114,6 +116,8 @@ aside:
...
@@ -114,6 +116,8 @@ aside:
-
【旁白@正常】【1】【2】,目前背包里还没有。【3】可以掉落该物品。
-
【旁白@正常】【1】【2】,目前背包里还没有。【3】可以掉落该物品。
search_item_info_none_to_plant_or_pet
:
search_item_info_none_to_plant_or_pet
:
-
【旁白@正常】【1】【2】,目前背包里还没有。可以通过种植【3】或者【4】掉落获得。
-
【旁白@正常】【1】【2】,目前背包里还没有。可以通过种植【3】或者【4】掉落获得。
search_item_info_none
:
-
【旁白@正常】【1】【2】,目前背包里没有这个物品哦。
search_item_info_no_exist
:
search_item_info_no_exist
:
-
【旁白@正常】该物品不存在。
-
【旁白@正常】该物品不存在。
...
@@ -135,7 +139,7 @@ man:
...
@@ -135,7 +139,7 @@ man:
gardener_upgrade_fail
:
gardener_upgrade_fail
:
-
【男园丁@正常】很抱歉【1】,我这次升级失败了……
-
【男园丁@正常】很抱歉【1】,我这次升级失败了……
gardener_upgrade_fail_had
:
gardener_upgrade_fail_had
:
-
【男园丁@正常】谢谢【1】,
满
级了。
-
【男园丁@正常】谢谢【1】,
目前到最大等
级了。
gardener_upgrade_fail_task
:
gardener_upgrade_fail_task
:
-
【男园丁@正常】【1】升级不了的话,要了解一下任务详情吗?
-
【男园丁@正常】【1】升级不了的话,要了解一下任务详情吗?
gardener_upgrade_cancel
:
gardener_upgrade_cancel
:
...
@@ -210,7 +214,7 @@ man:
...
@@ -210,7 +214,7 @@ man:
view_back_pack_item_lot
:
view_back_pack_item_lot
:
-
【男园丁@正常】这么多东西,把背包都塞得满满当当啊!
-
【男园丁@正常】这么多东西,把背包都塞得满满当当啊!
view_back_pack_item_few
:
view_back_pack_item_few
:
-
【男园丁@正常】这也太少了点吧……【1】
,我们再去多种一点植物吧!
-
【男园丁@正常】这也太少了点吧……【1】
view_back_pack_item_fail_no_type
:
view_back_pack_item_fail_no_type
:
-
【男园丁@正常】【1】,【2】还没告诉我想看的种类。
-
【男园丁@正常】【1】,【2】还没告诉我想看的种类。
view_back_pack_item_fail_not_exist
:
view_back_pack_item_fail_not_exist
:
...
@@ -253,7 +257,7 @@ woman:
...
@@ -253,7 +257,7 @@ woman:
gardener_upgrade_fail
:
gardener_upgrade_fail
:
-
【女园丁@正常】啊……我无法获得更强大的力量升级了吗……
-
【女园丁@正常】啊……我无法获得更强大的力量升级了吗……
gardener_upgrade_fail_had
:
gardener_upgrade_fail_had
:
-
【女园丁@正常】
厉害了【1】,我满级可以帮【1】更多的忙
。
-
【女园丁@正常】
谢谢【1】,目前到最大等级了
。
gardener_upgrade_fail_task
:
gardener_upgrade_fail_task
:
-
【女园丁@正常】升级不了呢,要不我们去看一下任务详情吧。
-
【女园丁@正常】升级不了呢,要不我们去看一下任务详情吧。
gardener_upgrade_cancel
:
gardener_upgrade_cancel
:
...
...
src/main/resources/speech/market.yaml
View file @
62ae40e0
...
@@ -28,6 +28,8 @@ aside:
...
@@ -28,6 +28,8 @@ aside:
-
【旁白@正常】不存在该物品。
-
【旁白@正常】不存在该物品。
sell_check_fail_none
:
sell_check_fail_none
:
-
【旁白@正常】背包还没有【1】。
-
【旁白@正常】背包还没有【1】。
sell_check_fail_salable
:
-
【旁白@正常】【1】为重要物品,暂不能出售。
sell_check_item_success
:
sell_check_item_success
:
-
【旁白@正常】当前一共有【1】个【2】,请问想要出售多少个?
-
【旁白@正常】当前一共有【1】个【2】,请问想要出售多少个?
sell_success
:
sell_success
:
...
@@ -42,6 +44,8 @@ aside:
...
@@ -42,6 +44,8 @@ aside:
-
【旁白@正常】背包里已经没有【1】了。
-
【旁白@正常】背包里已经没有【1】了。
sell_all_check_fail_no_exist
:
sell_all_check_fail_no_exist
:
-
【旁白@正常】不存在这类物品。
-
【旁白@正常】不存在这类物品。
sell_all_check_fail_salable
:
-
【旁白@正常】抱歉,关键物品无法出售。
sell_all_success
:
sell_all_success
:
-
【旁白@正常】已完成出售,本次出售共获得【1】【2】。
-
【旁白@正常】已完成出售,本次出售共获得【1】【2】。
sell_all_cancel
:
sell_all_cancel
:
...
...
src/main/resources/speech/message.yaml
0 → 100644
View file @
62ae40e0
aside
:
#1200100:留言模板
1200100
:
-
【旁白@正常】你将要给【1】留言,留言内容:“【2】”,确定吗?
#1200101:问候
1200101
:
-
你好,很高兴和你成为好友,以后还请多多关照!
1200102
:
-
你好,祝你今日好心情,一切顺利!
1200103
:
-
【旁白@正常】你今日已发送过问候留言,每个好友每天只能发送一次问候留言。
#1200201:请求种植
1200201
:
-
请您种植一些【1】可以吗?感激不尽!
1200202
:
-
【旁白@正常】你提供的植物名称无效,请重新提供一遍植物名称,可以说1个想要对方种植的植物名称。
1200203
:
-
【旁白@正常】你还没有说请求种植的植物名称呢,可以说1个想要对方种植的植物名称。
1200204
:
-
【旁白@正常】【1】还不是你的好友,暂时不能让他种植。
1200205
:
-
【旁白@正常】不能给自己留言协助攻打自己,请重新提供一个有效的玩家地址。
#1200301:请求帮助
1200301
:
-
我最近太忙了,可以帮我收取果实吗?【1】号{花圃称呼}的帮助受益是【2】%,感激不尽!
1200302
:
-
我最近太忙了,可以帮我收取一下果实吗?感激不尽!
1200303
:
-
【旁白@正常】你目前还有没有这个{花圃称呼}编号。请您重新留言。目前有【1】。
1200304
:
-
【旁白@正常】【1】还不是你的好友,暂时不能请他帮忙。
#1200401:请求协助攻打
1200401
:
-
【1】攻打了我,能请你协助我攻打他吗
1200402
:
-
【旁白@正常】找不到这个玩家地址,请重新提供一个有效的玩家地址。
1200403
:
-
【旁白@正常】你没有提供一个玩家地址,请提供一个有效的玩家地址作为协助攻打对象。
1200404
:
-
【旁白@正常】【1】还不是你的好友,暂时不能请他帮你攻打。
#1200501:问候回复
1200501
:
-
你好,我也很高兴和你成为好友,以后互相关照!
1200502
:
-
你好,祝你今日好心情,一切顺利!
#1200601:请求种植回复
1200601
:
-
好的,下一次我会种植你想要的这些植物,记得过来帮助收取。
1200602
:
-
不好意思,我暂时没办法种植你需要的这些植物,下次再说吧。
#1200701:请求帮助回复
1200701
:
-
好的,我会想着帮你收取果实的,放心吧!
1200702
:
-
抱歉,我这几天可能没空,没办法帮到你了。
#1200801:请求协助攻打回复
1200801
:
-
好的,我会协助你攻打他。
1200802
:
-
不好意思,我的宠物能力不足,可能帮不到你了。
#1200901:种植感谢
1200901
:
-
感谢你满足了我的种植请求。
1200902
:
-
【旁白@正常】【1】还不是你的好友,暂时不能感谢种植。
#1201001:帮助感谢
1201001
:
-
感谢你帮我收取了果实。
1201002
:
-
【旁白@正常】【1】还不是你的好友,暂时不能感谢帮助。
#1201101:协助攻打感谢
1201101
:
-
感谢你协助我攻打。
1201102
:
-
【旁白@正常】【1】还不是你的好友,暂时不能感谢攻打。
#1201201:感谢回复
1201201
:
-
不客气,有需要帮忙的尽管提。
1201202
:
-
【旁白@正常】【1】还不是你的好友,暂时不能回复感谢。
#1201301:请求放置宠物
1201301
:
-
可以请你在{花圃称呼}中放置【1】吗?感激不尽。
1201302
:
-
【旁白@正常】你提供的宠物名称无效,请重新提供一遍宠物名称,可以说1个想要对方放置的宠物名称。
1201303
:
-
【旁白@正常】你还没有说请求放置的宠物名称呢,可以说1个想要对方放置的宠物名称。
1201304
:
-
【旁白@正常】【1】还不是你的好友,暂时不能请求放置宠物。
#1201401:请求宠物回复
1201401
:
-
好的,下一次种植时我会放置你需要的宠物。
1201402
:
-
不好意思,我没有你说的宠物,暂时不能满足你的请求。
#1201501:宠物感谢
1201501
:
-
感谢你放置了我需要的宠物。
1201502
:
-
【旁白@正常】【1】还不是你的好友,暂时不能感谢放置宠物。
#1201601:通知种植情况
1201601
:
-
我在【1】号{花圃称呼}上种植了【2】,距离成熟还有【3】,有空可以帮我收一下果实哦,有回报的。
120160101
:
-
我在【1】号{花圃称呼}上种植了【2】,已经成熟了,有空可以帮我收一下果实哦,有回报的。
1201602
:
-
【旁白@正常】你提供的苗圃上还没有种植植物,请提供一个已经种植植物的苗圃编号。
1201603
:
-
【旁白@正常】你还没有提供一个苗圃编号,请提供一个已经种植植物的苗圃编号。
1201604
:
-
【旁白@正常】你目前还有没有这个{花圃称呼}编号。请您重新留言。目前有【1】。
1201605
:
-
【旁白@正常】【1】还不是你的好友,暂时不能通知他种植情况。
#1201701:通知宠物放置情况
1201701
:
-
我在【1】号{花圃称呼}放置了【2】。
120170101
:
-
我在【1】号{花圃称呼}放置了【2】,目前正在种植【3】,距离成熟还有【4】,有空可以帮我收一下果实哦,有回报的。。
120170102
:
-
我在【1】号{花圃称呼}放置了【2】,目前正在种植【3】,已经成熟了,有空可以帮我收一下果实哦,有回报的。。
1201702
:
-
【旁白@正常】你提供的苗圃上还没有放置宠物,请提供一个放置了宠物的苗圃编号。
1201703
:
-
【旁白@正常】你还没有提供一个苗圃编号,请提供一个放置了宠物的苗圃编号。
1201704
:
-
【旁白@正常】你目前还有没有这个{花圃称呼}编号。请您重新留言。目前有【1】。
1201705
:
-
【旁白@正常】【1】还不是你的好友,暂时不能通知他宠物放置情况。
#1201801:通知帮助情况
1201801
:
-
我今天帮你收取了果实,感谢你的酬劳。
1201802
:
-
【旁白@正常】你今天还没有帮助过他,帮助他收取果实后再通知他这件事吧。
1201803
:
-
【旁白@正常】【1】还不是你的好友,不能帮助,暂时不能通知。
#1201901:通知攻打情况
1201901
:
-
我今天已经协助你攻打了【1】。
1201902
:
-
【旁白@正常】你今天并没有协助过他攻打,攻打【1】后再通知他这件事吧。
1201903
:
-
【旁白@正常】你还没有提供一个玩家地址,请提供一个今天攻打过的玩家地址。
1201904
:
-
【旁白@正常】【1】还不是你的好友,暂时不能通知攻打情况。
#1202001:请求提升/降低帮助收益
1202001
:
-
请您【1】帮助收益到【2】%好吗?感激不尽!
1202002
:
-
【旁白@正常】你提供的收益比例无效,请重新提供一下收益比例参数,可以选择在【1】%至【2】%之间的任意整数参数。
1202003
:
-
请您【1】一下帮助收益好吗?感激不尽!
1202004
:
-
【旁白@正常】请问你是想要【1】提升收益比例还是降低收益比例呢?
1202005
:
-
【旁白@正常】【1】还不是你的好友,暂时不能请求改变收益比例。
#1202101:回复请求提升帮助收益
1202101
:
-
好的,我会【1】帮助收益。
1202102
:
-
不好意思,暂时不能【1】帮助收益
#1202201:通知提升/降低帮助收益
1202201
:
-
我已经把【1】号{花圃称呼}的帮助收益【2】到了【3】,欢迎你随时来帮助我收取果实。
1202202
:
-
【旁白@正常】你提供的【1】号{花圃称呼}今天还没有变更过帮助收益,请提供一个今日内变更过帮助收益的苗圃。
1202203
:
-
【旁白@正常】你还没有提供{花圃称呼}编号哦。目前有【1】。
1202204
:
-
【旁白@正常】你目前还有没有这个{花圃称呼}编号。请您重新留言。目前有【1】。
1202205
:
-
【旁白@正常】【1】还不是你的好友,暂时不能通知改变收益比例。
#1202301:提升/降低帮助请求感谢
1202301
:
-
感谢你更改了帮助收益。
1202302
:
-
【旁白@正常】【1】还不是你的好友,暂时不能感谢改变收益比例。
#1202401:请求休战
1202401
:
-
苗圃种植不易,请您高抬贵手,不要再攻打我了。
1202402
:
-
【旁白@正常】您的留言对象从来没有攻打过你,换一个人留言吧。
1202403
:
-
【旁白@正常】【1】是你的好友,不能攻打你。
#1202501:请求休战回复
1202501
:
-
好吧,冤家宜解不宜结,咱们就此休战。
1202502
:
-
不好意思,暂时无法满足你的请求。
#1202601:休战感谢
1202601
:
-
感谢你的休战承诺。
1202602
:
-
【旁白@正常】【1】是你的好友,不能攻打你的。
#1202701:问候(陌生人)
1202701
:
-
你好,你的苗圃被照顾的不错。
1202702
:
-
今天又是美好的一天,希望你的苗圃生长旺盛!
1202703
:
-
【旁白@正常】你今日已发送过问候留言,每个陌生人每天只能发送一次问候留言。
#1202801:邀请攻打
1202801
:
-
我的宠物阵容很强大,要来挑战一下吗?如果能赢我,苗圃的收益任选。
1202802
:
-
【旁白@正常】【1】是你的好友,不能攻打你。
#1202901:邀请攻打回复
1202901
:
-
这么有自信?我这就来试试你的阵容。
1202902
:
-
我的阵容还不够强大,就不挑战了吧。
#1203001:模糊感谢
1203001
:
-
谢谢你对我的所有帮助。
\ No newline at end of file
src/main/resources/speech/pet.yaml
View file @
62ae40e0
...
@@ -12,7 +12,7 @@ aside:
...
@@ -12,7 +12,7 @@ aside:
pet_view_both
:
pet_view_both
:
-
【旁白@正常】【1】【2】,属性:【3】,生命值:【4】,攻击值:【5】,目前有【6】只该宠物正在宠物栏里,有【7】只该宠物正养在【8】中。
-
【旁白@正常】【1】【2】,属性:【3】,生命值:【4】,攻击值:【5】,目前有【6】只该宠物正在宠物栏里,有【7】只该宠物正养在【8】中。
pet_view_no_pet
:
pet_view_no_pet
:
-
【旁白@正常】{花圃称呼}、宠物栏内没有该宠物。
我们还没有这个宠物,
可以通过种植【1】,以一定几率获得
-
【旁白@正常】{花圃称呼}、宠物栏内没有该宠物。可以通过种植【1】,以一定几率获得
pet_view_no_exist
:
pet_view_no_exist
:
-
【旁白@正常】不存在该宠物。
-
【旁白@正常】不存在该宠物。
#宠物移动
#宠物移动
...
@@ -146,6 +146,29 @@ aside:
...
@@ -146,6 +146,29 @@ aside:
#升级宠物
#升级宠物
upgrade_pet
:
upgrade_pet
:
-
【旁白@正常】宠物不支持升级。可以去看看有哪些宠物。
-
【旁白@正常】宠物不支持升级。可以去看看有哪些宠物。
#玩家选定宠物
pet_choose
:
-
【旁白@正常】没有你说的宠物哦,你可以在【1】和【2】中选择。
#宠物比试结果
pet_match_fail
:
-
【旁白@正常】很抱歉,你目前只有【1】【2】,不够下注。
pet_match_win
:
-
【旁白@正常】恭喜你,这次共赢得【1】【2】,现有【3】【2】。
pet_match_win_cost
:
-
【旁白@正常】恭喜你,这次共赢得【1】【2】,现有【3】【2】,还了对方【4】【2】。
pet_match_lose
:
-
【旁白@正常】很遗憾,这次你押的【1】【2】全输掉了,目前还剩下【3】【2】。
#宠物比试结果
copy_pet_no_name
:
-
【旁白@正常】没有这个副本哦,现在有【1】。
copy_pet_finished
:
-
【旁白@正常】天选者,本周你已经成功的战胜了【1】里的邪灵。若想再次挑战需等待至下周一的平旦之时。
copy_pet_lack_one
:
-
【旁白@正常】抱歉,本周【1】需要【2】和【3】才可以挑战,您目前缺少【4】,快去种植与之对应的植物吧,快去种植与之对应的植物吧。如果不清楚怎么吸引,可以问问花仙“怎么吸引【4】”。
copy_pet_lack_two
:
-
【旁白@正常】抱歉,本周【1】需要【2】和【3】才可以挑战,您目前两只宠物都没有,快去种植与之对应的植物吧。如果不清楚怎么吸引,可以问问花仙“怎么吸引【2】”。
copy_pet_lack_success
:
-
【旁白@平静】►打开:当前作品:绫华不歪玩到关服◄
...
...
src/main/resources/speech/plant.yaml
View file @
62ae40e0
...
@@ -94,7 +94,7 @@ aside:
...
@@ -94,7 +94,7 @@ aside:
check_nursery_fail_wrong_num
:
check_nursery_fail_wrong_num
:
-
【旁白@正常】该{花圃称呼}编号不存在,还无法查看。目前有【1】。
-
【旁白@正常】该{花圃称呼}编号不存在,还无法查看。目前有【1】。
check_nursery_info
:
check_nursery_info
:
-
【旁白@正常】
【1】号{花圃称呼}当前等级为【2】,类型:【3】
-
【旁白@正常】
🅰【1】号🅱{花圃称呼}当前等级为🅰【2】🅱,类型:🅰【3】🅱
check_nursery_info_have_plant_pet
:
check_nursery_info_have_plant_pet
:
-
,正在种植【1】,【2】【3】在这个{花圃称呼}中。
-
,正在种植【1】,【2】【3】在这个{花圃称呼}中。
check_nursery_info_have_plant_no_pet
:
check_nursery_info_have_plant_no_pet
:
...
@@ -105,38 +105,38 @@ aside:
...
@@ -105,38 +105,38 @@ aside:
-
,这里还没有种植植物,也没有宠物。
-
,这里还没有种植植物,也没有宠物。
#查看花圃状态
#查看花圃状态
nursery_seeding
:
nursery_seeding
:
-
【旁白@正常】
【1】号
{花圃称呼}的植物果实刚种下还没发芽。
-
【旁白@正常】
🅰【1】号🅱
{花圃称呼}的植物果实刚种下还没发芽。
nursery_sowing
:
nursery_sowing
:
-
【旁白@正常】
【1】号
{花圃称呼}的植物新抽出了绿芽,看起来是在茁壮成长;
-
【旁白@正常】
🅰【1】号🅱
{花圃称呼}的植物新抽出了绿芽,看起来是在茁壮成长;
nursery_growing
:
nursery_growing
:
-
【旁白@正常】
【1】号
{花圃称呼}的植物距离成熟期还有一段时间,看来还需要耐心等待啊……
-
【旁白@正常】
🅰【1】号🅱
{花圃称呼}的植物距离成熟期还有一段时间,看来还需要耐心等待啊……
nursery_blooming
:
nursery_blooming
:
-
【旁白@正常】
【1】号{花圃称呼}的【2】
已经结了花苞,离成熟还有一段时间。
-
【旁白@正常】
🅰【1】号🅱{花圃称呼}的🅰【2】🅱
已经结了花苞,离成熟还有一段时间。
nursery_mature
:
nursery_mature
:
-
【旁白@正常】
【1】号
{花圃称呼}的果实已经成熟可以摘取!
-
【旁白@正常】
🅰【1】号🅱
{花圃称呼}的果实已经成熟可以摘取!
-
【旁白@正常】
【1】号
{花圃称呼}硕果累累,可以摘取了!
-
【旁白@正常】
🅰【1】号🅱
{花圃称呼}硕果累累,可以摘取了!
nursery_pet
:
nursery_pet
:
-
【1】种植过的植物吸引来了
【2】只
神秘的动物。
-
【1】种植过的植物吸引来了
🅰【2】只🅱
神秘的动物。
nursery_level
:
nursery_level
:
-
【旁白@正常】
【1】号{花圃称呼}的等级目前为【2】级,类型为【3】
。
-
【旁白@正常】
🅰【1】号🅱{花圃称呼}的等级目前为🅰【2】级🅱,类型为🅰【3】🅱
。
nursery_fail_no_nursery
:
nursery_fail_no_nursery
:
-
【旁白@正常】你还提供没有{花圃称呼}编号,目前有【1】。
-
【旁白@正常】你还提供没有{花圃称呼}编号,目前有【1】。
nursery_all_fail_no_plant
:
nursery_all_fail_no_plant
:
-
【旁白@正常】所有{花圃称呼}还未种植。
-
【旁白@正常】所有{花圃称呼}还未种植。
nursery_all_check
:
nursery_all_check
:
-
【旁白@正常】一共有
【1】个
苗圃,【2】。
-
【旁白@正常】一共有
🅰【1】个🅱
苗圃,【2】。
nursery_all_seeding
:
nursery_all_seeding
:
-
中的
【1】
刚刚播种了,
-
中的
🅰【1】🅱
刚刚播种了,
nursery_all_sowing
:
nursery_all_sowing
:
-
中的
【1】
刚刚发出嫩芽,
-
中的
🅰【1】🅱
刚刚发出嫩芽,
nursery_all_growing
:
nursery_all_growing
:
-
中的
【1】
正在茁壮成长,
-
中的
🅰【1】🅱
正在茁壮成长,
nursery_all_blooming
:
nursery_all_blooming
:
-
中的
【1】
已经开花,
-
中的
🅰【1】🅱
已经开花,
nursery_all_mature
:
nursery_all_mature
:
-
中的
【1】
已经成熟,可以收取果实了。
-
中的
🅰【1】🅱
已经成熟,可以收取果实了。
nursery_have_free
:
nursery_have_free
:
-
有
【1】
个{花圃称呼}还空闲着。
-
有
🅰【1】🅱
个{花圃称呼}还空闲着。
#铲除植物
#铲除植物
clear_plant_check
:
clear_plant_check
:
-
【旁白@正常】确定消耗【1】个【2】,铲除【3】号{花圃称呼}上的植物吗?
-
【旁白@正常】确定消耗【1】个【2】,铲除【3】号{花圃称呼}上的植物吗?
...
@@ -497,7 +497,7 @@ woman:
...
@@ -497,7 +497,7 @@ woman:
-
【女园丁@正常】【1】不要灰心!我们再去找找材料吧!
-
【女园丁@正常】【1】不要灰心!我们再去找找材料吧!
-
【女园丁@正常】没再【1】的背包里看到这种材料呢……我陪【1】再去外面找找吧。
-
【女园丁@正常】没再【1】的背包里看到这种材料呢……我陪【1】再去外面找找吧。
-
【女园丁@正常】没关系,找到材料后我们还可以回来种植的。
-
【女园丁@正常】没关系,找到材料后我们还可以回来种植的。
plant_fail_n
o_n
ear_plant
:
plant_fail_near_plant
:
-
【女园丁@正常】这种植物需要先种植另一种植物才可以呢。
-
【女园丁@正常】这种植物需要先种植另一种植物才可以呢。
-
【女园丁@正常】这两种植物是伴生关系,缺一不可的。
-
【女园丁@正常】这两种植物是伴生关系,缺一不可的。
-
【女园丁@正常】种植完伴生植物后,再来种植对应的植物吧!
-
【女园丁@正常】种植完伴生植物后,再来种植对应的植物吧!
...
...
src/main/resources/speech/social.yaml
View file @
62ae40e0
...
@@ -200,15 +200,17 @@ aside:
...
@@ -200,15 +200,17 @@ aside:
-
【旁白@正常】已为你取消留言,要继续留言吗?
-
【旁白@正常】已为你取消留言,要继续留言吗?
#查看留言
#查看留言
check_message
:
check_message
:
-
【旁白@正常】【1】
给你留了
信息,需要查看一下吗?
-
【旁白@正常】【1】信息,需要查看一下吗?
check_message_fail
:
check_message_fail
:
-
【旁白@正常】当前没有
好友
留言。
-
【旁白@正常】当前没有
玩家
留言。
read_message_pre
:
read_message_pre
:
-
【旁白@正常】
你的好友
【1】在你的留言板上写下了这样一段话。
-
【旁白@正常】【1】在你的留言板上写下了这样一段话。
read_message_content
:
read_message_content
:
-
【旁白@正常】【1】
。
-
【旁白@正常】【1】
read_message_end
:
read_message_end
:
-
【旁白@正常】留言播报结束,您可以选择重播或者播放下一条留言,播放下一条留言时会删除已读留言。
-
【旁白@正常】留言播报结束,您可以选择重播或者播放下一条留言。
read_message_end_answer
:
-
【旁白@正常】留言播报结束,您可以选择重播或者播放下一条留言。当然你也可以说“回复留言”来快速回复该留言。
read_message_fail_no_pre
:
read_message_fail_no_pre
:
-
【旁白@正常】请先检查有哪些好友有留言再查看留言。
-
【旁白@正常】请先检查有哪些好友有留言再查看留言。
read_message_fail_over
:
read_message_fail_over
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment