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
6e81dc39
Commit
6e81dc39
authored
Apr 21, 2022
by
Magix
Committed by
GitHub
Apr 21, 2022
Browse files
Update Grasscutter to v1.0.0
Merge development into stable (and all the support hell that comes with it).
parents
1456cd99
4e1ea6ab
Changes
103
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java
View file @
6e81dc39
...
@@ -15,26 +15,41 @@ import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
...
@@ -15,26 +15,41 @@ import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
@Opcodes
(
PacketOpcodes
.
MarkMapReq
)
@Opcodes
(
PacketOpcodes
.
MarkMapReq
)
public
class
HandlerMarkMapReq
extends
PacketHandler
{
public
class
HandlerMarkMapReq
extends
PacketHandler
{
private
static
boolean
isInt
(
String
str
)
{
try
{
@SuppressWarnings
(
"unused"
)
int
x
=
Integer
.
parseInt
(
str
);
return
true
;
// String is an Integer
}
catch
(
NumberFormatException
e
)
{
return
false
;
// String is not an Integer
}
}
@Override
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
MarkMapReq
req
=
MarkMapReq
.
parseFrom
(
payload
);
MarkMapReq
req
=
MarkMapReq
.
parseFrom
(
payload
);
if
(
req
.
getOp
()
!=
Operation
.
Add
)
{
if
(
req
.
getOp
()
!=
Operation
.
Add
)
{
return
;
return
;
}
}
session
.
getPlayer
().
getPos
().
setX
(
req
.
getMark
().
getPos
().
getX
());
session
.
getPlayer
().
getPos
().
setX
(
req
.
getMark
().
getPos
().
getX
());
session
.
getPlayer
().
getPos
().
setZ
(
req
.
getMark
().
getPos
().
getZ
());
session
.
getPlayer
().
getPos
().
setZ
(
req
.
getMark
().
getPos
().
getZ
());
session
.
getPlayer
().
getPos
().
setY
(
300
);
session
.
getPlayer
().
getPos
()
Grasscutter
.
getLogger
().
info
(
"Player ["
+
session
.
getPlayer
().
getUid
()
+
":"
+
session
.
getPlayer
().
getNickname
()
+
"] tp to "
+
session
.
getPlayer
().
getPos
()
+
" Scene id: "
+
req
.
getMark
().
getSceneId
());
.
setY
(
isInt
(
req
.
getMark
().
getName
())
?
Integer
.
parseInt
(
req
.
getMark
().
getName
())
:
300
);
Grasscutter
.
getLogger
().
info
(
"Player ["
+
session
.
getPlayer
().
getUid
()
+
":"
+
session
.
getPlayer
().
getNickname
()
+
"] tp to "
+
session
.
getPlayer
().
getPos
()
+
" Scene id: "
+
req
.
getMark
().
getSceneId
());
if
(
req
.
getMark
().
getSceneId
()
!=
session
.
getPlayer
().
getSceneId
())
{
if
(
req
.
getMark
().
getSceneId
()
!=
session
.
getPlayer
().
getSceneId
())
{
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getMark
().
getSceneId
(),
session
.
getPlayer
().
getPos
());
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getMark
().
getSceneId
(),
session
.
getPlayer
().
getPos
());
}
else
{
}
else
{
session
.
getPlayer
().
getScene
().
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
session
.
getPlayer
()));
session
.
getPlayer
().
getScene
().
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
session
.
getPlayer
()));
}
}
}
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java
0 → 100644
View file @
6e81dc39
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.inventory.GenshinItem
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketNpcTalkRsp
;
@Opcodes
(
PacketOpcodes
.
NpcTalkReq
)
public
class
HandlerNpcTalkReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
NpcTalkReq
req
=
NpcTalkReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketNpcTalkRsp
(
req
.
getNpcEntityId
(),
req
.
getTalkId
(),
req
.
getEntityId
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java
View file @
6e81dc39
...
@@ -30,7 +30,7 @@ public class HandlerPlayerLoginReq extends PacketHandler {
...
@@ -30,7 +30,7 @@ public class HandlerPlayerLoginReq extends PacketHandler {
}
}
// Load character from db
// Load character from db
GenshinPlayer
player
=
DatabaseHelper
.
getPlayerById
(
session
.
getAccount
().
getPlayer
I
d
());
GenshinPlayer
player
=
DatabaseHelper
.
getPlayerById
(
session
.
getAccount
().
getPlayer
Ui
d
());
if
(
player
==
null
)
{
if
(
player
==
null
)
{
// Send packets
// Send packets
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneTransToPointReq.java
0 → 100644
View file @
6e81dc39
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.data.GenshinData
;
import
emu.grasscutter.data.custom.ScenePointEntry
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneTransToPointReqOuterClass.SceneTransToPointReq
;
import
emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSceneTransToPointRsp
;
import
emu.grasscutter.utils.Position
;
@Opcodes
(
PacketOpcodes
.
SceneTransToPointReq
)
public
class
HandlerSceneTransToPointReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SceneTransToPointReq
req
=
SceneTransToPointReq
.
parseFrom
(
payload
);
String
code
=
req
.
getSceneId
()
+
"_"
+
req
.
getPointId
();
ScenePointEntry
scenePointEntry
=
GenshinData
.
getScenePointEntries
().
get
(
code
);
if
(
scenePointEntry
!=
null
)
{
float
x
=
scenePointEntry
.
getPointData
().
getTranPos
().
getX
();
float
y
=
scenePointEntry
.
getPointData
().
getTranPos
().
getY
();
float
z
=
scenePointEntry
.
getPointData
().
getTranPos
().
getZ
();
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getSceneId
(),
new
Position
(
x
,
y
,
z
));
session
.
send
(
new
PacketSceneTransToPointRsp
(
session
.
getPlayer
(),
req
.
getPointId
(),
req
.
getSceneId
()));
}
else
{
session
.
send
(
new
PacketSceneTransToPointRsp
());
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java
View file @
6e81dc39
package
emu.grasscutter.server.packet.recv
;
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession
;
...
@@ -10,7 +12,18 @@ public class HandlerSetEntityClientDataNotify extends PacketHandler {
...
@@ -10,7 +12,18 @@ public class HandlerSetEntityClientDataNotify extends PacketHandler {
@Override
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
// Skip if there is no one to broadcast it too
if
(
session
.
getPlayer
().
getScene
().
getPlayerCount
()
<=
1
)
{
return
;
}
// Make sure packet is a valid proto before replaying it to the other players
SetEntityClientDataNotify
notif
=
SetEntityClientDataNotify
.
parseFrom
(
payload
);
GenshinPacket
packet
=
new
GenshinPacket
(
PacketOpcodes
.
SetEntityClientDataNotify
,
true
);
packet
.
setData
(
notif
);
session
.
getPlayer
().
getScene
().
broadcastPacketToOthers
(
session
.
getPlayer
(),
packet
);
}
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java
View file @
6e81dc39
...
@@ -43,7 +43,7 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler {
...
@@ -43,7 +43,7 @@ public class HandlerSetPlayerBornDataReq extends PacketHandler {
try
{
try
{
// Save to db
// Save to db
DatabaseHelper
.
createPlayer
(
player
,
session
.
getAccount
().
getPlayer
I
d
());
DatabaseHelper
.
createPlayer
(
player
,
session
.
getAccount
().
getPlayer
Ui
d
());
// Create avatar
// Create avatar
if
(
player
.
getAvatars
().
getAvatarCount
()
==
0
)
{
if
(
player
.
getAvatars
().
getAvatarCount
()
==
0
)
{
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketAbilityChangeNotify.java
View file @
6e81dc39
...
@@ -8,8 +8,8 @@ import emu.grasscutter.net.proto.AbilityChangeNotifyOuterClass.AbilityChangeNoti
...
@@ -8,8 +8,8 @@ import emu.grasscutter.net.proto.AbilityChangeNotifyOuterClass.AbilityChangeNoti
public
class
PacketAbilityChangeNotify
extends
GenshinPacket
{
public
class
PacketAbilityChangeNotify
extends
GenshinPacket
{
public
PacketAbilityChangeNotify
(
EntityAvatar
entity
)
{
public
PacketAbilityChangeNotify
(
EntityAvatar
entity
)
{
super
(
PacketOpcodes
.
AbilityChangeNotify
);
super
(
PacketOpcodes
.
AbilityChangeNotify
,
true
);
AbilityChangeNotify
proto
=
AbilityChangeNotify
.
newBuilder
()
AbilityChangeNotify
proto
=
AbilityChangeNotify
.
newBuilder
()
.
setEntityId
(
entity
.
getId
())
.
setEntityId
(
entity
.
getId
())
.
setAbilityControlBlock
(
entity
.
getAbilityControlBlock
())
.
setAbilityControlBlock
(
entity
.
getAbilityControlBlock
())
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java
0 → 100644
View file @
6e81dc39
package
emu.grasscutter.server.packet.send
;
import
java.util.List
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry
;
import
emu.grasscutter.net.proto.ClientAbilityInitFinishNotifyOuterClass.ClientAbilityInitFinishNotify
;
public
class
PacketClientAbilityInitFinishNotify
extends
GenshinPacket
{
public
PacketClientAbilityInitFinishNotify
(
List
<
AbilityInvokeEntry
>
entries
)
{
super
(
PacketOpcodes
.
ClientAbilityInitFinishNotify
,
true
);
int
entityId
=
0
;
if
(
entries
.
size
()
>
0
)
{
AbilityInvokeEntry
entry
=
entries
.
get
(
0
);
entityId
=
entry
.
getEntityId
();
}
ClientAbilityInitFinishNotify
proto
=
ClientAbilityInitFinishNotify
.
newBuilder
()
.
setEntityId
(
entityId
)
.
addAllInvokes
(
entries
)
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerFriendListRsp.java
View file @
6e81dc39
...
@@ -23,7 +23,6 @@ public class PacketGetPlayerFriendListRsp extends GenshinPacket {
...
@@ -23,7 +23,6 @@ public class PacketGetPlayerFriendListRsp extends GenshinPacket {
.
setWorldLevel
(
0
)
.
setWorldLevel
(
0
)
.
setSignature
(
""
)
.
setSignature
(
""
)
.
setLastActiveTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
f
))
.
setLastActiveTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
f
))
.
setIsMpModeAvailable
(
true
)
.
setNameCardId
(
210001
)
.
setNameCardId
(
210001
)
.
setOnlineState
(
FriendOnlineState
.
FRIEND_ONLINE
)
.
setOnlineState
(
FriendOnlineState
.
FRIEND_ONLINE
)
.
setParam
(
1
)
.
setParam
(
1
)
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketGetPlayerTokenRsp.java
View file @
6e81dc39
...
@@ -16,7 +16,7 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket {
...
@@ -16,7 +16,7 @@ public class PacketGetPlayerTokenRsp extends GenshinPacket {
this
.
setUseDispatchKey
(
true
);
this
.
setUseDispatchKey
(
true
);
GetPlayerTokenRsp
p
=
GetPlayerTokenRsp
.
newBuilder
()
GetPlayerTokenRsp
p
=
GetPlayerTokenRsp
.
newBuilder
()
.
setPlayerUid
(
session
.
getAccount
().
getPlayer
I
d
())
.
setPlayerUid
(
session
.
getAccount
().
getPlayer
Ui
d
())
.
setAccountToken
(
session
.
getAccount
().
getToken
())
.
setAccountToken
(
session
.
getAccount
().
getToken
())
.
setAccountType
(
1
)
.
setAccountType
(
1
)
.
setIsProficientPlayer
(
doesPlayerExist
)
// Not sure where this goes
.
setIsProficientPlayer
(
doesPlayerExist
)
// Not sure where this goes
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java
0 → 100644
View file @
6e81dc39
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp
;
public
class
PacketNpcTalkRsp
extends
GenshinPacket
{
public
PacketNpcTalkRsp
(
int
npcEntityId
,
int
curTalkId
,
int
entityId
)
{
super
(
PacketOpcodes
.
NpcTalkRsp
);
NpcTalkRsp
p
=
NpcTalkRsp
.
newBuilder
()
.
setNpcEntityId
(
npcEntityId
)
.
setCurTalkId
(
curTalkId
)
.
setEntityId
(
entityId
)
.
build
();
this
.
setData
(
p
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java
View file @
6e81dc39
...
@@ -52,7 +52,7 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket {
...
@@ -52,7 +52,7 @@ public class PacketPlayerEnterSceneNotify extends GenshinPacket {
.
setSceneId
(
newScene
)
.
setSceneId
(
newScene
)
.
setPos
(
newPos
.
toProto
())
.
setPos
(
newPos
.
toProto
())
.
setSceneBeginTime
(
System
.
currentTimeMillis
())
.
setSceneBeginTime
(
System
.
currentTimeMillis
())
.
setType
(
EnterType
.
EnterSelf
)
.
setType
(
type
)
.
setTargetUid
(
target
.
getUid
())
.
setTargetUid
(
target
.
getUid
())
.
setEnterSceneToken
(
player
.
getEnterSceneToken
())
.
setEnterSceneToken
(
player
.
getEnterSceneToken
())
.
setWorldLevel
(
target
.
getWorld
().
getWorldLevel
())
.
setWorldLevel
(
target
.
getWorld
().
getWorldLevel
())
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java
View file @
6e81dc39
package
emu.grasscutter.server.packet.send
;
package
emu.grasscutter.server.packet.send
;
import
com.google.protobuf.ByteString
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerLoginRspOuterClass.PlayerLoginRsp
;
import
emu.grasscutter.net.proto.PlayerLoginRspOuterClass.PlayerLoginRsp
;
import
emu.grasscutter.net.proto.QueryCurrRegionHttpRspOuterClass
;
import
emu.grasscutter.net.proto.RegionInfoOuterClass.RegionInfo
;
import
emu.grasscutter.net.proto.RegionInfoOuterClass.RegionInfo
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.utils.FileUtils
;
import
java.io.File
;
import
java.net.URL
;
import
java.util.Base64
;
public
class
PacketPlayerLoginRsp
extends
GenshinPacket
{
public
class
PacketPlayerLoginRsp
extends
GenshinPacket
{
private
static
QueryCurrRegionHttpRspOuterClass
.
QueryCurrRegionHttpRsp
regionCache
;
public
PacketPlayerLoginRsp
(
GameSession
session
)
{
public
PacketPlayerLoginRsp
(
GameSession
session
)
{
super
(
PacketOpcodes
.
PlayerLoginRsp
,
1
);
super
(
PacketOpcodes
.
PlayerLoginRsp
,
1
);
this
.
setUseDispatchKey
(
true
);
this
.
setUseDispatchKey
(
true
);
RegionInfo
info
=
Grasscutter
.
getDispatchServer
().
getCurrRegion
().
getRegionInfo
();
RegionInfo
info
;
if
(
Grasscutter
.
getConfig
().
RunMode
.
equalsIgnoreCase
(
"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
()
.
setIp
((
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
.
isEmpty
()
?
Grasscutter
.
getConfig
().
getGameServerOptions
().
Ip
:
Grasscutter
.
getConfig
().
getGameServerOptions
().
PublicIp
))
.
setPort
(
Grasscutter
.
getConfig
().
getGameServerOptions
().
Port
)
.
setSecretKey
(
ByteString
.
copyFrom
(
FileUtils
.
read
(
Grasscutter
.
getConfig
().
KEY_FOLDER
+
"dispatchSeed.bin"
)))
.
build
();
regionCache
=
regionQuery
.
toBuilder
().
setRegionInfo
(
serverRegion
).
build
();
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
"Error while initializing region cache!"
,
e
);
}
}
info
=
regionCache
.
getRegionInfo
();
}
else
{
info
=
Grasscutter
.
getDispatchServer
().
getCurrRegion
().
getRegionInfo
();
}
PlayerLoginRsp
p
=
PlayerLoginRsp
.
newBuilder
()
PlayerLoginRsp
p
=
PlayerLoginRsp
.
newBuilder
()
.
setIsUseAbilityHash
(
true
)
// true
.
setIsUseAbilityHash
(
true
)
// true
.
setAbilityHashCode
(
1844674
)
// 1844674
.
setAbilityHashCode
(
1844674
)
// 1844674
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketPlayerStoreNotify.java
View file @
6e81dc39
...
@@ -19,7 +19,7 @@ public class PacketPlayerStoreNotify extends GenshinPacket {
...
@@ -19,7 +19,7 @@ public class PacketPlayerStoreNotify extends GenshinPacket {
PlayerStoreNotify
.
Builder
p
=
PlayerStoreNotify
.
newBuilder
()
PlayerStoreNotify
.
Builder
p
=
PlayerStoreNotify
.
newBuilder
()
.
setStoreType
(
StoreType
.
StorePack
)
.
setStoreType
(
StoreType
.
StorePack
)
.
setWeightLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitAll
);
.
setWeightLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitAll
);
for
(
GenshinItem
item
:
player
.
getInventory
())
{
for
(
GenshinItem
item
:
player
.
getInventory
())
{
Item
itemProto
=
item
.
toProto
();
Item
itemProto
=
item
.
toProto
();
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketPullRecentChatRsp.java
View file @
6e81dc39
package
emu.grasscutter.server.packet.send
;
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.Config.ServerOptions
;
import
emu.grasscutter.Config.
Game
ServerOptions
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.GenshinPlayer
;
...
@@ -14,7 +14,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket {
...
@@ -14,7 +14,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket {
public
PacketPullRecentChatRsp
(
GenshinPlayer
player
)
{
public
PacketPullRecentChatRsp
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
PullRecentChatRsp
);
super
(
PacketOpcodes
.
PullRecentChatRsp
);
ServerOptions
serverOptions
=
Grasscutter
.
getConfig
().
getServerOptions
();
Game
ServerOptions
serverOptions
=
Grasscutter
.
getConfig
().
get
Game
ServerOptions
();
PullRecentChatRsp
.
Builder
proto
=
PullRecentChatRsp
.
newBuilder
();
PullRecentChatRsp
.
Builder
proto
=
PullRecentChatRsp
.
newBuilder
();
if
(
serverOptions
.
WelcomeEmotes
!=
null
&&
serverOptions
.
WelcomeEmotes
.
length
>
0
)
{
if
(
serverOptions
.
WelcomeEmotes
!=
null
&&
serverOptions
.
WelcomeEmotes
.
length
>
0
)
{
...
@@ -33,7 +33,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket {
...
@@ -33,7 +33,7 @@ public class PacketPullRecentChatRsp extends GenshinPacket {
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setTime
((
int
)
(
System
.
currentTimeMillis
()
/
1000
))
.
setUid
(
GenshinConstants
.
SERVER_CONSOLE_UID
)
.
setUid
(
GenshinConstants
.
SERVER_CONSOLE_UID
)
.
setToUid
(
player
.
getUid
())
.
setToUid
(
player
.
getUid
())
.
setText
(
Grasscutter
.
getConfig
().
getServerOptions
().
WelcomeMotd
)
.
setText
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
WelcomeMotd
)
.
build
();
.
build
();
proto
.
addChatInfo
(
welcomeMotd
);
proto
.
addChatInfo
(
welcomeMotd
);
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketSceneAreaWeatherNotify.java
View file @
6e81dc39
...
@@ -12,7 +12,7 @@ public class PacketSceneAreaWeatherNotify extends GenshinPacket {
...
@@ -12,7 +12,7 @@ public class PacketSceneAreaWeatherNotify extends GenshinPacket {
super
(
PacketOpcodes
.
SceneAreaWeatherNotify
);
super
(
PacketOpcodes
.
SceneAreaWeatherNotify
);
SceneAreaWeatherNotify
proto
=
SceneAreaWeatherNotify
.
newBuilder
()
SceneAreaWeatherNotify
proto
=
SceneAreaWeatherNotify
.
newBuilder
()
.
setWeatherAreaId
(
1
)
.
setWeatherAreaId
(
player
.
getScene
().
getWeather
()
)
.
setClimateType
(
player
.
getScene
().
getClimate
().
getValue
())
.
setClimateType
(
player
.
getScene
().
getClimate
().
getValue
())
.
build
();
.
build
();
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketScenePlayerLocationNotify.java
View file @
6e81dc39
package
emu.grasscutter.server.packet.send
;
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.GenshinScene
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify
;
import
emu.grasscutter.net.proto.ScenePlayerLocationNotifyOuterClass.ScenePlayerLocationNotify
;
public
class
PacketScenePlayerLocationNotify
extends
GenshinPacket
{
public
class
PacketScenePlayerLocationNotify
extends
GenshinPacket
{
public
PacketScenePlayerLocationNotify
(
Genshin
Player
player
)
{
public
PacketScenePlayerLocationNotify
(
Genshin
Scene
scene
)
{
super
(
PacketOpcodes
.
ScenePlayerLocationNotify
);
super
(
PacketOpcodes
.
ScenePlayerLocationNotify
);
ScenePlayerLocationNotify
.
Builder
proto
=
ScenePlayerLocationNotify
.
newBuilder
()
ScenePlayerLocationNotify
.
Builder
proto
=
ScenePlayerLocationNotify
.
newBuilder
()
.
setSceneId
(
player
.
getScene
Id
());
.
setSceneId
(
scene
.
get
Id
());
for
(
GenshinPlayer
p
:
player
.
getWorld
()
.
getPlayers
())
{
for
(
GenshinPlayer
p
:
scene
.
getPlayers
())
{
proto
.
addPlayerLocList
(
p
.
getPlayerLocationInfo
());
proto
.
addPlayerLocList
(
p
.
getPlayerLocationInfo
());
}
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketSceneTransToPointRsp.java
0 → 100644
View file @
6e81dc39
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.data.GenshinData
;
import
emu.grasscutter.data.custom.ScenePointEntry
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SceneTransToPointRspOuterClass.SceneTransToPointRsp
;
import
emu.grasscutter.utils.Position
;
public
class
PacketSceneTransToPointRsp
extends
GenshinPacket
{
public
PacketSceneTransToPointRsp
(
GenshinPlayer
player
,
int
pointId
,
int
sceneId
)
{
super
(
PacketOpcodes
.
SceneTransToPointRsp
);
SceneTransToPointRsp
proto
=
SceneTransToPointRsp
.
newBuilder
()
.
setRetcode
(
0
)
.
setPointId
(
pointId
)
.
setSceneId
(
sceneId
)
.
build
();
this
.
setData
(
proto
);
}
public
PacketSceneTransToPointRsp
()
{
super
(
PacketOpcodes
.
SceneTransToPointRsp
);
SceneTransToPointRsp
proto
=
SceneTransToPointRsp
.
newBuilder
()
.
setRetcode
(
1
)
// Internal server error
.
build
();
this
.
setData
(
proto
);
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSceneUnlockInfoNotify.java
View file @
6e81dc39
...
@@ -12,8 +12,8 @@ public class PacketSceneUnlockInfoNotify extends GenshinPacket {
...
@@ -12,8 +12,8 @@ public class PacketSceneUnlockInfoNotify extends GenshinPacket {
SceneUnlockInfoNotify
proto
=
SceneUnlockInfoNotify
.
newBuilder
()
SceneUnlockInfoNotify
proto
=
SceneUnlockInfoNotify
.
newBuilder
()
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
1
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
1
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
3
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
3
)
.
addSceneTagIdList
(
102
).
addSceneTagIdList
(
113
).
addSceneTagIdList
(
117
)
)
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
4
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
4
)
.
addSceneTagIdList
(
106
).
addSceneTagIdList
(
109
)
)
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
5
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
5
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
6
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
6
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
7
))
.
addUnlockInfos
(
SceneUnlockInfo
.
newBuilder
().
setSceneId
(
7
))
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketStoreWeightLimitNotify.java
View file @
6e81dc39
...
@@ -13,11 +13,11 @@ public class PacketStoreWeightLimitNotify extends GenshinPacket {
...
@@ -13,11 +13,11 @@ public class PacketStoreWeightLimitNotify extends GenshinPacket {
StoreWeightLimitNotify
p
=
StoreWeightLimitNotify
.
newBuilder
()
StoreWeightLimitNotify
p
=
StoreWeightLimitNotify
.
newBuilder
()
.
setStoreType
(
StoreType
.
StorePack
)
.
setStoreType
(
StoreType
.
StorePack
)
.
setWeightLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitAll
)
.
setWeightLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitAll
)
.
setWeaponCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitWeapon
)
.
setWeaponCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitWeapon
)
.
setReliquaryCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitRelic
)
.
setReliquaryCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitRelic
)
.
setMaterialCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitMaterial
)
.
setMaterialCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitMaterial
)
.
setFurnitureCountLimit
(
Grasscutter
.
getConfig
().
getServerOptions
().
InventoryLimitFurniture
)
.
setFurnitureCountLimit
(
Grasscutter
.
getConfig
().
get
Game
ServerOptions
().
InventoryLimitFurniture
)
.
build
();
.
build
();
this
.
setData
(
p
);
this
.
setData
(
p
);
...
...
Prev
1
2
3
4
5
6
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