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
1b803042
Commit
1b803042
authored
Sep 22, 2022
by
周君强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.建议系统初步实现
parent
882e0bb4
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
356 additions
and
37 deletions
+356
-37
TimingAcquisition.java
...main/java/com/qiwuai/garden/common/TimingAcquisition.java
+1
-1
AdviseUtil.java
src/main/java/com/qiwuai/garden/common/utils/AdviseUtil.java
+237
-17
HttpUtil.java
src/main/java/com/qiwuai/garden/common/utils/HttpUtil.java
+27
-0
SpeechUtil.java
src/main/java/com/qiwuai/garden/common/utils/SpeechUtil.java
+14
-0
CommonController.java
...n/java/com/qiwuai/garden/controller/CommonController.java
+3
-0
BackPackDto.java
src/main/java/com/qiwuai/garden/dto/BackPackDto.java
+1
-1
FruitToNurseryDto.java
src/main/java/com/qiwuai/garden/dto/FruitToNurseryDto.java
+19
-0
AdviseServiceImpl.java
.../garden/service/adviseService/impl/AdviseServiceImpl.java
+24
-12
BackPackServiceImpl.java
...den/service/backPackService/impl/BackPackServiceImpl.java
+7
-0
GardenerServiceImpl.java
...den/service/gardenerService/impl/GardenerServiceImpl.java
+1
-0
MarketServiceImpl.java
.../garden/service/marketService/impl/MarketServiceImpl.java
+1
-1
PetServiceImpl.java
...qiwuai/garden/service/petService/impl/PetServiceImpl.java
+3
-0
PlantServiceImpl.java
...ai/garden/service/plantService/impl/PlantServiceImpl.java
+12
-3
plant.yaml
src/main/resources/speech/plant.yaml
+6
-2
No files found.
src/main/java/com/qiwuai/garden/common/TimingAcquisition.java
View file @
1b803042
...
@@ -933,7 +933,7 @@ public class TimingAcquisition {
...
@@ -933,7 +933,7 @@ public class TimingAcquisition {
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
feedText
.
deleteCharAt
(
feedText
.
length
()
-
1
);
//获取对应话术
//获取对应话术
text
=
SpeechUtil
.
getMarketSpeech
(
Constants
.
SPEECH_ASIDE
,
"goods_check_type_success"
);
text
=
SpeechUtil
.
getMarketSpeech
(
Constants
.
SPEECH_ASIDE
,
"goods_check_type_success"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemLevelName
,
itemAttribute
,
itemType
,
String
.
valueOf
(
size
),
feedText
.
toString
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemLevelName
,
itemAttribute
,
itemType
,
String
.
valueOf
(
itemIdList
.
size
()
),
feedText
.
toString
());
text
+=
SpeechUtil
.
getMarketSpeech
(
gender
,
"goods_check_type_success"
);
text
+=
SpeechUtil
.
getMarketSpeech
(
gender
,
"goods_check_type_success"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
resultResponse
.
set
后台附加返回
(
"查看商品回复2"
);
resultResponse
.
set
后台附加返回
(
"查看商品回复2"
);
...
...
src/main/java/com/qiwuai/garden/common/utils/AdviseUtil.java
View file @
1b803042
...
@@ -34,6 +34,43 @@ public class AdviseUtil {
...
@@ -34,6 +34,43 @@ public class AdviseUtil {
}
}
/**
/**
* 找到玩家背包里可在空闲花圃种植的果实id
* @param uid
* @return List<FruitToNurseryDto>
*/
public
static
List
<
FruitToNurseryDto
>
getFruitIdsToPlant
(
String
uid
)
{
List
<
FruitToNurseryDto
>
fruitToNurseryList
=
new
ArrayList
<>();
//玩家的所有花圃
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
//找到玩家的空闲花圃,等级从低到高
List
<
Integer
>
freeNurseryNumList
=
findFreeNurseryNum
(
uid
);
//遍历空闲花圃,找到能种植的果实
for
(
Integer
nurseryNum
:
freeNurseryNumList
)
{
List
<
Integer
>
plantIdList
=
findPlantIdByFreeNursery
(
uid
,
nurseryNum
);
for
(
Integer
plantId
:
plantIdList
)
{
boolean
isPlant
=
checkPlantItems
(
uid
,
nurseryNum
,
plantId
);
//该植物可指定花圃中种植
if
(
isPlant
)
{
PlantPojo
plant
=
TimingAcquisition
.
plantMap
.
get
(
plantId
);
//根据花圃类型id找到花圃配置信息
NurseryPojo
nurseryConfig
=
TimingAcquisition
.
nurseryConfigMap
.
get
(
nurseryInfoMap
.
get
(
nurseryNum
).
getId
());
//--------------------玩家技能的花圃容量加成-------------
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
());
FruitToNurseryDto
fruitToNursery
=
new
FruitToNurseryDto
();
fruitToNursery
.
setNurseryNum
(
nurseryNum
);
fruitToNursery
.
setFruitId
(
plant
.
getFruitId
());
fruitToNursery
.
setFruitNum
(
fruitNum
);
fruitToNurseryList
.
add
(
fruitToNursery
);
}
}
}
return
fruitToNurseryList
;
}
/**
* 根据物品ID获取所有对应的宠物id
* 根据物品ID获取所有对应的宠物id
* @param itemId
* @param itemId
* @return List<Integer>
* @return List<Integer>
...
@@ -64,6 +101,39 @@ public class AdviseUtil {
...
@@ -64,6 +101,39 @@ public class AdviseUtil {
}
}
return
nurseryIdList
;
return
nurseryIdList
;
}
}
/**
* 根据植物id找到玩家能种植的所有花圃
* @param uid
* @param plantId
* @return List<Integer>
*/
public
static
List
<
Integer
>
findAllNurseryNumsByPlantId
(
String
uid
,
Integer
plantId
)
{
List
<
Integer
>
nurseryNumList
=
new
ArrayList
<>();
//玩家的所有花圃
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
String
nurseryIds
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getNurseryId
();
if
(
Constants
.
NON_STR
.
equals
(
nurseryIds
))
{
//遍历玩家花圃
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
nurseryNumList
.
add
(
entry
.
getKey
());
}
}
else
{
//指定植物可种植的花圃类型
List
<
Integer
>
nurseryIdList
=
Arrays
.
stream
(
nurseryIds
.
split
(
"\\|"
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
//遍历玩家花圃
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
//玩家有可种植的花圃类型
if
(
nurseryIdList
.
contains
(
nurseryInfo
.
getId
()))
{
nurseryNumList
.
add
(
entry
.
getKey
());
}
}
}
if
(
nurseryNumList
.
size
()
!=
0
)
{
NurseryNumQuickSort
(
uid
,
nurseryNumList
,
0
,
nurseryNumList
.
size
()
-
1
);
}
return
nurseryNumList
;
}
/**
/**
* 根据植物id找到玩家所有可种植的空闲花圃
* 根据植物id找到玩家所有可种植的空闲花圃
...
@@ -76,7 +146,16 @@ public class AdviseUtil {
...
@@ -76,7 +146,16 @@ public class AdviseUtil {
//玩家的所有花圃
//玩家的所有花圃
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
Map
<
Integer
,
NurseryInfoDto
>
nurseryInfoMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
();
String
nurseryIds
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getNurseryId
();
String
nurseryIds
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getNurseryId
();
if
(!
Constants
.
NON_STR
.
equals
(
nurseryIds
))
{
if
(
Constants
.
NON_STR
.
equals
(
nurseryIds
))
{
//遍历玩家花圃
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
//该花圃空闲
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
nurseryNumList
.
add
(
entry
.
getKey
());
}
}
}
else
{
//指定植物可种植的花圃类型
//指定植物可种植的花圃类型
List
<
Integer
>
nurseryIdList
=
Arrays
.
stream
(
nurseryIds
.
split
(
"\\|"
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
nurseryIdList
=
Arrays
.
stream
(
nurseryIds
.
split
(
"\\|"
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
//遍历玩家花圃
//遍历玩家花圃
...
@@ -90,9 +169,9 @@ public class AdviseUtil {
...
@@ -90,9 +169,9 @@ public class AdviseUtil {
}
}
}
}
}
}
if
(
nurseryNumList
.
size
()
!=
0
)
{
NurseryNumQuickSort
(
uid
,
nurseryNumList
,
0
,
nurseryIdList
.
size
()
-
1
);
}
}
if
(
nurseryNumList
.
size
()
!=
0
)
{
NurseryNumQuickSort
(
uid
,
nurseryNumList
,
0
,
nurseryNumList
.
size
()
-
1
);
}
}
return
nurseryNumList
;
return
nurseryNumList
;
}
}
...
@@ -103,7 +182,7 @@ public class AdviseUtil {
...
@@ -103,7 +182,7 @@ public class AdviseUtil {
* @param plantId
* @param plantId
* @return List<Integer>
* @return List<Integer>
*/
*/
public
static
List
<
Integer
>
findNurseryNumsByPlantId
(
String
uid
,
Integer
plantId
)
{
public
static
List
<
Integer
>
find
Up
NurseryNumsByPlantId
(
String
uid
,
Integer
plantId
)
{
List
<
Integer
>
upNurseryNumList
=
new
ArrayList
<>();
List
<
Integer
>
upNurseryNumList
=
new
ArrayList
<>();
List
<
Integer
>
nurseryNumList
=
new
ArrayList
<>();
List
<
Integer
>
nurseryNumList
=
new
ArrayList
<>();
//玩家的所有花圃
//玩家的所有花圃
...
@@ -132,7 +211,7 @@ public class AdviseUtil {
...
@@ -132,7 +211,7 @@ public class AdviseUtil {
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
NurseryInfoDto
>
entry
:
nurseryInfoMap
.
entrySet
())
{
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
NurseryInfoDto
nurseryInfo
=
entry
.
getValue
();
//花圃升级后可种植的花圃
//花圃升级后可种植的花圃
if
(
nurseryIdPathList
.
contains
(
nurseryInfo
.
getId
()))
{
if
(
nurseryIdPathList
.
contains
(
nurseryInfo
.
getId
())
&&
!
upNurseryNumList
.
contains
(
entry
.
getKey
())
)
{
upNurseryNumList
.
add
(
entry
.
getKey
());
upNurseryNumList
.
add
(
entry
.
getKey
());
}
}
}
}
...
@@ -146,14 +225,15 @@ public class AdviseUtil {
...
@@ -146,14 +225,15 @@ public class AdviseUtil {
/**
/**
* 根据玩家花圃编号找到可以种植的植物
* 根据玩家花圃编号找到可以种植的植物
* @param uid
* @param uid
* @param nurseryNum
* @return List<Integer>
* @return List<Integer>
*/
*/
public
static
List
<
Integer
>
findPlantIdByFreeNursery
(
String
uid
,
Integer
nurseryNum
)
{
public
static
List
<
Integer
>
findPlantIdByFreeNursery
(
String
uid
,
Integer
nurseryNum
)
{
List
<
Integer
>
plantIdList
=
new
ArrayList
<>();
List
<
Integer
>
plantIdList
=
new
ArrayList
<>();
//玩家该花圃的信息
//玩家该花圃的信息
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
;
...
@@ -171,6 +251,8 @@ public class AdviseUtil {
...
@@ -171,6 +251,8 @@ public class AdviseUtil {
PlantPojo
plant
=
entry
.
getValue
();
PlantPojo
plant
=
entry
.
getValue
();
String
nurseryIds
=
plant
.
getNurseryId
();
String
nurseryIds
=
plant
.
getNurseryId
();
if
(
Constants
.
NON_STR
.
equals
(
nurseryIds
))
{
if
(
Constants
.
NON_STR
.
equals
(
nurseryIds
))
{
plantIdList
.
add
(
entry
.
getKey
());
}
else
{
//该植物可种植的花圃类型
//该植物可种植的花圃类型
List
<
Integer
>
nurseryIdList
=
Arrays
.
stream
(
nurseryIds
.
split
(
"\\|"
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
nurseryIdList
=
Arrays
.
stream
(
nurseryIds
.
split
(
"\\|"
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
if
(
nurseryIdList
.
contains
(
nurseryId
))
{
if
(
nurseryIdList
.
contains
(
nurseryId
))
{
...
@@ -234,6 +316,26 @@ public class AdviseUtil {
...
@@ -234,6 +316,26 @@ public class AdviseUtil {
double
nurseryCapacity
=
addCapacityPro
.
add
(
new
BigDecimal
(
1
)).
multiply
(
new
BigDecimal
(
nurseryConfig
.
getCapacity
())).
doubleValue
();
double
nurseryCapacity
=
addCapacityPro
.
add
(
new
BigDecimal
(
1
)).
multiply
(
new
BigDecimal
(
nurseryConfig
.
getCapacity
())).
doubleValue
();
//根据植物id找到植物配置信息
//根据植物id找到植物配置信息
PlantPojo
plant
=
TimingAcquisition
.
plantMap
.
get
(
plantId
);
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
;
}
}
//需要的果实数量
//需要的果实数量
int
fruitNum
=
(
int
)
((
nurseryCapacity
/
plant
.
getOccupyArea
())
*
plant
.
getFruitSeedNum
());
int
fruitNum
=
(
int
)
((
nurseryCapacity
/
plant
.
getOccupyArea
())
*
plant
.
getFruitSeedNum
());
//玩家的背包
//玩家的背包
...
@@ -282,6 +384,59 @@ public class AdviseUtil {
...
@@ -282,6 +384,59 @@ public class AdviseUtil {
}
}
/**
/**
* 检查玩家种植plantId时是否存在伴生宠物
* @param uid
* @param plantId
* @return boolean
*/
public
static
boolean
checkNearPet
(
String
uid
,
Integer
plantId
,
Integer
nurseryNum
)
{
Integer
petId
=
TimingAcquisition
.
plantMap
.
get
(
plantId
).
getPetId
();
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
if
(!
StringUtils
.
isEmpty
(
petId
)
&&
!
Constants
.
NON
.
equals
(
petId
))
{
Integer
nurseryPetId
=
nurseryInfo
.
getPetField
();
if
(!
petId
.
equals
(
nurseryPetId
)
||
StringUtils
.
isEmpty
(
nurseryPetId
))
{
}
}
return
false
;
}
/**
* 检查玩家种植是否有足够的货币
* @param uid
* @param plantId
* @return List<Integer>
*/
public
static
boolean
checkPlantMoney
(
String
uid
,
Integer
plantId
)
{
//获取当前玩家的背包
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
.
get
(
moneyType
).
getItems
(
moneyId
);
//植物配置信息
PlantPojo
plant
=
TimingAcquisition
.
plantMap
.
get
(
plantId
);
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
();
if
(
moneyType
.
equals
(
itemType
))
{
if
(
moneyPacket
.
getItemNum
()
>=
item
.
getItemNum
())
{
return
true
;
}
}
}
}
}
return
false
;
}
/**
* 根据现有花圃类型回溯到父节点的所有花圃id(初级花圃)
* 根据现有花圃类型回溯到父节点的所有花圃id(初级花圃)
* @param nurseryId
* @param nurseryId
* @return List<Integer>
* @return List<Integer>
...
@@ -360,7 +515,7 @@ public class AdviseUtil {
...
@@ -360,7 +515,7 @@ public class AdviseUtil {
}
}
/**
/**
* 找到所有空闲花圃编号
* 找到所有空闲花圃编号
,并按花圃等级升序排列
* @param uid
* @param uid
* @return List<Integer>
* @return List<Integer>
*/
*/
...
@@ -381,7 +536,7 @@ public class AdviseUtil {
...
@@ -381,7 +536,7 @@ public class AdviseUtil {
}
}
/**
/**
* 找到有成熟植物的所有花圃编号
* 找到有成熟植物的所有花圃编号
,按花圃等级升序排列
* @param uid
* @param uid
* @return List<Integer>
* @return List<Integer>
*/
*/
...
@@ -405,6 +560,23 @@ public class AdviseUtil {
...
@@ -405,6 +560,23 @@ public class AdviseUtil {
}
}
/**
/**
* 判断指定花圃的植物是否成熟
* @param uid
* @param nurseryNum
* @return boolean
*/
public
static
boolean
checkNurseryNumMature
(
String
uid
,
Integer
nurseryNum
)
{
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
if
(!
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
//植物已成熟
if
(
DateUtil
.
getCurrentTime
().
compareTo
(
nurseryInfo
.
getPlantTime
().
getMatureTime
())
>=
0
)
{
return
true
;
}
}
return
false
;
}
/**
* 按花圃等级升序排列,使用快速排序
* 按花圃等级升序排列,使用快速排序
* @param uid
* @param uid
* @param nurseryNumList
* @param nurseryNumList
...
@@ -488,17 +660,62 @@ public class AdviseUtil {
...
@@ -488,17 +660,62 @@ public class AdviseUtil {
/**
/**
* 根据物品id找到能产生该物品的植物
* 根据物品id找到能产生该物品的植物
* @param itemId
* @param itemId
* @return List<I
temDto
>
* @return List<I
nteger
>
*/
*/
public
static
List
<
I
temDto
>
getPlantIdsByItemId
(
ItemDto
itemId
)
{
public
static
List
<
I
nteger
>
getPlantIdsByItemId
(
Integer
itemId
)
{
List
<
String
>
plantIdList
=
new
ArrayList
<>();
List
<
Integer
>
plantIdList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Integer
,
PlantPojo
>
entry
:
TimingAcquisition
.
plantMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
PlantPojo
>
entry
:
TimingAcquisition
.
plantMap
.
entrySet
())
{
PlantPojo
plant
=
entry
.
getValue
();
PlantPojo
plant
=
entry
.
getValue
();
if
(
plant
.
getFruitId
().
equals
(
itemId
))
{
if
(
plant
.
getFruitId
().
equals
(
itemId
))
{
plantIdList
.
add
(
entry
.
getKey
());
}
else
{
//指定植物有掉落物品
if
(!
Constants
.
NON_STR
.
equals
(
plant
.
getDropItems
()))
{
List
<
Integer
>
dropItemIdList
=
Arrays
.
stream
(
plant
.
getDropItems
().
split
(
"\\|"
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
if
(
dropItemIdList
.
contains
(
itemId
))
{
plantIdList
.
add
(
entry
.
getKey
());
}
}
}
}
return
plantIdList
;
}
/**
* 根据物品id找到能掉落该物品的宠物
* @param itemId
* @return List<Integer>
*/
public
static
List
<
Integer
>
getPetIdsByItemId
(
Integer
itemId
)
{
List
<
Integer
>
petIdList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Integer
,
PetPojo
>
entry
:
TimingAcquisition
.
petConfigMap
.
entrySet
())
{
PetPojo
pet
=
entry
.
getValue
();
//指定宠物有掉落物品
if
(!
Constants
.
NON_STR
.
equals
(
pet
.
getDropItems
()))
{
List
<
Integer
>
dropItemIdList
=
Arrays
.
stream
(
pet
.
getDropItems
().
split
(
"\\|"
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
if
(
dropItemIdList
.
contains
(
itemId
))
{
petIdList
.
add
(
entry
.
getKey
());
}
}
}
return
petIdList
;
}
/**
* 根据物品id找到商店中的商品
* @param itemId
* @return Integer
*/
public
static
Integer
getGoodIdByItemId
(
Integer
itemId
)
{
Integer
goodId
=
null
;
for
(
Map
.
Entry
<
Integer
,
GoodsPojo
>
entry
:
TimingAcquisition
.
goodsConfigMap
.
entrySet
())
{
GoodsPojo
goods
=
entry
.
getValue
();
//商店中有指定物品
if
(
goods
.
getItemId
().
equals
(
itemId
))
{
goodId
=
entry
.
getKey
();
}
}
}
}
return
null
;
return
goodId
;
}
}
...
@@ -515,16 +732,17 @@ public class AdviseUtil {
...
@@ -515,16 +732,17 @@ public class AdviseUtil {
Integer
gardenerLevel
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
();
Integer
gardenerLevel
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGardenerInfo
().
getLevel
();
//园丁下个等级配置信息
//园丁下个等级配置信息
GardenerLevelPojo
gardenerLevelConfig
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
gardenerLevel
+
1
);
GardenerLevelPojo
gardenerLevelConfig
=
TimingAcquisition
.
gardenerLevelMap
.
get
(
gardenerLevel
+
1
);
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
//货币对应种类
Integer
moneyType
=
TimingAcquisition
.
itemConfigMap
.
get
(
moneyId
).
getItemTypeId
();
//园丁升级所需物品
//园丁升级所需物品
List
<
ItemDto
>
upgradeItemList
=
TypeConvertUtil
.
itemString2List
(
gardenerLevelConfig
.
getCostItemNums
());
List
<
ItemDto
>
upgradeItemList
=
TypeConvertUtil
.
itemString2List
(
gardenerLevelConfig
.
getCostItemNums
());
upgradeItemList
.
removeIf
(
itemDto
->
moneyId
.
equals
(
itemDto
.
getItemId
()));
//花圃升级和空闲花圃种植所需物品
//花圃升级和空闲花圃种植所需物品
List
<
ItemDto
>
nurseryItemList
=
new
ArrayList
<>();
List
<
ItemDto
>
nurseryItemList
=
new
ArrayList
<>();
//宠物消耗所需物品
//宠物消耗所需物品
List
<
ItemDto
>
petCostItemList
=
new
ArrayList
<>();
List
<
ItemDto
>
petCostItemList
=
new
ArrayList
<>();
//货币配置信息
Integer
moneyId
=
Integer
.
parseInt
(
TimingAcquisition
.
systemConfigMap
.
get
(
"money"
).
getValue
());
//货币对应种类
Integer
moneyType
=
TimingAcquisition
.
itemConfigMap
.
get
(
moneyId
).
getItemTypeId
();
//获取当前玩家的背包
//获取当前玩家的背包
BackPackDto
backPack
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
();
BackPackDto
backPack
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
();
//种植需要消耗的物品
//种植需要消耗的物品
...
@@ -578,11 +796,13 @@ public class AdviseUtil {
...
@@ -578,11 +796,13 @@ public class AdviseUtil {
if
(!
StringUtils
.
isEmpty
(
nurseryInfo
.
getPetField
()))
{
if
(!
StringUtils
.
isEmpty
(
nurseryInfo
.
getPetField
()))
{
//获取花圃中的宠物
//获取花圃中的宠物
PetPojo
pet
=
TimingAcquisition
.
petConfigMap
.
get
(
nurseryInfo
.
getPetField
());
PetPojo
pet
=
TimingAcquisition
.
petConfigMap
.
get
(
nurseryInfo
.
getPetField
());
if
(!
StringUtils
.
isEmpty
(
pet
.
getFeedCost
())
&&
!
Constants
.
NON_STR
.
equals
(
pet
.
getFeedCost
()))
{
List
<
ItemDto
>
costItemList
=
TypeConvertUtil
.
itemString2List
(
pet
.
getFeedCost
());
List
<
ItemDto
>
costItemList
=
TypeConvertUtil
.
itemString2List
(
pet
.
getFeedCost
());
costItemList
.
removeIf
(
itemDto
->
moneyId
.
equals
(
itemDto
.
getItemId
()));
costItemList
.
removeIf
(
itemDto
->
moneyId
.
equals
(
itemDto
.
getItemId
()));
petCostItemList
=
TypeConvertUtil
.
listMerge
(
petCostItemList
,
costItemList
);
petCostItemList
=
TypeConvertUtil
.
listMerge
(
petCostItemList
,
costItemList
);
}
}
}
}
}
//宠物栏中的宠物
//宠物栏中的宠物
List
<
Integer
>
petFields
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getPetFields
();
List
<
Integer
>
petFields
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getPetFields
();
for
(
Integer
petId
:
petFields
)
{
for
(
Integer
petId
:
petFields
)
{
...
...
src/main/java/com/qiwuai/garden/common/utils/HttpUtil.java
View file @
1b803042
...
@@ -56,6 +56,33 @@ public class HttpUtil {
...
@@ -56,6 +56,33 @@ public class HttpUtil {
log
.
info
(
phraseName
+
"的动态词组更新结果:"
+
forObject
.
getBody
());
log
.
info
(
phraseName
+
"的动态词组更新结果:"
+
forObject
.
getBody
());
}
}
//更新动态词组
public
static
void
doPutCrazyGardener
(
String
phraseName
,
String
phraseContent
)
{
RestTemplate
template
=
new
RestTemplate
();
//获取时间戳
long
timestamp
=
System
.
currentTimeMillis
();
//签名
String
authorization
=
DigestUtils
.
md5Hex
(
appSecret
+
":"
+
timestamp
);
//设置请求体
PhraseRequest
phraseRequest
=
new
PhraseRequest
();
phraseRequest
.
setWorkName
(
"园丁也疯狂"
);
phraseRequest
.
setPhraseName
(
phraseName
);
phraseRequest
.
setPhraseContent
(
phraseContent
);
JSONObject
object
=
new
JSONObject
();
object
.
put
(
"workName"
,
"园丁也疯狂"
);
object
.
put
(
"phraseName"
,
phraseName
);
object
.
put
(
"phraseContent"
,
phraseContent
);
//设置请求头
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
set
(
"Content-Type"
,
"application/json;charset=utf-8"
);
httpHeaders
.
set
(
"Timestamp"
,
String
.
valueOf
(
timestamp
));
httpHeaders
.
set
(
"Authorization"
,
authorization
);
HttpEntity
<
JSONObject
>
request
=
new
HttpEntity
<>(
object
,
httpHeaders
);
ResponseEntity
<
PhraseResponse
>
forObject
=
template
.
exchange
(
updatePhraseUrl
,
HttpMethod
.
PUT
,
request
,
PhraseResponse
.
class
);
log
.
info
(
"《园丁也疯狂》"
+
phraseName
+
"的动态词组更新结果:"
+
forObject
.
getBody
());
}
//获取app用户关联id
//获取app用户关联id
public
static
List
<
Object
>
getInviteUid
(
String
uid
)
{
public
static
List
<
Object
>
getInviteUid
(
String
uid
)
{
RestTemplate
template
=
new
RestTemplate
();
RestTemplate
template
=
new
RestTemplate
();
...
...
src/main/java/com/qiwuai/garden/common/utils/SpeechUtil.java
View file @
1b803042
...
@@ -105,6 +105,20 @@ public class SpeechUtil {
...
@@ -105,6 +105,20 @@ public class SpeechUtil {
}
}
/**
/**
* 从建议模块话术获取话术
* @param someone
* @param feedText
* @return String
*/
public
static
String
getAdviseSpeech
(
String
someone
,
String
feedText
)
{
String
result
=
""
;
List
<
String
>
speech
=
TimingAcquisition
.
adviseSpeechMap
.
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 @
1b803042
...
@@ -716,6 +716,9 @@ public class CommonController {
...
@@ -716,6 +716,9 @@ public class CommonController {
case
"建议指令"
:
case
"建议指令"
:
result
=
adviseServiceProxy
.
adviseWithout
(
operationReq
);
result
=
adviseServiceProxy
.
adviseWithout
(
operationReq
);
break
;
break
;
case
"种植建议指令"
:
result
=
adviseServiceProxy
.
adviseByPlant
(
operationReq
);
break
;
}
}
log
.
info
(
operationReq
.
getUid
()
+
"已完成操作:【"
+
commonRequest
.
getVars
().
get
操作名
()
+
"】"
);
log
.
info
(
operationReq
.
getUid
()
+
"已完成操作:【"
+
commonRequest
.
getVars
().
get
操作名
()
+
"】"
);
return
result
;
return
result
;
...
...
src/main/java/com/qiwuai/garden/dto/BackPackDto.java
View file @
1b803042
...
@@ -63,7 +63,7 @@ public class BackPackDto {
...
@@ -63,7 +63,7 @@ public class BackPackDto {
itemBags
.
put
(
id
,
itemBag
);
//id对应背包中装不同物品类型id的袋子编号
itemBags
.
put
(
id
,
itemBag
);
//id对应背包中装不同物品类型id的袋子编号
}
}
public
ItemBagDto
get
(
int
i
)
{
public
ItemBagDto
get
(
Integer
i
)
{
return
itemBags
.
get
(
i
);
return
itemBags
.
get
(
i
);
}
}
}
}
src/main/java/com/qiwuai/garden/dto/FruitToNurseryDto.java
0 → 100644
View file @
1b803042
package
com
.
qiwuai
.
garden
.
dto
;
import
lombok.Data
;
@Data
public
class
FruitToNurseryDto
{
/**
* 花圃编号
*/
private
Integer
nurseryNum
;
/**
* 果实id
*/
private
Integer
fruitId
;
/**
* 所需果实数量
*/
private
Integer
fruitNum
;
}
src/main/java/com/qiwuai/garden/service/adviseService/impl/AdviseServiceImpl.java
View file @
1b803042
...
@@ -5,10 +5,7 @@ import com.qiwuai.garden.common.TimingAcquisition;
...
@@ -5,10 +5,7 @@ import com.qiwuai.garden.common.TimingAcquisition;
import
com.qiwuai.garden.common.utils.AdviseUtil
;
import
com.qiwuai.garden.common.utils.AdviseUtil
;
import
com.qiwuai.garden.common.utils.SpeechUtil
;
import
com.qiwuai.garden.common.utils.SpeechUtil
;
import
com.qiwuai.garden.common.utils.TypeConvertUtil
;
import
com.qiwuai.garden.common.utils.TypeConvertUtil
;
import
com.qiwuai.garden.dto.BackPackDto
;
import
com.qiwuai.garden.dto.*
;
import
com.qiwuai.garden.dto.ItemBagDto
;
import
com.qiwuai.garden.dto.ItemDto
;
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
;
import
com.qiwuai.garden.dto.base.ResultVarsResponse
;
import
com.qiwuai.garden.dto.base.ResultVarsResponse
;
...
@@ -42,7 +39,7 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -42,7 +39,7 @@ public class AdviseServiceImpl implements AdviseService {
//园丁等级满级
//园丁等级满级
if
(
gardenerLevel
>=
gardenerLevelMax
)
{
if
(
gardenerLevel
>=
gardenerLevelMax
)
{
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
get
Gardener
Speech
(
Constants
.
SPEECH_ASIDE
,
"current_status_advise_success"
);
String
text
=
SpeechUtil
.
get
Advise
Speech
(
Constants
.
SPEECH_ASIDE
,
"current_status_advise_success"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
900101
);
resultResponse
.
set
反馈
ID
(
900101
);
...
@@ -74,6 +71,7 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -74,6 +71,7 @@ public class AdviseServiceImpl implements AdviseService {
if
(
task
.
getEventId
()
==
Constants
.
SEEDING_EVENT
)
{
if
(
task
.
getEventId
()
==
Constants
.
SEEDING_EVENT
)
{
if
(
eventCont
<
task
.
getTimes
())
{
if
(
eventCont
<
task
.
getTimes
())
{
//进入种植植物判定
//进入种植植物判定
}
}
}
}
//2.收获事件对应的任务
//2.收获事件对应的任务
...
@@ -145,7 +143,7 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -145,7 +143,7 @@ public class AdviseServiceImpl implements AdviseService {
}
}
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
get
Gardener
Speech
(
Constants
.
SPEECH_ASIDE
,
"current_status_advise_success"
);
String
text
=
SpeechUtil
.
get
Advise
Speech
(
Constants
.
SPEECH_ASIDE
,
"current_status_advise_success"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
900101
);
resultResponse
.
set
反馈
ID
(
900101
);
...
@@ -164,10 +162,24 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -164,10 +162,24 @@ public class AdviseServiceImpl implements AdviseService {
String
uid
=
operationReq
.
getUid
();
String
uid
=
operationReq
.
getUid
();
Integer
plantId
=
operationReq
.
getPlantId
();
Integer
plantId
=
operationReq
.
getPlantId
();
log
.
info
(
uid
+
"根据指定植物"
+
plantId
+
"来提供建议"
);
log
.
info
(
uid
+
"根据指定植物"
+
plantId
+
"来提供建议"
);
//通过植物id找到能种植的空闲花圃
//根据植物id找到玩家能种植的所有花圃
List
<
Integer
>
nurseryNumList
=
AdviseUtil
.
findFreeNurseryNumsByPlantId
(
uid
,
plantId
);
List
<
Integer
>
nurseryNumList
=
AdviseUtil
.
findAllNurseryNumsByPlantId
(
uid
,
plantId
);
//没有可种植该植物的空闲花圃
//玩家有可种植该植物的花圃
if
(
nurseryNumList
.
size
()
==
0
)
{
if
(
nurseryNumList
.
size
()
!=
0
)
{
for
(
Integer
nurseryNum
:
nurseryNumList
)
{
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
//花圃为空
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
//果实和材料数量是否足够
boolean
isItemEnough
=
AdviseUtil
.
checkPlantItems
(
uid
,
nurseryNum
,
plantId
);
//数量足够
if
(
isItemEnough
)
{
//存在伴生宠物
}
}
}
}
else
{
//玩家没有可种植该植物的花圃
//--------走其他植物的种植流程---------
//--------走其他植物的种植流程---------
//找到花圃等级升序的空闲花圃
//找到花圃等级升序的空闲花圃
List
<
Integer
>
freeNurseryNumList
=
AdviseUtil
.
findFreeNurseryNum
(
uid
);
List
<
Integer
>
freeNurseryNumList
=
AdviseUtil
.
findFreeNurseryNum
(
uid
);
...
@@ -180,7 +192,7 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -180,7 +192,7 @@ public class AdviseServiceImpl implements AdviseService {
//存在可以种植的植物
//存在可以种植的植物
if
(
plantIdList
.
size
()
!=
0
)
{
if
(
plantIdList
.
size
()
!=
0
)
{
//检查玩家是否有可种植的果实和材料
//检查玩家是否有可种植的果实和材料
AdviseUtil
.
checkPlantItems
(
uid
,
nurseryNum
,
plantIdList
.
get
(
0
));
boolean
isPlant
=
AdviseUtil
.
checkPlantItems
(
uid
,
nurseryNum
,
plantIdList
.
get
(
0
));
}
}
}
else
{
}
else
{
//不存在空闲花圃,查找是否有成熟植物的花圃,有则建议收取
//不存在空闲花圃,查找是否有成熟植物的花圃,有则建议收取
...
@@ -194,7 +206,7 @@ public class AdviseServiceImpl implements AdviseService {
...
@@ -194,7 +206,7 @@ public class AdviseServiceImpl implements AdviseService {
}
}
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
get
Gardener
Speech
(
Constants
.
SPEECH_ASIDE
,
"current_status_advise_success"
);
String
text
=
SpeechUtil
.
get
Advise
Speech
(
Constants
.
SPEECH_ASIDE
,
"current_status_advise_success"
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
900101
);
resultResponse
.
set
反馈
ID
(
900101
);
...
...
src/main/java/com/qiwuai/garden/service/backPackService/impl/BackPackServiceImpl.java
View file @
1b803042
...
@@ -5,6 +5,7 @@ import com.qiwuai.garden.common.Constants;
...
@@ -5,6 +5,7 @@ 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.PersistenceUtil
;
import
com.qiwuai.garden.common.utils.SpeechUtil
;
import
com.qiwuai.garden.common.utils.SpeechUtil
;
import
com.qiwuai.garden.dto.BackPackDto
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.GardenerDto
;
import
com.qiwuai.garden.dto.ItemBagDto
;
import
com.qiwuai.garden.dto.ItemBagDto
;
import
com.qiwuai.garden.dto.ItemDto
;
import
com.qiwuai.garden.dto.ItemDto
;
...
@@ -135,6 +136,12 @@ public class BackPackServiceImpl implements BackPackService {
...
@@ -135,6 +136,12 @@ public class BackPackServiceImpl implements BackPackService {
//获取背包中的所有袋子
//获取背包中的所有袋子
Map
<
Integer
,
ItemBagDto
>
itemBags
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
();
Map
<
Integer
,
ItemBagDto
>
itemBags
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
getItemBags
();
//根据种类id取出背包里的对应袋子
//根据种类id取出背包里的对应袋子
ItemBagDto
itemBag
=
itemBags
.
get
(
itemTypeId
);
//背包中没有该种类,则新增袋子
if
(
StringUtils
.
isEmpty
(
itemBag
))
{
itemBag
=
new
ItemBagDto
();
//定义背包里新的袋子
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getBackPack
().
add
(
itemTypeId
,
itemBag
);
}
Map
<
Integer
,
ItemDto
>
bag
=
itemBags
.
get
(
itemTypeId
).
getItemBag
();
Map
<
Integer
,
ItemDto
>
bag
=
itemBags
.
get
(
itemTypeId
).
getItemBag
();
StringBuilder
feedText
=
new
StringBuilder
();
StringBuilder
feedText
=
new
StringBuilder
();
//种类对应物品为空
//种类对应物品为空
...
...
src/main/java/com/qiwuai/garden/service/gardenerService/impl/GardenerServiceImpl.java
View file @
1b803042
...
@@ -220,6 +220,7 @@ public class GardenerServiceImpl implements GardenerService {
...
@@ -220,6 +220,7 @@ public class GardenerServiceImpl implements GardenerService {
}
}
String
address
=
String
.
join
(
"+"
,
playerList
);
String
address
=
String
.
join
(
"+"
,
playerList
);
HttpUtil
.
doPut
(
"项目词组玩家地址"
,
address
);
HttpUtil
.
doPut
(
"项目词组玩家地址"
,
address
);
HttpUtil
.
doPutCrazyGardener
(
"项目词组玩家地址"
,
address
);
}
}
//玩家初始宠物id
//玩家初始宠物id
String
initialPet
=
TimingAcquisition
.
systemConfigMap
.
get
(
"initial_pet"
).
getValue
();
String
initialPet
=
TimingAcquisition
.
systemConfigMap
.
get
(
"initial_pet"
).
getValue
();
...
...
src/main/java/com/qiwuai/garden/service/marketService/impl/MarketServiceImpl.java
View file @
1b803042
...
@@ -1257,7 +1257,7 @@ public class MarketServiceImpl implements MarketService {
...
@@ -1257,7 +1257,7 @@ public class MarketServiceImpl implements MarketService {
}
}
//获取对应话术
//获取对应话术
String
text
=
SpeechUtil
.
getMarketSpeech
(
Constants
.
SPEECH_ASIDE
,
"goods_check_type_success"
);
String
text
=
SpeechUtil
.
getMarketSpeech
(
Constants
.
SPEECH_ASIDE
,
"goods_check_type_success"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemLevelName
,
itemAttribute
,
itemType
,
String
.
valueOf
(
size
),
feedText
.
toString
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
itemLevelName
,
itemAttribute
,
itemType
,
String
.
valueOf
(
itemIdList
.
size
()
),
feedText
.
toString
());
text
+=
SpeechUtil
.
getMarketSpeech
(
gender
,
"goods_check_type_success"
);
text
+=
SpeechUtil
.
getMarketSpeech
(
gender
,
"goods_check_type_success"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
callName
.
getName
(),
callName
.
getSubName
());
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
...
...
src/main/java/com/qiwuai/garden/service/petService/impl/PetServiceImpl.java
View file @
1b803042
...
@@ -2233,6 +2233,9 @@ public class PetServiceImpl implements PetService {
...
@@ -2233,6 +2233,9 @@ public class PetServiceImpl implements PetService {
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
NurseryInfoDto
nurseryInfo
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getGarden
().
getNurseryInfos
().
get
(
nurseryNum
);
nurseryInfo
.
setPetField
(
petId
);
nurseryInfo
.
setPetField
(
petId
);
nurseryInfo
.
setPetCheck
(
Constants
.
PET_UNCHECK
);
nurseryInfo
.
setPetCheck
(
Constants
.
PET_UNCHECK
);
//----------获得宠物累计次数加1---------------
Map
<
Integer
,
Integer
>
taskCountMap
=
TimingAcquisition
.
gardenerMap
.
get
(
uid
).
getTaskCountMap
();
taskCountMap
.
put
(
Constants
.
GET_PET_EVENT
,
taskCountMap
.
get
(
Constants
.
GET_PET_EVENT
)
+
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setCode
(
1
);
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
301004
);
resultResponse
.
set
反馈
ID
(
301004
);
...
...
src/main/java/com/qiwuai/garden/service/plantService/impl/PlantServiceImpl.java
View file @
1b803042
...
@@ -246,12 +246,13 @@ public class PlantServiceImpl implements PlantService {
...
@@ -246,12 +246,13 @@ public class PlantServiceImpl implements PlantService {
//获取对应话术
//获取对应话术
text
=
SpeechUtil
.
getPlantSpeech
(
Constants
.
SPEECH_ASIDE
,
"plant_fail_planted_hava_free"
);
text
=
SpeechUtil
.
getPlantSpeech
(
Constants
.
SPEECH_ASIDE
,
"plant_fail_planted_hava_free"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
plantMap
.
get
(
nurseryInfo
.
getPlantId
()).
getName
(),
nurseryText
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
plantMap
.
get
(
nurseryInfo
.
getPlantId
()).
getName
(),
nurseryText
);
text
+=
SpeechUtil
.
getPlantSpeech
(
gender
,
"plant_fail_planted_hava_free"
);
}
else
{
}
else
{
//获取对应话术
//获取对应话术
text
=
SpeechUtil
.
getPlantSpeech
(
Constants
.
SPEECH_ASIDE
,
"plant_fail_planted_no_free"
);
text
=
SpeechUtil
.
getPlantSpeech
(
Constants
.
SPEECH_ASIDE
,
"plant_fail_planted_no_free"
);
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
plantMap
.
get
(
nurseryInfo
.
getPlantId
()).
getName
());
text
=
SpeechUtil
.
speechReplaceNum
(
text
,
TimingAcquisition
.
plantMap
.
get
(
nurseryInfo
.
getPlantId
()).
getName
());
text
+=
SpeechUtil
.
getPlantSpeech
(
gender
,
"plant_fail_planted_no_free"
);
}
}
text
+=
SpeechUtil
.
getPlantSpeech
(
gender
,
"plant_fail_planted"
);
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
(
"成功"
);
...
@@ -1372,6 +1373,11 @@ public class PlantServiceImpl implements PlantService {
...
@@ -1372,6 +1373,11 @@ public class PlantServiceImpl implements PlantService {
String
gender
=
TimingAcquisition
.
getGardenerGender
(
uid
);
String
gender
=
TimingAcquisition
.
getGardenerGender
(
uid
);
int
count
=
0
;
int
count
=
0
;
TaskResultDto
taskResult
=
new
TaskResultDto
();
TaskResultDto
taskResult
=
new
TaskResultDto
();
if
(!
StringUtils
.
isEmpty
(
nurseryNum
))
{
if
(
nurseryNum
==
Constants
.
REQ_ALL
)
{
nurseryNum
=
null
;
}
}
//玩家称呼
//玩家称呼
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
CallNamePojo
callName
=
TimingAcquisition
.
getCallNameByUid
(
uid
);
//1.仅指定植物id的情况下-“收取某植物的果子”
//1.仅指定植物id的情况下-“收取某植物的果子”
...
@@ -1805,7 +1811,7 @@ public class PlantServiceImpl implements PlantService {
...
@@ -1805,7 +1811,7 @@ public class PlantServiceImpl implements PlantService {
//4.指定花圃id和植物id-“收取某花圃的某某果实”
//4.指定花圃id和植物id-“收取某花圃的某某果实”
//获取花圃类型id
//获取花圃类型id
Integer
nurseryId
=
nurseryInfoMap
.
get
(
nurseryNum
).
getId
();
//
Integer nurseryId = nurseryInfoMap.get(nurseryNum).getId();
//获取指定花圃的信息
//获取指定花圃的信息
NurseryInfoDto
nurseryInfo
=
nurseryInfoMap
.
get
(
nurseryNum
);
NurseryInfoDto
nurseryInfo
=
nurseryInfoMap
.
get
(
nurseryNum
);
if
(
nurseryInfo
.
getUsable
()
==
Constants
.
NURSERY_UNUSABLE
)
{
if
(
nurseryInfo
.
getUsable
()
==
Constants
.
NURSERY_UNUSABLE
)
{
...
@@ -1821,7 +1827,7 @@ public class PlantServiceImpl implements PlantService {
...
@@ -1821,7 +1827,7 @@ public class PlantServiceImpl implements PlantService {
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
}
}
PlantPojo
plantConfig
=
TimingAcquisition
.
plantMap
.
get
(
plantId
);
//
PlantPojo plantConfig = TimingAcquisition.plantMap.get(plantId);
//花圃未种植植物
//花圃未种植植物
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
if
(
StringUtils
.
isEmpty
(
nurseryInfo
.
getPlantId
()))
{
//获取对应话术
//获取对应话术
...
@@ -2485,6 +2491,7 @@ public class PlantServiceImpl implements PlantService {
...
@@ -2485,6 +2491,7 @@ public class PlantServiceImpl implements PlantService {
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
101202
);
resultResponse
.
set
反馈
ID
(
101202
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"查看植物成熟时间回复3"
);
resultVarsResponse
.
setVars
(
resultResponse
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
...
@@ -2571,6 +2578,7 @@ public class PlantServiceImpl implements PlantService {
...
@@ -2571,6 +2578,7 @@ public class PlantServiceImpl implements PlantService {
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
101202
);
resultResponse
.
set
反馈
ID
(
101202
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"查看植物成熟时间回复3"
);
resultVarsResponse
.
setVars
(
resultResponse
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
...
@@ -2695,6 +2703,7 @@ public class PlantServiceImpl implements PlantService {
...
@@ -2695,6 +2703,7 @@ public class PlantServiceImpl implements PlantService {
commonResponse
.
setMsg
(
"成功"
);
commonResponse
.
setMsg
(
"成功"
);
resultResponse
.
set
反馈
ID
(
101202
);
resultResponse
.
set
反馈
ID
(
101202
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
反馈文本
(
text
);
resultResponse
.
set
后台附加返回
(
"查看植物成熟时间回复3"
);
resultVarsResponse
.
setVars
(
resultResponse
);
resultVarsResponse
.
setVars
(
resultResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
commonResponse
.
setData
(
resultVarsResponse
);
return
commonResponse
;
return
commonResponse
;
...
...
src/main/resources/speech/plant.yaml
View file @
1b803042
...
@@ -255,10 +255,12 @@ man:
...
@@ -255,10 +255,12 @@ man:
-
【男园丁@正常】真遗憾,看来我们需要去找找植物果实了。
-
【男园丁@正常】真遗憾,看来我们需要去找找植物果实了。
-
【男园丁@正常】找到植物果实再来种植吧。
-
【男园丁@正常】找到植物果实再来种植吧。
-
【男园丁@正常】看来需要去丰富库存,采购植物果实储备了。
-
【男园丁@正常】看来需要去丰富库存,采购植物果实储备了。
plant_fail_planted
:
plant_fail_planted
_hava_free
:
-
【男园丁@正常】不如我们换其他{花圃称呼}种植吧?
-
【男园丁@正常】不如我们换其他{花圃称呼}种植吧?
-
【男园丁@正常】可以换另一块{花圃称呼}种植。
-
【男园丁@正常】可以换另一块{花圃称呼}种植。
-
【男园丁@正常】看看别的空闲{花圃称呼}吧。
-
【男园丁@正常】看看别的空闲{花圃称呼}吧。
plant_fail_planted_no_free
:
-
【男园丁@正常】【1】,现在暂时没有{花圃称呼}可种,等有{花圃称呼}空闲了再试试吧。
plant_fail_nursery_level
:
plant_fail_nursery_level
:
-
【男园丁@正常】【1】,看来我们还需要再接再厉,努力升级啊!
-
【男园丁@正常】【1】,看来我们还需要再接再厉,努力升级啊!
-
【男园丁@正常】{花圃称呼}的等级还是太低了……【1】,我们要一起努力升级啊。
-
【男园丁@正常】{花圃称呼}的等级还是太低了……【1】,我们要一起努力升级啊。
...
@@ -467,10 +469,12 @@ woman:
...
@@ -467,10 +469,12 @@ woman:
-
【女园丁@正常】晕……居然是没有库存了,我们再去买点吧。
-
【女园丁@正常】晕……居然是没有库存了,我们再去买点吧。
-
【女园丁@正常】去市场买点植物果实再来种植吧【1】!
-
【女园丁@正常】去市场买点植物果实再来种植吧【1】!
-
【女园丁@正常】我们的库存竟然已经这么少了吗?快去买点吧【1】!
-
【女园丁@正常】我们的库存竟然已经这么少了吗?快去买点吧【1】!
plant_fail_planted
:
plant_fail_planted
_hava_free
:
-
【女园丁@正常】【1】,我们之前已经在这块{花圃称呼}上种了别的植物了,换一块试试吧!
-
【女园丁@正常】【1】,我们之前已经在这块{花圃称呼}上种了别的植物了,换一块试试吧!
-
【女园丁@正常】找一找空闲的{花圃称呼}吧。
-
【女园丁@正常】找一找空闲的{花圃称呼}吧。
-
【女园丁@正常】我们还有其他的{花圃称呼}啊!再去种植试试吧!
-
【女园丁@正常】我们还有其他的{花圃称呼}啊!再去种植试试吧!
plant_fail_planted_no_free
:
-
【女园丁@正常】【1】太勤奋了,所有{花圃称呼}都已经种满了耶。
plant_fail_nursery_level
:
plant_fail_nursery_level
:
-
【女园丁@正常】我们的{花圃称呼}等级还差一点点就够升级了……主要我会陪【2】一起加油升级的!
-
【女园丁@正常】我们的{花圃称呼}等级还差一点点就够升级了……主要我会陪【2】一起加油升级的!
-
【女园丁@正常】不要灰心!我会陪着【1】一起给{花圃称呼}升级的!
-
【女园丁@正常】不要灰心!我会陪着【1】一起给{花圃称呼}升级的!
...
...
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