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
01b190bc
Commit
01b190bc
authored
May 07, 2022
by
Magix
Committed by
GitHub
May 07, 2022
Browse files
UPGRADE TO 1.1.0 POG
Merge `development` into `stable`
parents
6b81b888
1beddf16
Changes
497
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterSceneDoneReq.java
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.
Genshin
Player.SceneLoadState
;
import
emu.grasscutter.game.
player.
Player.SceneLoadState
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerEnterTransPointRegionNotify.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.managers.SotSManager.SotSManager
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ChangeHpReasonOuterClass.ChangeHpReason
;
import
emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropChangeReasonNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
java.util.List
;
@Opcodes
(
PacketOpcodes
.
EnterTransPointRegionNotify
)
public
class
HandlerEnterTransPointRegionNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
Player
player
=
session
.
getPlayer
();
SotSManager
sotsManager
=
player
.
getSotSManager
();
sotsManager
.
refillSpringVolume
();
sotsManager
.
autoRevive
(
session
);
sotsManager
.
scheduleAutoRecover
(
session
);
// TODO: allow interaction with the SotS?
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAvatarLockChairReq.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtAvatarLockChairReqOuterClass.EvtAvatarLockChairReq
;
import
emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketEvtAvatarLockChairRsp
;
@Opcodes
(
PacketOpcodes
.
EvtAvatarLockChairReq
)
public
class
HandlerEvtAvatarLockChairReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PacketHead
head
=
PacketHead
.
parseFrom
(
header
);
EvtAvatarLockChairReq
lockChairReq
=
EvtAvatarLockChairReq
.
parseFrom
(
payload
);
EntityAvatar
entityAvatar
=
session
.
getPlayer
().
getTeamManager
().
getCurrentAvatarEntity
();
session
.
send
(
new
PacketEvtAvatarLockChairRsp
(
head
.
getClientSequenceId
(),
entityAvatar
,
lockChairReq
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAvatarSitDownNotify.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketEvtAvatarSitDownNotify
;
@Opcodes
(
PacketOpcodes
.
EvtAvatarSitDownNotify
)
public
class
HandlerEvtAvatarSitDownNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
EvtAvatarSitDownNotify
notify
=
EvtAvatarSitDownNotify
.
parseFrom
(
payload
);
session
.
getPlayer
().
getScene
().
broadcastPacket
(
new
PacketEvtAvatarSitDownNotify
(
notify
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtAvatarStandUpNotify.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtAvatarStandUpNotifyOuterClass.EvtAvatarStandUpNotify
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketEvtAvatarStandUpNotify
;
@Opcodes
(
PacketOpcodes
.
EvtAvatarStandUpNotify
)
public
class
HandlerEvtAvatarStandUpNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
EvtAvatarStandUpNotify
notify
=
EvtAvatarStandUpNotify
.
parseFrom
(
payload
);
session
.
getPlayer
().
getScene
().
broadcastPacket
(
new
PacketEvtAvatarStandUpNotify
(
notify
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerEvtDoSkillSuccNotify.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
EvtDoSkillSuccNotify
)
public
class
HandlerEvtDoSkillSuccNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
EvtDoSkillSuccNotify
notify
=
EvtDoSkillSuccNotify
.
parseFrom
(
payload
);
// TODO: Will be used for deducting stamina for charged skills.
int
caster
=
notify
.
getCasterId
();
int
skillId
=
notify
.
getSkillId
();
session
.
getPlayer
().
getMovementManager
().
notifySkill
(
caster
,
skillId
);
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerExitTransPointRegionNotify.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.managers.SotSManager.SotSManager
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
ExitTransPointRegionNotify
)
public
class
HandlerExitTransPointRegionNotify
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
Player
player
=
session
.
getPlayer
();
SotSManager
sotsManager
=
player
.
getSotSManager
();
sotsManager
.
cancelAutoRecover
();
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAllMailReq.java
0 → 100644
View file @
01b190bc
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.packet.PacketHandler
;
import
emu.grasscutter.net.proto.GetAllMailReqOuterClass
;
import
emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetAllMailRsp
;
import
emu.grasscutter.server.packet.send.PacketGetGachaInfoRsp
;
@Opcodes
(
PacketOpcodes
.
GetAllMailReq
)
public
class
HandlerGetAllMailReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetAllMailReqOuterClass
.
GetAllMailReq
req
=
GetAllMailReqOuterClass
.
GetAllMailReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketGetAllMailRsp
(
session
.
getPlayer
(),
req
.
getIsGiftMail
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetFriendShowAvatarInfoReq.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.GetFriendShowAvatarInfoReqOuterClass.GetFriendShowAvatarInfoReq
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetFriendShowAvatarInfoRsp
;
@Opcodes
(
PacketOpcodes
.
GetFriendShowAvatarInfoReq
)
public
class
HandlerGetFriendShowAvatarInfoReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetFriendShowAvatarInfoReq
req
=
GetFriendShowAvatarInfoReq
.
parseFrom
(
payload
);
int
targetUid
=
req
.
getUid
();
Player
targetPlayer
=
session
.
getServer
().
getPlayerByUid
(
targetUid
,
true
);
if
(
targetPlayer
.
isShowAvatars
())
{
session
.
send
(
new
PacketGetFriendShowAvatarInfoRsp
(
targetUid
,
targetPlayer
.
getShowAvatarInfoList
()));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetGachaInfoReq.java
View file @
01b190bc
...
...
@@ -11,7 +11,10 @@ public class HandlerGetGachaInfoReq extends PacketHandler {
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetGachaInfoRsp
(
session
.
getServer
().
getGachaManager
()));
session
.
send
(
new
PacketGetGachaInfoRsp
(
session
.
getServer
().
getGachaManager
(),
// TODO: use other Nonce/key insteadof session key to ensure the overall security for the player
session
.
getPlayer
().
getAccount
().
getSessionKey
())
);
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetMailItemReq.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.GetMailItemReqOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetMailItemRsp
;
@Opcodes
(
PacketOpcodes
.
GetMailItemReq
)
public
class
HandlerGetMailItemReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
GetMailItemReqOuterClass
.
GetMailItemReq
req
=
GetMailItemReqOuterClass
.
GetMailItemReq
.
parseFrom
(
payload
);
session
.
send
(
new
PacketGetMailItemRsp
(
session
.
getPlayer
(),
req
.
getMailIdListList
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetOnlinePlayerListReq.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetOnlinePlayerListRsp
;
@Opcodes
(
PacketOpcodes
.
GetOnlinePlayerListReq
)
public
class
HandlerGetOnlinePlayerListReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
PacketGetOnlinePlayerListRsp
(
session
.
getPlayer
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetPlayerBlacklistReq.java
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.
Genshin
Packet
;
import
emu.grasscutter.net.packet.
Base
Packet
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
...
...
@@ -11,7 +11,7 @@ public class HandlerGetPlayerBlacklistReq extends PacketHandler {
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
session
.
send
(
new
Genshin
Packet
(
PacketOpcodes
.
GetPlayerBlacklistRsp
).
buildHeader
(
3
));
session
.
send
(
new
Base
Packet
(
PacketOpcodes
.
GetPlayerBlacklistRsp
).
buildHeader
(
3
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetShopReq.java
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
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
;
...
...
@@ -12,8 +12,7 @@ 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
()));
session
.
send
(
new
PacketGetShopRsp
(
session
.
getPlayer
(),
req
.
getShopType
()));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.
Grasscutter
;
import
emu.grasscutter.game.
World
;
import
emu.grasscutter.game.p
rops.EnterReason
;
import
emu.grasscutter.
game.managers.MapMarkManager.MapMark
;
import
emu.grasscutter.game.
managers.MapMarkManager.MapMarksManager
;
import
emu.grasscutter.game.p
layer.Player
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.
EnterTypeOuterClass.EnterType
;
import
emu.grasscutter.net.proto.
*
;
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.PacketPlayerEnterSceneNotify
;
import
emu.grasscutter.server.packet.send.PacketMarkMapRsp
;
import
emu.grasscutter.server.packet.send.PacketMarkNewNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify
;
import
emu.grasscutter.utils.Position
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
@Opcodes
(
PacketOpcodes
.
MarkMapReq
)
public
class
HandlerMarkMapReq
extends
PacketHandler
{
...
...
@@ -31,25 +36,49 @@ 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
;
MarkMapReq
.
Operation
op
=
req
.
getOp
();
Player
player
=
session
.
getPlayer
();
MapMarksManager
mapMarksManager
=
player
.
getMapMarksManager
();
if
(
op
==
MarkMapReq
.
Operation
.
ADD
)
{
MapMark
newMapMark
=
new
MapMark
(
req
.
getMark
());
// keep teleporting functionality on fishhook mark.
if
(
newMapMark
.
getMapMarkPointType
()
==
MapMarkPointTypeOuterClass
.
MapMarkPointType
.
MAP_MARK_POINT_TYPE_FISH_POOL
)
{
teleport
(
player
,
newMapMark
);
return
;
}
if
(
mapMarksManager
.
addMapMark
(
newMapMark
))
{
player
.
save
();
}
}
else
if
(
op
==
MarkMapReq
.
Operation
.
MOD
)
{
MapMark
newMapMark
=
new
MapMark
(
req
.
getMark
());
if
(
mapMarksManager
.
removeMapMark
(
newMapMark
.
getPosition
()))
{
if
(
mapMarksManager
.
addMapMark
(
newMapMark
))
{
player
.
save
();
}
}
}
else
if
(
op
==
MarkMapReq
.
Operation
.
DEL
)
{
MapMark
newMapMark
=
new
MapMark
(
req
.
getMark
());
if
(
mapMarksManager
.
removeMapMark
(
newMapMark
.
getPosition
()))
{
player
.
save
();
}
}
else
if
(
op
==
MarkMapReq
.
Operation
.
GET
)
{
// no-op
}
// send all marks to refresh client map view.
HashMap
<
String
,
MapMark
>
mapMarks
=
mapMarksManager
.
getAllMapMarks
();
session
.
send
(
new
PacketMarkMapRsp
(
player
,
mapMarks
));
}
session
.
getPlayer
().
getPos
().
setX
(
req
.
getMark
().
getPos
().
getX
());
session
.
getPlayer
().
getPos
().
setZ
(
req
.
getMark
().
getPos
().
getZ
());
session
.
getPlayer
().
getPos
()
.
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
())
{
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getMark
().
getSceneId
(),
session
.
getPlayer
().
getPos
());
private
void
teleport
(
Player
player
,
MapMark
mapMark
)
{
float
y
=
isInt
(
mapMark
.
getName
())
?
Integer
.
parseInt
(
mapMark
.
getName
())
:
300
;
float
x
=
mapMark
.
getPosition
().
getX
();
float
z
=
mapMark
.
getPosition
().
getZ
();
player
.
getPos
().
set
(
x
,
y
,
z
);
if
(
mapMark
.
getSceneId
()
!=
player
.
getSceneId
())
{
player
.
getWorld
().
transferPlayerToScene
(
player
,
mapMark
.
getSceneId
(),
player
.
getPos
());
}
else
{
session
.
getP
layer
()
.
getScene
().
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
session
.
getP
layer
()
));
p
layer
.
getScene
().
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
p
layer
));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerMcoinExchangeHcoinReq.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.McoinExchangeHcoinReqOuterClass
;
import
emu.grasscutter.net.proto.RetcodeOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketMcoinExchangeHcoinRsp
;
@Opcodes
(
PacketOpcodes
.
McoinExchangeHcoinReq
)
public
class
HandlerMcoinExchangeHcoinReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
McoinExchangeHcoinReqOuterClass
.
McoinExchangeHcoinReq
exchangeReq
=
McoinExchangeHcoinReqOuterClass
.
McoinExchangeHcoinReq
.
parseFrom
(
payload
);
if
(
session
.
getPlayer
().
getCrystals
()
<
exchangeReq
.
getMCoinNum
()
&&
exchangeReq
.
getMCoinNum
()
==
exchangeReq
.
getHCoinNum
())
{
session
.
send
(
new
PacketMcoinExchangeHcoinRsp
(
RetcodeOuterClass
.
Retcode
.
RET_UNKNOWN_ERROR_VALUE
));
return
;
}
session
.
getPlayer
().
setCrystals
(
session
.
getPlayer
().
getCrystals
()
-
exchangeReq
.
getMCoinNum
());
session
.
getPlayer
().
setPrimogems
(
session
.
getPlayer
().
getPrimogems
()
+
exchangeReq
.
getHCoinNum
());
session
.
getPlayer
().
save
();
session
.
send
(
new
PacketMcoinExchangeHcoinRsp
(
RetcodeOuterClass
.
Retcode
.
RET_SUCC_VALUE
));
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.game.inventory.G
enshin
Item
;
import
emu.grasscutter.game.inventory.G
ame
Item
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq
;
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerPersonalSceneJumpReq.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.data.GameData
;
import
emu.grasscutter.data.custom.ScenePointEntry
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PersonalSceneJumpReqOuterClass.PersonalSceneJumpReq
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPersonalSceneJumpRsp
;
import
emu.grasscutter.utils.Position
;
@Opcodes
(
PacketOpcodes
.
PersonalSceneJumpReq
)
public
class
HandlerPersonalSceneJumpReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
PersonalSceneJumpReq
req
=
PersonalSceneJumpReq
.
parseFrom
(
payload
);
// get the scene point
String
code
=
session
.
getPlayer
().
getSceneId
()
+
"_"
+
req
.
getPointId
();
ScenePointEntry
scenePointEntry
=
GameData
.
getScenePointEntries
().
get
(
code
);
if
(
scenePointEntry
!=
null
)
{
float
x
=
scenePointEntry
.
getPointData
().
getTranPos
().
getX
();
float
y
=
scenePointEntry
.
getPointData
().
getTranPos
().
getY
();
float
z
=
scenePointEntry
.
getPointData
().
getTranPos
().
getZ
();
Position
pos
=
new
Position
(
x
,
y
,
z
);
int
sceneId
=
scenePointEntry
.
getPointData
().
getTranSceneId
();
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
sceneId
,
pos
);
session
.
send
(
new
PacketPersonalSceneJumpRsp
(
sceneId
,
pos
));
}
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java
0 → 100644
View file @
01b190bc
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.PlayerEnterDungeonReqOuterClass.PlayerEnterDungeonReq
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.server.game.GameSession
;
@Opcodes
(
PacketOpcodes
.
PlayerEnterDungeonReq
)
public
class
HandlerPlayerEnterDungeonReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
// Auto template
PlayerEnterDungeonReq
req
=
PlayerEnterDungeonReq
.
parseFrom
(
payload
);
session
.
getServer
().
getDungeonManager
().
enterDungeon
(
session
.
getPlayer
(),
req
.
getPointId
(),
req
.
getDungeonId
());
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerGetForceQuitBanInfoReq.java
View file @
01b190bc
...
...
@@ -3,6 +3,7 @@ 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.net.proto.RetcodeOuterClass
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketPlayerGetForceQuitBanInfoRsp
;
...
...
@@ -14,10 +15,10 @@ public class HandlerPlayerGetForceQuitBanInfoReq extends PacketHandler {
if
(
session
.
getServer
().
getMultiplayerManager
().
leaveCoop
(
session
.
getPlayer
()))
{
// Success
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
0
));
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
RetcodeOuterClass
.
Retcode
.
RET_SUCC_VALUE
));
}
else
{
// Fail
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
1
));
session
.
send
(
new
PacketPlayerGetForceQuitBanInfoRsp
(
RetcodeOuterClass
.
Retcode
.
RET_SVR_ERROR_VALUE
));
}
}
...
...
Prev
1
…
10
11
12
13
14
15
16
17
18
…
25
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