Support for AggroInfo long numbers.

This commit is contained in:
MobiusDevelopment
2022-12-01 04:30:00 +00:00
parent 25ca9044f1
commit f1158b42a0
248 changed files with 796 additions and 767 deletions

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -721,7 +721,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -789,7 +789,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -818,7 +818,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -853,7 +853,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -930,7 +930,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -963,7 +963,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1013,7 +1013,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -717,7 +717,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -785,7 +785,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -814,7 +814,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -849,7 +849,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -926,7 +926,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -959,7 +959,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1009,7 +1009,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -717,7 +717,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -785,7 +785,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -814,7 +814,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -849,7 +849,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -926,7 +926,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -959,7 +959,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1009,7 +1009,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -717,7 +717,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -785,7 +785,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -814,7 +814,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -849,7 +849,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -926,7 +926,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -959,7 +959,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1009,7 +1009,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -705,7 +705,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -773,7 +773,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -802,7 +802,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -837,7 +837,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -914,7 +914,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -947,7 +947,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -997,7 +997,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -705,7 +705,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -773,7 +773,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -802,7 +802,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -837,7 +837,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -914,7 +914,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -947,7 +947,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -997,7 +997,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -705,7 +705,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -773,7 +773,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -802,7 +802,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -837,7 +837,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -914,7 +914,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -947,7 +947,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -997,7 +997,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -716,7 +716,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -784,7 +784,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -813,7 +813,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -848,7 +848,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -925,7 +925,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -958,7 +958,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1008,7 +1008,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -716,7 +716,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -784,7 +784,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -813,7 +813,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -848,7 +848,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -925,7 +925,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -958,7 +958,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1008,7 +1008,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -716,7 +716,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -784,7 +784,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -813,7 +813,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -848,7 +848,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -925,7 +925,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -958,7 +958,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1008,7 +1008,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

View File

@@ -84,7 +84,7 @@ public class RandomizeHate extends AbstractEffect
// Choosing randomly a new target // Choosing randomly a new target
final Creature target = targetList.get(Rnd.get(targetList.size())); final Creature target = targetList.get(Rnd.get(targetList.size()));
final int hate = effectedMob.getHating(effector); final long hate = effectedMob.getHating(effector);
effectedMob.stopHating(effector); effectedMob.stopHating(effector);
effectedMob.addDamageHate(target, 0, hate); effectedMob.addDamageHate(target, 0, hate);
} }

View File

