Addition of configurable drops for bosses.

Contributed by MrNiceGuy.
This commit is contained in:
MobiusDevelopment
2022-08-24 23:24:12 +00:00
parent bf5690956d
commit c82add27e5
78 changed files with 1221 additions and 64 deletions

View File

@@ -61,8 +61,10 @@ import org.l2jmobius.commons.util.PropertiesParser;
import org.l2jmobius.commons.util.StringUtil;
import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.enums.ClassId;
import org.l2jmobius.gameserver.enums.DropType;
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.holders.DropHolder;
import org.l2jmobius.gameserver.model.holders.ItemHolder;
import org.l2jmobius.gameserver.model.skill.AbnormalVisualEffect;
import org.l2jmobius.gameserver.util.FloodProtectorConfig;
@@ -726,6 +728,10 @@ public class Config
public static int DROP_ITEM_MAX_LEVEL_DIFFERENCE;
public static double DROP_ITEM_MIN_LEVEL_GAP_CHANCE;
public static int EVENT_ITEM_MAX_LEVEL_DIFFERENCE;
public static boolean BOSS_DROP_ENABLED;
public static int BOSS_DROP_MIN_LEVEL;
public static int BOSS_DROP_MAX_LEVEL;
public static List<DropHolder> BOSS_DROP_LIST = new ArrayList<>();
public static float RATE_KARMA_LOST;
public static float RATE_KARMA_EXP_LOST;
public static float RATE_SIEGE_GUARDS_PRICE;
@@ -2403,6 +2409,18 @@ public class Config
DROP_ITEM_MAX_LEVEL_DIFFERENCE = ratesConfig.getInt("DropItemMaxLevelDifference", 10);
DROP_ITEM_MIN_LEVEL_GAP_CHANCE = ratesConfig.getDouble("DropItemMinLevelGapChance", 10);
EVENT_ITEM_MAX_LEVEL_DIFFERENCE = ratesConfig.getInt("EventItemMaxLevelDifference", 9);
BOSS_DROP_ENABLED = ratesConfig.getBoolean("BossDropEnable", false);
BOSS_DROP_MIN_LEVEL = ratesConfig.getInt("BossDropMinLevel", 85);
BOSS_DROP_MAX_LEVEL = ratesConfig.getInt("BossDropMaxLevel", 999);
BOSS_DROP_LIST.clear();
for (String s : ratesConfig.getString("BossDropList", "").trim().split(";"))
{
if (s.isEmpty())
{
continue;
}
BOSS_DROP_LIST.add(new DropHolder(DropType.DROP, Integer.parseInt(s.split(",")[0]), Integer.parseInt(s.split(",")[1]), Integer.parseInt(s.split(",")[2]), (Double.parseDouble(s.split(",")[3]))));
}
// Load PvP config file (if exists)
final PropertiesParser pvpConfig = new PropertiesParser(PVP_CONFIG_FILE);

View File

@@ -96,6 +96,8 @@ 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", 85);
final String type = parseString(attrs, "type", "Folk");
Map<String, Object> parameters = null;
Map<Integer, Skill> skills = null;
Set<Integer> clans = null;
@@ -104,8 +106,8 @@ public class NpcData implements IXmlReader
List<DropGroupHolder> dropGroups = null;
set.set("id", npcId);
set.set("displayId", parseInteger(attrs, "displayId"));
set.set("level", parseInteger(attrs, "level"));
set.set("type", parseString(attrs, "type", "Folk"));
set.set("level", level);
set.set("type", type);
set.set("name", parseString(attrs, "name"));
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
@@ -656,6 +658,16 @@ public class NpcData implements IXmlReader
// Clean old drop lists.
template.removeDrops();
// Add configurable item drop for bosses.
if ((Config.BOSS_DROP_ENABLED) && (type.contains("RaidBoss") && (level >= Config.BOSS_DROP_MIN_LEVEL) && (level <= Config.BOSS_DROP_MAX_LEVEL)))
{
if (dropLists == null)
{
dropLists = new ArrayList<>();
}
dropLists.addAll(Config.BOSS_DROP_LIST);
}
// Set new drop lists.
if (dropLists != null)
{