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
a8293102
Commit
a8293102
authored
Jun 07, 2022
by
Melledy
Committed by
GitHub
Jun 07, 2022
Browse files
Merge branch 'development' into stable
parents
304b9cb8
ecf7a81a
Changes
410
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/send/PacketGetMailItemRsp.java
View file @
a8293102
...
...
@@ -18,30 +18,32 @@ public class PacketGetMailItemRsp extends BasePacket {
public
PacketGetMailItemRsp
(
Player
player
,
List
<
Integer
>
mailList
)
{
super
(
PacketOpcodes
.
GetMailItemRsp
);
List
<
Mail
>
claimedMessages
=
new
ArrayList
<>();
List
<
EquipParamOuterClass
.
EquipParam
>
claimedItems
=
new
ArrayList
<>();
GetMailItemRsp
.
Builder
proto
=
GetMailItemRsp
.
newBuilder
();
synchronized
(
player
)
{
boolean
modified
=
false
;
for
(
int
mailId
:
mailList
)
{
Mail
message
=
player
.
getMail
(
mailId
);
for
(
Mail
.
MailItem
mailItem
:
message
.
itemList
)
{
if
(!
message
.
isAttachmentGot
)
{
//No duplicated item
for
(
Mail
.
MailItem
mailItem
:
message
.
itemList
)
{
EquipParamOuterClass
.
EquipParam
.
Builder
item
=
EquipParamOuterClass
.
EquipParam
.
newBuilder
();
int
promoteLevel
=
0
;
if
(
mailItem
.
itemLevel
>
20
)
{
// 20/40
promoteLevel
=
1
;
}
else
if
(
mailItem
.
itemLevel
>
40
)
{
// 40/50
promoteLevel
=
2
;
}
else
if
(
mailItem
.
itemLevel
>
50
)
{
// 50/60
promoteLevel
=
3
;
}
else
if
(
mailItem
.
itemLevel
>
60
)
{
// 60/70
promoteLevel
=
4
;
if
(
mailItem
.
itemLevel
>
80
)
{
// 80/90
promoteLevel
=
6
;
}
else
if
(
mailItem
.
itemLevel
>
70
)
{
// 70/80
promoteLevel
=
5
;
}
else
if
(
mailItem
.
itemLevel
>
80
)
{
// 80/90
promoteLevel
=
6
;
}
else
if
(
mailItem
.
itemLevel
>
60
)
{
// 60/70
promoteLevel
=
4
;
}
else
if
(
mailItem
.
itemLevel
>
50
)
{
// 50/60
promoteLevel
=
3
;
}
else
if
(
mailItem
.
itemLevel
>
40
)
{
// 40/50
promoteLevel
=
2
;
}
else
if
(
mailItem
.
itemLevel
>
20
)
{
// 20/40
promoteLevel
=
1
;
}
item
.
setItemId
(
mailItem
.
itemId
);
...
...
@@ -61,9 +63,15 @@ public class PacketGetMailItemRsp extends BasePacket {
claimedMessages
.
add
(
message
);
player
.
replaceMailByIndex
(
mailId
,
message
);
modified
=
true
;
}
}
if
(
modified
)
{
player
.
save
();
}
}
proto
.
addAllMailIdList
(
claimedMessages
.
stream
().
map
(
message
->
player
.
getMailId
(
message
)
).
collect
(
Collectors
.
toList
()));
proto
.
addAllMailIdList
(
claimedMessages
.
stream
().
map
(
player
:
:
getMailId
).
collect
(
Collectors
.
toList
()));
proto
.
addAllItemList
(
claimedItems
);
this
.
setData
(
proto
.
build
());
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.GameConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.friends.Friendship
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
...
...
@@ -12,24 +11,27 @@ import emu.grasscutter.net.proto.GetPlayerFriendListRspOuterClass.GetPlayerFrien
import
emu.grasscutter.net.proto.ProfilePictureOuterClass.ProfilePicture
;
import
emu.grasscutter.net.proto.PlatformTypeOuterClass
;
import
static
emu
.
grasscutter
.
Configuration
.*;
public
class
PacketGetPlayerFriendListRsp
extends
BasePacket
{
public
PacketGetPlayerFriendListRsp
(
Player
player
)
{
super
(
PacketOpcodes
.
GetPlayerFriendListRsp
);
var
serverAccount
=
GAME_INFO
.
serverAccount
;
FriendBrief
serverFriend
=
FriendBrief
.
newBuilder
()
.
setUid
(
GameConstants
.
SERVER_CONSOLE_UID
)
.
setNickname
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
ServerN
ick
n
ame
)
.
setLevel
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
ServerLevel
)
.
setProfilePicture
(
ProfilePicture
.
newBuilder
().
setAvatarId
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
ServerA
vatarId
))
.
setWorldLevel
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
ServerW
orldLevel
)
.
setSignature
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
ServerS
ignature
)
.
setNickname
(
serverAccount
.
n
ick
N
ame
)
.
setLevel
(
serverAccount
.
adventureRank
)
.
setProfilePicture
(
ProfilePicture
.
newBuilder
().
setAvatarId
(
serverAccount
.
a
vatarId
))
.
setWorldLevel
(
serverAccount
.
w
orldLevel
)
.
setSignature
(
serverAccount
.
s
ignature
)
.
setLastActiveTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
f
))
.
setNameCardId
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
ServerN
ameCardId
)
.
setOnlineState
(
FriendOnlineState
.
FRIEND_ONLINE
)
.
setNameCardId
(
serverAccount
.
n
ameCardId
)
.
setOnlineState
(
FriendOnlineState
.
FRIEND_ONLINE
_STATE_ONLINE
)
.
setParam
(
1
)
.
setIsGameSource
(
true
)
.
setPlatformType
(
PlatformTypeOuterClass
.
PlatformType
.
PC
)
.
setPlatformType
(
PlatformTypeOuterClass
.
PlatformType
.
PLATFORM_TYPE_
PC
)
.
build
();
GetPlayerFriendListRsp
.
Builder
proto
=
GetPlayerFriendListRsp
.
newBuilder
().
addFriendList
(
serverFriend
);
...
...
@@ -37,10 +39,12 @@ public class PacketGetPlayerFriendListRsp extends BasePacket {
for
(
Friendship
friendship
:
player
.
getFriendsList
().
getFriends
().
values
())
{
proto
.
addFriendList
(
friendship
.
toProto
());
}
for
(
Friendship
friendship
:
player
.
getFriendsList
().
getPendingFriends
().
values
())
{
if
(
friendship
.
getAskerId
()
==
player
.
getUid
())
{
continue
;
}
proto
.
addAskFriendList
(
friendship
.
toProto
());
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java
View file @
a8293102
...
...
@@ -10,16 +10,16 @@ import emu.grasscutter.utils.Crypto;
public
class
PacketGetPlayerTokenRsp
extends
BasePacket
{
public
PacketGetPlayerTokenRsp
(
GameSession
session
,
boolean
doesPlayerExist
)
{
public
PacketGetPlayerTokenRsp
(
GameSession
session
)
{
super
(
PacketOpcodes
.
GetPlayerTokenRsp
,
true
);
this
.
setUseDispatchKey
(
true
);
GetPlayerTokenRsp
p
=
GetPlayerTokenRsp
.
newBuilder
()
.
setUid
(
session
.
get
Account
().
get
PlayerUid
())
.
setUid
(
session
.
getPlayer
().
get
Uid
())
.
setToken
(
session
.
getAccount
().
getToken
())
.
setAccountType
(
1
)
.
setIsProficientPlayer
(
doesPlayerExist
)
// Not sure where this goes
.
setIsProficientPlayer
(
session
.
getPlayer
().
getAvatars
().
getAvatarCount
()
>
0
)
// Not sure where this goes
.
setSecretKeySeed
(
Crypto
.
ENCRYPT_SEED
)
.
setSecurityCmdBuffer
(
ByteString
.
copyFrom
(
Crypto
.
ENCRYPT_SEED_BUFFER
))
.
setPlatformType
(
3
)
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketGetWidgetSlotRsp.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.GetWidgetSlotRspOuterClass
;
import
emu.grasscutter.net.proto.WidgetSlotDataOuterClass
;
import
emu.grasscutter.net.proto.WidgetSlotTagOuterClass
;
import
java.util.List
;
public
class
PacketGetWidgetSlotRsp
extends
BasePacket
{
public
PacketGetWidgetSlotRsp
(
Player
player
)
{
super
(
PacketOpcodes
.
GetWidgetSlotRsp
);
GetWidgetSlotRspOuterClass
.
GetWidgetSlotRsp
.
Builder
proto
=
GetWidgetSlotRspOuterClass
.
GetWidgetSlotRsp
.
newBuilder
();
if
(
player
.
getWidgetId
()
==
null
)
{
proto
.
addAllSlotList
(
List
.
of
());
}
else
{
proto
.
addSlotList
(
WidgetSlotDataOuterClass
.
WidgetSlotData
.
newBuilder
()
.
setIsActive
(
true
)
.
setMaterialId
(
player
.
getWidgetId
())
.
build
()
);
proto
.
addSlotList
(
WidgetSlotDataOuterClass
.
WidgetSlotData
.
newBuilder
()
.
setTag
(
WidgetSlotTagOuterClass
.
WidgetSlotTag
.
WIDGET_SLOT_TAG_ATTACH_AVATAR
)
.
build
()
);
}
GetWidgetSlotRspOuterClass
.
GetWidgetSlotRsp
protoData
=
proto
.
build
();
this
.
setData
(
protoData
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeChooseModuleRsp.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeChooseModuleRspOuterClass
;
public
class
PacketHomeChooseModuleRsp
extends
BasePacket
{
public
PacketHomeChooseModuleRsp
(
int
moduleId
)
{
super
(
PacketOpcodes
.
HomeChooseModuleRsp
);
HomeChooseModuleRspOuterClass
.
HomeChooseModuleRsp
proto
=
HomeChooseModuleRspOuterClass
.
HomeChooseModuleRsp
.
newBuilder
()
.
setRetcode
(
0
)
.
setModuleId
(
moduleId
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketHomeComfortInfoNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.HomeComfortInfoNotifyOuterClass
;
import
emu.grasscutter.net.proto.HomeModuleComfortInfoOuterClass
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
PacketHomeComfortInfoNotify
extends
BasePacket
{
public
PacketHomeComfortInfoNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
HomeComfortInfoNotify
);
if
(
player
.
getRealmList
()
==
null
)
{
// Do not send
return
;
}
List
<
HomeModuleComfortInfoOuterClass
.
HomeModuleComfortInfo
>
comfortInfoList
=
new
ArrayList
<>();
for
(
int
moduleId
:
player
.
getRealmList
())
{
comfortInfoList
.
add
(
HomeModuleComfortInfoOuterClass
.
HomeModuleComfortInfo
.
newBuilder
()
.
setModuleId
(
moduleId
)
.
build
()
);
}
HomeComfortInfoNotifyOuterClass
.
HomeComfortInfoNotify
proto
=
HomeComfortInfoNotifyOuterClass
.
HomeComfortInfoNotify
.
newBuilder
()
.
addAllModuleInfoList
(
comfortInfoList
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketMailChangeNotify.java
View file @
a8293102
...
...
@@ -37,10 +37,10 @@ public class PacketMailChangeNotify extends BasePacket {
for
(
Mail
.
MailItem
item
:
message
.
itemList
)
{
MailItemOuterClass
.
MailItem
.
Builder
mailItem
=
MailItemOuterClass
.
MailItem
.
newBuilder
();
Item
ParamOuterClass
.
Item
Param
.
Builder
itemParam
=
Item
ParamOuterClass
.
Item
Param
.
newBuilder
();
Equip
ParamOuterClass
.
Equip
Param
.
Builder
itemParam
=
Equip
ParamOuterClass
.
Equip
Param
.
newBuilder
();
itemParam
.
setItemId
(
item
.
itemId
);
itemParam
.
set
Count
(
item
.
itemCount
);
mailItem
.
set
Item
Param
(
itemParam
.
build
());
itemParam
.
set
ItemNum
(
item
.
itemCount
);
mailItem
.
set
Equip
Param
(
itemParam
.
build
());
mailItems
.
add
(
mailItem
.
build
());
}
...
...
@@ -54,7 +54,7 @@ public class PacketMailChangeNotify extends BasePacket {
mailData
.
setImportance
(
message
.
importance
);
mailData
.
setIsRead
(
message
.
isRead
);
mailData
.
setIsAttachmentGot
(
message
.
isAttachmentGot
);
mailData
.
set
State
Value
(
message
.
stateValue
);
mailData
.
set
BHCAHLJIKFF
Value
(
message
.
stateValue
);
proto
.
addMailList
(
mailData
.
build
());
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketMarkMapRsp.java
View file @
a8293102
...
...
@@ -10,7 +10,7 @@ import java.util.*;
public
class
PacketMarkMapRsp
extends
BasePacket
{
public
PacketMarkMapRsp
(
Player
player
,
HashMap
<
String
,
MapMark
>
mapMarks
)
{
public
PacketMarkMapRsp
(
HashMap
<
String
,
MapMark
>
mapMarks
)
{
super
(
PacketOpcodes
.
MarkMapRsp
);
MarkMapRspOuterClass
.
MarkMapRsp
.
Builder
proto
=
MarkMapRspOuterClass
.
MarkMapRsp
.
newBuilder
();
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java
View file @
a8293102
...
...
@@ -23,7 +23,7 @@ public class PacketPlayerEnterSceneNotify extends BasePacket {
.
setSceneId
(
player
.
getSceneId
())
.
setPos
(
player
.
getPos
().
toProto
())
.
setSceneBeginTime
(
System
.
currentTimeMillis
())
.
setType
(
EnterType
.
ENTER_SELF
)
.
setType
(
EnterType
.
ENTER_
TYPE_
SELF
)
.
setTargetUid
(
player
.
getUid
())
.
setEnterSceneToken
(
player
.
getEnterSceneToken
())
.
setWorldLevel
(
player
.
getWorldLevel
())
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerHomeCompInfoNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerHomeCompInfoNotifyOuterClass
;
import
emu.grasscutter.net.proto.PlayerHomeCompInfoOuterClass
;
import
java.util.List
;
public
class
PacketPlayerHomeCompInfoNotify
extends
BasePacket
{
public
PacketPlayerHomeCompInfoNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
PlayerHomeCompInfoNotify
);
if
(
player
.
getRealmList
()
==
null
)
{
// Do not send
return
;
}
PlayerHomeCompInfoNotifyOuterClass
.
PlayerHomeCompInfoNotify
proto
=
PlayerHomeCompInfoNotifyOuterClass
.
PlayerHomeCompInfoNotify
.
newBuilder
()
.
setCompInfo
(
PlayerHomeCompInfoOuterClass
.
PlayerHomeCompInfo
.
newBuilder
()
.
addAllUnlockedModuleIdList
(
player
.
getRealmList
())
.
addAllLevelupRewardGotLevelList
(
List
.
of
(
1
))
// Hardcoded
.
build
()
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java
View file @
a8293102
...
...
@@ -2,7 +2,6 @@ package emu.grasscutter.server.packet.send;
import
com.google.protobuf.ByteString
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter.ServerDebugMode
;
import
emu.grasscutter.Grasscutter.ServerRunMode
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
...
...
@@ -10,11 +9,15 @@ import emu.grasscutter.net.proto.PlayerLoginRspOuterClass.PlayerLoginRsp;
import
emu.grasscutter.net.proto.QueryCurrRegionHttpRspOuterClass
;
import
emu.grasscutter.net.proto.RegionInfoOuterClass.RegionInfo
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.http.dispatch.RegionHandler
;
import
emu.grasscutter.utils.Crypto
;
import
emu.grasscutter.utils.FileUtils
;
import
java.io.File
;
import
java.net.URL
;
import
java.util.Base64
;
import
java.util.Objects
;
import
static
emu
.
grasscutter
.
Configuration
.*;
public
class
PacketPlayerLoginRsp
extends
BasePacket
{
...
...
@@ -27,27 +30,17 @@ public class PacketPlayerLoginRsp extends BasePacket {
RegionInfo
info
;
if
(
Grasscutter
.
getConfig
().
R
unMode
==
ServerRunMode
.
GAME_ONLY
)
{
if
(
SERVER
.
r
unMode
==
ServerRunMode
.
GAME_ONLY
)
{
if
(
regionCache
==
null
)
{
try
{
File
file
=
new
File
(
Grasscutter
.
getConfig
().
DATA_FOLDER
+
"query_cur_region.txt"
);
String
query_cur_region
=
""
;
if
(
file
.
exists
())
{
query_cur_region
=
new
String
(
FileUtils
.
read
(
file
));
}
else
{
Grasscutter
.
getLogger
().
warn
(
"query_cur_region not found! Using default current region."
);
}
byte
[]
decodedCurRegion
=
Base64
.
getDecoder
().
decode
(
query_cur_region
);
QueryCurrRegionHttpRspOuterClass
.
QueryCurrRegionHttpRsp
regionQuery
=
QueryCurrRegionHttpRspOuterClass
.
QueryCurrRegionHttpRsp
.
parseFrom
(
decodedCurRegion
);
RegionInfo
serverRegion
=
regionQuery
.
getRegionInfo
().
toBuilder
()
.
setGateserverIp
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
Ip
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
))
.
setGateserverPort
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
!=
0
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicPort
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
Port
)
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
// todo: we might want to push custom config to client
RegionInfo
serverRegion
=
RegionInfo
.
newBuilder
()
.
setGateserverIp
(
lr
(
GAME_INFO
.
accessAddress
,
GAME_INFO
.
bindAddress
))
.
setGateserverPort
(
lr
(
GAME_INFO
.
accessPort
,
GAME_INFO
.
bindPort
))
.
setSecretKey
(
ByteString
.
copyFrom
(
Crypto
.
DISPATCH_SEED
))
.
build
();
regionCache
=
regionQuery
.
to
Builder
().
setRegionInfo
(
serverRegion
).
build
();
regionCache
=
QueryCurrRegionHttpRspOuterClass
.
QueryCurrRegionHttpRsp
.
new
Builder
().
setRegionInfo
(
serverRegion
).
build
();
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
"Error while initializing region cache!"
,
e
);
}
...
...
@@ -55,7 +48,7 @@ public class PacketPlayerLoginRsp extends BasePacket {
info
=
regionCache
.
getRegionInfo
();
}
else
{
info
=
Grasscutter
.
getDispatchServer
()
.
getCurrRegion
().
getRegionInfo
();
info
=
Objects
.
requireNonNull
(
RegionHandler
.
getCurr
ent
Region
()
)
.
getRegionInfo
();
}
PlayerLoginRsp
p
=
PlayerLoginRsp
.
newBuilder
()
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerStoreNotify.java
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.GameConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.inventory.GameItem
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
...
...
@@ -10,6 +8,8 @@ import emu.grasscutter.net.proto.ItemOuterClass.Item;
import
emu.grasscutter.net.proto.PlayerStoreNotifyOuterClass.PlayerStoreNotify
;
import
emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType
;
import
static
emu
.
grasscutter
.
Configuration
.*;
public
class
PacketPlayerStoreNotify
extends
BasePacket
{
public
PacketPlayerStoreNotify
(
Player
player
)
{
...
...
@@ -18,8 +18,8 @@ public class PacketPlayerStoreNotify extends BasePacket {
this
.
buildHeader
(
2
);
PlayerStoreNotify
.
Builder
p
=
PlayerStoreNotify
.
newBuilder
()
.
setStoreType
(
StoreType
.
STORE_PACK
)
.
setWeightLimit
(
G
rasscutter
.
getConfig
().
getGameServerOptions
().
I
nventoryLimit
A
ll
);
.
setStoreType
(
StoreType
.
STORE_
TYPE_
PACK
)
.
setWeightLimit
(
G
AME_OPTIONS
.
i
nventoryLimit
s
.
a
ll
);
for
(
GameItem
item
:
player
.
getInventory
())
{
Item
itemProto
=
item
.
toProto
();
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerWorldSceneInfoListNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerWorldSceneInfoListNotifyOuterClass.PlayerWorldSceneInfoListNotify
;
import
emu.grasscutter.net.proto.PlayerWorldSceneInfoOuterClass
;
import
emu.grasscutter.net.proto.SceneUnlockInfoOuterClass.SceneUnlockInfo
;
import
static
emu
.
grasscutter
.
net
.
proto
.
PlayerWorldSceneInfoOuterClass
.*;
public
class
PacketPlayerWorldSceneInfoListNotify
extends
BasePacket
{
public
PacketPlayerWorldSceneInfoListNotify
()
{
super
(
PacketOpcodes
.
PlayerWorldSceneInfoListNotify
);
// Rename opcode later
PlayerWorldSceneInfoListNotify
proto
=
PlayerWorldSceneInfoListNotify
.
newBuilder
()
.
addInfoList
(
PlayerWorldSceneInfo
.
newBuilder
()
.
setSceneId
(
1
)
.
setIsLocked
(
false
)
.
build
()
)
.
addInfoList
(
PlayerWorldSceneInfo
.
newBuilder
()
.
setSceneId
(
3
)
.
setIsLocked
(
false
)
.
addSceneTagIdList
(
102
)
.
addSceneTagIdList
(
113
)
.
addSceneTagIdList
(
117
)
.
build
()
)
.
addInfoList
(
PlayerWorldSceneInfo
.
newBuilder
()
.
setSceneId
(
4
)
.
setIsLocked
(
false
)
.
addSceneTagIdList
(
106
)
.
addSceneTagIdList
(
109
)
.
addSceneTagIdList
(
117
)
.
build
()
)
.
addInfoList
(
PlayerWorldSceneInfo
.
newBuilder
()
.
setSceneId
(
5
)
.
setIsLocked
(
false
)
.
build
()
)
.
addInfoList
(
PlayerWorldSceneInfo
.
newBuilder
()
.
setSceneId
(
6
)
.
setIsLocked
(
false
)
.
build
()
)
.
addInfoList
(
PlayerWorldSceneInfo
.
newBuilder
()
.
setSceneId
(
7
)
.
setIsLocked
(
false
)
.
build
()
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPullRecentChatRsp.java
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.Config.GameServerOptions
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.GameConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo
;
import
emu.grasscutter.net.proto.PullRecentChatRspOuterClass.PullRecentChatRsp
;
import
emu.grasscutter.utils.Utils
;
import
static
emu
.
grasscutter
.
Configuration
.*;
public
class
PacketPullRecentChatRsp
extends
BasePacket
{
public
PacketPullRecentChatRsp
(
Player
player
)
{
super
(
PacketOpcodes
.
PullRecentChatRsp
);
GameServerOptions
serverOptions
=
Grasscutter
.
getConfig
().
getGameServer
Options
()
;
var
joinOptions
=
GAME_INFO
.
join
Options
;
PullRecentChatRsp
.
Builder
proto
=
PullRecentChatRsp
.
newBuilder
();
if
(
server
Options
.
W
elcomeEmotes
!=
null
&&
server
Options
.
W
elcomeEmotes
.
length
>
0
)
{
if
(
join
Options
.
w
elcomeEmotes
!=
null
&&
join
Options
.
w
elcomeEmotes
.
length
>
0
)
{
ChatInfo
welcomeEmote
=
ChatInfo
.
newBuilder
()
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setUid
(
GameConstants
.
SERVER_CONSOLE_UID
)
.
setToUid
(
player
.
getUid
())
.
setIcon
(
server
Options
.
W
elcomeEmotes
[
Utils
.
randomRange
(
0
,
server
Options
.
W
elcomeEmotes
.
length
-
1
)])
.
setIcon
(
join
Options
.
w
elcomeEmotes
[
Utils
.
randomRange
(
0
,
join
Options
.
w
elcomeEmotes
.
length
-
1
)])
.
build
();
proto
.
addChatInfo
(
welcomeEmote
);
}
if
(
server
Options
.
W
elcomeM
otd
!=
null
&&
server
Options
.
W
elcomeM
otd
.
length
()
>
0
)
{
ChatInfo
welcomeM
otd
=
ChatInfo
.
newBuilder
()
if
(
join
Options
.
w
elcomeM
essage
!=
null
&&
join
Options
.
w
elcomeM
essage
.
length
()
>
0
)
{
ChatInfo
welcomeM
essage
=
ChatInfo
.
newBuilder
()
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setUid
(
GameConstants
.
SERVER_CONSOLE_UID
)
.
setToUid
(
player
.
getUid
())
.
setText
(
Grasscutter
.
getConfig
().
getGameServer
Options
().
W
elcomeM
otd
)
.
setText
(
join
Options
.
w
elcomeM
essage
)
.
build
();
proto
.
addChatInfo
(
welcomeMotd
);
proto
.
addChatInfo
(
welcomeMessage
);
}
this
.
setData
(
proto
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketQueryCodexMonsterBeKilledNumRsp.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.QueryCodexMonsterBeKilledNumRspOuterClass.QueryCodexMonsterBeKilledNumRsp
;
import
java.util.List
;
public
class
PacketQueryCodexMonsterBeKilledNumRsp
extends
BasePacket
{
public
PacketQueryCodexMonsterBeKilledNumRsp
(
Player
player
,
List
<
Integer
>
codexList
)
{
super
(
PacketOpcodes
.
QueryCodexMonsterBeKilledNumRsp
);
QueryCodexMonsterBeKilledNumRsp
.
Builder
proto
=
QueryCodexMonsterBeKilledNumRsp
.
newBuilder
();
codexList
.
forEach
(
animal
->
{
if
(
player
.
getCodex
().
getUnlockedAnimal
().
containsKey
(
animal
)){
proto
.
addCodexIdList
(
animal
)
.
addBeKilledNumList
(
player
.
getCodex
().
getUnlockedAnimal
().
get
(
animal
))
.
addCHPBKCLKPCJ
(
0
);
}
});
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketQuestListNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.game.quest.QuestManager
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.QuestListNotifyOuterClass.QuestListNotify
;
public
class
PacketQuestListNotify
extends
BasePacket
{
public
PacketQuestListNotify
(
Player
player
)
{
super
(
PacketOpcodes
.
QuestListNotify
,
true
);
QuestListNotify
.
Builder
proto
=
QuestListNotify
.
newBuilder
();
player
.
getQuestManager
().
forEachQuest
(
quest
->
{
proto
.
addQuestList
(
quest
.
toProto
());
});
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketQuestListUpdateNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.game.quest.GameQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.QuestListUpdateNotifyOuterClass.QuestListUpdateNotify
;
public
class
PacketQuestListUpdateNotify
extends
BasePacket
{
public
PacketQuestListUpdateNotify
(
GameQuest
quest
)
{
super
(
PacketOpcodes
.
QuestListUpdateNotify
);
QuestListUpdateNotify
proto
=
QuestListUpdateNotify
.
newBuilder
()
.
addQuestList
(
quest
.
toProto
())
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketQuestProgressUpdateNotify.java
0 → 100644
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.quest.GameMainQuest
;
import
emu.grasscutter.game.quest.GameQuest
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.QuestProgressUpdateNotifyOuterClass.QuestProgressUpdateNotify
;
public
class
PacketQuestProgressUpdateNotify
extends
BasePacket
{
public
PacketQuestProgressUpdateNotify
(
GameQuest
quest
)
{
super
(
PacketOpcodes
.
QuestProgressUpdateNotify
);
QuestProgressUpdateNotify
.
Builder
proto
=
QuestProgressUpdateNotify
.
newBuilder
().
setQuestId
(
quest
.
getQuestId
());
if
(
quest
.
getFinishProgressList
()
!=
null
)
{
for
(
int
i
:
quest
.
getFinishProgressList
())
{
proto
.
addFinishProgressList
(
i
);
}
}
if
(
quest
.
getFailProgressList
()
!=
null
)
{
for
(
int
i
:
quest
.
getFailProgressList
())
{
proto
.
addFailProgressList
(
i
);
}
}
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneEntityAppearNotify.java
View file @
a8293102
...
...
@@ -15,7 +15,7 @@ public class PacketSceneEntityAppearNotify extends BasePacket {
super
(
PacketOpcodes
.
SceneEntityAppearNotify
,
true
);
SceneEntityAppearNotify
.
Builder
proto
=
SceneEntityAppearNotify
.
newBuilder
()
.
setAppearType
(
VisionType
.
VISION_BORN
)
.
setAppearType
(
VisionType
.
VISION_
TYPE_
BORN
)
.
addEntityList
(
entity
.
toProto
());
this
.
setData
(
proto
.
build
());
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java
View file @
a8293102
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.
custom
.ScenePointEntry
;
import
emu.grasscutter.data.
binout
.ScenePointEntry
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
...
...
Prev
1
…
13
14
15
16
17
18
19
20
21
Next
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