Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
211d7d6f
Commit
211d7d6f
authored
Jun 16, 2022
by
Akka
Committed by
Melledy
Jun 17, 2022
Browse files
implement furniture make system
parent
7a247e70
Changes
19
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/GameData.java
View file @
211d7d6f
...
...
@@ -87,6 +87,8 @@ public class GameData {
private
static
final
Int2ObjectMap
<
TowerLevelData
>
towerLevelDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
TowerScheduleData
>
towerScheduleDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
ForgeData
>
forgeDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
HomeWorldLevelData
>
homeWorldLevelDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
FurnitureMakeConfigData
>
furnitureMakeConfigDataMap
=
new
Int2ObjectOpenHashMap
<>();
// Cache
private
static
Map
<
Integer
,
List
<
Integer
>>
fetters
=
new
HashMap
<>();
...
...
@@ -377,4 +379,10 @@ public class GameData {
public
static
Int2ObjectMap
<
ForgeData
>
getForgeDataMap
()
{
return
forgeDataMap
;
}
public
static
Int2ObjectMap
<
HomeWorldLevelData
>
getHomeWorldLevelDataMap
()
{
return
homeWorldLevelDataMap
;
}
public
static
Int2ObjectMap
<
FurnitureMakeConfigData
>
getFurnitureMakeConfigDataMap
()
{
return
furnitureMakeConfigDataMap
;
}
}
src/main/java/emu/grasscutter/data/excels/FurnitureMakeConfigData.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.data.excels
;
import
emu.grasscutter.data.GameResource
;
import
emu.grasscutter.data.ResourceType
;
import
emu.grasscutter.data.common.ItemParamData
;
import
lombok.AccessLevel
;
import
lombok.Getter
;
import
lombok.experimental.FieldDefaults
;
import
java.util.List
;
@Getter
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@ResourceType
(
name
=
{
"FurnitureMakeExcelConfigData.json"
})
public
class
FurnitureMakeConfigData
extends
GameResource
{
int
configID
;
int
furnitureItemID
;
int
count
;
int
exp
;
List
<
ItemParamData
>
materialItems
;
int
makeTime
;
int
maxAccelerateTime
;
int
quickFetchMaterialNum
;
@Override
public
int
getId
()
{
return
configID
;
}
@Override
public
void
onLoad
()
{
this
.
materialItems
=
materialItems
.
stream
()
.
filter
(
x
->
x
.
getId
()
>
0
)
.
toList
();
}
}
src/main/java/emu/grasscutter/data/excels/HomeWorldLevelData.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.data.excels
;
import
emu.grasscutter.data.GameResource
;
import
emu.grasscutter.data.ResourceType
;
import
lombok.AccessLevel
;
import
lombok.Getter
;
import
lombok.experimental.FieldDefaults
;
import
java.util.List
;
@Getter
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@ResourceType
(
name
=
{
"HomeworldLevelExcelConfigData.json"
})
public
class
HomeWorldLevelData
extends
GameResource
{
int
level
;
int
exp
;
int
homeCoinStoreLimit
;
int
homeFetterExpStoreLimit
;
int
rewardId
;
int
furnitureMakeSlotCount
;
int
outdoorUnlockBlockCount
;
int
freeUnlockModuleCount
;
int
deployNpcCount
;
int
limitShopGoodsCount
;
List
<
String
>
levelFuncs
;
@Override
public
int
getId
()
{
return
level
;
}
@Override
public
void
onLoad
()
{
super
.
onLoad
();
}
}
src/main/java/emu/grasscutter/game/home/FurnitureMakeSlotItem.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.game.home
;
import
dev.morphia.annotations.Entity
;
import
dev.morphia.annotations.Id
;
import
emu.grasscutter.net.proto.FurnitureMakeDataOuterClass
;
import
emu.grasscutter.net.proto.FurnitureMakeSlotOuterClass
;
import
lombok.AccessLevel
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.experimental.FieldDefaults
;
@Entity
@Data
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Builder
(
builderMethodName
=
"of"
)
public
class
FurnitureMakeSlotItem
{
@Id
int
index
;
int
makeId
;
int
avatarId
;
int
beginTime
;
int
durTime
;
public
FurnitureMakeDataOuterClass
.
FurnitureMakeData
toProto
()
{
return
FurnitureMakeDataOuterClass
.
FurnitureMakeData
.
newBuilder
()
.
setIndex
(
index
)
.
setAvatarId
(
avatarId
)
.
setMakeId
(
makeId
)
.
setBeginTime
(
beginTime
)
.
setDurTime
(
durTime
)
.
build
();
}
}
src/main/java/emu/grasscutter/game/home/GameHome.java
View file @
211d7d6f
...
...
@@ -6,6 +6,7 @@ import dev.morphia.annotations.IndexOptions;
import
dev.morphia.annotations.Indexed
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.excels.HomeWorldLevelData
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.server.packet.send.*
;
...
...
@@ -14,6 +15,7 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.experimental.FieldDefaults
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
@Entity
(
value
=
"homes"
,
useDiscriminator
=
false
)
...
...
@@ -28,6 +30,9 @@ public class GameHome {
@Indexed
(
options
=
@IndexOptions
(
unique
=
true
))
long
ownerUid
;
int
level
;
int
exp
;
List
<
FurnitureMakeSlotItem
>
furnitureMakeSlotItemList
;
ConcurrentHashMap
<
Integer
,
HomeSceneItem
>
sceneMap
;
public
void
save
(){
...
...
@@ -45,6 +50,7 @@ public class GameHome {
public
static
GameHome
create
(
Integer
uid
){
return
GameHome
.
of
()
.
ownerUid
(
uid
)
.
level
(
1
)
.
sceneMap
(
new
ConcurrentHashMap
<>())
.
build
();
}
...
...
@@ -65,6 +71,10 @@ public class GameHome {
player
.
getSession
().
send
(
new
PacketPlayerHomeCompInfoNotify
(
player
));
player
.
getSession
().
send
(
new
PacketHomeComfortInfoNotify
(
player
));
player
.
getSession
().
send
(
new
PacketFurnitureCurModuleArrangeCountNotify
());
player
.
getSession
().
send
(
new
PacketHomeMarkPointNotify
(
player
,
this
));
player
.
getSession
().
send
(
new
PacketHomeMarkPointNotify
(
player
));
}
public
HomeWorldLevelData
getLevelData
(){
return
GameData
.
getHomeWorldLevelDataMap
().
get
(
level
);
}
}
src/main/java/emu/grasscutter/game/home/HomeSceneItem.java
View file @
211d7d6f
...
...
@@ -4,7 +4,6 @@ import dev.morphia.annotations.Entity;
import
dev.morphia.annotations.Id
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.binout.HomeworldDefaultSaveData
;
import
emu.grasscutter.net.proto.HomeBasicInfoOuterClass.HomeBasicInfo
;
import
emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo
;
import
emu.grasscutter.utils.Position
;
import
lombok.AccessLevel
;
...
...
src/main/java/emu/grasscutter/game/managers/FurnitureManager.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.game.managers
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.common.ItemParamData
;
import
emu.grasscutter.game.home.FurnitureMakeSlotItem
;
import
emu.grasscutter.game.inventory.GameItem
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.proto.ItemParamOuterClass
;
import
emu.grasscutter.net.proto.RetcodeOuterClass.Retcode
;
import
emu.grasscutter.server.packet.send.*
;
import
emu.grasscutter.utils.Utils
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
FurnitureManager
{
private
final
Player
player
;
public
FurnitureManager
(
Player
player
)
{
this
.
player
=
player
;
}
public
void
onLogin
(){
notifyUnlockFurniture
();
notifyUnlockFurnitureSuite
();
}
public
void
notifyUnlockFurniture
(){
player
.
getSession
().
send
(
new
PacketUnlockedFurnitureFormulaDataNotify
(
player
.
getUnlockedFurniture
()));
}
public
void
notifyUnlockFurnitureSuite
(){
player
.
getSession
().
send
(
new
PacketUnlockedFurnitureSuiteDataNotify
(
player
.
getUnlockedFurnitureSuite
()));
}
public
synchronized
boolean
unlockFurnitureOrSuite
(
GameItem
useItem
){
// Check
if
(!
List
.
of
(
"ITEM_USE_UNLOCK_FURNITURE_FORMULA"
,
"ITEM_USE_UNLOCK_FURNITURE_SUITE"
)
.
contains
(
useItem
.
getItemData
().
getItemUse
().
get
(
0
).
getUseOp
()))
{
return
false
;
}
int
furnitureIdOrSuiteId
=
Integer
.
parseInt
(
useItem
.
getItemData
().
getItemUse
().
get
(
0
).
getUseParam
().
get
(
0
));
// Remove first
player
.
getInventory
().
removeItem
(
useItem
,
1
);
if
(
"ITEM_USE_UNLOCK_FURNITURE_FORMULA"
.
equals
(
useItem
.
getItemData
().
getItemUse
().
get
(
0
).
getUseOp
())){
player
.
getUnlockedFurniture
().
add
(
furnitureIdOrSuiteId
);
notifyUnlockFurniture
();
}
else
{
player
.
getUnlockedFurnitureSuite
().
add
(
furnitureIdOrSuiteId
);
notifyUnlockFurnitureSuite
();
}
return
true
;
}
public
void
startMake
(
int
makeId
,
int
avatarId
)
{
var
makeData
=
GameData
.
getFurnitureMakeConfigDataMap
().
get
(
makeId
);
if
(
makeData
==
null
){
player
.
getSession
().
send
(
new
PacketFurnitureMakeStartRsp
(
Retcode
.
RET_FURNITURE_MAKE_CONFIG_ERROR_VALUE
,
null
));
return
;
}
// check slot count
if
(
player
.
getHome
().
getLevelData
().
getFurnitureMakeSlotCount
()
<=
player
.
getHome
().
getFurnitureMakeSlotItemList
().
size
()){
player
.
getSession
().
send
(
new
PacketFurnitureMakeStartRsp
(
Retcode
.
RET_FURNITURE_MAKE_SLOT_FULL_VALUE
,
null
));
return
;
}
// pay items first
if
(!
player
.
getInventory
().
payItems
(
makeData
.
getMaterialItems
().
toArray
(
new
ItemParamData
[
0
]))){
player
.
getSession
().
send
(
new
PacketFurnitureMakeStartRsp
(
Retcode
.
RET_HOME_FURNITURE_COUNT_NOT_ENOUGH_VALUE
,
null
));
return
;
}
var
furnitureSlot
=
FurnitureMakeSlotItem
.
of
()
.
avatarId
(
avatarId
)
.
makeId
(
makeId
)
.
beginTime
(
Utils
.
getCurrentSeconds
())
.
durTime
(
makeData
.
getMakeTime
())
.
build
();
// add furniture make task
player
.
getHome
().
getFurnitureMakeSlotItemList
().
add
(
furnitureSlot
);
player
.
getSession
().
send
(
new
PacketFurnitureMakeStartRsp
(
Retcode
.
RET_SUCC_VALUE
,
player
.
getHome
().
getFurnitureMakeSlotItemList
().
stream
()
.
map
(
FurnitureMakeSlotItem:
:
toProto
)
.
toList
()
));
player
.
getHome
().
save
();
}
public
void
queryStatus
()
{
if
(
player
.
getHome
().
getFurnitureMakeSlotItemList
()
==
null
){
player
.
getHome
().
setFurnitureMakeSlotItemList
(
new
ArrayList
<>());
}
player
.
sendPacket
(
new
PacketFurnitureMakeRsp
(
player
.
getHome
()));
}
public
void
take
(
int
index
,
int
makeId
,
boolean
isFastFinish
)
{
var
makeData
=
GameData
.
getFurnitureMakeConfigDataMap
().
get
(
makeId
);
if
(
makeData
==
null
){
player
.
getSession
().
send
(
new
PacketTakeFurnitureMakeRsp
(
Retcode
.
RET_FURNITURE_MAKE_CONFIG_ERROR_VALUE
,
makeId
,
null
,
null
));
return
;
}
var
slotItem
=
player
.
getHome
().
getFurnitureMakeSlotItemList
().
stream
()
.
filter
(
x
->
x
.
getIndex
()
==
index
&&
x
.
getMakeId
()
==
makeId
)
.
findFirst
();
if
(
slotItem
.
isEmpty
()){
player
.
getSession
().
send
(
new
PacketTakeFurnitureMakeRsp
(
Retcode
.
RET_FURNITURE_MAKE_NO_MAKE_DATA_VALUE
,
makeId
,
null
,
null
));
return
;
}
// pay the speedup item
if
(
isFastFinish
&&
!
player
.
getInventory
().
payItem
(
107013
,
1
)){
player
.
getSession
().
send
(
new
PacketTakeFurnitureMakeRsp
(
Retcode
.
RET_FURNITURE_MAKE_UNFINISH_VALUE
,
makeId
,
null
,
null
));
return
;
}
// check if player can take
if
(
slotItem
.
get
().
getBeginTime
()
+
slotItem
.
get
().
getDurTime
()
>=
Utils
.
getCurrentSeconds
()
&&
!
isFastFinish
){
player
.
getSession
().
send
(
new
PacketTakeFurnitureMakeRsp
(
Retcode
.
RET_FURNITURE_MAKE_UNFINISH_VALUE
,
makeId
,
null
,
null
));
return
;
}
player
.
getInventory
().
addItem
(
makeData
.
getFurnitureItemID
(),
makeData
.
getCount
());
player
.
getHome
().
getFurnitureMakeSlotItemList
().
remove
(
slotItem
.
get
());
player
.
getSession
().
send
(
new
PacketTakeFurnitureMakeRsp
(
Retcode
.
RET_SUCC_VALUE
,
makeId
,
List
.
of
(
ItemParamOuterClass
.
ItemParam
.
newBuilder
()
.
setItemId
(
makeData
.
getFurnitureItemID
())
.
setCount
(
makeData
.
getCount
())
.
build
()),
player
.
getHome
().
getFurnitureMakeSlotItemList
().
stream
()
.
map
(
FurnitureMakeSlotItem:
:
toProto
)
.
toList
()
));
player
.
getHome
().
save
();
}
}
src/main/java/emu/grasscutter/game/managers/InventoryManager.java
View file @
211d7d6f
...
...
@@ -6,7 +6,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.binout.OpenConfigEntry
;
import
emu.grasscutter.data.binout.OpenConfigEntry.SkillPointModifier
;
...
...
@@ -22,14 +21,12 @@ import emu.grasscutter.data.excels.AvatarSkillDepotData.InherentProudSkillOpens;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.inventory.GameItem
;
import
emu.grasscutter.game.inventory.ItemType
;
import
emu.grasscutter.game.inventory.MaterialType
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.props.ActionReason
;
import
emu.grasscutter.game.shop.ShopChestBatchUseTable
;
import
emu.grasscutter.game.shop.ShopChestTable
;
import
emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam
;
import
emu.grasscutter.net.proto.MaterialInfoOuterClass.MaterialInfo
;
import
emu.grasscutter.server.packet.send.PacketForgeFormulaDataNotify
;
import
emu.grasscutter.server.game.GameServer
;
import
emu.grasscutter.server.packet.send.*
;
import
emu.grasscutter.utils.Utils
;
...
...
@@ -861,6 +858,14 @@ public class InventoryManager {
// Unlock.
useSuccess
=
player
.
getServer
().
getCombineManger
().
unlockCombineDiagram
(
player
,
useItem
);
}
break
;
case
MATERIAL_FURNITURE_FORMULA:
case
MATERIAL_FURNITURE_SUITE_FORMULA:
if
(
useItem
.
getItemData
().
getItemUse
()
==
null
)
{
break
;
}
useSuccess
=
player
.
getFurnitureManager
().
unlockFurnitureOrSuite
(
useItem
);
break
;
case
MATERIAL_CONSUME_BATCH_USE:
// Make sure we have usage data for this material.
...
...
src/main/java/emu/grasscutter/game/player/Player.java
View file @
211d7d6f
...
...
@@ -27,6 +27,7 @@ import emu.grasscutter.game.inventory.GameItem;
import
emu.grasscutter.game.inventory.Inventory
;
import
emu.grasscutter.game.mail.Mail
;
import
emu.grasscutter.game.mail.MailHandler
;
import
emu.grasscutter.game.managers.FurnitureManager
;
import
emu.grasscutter.game.managers.InsectCaptureManager
;
import
emu.grasscutter.game.managers.ResinManager
;
import
emu.grasscutter.game.managers.deforestation.DeforestationManager
;
...
...
@@ -99,6 +100,8 @@ public class Player {
private
Set
<
Integer
>
costumeList
;
private
Set
<
Integer
>
unlockedForgingBlueprints
;
private
Set
<
Integer
>
unlockedCombines
;
private
Set
<
Integer
>
unlockedFurniture
;
private
Set
<
Integer
>
unlockedFurnitureSuite
;
private
List
<
ActiveForgeData
>
activeForges
;
private
Integer
widgetId
;
...
...
@@ -167,6 +170,7 @@ public class Player {
@Transient
private
ForgingManager
forgingManager
;
@Transient
private
DeforestationManager
deforestationManager
;
@Transient
private
GameHome
home
;
@Transient
private
FurnitureManager
furnitureManager
;
private
long
springLastUsed
;
private
HashMap
<
String
,
MapMark
>
mapMarks
;
...
...
@@ -202,6 +206,8 @@ public class Player {
this
.
towerData
=
new
TowerData
();
this
.
unlockedForgingBlueprints
=
new
HashSet
<>();
this
.
unlockedCombines
=
new
HashSet
<>();
this
.
unlockedFurniture
=
new
HashSet
<>();
this
.
unlockedFurnitureSuite
=
new
HashSet
<>();
this
.
activeForges
=
new
ArrayList
<>();
this
.
setSceneId
(
3
);
...
...
@@ -228,6 +234,7 @@ public class Player {
this
.
energyManager
=
new
EnergyManager
(
this
);
this
.
resinManager
=
new
ResinManager
(
this
);
this
.
forgingManager
=
new
ForgingManager
(
this
);
this
.
furnitureManager
=
new
FurnitureManager
(
this
);
}
// On player creation
...
...
@@ -261,6 +268,7 @@ public class Player {
this
.
resinManager
=
new
ResinManager
(
this
);
this
.
deforestationManager
=
new
DeforestationManager
(
this
);
this
.
forgingManager
=
new
ForgingManager
(
this
);
this
.
furnitureManager
=
new
FurnitureManager
(
this
);
}
public
int
getUid
()
{
...
...
@@ -565,6 +573,14 @@ public class Player {
return
this
.
unlockedCombines
;
}
public
Set
<
Integer
>
getUnlockedFurniture
()
{
return
unlockedFurniture
;
}
public
Set
<
Integer
>
getUnlockedFurnitureSuite
()
{
return
unlockedFurnitureSuite
;
}
public
List
<
ActiveForgeData
>
getActiveForges
()
{
return
this
.
activeForges
;
}
...
...
@@ -1183,6 +1199,10 @@ public class Player {
return
this
.
forgingManager
;
}
public
FurnitureManager
getFurnitureManager
()
{
return
furnitureManager
;
}
public
AbilityManager
getAbilityManager
()
{
return
abilityManager
;
}
...
...
@@ -1335,6 +1355,7 @@ public class Player {
getTodayMoonCard
();
// The timer works at 0:0, some users log in after that, use this method to check if they have received a reward today or not. If not, send the reward.
this
.
furnitureManager
.
onLogin
();
// Home
home
=
GameHome
.
getByUid
(
getUid
());
home
.
onOwnerLogin
(
this
);
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerFurnitureMakeReq.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
FurnitureMakeReq
)
public
class
HandlerFurnitureMakeReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
getPlayer
().
getFurnitureManager
().
queryStatus
();
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerFurnitureMakeStartReq.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FurnitureMakeStartReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
FurnitureMakeStartReq
)
public
class
HandlerFurnitureMakeStartReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
var
req
=
FurnitureMakeStartReqOuterClass
.
FurnitureMakeStartReq
.
parseFrom
(
payload
);
session
.
getPlayer
().
getFurnitureManager
().
startMake
(
req
.
getMakeId
(),
req
.
getAvatarId
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerHomeSceneJumpReq.java
View file @
211d7d6f
...
...
@@ -24,7 +24,7 @@ public class HandlerHomeSceneJumpReq extends PacketHandler {
Scene
scene
=
session
.
getPlayer
().
getWorld
().
getSceneById
(
req
.
getIsEnterRoomScene
()
?
homeScene
.
getRoomSceneId
()
:
realmId
);
Position
pos
=
scene
.
getScriptManager
().
getConfig
().
born_pos
;
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getIsEnterRoomScene
()
?
homeScene
.
getRoomSceneId
()
:
realmId
,
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerTakeFurnitureMakeReq.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.TakeFurnitureMakeReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
TakeFurnitureMakeReq
)
public
class
HandlerTakeFurnitureMakeReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
var
req
=
TakeFurnitureMakeReqOuterClass
.
TakeFurnitureMakeReq
.
parseFrom
(
payload
);
session
.
getPlayer
().
getFurnitureManager
().
take
(
req
.
getIndex
(),
req
.
getMakeId
(),
req
.
getIsFastFinish
());
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureMakeRsp.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.home.FurnitureMakeSlotItem
;
import
emu.grasscutter.game.home.GameHome
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FurnitureMakeRspOuterClass
;
import
emu.grasscutter.net.proto.FurnitureMakeSlotOuterClass
;
public
class
PacketFurnitureMakeRsp
extends
BasePacket
{
public
PacketFurnitureMakeRsp
(
GameHome
home
)
{
super
(
PacketOpcodes
.
FurnitureMakeRsp
);
var
proto
=
FurnitureMakeRspOuterClass
.
FurnitureMakeRsp
.
newBuilder
();
proto
.
setFurnitureMakeSlot
(
FurnitureMakeSlotOuterClass
.
FurnitureMakeSlot
.
newBuilder
()
.
addAllFurnitureMakeDataList
(
home
.
getFurnitureMakeSlotItemList
().
stream
()
.
map
(
FurnitureMakeSlotItem:
:
toProto
)
.
toList
())
.
build
());
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketFurnitureMakeStartRsp.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FurnitureMakeDataOuterClass
;
import
emu.grasscutter.net.proto.FurnitureMakeSlotOuterClass
;
import
emu.grasscutter.net.proto.FurnitureMakeStartRspOuterClass
;
import
java.util.List
;
public
class
PacketFurnitureMakeStartRsp
extends
BasePacket
{
public
PacketFurnitureMakeStartRsp
(
int
ret
,
List
<
FurnitureMakeDataOuterClass
.
FurnitureMakeData
>
furnitureMakeData
)
{
super
(
PacketOpcodes
.
FurnitureMakeStartRsp
);
var
proto
=
FurnitureMakeStartRspOuterClass
.
FurnitureMakeStartRsp
.
newBuilder
();
proto
.
setRetcode
(
ret
);
if
(
furnitureMakeData
!=
null
){
proto
.
setFurnitureMakeSlot
(
FurnitureMakeSlotOuterClass
.
FurnitureMakeSlot
.
newBuilder
()
.
addAllFurnitureMakeDataList
(
furnitureMakeData
)
.
build
());
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeMarkPointNotify.java
View file @
211d7d6f
...
...
@@ -12,13 +12,16 @@ import java.util.Collection;
public
class
PacketHomeMarkPointNotify
extends
BasePacket
{
public
PacketHomeMarkPointNotify
(
Player
player
,
GameHome
home
)
{
public
PacketHomeMarkPointNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
HomeMarkPointNotify
);
var
proto
=
HomeMarkPointNotifyOuterClass
.
HomeMarkPointNotify
.
newBuilder
();
if
(
player
.
getRealmList
()
==
null
){
return
;
}
for
(
var
moduleId
:
player
.
getRealmList
()){
var
homeScene
=
h
ome
.
getHomeSceneItem
(
moduleId
+
2000
);
var
homeScene
=
player
.
getH
ome
()
.
getHomeSceneItem
(
moduleId
+
2000
);
var
markPointData
=
HomeMarkPointSceneDataOuterClass
.
HomeMarkPointSceneData
.
newBuilder
()
.
setModuleId
(
moduleId
)
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketTakeFurnitureMakeRsp.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.common.ItemParamData
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.FurnitureMakeDataOuterClass
;
import
emu.grasscutter.net.proto.FurnitureMakeSlotOuterClass
;
import
emu.grasscutter.net.proto.ItemParamOuterClass
;
import
emu.grasscutter.net.proto.TakeFurnitureMakeRspOuterClass
;
import
java.util.List
;
public
class
PacketTakeFurnitureMakeRsp
extends
BasePacket
{
public
PacketTakeFurnitureMakeRsp
(
int
ret
,
int
makeId
,
List
<
ItemParamOuterClass
.
ItemParam
>
output
,
List
<
FurnitureMakeDataOuterClass
.
FurnitureMakeData
>
others
)
{
super
(
PacketOpcodes
.
TakeFurnitureMakeRsp
);
var
proto
=
TakeFurnitureMakeRspOuterClass
.
TakeFurnitureMakeRsp
.
newBuilder
();
proto
.
setRetcode
(
ret
)
.
setMakeId
(
makeId
);
if
(
output
!=
null
){
proto
.
addAllOutputItemList
(
output
);
}
if
(
others
!=
null
){
proto
.
setFurnitureMakeSlot
(
FurnitureMakeSlotOuterClass
.
FurnitureMakeSlot
.
newBuilder
()
.
addAllFurnitureMakeDataList
(
others
)
.
build
());
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketUnlockedFurnitureFormulaDataNotify.java
View file @
211d7d6f
...
...
@@ -4,22 +4,16 @@ import emu.grasscutter.net.packet.BasePacket;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.UnlockedFurnitureFormulaDataNotifyOuterClass
;
import
java.util.Set
;
public
class
PacketUnlockedFurnitureFormulaDataNotify
extends
BasePacket
{
public
PacketUnlockedFurnitureFormulaDataNotify
()
{
public
PacketUnlockedFurnitureFormulaDataNotify
(
Set
<
Integer
>
unlockList
)
{
super
(
PacketOpcodes
.
UnlockedFurnitureFormulaDataNotify
);
var
proto
=
UnlockedFurnitureFormulaDataNotifyOuterClass
.
UnlockedFurnitureFormulaDataNotify
.
newBuilder
();
proto
.
addFurnitureIdList
(
361207
);
proto
.
addFurnitureIdList
(
362202
);
proto
.
addFurnitureIdList
(
362304
);
proto
.
addFurnitureIdList
(
363102
);
proto
.
addFurnitureIdList
(
363103
);
proto
.
addFurnitureIdList
(
363203
);
proto
.
addFurnitureIdList
(
370201
);
proto
.
addFurnitureIdList
(
370302
);
proto
.
addAllFurnitureIdList
(
unlockList
);
proto
.
setIsAll
(
true
);
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketUnlockedFurnitureSuiteDataNotify.java
0 → 100644
View file @
211d7d6f
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.UnlockedFurnitureSuiteDataNotifyOuterClass
;
import
java.util.Set
;
public
class
PacketUnlockedFurnitureSuiteDataNotify
extends
BasePacket
{
public
PacketUnlockedFurnitureSuiteDataNotify
(
Set
<
Integer
>
unlockList
)
{
super
(
PacketOpcodes
.
UnlockedFurnitureSuiteDataNotify
);
var
proto
=
UnlockedFurnitureSuiteDataNotifyOuterClass
.
UnlockedFurnitureSuiteDataNotify
.
newBuilder
();
proto
.
addAllFurnitureSuiteIdList
(
unlockList
);
proto
.
setIsAll
(
true
);
this
.
setData
(
proto
);
}
}
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