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
eac82f3c
Commit
eac82f3c
authored
Apr 30, 2022
by
Melledy
Browse files
Fix possible exploit with mcoin exchange
parent
da3eb3d2
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerMcoinExchangeHcoinReq.java
View file @
eac82f3c
...
...
@@ -13,14 +13,15 @@ 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
==
null
)
{
return
;
}
else
if
(
session
.
getPlayer
().
getCrystals
()
<
exchangeReq
.
getMCoinNum
())
{
if
(
session
.
getPlayer
().
getCrystals
()
<
exchangeReq
.
getMCoinNum
()
&&
exchangeReq
.
getMCoinNum
()
==
exchangeReq
.
getHCoinNum
())
{
return
;
}
session
.
getPlayer
().
setCrystals
(
session
.
getPlayer
().
getCrystals
()
-
exchangeReq
.
getMCoinNum
());
session
.
getPlayer
().
setPrimogems
(
session
.
getPlayer
().
getPrimogems
()
+
exchangeReq
.
getHCoinNum
());
session
.
getPlayer
().
save
();
session
.
send
(
new
PacketMcoinExchangeHcoinRsp
(
session
.
getPlayer
().
getCrystals
(),
session
.
getPlayer
().
getPrimogems
()));
}
}
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