Support for AggroInfo long numbers.
This commit is contained in:
@ -331,7 +331,7 @@ public class AttackableAI extends CreatureAI
|
||||
|| (Config.FAKE_PLAYER_AGGRO_MONSTERS && t.isMonster() && !t.isFakePlayer()) //
|
||||
|| (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);
|
||||
if ((hating == 0) && (closestDistance > distance))
|
||||
{
|
||||
@ -392,7 +392,7 @@ public class AttackableAI extends CreatureAI
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
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
|
||||
if (hating == 0)
|
||||
@ -442,7 +442,7 @@ public class AttackableAI extends CreatureAI
|
||||
if ((hated != null) && !npc.isCoreAIDisabled())
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
// 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;
|
||||
for (AggroInfo aggro : npc.getAggroList().values())
|
||||
{
|
||||
|
@ -24,8 +24,8 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
public class AggroInfo
|
||||
{
|
||||
private final Creature _attacker;
|
||||
private int _hate = 0;
|
||||
private int _damage = 0;
|
||||
private long _hate = 0;
|
||||
private long _damage = 0;
|
||||
|
||||
public AggroInfo(Creature pAttacker)
|
||||
{
|
||||
@ -37,12 +37,12 @@ public class AggroInfo
|
||||
return _attacker;
|
||||
}
|
||||
|
||||
public int getHate()
|
||||
public long getHate()
|
||||
{
|
||||
return _hate;
|
||||
}
|
||||
|
||||
public int checkHate(Creature owner)
|
||||
public long checkHate(Creature owner)
|
||||
{
|
||||
if (_attacker.isAlikeDead() || !_attacker.isSpawned() || !owner.isInSurroundingRegion(_attacker))
|
||||
{
|
||||
@ -51,9 +51,9 @@ public class AggroInfo
|
||||
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()
|
||||
@ -61,14 +61,14 @@ public class AggroInfo
|
||||
_hate = 0;
|
||||
}
|
||||
|
||||
public int getDamage()
|
||||
public long getDamage()
|
||||
{
|
||||
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
|
||||
|
@ -703,7 +703,7 @@ public class Attackable extends Npc
|
||||
return null;
|
||||
}
|
||||
|
||||
int damage = 0;
|
||||
long damage = 0;
|
||||
Creature damageDealer = null;
|
||||
for (AggroInfo info : _aggroList.values())
|
||||
{
|
||||
@ -771,7 +771,7 @@ public class Attackable extends Npc
|
||||
* @param damage The number of damages 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;
|
||||
if ((attacker == null) || (attacker == this))
|
||||
@ -800,7 +800,7 @@ public class Attackable extends Npc
|
||||
// traps does not cause aggro
|
||||
// making this hack because not possible to determine if damage made by trap
|
||||
// so just check for triggered trap here
|
||||
int aggro = aggroValue;
|
||||
long aggro = aggroValue;
|
||||
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
|
||||
{
|
||||
ai.addHate(aggro);
|
||||
@ -835,7 +835,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
|
||||
{
|
||||
@ -912,7 +912,7 @@ public class Attackable extends Npc
|
||||
}
|
||||
|
||||
Creature mostHated = null;
|
||||
int maxHate = 0;
|
||||
long maxHate = 0;
|
||||
|
||||
// While Interacting over This Map Removing Object is Not Allowed
|
||||
// Go through the aggroList of the Attackable
|
||||
@ -945,7 +945,7 @@ public class Attackable extends Npc
|
||||
|
||||
Creature mostHated = null;
|
||||
Creature secondMostHated = null;
|
||||
int maxHate = 0;
|
||||
long maxHate = 0;
|
||||
final List<Creature> result = new ArrayList<>();
|
||||
|
||||
// While iterating over this map removing objects is not allowed
|
||||
@ -995,7 +995,7 @@ public class Attackable extends Npc
|
||||
* @param target The Creature whose hate level must be returned
|
||||
* @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))
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ public class Defender extends Attackable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDamageHate(Creature attacker, int damage, int aggro)
|
||||
public void addDamageHate(Creature attacker, long damage, long aggro)
|
||||
{
|
||||
if (attacker == null)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ public class FortCommander extends Defender
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDamageHate(Creature attacker, int damage, int aggro)
|
||||
public void addDamageHate(Creature attacker, long damage, long aggro)
|
||||
{
|
||||
if (attacker == null)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ public class FriendlyNpc extends Attackable
|
||||
}
|
||||
|
||||
@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))
|
||||
{
|
||||
|
Reference in New Issue
Block a user