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
8bf17a8b
Commit
8bf17a8b
authored
Apr 27, 2022
by
Melledy
Browse files
Fixed genesis crystals not being given to player
parent
1586bab5
Changes
4
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/inventory/Inventory.java
View file @
8bf17a8b
...
@@ -249,6 +249,9 @@ public class Inventory implements Iterable<GameItem> {
...
@@ -249,6 +249,9 @@ public class Inventory implements Iterable<GameItem> {
case
202
:
// Mora
case
202
:
// Mora
getPlayer
().
setMora
(
player
.
getMora
()
+
count
);
getPlayer
().
setMora
(
player
.
getMora
()
+
count
);
break
;
break
;
case
203
:
// Genesis Crystals
getPlayer
().
setCrystals
(
player
.
getCrystals
()
+
count
);
break
;
}
}
}
}
...
...
src/main/java/emu/grasscutter/game/managers/InventoryManager.java
View file @
8bf17a8b
...
@@ -923,6 +923,7 @@ public class InventoryManager {
...
@@ -923,6 +923,7 @@ public class InventoryManager {
break
;
break
;
}
}
// Welkin
if
(
useItem
.
getItemId
()
==
1202
)
{
if
(
useItem
.
getItemId
()
==
1202
)
{
player
.
rechargeMoonCard
();
player
.
rechargeMoonCard
();
used
=
1
;
used
=
1
;
...
...
src/main/java/emu/grasscutter/game/player/Player.java
View file @
8bf17a8b
...
@@ -295,6 +295,15 @@ public class Player {
...
@@ -295,6 +295,15 @@ public class Player {
this
.
sendPacket
(
new
PacketPlayerPropNotify
(
this
,
PlayerProperty
.
PROP_PLAYER_SCOIN
));
this
.
sendPacket
(
new
PacketPlayerPropNotify
(
this
,
PlayerProperty
.
PROP_PLAYER_SCOIN
));
}
}
public
int
getCrystals
()
{
return
this
.
getProperty
(
PlayerProperty
.
PROP_PLAYER_MCOIN
);
}
public
void
setCrystals
(
int
crystals
)
{
this
.
setProperty
(
PlayerProperty
.
PROP_PLAYER_MCOIN
,
crystals
);
this
.
sendPacket
(
new
PacketPlayerPropNotify
(
this
,
PlayerProperty
.
PROP_PLAYER_MCOIN
));
}
private
int
getExpRequired
(
int
level
)
{
private
int
getExpRequired
(
int
level
)
{
PlayerLevelData
levelData
=
GameData
.
getPlayerLevelDataMap
().
get
(
level
);
PlayerLevelData
levelData
=
GameData
.
getPlayerLevelDataMap
().
get
(
level
);
return
levelData
!=
null
?
levelData
.
getExp
()
:
0
;
return
levelData
!=
null
?
levelData
.
getExp
()
:
0
;
...
@@ -550,11 +559,7 @@ public class Player {
...
@@ -550,11 +559,7 @@ public class Player {
}
}
public
void
rechargeMoonCard
()
{
public
void
rechargeMoonCard
()
{
LinkedList
<
GameItem
>
items
=
new
LinkedList
<
GameItem
>();
inventory
.
addItem
(
new
GameItem
(
203
,
300
));
for
(
int
i
=
0
;
i
<
300
;
i
++)
{
items
.
add
(
new
GameItem
(
203
));
}
inventory
.
addItems
(
items
);
if
(!
moonCard
)
{
if
(!
moonCard
)
{
moonCard
=
true
;
moonCard
=
true
;
Date
now
=
new
Date
();
Date
now
=
new
Date
();
...
...
src/main/java/emu/grasscutter/server/packet/recv/HandlerBuyGoodsReq.java
View file @
8bf17a8b
...
@@ -32,7 +32,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
...
@@ -32,7 +32,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
if
(
sg
.
getHcoin
()
>
0
&&
session
.
getPlayer
().
getPrimogems
()
<
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getHcoin
())
{
if
(
sg
.
getHcoin
()
>
0
&&
session
.
getPlayer
().
getPrimogems
()
<
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getHcoin
())
{
return
;
return
;
}
}
if
(
sg
.
getMcoin
()
>
0
&&
session
.
getPlayer
().
get
Property
(
PlayerProperty
.
PROP_PLAYER_MCOIN
)
<
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getMcoin
())
{
if
(
sg
.
getMcoin
()
>
0
&&
session
.
getPlayer
().
get
Crystals
(
)
<
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getMcoin
())
{
return
;
return
;
}
}
...
@@ -46,7 +46,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
...
@@ -46,7 +46,7 @@ public class HandlerBuyGoodsReq extends PacketHandler {
session
.
getPlayer
().
setMora
(
session
.
getPlayer
().
getMora
()
-
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getScoin
());
session
.
getPlayer
().
setMora
(
session
.
getPlayer
().
getMora
()
-
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getScoin
());
session
.
getPlayer
().
setPrimogems
(
session
.
getPlayer
().
getPrimogems
()
-
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getHcoin
());
session
.
getPlayer
().
setPrimogems
(
session
.
getPlayer
().
getPrimogems
()
-
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getHcoin
());
session
.
getPlayer
().
set
Property
(
PlayerProperty
.
PROP_PLAYER_MCOIN
,
session
.
getPlayer
().
getProperty
(
PlayerProperty
.
PROP_PLAYER_MCOIN
)
-
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getMcoin
());
session
.
getPlayer
().
set
Crystals
(
session
.
getPlayer
().
getCrystals
(
)
-
buyGoodsReq
.
getBoughtNum
()
*
sg
.
getMcoin
());
if
(!
itemsCache
.
isEmpty
())
{
if
(!
itemsCache
.
isEmpty
())
{
for
(
GameItem
gi
:
itemsCache
.
keySet
())
{
for
(
GameItem
gi
:
itemsCache
.
keySet
())
{
...
...
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