Store auto use settings.
This commit is contained in:
parent
ad08f1081a
commit
cab91dfa54
@ -890,6 +890,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
||||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||||
|
private boolean _resumedAutoPlay = false;
|
||||||
|
|
||||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||||
|
|
||||||
@ -14298,6 +14299,54 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResumedAutoPlay(boolean value)
|
||||||
|
{
|
||||||
|
_resumedAutoPlay = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasResumedAutoPlay()
|
||||||
|
{
|
||||||
|
return _resumedAutoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreAutoSettings()
|
||||||
|
{
|
||||||
|
if (!Config.ENABLE_AUTO_PLAY || !getVariables().contains(PlayerVariables.AUTO_USE_SETTINGS))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SETTINGS);
|
||||||
|
if (settings.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int options = settings.get(0);
|
||||||
|
final boolean active = 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 int potionPercent = settings.get(5);
|
||||||
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
|
||||||
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
|
getAutoPlaySettings().setOptions(options);
|
||||||
|
getAutoPlaySettings().setPickup(pickUp);
|
||||||
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
|
getAutoPlaySettings().setLongRange(!longRange);
|
||||||
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
|
||||||
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, longRange, potionPercent, respectfulHunting));
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
AutoPlayTaskManager.getInstance().doAutoPlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_resumedAutoPlay = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void restoreAutoShortcutVisual()
|
public void restoreAutoShortcutVisual()
|
||||||
{
|
{
|
||||||
if (_autoUseSettings.isEmpty())
|
if (_autoUseSettings.isEmpty())
|
||||||
|
@ -62,6 +62,7 @@ public class PlayerVariables extends AbstractVariables
|
|||||||
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
||||||
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
||||||
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||||
|
public static final String AUTO_USE_SETTINGS = "AUTO_USE_SETTINGS";
|
||||||
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
||||||
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
||||||
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
||||||
|
@ -646,6 +646,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
// Auto use restore.
|
// Auto use restore.
|
||||||
player.restoreAutoShortcuts();
|
player.restoreAutoShortcuts();
|
||||||
|
player.restoreAutoSettings();
|
||||||
|
|
||||||
// Fix for equipped item skills
|
// Fix for equipped item skills
|
||||||
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
||||||
@ -59,6 +63,14 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip first run. Fixes restored settings been overwritten.
|
||||||
|
// Client sends a disabled ExAutoPlaySetting upon player login.
|
||||||
|
if (player.hasResumedAutoPlay())
|
||||||
|
{
|
||||||
|
player.setResumedAutoPlay(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
@ -67,6 +79,16 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = new ArrayList<>(7);
|
||||||
|
settings.add(0, _options);
|
||||||
|
settings.add(1, _active ? 1 : 0);
|
||||||
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
|
settings.add(3, _nextTargetMode);
|
||||||
|
settings.add(4, _longRange ? 1 : 0);
|
||||||
|
settings.add(5, _potionPercent);
|
||||||
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
player.getAutoPlaySettings().setPickup(_pickUp);
|
player.getAutoPlaySettings().setPickup(_pickUp);
|
||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
|
@ -890,6 +890,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
||||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||||
|
private boolean _resumedAutoPlay = false;
|
||||||
|
|
||||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||||
|
|
||||||
@ -14368,6 +14369,54 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResumedAutoPlay(boolean value)
|
||||||
|
{
|
||||||
|
_resumedAutoPlay = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasResumedAutoPlay()
|
||||||
|
{
|
||||||
|
return _resumedAutoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreAutoSettings()
|
||||||
|
{
|
||||||
|
if (!Config.ENABLE_AUTO_PLAY || !getVariables().contains(PlayerVariables.AUTO_USE_SETTINGS))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SETTINGS);
|
||||||
|
if (settings.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int options = settings.get(0);
|
||||||
|
final boolean active = 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 int potionPercent = settings.get(5);
|
||||||
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
|
||||||
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
|
getAutoPlaySettings().setOptions(options);
|
||||||
|
getAutoPlaySettings().setPickup(pickUp);
|
||||||
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
|
getAutoPlaySettings().setLongRange(!longRange);
|
||||||
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
|
||||||
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, longRange, potionPercent, respectfulHunting));
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
AutoPlayTaskManager.getInstance().doAutoPlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_resumedAutoPlay = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void restoreAutoShortcutVisual()
|
public void restoreAutoShortcutVisual()
|
||||||
{
|
{
|
||||||
if (_autoUseSettings.isEmpty())
|
if (_autoUseSettings.isEmpty())
|
||||||
|
@ -62,6 +62,7 @@ public class PlayerVariables extends AbstractVariables
|
|||||||
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
||||||
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
||||||
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||||
|
public static final String AUTO_USE_SETTINGS = "AUTO_USE_SETTINGS";
|
||||||
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
||||||
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
||||||
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
||||||
|
@ -656,6 +656,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
// Auto use restore.
|
// Auto use restore.
|
||||||
player.restoreAutoShortcuts();
|
player.restoreAutoShortcuts();
|
||||||
|
player.restoreAutoSettings();
|
||||||
|
|
||||||
// Fix for equipped item skills
|
// Fix for equipped item skills
|
||||||
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
||||||
@ -60,6 +64,14 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip first run. Fixes restored settings been overwritten.
|
||||||
|
// Client sends a disabled ExAutoPlaySetting upon player login.
|
||||||
|
if (player.hasResumedAutoPlay())
|
||||||
|
{
|
||||||
|
player.setResumedAutoPlay(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
@ -68,6 +80,16 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = new ArrayList<>(7);
|
||||||
|
settings.add(0, _options);
|
||||||
|
settings.add(1, _active ? 1 : 0);
|
||||||
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
|
settings.add(3, _nextTargetMode);
|
||||||
|
settings.add(4, _longRange ? 1 : 0);
|
||||||
|
settings.add(5, _potionPercent);
|
||||||
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
player.getAutoPlaySettings().setPickup(_pickUp);
|
player.getAutoPlaySettings().setPickup(_pickUp);
|
||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
|
@ -903,6 +903,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
||||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||||
|
private boolean _resumedAutoPlay = false;
|
||||||
|
|
||||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||||
|
|
||||||
@ -14405,6 +14406,54 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResumedAutoPlay(boolean value)
|
||||||
|
{
|
||||||
|
_resumedAutoPlay = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasResumedAutoPlay()
|
||||||
|
{
|
||||||
|
return _resumedAutoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreAutoSettings()
|
||||||
|
{
|
||||||
|
if (!Config.ENABLE_AUTO_PLAY || !getVariables().contains(PlayerVariables.AUTO_USE_SETTINGS))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SETTINGS);
|
||||||
|
if (settings.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int options = settings.get(0);
|
||||||
|
final boolean active = 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 int potionPercent = settings.get(5);
|
||||||
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
|
||||||
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
|
getAutoPlaySettings().setOptions(options);
|
||||||
|
getAutoPlaySettings().setPickup(pickUp);
|
||||||
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
|
getAutoPlaySettings().setLongRange(!longRange);
|
||||||
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
|
||||||
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, longRange, potionPercent, respectfulHunting));
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
AutoPlayTaskManager.getInstance().doAutoPlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_resumedAutoPlay = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void restoreAutoShortcutVisual()
|
public void restoreAutoShortcutVisual()
|
||||||
{
|
{
|
||||||
if (_autoUseSettings.isEmpty())
|
if (_autoUseSettings.isEmpty())
|
||||||
|
@ -62,6 +62,7 @@ public class PlayerVariables extends AbstractVariables
|
|||||||
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
||||||
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
||||||
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||||
|
public static final String AUTO_USE_SETTINGS = "AUTO_USE_SETTINGS";
|
||||||
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
||||||
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
||||||
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
||||||
|
@ -661,6 +661,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
// Auto use restore.
|
// Auto use restore.
|
||||||
player.restoreAutoShortcuts();
|
player.restoreAutoShortcuts();
|
||||||
|
player.restoreAutoSettings();
|
||||||
|
|
||||||
// Fix for equipped item skills
|
// Fix for equipped item skills
|
||||||
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
||||||
@ -60,6 +64,14 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip first run. Fixes restored settings been overwritten.
|
||||||
|
// Client sends a disabled ExAutoPlaySetting upon player login.
|
||||||
|
if (player.hasResumedAutoPlay())
|
||||||
|
{
|
||||||
|
player.setResumedAutoPlay(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
@ -68,6 +80,16 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = new ArrayList<>(7);
|
||||||
|
settings.add(0, _options);
|
||||||
|
settings.add(1, _active ? 1 : 0);
|
||||||
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
|
settings.add(3, _nextTargetMode);
|
||||||
|
settings.add(4, _longRange ? 1 : 0);
|
||||||
|
settings.add(5, _potionPercent);
|
||||||
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
player.getAutoPlaySettings().setPickup(_pickUp);
|
player.getAutoPlaySettings().setPickup(_pickUp);
|
||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
|
@ -879,6 +879,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
||||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||||
|
private boolean _resumedAutoPlay = false;
|
||||||
|
|
||||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||||
|
|
||||||
@ -14278,6 +14279,54 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResumedAutoPlay(boolean value)
|
||||||
|
{
|
||||||
|
_resumedAutoPlay = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasResumedAutoPlay()
|
||||||
|
{
|
||||||
|
return _resumedAutoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreAutoSettings()
|
||||||
|
{
|
||||||
|
if (!Config.ENABLE_AUTO_PLAY || !getVariables().contains(PlayerVariables.AUTO_USE_SETTINGS))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SETTINGS);
|
||||||
|
if (settings.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int options = settings.get(0);
|
||||||
|
final boolean active = 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 int potionPercent = settings.get(5);
|
||||||
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
|
||||||
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
|
getAutoPlaySettings().setOptions(options);
|
||||||
|
getAutoPlaySettings().setPickup(pickUp);
|
||||||
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
|
getAutoPlaySettings().setLongRange(!longRange);
|
||||||
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
|
||||||
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, longRange, potionPercent, respectfulHunting));
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
AutoPlayTaskManager.getInstance().doAutoPlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_resumedAutoPlay = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void restoreAutoShortcutVisual()
|
public void restoreAutoShortcutVisual()
|
||||||
{
|
{
|
||||||
if (_autoUseSettings.isEmpty())
|
if (_autoUseSettings.isEmpty())
|
||||||
|
@ -63,6 +63,7 @@ public class PlayerVariables extends AbstractVariables
|
|||||||
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
||||||
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
||||||
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||||
|
public static final String AUTO_USE_SETTINGS = "AUTO_USE_SETTINGS";
|
||||||
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
||||||
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
||||||
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
||||||
|
@ -635,6 +635,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
// Auto use restore.
|
// Auto use restore.
|
||||||
player.restoreAutoShortcuts();
|
player.restoreAutoShortcuts();
|
||||||
|
player.restoreAutoSettings();
|
||||||
|
|
||||||
// Fix for equipped item skills
|
// Fix for equipped item skills
|
||||||
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
||||||
@ -59,6 +63,14 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip first run. Fixes restored settings been overwritten.
|
||||||
|
// Client sends a disabled ExAutoPlaySetting upon player login.
|
||||||
|
if (player.hasResumedAutoPlay())
|
||||||
|
{
|
||||||
|
player.setResumedAutoPlay(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
@ -67,6 +79,16 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = new ArrayList<>(7);
|
||||||
|
settings.add(0, _options);
|
||||||
|
settings.add(1, _active ? 1 : 0);
|
||||||
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
|
settings.add(3, _nextTargetMode);
|
||||||
|
settings.add(4, _longRange ? 1 : 0);
|
||||||
|
settings.add(5, _potionPercent);
|
||||||
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
player.getAutoPlaySettings().setPickup(_pickUp);
|
player.getAutoPlaySettings().setPickup(_pickUp);
|
||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
|
@ -905,6 +905,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
||||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||||
|
private boolean _resumedAutoPlay = false;
|
||||||
|
|
||||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||||
|
|
||||||
@ -14538,6 +14539,54 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResumedAutoPlay(boolean value)
|
||||||
|
{
|
||||||
|
_resumedAutoPlay = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasResumedAutoPlay()
|
||||||
|
{
|
||||||
|
return _resumedAutoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreAutoSettings()
|
||||||
|
{
|
||||||
|
if (!Config.ENABLE_AUTO_PLAY || !getVariables().contains(PlayerVariables.AUTO_USE_SETTINGS))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SETTINGS);
|
||||||
|
if (settings.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int options = settings.get(0);
|
||||||
|
final boolean active = 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 int potionPercent = settings.get(5);
|
||||||
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
|
||||||
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
|
getAutoPlaySettings().setOptions(options);
|
||||||
|
getAutoPlaySettings().setPickup(pickUp);
|
||||||
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
|
getAutoPlaySettings().setLongRange(!longRange);
|
||||||
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
|
||||||
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, longRange, potionPercent, respectfulHunting));
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
AutoPlayTaskManager.getInstance().doAutoPlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_resumedAutoPlay = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void restoreAutoShortcutVisual()
|
public void restoreAutoShortcutVisual()
|
||||||
{
|
{
|
||||||
if (_autoUseSettings.isEmpty())
|
if (_autoUseSettings.isEmpty())
|
||||||
|
@ -63,6 +63,7 @@ public class PlayerVariables extends AbstractVariables
|
|||||||
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
||||||
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
||||||
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||||
|
public static final String AUTO_USE_SETTINGS = "AUTO_USE_SETTINGS";
|
||||||
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
||||||
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
||||||
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
||||||
|
@ -638,6 +638,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
// Auto use restore.
|
// Auto use restore.
|
||||||
player.restoreAutoShortcuts();
|
player.restoreAutoShortcuts();
|
||||||
|
player.restoreAutoSettings();
|
||||||
|
|
||||||
// Fix for equipped item skills
|
// Fix for equipped item skills
|
||||||
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
||||||
@ -60,6 +64,14 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip first run. Fixes restored settings been overwritten.
|
||||||
|
// Client sends a disabled ExAutoPlaySetting upon player login.
|
||||||
|
if (player.hasResumedAutoPlay())
|
||||||
|
{
|
||||||
|
player.setResumedAutoPlay(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
@ -68,6 +80,16 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = new ArrayList<>(7);
|
||||||
|
settings.add(0, _options);
|
||||||
|
settings.add(1, _active ? 1 : 0);
|
||||||
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
|
settings.add(3, _nextTargetMode);
|
||||||
|
settings.add(4, _longRange ? 1 : 0);
|
||||||
|
settings.add(5, _potionPercent);
|
||||||
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
player.getAutoPlaySettings().setPickup(_pickUp);
|
player.getAutoPlaySettings().setPickup(_pickUp);
|
||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
|
@ -929,6 +929,7 @@ public class PlayerInstance extends Playable
|
|||||||
|
|
||||||
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
private final AutoPlaySettingsHolder _autoPlaySettings = new AutoPlaySettingsHolder();
|
||||||
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
private final AutoUseSettingsHolder _autoUseSettings = new AutoUseSettingsHolder();
|
||||||
|
private boolean _resumedAutoPlay = false;
|
||||||
|
|
||||||
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
private ScheduledFuture<?> _timedHuntingZoneTask = null;
|
||||||
|
|
||||||
@ -14615,6 +14616,54 @@ public class PlayerInstance extends Playable
|
|||||||
return _autoUseSettings;
|
return _autoUseSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setResumedAutoPlay(boolean value)
|
||||||
|
{
|
||||||
|
_resumedAutoPlay = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasResumedAutoPlay()
|
||||||
|
{
|
||||||
|
return _resumedAutoPlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void restoreAutoSettings()
|
||||||
|
{
|
||||||
|
if (!Config.ENABLE_AUTO_PLAY || !getVariables().contains(PlayerVariables.AUTO_USE_SETTINGS))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = getVariables().getIntegerList(PlayerVariables.AUTO_USE_SETTINGS);
|
||||||
|
if (settings.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int options = settings.get(0);
|
||||||
|
final boolean active = 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 int potionPercent = settings.get(5);
|
||||||
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
|
||||||
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
|
getAutoPlaySettings().setOptions(options);
|
||||||
|
getAutoPlaySettings().setPickup(pickUp);
|
||||||
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
|
getAutoPlaySettings().setLongRange(!longRange);
|
||||||
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
|
||||||
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, longRange, potionPercent, respectfulHunting));
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
AutoPlayTaskManager.getInstance().doAutoPlay(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_resumedAutoPlay = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void restoreAutoShortcutVisual()
|
public void restoreAutoShortcutVisual()
|
||||||
{
|
{
|
||||||
if (_autoUseSettings.isEmpty())
|
if (_autoUseSettings.isEmpty())
|
||||||
|
@ -63,6 +63,7 @@ public class PlayerVariables extends AbstractVariables
|
|||||||
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
public static final String FORTUNE_TELLING_VARIABLE = "FortuneTelling";
|
||||||
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
public static final String FORTUNE_TELLING_BLACK_CAT_VARIABLE = "FortuneTellingBlackCat";
|
||||||
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
public static final String DELUSION_RETURN = "DELUSION_RETURN";
|
||||||
|
public static final String AUTO_USE_SETTINGS = "AUTO_USE_SETTINGS";
|
||||||
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
public static final String AUTO_USE_SHORTCUTS = "AUTO_USE_SHORTCUTS";
|
||||||
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
public static final String HUNTING_ZONE_ENTRY = "HUNTING_ZONE_ENTRY_";
|
||||||
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
public static final String HUNTING_ZONE_TIME = "HUNTING_ZONE_TIME_";
|
||||||
|
@ -645,6 +645,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
// Auto use restore.
|
// Auto use restore.
|
||||||
player.restoreAutoShortcuts();
|
player.restoreAutoShortcuts();
|
||||||
|
player.restoreAutoSettings();
|
||||||
|
|
||||||
// Fix for equipped item skills
|
// Fix for equipped item skills
|
||||||
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
if (!player.getEffectList().getCurrentAbnormalVisualEffects().isEmpty())
|
||||||
|
@ -16,9 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
package org.l2jmobius.gameserver.network.clientpackets.autoplay;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.network.PacketReader;
|
import org.l2jmobius.commons.network.PacketReader;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend;
|
||||||
@ -60,6 +64,14 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip first run. Fixes restored settings been overwritten.
|
||||||
|
// Client sends a disabled ExAutoPlaySetting upon player login.
|
||||||
|
if (player.hasResumedAutoPlay())
|
||||||
|
{
|
||||||
|
player.setResumedAutoPlay(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
@ -68,6 +80,16 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Integer> settings = new ArrayList<>(7);
|
||||||
|
settings.add(0, _options);
|
||||||
|
settings.add(1, _active ? 1 : 0);
|
||||||
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
|
settings.add(3, _nextTargetMode);
|
||||||
|
settings.add(4, _longRange ? 1 : 0);
|
||||||
|
settings.add(5, _potionPercent);
|
||||||
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
player.getAutoPlaySettings().setPickup(_pickUp);
|
player.getAutoPlaySettings().setPickup(_pickUp);
|
||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
|
Loading…
Reference in New Issue
Block a user