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
26a780a3
Commit
26a780a3
authored
Nov 04, 2022
by
周君强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.建议系统调整优化;
parent
5958ccbd
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
418 additions
and
15 deletions
+418
-15
AdviseUtil.java
src/main/java/com/qiwuai/garden/common/utils/AdviseUtil.java
+204
-5
AdviseServiceImpl.java
.../garden/service/adviseService/impl/AdviseServiceImpl.java
+54
-10
application-crazyPro.yml
src/main/resources/application-crazyPro.yml
+77
-0
application-crazyUat.yml
src/main/resources/application-crazyUat.yml
+77
-0
advise.yaml
src/main/resources/speech/advise.yaml
+6
-0
No files found.
src/main/java/com/qiwuai/garden/common/utils/AdviseUtil.java
View file @
26a780a3
...
@@ -102,6 +102,33 @@ public class AdviseUtil {
...
@@ -102,6 +102,33 @@ public class AdviseUtil {
}
}
/**
/**
* 判断plantId能否在nurseryNum中种植,不考虑果实数量情况,可以让玩家购买
* @param uid
* @param plantId
* @return List<Integer>
*/
public
static
boolean
checkCanPlantToNurseryNum
(
String
uid
,
Integer
nurseryNum
,
Integer
plantId
)
{
List
<
Integer
>
nurseryNumList
=
findAllNurseryNumsByPlantId
(
uid
,
plantId
);
//该花圃不能种植plantId
if
(!
nurseryNumList
.
contains
(
nurseryNum
))
{
return
false
;
}
//玩家园丁和背包状态是否满足种植
if
(!
checkCanPlantItems
(
uid
,
nurseryNum
,
plantId
))
{
return
false
;
}
//没有伴生宠物
if
(!
checkNearPet
(
uid
,
nurseryNum
,
plantId
))
{
return
false
;
}
//没有伴生植物
if
(!
checkNearPlant
(
uid
,
plantId
))
{
return
false
;
}
return
true
;
}
/**
* 找到有成熟plantId的花圃
* 找到有成熟plantId的花圃
* @param uid
* @param uid
* @param plantId
* @param plantId
...
@@ -588,6 +615,91 @@ public class AdviseUtil {
...
@@ -588,6 +615,91 @@ public class AdviseUtil {
}
}
/**
/**
* 检查玩家的状况是否能在nurseryNum种植plantId,不考虑果实数量情况,可以让玩家购买
* @param uid
* @param nurseryNum
* @param plantId
* @return List<Integer>
*/
public
static
boolean
checkCanPlantItems
(
String
uid
,
Integer
nurseryNum
,
Integer
plantId
)
{
//玩家该花圃的信息
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
//根据花圃类型id找到花圃配置信息
NurseryPojo
nurseryConfig
=
TimingAcquisition
.
nurseryConfigMap
.
get
(
nurseryInfo
.
getId
());
//根据植物id找到植物配置信息
PlantPojo
plant
=
TimingAcquisition
.
plantMap
.
get
(
plantId
);
//园丁等级
Integer
level
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
();
//园丁等级不足以种植该植物
if
(
level
<
plant
.
getGardenerLevel
())
{
return
false
;
}
//该植物所需花圃等级
Integer
plantNurseryLevel
=
plant
.
getNurseryLevel
();
//花圃等级还不能种植该植物
if
(
nurseryConfig
.
getLevel
()
<
plantNurseryLevel
)
{
return
false
;
}
//园丁技能是否满足种植条件
if
(!
StringUtils
.
isEmpty
(
plant
.
getGardenerSkillId
())
&&
!
Constants
.
NON
.
equals
(
plant
.
getGardenerSkillId
()))
{
Map
<
Integer
,
GardenerSkillDto
>
gardenerSkillMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getSkills
();
List
<
Integer
>
skillIdList
=
gardenerSkillMap
.
values
().
stream
().
map
(
GardenerSkillDto:
:
getId
).
collect
(
Collectors
.
toList
());
if
(!
skillIdList
.
contains
(
plant
.
getGardenerSkillId
()))
{
return
false
;
}
}
//玩家的背包
BackPackDto
backPack
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
();
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
//货币对应种类
Integer
moneyType
=
TimingAcquisition
.
itemConfigMap
.
get
(
moneyId
).
getItemTypeId
();
//获取袋里的钱袋
ItemDto
moneyPacket
=
backPack
.
getItemBags
().
get
(
moneyType
).
getItems
(
moneyId
);
//--------------------玩家技能的花圃容量加成-------------
BigDecimal
addCapacityPro
=
TimingAcquisition
.
getAddNurseryCapacity
(
uid
);
double
nurseryCapacity
=
addCapacityPro
.
add
(
new
BigDecimal
(
1
)).
multiply
(
new
BigDecimal
(
nurseryConfig
.
getCapacity
())).
doubleValue
();
//需要的果实数量
int
fruitNum
=
(
int
)
((
nurseryCapacity
/
plant
.
getOccupyArea
())
*
plant
.
getFruitSeedNum
());
//果实购买价格
Integer
fruitPrice
=
getGoodsPriceByItemId
(
plant
.
getFruitId
());
if
(
moneyPacket
.
getItemNum
()
<=
(
fruitNum
*
fruitPrice
))
{
return
false
;
}
//获取植物配置信息中的所需材料
String
costItemNums
=
plant
.
getCostItemNums
();
//植物有配置所需消耗材料
if
(!
StringUtils
.
isEmpty
(
costItemNums
))
{
if
(!
Constants
.
NON_STR
.
equals
(
costItemNums
))
{
List
<
ItemDto
>
itemDtoList
=
TypeConvertUtil
.
itemString2List
(
costItemNums
);
for
(
ItemDto
item
:
itemDtoList
)
{
//所需材料
//物品对应种类
Integer
itemType
=
TimingAcquisition
.
itemConfigMap
.
get
(
item
.
getItemId
()).
getItemTypeId
();
//背包中对应种类的袋子
ItemBagDto
itemBag
=
backPack
.
getItemBags
().
get
(
itemType
);
//背包中没有该种类,则新增袋子
if
(
StringUtils
.
isEmpty
(
itemBag
))
{
itemBag
=
new
ItemBagDto
();
//定义背包里新的袋子
backPack
.
add
(
itemType
,
itemBag
);
itemBag
=
backPack
.
getItemBags
().
get
(
itemType
);
}
//获取袋里的所有物品id
List
<
Integer
>
itemPacketList
=
new
ArrayList
<>(
itemBag
.
getItemBag
().
keySet
());
if
(!
itemPacketList
.
contains
(
item
.
getItemId
()))
{
return
false
;
}
ItemDto
itemPacket
=
itemBag
.
getItems
(
item
.
getItemId
());
//背包的该物品
//背包有对应材料的情况下,查看该材料数量是否满足
if
(
itemPacket
.
getItemNum
()
<
item
.
getItemNum
())
{
return
false
;
}
}
}
}
return
true
;
}
/**
* 查找玩家可在空闲花圃种植的plantId
* 查找玩家可在空闲花圃种植的plantId
* @param uid
* @param uid
* @return Integer
* @return Integer
...
@@ -628,7 +740,62 @@ public class AdviseUtil {
...
@@ -628,7 +740,62 @@ public class AdviseUtil {
List
<
Integer
>
nurseryNumList
=
new
ArrayList
<>(
freeNumWithPlantIdMap
.
keySet
());
List
<
Integer
>
nurseryNumList
=
new
ArrayList
<>(
freeNumWithPlantIdMap
.
keySet
());
freeNurseryNum
[
0
]
=
nurseryNumList
.
get
(
0
);
freeNurseryNum
[
0
]
=
nurseryNumList
.
get
(
0
);
List
<
Integer
>
plantIdList
=
freeNumWithPlantIdMap
.
get
(
nurseryNumList
.
get
(
0
));
List
<
Integer
>
plantIdList
=
freeNumWithPlantIdMap
.
get
(
nurseryNumList
.
get
(
0
));
int
randomNum
=
RandomDropUtil
.
getRandomNum
(
0
,
plantIdList
.
size
());
int
randomNum
=
0
;
//避免随机到香草的概率较大的情况
if
(
plantIdList
.
size
()
>
1
)
{
randomNum
=
RandomDropUtil
.
getRandomNum
(
1
,
plantIdList
.
size
());
}
return
plantIdList
.
get
(
randomNum
);
}
return
null
;
}
/**
* 查找玩家可在空闲花圃种植的plantId,不考虑果实数量情况,可以让玩家购买
* @param uid
* @return Integer
*/
public
static
Integer
getCanPlantIdToFreeNursery
(
String
uid
,
int
[]
freeNurseryNum
)
{
//玩家所有空闲花圃
List
<
Integer
>
freeNurseryNumList
=
findFreeNurseryNums
(
uid
);
//Map<空闲花圃编号,List<植物id>>
Map
<
Integer
,
List
<
Integer
>>
freeNumWithPlantIdMap
=
new
ConcurrentHashMap
<>();
//有空闲苗圃
if
(
freeNurseryNumList
.
size
()
!=
0
)
{
for
(
Integer
nurseryNum
:
freeNurseryNumList
)
{
List
<
Integer
>
canPlantIdList
=
new
ArrayList
<>();
//花圃可以种植的植物
List
<
Integer
>
plantIdList
=
findPlantIdToNursery
(
uid
,
nurseryNum
);
if
(
plantIdList
.
size
()
!=
0
)
{
for
(
Integer
canPlantId
:
plantIdList
)
{
//在花圃nurseryNum是否可种植plantId,不考虑果实数量情况,可以让玩家购买
if
(
checkCanPlantToNurseryNum
(
uid
,
nurseryNum
,
canPlantId
))
{
canPlantIdList
.
add
(
canPlantId
);
}
}
}
if
(
canPlantIdList
.
size
()
!=
0
)
{
freeNumWithPlantIdMap
.
put
(
nurseryNum
,
canPlantIdList
);
}
}
//玩家还没有可以在空闲花圃种植的植物,选择一个花圃等级低,且能种植的植物(让玩家购买)
if
(
freeNumWithPlantIdMap
.
size
()
==
0
)
{
//花圃可以种植的植物
List
<
Integer
>
plantIdList
=
findPlantIdToNursery
(
uid
,
freeNurseryNumList
.
get
(
0
));
// canPlantIdList.add(plantIdList.get(0));
freeNumWithPlantIdMap
.
put
(
freeNurseryNumList
.
get
(
0
),
plantIdList
);
}
}
if
(
freeNumWithPlantIdMap
.
size
()
!=
0
)
{
//存在空闲花圃可种植的植物
List
<
Integer
>
nurseryNumList
=
new
ArrayList
<>(
freeNumWithPlantIdMap
.
keySet
());
freeNurseryNum
[
0
]
=
nurseryNumList
.
get
(
0
);
List
<
Integer
>
plantIdList
=
freeNumWithPlantIdMap
.
get
(
nurseryNumList
.
get
(
0
));
int
randomNum
=
0
;
//避免随机到香草的概率较大的情况
if
(
plantIdList
.
size
()
>
1
)
{
randomNum
=
RandomDropUtil
.
getRandomNum
(
1
,
plantIdList
.
size
());
}
return
plantIdList
.
get
(
randomNum
);
return
plantIdList
.
get
(
randomNum
);
}
}
return
null
;
return
null
;
...
@@ -2746,6 +2913,23 @@ public class AdviseUtil {
...
@@ -2746,6 +2913,23 @@ public class AdviseUtil {
}
}
/**
/**
* 查找宠物栏是否有空位放置宠物。宠物栏有空位返回0,没空位则返回null
* @param uid
* @return Integer
*/
public
static
Integer
getFieldPosToMovePet
(
String
uid
)
{
//玩家的宠物栏
List
<
Integer
>
petFieldList
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getPetFields
();
//园丁宠物栏存放上限
int
petNumMax
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
()).
getPetNumMax
();
//宠物栏未满
if
(
petFieldList
.
size
()
<
petNumMax
)
{
return
0
;
}
return
null
;
}
/**
* 查找花圃中指定宠物所在的花圃。找到则返回花圃编号,否则返回null
* 查找花圃中指定宠物所在的花圃。找到则返回花圃编号,否则返回null
* @param uid
* @param uid
* @param petId
* @param petId
...
@@ -3034,9 +3218,11 @@ public class AdviseUtil {
...
@@ -3034,9 +3218,11 @@ public class AdviseUtil {
List
<
ItemDto
>
petCostItemList
=
new
ArrayList
<>();
List
<
ItemDto
>
petCostItemList
=
new
ArrayList
<>();
//任意一个空闲花圃种植所需物品
//任意一个空闲花圃种植所需物品
List
<
ItemDto
>
freeNurseryItemList
=
new
ArrayList
<>();
List
<
ItemDto
>
freeNurseryItemList
=
new
ArrayList
<>();
//所有果实保留一份
List
<
ItemDto
>
fruitList
=
new
ArrayList
<>();
//获取当前玩家的背包
//获取当前玩家的背包
BackPackDto
backPack
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
();
BackPackDto
backPack
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
();
//种植需要消耗的物品
//
1.
种植需要消耗的物品
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
...
@@ -3119,7 +3305,7 @@ public class AdviseUtil {
...
@@ -3119,7 +3305,7 @@ public class AdviseUtil {
if
(
freeNurseryNumList
.
size
()
==
0
)
{
if
(
freeNurseryNumList
.
size
()
==
0
)
{
freeNurseryNumList
.
add
(
getMaxLevelNursery
(
uid
));
freeNurseryNumList
.
add
(
getMaxLevelNursery
(
uid
));
}
}
//保留一个花圃可种植的果实数量和物品
//
2.
保留一个花圃可种植的果实数量和物品
for
(
Integer
freeNum
:
freeNurseryNumList
)
{
for
(
Integer
freeNum
:
freeNurseryNumList
)
{
//该花圃中可种植的植物
//该花圃中可种植的植物
List
<
Integer
>
plantIdList
=
findPlantIdToNursery
(
uid
,
freeNum
);
List
<
Integer
>
plantIdList
=
findPlantIdToNursery
(
uid
,
freeNum
);
...
@@ -3157,7 +3343,7 @@ public class AdviseUtil {
...
@@ -3157,7 +3343,7 @@ public class AdviseUtil {
break
;
break
;
}
}
}
}
//宠物栏中的宠物
//
3.
宠物栏中的宠物
List
<
Integer
>
petFields
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getPetFields
();
List
<
Integer
>
petFields
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getPetFields
();
for
(
Integer
petId
:
petFields
)
{
for
(
Integer
petId
:
petFields
)
{
//获取对应位置的宠物
//获取对应位置的宠物
...
@@ -3171,11 +3357,24 @@ public class AdviseUtil {
...
@@ -3171,11 +3357,24 @@ public class AdviseUtil {
}
}
}
}
}
}
//统计所有的物品
//4.所有果实保留一份
//获取果实袋子
Map
<
Integer
,
ItemDto
>
fruitPacket
=
backPack
.
getItemBags
().
get
(
Constants
.
ITEM_TYPE_FRUIT
).
getItemBag
();
for
(
Map
.
Entry
<
Integer
,
ItemDto
>
entry
:
fruitPacket
.
entrySet
())
{
ItemDto
fruit
=
entry
.
getValue
();
if
(
fruit
.
getItemNum
()
>=
1
)
{
ItemDto
fruitAdd
=
new
ItemDto
();
fruitAdd
.
setItemId
(
fruit
.
getItemId
());
fruitAdd
.
setItemNum
(
1
);
fruitList
.
add
(
fruitAdd
);
}
}
//统计所有需要保留的物品
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
upgradeItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
upgradeItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
nurseryItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
nurseryItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
petCostItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
petCostItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
freeNurseryItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
freeNurseryItemList
);
allItemList
=
TypeConvertUtil
.
listMerge
(
allItemList
,
fruitList
);
//遍历背包中的所有物品
//遍历背包中的所有物品
for
(
Map
.
Entry
<
Integer
,
ItemBagDto
>
entry
:
backPack
.
getItemBags
().
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
ItemBagDto
>
entry
:
backPack
.
getItemBags
().
entrySet
())
{
//非货币的袋子
//非货币的袋子
...
...
src/main/java/com/qiwuai/garden/service/adviseService/impl/AdviseServiceImpl.java
View file @
26a780a3
...
@@ -1132,12 +1132,37 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -1132,12 +1132,37 @@ public class AdviseServiceImpl implements AdviseService {
adviseRequest
.
setPlantId
(
plantId
);
adviseRequest
.
setPlantId
(
plantId
);
adviseOperate
.
setOperationReq
(
adviseRequest
);
adviseOperate
.
setOperationReq
(
adviseRequest
);
adviseOperateList
.
add
(
adviseOperate
);
adviseOperateList
.
add
(
adviseOperate
);
operationReq
.
setAdviseOperateList
(
adviseOperateList
);
operationReq
.
setOperationLabel
(
Constants
.
ADVISE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getAdviseSpeech
(
gender
,
"plant_advise_success"
);
String
text
=
SpeechUtil
.
getAdviseSpeech
(
gender
,
"plant_advise_success"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryNum
.
toString
(),
plantName
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
nurseryNum
.
toString
(),
plantName
);
//植物没有配置伴生宠物,花圃中有宠物,同时宠物栏有空位的情况下,宠物移动到宠物栏
//植物所需伴生宠物
Integer
petId
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getPetId
();
//植物没有配置伴生宠物
if
(
Constants
.
NON
.
equals
(
petId
))
{
//花圃中有宠物
if
(!
StringUtils
.
isEmpty
(
nurseryInfo
.
getPetField
()))
{
//同时宠物栏有空位
if
(!
StringUtils
.
isEmpty
(
AdviseUtil
.
getFieldPosToMovePet
(
uid
)))
{
//-------------建议移动宠物------------
//获取对应话术
String
moveText
=
SpeechUtil
.
getAdviseSpeech
(
gender
,
"pet_advise_move_pet_to_field"
);
moveText
=
SpeechUtil
.
speechReplaceNum
(
moveText
,
nurseryNum
.
toString
(),
TimingAcquisition
.
petConfigMap
.
get
(
nurseryInfo
.
getPetField
()).
getName
());
//-------------------保存玩家这轮的建议,用于下一步操作---------------------
AdviseOperateDto
moveOperate
=
new
AdviseOperateDto
();
moveOperate
.
setOperateName
(
Constants
.
PET_NURSERY_TO_FIELD_OPERATE
);
//花圃移动到宠物栏
OperationRequest
moveRequest
=
new
OperationRequest
();
moveRequest
.
setNurseryNum
(
nurseryNum
);
moveOperate
.
setOperationReq
(
moveRequest
);
adviseOperateList
.
add
(
moveOperate
);
text
=
SpeechUtil
.
mergeSpeech
(
text
,
moveText
);
}
}
}
operationReq
.
setAdviseOperateList
(
adviseOperateList
);
operationReq
.
setOperationLabel
(
Constants
.
ADVISE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
900203
);
resultResponse
.
set
反馈
ID
(
900203
);
...
@@ -1382,13 +1407,30 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -1382,13 +1407,30 @@ public class AdviseServiceImpl implements AdviseService {
adviseRequest
.
setNumber
(
lackFruitItem
.
getItemNum
());
adviseRequest
.
setNumber
(
lackFruitItem
.
getItemNum
());
adviseOperate
.
setOperationReq
(
adviseRequest
);
adviseOperate
.
setOperationReq
(
adviseRequest
);
adviseOperateList
.
add
(
adviseOperate
);
adviseOperateList
.
add
(
adviseOperate
);
operationReq
.
setAdviseOperateList
(
adviseOperateList
);
operationReq
.
setOperationLabel
(
Constants
.
ADVISE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
//获取对应话术
String
buyText
=
SpeechUtil
.
getAdviseSpeech
(
gender
,
"item_advise_buy"
);
String
buyText
=
SpeechUtil
.
getAdviseSpeech
(
gender
,
"item_advise_buy"
);
buyText
=
SpeechUtil
.
speechReplaceNum
(
buyText
,
fruitName
,
price
.
toString
(),
moneyName
);
buyText
=
SpeechUtil
.
speechReplaceNum
(
buyText
,
fruitName
,
price
.
toString
(),
moneyName
);
text
=
SpeechUtil
.
mergeSpeech
(
text
,
buyText
);
text
=
SpeechUtil
.
mergeSpeech
(
text
,
buyText
);
//获取对应话术
String
addText
=
SpeechUtil
.
getAdviseSpeech
(
gender
,
"plant_advise_buy_fruit_to_plant"
);
addText
=
SpeechUtil
.
speechReplaceNum
(
addText
,
fruitName
);
text
=
SpeechUtil
.
mergeSpeech
(
text
,
addText
);
//------------建议种植-------------
//-------------------保存玩家这轮的建议,用于下一步操作---------------------
AdviseOperateDto
plantOperate
=
new
AdviseOperateDto
();
plantOperate
.
setOperateName
(
Constants
.
SEED_OPERATE
);
OperationRequest
plantRequest
=
new
OperationRequest
();
plantRequest
.
setNurseryNum
(
nurseryNum
);
plantRequest
.
setPlantId
(
plantId
);
plantOperate
.
setOperationReq
(
plantRequest
);
adviseOperateList
.
add
(
plantOperate
);
operationReq
.
setAdviseOperateList
(
adviseOperateList
);
operationReq
.
setOperationLabel
(
Constants
.
ADVISE
);
CacheUtil
.
put
(
uid
,
operationReq
,
Long
.
parseLong
(
expireTime
));
//获取对应话术
String
plantText
=
SpeechUtil
.
getAdviseSpeech
(
gender
,
"plant_advise_success"
);
plantText
=
SpeechUtil
.
speechReplaceNum
(
plantText
,
nurseryNum
.
toString
(),
plantName
);
text
=
SpeechUtil
.
mergeSpeech
(
text
,
plantText
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
900209
);
resultResponse
.
set
反馈
ID
(
900209
);
...
@@ -2921,11 +2963,11 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -2921,11 +2963,11 @@ public class AdviseServiceImpl implements AdviseService {
//取出最接近目标花圃类型的花圃编号
//取出最接近目标花圃类型的花圃编号
Integer
nurseryNum
=
nurseryNumList
.
get
(
nurseryNumList
.
size
()
-
1
);
Integer
nurseryNum
=
nurseryNumList
.
get
(
nurseryNumList
.
size
()
-
1
);
//先找出空闲花圃
//先找出空闲花圃
for
(
Integer
nurNum
:
nurseryNumList
)
{
for
(
int
i
=
(
nurseryNumList
.
size
()
-
1
);
i
>=
0
;
i
--
)
{
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nur
Num
);
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nur
seryNumList
.
get
(
i
)
);
//该花圃空闲
//该花圃空闲
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
nurseryNum
=
nur
Num
;
nurseryNum
=
nur
seryNumList
.
get
(
i
)
;
break
;
break
;
}
}
}
}
...
@@ -3260,7 +3302,9 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -3260,7 +3302,9 @@ public class AdviseServiceImpl implements AdviseService {
//没有多余物品出售
//没有多余物品出售
//可以种植的植物id
//可以种植的植物id
int
[]
freeNurseryNum
=
{
1
};
int
[]
freeNurseryNum
=
{
1
};
Integer
havePlantId
=
AdviseUtil
.
getPlantIdToFreeNursery
(
uid
,
freeNurseryNum
);
// Integer havePlantId = AdviseUtil.getPlantIdToFreeNursery(uid, freeNurseryNum);
//查找玩家可在空闲花圃种植的plantId,不考虑果实数量情况,可以让玩家购买
Integer
havePlantId
=
AdviseUtil
.
getCanPlantIdToFreeNursery
(
uid
,
freeNurseryNum
);
//有空闲苗圃
//有空闲苗圃
if
(!
StringUtils
.
isEmpty
(
havePlantId
))
{
if
(!
StringUtils
.
isEmpty
(
havePlantId
))
{
//---------------为避免陷入死循环,打断机制---------------
//---------------为避免陷入死循环,打断机制---------------
...
...
src/main/resources/application-crazyPro.yml
0 → 100644
View file @
26a780a3
server
:
port
:
60017
serlvet
:
context-path:/crazyGarden
#设置当前服务名
spring
:
application
:
#注册到注册中心的服务名
name
:
crazy-garden
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://localhost:3306/crazy_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username
:
root
password
:
38A0O1jEPOE
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
#配置间隔多久才进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis
:
20000
#配置一个连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
cloud
:
inetutils
:
#设置主机ip超时时间,默认1秒
timeout-seconds
:
10
mybatis
:
type-aliases-package
:
com.qiwuai.garden.pojo
mapper-locations
:
classpath:com/qiwuai/garden/dao/*.xml
configuration
:
map-underscore-to-camel-case
:
true
eureka
:
instance
:
hostname
:
127.0.0.1
client
:
serviceUrl
:
#设置添加服务中心的地址
defaultZone
:
http://${eureka.instance.hostname}:8081/eureka/
#将当前服务注册到到注册中心(true)
register-with-eureka
:
false
#是否检索注册中心信息
fetch-registry
:
false
#对话过期时间
expireTime
:
180000
#玩家无操作时长,默认下线
offlineTime
:
180000
userFilePath
:
/home/crazyGarden/crazyGardenUser/
speechFilePath
:
/home/crazyGarden/crazyGardenSpeech/
configFilePath
:
/home/crazyGarden/config/
messageFilePath
:
/home/crazyGarden/message/
reportFilePath
:
/home/crazyGarden/report/
#动态词组更新秘钥
appSecret
:
Wl4zX6mEAjK5uT2M
#动态词组更新链接
updatePhraseUrl
:
http://172.16.0.58:8082/out/phrase
#分享关系查看地址
shareRelationUrl
:
https://tongyong.jiaoyou365.com/api/xiaowu/
#分享链接通道
shareChannelId
:
zhuimenggarden-server-pro
#分享链接秘钥
shareAppSecret
:
KrEy5PXZGwCgM8kP
\ No newline at end of file
src/main/resources/application-crazyUat.yml
0 → 100644
View file @
26a780a3
server
:
port
:
60017
serlvet
:
context-path:/crazyGarden
#设置当前服务名
spring
:
application
:
#注册到注册中心的服务名
name
:
crazy-garden
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://localhost:3306/crazy_garden?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username
:
root
password
:
38A0O1jEPOE
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
initial-size
:
5
min-idle
:
5
max-active
:
20
max-wait
:
60000
#配置间隔多久才进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis
:
20000
#配置一个连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
cloud
:
inetutils
:
#设置主机ip超时时间,默认1秒
timeout-seconds
:
10
mybatis
:
type-aliases-package
:
com.qiwuai.garden.pojo
mapper-locations
:
classpath:com/qiwuai/garden/dao/*.xml
configuration
:
map-underscore-to-camel-case
:
true
eureka
:
instance
:
hostname
:
127.0.0.1
client
:
serviceUrl
:
#设置添加服务中心的地址
defaultZone
:
http://${eureka.instance.hostname}:8081/eureka/
#将当前服务注册到到注册中心(true)
register-with-eureka
:
false
#是否检索注册中心信息
fetch-registry
:
false
#对话过期时间
expireTime
:
180000
#玩家无操作时长,默认下线
offlineTime
:
180000
userFilePath
:
/home/crazyGarden/crazyGardenUser/
speechFilePath
:
/home/crazyGarden/crazyGardenSpeech/
configFilePath
:
/home/crazyGarden/config/
messageFilePath
:
/home/crazyGarden/message/
reportFilePath
:
/home/crazyGarden/report/
#动态词组更新秘钥
appSecret
:
nnPGsrbMriXdrRNISQeb
#动态词组更新链接
updatePhraseUrl
:
http://hw-gz24.heyqiwu.cn:8082/out/phrase
#分享关系查看地址
shareRelationUrl
:
https://hw-gz26.heyqiwu.cn/api/tongyong/
#分享链接通道
shareChannelId
:
zhuimenggarden-server-test
#分享链接秘钥
shareAppSecret
:
nRnPJwf6gIcVc2mL
\ No newline at end of file
src/main/resources/speech/advise.yaml
View file @
26a780a3
...
@@ -121,6 +121,8 @@ aside:
...
@@ -121,6 +121,8 @@ aside:
-
【旁白@正常】已为你找到好友【1】有成熟的植物,能获取一定数量的果实,要去帮助吗?
-
【旁白@正常】已为你找到好友【1】有成熟的植物,能获取一定数量的果实,要去帮助吗?
plant_advise_lack_fruit
:
plant_advise_lack_fruit
:
-
【旁白@正常】当前【1】的果实:【2】不够,
-
【旁白@正常】当前【1】的果实:【2】不够,
plant_advise_buy_fruit_to_plant
:
-
【旁白@正常】购买【1】后,
plant_advise_lack_money
:
plant_advise_lack_money
:
-
【旁白@正常】购买【1】的【2】数量不够,
-
【旁白@正常】购买【1】的【2】数量不够,
plant_advise_lack_material
:
plant_advise_lack_material
:
...
@@ -364,6 +366,8 @@ man:
...
@@ -364,6 +366,8 @@ man:
-
【男园丁@正常】已为你找到好友【1】有成熟的植物,能获取一定数量的果实,要去帮助吗?
-
【男园丁@正常】已为你找到好友【1】有成熟的植物,能获取一定数量的果实,要去帮助吗?
plant_advise_lack_fruit
:
plant_advise_lack_fruit
:
-
【男园丁@正常】当前【1】的果实:【2】不够,
-
【男园丁@正常】当前【1】的果实:【2】不够,
plant_advise_buy_fruit_to_plant
:
-
【男园丁@正常】购买【1】后,
plant_advise_lack_money
:
plant_advise_lack_money
:
-
【男园丁@正常】购买【1】的【2】数量不够,
-
【男园丁@正常】购买【1】的【2】数量不够,
plant_advise_lack_material
:
plant_advise_lack_material
:
...
@@ -613,6 +617,8 @@ woman:
...
@@ -613,6 +617,8 @@ woman:
-
【女园丁@正常】已为你找到好友【1】有成熟的植物,能获取一定数量的果实,要去帮助吗?
-
【女园丁@正常】已为你找到好友【1】有成熟的植物,能获取一定数量的果实,要去帮助吗?
plant_advise_lack_fruit
:
plant_advise_lack_fruit
:
-
【女园丁@正常】当前【1】的果实:【2】不够,
-
【女园丁@正常】当前【1】的果实:【2】不够,
plant_advise_buy_fruit_to_plant
:
-
【女园丁@正常】购买【1】后,
plant_advise_lack_money
:
plant_advise_lack_money
:
-
【女园丁@正常】购买【1】的【2】数量不够,
-
【女园丁@正常】购买【1】的【2】数量不够,
plant_advise_lack_material
:
plant_advise_lack_material
:
...
...
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