Auto hunt short range related cleanup.
This commit is contained in:
@@ -10297,7 +10297,7 @@ public class PlayerInstance extends Playable
|
||||
// Stop auto play.
|
||||
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
||||
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
||||
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isLongRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting()));
|
||||
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting()));
|
||||
restoreAutoShortcutVisual();
|
||||
|
||||
// Send info to nearby players.
|
||||
@@ -14309,7 +14309,7 @@ public class PlayerInstance extends Playable
|
||||
final boolean active = Config.RESUME_AUTO_PLAY && (settings.get(1) == 1);
|
||||
final boolean pickUp = settings.get(2) == 1;
|
||||
final int nextTargetMode = settings.get(3);
|
||||
final boolean longRange = settings.get(4) == 1;
|
||||
final boolean shortRange = settings.get(4) == 1;
|
||||
final int potionPercent = settings.get(5);
|
||||
final boolean respectfulHunting = settings.get(6) == 1;
|
||||
|
||||
@@ -14317,10 +14317,10 @@ public class PlayerInstance extends Playable
|
||||
getAutoPlaySettings().setOptions(options);
|
||||
getAutoPlaySettings().setPickup(pickUp);
|
||||
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||
getAutoPlaySettings().setLongRange(!longRange);
|
||||
getAutoPlaySettings().setShortRange(shortRange);
|
||||
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||
|
||||
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, longRange, potionPercent, respectfulHunting));
|
||||
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting));
|
||||
|
||||
if (active)
|
||||
{
|
||||
|
@@ -27,7 +27,7 @@ public class AutoPlaySettingsHolder
|
||||
private final AtomicInteger _options = new AtomicInteger();
|
||||
private final AtomicBoolean _pickup = new AtomicBoolean();
|
||||
private final AtomicInteger _nextTargetMode = new AtomicInteger();
|
||||
private final AtomicBoolean _longRange = new AtomicBoolean();
|
||||
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
||||
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
||||
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
||||
|
||||
@@ -65,14 +65,14 @@ public class AutoPlaySettingsHolder
|
||||
_nextTargetMode.set(nextTargetMode);
|
||||
}
|
||||
|
||||
public boolean isLongRange()
|
||||
public boolean isShortRange()
|
||||
{
|
||||
return _longRange.get();
|
||||
return _shortRange.get();
|
||||
}
|
||||
|
||||
public void setLongRange(boolean value)
|
||||
public void setShortRange(boolean value)
|
||||
{
|
||||
_longRange.set(value);
|
||||
_shortRange.set(value);
|
||||
}
|
||||
|
||||
public boolean isRespectfulHunting()
|
||||
|
@@ -37,7 +37,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
||||
private boolean _active;
|
||||
private boolean _pickUp;
|
||||
private int _nextTargetMode;
|
||||
private boolean _longRange;
|
||||
private boolean _shortRange;
|
||||
private int _potionPercent;
|
||||
private boolean _respectfulHunting;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
||||
_active = packet.readC() == 1;
|
||||
_pickUp = packet.readC() == 1;
|
||||
_nextTargetMode = packet.readH();
|
||||
_longRange = packet.readC() != 0;
|
||||
_shortRange = packet.readC() == 1;
|
||||
_potionPercent = packet.readD();
|
||||
_respectfulHunting = packet.readC() == 1;
|
||||
return true;
|
||||
@@ -71,7 +71,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting));
|
||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||
|
||||
if (!Config.ENABLE_AUTO_PLAY)
|
||||
@@ -84,7 +84,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
||||
settings.add(1, _active ? 1 : 0);
|
||||
settings.add(2, _pickUp ? 1 : 0);
|
||||
settings.add(3, _nextTargetMode);
|
||||
settings.add(4, _longRange ? 1 : 0);
|
||||
settings.add(4, _shortRange ? 1 : 0);
|
||||
settings.add(5, _potionPercent);
|
||||
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||
@@ -92,7 +92,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
||||
player.getAutoPlaySettings().setOptions(_options);
|
||||
player.getAutoPlaySettings().setPickup(_pickUp);
|
||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||
player.getAutoPlaySettings().setLongRange(!_longRange);
|
||||
player.getAutoPlaySettings().setShortRange(_shortRange);
|
||||
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
||||
|
||||
if (_active)
|
||||
|
@@ -29,17 +29,17 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
||||
private final boolean _active;
|
||||
private final boolean _pickUp;
|
||||
private final int _nextTargetMode;
|
||||
private final boolean _longRange;
|
||||
private final boolean _shortRange;
|
||||
private final int _potionPercent;
|
||||
private final boolean _respectfulHunting;
|
||||
|
||||
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean longRange, int potionPercent, boolean respectfulHunting)
|
||||
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting)
|
||||
{
|
||||
_options = options;
|
||||
_active = active;
|
||||
_pickUp = pickUp;
|
||||
_nextTargetMode = nextTargetMode;
|
||||
_longRange = longRange;
|
||||
_shortRange = shortRange;
|
||||
_potionPercent = potionPercent;
|
||||
_respectfulHunting = respectfulHunting;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
||||
packet.writeC(_active ? 1 : 0);
|
||||
packet.writeC(_pickUp ? 1 : 0);
|
||||
packet.writeH(_nextTargetMode);
|
||||
packet.writeC(_longRange ? 1 : 0);
|
||||
packet.writeC(_shortRange ? 1 : 0);
|
||||
packet.writeD(_potionPercent);
|
||||
packet.writeC(_respectfulHunting ? 1 : 0);
|
||||
return true;
|
||||
|
@@ -123,7 +123,7 @@ public class AutoPlayTaskManager
|
||||
// Find target.
|
||||
MonsterInstance monster = null;
|
||||
double closestDistance = Double.MAX_VALUE;
|
||||
TARGET: for (MonsterInstance nearby : World.getInstance().getVisibleObjectsInRange(player, MonsterInstance.class, player.getAutoPlaySettings().isLongRange() ? 1400 : 600))
|
||||
TARGET: for (MonsterInstance nearby : World.getInstance().getVisibleObjectsInRange(player, MonsterInstance.class, player.getAutoPlaySettings().isShortRange() ? 600 : 1400))
|
||||
{
|
||||
// Skip unavailable monsters.
|
||||
if ((nearby == null) || nearby.isAlikeDead())
|
||||
|
Reference in New Issue
Block a user