Drops rework.

This commit is contained in:
MobiusDev
2017-10-06 00:53:49 +00:00
parent 2c61857b12
commit fc94704b2d
408 changed files with 741952 additions and 835872 deletions

View File

@@ -781,7 +781,6 @@ public final class Config
public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
public static Map<Integer, Integer> L2JMOD_DUALBOX_CHECK_WHITELIST;
public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
public static boolean L2JMOD_OLD_DROP_BEHAVIOR;
public static boolean CUSTOM_STARTING_LOC;
public static int CUSTOM_STARTING_LOC_X;
public static int CUSTOM_STARTING_LOC_Y;
@@ -905,11 +904,11 @@ public final class Config
public static float RATE_QUEST_REWARD_RECIPE;
public static float RATE_QUEST_REWARD_MATERIAL;
public static float RATE_DEATH_DROP_AMOUNT_MULTIPLIER;
public static float RATE_CORPSE_DROP_AMOUNT_MULTIPLIER;
public static float RATE_SPOIL_DROP_AMOUNT_MULTIPLIER;
public static float RATE_HERB_DROP_AMOUNT_MULTIPLIER;
public static float RATE_RAID_DROP_AMOUNT_MULTIPLIER;
public static float RATE_DEATH_DROP_CHANCE_MULTIPLIER;
public static float RATE_CORPSE_DROP_CHANCE_MULTIPLIER;
public static float RATE_SPOIL_DROP_CHANCE_MULTIPLIER;
public static float RATE_HERB_DROP_CHANCE_MULTIPLIER;
public static float RATE_RAID_DROP_CHANCE_MULTIPLIER;
public static Map<Integer, Float> RATE_DROP_AMOUNT_BY_ID;
@@ -2101,14 +2100,6 @@ public final class Config
PET_HP_REGEN_MULTIPLIER = NPC.getDouble("PetHpRegenMultiplier", 100) / 100;
PET_MP_REGEN_MULTIPLIER = NPC.getDouble("PetMpRegenMultiplier", 100) / 100;
DROP_ADENA_MIN_LEVEL_DIFFERENCE = NPC.getInt("DropAdenaMinLevelDifference", 8);
DROP_ADENA_MAX_LEVEL_DIFFERENCE = NPC.getInt("DropAdenaMaxLevelDifference", 15);
DROP_ADENA_MIN_LEVEL_GAP_CHANCE = NPC.getDouble("DropAdenaMinLevelGapChance", 10);
DROP_ITEM_MIN_LEVEL_DIFFERENCE = NPC.getInt("DropItemMinLevelDifference", 5);
DROP_ITEM_MAX_LEVEL_DIFFERENCE = NPC.getInt("DropItemMaxLevelDifference", 10);
DROP_ITEM_MIN_LEVEL_GAP_CHANCE = NPC.getDouble("DropItemMinLevelGapChance", 10);
// Load Rates L2Properties file (if exists)
final PropertiesParser RatesSettings = new PropertiesParser(RATES_CONFIG_FILE);
@@ -2161,11 +2152,11 @@ public final class Config
KARMA_RATE_DROP_EQUIP_WEAPON = RatesSettings.getInt("KarmaRateDropEquipWeapon", 10);
RATE_DEATH_DROP_AMOUNT_MULTIPLIER = RatesSettings.getFloat("DeathDropAmountMultiplier", 1);
RATE_CORPSE_DROP_AMOUNT_MULTIPLIER = RatesSettings.getFloat("CorpseDropAmountMultiplier", 1);
RATE_SPOIL_DROP_AMOUNT_MULTIPLIER = RatesSettings.getFloat("SpoilDropAmountMultiplier", 1);
RATE_HERB_DROP_AMOUNT_MULTIPLIER = RatesSettings.getFloat("HerbDropAmountMultiplier", 1);
RATE_RAID_DROP_AMOUNT_MULTIPLIER = RatesSettings.getFloat("RaidDropAmountMultiplier", 1);
RATE_DEATH_DROP_CHANCE_MULTIPLIER = RatesSettings.getFloat("DeathDropChanceMultiplier", 1);
RATE_CORPSE_DROP_CHANCE_MULTIPLIER = RatesSettings.getFloat("CorpseDropChanceMultiplier", 1);
RATE_SPOIL_DROP_CHANCE_MULTIPLIER = RatesSettings.getFloat("SpoilDropChanceMultiplier", 1);
RATE_HERB_DROP_CHANCE_MULTIPLIER = RatesSettings.getFloat("HerbDropChanceMultiplier", 1);
RATE_RAID_DROP_CHANCE_MULTIPLIER = RatesSettings.getFloat("RaidDropChanceMultiplier", 1);
@@ -2225,6 +2216,13 @@ public final class Config
}
}
DROP_ADENA_MIN_LEVEL_DIFFERENCE = RatesSettings.getInt("DropAdenaMinLevelDifference", 8);
DROP_ADENA_MAX_LEVEL_DIFFERENCE = RatesSettings.getInt("DropAdenaMaxLevelDifference", 15);
DROP_ADENA_MIN_LEVEL_GAP_CHANCE = RatesSettings.getDouble("DropAdenaMinLevelGapChance", 10);
DROP_ITEM_MIN_LEVEL_DIFFERENCE = RatesSettings.getInt("DropItemMinLevelDifference", 5);
DROP_ITEM_MAX_LEVEL_DIFFERENCE = RatesSettings.getInt("DropItemMaxLevelDifference", 10);
DROP_ITEM_MIN_LEVEL_GAP_CHANCE = RatesSettings.getDouble("DropItemMinLevelGapChance", 10);
// Load Custom L2Properties file (if exists)
final PropertiesParser CustomSettings = new PropertiesParser(CUSTOM_CONFIG_FILE);
@@ -2272,8 +2270,6 @@ public final class Config
L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = CustomSettings.getBoolean("EnableWarehouseSortingClan", false);
L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = CustomSettings.getBoolean("EnableWarehouseSortingPrivate", false);
L2JMOD_OLD_DROP_BEHAVIOR = CustomSettings.getBoolean("OldDropBehavior", false);
if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
{
TVT_EVENT_ENABLED = false;

View File

@@ -34,16 +34,15 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.AISkillScope;
import com.l2jmobius.gameserver.enums.DropType;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.drops.DropListScope;
import com.l2jmobius.gameserver.model.drops.GeneralDropItem;
import com.l2jmobius.gameserver.model.drops.GroupedGeneralDropItem;
import com.l2jmobius.gameserver.model.drops.IDropItem;
import com.l2jmobius.gameserver.model.effects.L2EffectType;
import com.l2jmobius.gameserver.model.holders.DropHolder;
import com.l2jmobius.gameserver.model.holders.MinionHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
@@ -102,7 +101,7 @@ public class NpcData implements IXmlReader
Map<Integer, Skill> skills = null;
Set<Integer> clans = null;
Set<Integer> ignoreClanNpcIds = null;
Map<DropListScope, List<IDropItem>> dropLists = null;
List<DropHolder> dropLists = null;
set.set("id", npcId);
set.set("displayId", parseInteger(attrs, "displayId"));
set.set("level", parseByte(attrs, "level"));
@@ -443,28 +442,41 @@ public class NpcData implements IXmlReader
}
case "droplists":
{
for (Node dropListsNode = npcNode.getFirstChild(); dropListsNode != null; dropListsNode = dropListsNode.getNextSibling())
for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{
DropListScope dropListScope = null;
DropType dropType = null;
try
{
dropListScope = Enum.valueOf(DropListScope.class, dropListsNode.getNodeName().toUpperCase());
dropType = Enum.valueOf(DropType.class, drop_lists_node.getNodeName().toUpperCase());
}
catch (Exception e)
{
}
if (dropListScope != null)
if (dropType != null)
{
if (dropLists == null)
{
dropLists = new EnumMap<>(DropListScope.class);
dropLists = new ArrayList<>();
}
final List<IDropItem> dropList = new ArrayList<>();
parseDropList(f, dropListsNode, dropListScope, dropList);
dropLists.put(dropListScope, Collections.unmodifiableList(dropList));
for (Node drop_node = drop_lists_node.getFirstChild(); drop_node != null; drop_node = drop_node.getNextSibling())
{
final NamedNodeMap drop_attrs = drop_node.getAttributes();
if ("item".equals(drop_node.getNodeName().toLowerCase()))
{
final DropHolder dropItem = new DropHolder(dropType, parseInteger(drop_attrs, "id"), parseLong(drop_attrs, "min"), parseLong(drop_attrs, "max"), parseDouble(drop_attrs, "chance"));
if (ItemTable.getInstance().getTemplate(parseInteger(drop_attrs, "id")) == null)
{
LOGGER.warning("DropListItem: Could not find item with id " + parseInteger(drop_attrs, "id") + ".");
}
else
{
dropLists.add(dropItem);
}
}
}
}
}
break;
@@ -628,67 +640,27 @@ public class NpcData implements IXmlReader
template.setClans(clans);
template.setIgnoreClanNpcIds(ignoreClanNpcIds);
template.setDropLists(dropLists);
}
}
}
}
}
private void parseDropList(File f, Node dropListNode, DropListScope dropListScope, List<IDropItem> drops)
{
for (Node dropNode = dropListNode.getFirstChild(); dropNode != null; dropNode = dropNode.getNextSibling())
{
switch (dropNode.getNodeName().toLowerCase())
{
case "group":
{
final GroupedGeneralDropItem dropItem = dropListScope.newGroupedDropItem(parseDouble(dropNode.getAttributes(), "chance"));
final List<IDropItem> groupedDropList = new ArrayList<>(2);
for (Node groupNode = dropNode.getFirstChild(); groupNode != null; groupNode = groupNode.getNextSibling())
{
parseDropListItem(groupNode, dropListScope, groupedDropList);
}
final List<GeneralDropItem> items = new ArrayList<>(groupedDropList.size());
for (IDropItem item : groupedDropList)
{
if (item instanceof GeneralDropItem)
if (dropLists != null)
{
items.add((GeneralDropItem) item);
}
else
{
LOGGER.warning("[" + f + "] grouped general drop item supports only general drop item.");
for (DropHolder dropHolder : dropLists)
{
switch (dropHolder.getDropType())
{
case DROP:
{
template.addDrop(dropHolder);
break;
}
case SPOIL:
{
template.addSpoil(dropHolder);
break;
}
}
}
}
}
dropItem.setItems(items);
drops.add(dropItem);
break;
}
default:
{
parseDropListItem(dropNode, dropListScope, drops);
break;
}
}
}
}
private void parseDropListItem(Node dropListItem, DropListScope dropListScope, List<IDropItem> drops)
{
final NamedNodeMap attrs = dropListItem.getAttributes();
switch (dropListItem.getNodeName().toLowerCase())
{
case "item":
{
final IDropItem dropItem = dropListScope.newDropItem(parseInteger(attrs, "id"), parseLong(attrs, "min"), parseLong(attrs, "max"), parseDouble(attrs, "chance"));
if (dropItem != null)
{
drops.add(dropItem);
}
break;
}
}
}

