Fixed champion related issues.

This commit is contained in:
MobiusDevelopment
2019-06-10 05:17:10 +00:00
parent 0850599fec
commit a80a494e6a
54 changed files with 785 additions and 658 deletions

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -1061,36 +1061,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);
}
}
}
} }
/** /**
@@ -1529,10 +1499,10 @@ public class Attackable extends Npc
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -770,13 +791,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -788,15 +815,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -820,9 +847,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -834,15 +865,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -862,7 +893,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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);
}
}
}
} }
/** /**
@@ -1475,10 +1445,10 @@ public class Attackable extends Npc
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -770,13 +791,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -788,15 +815,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -820,9 +847,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -834,15 +865,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -862,7 +893,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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);
}
}
}
} }
/** /**
@@ -1475,10 +1445,10 @@ public class Attackable extends Npc
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -770,13 +791,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -788,15 +815,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -820,9 +847,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -834,15 +865,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -862,7 +893,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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);
}
}
}
} }
/** /**
@@ -1475,10 +1445,10 @@ public class Attackable extends Npc
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -770,13 +791,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -788,15 +815,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -820,9 +847,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -834,15 +865,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -862,7 +893,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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);
}
}
}
} }
/** /**
@@ -1475,10 +1445,10 @@ public class Attackable extends Npc
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -770,13 +791,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -788,15 +815,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -820,9 +847,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -834,15 +865,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -862,7 +893,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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);
}
}
}
} }
/** /**
@@ -1475,10 +1445,10 @@ public class Attackable extends Npc
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -770,13 +791,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -788,15 +815,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -820,9 +847,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -834,15 +865,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -862,7 +893,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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);
}
}
}
} }
/** /**
@@ -1475,10 +1445,10 @@ public class Attackable extends Npc
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CharTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -770,13 +791,19 @@ public final class NpcTemplate extends CharTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -788,15 +815,15 @@ public final class NpcTemplate extends CharTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -820,9 +847,13 @@ public final class NpcTemplate extends CharTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -834,15 +865,15 @@ public final class NpcTemplate extends CharTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -862,7 +893,7 @@ public final class NpcTemplate extends CharTemplate implements IIdentifiable
rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -3,7 +3,7 @@
# Turns random mobs into Champions # # Turns random mobs into Champions #
# =========================================================== # # =========================================================== #
# Enable Champions L2JMod # Enable champion monsters.
ChampionEnable = False ChampionEnable = False
# Chance for a mob to became champion (in percents) - 0 to disable # Chance for a mob to became champion (in percents) - 0 to disable
@@ -11,7 +11,7 @@ ChampionFrequency = 5
# Min and max lvl allowed for a mob to be champion. # Min and max lvl allowed for a mob to be champion.
ChampionMinLevel = 20 ChampionMinLevel = 20
ChampionMaxLevel = 85 ChampionMaxLevel = 70
# Hp multiplier # Hp multiplier
ChampionHp = 8 ChampionHp = 8

View File

@@ -569,12 +569,11 @@ public class Attackable extends NpcInstance
setChampion(false); setChampion(false);
if (Config.L2JMOD_CHAMPION_ENABLE) if (Config.L2JMOD_CHAMPION_ENABLE)
{ {
// Set champion on next spawn // Set champion on next spawn.
if (!(this instanceof GrandBossInstance) && !(this instanceof RaidBossInstance) && (this instanceof MonsterInstance) if (!(this instanceof GrandBossInstance) && !(this instanceof RaidBossInstance) && (this instanceof MonsterInstance)
/* && !getTemplate().isQuestMonster */ && (Config.L2JMOD_CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.L2JMOD_CHAMP_MIN_LVL) && (getLevel() <= Config.L2JMOD_CHAMP_MAX_LVL)) /* && !getTemplate().isQuestMonster */ && (Config.L2JMOD_CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.L2JMOD_CHAMP_MIN_LVL) && (getLevel() <= Config.L2JMOD_CHAMP_MAX_LVL))
{ {
final int random = Rnd.get(100); if (Rnd.get(100) < Config.L2JMOD_CHAMPION_FREQUENCY)
if (random < Config.L2JMOD_CHAMPION_FREQUENCY)
{ {
setChampion(true); setChampion(true);
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 0
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -1019,38 +1019,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)))
{
return;
}
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);
}
}
} }
/** /**
@@ -1747,9 +1715,9 @@ public class Attackable extends Npc
public void setChampion(boolean champ) public void setChampion(boolean champ)
{ {
_champion = champ; _champion = champ;
if (champ && Config.SHOW_CHAMPION_AURA) if (Config.SHOW_CHAMPION_AURA)
{ {
setTeam(Team.RED); setTeam(champ ? Team.RED : Team.NONE);
} }
} }

View File

@@ -1567,6 +1567,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -702,6 +702,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -718,13 +739,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
case DROP: case DROP:
{ {
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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -736,15 +763,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -765,9 +792,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -779,15 +810,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -804,7 +835,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
// finally // 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; break;
} }
@@ -813,7 +844,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
// chance // chance
double rateChance = Config.RATE_SPOIL_DROP_CHANCE_MULTIPLIER; double rateChance = Config.RATE_SPOIL_DROP_CHANCE_MULTIPLIER;
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus()) if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus())
{ {
rateChance *= Config.PREMIUM_RATE_SPOIL_CHANCE; rateChance *= Config.PREMIUM_RATE_SPOIL_CHANCE;
} }
@@ -824,7 +855,7 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = Config.RATE_SPOIL_DROP_AMOUNT_MULTIPLIER; double rateAmount = Config.RATE_SPOIL_DROP_AMOUNT_MULTIPLIER;
// premium amount // premium amount
if (Config.PREMIUM_SYSTEM_ENABLED && killer.getActingPlayer().hasPremiumStatus()) if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus())
{ {
rateAmount *= Config.PREMIUM_RATE_SPOIL_AMOUNT; rateAmount *= Config.PREMIUM_RATE_SPOIL_AMOUNT;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -771,13 +792,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
case DROP: case DROP:
case LUCKY: 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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -789,15 +816,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -821,9 +848,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -835,15 +866,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) 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); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -771,13 +792,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
case DROP: case DROP:
case LUCKY: 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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -789,15 +816,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -821,9 +848,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -835,15 +866,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) 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); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -771,13 +792,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
case DROP: case DROP:
case LUCKY: 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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -789,15 +816,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -821,9 +848,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -835,15 +866,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) 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); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -771,13 +792,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
case DROP: case DROP:
case LUCKY: 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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -789,15 +816,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -821,9 +848,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -835,15 +866,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) 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); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }

View File

@@ -56,13 +56,13 @@ ChampionRewardItemID = 6393
# The amount of the specified reward a player will receive if they are awarded the item. # The amount of the specified reward a player will receive if they are awarded the item.
ChampionRewardItemQty = 1 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 # Default: 0
ChampionRewardLowerLvlItemChance = 0 ChampionRewardLowerLvlItemChance = 0
# % Chance to obtain a specified reward item from a lower level Champion mob. # % Chance to obtain a specified reward item from a higher level Champion mob.
# Default: 0 # Default: 100
ChampionRewardHigherLvlItemChance = 0 ChampionRewardHigherLvlItemChance = 100
# Do you want to enable the vitality calculation when killing champion mobs? # 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 # Be aware that it can lead to huge unbalance on your server, your rate for that mob would

View File

@@ -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) if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{ {
_champion = true; _champion = true;
if (Config.SHOW_CHAMPION_AURA) }
{ if (Config.SHOW_CHAMPION_AURA)
setTeam(Team.RED); {
} setTeam(_champion ? Team.RED : Team.NONE, false);
} }
} }
} }

View File

@@ -1344,6 +1344,15 @@ public class Npc extends Creature
return true; return true;
} }
public void setTeam(Team team, boolean broadcast)
{
super.setTeam(team);
if (broadcast)
{
broadcastInfo();
}
}
@Override @Override
public void setTeam(Team team) public void setTeam(Team team)
{ {

View File

@@ -754,6 +754,27 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
calculatedDrops.add(drop); 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; return calculatedDrops;
} }
@@ -771,13 +792,19 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
case DROP: case DROP:
case LUCKY: 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 // chance
double rateChance = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -789,15 +816,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER; rateChance *= Config.RATE_DEATH_DROP_CHANCE_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_CHANCE : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) else if (item.hasExImmediateEffect())
{ {
@@ -821,9 +848,13 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
{ {
// amount is calculated after chance returned success // amount is calculated after chance returned success
double rateAmount = 1; 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()) else if (item.hasExImmediateEffect())
{ {
@@ -835,15 +866,15 @@ public final class NpcTemplate extends CreatureTemplate implements IIdentifiable
} }
else else
{ {
rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER; rateAmount *= Config.RATE_DEATH_DROP_AMOUNT_MULTIPLIER * (champion ? Config.CHAMPION_REWARDS_AMOUNT : 1);
} }
// premium chance // premium chance
if (Config.PREMIUM_SYSTEM_ENABLED && (killer.getActingPlayer() != null) && killer.getActingPlayer().hasPremiumStatus()) 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()) 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); rateAmount *= killer.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
// finally // 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; break;
} }