Commit 7f898417 authored by Melledy's avatar Melledy
Browse files

Fix a few null pointer issues.

parent 2e85834e
......@@ -5,13 +5,15 @@ import java.util.List;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import emu.grasscutter.game.props.FightProperty;
import it.unimi.dsi.fastutil.ints.Int2FloatMap;
import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@ResourceType(name = "ReliquaryLevelExcelConfigData.json")
public class ReliquaryLevelData extends GameResource {
private int id;
private Int2ObjectMap<Float> propMap;
private Int2FloatMap propMap;
private int rank;
private int level;
......@@ -40,15 +42,15 @@ public class ReliquaryLevelData extends GameResource {
}
public float getPropValue(int id) {
return propMap.get(id);
return propMap.getOrDefault(id, 0f);
}
@Override
public void onLoad() {
this.id = (rank << 8) + this.getLevel();
this.propMap = new Int2ObjectOpenHashMap<>();
this.propMap = new Int2FloatOpenHashMap();
for (RelicLevelProperty p : addProps) {
this.propMap.put(FightProperty.getPropByName(p.getPropType()).getId(), (Float) p.getValue());
this.propMap.put(FightProperty.getPropByName(p.getPropType()).getId(), p.getValue());
}
}
......
......@@ -4,6 +4,7 @@ import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.proto.QueryPathReqOuterClass;
import emu.grasscutter.net.proto.QueryPathReqOuterClass.QueryPathReq;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketQueryPathRsp;
......@@ -12,12 +13,15 @@ public class HandlerQueryPathReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = QueryPathReqOuterClass.QueryPathReq.parseFrom(payload);
var req = QueryPathReq.parseFrom(payload);
/**
* It is not the actual work
*/
if (req.getDestinationPosList().size() > 0) {
session.send(new PacketQueryPathRsp(req));
}
}
}
......@@ -159,8 +159,10 @@ final class ToolsWithLanguageOption {
for (Integer id : list) {
QuestData data = GameData.getQuestDataMap().get(id);
MainQuestData mainQuest = GameData.getMainQuestDataMap().get(data.getMainId());
if (mainQuest != null) {
writer.println(data.getId() + " : " + map.get(mainQuest.getTitleTextMapHash()) + " - " + map.get(data.getDescTextMapHash()));
}
}
writer.println();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment