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
e140284d
Commit
e140284d
authored
Jun 02, 2022
by
ImmuState
Committed by
Melledy
Jun 03, 2022
Browse files
Persist unlocked blueprints to the database.
parent
f243c101
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/managers/InventoryManager.java
View file @
e140284d
...
...
@@ -824,7 +824,6 @@ public class InventoryManager {
int
used
=
0
;
// Use
Grasscutter
.
getLogger
().
info
(
"Item: {}"
,
useItem
.
getItemData
().
getId
());
switch
(
useItem
.
getItemData
().
getMaterialType
())
{
case
MATERIAL_FOOD:
if
(
useItem
.
getItemData
().
getUseTarget
().
equals
(
"ITEM_USE_TARGET_SPECIFY_DEAD_AVATAR"
))
{
...
...
@@ -856,8 +855,9 @@ public class InventoryManager {
// Determine the forging item we should unlock.
int
forgeId
=
Integer
.
parseInt
(
useItem
.
getItemData
().
getItemUse
().
get
(
0
).
getUseParam
().
get
(
0
));
// Tell the client that this blueprint is now unlocked.
// Tell the client that this blueprint is now unlocked
and add the unlocked item to the player
.
player
.
sendPacket
(
new
PacketForgeFormulaDataNotify
(
forgeId
));
player
.
getUnlockedForgingBlueprints
().
add
(
forgeId
);
// Use up the blueprint item.
used
=
1
;
...
...
src/main/java/emu/grasscutter/game/player/Player.java
View file @
e140284d
...
...
@@ -89,6 +89,7 @@ public class Player {
private
Set
<
Integer
>
nameCardList
;
private
Set
<
Integer
>
flyCloakList
;
private
Set
<
Integer
>
costumeList
;
private
Set
<
Integer
>
unlockedForgingBlueprints
;
private
Integer
widgetId
;
...
...
@@ -183,6 +184,7 @@ public class Player {
this
.
nameCardList
=
new
HashSet
<>();
this
.
flyCloakList
=
new
HashSet
<>();
this
.
costumeList
=
new
HashSet
<>();
this
.
unlockedForgingBlueprints
=
new
HashSet
<>();
this
.
setSceneId
(
3
);
this
.
setRegionId
(
1
);
...
...
@@ -515,6 +517,10 @@ public class Player {
return
this
.
nameCardList
;
}
public
Set
<
Integer
>
getUnlockedForgingBlueprints
()
{
return
unlockedForgingBlueprints
;
}
public
MpSettingType
getMpSetting
()
{
return
MpSettingType
.
MP_SETTING_TYPE_ENTER_AFTER_APPLY
;
// TEMP
}
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketForgeDataNotify.java
View file @
e140284d
package
emu.grasscutter.server.packet.send
;
import
java.util.List
;
import
dev.morphia.AdvancedDatastore
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.net.packet.BasePacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.ForgeDataNotifyOuterClass.ForgeDataNotify
;
import
emu.grasscutter.net.proto.ForgeQueueDataOuterClass.ForgeQueueData
;
public
class
PacketForgeDataNotify
extends
BasePacket
{
...
...
@@ -22,10 +18,13 @@ public class PacketForgeDataNotify extends BasePacket {
:
1
;
ForgeDataNotify
proto
=
ForgeDataNotify
.
newBuilder
()
.
addAllForgeIdList
(
List
.
of
(
14017
,
14009
,
14008
))
.
addAllForgeIdList
(
player
.
getUnlockedForgingBlueprints
(
))
.
setMaxQueueNum
(
numQueues
)
.
build
();
// ToDo: Add the information for the actual forging queues
// and ongoing forges.
this
.
setData
(
proto
);
}
}
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