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/HandlerReliquaryUpgradeReq.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.ReliquaryUpgradeReqOuterClass.ReliquaryUpgradeReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
ReliquaryUpgradeReq
)
public
class
HandlerReliquaryUpgradeReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
ReliquaryUpgradeReq
req
=
ReliquaryUpgradeReq
.
parseFrom
(
payload
);
session
.
getServer
().
getInventoryManager
().
upgradeRelic
(
session
.
getPlayer
(),
req
.
getTargetReliquaryGuid
(),
req
.
getFoodReliquaryGuidListList
(),
req
.
getItemParamListList
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneInitFinishReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.GenshinPlayer.SceneLoadState
;
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
;
import
emu.grasscutter.server.packet.send.PacketHostPlayerNotify
;
import
emu.grasscutter.server.packet.send.PacketPlayerEnterSceneInfoNotify
;
import
emu.grasscutter.server.packet.send.PacketPlayerGameTimeNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneInitFinishRsp
;
import
emu.grasscutter.server.packet.send.PacketScenePlayerInfoNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneTeamUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneTimeNotify
;
import
emu.grasscutter.server.packet.send.PacketServerTimeNotify
;
import
emu.grasscutter.server.packet.send.PacketSyncScenePlayTeamEntityNotify
;
import
emu.grasscutter.server.packet.send.PacketSyncTeamEntityNotify
;
import
emu.grasscutter.server.packet.send.PacketWorldDataNotify
;
import
emu.grasscutter.server.packet.send.PacketWorldPlayerInfoNotify
;
@Opcodes
(
PacketOpcodes
.
SceneInitFinishReq
)
public
class
HandlerSceneInitFinishReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Info packets
session
.
send
(
new
PacketServerTimeNotify
());
session
.
send
(
new
PacketWorldPlayerInfoNotify
(
session
.
getPlayer
().
getWorld
()));
session
.
send
(
new
PacketWorldDataNotify
(
session
.
getPlayer
().
getWorld
()));
session
.
send
(
new
GenshinPacket
(
PacketOpcodes
.
SceneForceUnlockNotify
));
session
.
send
(
new
PacketHostPlayerNotify
(
session
.
getPlayer
().
getWorld
()));
session
.
send
(
new
PacketSceneTimeNotify
(
session
.
getPlayer
()));
session
.
send
(
new
PacketPlayerGameTimeNotify
(
session
.
getPlayer
().
getWorld
(),
session
.
getPlayer
()));
session
.
send
(
new
PacketPlayerEnterSceneInfoNotify
(
session
.
getPlayer
()));
session
.
send
(
new
PacketSceneAreaWeatherNotify
(
session
.
getPlayer
().
getWorld
(),
session
.
getPlayer
()));
session
.
send
(
new
PacketScenePlayerInfoNotify
(
session
.
getPlayer
().
getWorld
()));
session
.
send
(
new
PacketSceneTeamUpdateNotify
(
session
.
getPlayer
()));
session
.
send
(
new
PacketSyncTeamEntityNotify
(
session
.
getPlayer
()));
session
.
send
(
new
PacketSyncScenePlayTeamEntityNotify
(
session
.
getPlayer
()));
// Done Packet
session
.
send
(
new
PacketSceneInitFinishRsp
(
session
.
getPlayer
()));
// Set state
session
.
getPlayer
().
setSceneLoadState
(
SceneLoadState
.
INIT
);
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSceneKickPlayerReq.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.SceneKickPlayerReqOuterClass.SceneKickPlayerReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSceneKickPlayerRsp
;
@Opcodes
(
PacketOpcodes
.
SceneKickPlayerReq
)
public
class
HandlerSceneKickPlayerReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SceneKickPlayerReq
req
=
SceneKickPlayerReq
.
parseFrom
(
payload
);
if
(
session
.
getServer
().
getMultiplayerManager
().
kickPlayer
(
session
.
getPlayer
(),
req
.
getTargetUid
()))
{
// Success
session
.
send
(
new
PacketSceneKickPlayerRsp
(
req
.
getTargetUid
()));
}
else
{
// Fail
session
.
send
(
new
PacketSceneKickPlayerRsp
());
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.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
.
SetEntityClientDataNotify
)
public
class
HandlerSetEntityClientDataNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEquipLockStateReq.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.SetEquipLockStateReqOuterClass.SetEquipLockStateReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
SetEquipLockStateReq
)
public
class
HandlerSetEquipLockStateReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetEquipLockStateReq
req
=
SetEquipLockStateReq
.
parseFrom
(
payload
);
session
.
getServer
().
getInventoryManager
().
lockEquip
(
session
.
getPlayer
(),
req
.
getTargetEquipGuid
(),
req
.
getIsLocked
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetNameCardReq.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.SetNameCardReqOuterClass.SetNameCardReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
SetNameCardReq
)
public
class
HandlerSetNameCardReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetNameCardReq
req
=
SetNameCardReq
.
parseFrom
(
payload
);
session
.
getPlayer
().
setNameCard
(
req
.
getNameCardId
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBornDataReq.java
0 → 100644
View file @
7925d1cd
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.GenshinConstants
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.data.GenshinData
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SetPlayerBornDataReqOuterClass.SetPlayerBornDataReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession.SessionState
;
@Opcodes
(
PacketOpcodes
.
SetPlayerBornDataReq
)
public
class
HandlerSetPlayerBornDataReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetPlayerBornDataReq
req
=
SetPlayerBornDataReq
.
parseFrom
(
payload
);
// Sanity checks
int
avatarId
=
req
.
getAvatarId
();
int
startingSkillDepot
=
0
;
if
(
avatarId
==
GenshinConstants
.
MAIN_CHARACTER_MALE
)
{
startingSkillDepot
=
504
;
}
else
if
(
avatarId
==
GenshinConstants
.
MAIN_CHARACTER_FEMALE
)
{
startingSkillDepot
=
704
;
}
else
{
return
;
}
String
nickname
=
req
.
getNickName
();
if
(
nickname
==
null
)
{
nickname
=
"Traveler"
;
}
// Create character
GenshinPlayer
player
=
new
GenshinPlayer
(
session
);
player
.
setNickname
(
nickname
);
try
{
// Save to db
DatabaseHelper
.
createPlayer
(
player
,
session
.
getAccount
().
getPlayerId
());
// Create avatar
if
(
player
.
getAvatars
().
getAvatarCount
()
==
0
)
{
GenshinAvatar
mainCharacter
=
new
GenshinAvatar
(
avatarId
);
mainCharacter
.
setSkillDepot
(
GenshinData
.
getAvatarSkillDepotDataMap
().
get
(
startingSkillDepot
));
player
.
addAvatar
(
mainCharacter
);
player
.
setMainCharacterId
(
avatarId
);
player
.
setHeadImage
(
avatarId
);
player
.
getTeamManager
().
getCurrentSinglePlayerTeamInfo
().
getAvatars
().
add
(
mainCharacter
.
getAvatarId
());
player
.
save
();
// TODO save player team in different object
}
// Save account
session
.
getAccount
().
setPlayerId
(
player
.
getId
());
session
.
getAccount
().
save
();
// Set character
session
.
setPlayer
(
player
);
// Login done
session
.
getPlayer
().
onLogin
();
session
.
setState
(
SessionState
.
ACTIVE
);
// Born resp packet
session
.
send
(
new
GenshinPacket
(
PacketOpcodes
.
SetPlayerBornDataRsp
));
}
catch
(
Exception
e
)
{
Grasscutter
.
getLogger
().
error
(
"Error creating player object: "
,
e
);
session
.
close
();
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerHeadImageReq.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.SetPlayerHeadImageReqOuterClass.SetPlayerHeadImageReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSetPlayerHeadImageRsp
;
@Opcodes
(
PacketOpcodes
.
SetPlayerHeadImageReq
)
public
class
HandlerSetPlayerHeadImageReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetPlayerHeadImageReq
req
=
SetPlayerHeadImageReq
.
parseFrom
(
payload
);
int
id
=
req
.
getAvatarId
();
if
(
session
.
getPlayer
().
getAvatars
().
hasAvatar
(
id
))
{
session
.
getPlayer
().
setHeadImage
(
id
);
session
.
send
(
new
PacketSetPlayerHeadImageRsp
(
session
.
getPlayer
()));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerNameReq.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.SetPlayerNameReqOuterClass.SetPlayerNameReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSetPlayerNameRsp
;
@Opcodes
(
PacketOpcodes
.
SetPlayerNameReq
)
public
class
HandlerSetPlayerNameReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
SetPlayerNameReq
req
=
SetPlayerNameReq
.
parseFrom
(
payload
);
if
(
req
.
getNickName
()
!=
null
&&
req
.
getNickName
().
length
()
>
0
)
{
session
.
getPlayer
().
setNickname
(
req
.
getNickName
());
session
.
send
(
new
PacketSetPlayerNameRsp
(
session
.
getPlayer
()));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerSignatureReq.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.SetPlayerSignatureReqOuterClass.SetPlayerSignatureReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketSetPlayerSignatureRsp
;
@Opcodes
(
PacketOpcodes
.
SetPlayerSignatureReq
)
public
class
HandlerSetPlayerSignatureReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
SetPlayerSignatureReq
req
=
SetPlayerSignatureReq
.
parseFrom
(
payload
);
if
(
req
.
getSignature
()
!=
null
&&
req
.
getSignature
().
length
()
>
0
)
{
session
.
getPlayer
().
setSignature
(
req
.
getSignature
());
session
.
send
(
new
PacketSetPlayerSignatureRsp
(
session
.
getPlayer
()));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetUpAvatarTeamReq.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.SetUpAvatarTeamReqOuterClass.SetUpAvatarTeamReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
SetUpAvatarTeamReq
)
public
class
HandlerSetUpAvatarTeamReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetUpAvatarTeamReq
req
=
SetUpAvatarTeamReq
.
parseFrom
(
payload
);
session
.
getPlayer
().
getTeamManager
().
setupAvatarTeam
(
req
.
getTeamId
(),
req
.
getAvatarTeamGuidListList
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerTakeoffEquipReq.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.TakeoffEquipReqOuterClass.TakeoffEquipReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketTakeoffEquipRsp
;
@Opcodes
(
PacketOpcodes
.
TakeoffEquipReq
)
public
class
HandlerTakeoffEquipReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
TakeoffEquipReq
req
=
TakeoffEquipReq
.
parseFrom
(
payload
);
if
(
session
.
getPlayer
().
getInventory
().
unequipItem
(
req
.
getAvatarGuid
(),
req
.
getSlot
()))
{
session
.
send
(
new
PacketTakeoffEquipRsp
(
req
.
getAvatarGuid
(),
req
.
getSlot
()));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.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.PacketTowerAllDataRsp
;
@Opcodes
(
PacketOpcodes
.
TowerAllDataReq
)
public
class
HandlerTowerAllDataReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketTowerAllDataRsp
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerUnionCmdNotify.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.UnionCmdNotifyOuterClass.UnionCmdNotify
;
import
emu.grasscutter.net.proto.UnionCmdOuterClass.UnionCmd
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
UnionCmdNotify
)
public
class
HandlerUnionCmdNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
UnionCmdNotify
req
=
UnionCmdNotify
.
parseFrom
(
payload
);
for
(
UnionCmd
cmd
:
req
.
getCmdListList
())
{
session
.
getServer
().
getPacketHandler
().
handle
(
session
,
cmd
.
getMessageId
(),
EMPTY_BYTE_ARRAY
,
cmd
.
getBody
().
toByteArray
());
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerUnlockAvatarTalentReq.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.UnlockAvatarTalentReqOuterClass.UnlockAvatarTalentReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
UnlockAvatarTalentReq
)
public
class
HandlerUnlockAvatarTalentReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
UnlockAvatarTalentReq
req
=
UnlockAvatarTalentReq
.
parseFrom
(
payload
);
// Unlock avatar const
session
.
getServer
().
getInventoryManager
().
unlockAvatarConstellation
(
session
.
getPlayer
(),
req
.
getAvatarGuid
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerUseItemReq.java
0 → 100644
View file @
7925d1cd
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.UseItemReqOuterClass.UseItemReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketUseItemRsp
;
@Opcodes
(
PacketOpcodes
.
UseItemReq
)
public
class
HandlerUseItemReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
UseItemReq
req
=
UseItemReq
.
parseFrom
(
payload
);
GenshinItem
useItem
=
session
.
getServer
().
getInventoryManager
().
useItem
(
session
.
getPlayer
(),
req
.
getTargetGuid
(),
req
.
getGuid
(),
req
.
getCount
());
if
(
useItem
!=
null
)
{
session
.
send
(
new
PacketUseItemRsp
(
req
.
getTargetGuid
(),
useItem
));
}
else
{
session
.
send
(
new
PacketUseItemRsp
());
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponAwakenReq.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.WeaponAwakenReqOuterClass.WeaponAwakenReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
WeaponAwakenReq
)
public
class
HandlerWeaponAwakenReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
WeaponAwakenReq
req
=
WeaponAwakenReq
.
parseFrom
(
payload
);
// Weapon refinement
session
.
getServer
().
getInventoryManager
().
refineWeapon
(
session
.
getPlayer
(),
req
.
getTargetWeaponGuid
(),
req
.
getItemGuid
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponPromoteReq.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.WeaponPromoteReqOuterClass.WeaponPromoteReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
WeaponPromoteReq
)
public
class
HandlerWeaponPromoteReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
WeaponPromoteReq
req
=
WeaponPromoteReq
.
parseFrom
(
payload
);
// Ascend weapon
session
.
getServer
().
getInventoryManager
().
promoteWeapon
(
session
.
getPlayer
(),
req
.
getTargetWeaponGuid
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerWeaponUpgradeReq.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.WeaponUpgradeReqOuterClass.WeaponUpgradeReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
WeaponUpgradeReq
)
public
class
HandlerWeaponUpgradeReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
WeaponUpgradeReq
req
=
WeaponUpgradeReq
.
parseFrom
(
payload
);
// Level up weapon
session
.
getServer
().
getInventoryManager
().
upgradeWeapon
(
session
.
getPlayer
(),
req
.
getTargetWeaponGuid
(),
req
.
getFoodWeaponGuidListList
(),
req
.
getItemParamListList
()
);
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerWearEquipReq.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.WearEquipReqOuterClass.WearEquipReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketWearEquipRsp
;
@Opcodes
(
PacketOpcodes
.
WearEquipReq
)
public
class
HandlerWearEquipReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
WearEquipReq
req
=
WearEquipReq
.
parseFrom
(
payload
);
if
(
session
.
getPlayer
().
getInventory
().
equipItem
(
req
.
getAvatarGuid
(),
req
.
getEquipGuid
()))
{
session
.
send
(
new
PacketWearEquipRsp
(
req
.
getAvatarGuid
(),
req
.
getEquipGuid
()));
}
}
}
Prev
1
…
7
8
9
10
11
12
13
14
15
…
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