diff --git a/Server/data/configs/drop_tables.json b/Server/data/configs/drop_tables.json
index 67eb03150..517d086ed 100644
--- a/Server/data/configs/drop_tables.json
+++ b/Server/data/configs/drop_tables.json
@@ -277,185 +277,107 @@
"ids": "7,1377,1757,1758,1759,1760,1761,7128,7129,7130",
"description": "",
"main": [
- {
- "minAmount": "1",
- "weight": "5.0",
- "id": "5345",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "25.0",
- "id": "5341",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "50.0",
- "id": "5329",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "5.0",
- "id": "5331",
- "maxAmount": "1"
- },
{
"minAmount": "4",
- "weight": "25.0",
- "id": "5324",
- "maxAmount": "4"
- },
- {
- "minAmount": "4",
- "weight": "50.0",
- "id": "5323",
- "maxAmount": "4"
- },
- {
- "minAmount": "1",
- "weight": "50.0",
- "id": "5318",
- "maxAmount": "4"
- },
- {
- "minAmount": "4",
- "weight": "25.0",
- "id": "5322",
- "maxAmount": "4"
- },
- {
- "minAmount": "4",
- "weight": "25.0",
- "id": "5321",
- "maxAmount": "4"
- },
- {
- "minAmount": "4",
- "weight": "25.0",
- "id": "12148",
- "maxAmount": "4"
- },
- {
- "minAmount": "1",
- "weight": "25.0",
- "id": "1965",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "25.0",
- "id": "313",
- "maxAmount": "1"
- },
- {
- "minAmount": "2",
- "weight": "25.0",
- "id": "562",
- "maxAmount": "2"
- },
- {
- "minAmount": "4",
- "weight": "25.0",
- "id": "556",
+ "weight": "2.0",
+ "id": "557",
"maxAmount": "4"
},
{
"minAmount": "6",
- "weight": "25.0",
+ "weight": "2.0",
"id": "554",
"maxAmount": "6"
},
{
"minAmount": "9",
- "weight": "25.0",
+ "weight": "2.0",
"id": "558",
"maxAmount": "9"
},
+ {
+ "minAmount": "2",
+ "weight": "1.0",
+ "id": "562",
+ "maxAmount": "2"
+ },
{
"minAmount": "1",
- "weight": "25.0",
+ "weight": "11.0",
+ "id": "14424",
+ "maxAmount": "1"
+ },
+ {
+ "minAmount": "1",
+ "weight": "27.0",
+ "id": "14430",
+ "maxAmount": "1"
+ },
+ {
+ "minAmount": "3",
+ "weight": "38.0",
+ "id": "995",
+ "maxAmount": "3"
+ },
+ {
+ "minAmount": "25",
+ "weight": "1.0",
+ "id": "995",
+ "maxAmount": "25"
+ },
+ {
+ "minAmount": "1",
+ "weight": "27.0",
+ "id": "0",
+ "maxAmount": "1"
+ },
+ {
+ "minAmount": "1",
+ "weight": "5.0",
+ "id": "313",
+ "maxAmount": "1"
+ },
+ {
+ "minAmount": "1",
+ "weight": "3.0",
+ "id": "5341",
+ "maxAmount": "1"
+ },
+ {
+ "minAmount": "1",
+ "weight": "2.0",
"id": "1440",
"maxAmount": "1"
},
- {
- "minAmount": "7",
- "weight": "25.0",
- "id": "882",
- "maxAmount": "7"
- },
- {
- "minAmount": "3",
- "weight": "25.0",
- "id": "877",
- "maxAmount": "12"
- },
{
"minAmount": "1",
- "weight": "25.0",
- "id": "1139",
+ "weight": "2.0",
+ "id": "5345",
"maxAmount": "1"
},
{
"minAmount": "1",
- "weight": "25.0",
- "id": "1203",
+ "weight": "2.0",
+ "id": "5343",
"maxAmount": "1"
},
{
"minAmount": "1",
- "weight": "25.0",
- "id": "436",
+ "weight": "1.0",
+ "id": "5329",
"maxAmount": "1"
},
{
"minAmount": "1",
- "weight": "5.0",
- "id": "207",
+ "weight": "1.0",
+ "id": "5340",
"maxAmount": "1"
},
{
"minAmount": "1",
- "weight": "25.0",
- "id": "5320",
+ "weight": "1.0",
+ "id": "1",
"maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "5.0",
- "id": "213",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "5.0",
- "id": "211",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "25.0",
- "id": "217",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "25.0",
- "id": "5319",
- "maxAmount": "1"
- },
- {
- "minAmount": "1",
- "weight": "5.0",
- "id": "5733",
- "maxAmount": "1"
- },
- {
- "minAmount": "3",
- "weight": "50.0",
- "id": "995",
- "maxAmount": "15"
}
]
},
diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json
index efc1afbaa..6b02780ce 100644
--- a/Server/data/configs/item_configs.json
+++ b/Server/data/configs/item_configs.json
@@ -130695,5 +130695,10 @@
"examine": "You should not have this.",
"name": "RSDT Slot",
"id": "14428"
+ },
+ {
+ "examine": "You should not have this.",
+ "name": "ASDT Slot",
+ "id": "14430"
}
]
\ No newline at end of file
diff --git a/Server/data/configs/shared_tables/ASDT.xml b/Server/data/configs/shared_tables/ASDT.xml
new file mode 100644
index 000000000..bc11f62de
--- /dev/null
+++ b/Server/data/configs/shared_tables/ASDT.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Server/src/main/java/core/game/node/entity/npc/drop/AllotmentSeedDropTable.java b/Server/src/main/java/core/game/node/entity/npc/drop/AllotmentSeedDropTable.java
new file mode 100644
index 000000000..71c3c9d07
--- /dev/null
+++ b/Server/src/main/java/core/game/node/entity/npc/drop/AllotmentSeedDropTable.java
@@ -0,0 +1,94 @@
+package core.game.node.entity.npc.drop;
+
+import api.StartupListener;
+import core.game.node.item.Item;
+import core.game.node.item.WeightedChanceItem;
+import core.tools.RandomFunction;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import rs09.ServerConstants;
+import rs09.game.system.SystemLogger;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static rs09.game.system.SystemLogger.logInfo;
+
+/**
+ * Handles the allotment seed drop table.
+ * @author Von Hresvelg
+ */
+public final class AllotmentSeedDropTable implements StartupListener {
+
+ /**
+ * The item id of the item representing the allotment seed drop table slot in a drop
+ * table.
+ */
+ public static final int SLOT_ITEM_ID = 14430;
+
+ /**
+ * The allotment seed drop table.
+ */
+ private static final List TABLE = new ArrayList<>(20);
+
+
+ /**
+ * Initialize needed objects for xml reading/writing
+ */
+ static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ static DocumentBuilder builder;
+
+ static {
+ try {
+ builder = factory.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public AllotmentSeedDropTable() throws ParserConfigurationException {}
+
+ @Override
+ public void startup() {
+ if(ServerConstants.ASDT_DATA_PATH != null && !new File(ServerConstants.ASDT_DATA_PATH).exists()){
+ SystemLogger.logErr(this.getClass(), "Can't locate ASDT file at " + ServerConstants.ASDT_DATA_PATH);
+ return;
+ }
+ parse(ServerConstants.ASDT_DATA_PATH);
+ logInfo(this.getClass(), "Initialized Allotment Seed Drop Table from " + ServerConstants.ASDT_DATA_PATH);
+ }
+
+ /**
+ * Parses the xml file for the allotment seed drop table.
+ * @param file the .xml file containing the allotment seed drop table.
+ */
+ public static void parse(String file){
+ try {
+ Document doc = builder.parse(file);
+
+ NodeList itemNodes = doc.getElementsByTagName("item");
+ for(int i = 0; i < itemNodes.getLength(); i++){
+ Node itemNode = itemNodes.item(i);
+ if(itemNode.getNodeType() == Node.ELEMENT_NODE){
+ Element item = (Element) itemNode;
+ int itemId = Integer.parseInt(item.getAttribute("id"));
+ int minAmt = Integer.parseInt(item.getAttribute("minAmt"));
+ int maxAmt = Integer.parseInt(item.getAttribute("maxAmt"));
+ int weight = Integer.parseInt(item.getAttribute("weight"));
+
+ TABLE.add(new WeightedChanceItem(itemId,minAmt,maxAmt,weight));
+ }
+ }
+ } catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ public static Item retrieve() {return RandomFunction.rollWeightedChanceTable(TABLE);}
+}
\ No newline at end of file
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 8092c724c..50122ae6e 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
@@ -104,6 +104,9 @@ public final class NPCDropTables {
if (item.getId() == RareSeedDropTable.SLOT_ITEM_ID){
item = RareSeedDropTable.retrieve();
}
+ if (item.getId() == AllotmentSeedDropTable.SLOT_ITEM_ID){
+ item = AllotmentSeedDropTable.retrieve();
+ }
if (item.getId() == 995 && player.getBank().hasSpaceFor(item) && ( player.getGlobalData().isEnableCoinMachine() )) {
item = new Item(995, (int) (item.getAmount() + (item.getAmount() * 0.25)));
player.getBank().add(item);
diff --git a/Server/src/main/kotlin/rs09/ServerConstants.kt b/Server/src/main/kotlin/rs09/ServerConstants.kt
index aa682da54..0e8140280 100644
--- a/Server/src/main/kotlin/rs09/ServerConstants.kt
+++ b/Server/src/main/kotlin/rs09/ServerConstants.kt
@@ -86,6 +86,9 @@ class ServerConstants {
@JvmField
var RSDT_DATA_PATH: String? = null
+ @JvmField
+ var ASDT_DATA_PATH: String? = null
+
//the max number of players.
@JvmField
var MAX_PLAYERS = 2000
diff --git a/Server/src/main/kotlin/rs09/game/content/global/WeightBasedTable.kt b/Server/src/main/kotlin/rs09/game/content/global/WeightBasedTable.kt
index d87726c55..7d0c4d745 100644
--- a/Server/src/main/kotlin/rs09/game/content/global/WeightBasedTable.kt
+++ b/Server/src/main/kotlin/rs09/game/content/global/WeightBasedTable.kt
@@ -9,6 +9,7 @@ import core.game.node.entity.npc.drop.UncommonSeedDropTable
import core.game.node.entity.npc.drop.HerbDropTable
import core.game.node.entity.npc.drop.GemDropTable
import core.game.node.entity.npc.drop.RareSeedDropTable
+import core.game.node.entity.npc.drop.AllotmentSeedDropTable
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.tools.RandomFunction
@@ -61,6 +62,7 @@ open class WeightBasedTable : ArrayList() {
SLOT_HDT -> HerbDropTable.retrieve()
SLOT_GDT -> GemDropTable.retrieve()
SLOT_RSDT -> RareSeedDropTable.retrieve()
+ SLOT_ASDT -> AllotmentSeedDropTable.retrieve()
else -> e.getItem()
}
safeItems.add(safeItem)
@@ -118,6 +120,11 @@ open class WeightBasedTable : ArrayList() {
return this
}
+ fun insertASDTRoll(weight: Double): WeightBasedTable{
+ this.add(WeightedItem(SLOT_ASDT,1,1,weight,false))
+ return this
+ }
+
companion object {
@JvmStatic
fun create(vararg items: WeightedItem): WeightBasedTable{
@@ -138,6 +145,7 @@ open class WeightBasedTable : ArrayList() {
val SLOT_HDT = Items.SACRED_CLAY_POUCH_CLASS_2_14424
val SLOT_GDT = Items.SACRED_CLAY_POUCH_CLASS_3_14426
val SLOT_RSDT = Items.SACRED_CLAY_POUCH_CLASS_4_14428
+ val SLOT_ASDT = Items.SACRED_CLAY_POUCH_CLASS_5_14430
}
override fun toString(): String {
diff --git a/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt b/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt
index 680c98c17..20454985a 100644
--- a/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt
+++ b/Server/src/main/kotlin/rs09/game/system/config/ServerConfigParser.kt
@@ -115,6 +115,7 @@ object ServerConfigParser {
ServerConstants.HDT_DATA_PATH = data.getPath("paths.herb_drop_table_path")
ServerConstants.GDT_DATA_PATH = data.getPath("paths.gem_drop_table_path")
ServerConstants.RSDT_DATA_PATH = data.getPath("paths.rare_seed_drop_table_path")
+ ServerConstants.ASDT_DATA_PATH = data.getPath("paths.allotment_seed_drop_table_path")
ServerConstants.SERVER_GE_NAME = data.getString("world.name_ge") ?: ServerConstants.SERVER_NAME
ServerConstants.RULES_AND_INFO_ENABLED = data.getBoolean("world.show_rules", true)
ServerConstants.BOTS_INFLUENCE_PRICE_INDEX = data.getBoolean("world.bots_influence_ge_price", true)
diff --git a/Server/src/test/resources/test.conf b/Server/src/test/resources/test.conf
index 8d8bcffe9..15b5ddd9d 100644
--- a/Server/src/test/resources/test.conf
+++ b/Server/src/test/resources/test.conf
@@ -73,6 +73,8 @@ herb_drop_table_path = "@data/configs/shared_tables/HDT.xml"
gem_drop_table_path = "@data/configs/shared_tables/GDT.xml"
#path to file defining the rare seed drop table
rare_seed_drop_table_path = "@data/configs/shared_tables/RSDT.xml"
+#path to file defining the allotment seed drop table
+allotment_seed_drop_table_path = "@data/configs/shared_tables/ASDT.xml"
#path to file containing boot-time object changes
object_parser_path = "@data/ObjectParser.xml"
#path logs are written to
diff --git a/Server/worldprops/default.conf b/Server/worldprops/default.conf
index b51d65986..d2db5c36f 100644
--- a/Server/worldprops/default.conf
+++ b/Server/worldprops/default.conf
@@ -95,6 +95,8 @@ herb_drop_table_path = "@data/configs/shared_tables/HDT.xml"
gem_drop_table_path = "@data/configs/shared_tables/GDT.xml"
#path to file defining the rare seed drop table
rare_seed_drop_table_path = "@data/configs/shared_tables/RSDT.xml"
+#path to file defining the allotment seed drop table
+allotment_seed_drop_table_path = "@data/configs/shared_tables/ASDT.xml"
#path to file containing boot-time object changes
object_parser_path = "@data/ObjectParser.xml"
#path logs are written to