Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/aCis_datapack/data/xml/monstersDrops.xml b/aCis_datapack/data/xml/monstersDrops.xml
- new file mode 100644
- index 0000000..184d745
- --- /dev/null
- +++ b/aCis_datapack/data/xml/monstersDrops.xml
- @@ -0,0 +1,6 @@
- +<?xml version="1.0" encoding="UTF-8"?>
- +<list>
- + <drops npcId="21337">
- + <settings itemId="9215" minDrop="1" maxDrop="1" chance="1000000" enchant="5-10" enchantChance="100"/>
- + </drops>
- +</list>
- \ No newline at end of file
- diff --git a/aCis_gameserver/config/players.properties b/aCis_gameserver/config/players.properties
- index 809b980..6c6515e 100644
- --- a/aCis_gameserver/config/players.properties
- +++ b/aCis_gameserver/config/players.properties
- @@ -73,6 +72,9 @@
- # Configure messages that players will receive. Variables: $player for player name; $days for days; $npc for npc name.
- HeroMsg = Congratulations $player you received $days days of HERO for murdering the boss $npc.
- +# Enable Custom Drops, configure in data/xml/monstersDrops.xml
- +MonsterDrops = True
- +
- #=============================================================
- # Aio System
- #=============================================================
- diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java
- index 782e7c3..ec42ff4 100644
- --- a/aCis_gameserver/java/net/sf/l2j/Config.java
- +++ b/aCis_gameserver/java/net/sf/l2j/Config.java
- @@ -473,12 +473,13 @@
- public static List<Integer> RAIDBOSS_NOBLES = new ArrayList<>();
- public static int BANKING_SYSTEM_ADENA;
- public static IntIntHolder[] BANKING_SYSTEM_GOLDCOIN;
- public static IntIntHolder[] PVP_COLORS;
- public static IntIntHolder[] KILL_RAID_HERO;
- public static String KILL_HERO_MSG;
- public static IntIntHolder[] KILL_RAID_VIP;
- public static String KILL_VIP_MSG;
- + public static boolean MONSTERS_DROPS;
- /** Aio */
- public static int AIO_COLOR;
- @@ -1308,10 +1309,14 @@
- for (String skill_id : players.getProperty("RaidBossId", "").split(";"))
- RAIDBOSS_NOBLES.add(Integer.parseInt(skill_id));
- +
- + MONSTERS_DROPS = players.getProperty("MonsterDrops", false);
- +
- BANKING_SYSTEM_GOLDCOIN = players.parseIntIntList("BankingGoldCoin", "9209-1");
- BANKING_SYSTEM_ADENA = players.getProperty("BankingAdenaCount", 500000000);
- PVP_COLORS = players.parseIntIntList("PvpColors", "10-99050");
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
- index 150e4c5..520b05c 100644
- --- a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
- @@ -58,7 +58,7 @@
- import net.sf.l2j.gameserver.data.xml.ArmorSetData;
- import net.sf.l2j.gameserver.data.xml.AugmentationData;
- import net.sf.l2j.gameserver.data.xml.DoorData;
- -import net.sf.l2j.gameserver.data.xml.DropsData;
- +import net.sf.l2j.gameserver.data.xml.DropMonstersData;
- import net.sf.l2j.gameserver.data.xml.EnchantData;
- import net.sf.l2j.gameserver.data.xml.FishData;
- import net.sf.l2j.gameserver.data.xml.HennaData;
- @@ -243,15 +243,12 @@
- StringUtil.printSection("Manor Manager");
- CastleManorManager.getInstance();
- + StringUtil.printSection("Drop Monsters");
- + DropMonstersData.getInstance();
- +
- StringUtil.printSection("NPCs");
- BufferManager.getInstance();
- HerbDropData.getInstance();
- -
- NpcData.getInstance();
- WalkerRouteData.getInstance();
- DoorData.getInstance().spawn();
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/DropMonstersData.java b/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/DropMonstersData.java
- new file mode 100644
- index 0000000..66b5292
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/data/xml/DropMonstersData.java
- @@ -0,0 +1,65 @@
- +package net.sf.l2j.gameserver.data.xml;
- +
- +import java.nio.file.Path;
- +import java.util.HashMap;
- +import java.util.Map;
- +
- +import net.sf.l2j.commons.data.xml.IXmlReader;
- +import net.sf.l2j.commons.util.StatsSet;
- +
- +import net.sf.l2j.gameserver.model.DropMonsters;
- +
- +import org.w3c.dom.Document;
- +
- +/**
- + * @author Williams
- + *
- + */
- +public class DropMonstersData implements IXmlReader
- +{
- + private final Map<Integer, DropMonsters> _data = new HashMap<>();
- +
- + public DropMonstersData()
- + {
- + load();
- + }
- +
- + public void reload()
- + {
- + _data.clear();
- + load();
- + }
- +
- + @Override
- + public void load()
- + {
- + parseFile("./data/xml/monstersDrops.xml");
- + LOGGER.info("Loaded {} drop data.", _data.size());
- + }
- +
- + @Override
- + public void parseDocument(Document doc, Path path)
- + {
- + forEach(doc, "list", listNode -> forEach(listNode, "drops", monstersNode ->
- + {
- + final StatsSet set = parseAttributes(monstersNode);
- + forEach(monstersNode, "settings", setNode -> set.putAll(parseAttributes(setNode)));
- + _data.put(set.getInteger("npcId"), new DropMonsters(set));
- + }));
- + }
- +
- + public DropMonsters getNpcs(int npcId)
- + {
- + return _data.get(npcId);
- + }
- +
- + public static DropMonstersData getInstance()
- + {
- + return SingletonHolder.INSTANCE;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final DropMonstersData INSTANCE = new DropMonstersData();
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/DropMonsters.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/DropMonsters.java
- new file mode 100644
- index 0000000..c00d11d
- --- /dev/null
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/DropMonsters.java
- @@ -0,0 +1,67 @@
- +package net.sf.l2j.gameserver.model;
- +
- +import net.sf.l2j.commons.random.Rnd;
- +import net.sf.l2j.commons.util.StatsSet;
- +
- +import net.sf.l2j.gameserver.model.holder.IntIntHolder;
- +
- +/**
- + * @author Williams
- + *
- + */
- +public class DropMonsters
- +{
- + private int _itemId;
- + private int _minDrop;
- + private int _maxDrop;
- + private int _chance;
- +
- + private final IntIntHolder _enchant;
- + private final int _enchantChance;
- +
- + public DropMonsters(StatsSet set)
- + {
- + _itemId = set.getInteger("itemId");
- + _minDrop = set.getInteger("minDrop");
- + _maxDrop = set.getInteger("maxDrop");
- + _chance = set.getInteger("chance");
- +
- + _enchant = set.getString("enchant", "").isEmpty() ? null : set.getIntIntHolder("enchant");
- + _enchantChance = set.getInteger("enchantChance", 0);
- + }
- +
- + public int getMinDrop()
- + {
- + return _minDrop;
- + }
- +
- + public int getMaxDrop()
- + {
- + return _maxDrop;
- + }
- +
- + public int getChance()
- + {
- + return _chance;
- + }
- +
- + public int getItemId()
- + {
- + return _itemId;
- + }
- +
- + public int getEnchant()
- + {
- + return Rnd.get(Math.min(_enchant.getId(), _enchant.getValue()), Math.max(_enchant.getId(), _enchant.getValue()));
- + }
- +
- + public int getEnchantChance()
- + {
- + return _enchantChance;
- + }
- +
- + public boolean hasEnchant()
- + {
- + return _enchant != null;
- + }
- +}
- \ No newline at end of file
- diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- index fa7ed64..fce5b0d 100644
- --- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- @@ -12,8 +12,9 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.data.manager.CursedWeaponManager;
- +import net.sf.l2j.gameserver.data.xml.DropMonstersData;
- import net.sf.l2j.gameserver.data.xml.HerbDropData;
- +import net.sf.l2j.gameserver.model.DropMonsters;
- import net.sf.l2j.gameserver.model.L2Skill;
- import net.sf.l2j.gameserver.model.actor.Attackable;
- import net.sf.l2j.gameserver.model.actor.Creature;
- @@ -1153,6 +1155,37 @@
- }
- }
- + if (Config.MONSTERS_DROPS)
- + {
- + final DropMonsters monsters = DropMonstersData.getInstance().getNpcs(npcTemplate.getNpcId());
- + if (monsters == null)
- + return;
- +
- + int dropChance = monsters.getChance();
- +
- + // Apply level modifier, if any/wanted.
- + if (Config.DEEPBLUE_DROP_RULES)
- + {
- + int deepBlueDrop = (levelModifier > 0) ? 3 : 1;
- +
- + // Check if we should apply our maths so deep blue mobs will not drop that easy.
- + dropChance = ((monsters.getChance() - ((monsters.getChance() * levelModifier) / 100)) / deepBlueDrop);
- + }
- +
- + if (Config.AUTO_LOOT)
- + {
- + if (Rnd.get(1, 100) < dropChance)
- + {
- + final ItemInstance item = player.addItem("", monsters.getItemId(), Rnd.get(monsters.getMinDrop(), monsters.getMaxDrop()), player, true);
- + if (item.getItem().getType1() == Item.TYPE1_WEAPON_RING_EARRING_NECKLACE || item.getItem().getType1() == Item.TYPE1_SHIELD_ARMOR)
- + {
- + if (monsters.hasEnchant() && Rnd.get(1, 100) < monsters.getEnchantChance())
- + item.setEnchantLevel(monsters.getEnchant());
- + }
- + }
- + }
- + }
- +
- // Apply special item drop for champions.
- if (isChampion() && Config.CHAMPION_REWARD > 0)
- {
Add Comment
Please, Sign In to add comment