Support for AggroInfo long numbers.
This commit is contained in:
@@ -78,7 +78,7 @@ public class RandomizeHate extends AbstractEffect
|
||||
|
||||
// Choosing randomly a new target
|
||||
final Creature target = aggroList.get(Rnd.get(aggroList.size()));
|
||||
final int hate = effectedMob.getHating(info.getEffector());
|
||||
final long hate = effectedMob.getHating(info.getEffector());
|
||||
effectedMob.stopHating(info.getEffector());
|
||||
effectedMob.addDamageHate(target, 0, hate);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class TransferHate extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
final int hate = hater.getHating(info.getEffector());
|
||||
final long hate = hater.getHating(info.getEffector());
|
||||
if (hate <= 0)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -477,7 +477,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))
|
||||
{
|
||||
@@ -547,7 +547,7 @@ public class AttackableAI extends CreatureAI
|
||||
{
|
||||
if (!npc.isFakePlayer() || (npc.isFakePlayer() && Config.FAKE_PLAYER_AGGRO_FPC))
|
||||
{
|
||||
final int hating = npc.getHating(target);
|
||||
final long hating = npc.getHating(target);
|
||||
if (hating == 0)
|
||||
{
|
||||
npc.addDamageHate(target, 0, 0);
|
||||
@@ -578,7 +578,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
|
||||
|
||||
@@ -275,7 +275,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
if (hated != null)
|
||||
{
|
||||
// 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
|
||||
@@ -493,7 +493,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
boolean useSkillSelf = true;
|
||||
if (sk.isContinuous() && !sk.isDebuff() && _actor.isAffectedBySkill(sk.getId()))
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -670,7 +670,7 @@ public class Attackable extends Npc
|
||||
return null;
|
||||
}
|
||||
|
||||
int damage = 0;
|
||||
long damage = 0;
|
||||
Creature damageDealer = null;
|
||||
for (AggroInfo info : _aggroList.values())
|
||||
{
|
||||
@@ -730,7 +730,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 attacker, int damage, int aggroValue)
|
||||
public void addDamageHate(Creature attacker, long damage, long aggroValue)
|
||||
{
|
||||
if ((attacker == null) || (attacker == this))
|
||||
{
|
||||
@@ -750,7 +750,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;
|
||||
final Player targetPlayer = attacker.getActingPlayer();
|
||||
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
|
||||
{
|
||||
@@ -786,7 +786,7 @@ public class Attackable extends Npc
|
||||
}
|
||||
}
|
||||
|
||||
public void reduceHate(Creature target, int amount)
|
||||
public void reduceHate(Creature target, long amount)
|
||||
{
|
||||
if (getAI() instanceof SiegeGuardAI)
|
||||
{
|
||||
@@ -872,7 +872,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
|
||||
@@ -905,7 +905,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
|
||||
@@ -963,7 +963,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))
|
||||
{
|
||||
@@ -998,6 +998,7 @@ public class Attackable extends Npc
|
||||
ai.stopHate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ai.getHate();
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,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)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ public class QuestGuard extends Guard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDamageHate(Creature attacker, int damage, int aggro)
|
||||
public void addDamageHate(Creature attacker, long damage, long aggro)
|
||||
{
|
||||
if (!_isPassive && !attacker.isPlayer())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user