View File

@@ -14,30 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import com.l2jmobius.Config;
package com.l2jmobius.gameserver.enums;
/**
* @author NosBit
* @author Mobius
*/
public class GroupedDeathDropItem extends GroupedGeneralDropItem
public enum DropType
{
/**
* @param chance the chance of this drop item.
*/
public GroupedDeathDropItem(double chance)
{
super(chance);
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drops.GroupedGeneralDropItem#getGlobalChanceMultiplier()
*/
@Override
protected double getGlobalChanceMultiplier()
{
return Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER;
}
DROP,
SPOIL;
}

View File

@@ -37,6 +37,7 @@ import com.l2jmobius.gameserver.datatables.EventDroplist;
import com.l2jmobius.gameserver.datatables.EventDroplist.DateDrop;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.DropType;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
@@ -56,7 +57,6 @@ import com.l2jmobius.gameserver.model.actor.knownlist.AttackableKnownList;
import com.l2jmobius.gameserver.model.actor.status.AttackableStatus;
import com.l2jmobius.gameserver.model.actor.tasks.attackable.CommandChannelTimer;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.drops.DropListScope;
import com.l2jmobius.gameserver.model.events.EventDispatcher;
import com.l2jmobius.gameserver.model.events.impl.character.npc.attackable.OnAttackableAggroRangeEnter;
import com.l2jmobius.gameserver.model.events.impl.character.npc.attackable.OnAttackableAttack;
@@ -961,10 +961,10 @@ public class L2Attackable extends L2Npc
if (isSpoiled())
{
_sweepItems.set(npcTemplate.calculateDrops(DropListScope.CORPSE, this, player));
_sweepItems.set(npcTemplate.calculateDrops(DropType.SPOIL, this, player));
}
final Collection<ItemHolder> deathItems = npcTemplate.calculateDrops(DropListScope.DEATH, this, player);
final Collection<ItemHolder> deathItems = npcTemplate.calculateDrops(DropType.DROP, this, player);
if (deathItems != null)
{
for (ItemHolder drop : deathItems)

View File

@@ -19,25 +19,29 @@ package com.l2jmobius.gameserver.model.actor.templates;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.AISkillScope;
import com.l2jmobius.gameserver.enums.AIType;
import com.l2jmobius.gameserver.enums.DropType;
import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.enums.Sex;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.drops.DropListScope;
import com.l2jmobius.gameserver.model.drops.IDropItem;
import com.l2jmobius.gameserver.model.holders.DropHolder;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.util.Util;
import com.l2jmobius.util.Rnd;
/**
* NPC template.
@@ -90,7 +94,8 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
private Map<AISkillScope, List<Skill>> _aiSkillLists;
private Set<Integer> _clans;
private Set<Integer> _ignoreClanNpcIds;
private Map<DropListScope, List<IDropItem>> _dropLists;
private List<DropHolder> _dropListDeath;
private List<DropHolder> _dropListSpoil;
private double _collisionRadiusGrown;
private double _collisionHeightGrown;
@@ -504,49 +509,220 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable
_ignoreClanNpcIds = ignoreClanNpcIds != null ? Collections.unmodifiableSet(ignoreClanNpcIds) : null;
}
public Map<DropListScope, List<IDropItem>> getDropLists()
public void addDrop(DropHolder dropHolder)
{
return _dropLists;
if (_dropListDeath == null)
{
_dropListDeath = new ArrayList<>();
}
_dropListDeath.add(dropHolder);
}
public void setDropLists(Map<DropListScope, List<IDropItem>> dropLists)
public void addSpoil(DropHolder dropHolder)
{
_dropLists = dropLists != null ? Collections.unmodifiableMap(dropLists) : null;
if (_dropListSpoil == null)
{
_dropListSpoil = new ArrayList<>();
}
_dropListSpoil.add(dropHolder);
}
public List<IDropItem> getDropList(DropListScope dropListScope)
public List<DropHolder> getDropList(DropType dropType)
{
return _dropLists != null ? _dropLists.get(dropListScope) : null;
switch (dropType)
{
case DROP:
{
return _dropListDeath;
}
case SPOIL:
{
return _dropListSpoil;
}
}
return null;
}
public Collection<ItemHolder> calculateDrops(DropListScope dropListScope, L2Character victim, L2Character killer)
public Collection<ItemHolder> calculateDrops(DropType dropType, L2Character victim, L2Character killer)
{
final List<IDropItem> dropList = getDropList(dropListScope);
final List<DropHolder> dropList = getDropList(dropType);
if (dropList == null)
{
return null;
}
final int levelDifference = victim.getLevel() - killer.getLevel();
Collection<ItemHolder> calculatedDrops = null;
for (IDropItem dropItem : dropList)
for (DropHolder dropItem : dropList)
{
final Collection<ItemHolder> drops = dropItem.calculateDrops(victim, killer);
if ((drops == null) || drops.isEmpty())
// check level gap that may prevent drop this item
final double levelGapChanceToDrop;
if (dropItem.getItemId() == Inventory.ADENA_ID)
{
levelGapChanceToDrop = Util.map(levelDifference, -Config.DROP_ADENA_MAX_LEVEL_DIFFERENCE, -Config.DROP_ADENA_MIN_LEVEL_DIFFERENCE, Config.DROP_ADENA_MIN_LEVEL_GAP_CHANCE, 100.0);
}
else
{
levelGapChanceToDrop = Util.map(levelDifference, -Config.DROP_ITEM_MAX_LEVEL_DIFFERENCE, -Config.DROP_ITEM_MIN_LEVEL_DIFFERENCE, Config.DROP_ITEM_MIN_LEVEL_GAP_CHANCE, 100.0);
}
if ((Rnd.nextDouble() * 100) > levelGapChanceToDrop)
{
continue;
}
if (calculatedDrops == null)
// calculate chances
final ItemHolder drop = calculateDrop(dropItem, victim, killer);
if (drop == null)
{
calculatedDrops = new LinkedList<>();
continue;
}
calculatedDrops.addAll(drops);
// create list
if (calculatedDrops == null)
{
calculatedDrops = new ArrayList<>();
}
// finally
calculatedDrops.add(drop);
}
return calculatedDrops;
}
/**
* All item drop chance calculations are done by this method.
* @param dropItem
* @param victim
* @param killer
* @return ItemHolder
*/
private ItemHolder calculateDrop(DropHolder dropItem, L2Character victim, L2Character killer)
{
switch (dropItem.getDropType())
{
case DROP:
{
final L2Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId());
// chance
double rateChance = 1;
if (Config.RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId()) != null)
{
rateChance *= Config.RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId());
}
else if (item.hasExImmediateEffect())
{
rateChance *= Config.RATE_HERB_DROP_CHANCE_MULTIPLIER;
}
else if (victim.isRaid())
{
rateChance *= Config.RATE_RAID_DROP_CHANCE_MULTIPLIER;
}
else
{
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER;
}
// premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus())
{
if (Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId()) != null)
{
rateChance *= Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId());
}
else if (item.hasExImmediateEffect())
{
// TODO: Premium herb chance? :)
}
else if (victim.isRaid())
{
// TODO: Premium raid chance? :)
}
else
{
rateChance *= Config.PREMIUM_RATE_DROP_CHANCE;
}
}
// calculate if item will drop
if ((Rnd.nextDouble() * 100) < (dropItem.getChance() * rateChance))
{
// amount is calculated after chance returned success
double rateAmount = 1;
if (Config.RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId()) != null)
{
rateAmount *= Config.RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId());
}
else if (item.hasExImmediateEffect())
{
rateAmount *= Config.RATE_HERB_DROP_AMOUNT_MULTIPLIER;
}
else if (victim.isRaid())
{
rateAmount *= Config.RATE_RAID_DROP_AMOUNT_MULTIPLIER;
}
else
{
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER;
}
// premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus())
{
if (Config.PREMIUM_RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId()) != null)
{
rateAmount *= Config.PREMIUM_RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId());
}
else if (item.hasExImmediateEffect())
{
// TODO: Premium herb amount? :)
}
else if (victim.isRaid())
{
// TODO: Premium raid amount? :)
}
else
{
rateAmount *= Config.PREMIUM_RATE_DROP_AMOUNT;
}
}
// finally
return new ItemHolder(dropItem.getItemId(), (long) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount));
}
break;
}
case SPOIL:
{
// chance
double rateChance = Config.RATE_SPOIL_DROP_CHANCE_MULTIPLIER;
// premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus())
{
rateChance *= Config.PREMIUM_RATE_SPOIL_CHANCE;
}
// calculate if item will be rewarded
if ((Rnd.nextDouble() * 100) < (dropItem.getChance() * rateChance))
{
// amount is calculated after chance returned success
double rateAmount = Config.RATE_SPOIL_DROP_AMOUNT_MULTIPLIER;
// premium amount
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus())
{
rateAmount *= Config.PREMIUM_RATE_SPOIL_AMOUNT;
}
// finally
return new ItemHolder(dropItem.getItemId(), (long) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount));
}
break;
}
}
return null;
}
public double getCollisionRadiusGrown()
{
return _collisionRadiusGrown;

View File

@@ -1,56 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import com.l2jmobius.Config;
/**
* @author NosBit
*/
public class CorpseDropItem extends GeneralDropItem
{
/**
* @param itemId the item id
* @param min the min count
* @param max the max count
* @param chance the chance of this drop item
*/
public CorpseDropItem(int itemId, long min, long max, double chance)
{
super(itemId, min, max, chance);
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drops.GeneralDropItem#getGlobalAmountMultiplier()
*/
@Override
protected double getGlobalAmountMultiplier(boolean isPremium)
{
return isPremium ? Config.PREMIUM_RATE_SPOIL_AMOUNT * Config.RATE_CORPSE_DROP_AMOUNT_MULTIPLIER : Config.RATE_CORPSE_DROP_AMOUNT_MULTIPLIER;
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drops.GeneralDropItem#getGlobalChanceMultiplier()
*/
@Override
protected double getGlobalChanceMultiplier(boolean isPremium)
{
return isPremium ? Config.PREMIUM_RATE_SPOIL_CHANCE * Config.RATE_CORPSE_DROP_CHANCE_MULTIPLIER : Config.RATE_CORPSE_DROP_CHANCE_MULTIPLIER;
}
}

View File

@@ -1,56 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import com.l2jmobius.Config;
/**
* @author NosBit
*/
public class DeathDropItem extends GeneralDropItem
{
/**
* @param itemId the item id
* @param min the min count
* @param max the max count
* @param chance the chance of this drop item
*/
public DeathDropItem(int itemId, long min, long max, double chance)
{
super(itemId, min, max, chance);
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drops.GeneralDropItem#getGlobalAmountMultiplier()
*/
@Override
protected double getGlobalAmountMultiplier(boolean isPremium)
{
return isPremium ? Config.PREMIUM_RATE_DROP_AMOUNT * Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER : Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER;
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drops.GeneralDropItem#getGlobalChanceMultiplier()
*/
@Override
protected double getGlobalChanceMultiplier(boolean isPremium)
{
return isPremium ? Config.PREMIUM_RATE_DROP_CHANCE * Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER : Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER;
}
}

View File

@@ -1,90 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author NosBit
*/
public enum DropListScope
{
DEATH(DeathDropItem.class, GroupedDeathDropItem.class),
CORPSE(CorpseDropItem.class, GroupedCorpseDropItem.class);
private static final Logger _log = Logger.getLogger(DropListScope.class.getName());
private final Class<? extends GeneralDropItem> _dropItemClass;
private final Class<? extends GroupedGeneralDropItem> _groupedDropItemClass;
private DropListScope(Class<? extends GeneralDropItem> dropItemClass, Class<? extends GroupedGeneralDropItem> groupedDropItemClass)
{
_dropItemClass = dropItemClass;
_groupedDropItemClass = groupedDropItemClass;
}
public IDropItem newDropItem(int itemId, long min, long max, double chance)
{
final Constructor<? extends GeneralDropItem> constructor;
try
{
constructor = _dropItemClass.getConstructor(int.class, long.class, long.class, double.class);
}
catch (NoSuchMethodException | SecurityException e)
{
_log.log(Level.SEVERE, "Constructor(int, long, long, double) not found for " + _dropItemClass.getSimpleName(), e);
return null;
}
try
{
return constructor.newInstance(itemId, min, max, chance);
}
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
{
_log.log(Level.SEVERE, "", e);
return null;
}
}
public GroupedGeneralDropItem newGroupedDropItem(double chance)
{
final Constructor<? extends GroupedGeneralDropItem> constructor;
try
{
constructor = _groupedDropItemClass.getConstructor(double.class);
}
catch (NoSuchMethodException | SecurityException e)
{
_log.log(Level.SEVERE, "Constructor(double) not found for " + _groupedDropItemClass.getSimpleName(), e);
return null;
}
try
{
return constructor.newInstance(chance);
}
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
{
_log.log(Level.SEVERE, "", e);
return null;
}
}
}

View File

@@ -1,300 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import java.util.ArrayList;
import java.util.Collection;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2ChestInstance;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.util.Util;
import com.l2jmobius.util.Rnd;
/**
* @author NosBit
*/
public class GeneralDropItem implements IDropItem
{
private final int _itemId;
private final long _min;
private final long _max;
private final double _chance;
/**
* @param itemId the item id
* @param min the min count
* @param max the max count
* @param chance the chance of this drop item
*/
public GeneralDropItem(int itemId, long min, long max, double chance)
{
_itemId = itemId;
_min = min;
_max = max;
_chance = chance;
}
protected double getGlobalChanceMultiplier(boolean isPremium)
{
return 1.;
}
protected double getGlobalAmountMultiplier(boolean isPremium)
{
return 1.;
}
private final long getMinMax(L2Character victim, L2Character killer, long val)
{
// Treasure chests x1
if (victim instanceof L2ChestInstance)
{
return val;
}
double multiplier = 1;
// individual drop amount
Float individualDropAmountMultiplier = null;
if (killer.getActingPlayer().hasPremiumStatus())
{
final Float normalMultiplier = Config.RATE_DROP_AMOUNT_BY_ID.get(getItemId());
final Float premiumMultiplier = Config.PREMIUM_RATE_DROP_AMOUNT_BY_ID.get(getItemId());
if ((normalMultiplier != null) && (premiumMultiplier != null))
{
individualDropAmountMultiplier = normalMultiplier * premiumMultiplier;
}
else if (normalMultiplier != null)
{
individualDropAmountMultiplier = normalMultiplier;
}
else if (premiumMultiplier != null)
{
individualDropAmountMultiplier = premiumMultiplier;
}
}
else
{
individualDropAmountMultiplier = Config.RATE_DROP_AMOUNT_BY_ID.get(getItemId());
}
if (individualDropAmountMultiplier != null)
{
// individual amount list multiplier
multiplier *= individualDropAmountMultiplier;
}
else
{
final L2Item item = ItemTable.getInstance().getTemplate(getItemId());
// global amount multiplier
if ((item != null) && item.hasExImmediateEffect())
{
// global herb amount multiplier
multiplier *= Config.RATE_HERB_DROP_AMOUNT_MULTIPLIER;
}
else if (victim.isRaid())
{
// global raid amount multiplier
multiplier *= Config.RATE_RAID_DROP_AMOUNT_MULTIPLIER;
}
else
{
// drop type specific amount multiplier
multiplier *= getGlobalAmountMultiplier(killer.getActingPlayer().hasPremiumStatus());
}
}
// global champions amount multiplier
if (victim.isChampion())
{
multiplier *= getItemId() != Inventory.ADENA_ID ? Config.L2JMOD_CHAMPION_REWARDS_AMOUNT : Config.L2JMOD_CHAMPION_ADENAS_REWARDS_AMOUNT;
}
return (long) (val * multiplier);
}
/**
* Gets the item id
* @return the item id
*/
public int getItemId()
{
return _itemId;
}
/**
* Gets the min drop count
* @return the min
*/
public long getMin()
{
return _min;
}
/**
* Gets the min drop count
* @param victim the victim
* @param killer the killer
* @return the min modified by any rates.
*/
public long getMin(L2Character victim, L2Character killer)
{
return getMinMax(victim, killer, getMin());
}
/**
* Gets the max drop count
* @return the max
*/
public long getMax()
{
return _max;
}
/**
* Gets the max drop count
* @param victim the victim
* @param killer the killer
* @return the max modified by any rates.
*/
public long getMax(L2Character victim, L2Character killer)
{
return getMinMax(victim, killer, getMax());
}
/**
* Gets the chance of this drop item.
* @return the chance
*/
public double getChance()
{
return _chance;
}
/**
* Gets the chance of this drop item.
* @param victim the victim
* @param killer the killer
* @return the chance modified by any rates.
*/
public double getChance(L2Character victim, L2Character killer)
{
// Treasure chests x1
if (victim instanceof L2ChestInstance)
{
return getChance();
}
double multiplier = 1;
// individual drop chance
Float individualDropChanceMultiplier = null;
if (killer.getActingPlayer().hasPremiumStatus())
{
final Float normalMultiplier = Config.RATE_DROP_CHANCE_BY_ID.get(getItemId());
final Float premiumMultiplier = Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(getItemId());
if ((normalMultiplier != null) && (premiumMultiplier != null))
{
individualDropChanceMultiplier = normalMultiplier * premiumMultiplier;
}
else if (normalMultiplier != null)
{
individualDropChanceMultiplier = normalMultiplier;
}
else if (premiumMultiplier != null)
{
individualDropChanceMultiplier = premiumMultiplier;
}
}
else
{
individualDropChanceMultiplier = Config.RATE_DROP_CHANCE_BY_ID.get(getItemId());
}
if (individualDropChanceMultiplier != null)
{
multiplier *= individualDropChanceMultiplier;
}
else
{
final L2Item item = ItemTable.getInstance().getTemplate(getItemId());
if ((item != null) && item.hasExImmediateEffect())
{
multiplier *= Config.RATE_HERB_DROP_CHANCE_MULTIPLIER;
}
else if (victim.isRaid())
{
// global raid chance multiplier
multiplier *= Config.RATE_RAID_DROP_CHANCE_MULTIPLIER;
}
else
{
multiplier *= getGlobalChanceMultiplier(killer.getActingPlayer().hasPremiumStatus());
}
}
if (victim.isChampion())
{
multiplier *= getItemId() != Inventory.ADENA_ID ? Config.L2JMOD_CHAMPION_REWARDS_CHANCE : Config.L2JMOD_CHAMPION_ADENAS_REWARDS_CHANCE;
}
return (getChance() * multiplier);
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drop.IDropItem#calculateDrops(com.l2jmobius.gameserver.model.actor.L2Character, com.l2jmobius.gameserver.model.actor.L2Character)
*/
@Override
public Collection<ItemHolder> calculateDrops(L2Character victim, L2Character killer)
{
final int levelDifference = victim.getLevel() - killer.getLevel();
final double levelGapChanceToDrop;
if (getItemId() == Inventory.ADENA_ID)
{
levelGapChanceToDrop = Util.map(levelDifference, -Config.DROP_ADENA_MAX_LEVEL_DIFFERENCE, -Config.DROP_ADENA_MIN_LEVEL_DIFFERENCE, Config.DROP_ADENA_MIN_LEVEL_GAP_CHANCE, 100.0);
}
else
{
levelGapChanceToDrop = Util.map(levelDifference, -Config.DROP_ITEM_MAX_LEVEL_DIFFERENCE, -Config.DROP_ITEM_MIN_LEVEL_DIFFERENCE, Config.DROP_ITEM_MIN_LEVEL_GAP_CHANCE, 100.0);
}
// There is a chance of level gap that it wont drop this item
if (levelGapChanceToDrop < (Rnd.nextDouble() * 100))
{
return null;
}
final double chance = getChance(victim, killer);
final boolean successes = chance > (Rnd.nextDouble() * 100);
if (successes)
{
final Collection<ItemHolder> items = new ArrayList<>(1);
final long baseDropCount = Rnd.get(getMin(victim, killer), getMax(victim, killer));
final long finaldropCount = (long) (Config.L2JMOD_OLD_DROP_BEHAVIOR ? (baseDropCount * Math.max(1, chance / 100)) + (chance > 100 ? (chance % 100) > (Rnd.nextDouble() * 100) ? baseDropCount : 0 : 0) : baseDropCount);
items.add(new ItemHolder(getItemId(), finaldropCount));
return items;
}
return null;
}
}

View File

@@ -1,43 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import com.l2jmobius.Config;
/**
* @author NosBit
*/
public class GroupedCorpseDropItem extends GroupedGeneralDropItem
{
/**
* @param chance the chance of this drop item.
*/
public GroupedCorpseDropItem(double chance)
{
super(chance);
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drops.GroupedGeneralDropItem#getGlobalChanceMultiplier()
*/
@Override
protected double getGlobalChanceMultiplier()
{
return Config.RATE_CORPSE_DROP_CHANCE_MULTIPLIER;
}
}

View File

@@ -1,179 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2RaidBossInstance;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.util.Util;
import com.l2jmobius.util.Rnd;
/**
* @author NosBit
*/
public class GroupedGeneralDropItem implements IDropItem
{
private final double _chance;
private List<GeneralDropItem> _items;
/**
* @param chance the chance of this drop item.
*/
public GroupedGeneralDropItem(double chance)
{
_chance = chance;
}
protected double getGlobalChanceMultiplier()
{
return 1.;
}
/**
* Gets the chance of this drop item.
* @return the chance
*/
public double getChance()
{
return _chance;
}
/**
* Gets the chance of this drop item.
* @param victim the victim
* @param killer the killer
* @return the chance modified by any rates.
*/
public double getChance(L2Character victim, L2Character killer)
{
for (GeneralDropItem gdi : getItems())
{
final L2Item item = ItemTable.getInstance().getTemplate(gdi.getItemId());
if (item == null)
{
return 0;
}
if (!item.hasExImmediateEffect())
{
// individual chance
Float individualDropChanceMultiplier = null;
if (killer.getActingPlayer().hasPremiumStatus())
{
final Float normalMultiplier = Config.RATE_DROP_CHANCE_BY_ID.get(item.getId());
final Float premiumMultiplier = Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(item.getId());
if ((normalMultiplier != null) && (premiumMultiplier != null))
{
individualDropChanceMultiplier = normalMultiplier * premiumMultiplier;
}
else if (normalMultiplier != null)
{
individualDropChanceMultiplier = normalMultiplier;
}
else if (premiumMultiplier != null)
{
individualDropChanceMultiplier = premiumMultiplier;
}
}
else
{
individualDropChanceMultiplier = Config.RATE_DROP_CHANCE_BY_ID.get(item.getId());
}
if (individualDropChanceMultiplier != null)
{
return getChance() * individualDropChanceMultiplier;
}
return getChance() * getGlobalChanceMultiplier();
}
}
return getChance() * Config.RATE_HERB_DROP_CHANCE_MULTIPLIER;
}
/**
* Gets the items.
* @return the items
*/
public List<GeneralDropItem> getItems()
{
return _items;
}
/**
* Sets an item list to this drop item.
* @param items the item list
*/
public void setItems(List<GeneralDropItem> items)
{
_items = Collections.unmodifiableList(items);
}
/*
* (non-Javadoc)
* @see com.l2jmobius.gameserver.model.drop.IDropItem#calculateDrops(com.l2jmobius.gameserver.model.actor.L2Character, com.l2jmobius.gameserver.model.actor.L2Character)
*/
@Override
public Collection<ItemHolder> calculateDrops(L2Character victim, L2Character killer)
{
final int levelDifference = victim.getLevel() - killer.getLevel();
double chanceModifier;
if (victim instanceof L2RaidBossInstance)
{
chanceModifier = Math.max(0, Math.min(1, (levelDifference * 0.15) + 1));
}
else
{
chanceModifier = 1;
if (Util.map(levelDifference, -Config.DROP_ITEM_MAX_LEVEL_DIFFERENCE, -Config.DROP_ITEM_MIN_LEVEL_DIFFERENCE, Config.DROP_ITEM_MIN_LEVEL_GAP_CHANCE, 100.0) < (Rnd.nextDouble() * 100))
{
return null;
}
}
final double chance = getChance(victim, killer) * chanceModifier;
final boolean successes = chance > (Rnd.nextDouble() * 100);
if (successes)
{
double totalChance = 0;
final double random = (Rnd.nextDouble() * 100);
for (GeneralDropItem item : getItems())
{
// Grouped item chance rates should not be modified.
totalChance += item.getChance(victim, killer);
if (totalChance > random)
{
final Collection<ItemHolder> items = new ArrayList<>(1);
final long baseDropCount = Rnd.get(item.getMin(victim, killer), item.getMax(victim, killer));
final long finaldropCount = (long) (Config.L2JMOD_OLD_DROP_BEHAVIOR ? (baseDropCount * Math.max(1, chance / 100)) + ((chance > 100) && ((chance % 100) > (Rnd.nextDouble() * 100)) ? baseDropCount : 0) : baseDropCount);
items.add(new ItemHolder(item.getItemId(), finaldropCount));
return items;
}
}
}
return null;
}
}

View File

@@ -1,36 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.drops;
import java.util.Collection;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
/**
* @author NosBit
*/
public interface IDropItem
{
/**
* Calculates drops of this drop item.
* @param victim the victim
* @param killer the killer
* @return {@code null} or empty collection if there are no drops, a collection containing all items to drop otherwise
*/
Collection<ItemHolder> calculateDrops(L2Character victim, L2Character killer);
}

View File

@@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.datatables.EventDroplist;
import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.announce.EventAnnouncement;
import com.l2jmobius.gameserver.model.drops.GeneralDropItem;
import com.l2jmobius.gameserver.model.holders.DropHolder;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.script.DateRange;
import com.l2jmobius.gameserver.util.Broadcast;
@@ -62,7 +62,7 @@ public class LongTimeEvent extends Quest
private final List<NpcSpawn> _spawnList = new ArrayList<>();
// Drop data for event
private final List<GeneralDropItem> _dropList = new ArrayList<>();
private final List<DropHolder> _dropList = new ArrayList<>();
private class NpcSpawn
{
@@ -180,7 +180,7 @@ public class LongTimeEvent extends Quest
continue;
}
_dropList.add(new GeneralDropItem(itemId, minCount, maxCount, finalChance));
_dropList.add(new DropHolder(null, itemId, minCount, maxCount, finalChance));
}
catch (NumberFormatException nfe)
{
@@ -260,7 +260,7 @@ public class LongTimeEvent extends Quest
// Add drop
if ((_dropList != null) && (currentTime < _dropPeriod.getEndDate().getTime()))
{
for (GeneralDropItem drop : _dropList)
for (DropHolder drop : _dropList)
{
EventDroplist.getInstance().addGlobalDrop(drop.getItemId(), drop.getMin(), drop.getMax(), (int) drop.getChance(), _dropPeriod);
}

View File

@@ -0,0 +1,65 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.holders;
import com.l2jmobius.gameserver.enums.DropType;
/**
* @author Mobius
*/
public class DropHolder
{
private final DropType _dropType;
private final int _itemId;
private final long _min;
private final long _max;
private final double _chance;
public DropHolder(DropType dropType, int itemId, long min, long max, double chance)
{
_dropType = dropType;
_itemId = itemId;
_min = min;
_max = max;
_chance = chance;
}
public DropType getDropType()
{
return _dropType;
}
public int getItemId()
{
return _itemId;
}
public long getMin()
{
return _min;
}
public long getMax()
{
return _max;
}
public double getChance()
{
return _chance;
}
}