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
7925d1cd
Commit
7925d1cd
authored
Apr 17, 2022
by
Melledy
Browse files
Initial commit
parents
Changes
354
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetShopmallDataReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetShopmallDataRsp
;
@Opcodes
(
PacketOpcodes
.
GetShopmallDataReq
)
public
class
HandlerGetShopmallDataReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// TODO add the correct shops
session
.
send
(
new
PacketGetShopmallDataRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetWidgetSlotReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
GetWidgetSlotReq
)
public
class
HandlerGetWidgetSlotReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Unhandled
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetWorldMpInfoReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetWorldMpInfoRsp
;
@Opcodes
(
PacketOpcodes
.
GetWorldMpInfoReq
)
public
class
HandlerGetWorldMpInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetWorldMpInfoRsp
(
session
.
getPlayer
().
getWorld
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.MarkMapReqOuterClass.MarkMapReq
;
import
emu.grasscutter.net.proto.OperationOuterClass.Operation
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify
;
@Opcodes
(
PacketOpcodes
.
MarkMapReq
)
public
class
HandlerMarkMapReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
MarkMapReq
req
=
MarkMapReq
.
parseFrom
(
payload
);
if
(
req
.
getOp
()
!=
Operation
.
Add
)
{
return
;
}
session
.
getPlayer
().
getPos
().
setX
(
req
.
getMark
().
getPos
().
getX
());
session
.
getPlayer
().
getPos
().
setZ
(
req
.
getMark
().
getPos
().
getZ
());
session
.
getPlayer
().
getPos
().
setY
(
300
);
Grasscutter
.
getLogger
().
info
(
"Player ["
+
session
.
getPlayer
().
getId
()
+
":"
+
session
.
getPlayer
().
getNickname
()
+
"] tp to "
+
session
.
getPlayer
().
getPos
());
session
.
getPlayer
().
getWorld
().
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
session
.
getPlayer
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerMonsterAIConfigHashNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
MonsterAIConfigHashNotify
)
public
class
HandlerMonsterAIConfigHashNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerObstacleModifyNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
ObstacleModifyNotify
)
public
class
HandlerObstacleModifyNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPathfindingEnterSceneReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPathfindingEnterSceneRsp
;
@Opcodes
(
PacketOpcodes
.
PathfindingEnterSceneReq
)
public
class
HandlerPathfindingEnterSceneReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PacketHead
head
=
PacketHead
.
parseFrom
(
header
);
session
.
send
(
new
PacketPathfindingEnterSceneRsp
(
head
.
getClientSequenceId
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPingReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead
;
import
emu.grasscutter.net.proto.PingReqOuterClass.PingReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPingRsp
;
@Opcodes
(
PacketOpcodes
.
PingReq
)
public
class
HandlerPingReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PacketHead
head
=
PacketHead
.
parseFrom
(
header
);
PingReq
ping
=
PingReq
.
parseFrom
(
payload
);
session
.
updateLastPingTime
(
ping
.
getClientTime
());
session
.
send
(
new
PacketPingRsp
(
head
.
getClientSequenceId
(),
ping
.
getClientTime
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerApplyEnterMpReqOuterClass.PlayerApplyEnterMpReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPlayerApplyEnterMpRsp
;
@Opcodes
(
PacketOpcodes
.
PlayerApplyEnterMpReq
)
public
class
HandlerPlayerApplyEnterMpReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PlayerApplyEnterMpReq
req
=
PlayerApplyEnterMpReq
.
parseFrom
(
payload
);
session
.
getServer
().
getMultiplayerManager
().
applyEnterMp
(
session
.
getPlayer
(),
req
.
getTargetUid
());
session
.
send
(
new
PacketPlayerApplyEnterMpRsp
(
req
.
getTargetUid
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerApplyEnterMpResultReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerApplyEnterMpResultReqOuterClass.PlayerApplyEnterMpResultReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPlayerApplyEnterMpResultRsp
;
@Opcodes
(
PacketOpcodes
.
PlayerApplyEnterMpResultReq
)
public
class
HandlerPlayerApplyEnterMpResultReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PlayerApplyEnterMpResultReq
req
=
PlayerApplyEnterMpResultReq
.
parseFrom
(
payload
);
session
.
getServer
().
getMultiplayerManager
().
applyEnterMpReply
(
session
.
getPlayer
(),
req
.
getApplyUid
(),
req
.
getIsAgreed
());
session
.
send
(
new
PacketPlayerApplyEnterMpResultRsp
(
req
.
getApplyUid
(),
req
.
getIsAgreed
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerChatReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo
;
import
emu.grasscutter.net.proto.PlayerChatReqOuterClass.PlayerChatReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPlayerChatRsp
;
@Opcodes
(
PacketOpcodes
.
PlayerChatReq
)
public
class
HandlerPlayerChatReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PlayerChatReq
req
=
PlayerChatReq
.
parseFrom
(
payload
);
ChatInfo
.
ContentCase
content
=
req
.
getChatInfo
().
getContentCase
();
if
(
content
==
ChatInfo
.
ContentCase
.
TEXT
)
{
session
.
getServer
().
getChatManager
().
sendTeamChat
(
session
.
getPlayer
(),
req
.
getChannelId
(),
req
.
getChatInfo
().
getText
());
}
else
if
(
content
==
ChatInfo
.
ContentCase
.
ICON
)
{
session
.
getServer
().
getChatManager
().
sendTeamChat
(
session
.
getPlayer
(),
req
.
getChannelId
(),
req
.
getChatInfo
().
getIcon
());
}
session
.
send
(
new
PacketPlayerChatRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerForceExitReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
PlayerForceExitReq
)
public
class
HandlerPlayerForceExitReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Client should auto disconnect right now
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerGetForceQuitBanInfoReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPlayerGetForceQuitBanInfoRsp
;
@Opcodes
(
PacketOpcodes
.
PlayerGetForceQuitBanInfoReq
)
public
class
HandlerPlayerGetForceQuitBanInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
if
(
session
.
getServer
().
getMultiplayerManager
().
leaveCoop
(
session
.
getPlayer
()))
{
// Success
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
0
));
}
else
{
// Fail
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
1
));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerLoginReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerLoginReqOuterClass.PlayerLoginReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession.SessionState
;
import
emu.grasscutter.server.packet.send.PacketPlayerLoginRsp
;
@Opcodes
(
PacketOpcodes
.
PlayerLoginReq
)
// Sends initial data packets
public
class
HandlerPlayerLoginReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Check
if
(
session
.
getAccount
()
==
null
)
{
return
;
}
// Parse request
PlayerLoginReq
req
=
PlayerLoginReq
.
parseFrom
(
payload
);
// Authenticate session
if
(!
req
.
getToken
().
equals
(
session
.
getAccount
().
getToken
()))
{
return
;
}
// Load character from db
GenshinPlayer
player
=
DatabaseHelper
.
getPlayerById
(
session
.
getAccount
().
getPlayerId
());
if
(
player
==
null
)
{
// Send packets
session
.
setState
(
SessionState
.
PICKING_CHARACTER
);
session
.
send
(
new
GenshinPacket
(
PacketOpcodes
.
DoSetPlayerBornDataNotify
));
}
else
{
// Set character
session
.
setPlayer
(
player
);
// Login done
session
.
getPlayer
().
onLogin
();
session
.
setState
(
SessionState
.
ACTIVE
);
}
// Final packet to tell client logging in is done
session
.
send
(
new
PacketPlayerLoginRsp
(
session
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerSetPauseReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead
;
import
emu.grasscutter.net.proto.PlayerSetPauseReqOuterClass.PlayerSetPauseReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPlayerSetPauseRsp
;
@Opcodes
(
PacketOpcodes
.
PlayerSetPauseReq
)
public
class
HandlerPlayerSetPauseReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PacketHead
head
=
PacketHead
.
parseFrom
(
header
);
PlayerSetPauseReq
req
=
PlayerSetPauseReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketPlayerSetPauseRsp
(
head
.
getClientSequenceId
()));
session
.
getPlayer
().
setPaused
(
req
.
getIsPaused
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPostEnterSceneReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPostEnterSceneRsp
;
@Opcodes
(
PacketOpcodes
.
PostEnterSceneReq
)
public
class
HandlerPostEnterSceneReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketPostEnterSceneRsp
(
session
.
getPlayer
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPrivateChatReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PrivateChatReqOuterClass.PrivateChatReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
PrivateChatReq
)
public
class
HandlerPrivateChatReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PrivateChatReq
req
=
PrivateChatReq
.
parseFrom
(
payload
);
PrivateChatReq
.
ContentCase
content
=
req
.
getContentCase
();
if
(
content
==
PrivateChatReq
.
ContentCase
.
TEXT
)
{
session
.
getServer
().
getChatManager
().
sendPrivChat
(
session
.
getPlayer
(),
req
.
getTargetUid
(),
req
.
getText
());
}
else
if
(
content
==
PrivateChatReq
.
ContentCase
.
ICON
)
{
session
.
getServer
().
getChatManager
().
sendPrivChat
(
session
.
getPlayer
(),
req
.
getTargetUid
(),
req
.
getIcon
());
}
//session.send(new GenshinPacket(PacketOpcodes.PrivateChatRsp)); // Unused by server
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPullPrivateChatReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PullPrivateChatReqOuterClass.PullPrivateChatReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPullPrivateChatRsp
;
@Opcodes
(
PacketOpcodes
.
PullPrivateChatReq
)
public
class
HandlerPullPrivateChatReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PullPrivateChatReq
req
=
PullPrivateChatReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketPullPrivateChatRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPullRecentChatReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPullRecentChatRsp
;
@Opcodes
(
PacketOpcodes
.
PullRecentChatReq
)
public
class
HandlerPullRecentChatReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketPullRecentChatRsp
(
session
.
getPlayer
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerQueryPathReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
QueryPathReq
)
public
class
HandlerQueryPathReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
}
}
Prev
1
…
6
7
8
9
10
11
12
13
14
…
18
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