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
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterWorldAreaReq.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.EnterWorldAreaReqOuterClass.EnterWorldAreaReq
;
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.PacketEnterWorldAreaRsp
;
@Opcodes
(
PacketOpcodes
.
EnterWorldAreaReq
)
public
class
HandlerEnterWorldAreaReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PacketHead
head
=
PacketHead
.
parseFrom
(
header
);
EnterWorldAreaReq
enterWorld
=
EnterWorldAreaReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketEnterWorldAreaRsp
(
head
.
getClientSequenceId
(),
enterWorld
));
//session.send(new PacketScenePlayerLocationNotify(session.getPlayer()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEntityAiSyncNotify.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.EntityAiSyncNotifyOuterClass.EntityAiSyncNotify
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketEntityAiSyncNotify
;
@Opcodes
(
PacketOpcodes
.
EntityAiSyncNotify
)
public
class
HandlerEntityAiSyncNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
EntityAiSyncNotify
notify
=
EntityAiSyncNotify
.
parseFrom
(
payload
);
if
(
notify
.
getLocalAvatarAlertedMonsterListCount
()
>
0
)
{
session
.
getPlayer
().
getWorld
().
broadcastPacket
(
new
PacketEntityAiSyncNotify
(
notify
));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAiSyncCombatThreatInfoNotify.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
.
EvtAiSyncCombatThreatInfoNotify
)
public
class
HandlerEvtAiSyncCombatThreatInfoNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAiSyncSkillCdNotify.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
.
EvtAiSyncSkillCdNotify
)
public
class
HandlerEvtAiSyncSkillCdNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtCreateGadgetNotify.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.entity.EntityClientGadget
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtCreateGadgetNotifyOuterClass.EvtCreateGadgetNotify
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
EvtCreateGadgetNotify
)
public
class
HandlerEvtCreateGadgetNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
EvtCreateGadgetNotify
notify
=
EvtCreateGadgetNotify
.
parseFrom
(
payload
);
// Dont handle in singleplayer
if
(!
session
.
getPlayer
().
getWorld
().
isMultiplayer
())
{
return
;
}
// Create entity and summon in world
EntityClientGadget
gadget
=
new
EntityClientGadget
(
session
.
getPlayer
().
getWorld
(),
session
.
getPlayer
(),
notify
);
session
.
getPlayer
().
getWorld
().
onPlayerCreateGadget
(
gadget
);
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtDestroyGadgetNotify.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.EvtDestroyGadgetNotifyOuterClass.EvtDestroyGadgetNotify
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
EvtDestroyGadgetNotify
)
public
class
HandlerEvtDestroyGadgetNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
EvtDestroyGadgetNotify
notify
=
EvtDestroyGadgetNotify
.
parseFrom
(
payload
);
// Dont handle in singleplayer
if
(!
session
.
getPlayer
().
getWorld
().
isMultiplayer
())
{
return
;
}
session
.
getPlayer
().
getWorld
().
onPlayerDestroyGadget
(
notify
.
getEntityId
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGadgetInteractReq.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.GadgetInteractReqOuterClass.GadgetInteractReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
GadgetInteractReq
)
public
class
HandlerGadgetInteractReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GadgetInteractReq
req
=
GadgetInteractReq
.
parseFrom
(
payload
);
session
.
getPlayer
().
interactWith
(
req
.
getGadgetEntityId
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetActivityInfoReq.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.PacketGetActivityInfoRsp
;
@Opcodes
(
PacketOpcodes
.
GetActivityInfoReq
)
public
class
HandlerGetActivityInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetActivityInfoRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAllH5ActivityInfoReq.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.PacketH5ActivityIdsNotify
;
@Opcodes
(
PacketOpcodes
.
GetAllH5ActivityInfoReq
)
public
class
HandlerGetAllH5ActivityInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketH5ActivityIdsNotify
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAllUnlockNameCardReq.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.PacketGetAllUnlockNameCardRsp
;
@Opcodes
(
PacketOpcodes
.
GetAllUnlockNameCardReq
)
public
class
HandlerGetAllUnlockNameCardReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetAllUnlockNameCardRsp
(
session
.
getPlayer
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAuthkeyReq.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.PacketGetAuthkeyRsp
;
@Opcodes
(
PacketOpcodes
.
GetAuthkeyReq
)
public
class
HandlerGetAuthkeyReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetAuthkeyRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetGachaInfoReq.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.PacketGetGachaInfoRsp
;
@Opcodes
(
PacketOpcodes
.
GetGachaInfoReq
)
public
class
HandlerGetGachaInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetGachaInfoRsp
(
session
.
getServer
().
getGachaManager
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerBlacklistReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.GenshinPacket
;
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
.
GetPlayerBlacklistReq
)
public
class
HandlerGetPlayerBlacklistReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
GenshinPacket
(
PacketOpcodes
.
GetPlayerBlacklistRsp
).
buildHeader
(
3
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerFriendListReq.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.PacketGetPlayerFriendListRsp
;
@Opcodes
(
PacketOpcodes
.
GetPlayerFriendListReq
)
public
class
HandlerGetPlayerFriendListReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
//session.send(new PacketGetPlayerAskFriendListRsp(session.getPlayer()));
session
.
send
(
new
PacketGetPlayerFriendListRsp
(
session
.
getPlayer
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerSocialDetailReq.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.GetPlayerSocialDetailReqOuterClass.GetPlayerSocialDetailReq
;
import
emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetPlayerSocialDetailRsp
;
@Opcodes
(
PacketOpcodes
.
GetPlayerSocialDetailReq
)
public
class
HandlerGetPlayerSocialDetailReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetPlayerSocialDetailReq
req
=
GetPlayerSocialDetailReq
.
parseFrom
(
payload
);
SocialDetail
.
Builder
detail
=
session
.
getServer
().
getSocialDetailById
(
req
.
getUid
());
if
(
detail
!=
null
)
{
detail
.
setIsFriend
(
session
.
getPlayer
().
getFriendsList
().
isFriendsWith
(
req
.
getUid
()));
}
session
.
send
(
new
PacketGetPlayerSocialDetailRsp
(
detail
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerTokenReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass.GetPlayerTokenReq
;
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.PacketGetPlayerTokenRsp
;
@Opcodes
(
PacketOpcodes
.
GetPlayerTokenReq
)
public
class
HandlerGetPlayerTokenReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetPlayerTokenReq
req
=
GetPlayerTokenReq
.
parseFrom
(
payload
);
// Authenticate
Account
account
=
DatabaseHelper
.
getAccountById
(
req
.
getAccountUid
());
if
(
account
==
null
)
{
return
;
}
// Check token
if
(!
account
.
getToken
().
equals
(
req
.
getAccountToken
()))
{
return
;
}
// Set account
session
.
setAccount
(
account
);
session
.
setUseSecretKey
(
true
);
session
.
setState
(
SessionState
.
WAITING_FOR_LOGIN
);
// Has character
boolean
doesPlayerExist
=
false
;
if
(
account
.
getPlayerId
()
>
0
)
{
// Set flag for player existing
doesPlayerExist
=
DatabaseHelper
.
checkPlayerExists
(
account
.
getPlayerId
());
}
// Set reserve player id if account doesnt exist
if
(!
doesPlayerExist
)
{
int
id
=
DatabaseHelper
.
getNextPlayerId
(
session
.
getAccount
().
getPlayerId
());
if
(
id
!=
session
.
getAccount
().
getPlayerId
())
{
session
.
getAccount
().
setPlayerId
(
id
);
session
.
getAccount
().
save
();
}
}
// Send packet
session
.
send
(
new
PacketGetPlayerTokenRsp
(
session
,
doesPlayerExist
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetRegionSearchReq.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
.
GetRegionSearchReq
)
public
class
HandlerGetRegionSearchReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetSceneAreaReq.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.GetSceneAreaReqOuterClass.GetSceneAreaReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetSceneAreaRsp
;
@Opcodes
(
PacketOpcodes
.
GetSceneAreaReq
)
public
class
HandlerGetSceneAreaReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetSceneAreaReq
req
=
GetSceneAreaReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketGetSceneAreaRsp
(
req
.
getSceneId
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetScenePointReq.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.GetScenePointReqOuterClass.GetScenePointReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetScenePointRsp
;
@Opcodes
(
PacketOpcodes
.
GetScenePointReq
)
public
class
HandlerGetScenePointReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetScenePointReq
req
=
GetScenePointReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketGetScenePointRsp
(
req
.
getSceneId
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetShopReq.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.GetShopReqOuterClass.GetShopReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetShopRsp
;
@Opcodes
(
PacketOpcodes
.
GetShopReq
)
public
class
HandlerGetShopReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetShopReq
req
=
GetShopReq
.
parseFrom
(
payload
);
// TODO
session
.
send
(
new
PacketGetShopRsp
(
req
.
getShopType
()));
}
}
Prev
1
…
5
6
7
8
9
10
11
12
13
…
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