Premium system changes.
This commit is contained in:
@ -20,6 +20,7 @@ package com.l2jserver.gameserver.model.drops;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.drops.strategy.IAmountMultiplierStrategy;
|
||||
import com.l2jserver.gameserver.model.drops.strategy.IChanceMultiplierStrategy;
|
||||
@ -146,10 +147,19 @@ public final class GeneralDropItem implements IDropItem
|
||||
/**
|
||||
* Gets the min drop count modified by server rates
|
||||
* @param victim the victim who drops the item
|
||||
* @param killer who kills the victim
|
||||
* @return the min modified by any rates.
|
||||
*/
|
||||
public final long getMin(L2Character victim)
|
||||
public final long getMin(L2Character victim, L2Character killer)
|
||||
{
|
||||
if (Config.PREMIUM_SYSTEM_ENABLED && killer.isPlayer() && killer.getActingPlayer().hasPremiumStatus())
|
||||
{
|
||||
if (Config.PREMIUM_RATE_DROP_AMOUNT_MULTIPLIER.get(_itemId) != null)
|
||||
{
|
||||
return (long) (getMin() * getAmountMultiplier(victim) * Config.PREMIUM_RATE_DROP_AMOUNT_MULTIPLIER.get(_itemId));
|
||||
}
|
||||
return (long) (getMin() * getAmountMultiplier(victim) * Config.PREMIUM_RATE_DROP_AMOUNT);
|
||||
}
|
||||
return (long) (getMin() * getAmountMultiplier(victim));
|
||||
}
|
||||
|
||||
@ -165,10 +175,19 @@ public final class GeneralDropItem implements IDropItem
|
||||
/**
|
||||
* Gets the max drop count modified by server rates
|
||||
* @param victim the victim who drops the item
|
||||
* @param killer who kills the victim
|
||||
* @return the max modified by any rates.
|
||||
*/
|
||||
public final long getMax(L2Character victim)
|
||||
public final long getMax(L2Character victim, L2Character killer)
|
||||
{
|
||||
if (Config.PREMIUM_SYSTEM_ENABLED && killer.isPlayer() && killer.getActingPlayer().hasPremiumStatus())
|
||||
{
|
||||
if (Config.PREMIUM_RATE_DROP_AMOUNT_MULTIPLIER.get(_itemId) != null)
|
||||
{
|
||||
return (long) (getMax() * getAmountMultiplier(victim) * Config.PREMIUM_RATE_DROP_AMOUNT_MULTIPLIER.get(_itemId));
|
||||
}
|
||||
return (long) (getMax() * getAmountMultiplier(victim) * Config.PREMIUM_RATE_DROP_AMOUNT);
|
||||
}
|
||||
return (long) (getMax() * getAmountMultiplier(victim));
|
||||
}
|
||||
|
||||
@ -201,7 +220,15 @@ public final class GeneralDropItem implements IDropItem
|
||||
*/
|
||||
public final double getChance(L2Character victim, L2Character killer)
|
||||
{
|
||||
return (getKillerChanceModifier(victim, killer) * getChance(victim));
|
||||
if (Config.PREMIUM_SYSTEM_ENABLED && killer.isPlayer() && killer.getActingPlayer().hasPremiumStatus())
|
||||
{
|
||||
if (Config.PREMIUM_RATE_DROP_CHANCE_MULTIPLIER.get(_itemId) != null)
|
||||
{
|
||||
return getKillerChanceModifier(victim, killer) * getChance(victim) * Config.PREMIUM_RATE_DROP_CHANCE_MULTIPLIER.get(_itemId);
|
||||
}
|
||||
return getKillerChanceModifier(victim, killer) * getChance(victim) * Config.PREMIUM_RATE_DROP_CHANCE;
|
||||
}
|
||||
return getKillerChanceModifier(victim, killer) * getChance(victim);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -214,14 +214,14 @@ public final class GroupedGeneralDropItem implements IDropItem
|
||||
double sumchance = 0;
|
||||
for (GeneralDropItem item : getItems())
|
||||
{
|
||||
sumchance += (item.getChance(victim) * getChance() * chanceModifier) / 100;
|
||||
sumchance += (item.getChance(victim, killer) * getChance() * chanceModifier) / 100;
|
||||
}
|
||||
GroupedGeneralDropItem group = new GroupedGeneralDropItem(sumchance, getDropCalculationStrategy(), IKillerChanceModifierStrategy.NO_RULES, getPreciseStrategy()); // to discard further deep blue calculations
|
||||
List<GeneralDropItem> items = new ArrayList<>();
|
||||
for (GeneralDropItem item : getItems())
|
||||
{
|
||||
// the item is made almost "static"
|
||||
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()));
|
||||
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()));
|
||||
}
|
||||
group.setItems(items);
|
||||
return group;
|
||||
|
@ -46,7 +46,7 @@ public interface IDropCalculationStrategy
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.singletonList(new ItemHolder(item.getItemId(), Rnd.get(item.getMin(victim), item.getMax(victim)) * amountMultiply));
|
||||
return Collections.singletonList(new ItemHolder(item.getItemId(), Rnd.get(item.getMin(victim, killer), item.getMax(victim, killer)) * amountMultiply));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -79,7 +79,7 @@ public interface IGroupedItemDropCalculationStrategy
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.singletonList(new ItemHolder(item2.getItemId(), Rnd.get(item2.getMin(victim), item2.getMax(victim)) * amountMultiply));
|
||||
return Collections.singletonList(new ItemHolder(item2.getItemId(), Rnd.get(item2.getMin(victim, killer), item2.getMax(victim, killer)) * amountMultiply));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user