@@ -66,7 +66,8 @@ public class TransferHate extends AbstractEffect
{ {
return; return;
} }
final int hate = hater.getHating(effector);
final long hate = hater.getHating(effector);
if (hate <= 0) if (hate <= 0)
{ {
return; return;

View File

@@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) // || (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|| (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer())) || (Config.FAKE_PLAYER_AGGRO_PLAYERS && t.isPlayer()))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
final double distance = npc.calculateDistance2D(t); final double distance = npc.calculateDistance2D(t);
if ((hating == 0) && (closestDistance > distance)) if ((hating == 0) && (closestDistance > distance))
{ {
@@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
{ {
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC)) if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
{ {
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
if (hating == 0) if (hating == 0)
{ {
npc.addDamageHate(t, 0, 0); npc.addDamageHate(t, 0, 0);
@@ -411,7 +411,7 @@ public class AttackableAI extends CreatureAI
} }
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int hating = npc.getHating(t); final long hating = npc.getHating(t);
// Add the attacker to the Attackable _aggroList with 0 damage and 1 hate // Add the attacker to the Attackable _aggroList with 0 damage and 1 hate
if (hating == 0) if (hating == 0)
@@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
if ((hated != null) && !npc.isCoreAIDisabled()) if ((hated != null) && !npc.isCoreAIDisabled())
{ {
// Get the hate level of the Attackable against this Creature target contained in _aggroList // Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated); final long aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0) if ((aggro + _globalAggro) > 0)
{ {
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player // Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others Player
@@ -1239,7 +1239,7 @@ public class AttackableAI extends CreatureAI
} }
} }
int searchValue = Integer.MIN_VALUE; long searchValue = Long.MIN_VALUE;
Creature creature = null; Creature creature = null;
for (AggroInfo aggro : npc.getAggroList().values()) for (AggroInfo aggro : npc.getAggroList().values())
{ {

View File

@@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
public class AggroInfo public class AggroInfo
{ {
private final Creature _attacker; private final Creature _attacker;
private int _hate = 0; private long _hate = 0;
private int _damage = 0; private long _damage = 0;
public AggroInfo(Creature pAttacker) public AggroInfo(Creature pAttacker)
{ {
@@ -37,12 +37,12 @@ public class AggroInfo
return _attacker; return _attacker;
} }
public int getHate() public long getHate()
{ {
return _hate; return _hate;
} }
public int checkHate(Creature owner) public long checkHate(Creature owner)
{ {
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker)) if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
{ {
@@ -51,9 +51,9 @@ public class AggroInfo
return _hate; return _hate;
} }
public void addHate(int value) public void addHate(long value)
{ {
_hate = (int) Math.min(_hate + (long) value, 999999999); _hate = Math.min(_hate + value, Long.MAX_VALUE);
} }
public void stopHate() public void stopHate()
@@ -61,14 +61,14 @@ public class AggroInfo
_hate = 0; _hate = 0;
} }
public int getDamage() public long getDamage()
{ {
return _damage; return _damage;
} }
public void addDamage(int value) public void addDamage(long value)
{ {
_damage = (int) Math.min(_damage + (long) value, 999999999); _damage = Math.min(_damage + value, Long.MAX_VALUE);
} }
@Override @Override

View File

@@ -716,7 +716,7 @@ public class Attackable extends Npc
return null; return null;
} }
int damage = 0; long damage = 0;
Creature damageDealer = null; Creature damageDealer = null;
for (AggroInfo info : _aggroList.values()) for (AggroInfo info : _aggroList.values())
{ {
@@ -784,7 +784,7 @@ public class Attackable extends Npc
* @param damage The number of damages given by the attacker Creature * @param damage The number of damages given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature * @param aggroValue The hate (=damage) given by the attacker Creature
*/ */
public void addDamageHate(Creature creature, int damage, int aggroValue) public void addDamageHate(Creature creature, long damage, long aggroValue)
{ {
Creature attacker = creature; Creature attacker = creature;
if ((attacker == null) || (attacker == this)) if ((attacker == null) || (attacker == this))
@@ -813,7 +813,7 @@ public class Attackable extends Npc
// traps does not cause aggro // traps does not cause aggro
// making this hack because not possible to determine if damage made by trap // making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here // so just check for triggered trap here
int aggro = aggroValue; long aggro = aggroValue;
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered()) if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{ {
ai.addHate(aggro); ai.addHate(aggro);
@@ -848,7 +848,7 @@ public class Attackable extends Npc
} }
} }
public void reduceHate(Creature target, int amount) public void reduceHate(Creature target, long amount)
{ {
if (target == null) // whole aggrolist if (target == null) // whole aggrolist
{ {
@@ -925,7 +925,7 @@ public class Attackable extends Npc
} }
Creature mostHated = null; Creature mostHated = null;
int maxHate = 0; long maxHate = 0;
// While Interacting over This Map Removing Object is Not Allowed // While Interacting over This Map Removing Object is Not Allowed
// Go through the aggroList of the Attackable // Go through the aggroList of the Attackable
@@ -958,7 +958,7 @@ public class Attackable extends Npc
Creature mostHated = null; Creature mostHated = null;
Creature secondMostHated = null; Creature secondMostHated = null;
int maxHate = 0; long maxHate = 0;
final List<Creature> result = new ArrayList<>(); final List<Creature> result = new ArrayList<>();
// While iterating over this map removing objects is not allowed // While iterating over this map removing objects is not allowed
@@ -1008,7 +1008,7 @@ public class Attackable extends Npc
* @param target The Creature whose hate level must be returned * @param target The Creature whose hate level must be returned
* @return the hate level of the Attackable against this Creature contained in _aggroList. * @return the hate level of the Attackable against this Creature contained in _aggroList.
*/ */
public int getHating(Creature target) public long getHating(Creature target)
{ {
if (_aggroList.isEmpty() || (target == null)) if (_aggroList.isEmpty() || (target == null))
{ {

View File

@@ -199,7 +199,7 @@ public class Defender extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -59,7 +59,7 @@ public class FortCommander extends Defender
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (attacker == null) if (attacker == null)
{ {

View File

@@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
} }
@Override @Override
public void addDamageHate(Creature attacker, int damage, int aggro) public void addDamageHate(Creature attacker, long damage, long aggro)
{ {
if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc)) if (!attacker.isPlayable() && !(attacker instanceof FriendlyNpc))
{ {

View File

@@ -398,7 +398,7 @@ public class IstinaCavern extends AbstractInstance
} }
else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId()) else if (skillId == ISTINA_ERUPTION_SKILL.getSkillId())
{ {
((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingInt(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character -> ((Attackable) npc).getAggroList().values().stream().sorted(Comparator.comparingLong(AggroInfo::getHate)).map(AggroInfo::getAttacker).limit(5).forEach(character ->
{ {
final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId()); final Npc eruption = addSpawn(INVISIBLE_NPC, Util.getRandomPosition(character, 150, 150), false, 0, false, instance.getId());
eruption.getVariables().set("ERUPTION_TARGET", character); eruption.getVariables().set("ERUPTION_TARGET", character);

Some files were not shown because too many files have changed in this diff Show More