From 25d9c2598402f621ec1b6f908af7807b6f62d30e Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Wed, 26 May 2021 22:19:39 +0000
Subject: [PATCH] Configurable LCoin drop rate for monsters. Contributed by
Norvox.
---
.../dist/game/config/Character.ini | 4 +--
.../dist/game/config/Rates.ini | 26 +++++++++++++++++++
.../java/org/l2jmobius/Config.java | 19 ++++++++++++++
.../gameserver/data/xml/NpcData.java | 12 +++++++--
.../dist/game/config/Character.ini | 4 +--
.../dist/game/config/Rates.ini | 26 +++++++++++++++++++
.../java/org/l2jmobius/Config.java | 19 ++++++++++++++
.../gameserver/data/xml/NpcData.java | 12 +++++++--
8 files changed, 114 insertions(+), 8 deletions(-)
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini
index 5958c8a528..48cdb4a39f 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Character.ini
@@ -644,8 +644,8 @@ RaidLootRightsCCSize = 45
# Specific item ids for auto pickup.
# Overrides all methods above.
# Format: itemId,itemId,itemId,....
-# Default: 57
-AutoLootItemIds = 57
+# Default: 57,91663 (Adena,LCoin)
+AutoLootItemIds = 57,91663
# Enable keyboard movement.
# Retail: True
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini
index 55b2cb86b7..ff370e2ee1 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini
@@ -209,3 +209,29 @@ SinEaterXpRate = 1
# Chance of blessing weapon.
# Default: 15.0
BlessingChance = 15.0
+
+
+# ---------------------------------------------------------------------------
+# LCoin Drop
+# ---------------------------------------------------------------------------
+
+# LCoin drops from mobs.
+# Default: false
+LCoinDropEnable = false
+
+# LCoin drop chance from normal mobs.
+# Default: 15.0
+LCoinDropChance = 15.0
+
+# LCoin drop minimum monster level.
+# Default: 40
+LCoinMinimumMonsterLevel = 40
+
+# LCoin drop minimum drop quantity.
+# Default: 1
+LCoinMinDropQuantity = 1
+
+# LCoin drop max drop quantity.
+# Default: 5
+LCoinMaxDropQuantity= 5
+
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java
index d5ecc98518..207997f653 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java
@@ -63,11 +63,20 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.ClassId;
import org.l2jmobius.gameserver.enums.GeoType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
+import org.l2jmobius.gameserver.geoengine.GeoEngine;
+import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
+import org.l2jmobius.gameserver.model.olympiad.Olympiad;
import org.l2jmobius.gameserver.util.FloodProtectorConfig;
import org.l2jmobius.gameserver.util.Util;
+import custom.DelevelManager.DelevelManager;
+import custom.FactionSystem.FactionSystem;
+import custom.NoblessMaster.NoblessMaster;
+import handlers.bypasshandlers.FindPvP;
+import handlers.voicedcommandhandlers.Banking;
+
/**
* This class loads all the game server related configurations from files.
* The files are usually located in config folder in server root folder.
@@ -743,6 +752,11 @@ public class Config
public static int DROP_ITEM_MAX_LEVEL_DIFFERENCE;
public static double DROP_ITEM_MIN_LEVEL_GAP_CHANCE;
public static double BLESSING_CHANCE;
+ public static boolean LCOIN_DROP_ENABLED;
+ public static double LCOIN_DROP_CHANCE;
+ public static int LCOIN_MIN_MOB_LV;
+ public static int LCOIN_MIN_QUANTITY;
+ public static int LCOIN_MAX_QUANTITY;
public static float RATE_KARMA_LOST;
public static float RATE_KARMA_EXP_LOST;
public static float RATE_SIEGE_GUARDS_PRICE;
@@ -2320,6 +2334,11 @@ public class Config
DROP_ITEM_MAX_LEVEL_DIFFERENCE = RatesSettings.getInt("DropItemMaxLevelDifference", 10);
DROP_ITEM_MIN_LEVEL_GAP_CHANCE = RatesSettings.getDouble("DropItemMinLevelGapChance", 10);
BLESSING_CHANCE = RatesSettings.getDouble("BlessingChance", 15.0);
+ LCOIN_DROP_ENABLED = RatesSettings.getBoolean("LCoinDropEnable", false);
+ LCOIN_DROP_CHANCE = RatesSettings.getDouble("LCoinDropChance", 15.0);
+ LCOIN_MIN_MOB_LV = RatesSettings.getInt("LCoinMinimumMonsterLevel", 40);
+ LCOIN_MIN_QUANTITY = RatesSettings.getInt("LCoinMinDropQuantity", 1);
+ LCOIN_MAX_QUANTITY = RatesSettings.getInt("LCoinMaxDropQuantity", 5);
// Load PvP config file (if exists)
final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE);
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/NpcData.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/NpcData.java
index 8f4bfc2af5..366a635d5d 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/NpcData.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/NpcData.java
@@ -48,6 +48,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.holders.DropHolder;
+import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
@@ -96,6 +97,7 @@ public class NpcData implements IXmlReader
NamedNodeMap attrs = listNode.getAttributes();
final StatSet set = new StatSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id");
+ final int level = parseInteger(attrs, "level");
final String type;
Map parameters = null;
Map skills = null;
@@ -104,7 +106,7 @@ public class NpcData implements IXmlReader
List dropLists = null;
set.set("id", npcId);
set.set("displayId", parseInteger(attrs, "displayId"));
- set.set("level", parseByte(attrs, "level"));
+ set.set("level", level);
type = parseString(attrs, "type");
set.set("type", type);
set.set("name", parseString(attrs, "name"));
@@ -633,7 +635,13 @@ public class NpcData implements IXmlReader
// Add LCoin drop for bosses.
if (type.contains("boss"))
{
- dropLists.add(new DropHolder(DropType.DROP, 91663, 1, 1, 100));
+ dropLists.add(new DropHolder(DropType.DROP, Inventory.LCOIN_ID, 1, 1, 100));
+ }
+
+ // Add configurable LCoin drop for monsters.
+ if ((Config.LCOIN_DROP_ENABLED) && (type.contains("Monster") && !type.contains("boss")) && (level >= Config.LCOIN_MIN_MOB_LV))
+ {
+ dropLists.add(new DropHolder(DropType.DROP, Inventory.LCOIN_ID, Config.LCOIN_MIN_QUANTITY, Config.LCOIN_MAX_QUANTITY, Config.LCOIN_DROP_CHANCE));
}
for (DropHolder dropHolder : dropLists)
diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Character.ini b/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Character.ini
index 5958c8a528..48cdb4a39f 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Character.ini
+++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Character.ini
@@ -644,8 +644,8 @@ RaidLootRightsCCSize = 45
# Specific item ids for auto pickup.
# Overrides all methods above.
# Format: itemId,itemId,itemId,....
-# Default: 57
-AutoLootItemIds = 57
+# Default: 57,91663 (Adena,LCoin)
+AutoLootItemIds = 57,91663
# Enable keyboard movement.
# Retail: True
diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Rates.ini b/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Rates.ini
index 55b2cb86b7..ff370e2ee1 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Rates.ini
+++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/Rates.ini
@@ -209,3 +209,29 @@ SinEaterXpRate = 1
# Chance of blessing weapon.
# Default: 15.0
BlessingChance = 15.0
+
+
+# ---------------------------------------------------------------------------
+# LCoin Drop
+# ---------------------------------------------------------------------------
+
+# LCoin drops from mobs.
+# Default: false
+LCoinDropEnable = false
+
+# LCoin drop chance from normal mobs.
+# Default: 15.0
+LCoinDropChance = 15.0
+
+# LCoin drop minimum monster level.
+# Default: 40
+LCoinMinimumMonsterLevel = 40
+
+# LCoin drop minimum drop quantity.
+# Default: 1
+LCoinMinDropQuantity = 1
+
+# LCoin drop max drop quantity.
+# Default: 5
+LCoinMaxDropQuantity= 5
+
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java
index 570edc5b3e..3915ad6bfb 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java
@@ -63,11 +63,20 @@ import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.ClassId;
import org.l2jmobius.gameserver.enums.GeoType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
+import org.l2jmobius.gameserver.geoengine.GeoEngine;
+import org.l2jmobius.gameserver.instancemanager.CustomMailManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
+import org.l2jmobius.gameserver.model.olympiad.Olympiad;
import org.l2jmobius.gameserver.util.FloodProtectorConfig;
import org.l2jmobius.gameserver.util.Util;
+import custom.DelevelManager.DelevelManager;
+import custom.FactionSystem.FactionSystem;
+import custom.NoblessMaster.NoblessMaster;
+import handlers.bypasshandlers.FindPvP;
+import handlers.voicedcommandhandlers.Banking;
+
/**
* This class loads all the game server related configurations from files.
* The files are usually located in config folder in server root folder.
@@ -743,6 +752,11 @@ public class Config
public static int DROP_ITEM_MAX_LEVEL_DIFFERENCE;
public static double DROP_ITEM_MIN_LEVEL_GAP_CHANCE;
public static double BLESSING_CHANCE;
+ public static boolean LCOIN_DROP_ENABLED;
+ public static double LCOIN_DROP_CHANCE;
+ public static int LCOIN_MIN_MOB_LV;
+ public static int LCOIN_MIN_QUANTITY;
+ public static int LCOIN_MAX_QUANTITY;
public static float RATE_KARMA_LOST;
public static float RATE_KARMA_EXP_LOST;
public static float RATE_SIEGE_GUARDS_PRICE;
@@ -2322,6 +2336,11 @@ public class Config
DROP_ITEM_MAX_LEVEL_DIFFERENCE = RatesSettings.getInt("DropItemMaxLevelDifference", 10);
DROP_ITEM_MIN_LEVEL_GAP_CHANCE = RatesSettings.getDouble("DropItemMinLevelGapChance", 10);
BLESSING_CHANCE = RatesSettings.getDouble("BlessingChance", 15.0);
+ LCOIN_DROP_ENABLED = RatesSettings.getBoolean("LCoinDropEnable", false);
+ LCOIN_DROP_CHANCE = RatesSettings.getDouble("LCoinDropChance", 15.0);
+ LCOIN_MIN_MOB_LV = RatesSettings.getInt("LCoinMinimumMonsterLevel", 40);
+ LCOIN_MIN_QUANTITY = RatesSettings.getInt("LCoinMinDropQuantity", 1);
+ LCOIN_MAX_QUANTITY = RatesSettings.getInt("LCoinMaxDropQuantity", 5);
// Load PvP config file (if exists)
final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE);
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/NpcData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/NpcData.java
index 8f4bfc2af5..366a635d5d 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/NpcData.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/NpcData.java
@@ -48,6 +48,7 @@ import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.model.effects.EffectType;
import org.l2jmobius.gameserver.model.holders.DropHolder;
+import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.skills.Skill;
/**
@@ -96,6 +97,7 @@ public class NpcData implements IXmlReader
NamedNodeMap attrs = listNode.getAttributes();
final StatSet set = new StatSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id");
+ final int level = parseInteger(attrs, "level");
final String type;
Map parameters = null;
Map skills = null;
@@ -104,7 +106,7 @@ public class NpcData implements IXmlReader
List dropLists = null;
set.set("id", npcId);
set.set("displayId", parseInteger(attrs, "displayId"));
- set.set("level", parseByte(attrs, "level"));
+ set.set("level", level);
type = parseString(attrs, "type");
set.set("type", type);
set.set("name", parseString(attrs, "name"));
@@ -633,7 +635,13 @@ public class NpcData implements IXmlReader
// Add LCoin drop for bosses.
if (type.contains("boss"))
{
- dropLists.add(new DropHolder(DropType.DROP, 91663, 1, 1, 100));
+ dropLists.add(new DropHolder(DropType.DROP, Inventory.LCOIN_ID, 1, 1, 100));
+ }
+
+ // Add configurable LCoin drop for monsters.
+ if ((Config.LCOIN_DROP_ENABLED) && (type.contains("Monster") && !type.contains("boss")) && (level >= Config.LCOIN_MIN_MOB_LV))
+ {
+ dropLists.add(new DropHolder(DropType.DROP, Inventory.LCOIN_ID, Config.LCOIN_MIN_QUANTITY, Config.LCOIN_MAX_QUANTITY, Config.LCOIN_DROP_CHANCE));
}
for (DropHolder dropHolder : dropLists)