Fixed champion related issues.
This commit is contained in:
@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
|
||||
# The amount of the specified reward a player will receive if they are awarded the item.
|
||||
ChampionRewardItemQty = 1
|
||||
|
||||
# % Chance to obtain a specified reward item from a higher level Champion mob.
|
||||
# % Chance to obtain a specified reward item from a lower level Champion mob.
|
||||
# Default: 0
|
||||
ChampionRewardLowerLvlItemChance = 0
|
||||
|
||||
# % Chance to obtain a specified reward item from a lower level Champion mob.
|
||||
# Default: 0
|
||||
ChampionRewardHigherLvlItemChance = 0
|
||||
# % Chance to obtain a specified reward item from a higher level Champion mob.
|
||||
# Default: 100
|
||||
ChampionRewardHigherLvlItemChance = 100
|
||||
|
||||
# Do you want to enable the vitality calculation when killing champion mobs?
|
||||
# Be aware that it can lead to huge unbalance on your server, your rate for that mob would
|
||||
|
@@ -1057,36 +1057,6 @@ public class Attackable extends Npc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply Special Item drop with random(rnd) quantity(qty) for champions.
|
||||
if (Config.CHAMPION_ENABLE && _champion && ((Config.CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE > 0) || (Config.CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE > 0)))
|
||||
{
|
||||
int champqty = Rnd.get(Config.CHAMPION_REWARD_QTY);
|
||||
final ItemHolder item = new ItemHolder(Config.CHAMPION_REWARD_ID, ++champqty);
|
||||
|
||||
if ((player.getLevel() <= getLevel()) && (Rnd.get(100) < Config.CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE))
|
||||
{
|
||||
if (Config.AUTO_LOOT_ITEM_IDS.contains(item.getId()) || Config.AUTO_LOOT || isFlying())
|
||||
{
|
||||
player.addItem("ChampionLoot", item.getId(), item.getCount(), this, true); // Give the item(s) to the PlayerInstance that has killed the Attackable
|
||||
}
|
||||
else
|
||||
{
|
||||
dropItem(player, item);
|
||||
}
|
||||
}
|
||||
else if ((player.getLevel() > getLevel()) && (Rnd.get(100) < Config.CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE))
|
||||
{
|
||||
if (Config.AUTO_LOOT_ITEM_IDS.contains(item.getId()) || Config.AUTO_LOOT || isFlying())
|
||||
{
|
||||
player.addItem("ChampionLoot", item.getId(), item.getCount(), this, true); // Give the item(s) to the PlayerInstance that has killed the Attackable
|
||||
}
|
||||
else
|
||||
{
|
||||
dropItem(player, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1465,10 +1435,10 @@ public class Attackable extends Npc
|
||||
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
|
||||
{
|
||||
_champion = true;
|
||||
if (Config.SHOW_CHAMPION_AURA)
|
||||
{
|
||||
setTeam(Team.RED);
|
||||
}
|
||||
}
|
||||
if (Config.SHOW_CHAMPION_AURA)
|
||||
{
|
||||
setTeam(_champion ? Team.RED : Team.NONE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1344,6 +1344,15 @@ public class Npc extends Creature
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTeam(Team team, boolean broadcast)
|
||||
{
|
||||
super.setTeam(team);
|
||||
if (broadcast)
|
||||
{
|
||||
broadcastInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTeam(Team team)
|
||||
{
|
||||
|
@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
calculatedDrops.add(drop);
|
||||
}
|
||||
|
||||
// champion extra drop
|
||||
if (victim.isChampion())
|
||||
{
|
||||
if ((victim.getLevel() < killer.getLevel()) && (Rnd.get(100) < Config.CHAMPION_REWARD_LOWER_LVL_ITEM_CHANCE))
|
||||
{
|
||||
return calculatedDrops;
|
||||
}
|
||||
if ((victim.getLevel() > killer.getLevel()) && (Rnd.get(100) < Config.CHAMPION_REWARD_HIGHER_LVL_ITEM_CHANCE))
|
||||
{
|
||||
return calculatedDrops;
|
||||
}
|
||||
|
||||
// create list
|
||||
if (calculatedDrops == null)
|
||||
{
|
||||
calculatedDrops = new ArrayList<>();
|
||||
}
|
||||
|
||||
calculatedDrops.add(new ItemHolder(Config.CHAMPION_REWARD_ID, Config.CHAMPION_REWARD_QTY));
|
||||
}
|
||||
|
||||
return calculatedDrops;
|
||||
}
|
||||
|
||||
@@ -771,13 +792,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
case DROP:
|
||||
case LUCKY:
|
||||
{
|
||||
final Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId());
|
||||
final int itemId = dropItem.getItemId();
|
||||
final Item item = ItemTable.getInstance().getTemplate(itemId);
|
||||
final boolean champion = victim.isChampion();
|
||||
|
||||
// chance
|
||||
double rateChance = 1;
|
||||
if (Config.RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId()) != null)
|
||||
if (Config.RATE_DROP_CHANCE_BY_ID.get(itemId) != null)
|
||||
{
|
||||
rateChance *= Config.RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId());
|
||||
rateChance *= Config.RATE_DROP_CHANCE_BY_ID.get(itemId);
|
||||
if (champion && (itemId == Inventory.ADENA_ID))
|
||||
{
|
||||
rateChance *= Config.CHAMPION_ADENAS_REWARDS_CHANCE;
|
||||
}
|
||||
}
|
||||
else if (item.hasExImmediateEffect())
|
||||
{
|
||||
@@ -789,15 +816,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
}
|
||||
else
|
||||
{
|
||||
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER;
|
||||
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
|
||||
}
|
||||
|
||||
// premium chance
|
||||
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus())
|
||||
{
|
||||
if (Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId()) != null)
|
||||
if (Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(itemId) != null)
|
||||
{
|
||||
rateChance *= Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(dropItem.getItemId());
|
||||
rateChance *= Config.PREMIUM_RATE_DROP_CHANCE_BY_ID.get(itemId);
|
||||
}
|
||||
else if (item.hasExImmediateEffect())
|
||||
{
|
||||
@@ -821,9 +848,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
{
|
||||
// amount is calculated after chance returned success
|
||||
double rateAmount = 1;
|
||||
if (Config.RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId()) != null)
|
||||
if (Config.RATE_DROP_AMOUNT_BY_ID.get(itemId) != null)
|
||||
{
|
||||
rateAmount *= Config.RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId());
|
||||
rateAmount *= Config.RATE_DROP_AMOUNT_BY_ID.get(itemId);
|
||||
if (champion && (itemId == Inventory.ADENA_ID))
|
||||
{
|
||||
rateAmount *= Config.CHAMPION_ADENAS_REWARDS_AMOUNT;
|
||||
}
|
||||
}
|
||||
else if (item.hasExImmediateEffect())
|
||||
{
|
||||
@@ -835,15 +866,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
}
|
||||
else
|
||||
{
|
||||
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER;
|
||||
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
|
||||
}
|
||||
|
||||
// premium chance
|
||||
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus())
|
||||
{
|
||||
if (Config.PREMIUM_RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId()) != null)
|
||||
if (Config.PREMIUM_RATE_DROP_AMOUNT_BY_ID.get(itemId) != null)
|
||||
{
|
||||
rateAmount *= Config.PREMIUM_RATE_DROP_AMOUNT_BY_ID.get(dropItem.getItemId());
|
||||
rateAmount *= Config.PREMIUM_RATE_DROP_AMOUNT_BY_ID.get(itemId);
|
||||
}
|
||||
else if (item.hasExImmediateEffect())
|
||||
{
|
||||
@@ -863,7 +894,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
|
||||
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
|
||||
|
||||
// finally
|
||||
return new ItemHolder(dropItem.getItemId(), (long) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount));
|
||||
return new ItemHolder(itemId, (long) (Rnd.get(dropItem.getMin(), dropItem.getMax()) * rateAmount));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user