From d027728c7f9838422d6819126536678a9dd0c9cf Mon Sep 17 00:00:00 2001 From: vk Date: Tue, 28 Sep 2021 01:44:09 -0700 Subject: [PATCH] fix clue scroll drops. There is a fairly significant bug with clue scrolls. The only npcs that drops clue scrolls right now are hellhonds (that is because their ids are hard-coded in TreasureTrailPlugin.createDrop()). All other npcs do not drop clues due to a bug in `NPCDropTables`. `NPCDropTables` has two separate ways to access the actual table: one is though `List defaultTable`, ` List charmTable`, and `List mainTable`; And the other is though a combined table `NPCDropTable table`. The problem is that only `NPCDropTable table` is set properly--the other 3 tables are always empty. The reason clues were bugged was because `TreasureTrailPlugin.createDrop()` has a check for `npc.getDefinition().getDropTables().getMainTable().size() < 3`, which always fails. I really do not see the point in this check to begin with, so i am going to remove it. The hard-coded check for hellounds is pointless as well and should be removed. I am also going to remove the 3 empty tables from `NPCDropTables` to avoid and similar bugs in the future. Alternatively, it is possible to make changes to `DropTableParser` and keep those tables, then add post-parsing step to populate `NPCDropTable table` from them. However that would just duplicate all the data in all drops table, and since nothing else was using these individual tables, i just opted for removing them. --- .../content/ttrail/TreasureTrailPlugin.java | 11 +--- .../node/entity/npc/drop/NPCDropTables.java | 51 ------------------- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/Server/src/main/java/core/game/content/ttrail/TreasureTrailPlugin.java b/Server/src/main/java/core/game/content/ttrail/TreasureTrailPlugin.java index 23cbcfe7f..f70aed69b 100644 --- a/Server/src/main/java/core/game/content/ttrail/TreasureTrailPlugin.java +++ b/Server/src/main/java/core/game/content/ttrail/TreasureTrailPlugin.java @@ -132,16 +132,7 @@ public final class TreasureTrailPlugin extends OptionHandler { @Override public boolean createDrop(Item item, Player player, NPC npc, Location l) { - if ((npc.getId() == 49 || npc.getId() == 3586)) { - return true; - } - if (npc.getDefinition().getDropTables().getMainTable().size() < 3) { - return false; - } - if (!hasClue(player)) { - return true; - } - return false; + return !hasClue(player); } @Override diff --git a/Server/src/main/java/core/game/node/entity/npc/drop/NPCDropTables.java b/Server/src/main/java/core/game/node/entity/npc/drop/NPCDropTables.java index 366f19ac5..347c54d76 100644 --- a/Server/src/main/java/core/game/node/entity/npc/drop/NPCDropTables.java +++ b/Server/src/main/java/core/game/node/entity/npc/drop/NPCDropTables.java @@ -10,7 +10,6 @@ import core.game.node.entity.skill.Skills; import core.game.node.item.GroundItem; import core.game.node.item.GroundItemManager; import core.game.node.item.Item; -import core.game.node.item.WeightedChanceItem; import core.game.world.map.Location; import core.game.world.map.RegionManager; import core.tools.RandomFunction; @@ -41,21 +40,6 @@ public final class NPCDropTables { * The npcs that will display drop messages */ public static final int[] MESSAGE_NPCS = { 50, 7133, 7134, 2881, 2882, 2883, 3200, 3340, 6247, 6203, 6260, 6222, 2745, 1160, 8133, 8610, 8611, 8612, 8613, 8614, 6204, 6206, 6208, 6261, 6263, 6265, 6223, 6225, 6227 }; - - /** - * The default drop table (holding the 100% drops). - */ - private final List defaultTable = new ArrayList<>(20); - - /** - * The charms drop table (holding the charm drops). - */ - private final List charmTable = new ArrayList<>(20); - - /** - * The main drop table (holding the main drops). - */ - private final List mainTable = new ArrayList<>(20); public final NPCDropTable table = new NPCDropTable(); @@ -239,41 +223,6 @@ public final class NPCDropTables { return (1 / (1 + def.getCombatLevel())) * 10; } - /** - * @return the defaultTable. - */ - public List getDefaultTable() { - return defaultTable; - } - - /** - * @return the charmTable. - */ - public List getCharmTable() { - return charmTable; - } - - /** - * @return the mainTable. - */ - public List getMainTable() { - return mainTable; - } - - /** - * @return the mainTableSize. - */ - public int getMainTableSize() { - return mainTableSize; - } - - /** - * @param mainTableSize the mainTableSize to set. - */ - public void setMainTableSize(int mainTableSize) { - this.mainTableSize = mainTableSize; - } - /** * Gets the modRate. * @return The modRate.