Reverting Premium System drop calculations.
This commit is contained in:
parent
66f1e4c9f9
commit
2543c68c09
@ -322,7 +322,7 @@ public class NpcViewMod implements IBypassHandler
|
|||||||
sb.append(item.getName());
|
sb.append(item.getName());
|
||||||
sb.append("</font></td></tr><tr><td width=32></td><td width=259><table width=253 cellpadding=0 cellspacing=0>");
|
sb.append("</font></td></tr><tr><td width=32></td><td width=259><table width=253 cellpadding=0 cellspacing=0>");
|
||||||
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td><td width=205 align=center>");
|
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td><td width=205 align=center>");
|
||||||
MinMax minMax = getPreciseMinMax(normalized.getChance(), generalDropItem.getMin(npc, null), generalDropItem.getMax(npc, null), generalDropItem.isPreciseCalculated());
|
MinMax minMax = getPreciseMinMax(normalized.getChance(), generalDropItem.getMin(npc), generalDropItem.getMax(npc), generalDropItem.isPreciseCalculated());
|
||||||
final long min = minMax.min;
|
final long min = minMax.min;
|
||||||
final long max = minMax.max;
|
final long max = minMax.max;
|
||||||
if (min == max)
|
if (min == max)
|
||||||
@ -401,7 +401,7 @@ public class NpcViewMod implements IBypassHandler
|
|||||||
sb.append("</font></td></tr><tr><td width=32></td><td width=300><table width=295 cellpadding=0 cellspacing=0>");
|
sb.append("</font></td></tr><tr><td width=32></td><td width=300><table width=295 cellpadding=0 cellspacing=0>");
|
||||||
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td>");
|
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td>");
|
||||||
sb.append("<td width=247 align=center>");
|
sb.append("<td width=247 align=center>");
|
||||||
MinMax minMax = getPreciseMinMax(dropItem.getChance(npc, activeChar), dropItem.getMin(npc, null), dropItem.getMax(npc, null), dropItem.isPreciseCalculated());
|
MinMax minMax = getPreciseMinMax(dropItem.getChance(npc, activeChar), dropItem.getMin(npc), dropItem.getMax(npc), dropItem.isPreciseCalculated());
|
||||||
|
|
||||||
final long min = minMax.min;
|
final long min = minMax.min;
|
||||||
final long max = minMax.max;
|
final long max = minMax.max;
|
||||||
|
@ -146,12 +146,11 @@ public final class GeneralDropItem implements IDropItem
|
|||||||
/**
|
/**
|
||||||
* Gets the min drop count modified by server rates
|
* Gets the min drop count modified by server rates
|
||||||
* @param victim the victim who drops the item
|
* @param victim the victim who drops the item
|
||||||
* @param killer
|
|
||||||
* @return the min modified by any rates.
|
* @return the min modified by any rates.
|
||||||
*/
|
*/
|
||||||
public final long getMin(L2Character victim, L2Character killer)
|
public final long getMin(L2Character victim)
|
||||||
{
|
{
|
||||||
return (long) (getMin() * getAmountMultiplier(victim, killer));
|
return (long) (getMin() * getAmountMultiplier(victim));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,12 +165,11 @@ public final class GeneralDropItem implements IDropItem
|
|||||||
/**
|
/**
|
||||||
* Gets the max drop count modified by server rates
|
* Gets the max drop count modified by server rates
|
||||||
* @param victim the victim who drops the item
|
* @param victim the victim who drops the item
|
||||||
* @param killer
|
|
||||||
* @return the max modified by any rates.
|
* @return the max modified by any rates.
|
||||||
*/
|
*/
|
||||||
public final long getMax(L2Character victim, L2Character killer)
|
public final long getMax(L2Character victim)
|
||||||
{
|
{
|
||||||
return (long) (getMax() * getAmountMultiplier(victim, killer));
|
return (long) (getMax() * getAmountMultiplier(victim));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,6 +181,17 @@ public final class GeneralDropItem implements IDropItem
|
|||||||
return _chance;
|
return _chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the general chance to drop this item modified by rates. <br>
|
||||||
|
* This shall be used in calculating chance within drop groups.
|
||||||
|
* @param victim the victim who drops the item
|
||||||
|
* @return the chance modified by any rates.
|
||||||
|
*/
|
||||||
|
public final double getChance(L2Character victim)
|
||||||
|
{
|
||||||
|
return getChance() * getChanceMultiplier(victim);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the chance of dropping this item for current killer and victim (modified by server rates and another rules based on killer) <br>
|
* Gets the chance of dropping this item for current killer and victim (modified by server rates and another rules based on killer) <br>
|
||||||
* This shall be used to calculate chance outside of drop groups.
|
* This shall be used to calculate chance outside of drop groups.
|
||||||
@ -192,7 +201,7 @@ public final class GeneralDropItem implements IDropItem
|
|||||||
*/
|
*/
|
||||||
public final double getChance(L2Character victim, L2Character killer)
|
public final double getChance(L2Character victim, L2Character killer)
|
||||||
{
|
{
|
||||||
return (getKillerChanceModifier(victim, killer) * getChance());
|
return (getKillerChanceModifier(victim, killer) * getChance(victim));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -223,22 +232,20 @@ public final class GeneralDropItem implements IDropItem
|
|||||||
/**
|
/**
|
||||||
* This gets standard server rates for this item
|
* This gets standard server rates for this item
|
||||||
* @param victim who drops the item
|
* @param victim who drops the item
|
||||||
* @param killer
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected final double getAmountMultiplier(L2Character victim, L2Character killer)
|
protected final double getAmountMultiplier(L2Character victim)
|
||||||
{
|
{
|
||||||
return _amountStrategy.getAmountMultiplier(this, victim, killer);
|
return _amountStrategy.getAmountMultiplier(this, victim);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This gets standard server rates for this item
|
* This gets standard server rates for this item
|
||||||
* @param victim who drops the item
|
* @param victim who drops the item
|
||||||
* @param killer
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected final double getChanceMultiplier(L2Character victim, L2Character killer)
|
protected final double getChanceMultiplier(L2Character victim)
|
||||||
{
|
{
|
||||||
return _chanceStrategy.getChanceMultiplier(this, victim, killer);
|
return _chanceStrategy.getChanceMultiplier(this, victim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,14 +214,14 @@ public final class GroupedGeneralDropItem implements IDropItem
|
|||||||
double sumchance = 0;
|
double sumchance = 0;
|
||||||
for (GeneralDropItem item : getItems())
|
for (GeneralDropItem item : getItems())
|
||||||
{
|
{
|
||||||
sumchance += (item.getChance(victim, killer) * getChance() * chanceModifier) / 100;
|
sumchance += (item.getChance(victim) * getChance() * chanceModifier) / 100;
|
||||||
}
|
}
|
||||||
GroupedGeneralDropItem group = new GroupedGeneralDropItem(sumchance, getDropCalculationStrategy(), IKillerChanceModifierStrategy.NO_RULES, getPreciseStrategy()); // to discard further deep blue calculations
|
GroupedGeneralDropItem group = new GroupedGeneralDropItem(sumchance, getDropCalculationStrategy(), IKillerChanceModifierStrategy.NO_RULES, getPreciseStrategy()); // to discard further deep blue calculations
|
||||||
List<GeneralDropItem> items = new ArrayList<>();
|
List<GeneralDropItem> items = new ArrayList<>();
|
||||||
for (GeneralDropItem item : getItems())
|
for (GeneralDropItem item : getItems())
|
||||||
{
|
{
|
||||||
// the item is made almost "static"
|
// the item is made almost "static"
|
||||||
items.add(new GeneralDropItem(item.getItemId(), item.getMin(victim, killer), item.getMax(victim, killer), (item.getChance(victim, killer) * getChance() * chanceModifier) / sumchance, IAmountMultiplierStrategy.STATIC, IChanceMultiplierStrategy.STATIC, getPreciseStrategy(), IKillerChanceModifierStrategy.NO_RULES, item.getDropCalculationStrategy()));
|
items.add(new GeneralDropItem(item.getItemId(), item.getMin(victim), item.getMax(victim), (item.getChance(victim) * getChance() * chanceModifier) / sumchance, IAmountMultiplierStrategy.STATIC, IChanceMultiplierStrategy.STATIC, getPreciseStrategy(), IKillerChanceModifierStrategy.NO_RULES, item.getDropCalculationStrategy()));
|
||||||
}
|
}
|
||||||
group.setItems(items);
|
group.setItems(items);
|
||||||
return group;
|
return group;
|
||||||
|
@ -30,21 +30,16 @@ public interface IAmountMultiplierStrategy
|
|||||||
{
|
{
|
||||||
public static final IAmountMultiplierStrategy DROP = DEFAULT_STRATEGY(Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER);
|
public static final IAmountMultiplierStrategy DROP = DEFAULT_STRATEGY(Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER);
|
||||||
public static final IAmountMultiplierStrategy SPOIL = DEFAULT_STRATEGY(Config.RATE_CORPSE_DROP_AMOUNT_MULTIPLIER);
|
public static final IAmountMultiplierStrategy SPOIL = DEFAULT_STRATEGY(Config.RATE_CORPSE_DROP_AMOUNT_MULTIPLIER);
|
||||||
public static final IAmountMultiplierStrategy STATIC = (item, victim, killer) -> 1;
|
public static final IAmountMultiplierStrategy STATIC = (item, victim) -> 1;
|
||||||
|
|
||||||
public static IAmountMultiplierStrategy DEFAULT_STRATEGY(final double defaultMultiplier)
|
public static IAmountMultiplierStrategy DEFAULT_STRATEGY(final double defaultMultiplier)
|
||||||
{
|
{
|
||||||
return (item, victim, killer) ->
|
return (item, victim) ->
|
||||||
{
|
{
|
||||||
double multiplier = 1;
|
double multiplier = 1;
|
||||||
|
|
||||||
final Float dropChanceMultiplier = Config.RATE_DROP_AMOUNT_MULTIPLIER.get(item.getItemId());
|
Float dropChanceMultiplier = Config.RATE_DROP_AMOUNT_MULTIPLIER.get(item.getItemId());
|
||||||
final Float premiumAmountMultiplier = Config.PREMIUM_RATE_DROP_AMOUNT_MULTIPLIER.get(item.getItemId());
|
if (dropChanceMultiplier != null)
|
||||||
if (Config.PREMIUM_SYSTEM_ENABLED && (premiumAmountMultiplier != null) && (killer != null) && killer.isPlayer() && killer.getActingPlayer().hasPremiumStatus())
|
|
||||||
{
|
|
||||||
multiplier *= premiumAmountMultiplier;
|
|
||||||
}
|
|
||||||
else if (dropChanceMultiplier != null)
|
|
||||||
{
|
{
|
||||||
multiplier *= dropChanceMultiplier;
|
multiplier *= dropChanceMultiplier;
|
||||||
}
|
}
|
||||||
@ -56,17 +51,6 @@ public interface IAmountMultiplierStrategy
|
|||||||
{
|
{
|
||||||
multiplier *= Config.RATE_RAID_DROP_AMOUNT_MULTIPLIER;
|
multiplier *= Config.RATE_RAID_DROP_AMOUNT_MULTIPLIER;
|
||||||
}
|
}
|
||||||
else if (Config.PREMIUM_SYSTEM_ENABLED && (killer != null) && killer.isPlayer() && killer.getActingPlayer().hasPremiumStatus())
|
|
||||||
{
|
|
||||||
if ((defaultMultiplier == Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER) && (defaultMultiplier != Config.RATE_CORPSE_DROP_AMOUNT_MULTIPLIER))
|
|
||||||
{
|
|
||||||
multiplier *= Config.PREMIUM_RATE_DROP_AMOUNT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
multiplier *= Config.PREMIUM_RATE_SPOIL_AMOUNT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
multiplier *= defaultMultiplier;
|
multiplier *= defaultMultiplier;
|
||||||
@ -75,5 +59,5 @@ public interface IAmountMultiplierStrategy
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getAmountMultiplier(GeneralDropItem item, L2Character victim, L2Character killer);
|
public double getAmountMultiplier(GeneralDropItem item, L2Character victim);
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,9 @@ public interface IChanceMultiplierStrategy
|
|||||||
{
|
{
|
||||||
public static final IChanceMultiplierStrategy DROP = DEFAULT_STRATEGY(Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER);
|
public static final IChanceMultiplierStrategy DROP = DEFAULT_STRATEGY(Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER);
|
||||||
public static final IChanceMultiplierStrategy SPOIL = DEFAULT_STRATEGY(Config.RATE_CORPSE_DROP_CHANCE_MULTIPLIER);
|
public static final IChanceMultiplierStrategy SPOIL = DEFAULT_STRATEGY(Config.RATE_CORPSE_DROP_CHANCE_MULTIPLIER);
|
||||||
public static final IChanceMultiplierStrategy STATIC = (item, victim, killer) -> 1;
|
public static final IChanceMultiplierStrategy STATIC = (item, victim) -> 1;
|
||||||
|
|
||||||
public static final IChanceMultiplierStrategy QUEST = (item, victim, killer) ->
|
public static final IChanceMultiplierStrategy QUEST = (item, victim) ->
|
||||||
{
|
{
|
||||||
double championmult;
|
double championmult;
|
||||||
if ((item.getItemId() == Inventory.ADENA_ID) || (item.getItemId() == Inventory.ANCIENT_ADENA_ID))
|
if ((item.getItemId() == Inventory.ADENA_ID) || (item.getItemId() == Inventory.ANCIENT_ADENA_ID))
|
||||||
@ -50,20 +50,15 @@ public interface IChanceMultiplierStrategy
|
|||||||
|
|
||||||
public static IChanceMultiplierStrategy DEFAULT_STRATEGY(final double defaultMultiplier)
|
public static IChanceMultiplierStrategy DEFAULT_STRATEGY(final double defaultMultiplier)
|
||||||
{
|
{
|
||||||
return (item, victim, killer) ->
|
return (item, victim) ->
|
||||||
{
|
{
|
||||||
float multiplier = 1;
|
float multiplier = 1;
|
||||||
if (victim.isChampion())
|
if (victim.isChampion())
|
||||||
{
|
{
|
||||||
multiplier *= item.getItemId() != Inventory.ADENA_ID ? Config.L2JMOD_CHAMPION_REWARDS : Config.L2JMOD_CHAMPION_ADENAS_REWARDS;
|
multiplier *= item.getItemId() != Inventory.ADENA_ID ? Config.L2JMOD_CHAMPION_REWARDS : Config.L2JMOD_CHAMPION_ADENAS_REWARDS;
|
||||||
}
|
}
|
||||||
final Float dropChanceMultiplier = Config.RATE_DROP_CHANCE_MULTIPLIER.get(item.getItemId());
|
Float dropChanceMultiplier = Config.RATE_DROP_CHANCE_MULTIPLIER.get(item.getItemId());
|
||||||
final Float premiumChanceMultiplier = Config.PREMIUM_RATE_DROP_CHANCE_MULTIPLIER.get(item.getItemId());
|
if (dropChanceMultiplier != null)
|
||||||
if (Config.PREMIUM_SYSTEM_ENABLED && (premiumChanceMultiplier != null) && (killer != null) && killer.isPlayer() && killer.getActingPlayer().hasPremiumStatus())
|
|
||||||
{
|
|
||||||
multiplier *= premiumChanceMultiplier;
|
|
||||||
}
|
|
||||||
else if (dropChanceMultiplier != null)
|
|
||||||
{
|
{
|
||||||
multiplier *= dropChanceMultiplier;
|
multiplier *= dropChanceMultiplier;
|
||||||
}
|
}
|
||||||
@ -75,17 +70,6 @@ public interface IChanceMultiplierStrategy
|
|||||||
{
|
{
|
||||||
multiplier *= Config.RATE_RAID_DROP_CHANCE_MULTIPLIER;
|
multiplier *= Config.RATE_RAID_DROP_CHANCE_MULTIPLIER;
|
||||||
}
|
}
|
||||||
else if (Config.PREMIUM_SYSTEM_ENABLED && (killer != null) && killer.isPlayer() && killer.getActingPlayer().hasPremiumStatus())
|
|
||||||
{
|
|
||||||
if ((defaultMultiplier == Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER) && (defaultMultiplier != Config.RATE_CORPSE_DROP_CHANCE_MULTIPLIER))
|
|
||||||
{
|
|
||||||
multiplier *= Config.PREMIUM_RATE_DROP_CHANCE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
multiplier *= Config.PREMIUM_RATE_SPOIL_CHANCE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
multiplier *= defaultMultiplier;
|
multiplier *= defaultMultiplier;
|
||||||
@ -94,5 +78,5 @@ public interface IChanceMultiplierStrategy
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getChanceMultiplier(GeneralDropItem item, L2Character victim, L2Character killer);
|
public double getChanceMultiplier(GeneralDropItem item, L2Character victim);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public interface IDropCalculationStrategy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.singletonList(new ItemHolder(item.getItemId(), Rnd.get(item.getMin(victim, killer), item.getMax(victim, killer)) * amountMultiply));
|
return Collections.singletonList(new ItemHolder(item.getItemId(), Rnd.get(item.getMin(victim), item.getMax(victim)) * amountMultiply));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -79,7 +79,7 @@ public interface IGroupedItemDropCalculationStrategy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.singletonList(new ItemHolder(item2.getItemId(), Rnd.get(item2.getMin(victim, killer), item2.getMax(victim, killer)) * amountMultiply));
|
return Collections.singletonList(new ItemHolder(item2.getItemId(), Rnd.get(item2.getMin(victim), item2.getMax(victim)) * amountMultiply));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,11 +40,11 @@ public interface IKillerChanceModifierStrategy extends INonGroupedKillerChanceMo
|
|||||||
}
|
}
|
||||||
else if (Config.DEEPBLUE_DROP_RULES)
|
else if (Config.DEEPBLUE_DROP_RULES)
|
||||||
{
|
{
|
||||||
|
|
||||||
return Util.map(levelDifference, -Config.DROP_ITEM_MAX_LEVEL_DIFFERENCE, -Config.DROP_ITEM_MIN_LEVEL_DIFFERENCE, Config.DROP_ITEM_MIN_LEVEL_GAP_CHANCE, 100.0) / 100;
|
return Util.map(levelDifference, -Config.DROP_ITEM_MAX_LEVEL_DIFFERENCE, -Config.DROP_ITEM_MIN_LEVEL_DIFFERENCE, Config.DROP_ITEM_MIN_LEVEL_GAP_CHANCE, 100.0) / 100;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final INonGroupedKillerChanceModifierStrategy DEFAULT_NONGROUP_STRATEGY = (item, victim, killer) ->
|
public static final INonGroupedKillerChanceModifierStrategy DEFAULT_NONGROUP_STRATEGY = (item, victim, killer) ->
|
||||||
{
|
{
|
||||||
if (((!(victim.isRaid())) && Config.DEEPBLUE_DROP_RULES) || ((victim.isRaid()) && Config.DEEPBLUE_DROP_RULES_RAID))
|
if (((!(victim.isRaid())) && Config.DEEPBLUE_DROP_RULES) || ((victim.isRaid()) && Config.DEEPBLUE_DROP_RULES_RAID))
|
||||||
@ -52,6 +52,7 @@ public interface IKillerChanceModifierStrategy extends INonGroupedKillerChanceMo
|
|||||||
int levelDifference = victim.getLevel() - killer.getLevel();
|
int levelDifference = victim.getLevel() - killer.getLevel();
|
||||||
if (item.getItemId() == Inventory.ADENA_ID)
|
if (item.getItemId() == Inventory.ADENA_ID)
|
||||||
{
|
{
|
||||||
|
|
||||||
return Util.map(levelDifference, -Config.DROP_ADENA_MAX_LEVEL_DIFFERENCE, -Config.DROP_ADENA_MIN_LEVEL_DIFFERENCE, Config.DROP_ADENA_MIN_LEVEL_GAP_CHANCE, 100.0) / 100;
|
return Util.map(levelDifference, -Config.DROP_ADENA_MAX_LEVEL_DIFFERENCE, -Config.DROP_ADENA_MIN_LEVEL_DIFFERENCE, Config.DROP_ADENA_MIN_LEVEL_GAP_CHANCE, 100.0) / 100;
|
||||||
}
|
}
|
||||||
return Util.map(levelDifference, -Config.DROP_ITEM_MAX_LEVEL_DIFFERENCE, -Config.DROP_ITEM_MIN_LEVEL_DIFFERENCE, Config.DROP_ITEM_MIN_LEVEL_GAP_CHANCE, 100.0) / 100;
|
return Util.map(levelDifference, -Config.DROP_ITEM_MAX_LEVEL_DIFFERENCE, -Config.DROP_ITEM_MIN_LEVEL_DIFFERENCE, Config.DROP_ITEM_MIN_LEVEL_GAP_CHANCE, 100.0) / 100;
|
||||||
|
Loading…
Reference in New Issue
Block a user