Add back in NPC conversation names

The names of the npc conversations were useful for context. Added them  back in.
This commit is contained in:
James McDowell
2021-05-26 19:41:27 +10:00
parent 9128329d37
commit e967294eb9
4 changed files with 17 additions and 10 deletions

View File

@@ -54,6 +54,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;
public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
@@ -406,15 +407,20 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
eim.registerPlayer(player);
}
}
// Tell the client to use the custom scripts available for the NPCs provided, instead of the WZ entries.
if (YamlConfig.config.server.USE_NPCS_SCRIPTABLE) {
// Create a set to remove duplicate entries if they exist.
Set<Integer> npcsIds = new HashSet<>(YamlConfig.config.server.NPCS_SCRIPTABLE);
// Create a copy to prevent always adding entries to the server's list.
Map<Integer, String> npcsIds = YamlConfig.config.server.NPCS_SCRIPTABLE
.entrySet().stream().collect(Collectors.toMap(
entry -> Integer.parseInt(entry.getKey()),
Entry::getValue
));
// Any npc be specified as the rebirth npc. Allow the npc to use custom scripts explicitly.
if (YamlConfig.config.server.USE_REBIRTH_SYSTEM) {
npcsIds.add(YamlConfig.config.server.REBIRTH_NPC_ID);
npcsIds.put(YamlConfig.config.server.REBIRTH_NPC_ID, "Rebirth");
}
c.announce(MaplePacketCreator.setNPCScriptable(npcsIds));