mirror of
https://github.com/Anime-Game-Servers/Grasscutter-Quests.git
synced 2024-12-03 10:10:42 +00:00
parent
cedda3167f
commit
906f15c5a3
@ -119,4 +119,10 @@ public class PlayerCodex {
|
||||
this.player.save();
|
||||
this.player.sendPacket(new PacketCodexDataUpdateNotify(7, viewpoint.getId()));
|
||||
}
|
||||
|
||||
public void checkBook(int bookId) {
|
||||
this.getUnlockedBook().add(bookId);
|
||||
this.player.save();
|
||||
this.player.sendPacket(new PacketCodexDataUpdateNotify(5, bookId));
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class ItemUseAction {
|
||||
case ITEM_USE_MAKE_GADGET -> new ItemUseMakeGadget(useParam);
|
||||
// Unlock recipes - TODO: allow scheduling packets for after recipe is removed
|
||||
case ITEM_USE_UNLOCK_COMBINE -> new ItemUseUnlockCombine(useParam);
|
||||
case ITEM_USE_UNLOCK_CODEX -> new ItemUseUnlockCodex(useParam); // TODO: No backend for this yet
|
||||
case ITEM_USE_UNLOCK_CODEX -> new ItemUseUnlockCodex(useParam);
|
||||
case ITEM_USE_UNLOCK_COOK_RECIPE -> new ItemUseUnlockCookRecipe(useParam);
|
||||
case ITEM_USE_UNLOCK_FORGE -> new ItemUseUnlockForge(useParam);
|
||||
case ITEM_USE_UNLOCK_FURNITURE_FORMULA -> new ItemUseUnlockFurnitureFormula(useParam);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package emu.grasscutter.game.props.ItemUseAction;
|
||||
|
||||
import emu.grasscutter.game.props.ItemUseOp;
|
||||
import emu.grasscutter.server.packet.send.PacketCodexDataUpdateNotify;
|
||||
|
||||
public class ItemUseUnlockCodex extends ItemUseInt {
|
||||
@Override
|
||||
@ -14,6 +15,7 @@ public class ItemUseUnlockCodex extends ItemUseInt {
|
||||
|
||||
@Override
|
||||
public boolean useItem(UseItemParams params) {
|
||||
return false;
|
||||
params.player.getCodex().checkBook(this.i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ public class PacketCodexDataFullNotify extends BasePacket {
|
||||
CodexTypeData.Builder reliquaryData = CodexTypeData.newBuilder()
|
||||
.setTypeValue(8);
|
||||
|
||||
//Quests
|
||||
player.getQuestManager().forEachMainQuest(mainQuest -> {
|
||||
if(mainQuest.isFinished()){
|
||||
var codexQuest = GameData.getCodexQuestDataIdMap().get(mainQuest.getParentQuestId());
|
||||
@ -54,6 +55,7 @@ public class PacketCodexDataFullNotify extends BasePacket {
|
||||
}
|
||||
});
|
||||
|
||||
//Weapons
|
||||
player.getCodex().getUnlockedWeapon().forEach(weapon -> {
|
||||
var codexWeapon = GameData.getCodexWeaponDataIdMap().get(weapon);
|
||||
if(codexWeapon != null){
|
||||
@ -61,6 +63,7 @@ public class PacketCodexDataFullNotify extends BasePacket {
|
||||
}
|
||||
});
|
||||
|
||||
//Animals
|
||||
player.getCodex().getUnlockedAnimal().forEach((animal, amount) -> {
|
||||
var codexAnimal = GameData.getCodexAnimalDataMap().get(animal);
|
||||
if(codexAnimal != null){
|
||||
@ -68,19 +71,28 @@ public class PacketCodexDataFullNotify extends BasePacket {
|
||||
}
|
||||
});
|
||||
|
||||
//Materials
|
||||
player.getCodex().getUnlockedMaterial().forEach(material -> {
|
||||
var codexMaterial = GameData.getCodexMaterialDataIdMap().get(material);
|
||||
if(codexMaterial != null){
|
||||
if (codexMaterial != null) {
|
||||
materialTypeData.addCodexIdList(codexMaterial.getId()).addAllHaveViewedList(Collections.singleton(true));
|
||||
}
|
||||
});
|
||||
|
||||
//Books
|
||||
player.getCodex().getUnlockedBook().forEach(view -> bookTypeData.addCodexIdList(view).addAllHaveViewedList(Collections.singleton(true)));
|
||||
|
||||
//Tips
|
||||
//TODO: Tips
|
||||
|
||||
//Views
|
||||
player.getCodex().getUnlockedView().forEach(view -> viewTypeData.addCodexIdList(view).addAllHaveViewedList(Collections.singleton(true)));
|
||||
|
||||
//Reliquary
|
||||
player.getCodex().getUnlockedReliquarySuitCodex().forEach(reliquarySuit -> {
|
||||
reliquaryData.addCodexIdList(reliquarySuit).addAllHaveViewedList(Collections.singleton(true));
|
||||
});
|
||||
|
||||
player.getCodex().getUnlockedView().forEach(view -> viewTypeData.addCodexIdList(view).addAllHaveViewedList(Collections.singleton(true)));
|
||||
|
||||
CodexDataFullNotify.Builder proto = CodexDataFullNotify.newBuilder()
|
||||
.addTypeDataList(questTypeData.build())
|
||||
.addTypeDataList(weaponTypeData)
|
||||
|
Loading…
Reference in New Issue
Block a user