mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 05:44:36 +01:00
Only props that restore technique points should restore them for the player
This commit is contained in:
@@ -20,6 +20,7 @@ public class GameData {
|
||||
@Getter private static Int2ObjectMap<EquipmentExcel> equipExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<RelicExcel> relicExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<MonsterExcel> monsterExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<PropExcel> propExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<NpcExcel> npcExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<NpcMonsterExcel> npcMonsterExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
@Getter private static Int2ObjectMap<StageExcel> stageExcelMap = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
32
src/main/java/emu/lunarcore/data/excel/PropExcel.java
Normal file
32
src/main/java/emu/lunarcore/data/excel/PropExcel.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package emu.lunarcore.data.excel;
|
||||
|
||||
import emu.lunarcore.data.GameResource;
|
||||
import emu.lunarcore.data.ResourceType;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@ResourceType(name = {"MazeProp.json"})
|
||||
public class PropExcel extends GameResource {
|
||||
private int ID;
|
||||
private String JsonPath;
|
||||
|
||||
private transient boolean recoverHp;
|
||||
private transient boolean recoverMp;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
// Hacky way to determine if a prop will recover hp or mp
|
||||
if (getJsonPath() != null && getJsonPath().length() > 0) {
|
||||
if (getJsonPath().contains("MPRecoverBox")) {
|
||||
this.recoverMp = true;
|
||||
} else if (getJsonPath().contains("HPRecoverBox")) {
|
||||
this.recoverHp = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import emu.lunarcore.data.config.*;
|
||||
import emu.lunarcore.data.config.GroupInfo.GroupLoadSide;
|
||||
import emu.lunarcore.data.excel.MazePlaneExcel;
|
||||
import emu.lunarcore.data.excel.NpcMonsterExcel;
|
||||
import emu.lunarcore.data.excel.PropExcel;
|
||||
import emu.lunarcore.game.avatar.GameAvatar;
|
||||
import emu.lunarcore.game.enums.PropState;
|
||||
import emu.lunarcore.game.player.PlayerLineup;
|
||||
@@ -98,8 +99,14 @@ public class Scene {
|
||||
// Add props
|
||||
if (group.getPropList() != null && group.getPropList().size() > 0) {
|
||||
for (PropInfo propInfo : group.getPropList()) {
|
||||
// Get prop excel
|
||||
PropExcel propExcel = GameData.getPropExcelMap().get(propInfo.getPropID());
|
||||
if (propExcel == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create prop from prop info
|
||||
EntityProp prop = new EntityProp(propInfo.getPropID(), propInfo.clonePos());
|
||||
EntityProp prop = new EntityProp(propExcel, propInfo.clonePos());
|
||||
prop.setState(propInfo.getState());
|
||||
prop.getRot().set(
|
||||
(int) (propInfo.getRotX() * 1000f),
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package emu.lunarcore.game.scene.entity;
|
||||
|
||||
import emu.lunarcore.data.excel.NpcMonsterExcel;
|
||||
import emu.lunarcore.data.excel.StageExcel;
|
||||
import emu.lunarcore.data.excel.PropExcel;
|
||||
import emu.lunarcore.game.enums.PropState;
|
||||
import emu.lunarcore.game.scene.Scene;
|
||||
import emu.lunarcore.proto.MotionInfoOuterClass.MotionInfo;
|
||||
import emu.lunarcore.proto.SceneEntityInfoOuterClass.SceneEntityInfo;
|
||||
import emu.lunarcore.proto.SceneNpcMonsterInfoOuterClass.SceneNpcMonsterInfo;
|
||||
import emu.lunarcore.proto.ScenePropInfoOuterClass.ScenePropInfo;
|
||||
import emu.lunarcore.proto.VectorOuterClass.Vector;
|
||||
import emu.lunarcore.util.Position;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -18,23 +15,28 @@ public class EntityProp implements GameEntity {
|
||||
@Setter private int entityId;
|
||||
@Setter private int groupId;
|
||||
@Setter private int instId;
|
||||
@Setter private int propId;
|
||||
@Setter private PropState state;
|
||||
|
||||
private PropExcel excel;
|
||||
private Position pos;
|
||||
private Position rot;
|
||||
|
||||
public EntityProp(int propId, Position pos) {
|
||||
this.propId = propId;
|
||||
public EntityProp(PropExcel excel, Position pos) {
|
||||
this.excel = excel;
|
||||
this.pos = pos;
|
||||
this.rot = new Position();
|
||||
this.state = PropState.Closed;
|
||||
}
|
||||
|
||||
public int getPropId() {
|
||||
return excel.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemove(Scene scene) {
|
||||
// TODO Debug
|
||||
scene.getPlayer().getLineupManager().addMp(2);
|
||||
if (excel.isRecoverMp()) {
|
||||
scene.getPlayer().getLineupManager().addMp(2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user