mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 18:12:53 +08:00
Persist unlocked blueprints to the database.
This commit is contained in:
parent
f243c10157
commit
e140284d37
@ -824,7 +824,6 @@ public class InventoryManager {
|
|||||||
int used = 0;
|
int used = 0;
|
||||||
|
|
||||||
// Use
|
// Use
|
||||||
Grasscutter.getLogger().info("Item: {}", useItem.getItemData().getId());
|
|
||||||
switch (useItem.getItemData().getMaterialType()) {
|
switch (useItem.getItemData().getMaterialType()) {
|
||||||
case MATERIAL_FOOD:
|
case MATERIAL_FOOD:
|
||||||
if (useItem.getItemData().getUseTarget().equals("ITEM_USE_TARGET_SPECIFY_DEAD_AVATAR")) {
|
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.
|
// Determine the forging item we should unlock.
|
||||||
int forgeId = Integer.parseInt(useItem.getItemData().getItemUse().get(0).getUseParam().get(0));
|
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.sendPacket(new PacketForgeFormulaDataNotify(forgeId));
|
||||||
|
player.getUnlockedForgingBlueprints().add(forgeId);
|
||||||
|
|
||||||
// Use up the blueprint item.
|
// Use up the blueprint item.
|
||||||
used = 1;
|
used = 1;
|
||||||
|
@ -89,6 +89,7 @@ public class Player {
|
|||||||
private Set<Integer> nameCardList;
|
private Set<Integer> nameCardList;
|
||||||
private Set<Integer> flyCloakList;
|
private Set<Integer> flyCloakList;
|
||||||
private Set<Integer> costumeList;
|
private Set<Integer> costumeList;
|
||||||
|
private Set<Integer> unlockedForgingBlueprints;
|
||||||
|
|
||||||
private Integer widgetId;
|
private Integer widgetId;
|
||||||
|
|
||||||
@ -183,6 +184,7 @@ public class Player {
|
|||||||
this.nameCardList = new HashSet<>();
|
this.nameCardList = new HashSet<>();
|
||||||
this.flyCloakList = new HashSet<>();
|
this.flyCloakList = new HashSet<>();
|
||||||
this.costumeList = new HashSet<>();
|
this.costumeList = new HashSet<>();
|
||||||
|
this.unlockedForgingBlueprints = new HashSet<>();
|
||||||
|
|
||||||
this.setSceneId(3);
|
this.setSceneId(3);
|
||||||
this.setRegionId(1);
|
this.setRegionId(1);
|
||||||
@ -515,6 +517,10 @@ public class Player {
|
|||||||
return this.nameCardList;
|
return this.nameCardList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<Integer> getUnlockedForgingBlueprints() {
|
||||||
|
return unlockedForgingBlueprints;
|
||||||
|
}
|
||||||
|
|
||||||
public MpSettingType getMpSetting() {
|
public MpSettingType getMpSetting() {
|
||||||
return MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; // TEMP
|
return MpSettingType.MP_SETTING_TYPE_ENTER_AFTER_APPLY; // TEMP
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
package emu.grasscutter.server.packet.send;
|
package emu.grasscutter.server.packet.send;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import dev.morphia.AdvancedDatastore;
|
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.net.packet.BasePacket;
|
import emu.grasscutter.net.packet.BasePacket;
|
||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
import emu.grasscutter.net.proto.ForgeDataNotifyOuterClass.ForgeDataNotify;
|
import emu.grasscutter.net.proto.ForgeDataNotifyOuterClass.ForgeDataNotify;
|
||||||
import emu.grasscutter.net.proto.ForgeQueueDataOuterClass.ForgeQueueData;
|
|
||||||
|
|
||||||
public class PacketForgeDataNotify extends BasePacket {
|
public class PacketForgeDataNotify extends BasePacket {
|
||||||
|
|
||||||
@ -22,10 +18,13 @@ public class PacketForgeDataNotify extends BasePacket {
|
|||||||
: 1;
|
: 1;
|
||||||
|
|
||||||
ForgeDataNotify proto = ForgeDataNotify.newBuilder()
|
ForgeDataNotify proto = ForgeDataNotify.newBuilder()
|
||||||
.addAllForgeIdList(List.of(14017, 14009, 14008))
|
.addAllForgeIdList(player.getUnlockedForgingBlueprints())
|
||||||
.setMaxQueueNum(numQueues)
|
.setMaxQueueNum(numQueues)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// ToDo: Add the information for the actual forging queues
|
||||||
|
// and ongoing forges.
|
||||||
|
|
||||||
this.setData(proto);
|
this.setData(proto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user