Implementation of pet auto potion.
This commit is contained in:
@@ -659,6 +659,9 @@ EnableAutoPlay = True
|
|||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoPotion = True
|
EnableAutoPotion = True
|
||||||
|
|
||||||
|
# Default: True
|
||||||
|
EnableAutoPetPotion = True
|
||||||
|
|
||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoSkill = True
|
EnableAutoSkill = True
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -928,7 +928,7 @@
|
|||||||
<set name="commissionItemType" val="POTION" />
|
<set name="commissionItemType" val="POTION" />
|
||||||
<set name="is_sellable" val="false" />
|
<set name="is_sellable" val="false" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="2038" level="1" /> <!-- Quick Healing Potion -->
|
<skill id="49100" level="1" /> <!-- Pet's HP Recovery Potion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class Transfer" type="EtcItem">
|
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class Transfer" type="EtcItem">
|
||||||
|
|||||||
+12
-2
@@ -1,9 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
||||||
<skill id="49100" toLevel="1" name="Pet HP Recovery Potion">
|
<skill id="49100" toLevel="1" name="Pet HP Recovery Potion">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<isMagic>2</isMagic> <!-- Static Skill -->
|
||||||
<icon>icon.skill0000</icon>
|
<magicLevel>1</magicLevel>
|
||||||
<operateType>A1</operateType>
|
<operateType>A1</operateType>
|
||||||
|
<magicCriticalRate>5</magicCriticalRate>
|
||||||
|
<hitCancelTime>0</hitCancelTime>
|
||||||
|
<targetType>PET</targetType>
|
||||||
|
<affectScope>SINGLE</affectScope>
|
||||||
|
<effects>
|
||||||
|
<effect name="Hp">
|
||||||
|
<amount>80</amount>
|
||||||
|
<mode>DIFF</mode>
|
||||||
|
</effect>
|
||||||
|
</effects>
|
||||||
</skill>
|
</skill>
|
||||||
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
||||||
|
|||||||
@@ -618,6 +618,7 @@ public class Config
|
|||||||
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
||||||
public static boolean ENABLE_AUTO_PLAY;
|
public static boolean ENABLE_AUTO_PLAY;
|
||||||
public static boolean ENABLE_AUTO_POTION;
|
public static boolean ENABLE_AUTO_POTION;
|
||||||
|
public static boolean ENABLE_AUTO_PET_POTION;
|
||||||
public static boolean ENABLE_AUTO_SKILL;
|
public static boolean ENABLE_AUTO_SKILL;
|
||||||
public static boolean ENABLE_AUTO_ITEM;
|
public static boolean ENABLE_AUTO_ITEM;
|
||||||
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
||||||
@@ -2147,6 +2148,7 @@ public class Config
|
|||||||
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
||||||
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
||||||
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
||||||
|
ENABLE_AUTO_PET_POTION = generalConfig.getBoolean("EnableAutoPetPotion", true);
|
||||||
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
||||||
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
||||||
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
||||||
|
|||||||
+4
-2
@@ -10602,7 +10602,7 @@ public class Player extends Playable
|
|||||||
// Stop auto play.
|
// Stop auto play.
|
||||||
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
||||||
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
||||||
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting()));
|
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting(), _autoPlaySettings.getAutoPetPotionPercent()));
|
||||||
restoreAutoShortcutVisual();
|
restoreAutoShortcutVisual();
|
||||||
|
|
||||||
// Send info to nearby players.
|
// Send info to nearby players.
|
||||||
@@ -14627,6 +14627,7 @@ public class Player extends Playable
|
|||||||
final boolean shortRange = settings.get(4) == 1;
|
final boolean shortRange = settings.get(4) == 1;
|
||||||
final int potionPercent = settings.get(5);
|
final int potionPercent = settings.get(5);
|
||||||
final boolean respectfulHunting = settings.get(6) == 1;
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
final int petPotionPercent = settings.size() < 8 ? 0 : settings.get(7);
|
||||||
|
|
||||||
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
getAutoPlaySettings().setOptions(options);
|
getAutoPlaySettings().setOptions(options);
|
||||||
@@ -14634,8 +14635,9 @@ public class Player extends Playable
|
|||||||
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
getAutoPlaySettings().setShortRange(shortRange);
|
getAutoPlaySettings().setShortRange(shortRange);
|
||||||
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
getAutoPlaySettings().setAutoPetPotionPercent(petPotionPercent);
|
||||||
|
|
||||||
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting));
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting, petPotionPercent));
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
|
|||||||
+11
@@ -30,6 +30,7 @@ public class AutoPlaySettingsHolder
|
|||||||
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
||||||
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
||||||
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
||||||
|
private final AtomicInteger _autoPetPotionPercent = new AtomicInteger();
|
||||||
|
|
||||||
public AutoPlaySettingsHolder()
|
public AutoPlaySettingsHolder()
|
||||||
{
|
{
|
||||||
@@ -94,4 +95,14 @@ public class AutoPlaySettingsHolder
|
|||||||
{
|
{
|
||||||
_autoPotionPercent.set(value);
|
_autoPotionPercent.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAutoPetPotionPercent()
|
||||||
|
{
|
||||||
|
return _autoPetPotionPercent.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoPetPotionPercent(int value)
|
||||||
|
{
|
||||||
|
_autoPetPotionPercent.set(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -28,6 +28,7 @@ public class AutoUseSettingsHolder
|
|||||||
{
|
{
|
||||||
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
|
private final Collection<Integer> _autoPetPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
||||||
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
||||||
@@ -47,6 +48,11 @@ public class AutoUseSettingsHolder
|
|||||||
return _autoPotionItems;
|
return _autoPotionItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Integer> getAutoPetPotionItems()
|
||||||
|
{
|
||||||
|
return _autoPetPotionItems;
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<Integer> getAutoActions()
|
public Collection<Integer> getAutoActions()
|
||||||
{
|
{
|
||||||
return _autoActions;
|
return _autoActions;
|
||||||
@@ -99,6 +105,6 @@ public class AutoUseSettingsHolder
|
|||||||
|
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoPetPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -39,6 +39,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
private int _nextTargetMode;
|
private int _nextTargetMode;
|
||||||
private boolean _shortRange;
|
private boolean _shortRange;
|
||||||
private int _potionPercent;
|
private int _potionPercent;
|
||||||
|
private int _petPotionPercent;
|
||||||
private boolean _respectfulHunting;
|
private boolean _respectfulHunting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,7 +51,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
_nextTargetMode = packet.readH();
|
_nextTargetMode = packet.readH();
|
||||||
_shortRange = packet.readC() == 1;
|
_shortRange = packet.readC() == 1;
|
||||||
_potionPercent = packet.readD();
|
_potionPercent = packet.readD();
|
||||||
packet.readD(); // 272
|
_petPotionPercent = packet.readD(); // 272
|
||||||
_respectfulHunting = packet.readC() == 1;
|
_respectfulHunting = packet.readC() == 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -72,7 +73,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting, _petPotionPercent));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
if (!Config.ENABLE_AUTO_PLAY)
|
if (!Config.ENABLE_AUTO_PLAY)
|
||||||
@@ -80,7 +81,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> settings = new ArrayList<>(7);
|
final List<Integer> settings = new ArrayList<>(8);
|
||||||
settings.add(0, _options);
|
settings.add(0, _options);
|
||||||
settings.add(1, _active ? 1 : 0);
|
settings.add(1, _active ? 1 : 0);
|
||||||
settings.add(2, _pickUp ? 1 : 0);
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
@@ -88,6 +89,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
settings.add(4, _shortRange ? 1 : 0);
|
settings.add(4, _shortRange ? 1 : 0);
|
||||||
settings.add(5, _potionPercent);
|
settings.add(5, _potionPercent);
|
||||||
settings.add(6, _respectfulHunting ? 1 : 0);
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
settings.add(7, _petPotionPercent);
|
||||||
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
@@ -95,6 +97,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
player.getAutoPlaySettings().setShortRange(_shortRange);
|
player.getAutoPlaySettings().setShortRange(_shortRange);
|
||||||
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
||||||
|
player.getAutoPlaySettings().setAutoPetPotionPercent(_petPotionPercent);
|
||||||
|
|
||||||
if (_active)
|
if (_active)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-1
@@ -114,6 +114,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else // auto potion
|
else // auto potion
|
||||||
{
|
{
|
||||||
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
||||||
|
AutoUseTaskManager.getInstance().removeAutoPetPotionItem(player, item.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
@@ -147,7 +148,9 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// auto potion
|
// auto potion
|
||||||
if ((_page == 23) && (_slot == 1))
|
if (_page == 23)
|
||||||
|
{
|
||||||
|
if (_slot == 1)
|
||||||
{
|
{
|
||||||
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
||||||
{
|
{
|
||||||
@@ -155,6 +158,15 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (_slot == 2)
|
||||||
|
{
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && (item != null) && item.isPotion())
|
||||||
|
{
|
||||||
|
AutoUseTaskManager.getInstance().addAutoPetPotionItem(player, item.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-2
@@ -32,8 +32,9 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
private final boolean _shortRange;
|
private final boolean _shortRange;
|
||||||
private final int _potionPercent;
|
private final int _potionPercent;
|
||||||
private final boolean _respectfulHunting;
|
private final boolean _respectfulHunting;
|
||||||
|
private final int _petPotionPercent;
|
||||||
|
|
||||||
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting)
|
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting, int petPotionPercent)
|
||||||
{
|
{
|
||||||
_options = options;
|
_options = options;
|
||||||
_active = active;
|
_active = active;
|
||||||
@@ -42,6 +43,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
_shortRange = shortRange;
|
_shortRange = shortRange;
|
||||||
_potionPercent = potionPercent;
|
_potionPercent = potionPercent;
|
||||||
_respectfulHunting = respectfulHunting;
|
_respectfulHunting = respectfulHunting;
|
||||||
|
_petPotionPercent = petPotionPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,7 +56,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
packet.writeH(_nextTargetMode);
|
packet.writeH(_nextTargetMode);
|
||||||
packet.writeC(_shortRange ? 1 : 0);
|
packet.writeC(_shortRange ? 1 : 0);
|
||||||
packet.writeD(_potionPercent);
|
packet.writeD(_potionPercent);
|
||||||
packet.writeD(0); // 272
|
packet.writeD(_petPotionPercent); // 272
|
||||||
packet.writeC(_respectfulHunting ? 1 : 0);
|
packet.writeC(_respectfulHunting ? 1 : 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+41
@@ -35,6 +35,7 @@ import org.l2jmobius.gameserver.model.actor.Playable;
|
|||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.Pet;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
||||||
@@ -163,6 +164,34 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && !isInPeaceZone)
|
||||||
|
{
|
||||||
|
final Pet pet = player.getPet();
|
||||||
|
if ((pet != null) && (pet.getCurrentHpPercent() <= player.getAutoPlaySettings().getAutoPetPotionPercent()))
|
||||||
|
{
|
||||||
|
POTIONS: for (Integer itemId : player.getAutoUseSettings().getAutoPetPotionItems())
|
||||||
|
{
|
||||||
|
final Item item = player.getInventory().getItemByItemId(itemId.intValue());
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
continue POTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int reuseDelay = item.getReuseDelay();
|
||||||
|
if ((reuseDelay <= 0) || (player.getItemRemainingReuseTime(item.getObjectId()) <= 0))
|
||||||
|
{
|
||||||
|
final EtcItem etcItem = item.getEtcItem();
|
||||||
|
final IItemHandler handler = ItemHandler.getInstance().getHandler(etcItem);
|
||||||
|
if ((handler != null) && handler.useItem(player, item, false) && (reuseDelay > 0))
|
||||||
|
{
|
||||||
|
player.addTimeStampItem(item, reuseDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.ENABLE_AUTO_SKILL)
|
if (Config.ENABLE_AUTO_SKILL)
|
||||||
{
|
{
|
||||||
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
||||||
@@ -465,6 +494,18 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
stopAutoUseTask(player);
|
stopAutoUseTask(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().add(itemId);
|
||||||
|
startAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
stopAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
public void addAutoBuff(Player player, int skillId)
|
public void addAutoBuff(Player player, int skillId)
|
||||||
{
|
{
|
||||||
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
||||||
|
|||||||
@@ -659,6 +659,9 @@ EnableAutoPlay = True
|
|||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoPotion = True
|
EnableAutoPotion = True
|
||||||
|
|
||||||
|
# Default: True
|
||||||
|
EnableAutoPetPotion = True
|
||||||
|
|
||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoSkill = True
|
EnableAutoSkill = True
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -927,7 +927,7 @@
|
|||||||
<set name="commissionItemType" val="POTION" />
|
<set name="commissionItemType" val="POTION" />
|
||||||
<set name="is_sellable" val="false" />
|
<set name="is_sellable" val="false" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="2038" level="1" /> <!-- Quick Healing Potion -->
|
<skill id="49100" level="1" /> <!-- Pet's HP Recovery Potion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class" type="EtcItem">
|
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class" type="EtcItem">
|
||||||
|
|||||||
+12
-2
@@ -1,9 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
||||||
<skill id="49100" toLevel="1" name="Pet HP Recovery Potion">
|
<skill id="49100" toLevel="1" name="Pet HP Recovery Potion">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<isMagic>2</isMagic> <!-- Static Skill -->
|
||||||
<icon>icon.skill0000</icon>
|
<magicLevel>1</magicLevel>
|
||||||
<operateType>A1</operateType>
|
<operateType>A1</operateType>
|
||||||
|
<magicCriticalRate>5</magicCriticalRate>
|
||||||
|
<hitCancelTime>0</hitCancelTime>
|
||||||
|
<targetType>PET</targetType>
|
||||||
|
<affectScope>SINGLE</affectScope>
|
||||||
|
<effects>
|
||||||
|
<effect name="Hp">
|
||||||
|
<amount>80</amount>
|
||||||
|
<mode>DIFF</mode>
|
||||||
|
</effect>
|
||||||
|
</effects>
|
||||||
</skill>
|
</skill>
|
||||||
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
||||||
|
|||||||
@@ -620,6 +620,7 @@ public class Config
|
|||||||
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
||||||
public static boolean ENABLE_AUTO_PLAY;
|
public static boolean ENABLE_AUTO_PLAY;
|
||||||
public static boolean ENABLE_AUTO_POTION;
|
public static boolean ENABLE_AUTO_POTION;
|
||||||
|
public static boolean ENABLE_AUTO_PET_POTION;
|
||||||
public static boolean ENABLE_AUTO_SKILL;
|
public static boolean ENABLE_AUTO_SKILL;
|
||||||
public static boolean ENABLE_AUTO_ITEM;
|
public static boolean ENABLE_AUTO_ITEM;
|
||||||
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
||||||
@@ -2246,6 +2247,7 @@ public class Config
|
|||||||
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
||||||
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
||||||
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
||||||
|
ENABLE_AUTO_PET_POTION = generalConfig.getBoolean("EnableAutoPetPotion", true);
|
||||||
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
||||||
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
||||||
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
||||||
|
|||||||
+4
-2
@@ -10657,7 +10657,7 @@ public class Player extends Playable
|
|||||||
// Stop auto play.
|
// Stop auto play.
|
||||||
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
||||||
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
||||||
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting()));
|
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting(), _autoPlaySettings.getAutoPetPotionPercent()));
|
||||||
restoreAutoShortcutVisual();
|
restoreAutoShortcutVisual();
|
||||||
|
|
||||||
// Send info to nearby players.
|
// Send info to nearby players.
|
||||||
@@ -14708,6 +14708,7 @@ public class Player extends Playable
|
|||||||
final boolean shortRange = settings.get(4) == 1;
|
final boolean shortRange = settings.get(4) == 1;
|
||||||
final int potionPercent = settings.get(5);
|
final int potionPercent = settings.get(5);
|
||||||
final boolean respectfulHunting = settings.get(6) == 1;
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
final int petPotionPercent = settings.size() < 8 ? 0 : settings.get(7);
|
||||||
|
|
||||||
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
getAutoPlaySettings().setOptions(options);
|
getAutoPlaySettings().setOptions(options);
|
||||||
@@ -14715,8 +14716,9 @@ public class Player extends Playable
|
|||||||
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
getAutoPlaySettings().setShortRange(shortRange);
|
getAutoPlaySettings().setShortRange(shortRange);
|
||||||
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
getAutoPlaySettings().setAutoPetPotionPercent(petPotionPercent);
|
||||||
|
|
||||||
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting));
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting, petPotionPercent));
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
|
|||||||
+11
@@ -30,6 +30,7 @@ public class AutoPlaySettingsHolder
|
|||||||
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
||||||
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
||||||
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
||||||
|
private final AtomicInteger _autoPetPotionPercent = new AtomicInteger();
|
||||||
|
|
||||||
public AutoPlaySettingsHolder()
|
public AutoPlaySettingsHolder()
|
||||||
{
|
{
|
||||||
@@ -94,4 +95,14 @@ public class AutoPlaySettingsHolder
|
|||||||
{
|
{
|
||||||
_autoPotionPercent.set(value);
|
_autoPotionPercent.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAutoPetPotionPercent()
|
||||||
|
{
|
||||||
|
return _autoPetPotionPercent.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoPetPotionPercent(int value)
|
||||||
|
{
|
||||||
|
_autoPetPotionPercent.set(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -28,6 +28,7 @@ public class AutoUseSettingsHolder
|
|||||||
{
|
{
|
||||||
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
|
private final Collection<Integer> _autoPetPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
||||||
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
||||||
@@ -47,6 +48,11 @@ public class AutoUseSettingsHolder
|
|||||||
return _autoPotionItems;
|
return _autoPotionItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Integer> getAutoPetPotionItems()
|
||||||
|
{
|
||||||
|
return _autoPetPotionItems;
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<Integer> getAutoActions()
|
public Collection<Integer> getAutoActions()
|
||||||
{
|
{
|
||||||
return _autoActions;
|
return _autoActions;
|
||||||
@@ -99,6 +105,6 @@ public class AutoUseSettingsHolder
|
|||||||
|
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoPetPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -39,6 +39,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
private int _nextTargetMode;
|
private int _nextTargetMode;
|
||||||
private boolean _shortRange;
|
private boolean _shortRange;
|
||||||
private int _potionPercent;
|
private int _potionPercent;
|
||||||
|
private int _petPotionPercent;
|
||||||
private boolean _respectfulHunting;
|
private boolean _respectfulHunting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,7 +51,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
_nextTargetMode = packet.readH();
|
_nextTargetMode = packet.readH();
|
||||||
_shortRange = packet.readC() == 1;
|
_shortRange = packet.readC() == 1;
|
||||||
_potionPercent = packet.readD();
|
_potionPercent = packet.readD();
|
||||||
packet.readD(); // 272
|
_petPotionPercent = packet.readD(); // 272
|
||||||
_respectfulHunting = packet.readC() == 1;
|
_respectfulHunting = packet.readC() == 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -72,7 +73,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting, _petPotionPercent));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
if (!Config.ENABLE_AUTO_PLAY)
|
if (!Config.ENABLE_AUTO_PLAY)
|
||||||
@@ -80,7 +81,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> settings = new ArrayList<>(7);
|
final List<Integer> settings = new ArrayList<>(8);
|
||||||
settings.add(0, _options);
|
settings.add(0, _options);
|
||||||
settings.add(1, _active ? 1 : 0);
|
settings.add(1, _active ? 1 : 0);
|
||||||
settings.add(2, _pickUp ? 1 : 0);
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
@@ -88,6 +89,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
settings.add(4, _shortRange ? 1 : 0);
|
settings.add(4, _shortRange ? 1 : 0);
|
||||||
settings.add(5, _potionPercent);
|
settings.add(5, _potionPercent);
|
||||||
settings.add(6, _respectfulHunting ? 1 : 0);
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
settings.add(7, _petPotionPercent);
|
||||||
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
@@ -95,6 +97,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
player.getAutoPlaySettings().setShortRange(_shortRange);
|
player.getAutoPlaySettings().setShortRange(_shortRange);
|
||||||
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
||||||
|
player.getAutoPlaySettings().setAutoPetPotionPercent(_petPotionPercent);
|
||||||
|
|
||||||
if (_active)
|
if (_active)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-1
@@ -114,6 +114,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else // auto potion
|
else // auto potion
|
||||||
{
|
{
|
||||||
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
||||||
|
AutoUseTaskManager.getInstance().removeAutoPetPotionItem(player, item.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
@@ -147,7 +148,9 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// auto potion
|
// auto potion
|
||||||
if ((_page == 23) && (_slot == 1))
|
if (_page == 23)
|
||||||
|
{
|
||||||
|
if (_slot == 1)
|
||||||
{
|
{
|
||||||
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
||||||
{
|
{
|
||||||
@@ -155,6 +158,15 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (_slot == 2)
|
||||||
|
{
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && (item != null) && item.isPotion())
|
||||||
|
{
|
||||||
|
AutoUseTaskManager.getInstance().addAutoPetPotionItem(player, item.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-2
@@ -32,8 +32,9 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
private final boolean _shortRange;
|
private final boolean _shortRange;
|
||||||
private final int _potionPercent;
|
private final int _potionPercent;
|
||||||
private final boolean _respectfulHunting;
|
private final boolean _respectfulHunting;
|
||||||
|
private final int _petPotionPercent;
|
||||||
|
|
||||||
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting)
|
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting, int petPotionPercent)
|
||||||
{
|
{
|
||||||
_options = options;
|
_options = options;
|
||||||
_active = active;
|
_active = active;
|
||||||
@@ -42,6 +43,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
_shortRange = shortRange;
|
_shortRange = shortRange;
|
||||||
_potionPercent = potionPercent;
|
_potionPercent = potionPercent;
|
||||||
_respectfulHunting = respectfulHunting;
|
_respectfulHunting = respectfulHunting;
|
||||||
|
_petPotionPercent = petPotionPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,7 +56,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
packet.writeH(_nextTargetMode);
|
packet.writeH(_nextTargetMode);
|
||||||
packet.writeC(_shortRange ? 1 : 0);
|
packet.writeC(_shortRange ? 1 : 0);
|
||||||
packet.writeD(_potionPercent);
|
packet.writeD(_potionPercent);
|
||||||
packet.writeD(0); // 272
|
packet.writeD(_petPotionPercent); // 272
|
||||||
packet.writeC(_respectfulHunting ? 1 : 0);
|
packet.writeC(_respectfulHunting ? 1 : 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+41
@@ -35,6 +35,7 @@ import org.l2jmobius.gameserver.model.actor.Playable;
|
|||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.Pet;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
||||||
@@ -163,6 +164,34 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && !isInPeaceZone)
|
||||||
|
{
|
||||||
|
final Pet pet = player.getPet();
|
||||||
|
if ((pet != null) && (pet.getCurrentHpPercent() <= player.getAutoPlaySettings().getAutoPetPotionPercent()))
|
||||||
|
{
|
||||||
|
POTIONS: for (Integer itemId : player.getAutoUseSettings().getAutoPetPotionItems())
|
||||||
|
{
|
||||||
|
final Item item = player.getInventory().getItemByItemId(itemId.intValue());
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
continue POTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int reuseDelay = item.getReuseDelay();
|
||||||
|
if ((reuseDelay <= 0) || (player.getItemRemainingReuseTime(item.getObjectId()) <= 0))
|
||||||
|
{
|
||||||
|
final EtcItem etcItem = item.getEtcItem();
|
||||||
|
final IItemHandler handler = ItemHandler.getInstance().getHandler(etcItem);
|
||||||
|
if ((handler != null) && handler.useItem(player, item, false) && (reuseDelay > 0))
|
||||||
|
{
|
||||||
|
player.addTimeStampItem(item, reuseDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.ENABLE_AUTO_SKILL)
|
if (Config.ENABLE_AUTO_SKILL)
|
||||||
{
|
{
|
||||||
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
||||||
@@ -465,6 +494,18 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
stopAutoUseTask(player);
|
stopAutoUseTask(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().add(itemId);
|
||||||
|
startAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
stopAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
public void addAutoBuff(Player player, int skillId)
|
public void addAutoBuff(Player player, int skillId)
|
||||||
{
|
{
|
||||||
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
||||||
|
|||||||
@@ -659,6 +659,9 @@ EnableAutoPlay = True
|
|||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoPotion = True
|
EnableAutoPotion = True
|
||||||
|
|
||||||
|
# Default: True
|
||||||
|
EnableAutoPetPotion = True
|
||||||
|
|
||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoSkill = True
|
EnableAutoSkill = True
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -927,7 +927,7 @@
|
|||||||
<set name="commissionItemType" val="POTION" />
|
<set name="commissionItemType" val="POTION" />
|
||||||
<set name="is_sellable" val="false" />
|
<set name="is_sellable" val="false" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="2038" level="1" /> <!-- Quick Healing Potion -->
|
<skill id="49100" level="1" /> <!-- Pet's HP Recovery Potion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class" type="EtcItem">
|
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class" type="EtcItem">
|
||||||
|
|||||||
+12
-2
@@ -1,9 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
||||||
<skill id="49100" toLevel="1" name="Pet HP Recovery Potion">
|
<skill id="49100" toLevel="1" name="Pet HP Recovery Potion">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<isMagic>2</isMagic> <!-- Static Skill -->
|
||||||
<icon>icon.skill0000</icon>
|
<magicLevel>1</magicLevel>
|
||||||
<operateType>A1</operateType>
|
<operateType>A1</operateType>
|
||||||
|
<magicCriticalRate>5</magicCriticalRate>
|
||||||
|
<hitCancelTime>0</hitCancelTime>
|
||||||
|
<targetType>PET</targetType>
|
||||||
|
<affectScope>SINGLE</affectScope>
|
||||||
|
<effects>
|
||||||
|
<effect name="Hp">
|
||||||
|
<amount>80</amount>
|
||||||
|
<mode>DIFF</mode>
|
||||||
|
</effect>
|
||||||
|
</effects>
|
||||||
</skill>
|
</skill>
|
||||||
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
||||||
|
|||||||
@@ -621,6 +621,7 @@ public class Config
|
|||||||
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
||||||
public static boolean ENABLE_AUTO_PLAY;
|
public static boolean ENABLE_AUTO_PLAY;
|
||||||
public static boolean ENABLE_AUTO_POTION;
|
public static boolean ENABLE_AUTO_POTION;
|
||||||
|
public static boolean ENABLE_AUTO_PET_POTION;
|
||||||
public static boolean ENABLE_AUTO_SKILL;
|
public static boolean ENABLE_AUTO_SKILL;
|
||||||
public static boolean ENABLE_AUTO_ITEM;
|
public static boolean ENABLE_AUTO_ITEM;
|
||||||
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
||||||
@@ -2253,6 +2254,7 @@ public class Config
|
|||||||
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
||||||
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
||||||
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
||||||
|
ENABLE_AUTO_PET_POTION = generalConfig.getBoolean("EnableAutoPetPotion", true);
|
||||||
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
||||||
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
||||||
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
||||||
|
|||||||
+4
-2
@@ -10833,7 +10833,7 @@ public class Player extends Playable
|
|||||||
// Stop auto play.
|
// Stop auto play.
|
||||||
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
||||||
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
||||||
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting()));
|
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting(), _autoPlaySettings.getAutoPetPotionPercent()));
|
||||||
restoreAutoShortcutVisual();
|
restoreAutoShortcutVisual();
|
||||||
|
|
||||||
// Send info to nearby players.
|
// Send info to nearby players.
|
||||||
@@ -14888,6 +14888,7 @@ public class Player extends Playable
|
|||||||
final boolean shortRange = settings.get(4) == 1;
|
final boolean shortRange = settings.get(4) == 1;
|
||||||
final int potionPercent = settings.get(5);
|
final int potionPercent = settings.get(5);
|
||||||
final boolean respectfulHunting = settings.get(6) == 1;
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
final int petPotionPercent = settings.size() < 8 ? 0 : settings.get(7);
|
||||||
|
|
||||||
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
getAutoPlaySettings().setOptions(options);
|
getAutoPlaySettings().setOptions(options);
|
||||||
@@ -14895,8 +14896,9 @@ public class Player extends Playable
|
|||||||
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
getAutoPlaySettings().setShortRange(shortRange);
|
getAutoPlaySettings().setShortRange(shortRange);
|
||||||
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
getAutoPlaySettings().setAutoPetPotionPercent(petPotionPercent);
|
||||||
|
|
||||||
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting));
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting, petPotionPercent));
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
|
|||||||
+11
@@ -30,6 +30,7 @@ public class AutoPlaySettingsHolder
|
|||||||
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
||||||
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
||||||
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
||||||
|
private final AtomicInteger _autoPetPotionPercent = new AtomicInteger();
|
||||||
|
|
||||||
public AutoPlaySettingsHolder()
|
public AutoPlaySettingsHolder()
|
||||||
{
|
{
|
||||||
@@ -94,4 +95,14 @@ public class AutoPlaySettingsHolder
|
|||||||
{
|
{
|
||||||
_autoPotionPercent.set(value);
|
_autoPotionPercent.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAutoPetPotionPercent()
|
||||||
|
{
|
||||||
|
return _autoPetPotionPercent.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoPetPotionPercent(int value)
|
||||||
|
{
|
||||||
|
_autoPetPotionPercent.set(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -28,6 +28,7 @@ public class AutoUseSettingsHolder
|
|||||||
{
|
{
|
||||||
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
|
private final Collection<Integer> _autoPetPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
||||||
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
||||||
@@ -47,6 +48,11 @@ public class AutoUseSettingsHolder
|
|||||||
return _autoPotionItems;
|
return _autoPotionItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Integer> getAutoPetPotionItems()
|
||||||
|
{
|
||||||
|
return _autoPetPotionItems;
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<Integer> getAutoActions()
|
public Collection<Integer> getAutoActions()
|
||||||
{
|
{
|
||||||
return _autoActions;
|
return _autoActions;
|
||||||
@@ -99,6 +105,6 @@ public class AutoUseSettingsHolder
|
|||||||
|
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoPetPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -39,6 +39,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
private int _nextTargetMode;
|
private int _nextTargetMode;
|
||||||
private boolean _shortRange;
|
private boolean _shortRange;
|
||||||
private int _potionPercent;
|
private int _potionPercent;
|
||||||
|
private int _petPotionPercent;
|
||||||
private boolean _respectfulHunting;
|
private boolean _respectfulHunting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,7 +51,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
_nextTargetMode = packet.readH();
|
_nextTargetMode = packet.readH();
|
||||||
_shortRange = packet.readC() == 1;
|
_shortRange = packet.readC() == 1;
|
||||||
_potionPercent = packet.readD();
|
_potionPercent = packet.readD();
|
||||||
packet.readD(); // 272
|
_petPotionPercent = packet.readD(); // 272
|
||||||
_respectfulHunting = packet.readC() == 1;
|
_respectfulHunting = packet.readC() == 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -72,7 +73,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting, _petPotionPercent));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
if (!Config.ENABLE_AUTO_PLAY)
|
if (!Config.ENABLE_AUTO_PLAY)
|
||||||
@@ -80,7 +81,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> settings = new ArrayList<>(7);
|
final List<Integer> settings = new ArrayList<>(8);
|
||||||
settings.add(0, _options);
|
settings.add(0, _options);
|
||||||
settings.add(1, _active ? 1 : 0);
|
settings.add(1, _active ? 1 : 0);
|
||||||
settings.add(2, _pickUp ? 1 : 0);
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
@@ -88,6 +89,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
settings.add(4, _shortRange ? 1 : 0);
|
settings.add(4, _shortRange ? 1 : 0);
|
||||||
settings.add(5, _potionPercent);
|
settings.add(5, _potionPercent);
|
||||||
settings.add(6, _respectfulHunting ? 1 : 0);
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
settings.add(7, _petPotionPercent);
|
||||||
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
@@ -95,6 +97,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
player.getAutoPlaySettings().setShortRange(_shortRange);
|
player.getAutoPlaySettings().setShortRange(_shortRange);
|
||||||
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
||||||
|
player.getAutoPlaySettings().setAutoPetPotionPercent(_petPotionPercent);
|
||||||
|
|
||||||
if (_active)
|
if (_active)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-1
@@ -114,6 +114,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else // auto potion
|
else // auto potion
|
||||||
{
|
{
|
||||||
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
||||||
|
AutoUseTaskManager.getInstance().removeAutoPetPotionItem(player, item.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
@@ -147,7 +148,9 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// auto potion
|
// auto potion
|
||||||
if ((_page == 23) && (_slot == 1))
|
if (_page == 23)
|
||||||
|
{
|
||||||
|
if (_slot == 1)
|
||||||
{
|
{
|
||||||
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
||||||
{
|
{
|
||||||
@@ -155,6 +158,15 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (_slot == 2)
|
||||||
|
{
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && (item != null) && item.isPotion())
|
||||||
|
{
|
||||||
|
AutoUseTaskManager.getInstance().addAutoPetPotionItem(player, item.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-2
@@ -32,8 +32,9 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
private final boolean _shortRange;
|
private final boolean _shortRange;
|
||||||
private final int _potionPercent;
|
private final int _potionPercent;
|
||||||
private final boolean _respectfulHunting;
|
private final boolean _respectfulHunting;
|
||||||
|
private final int _petPotionPercent;
|
||||||
|
|
||||||
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting)
|
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting, int petPotionPercent)
|
||||||
{
|
{
|
||||||
_options = options;
|
_options = options;
|
||||||
_active = active;
|
_active = active;
|
||||||
@@ -42,6 +43,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
_shortRange = shortRange;
|
_shortRange = shortRange;
|
||||||
_potionPercent = potionPercent;
|
_potionPercent = potionPercent;
|
||||||
_respectfulHunting = respectfulHunting;
|
_respectfulHunting = respectfulHunting;
|
||||||
|
_petPotionPercent = petPotionPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,7 +56,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
packet.writeH(_nextTargetMode);
|
packet.writeH(_nextTargetMode);
|
||||||
packet.writeC(_shortRange ? 1 : 0);
|
packet.writeC(_shortRange ? 1 : 0);
|
||||||
packet.writeD(_potionPercent);
|
packet.writeD(_potionPercent);
|
||||||
packet.writeD(0); // 272
|
packet.writeD(_petPotionPercent); // 272
|
||||||
packet.writeC(_respectfulHunting ? 1 : 0);
|
packet.writeC(_respectfulHunting ? 1 : 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+41
@@ -35,6 +35,7 @@ import org.l2jmobius.gameserver.model.actor.Playable;
|
|||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.Pet;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
||||||
@@ -163,6 +164,34 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && !isInPeaceZone)
|
||||||
|
{
|
||||||
|
final Pet pet = player.getPet();
|
||||||
|
if ((pet != null) && (pet.getCurrentHpPercent() <= player.getAutoPlaySettings().getAutoPetPotionPercent()))
|
||||||
|
{
|
||||||
|
POTIONS: for (Integer itemId : player.getAutoUseSettings().getAutoPetPotionItems())
|
||||||
|
{
|
||||||
|
final Item item = player.getInventory().getItemByItemId(itemId.intValue());
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
continue POTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int reuseDelay = item.getReuseDelay();
|
||||||
|
if ((reuseDelay <= 0) || (player.getItemRemainingReuseTime(item.getObjectId()) <= 0))
|
||||||
|
{
|
||||||
|
final EtcItem etcItem = item.getEtcItem();
|
||||||
|
final IItemHandler handler = ItemHandler.getInstance().getHandler(etcItem);
|
||||||
|
if ((handler != null) && handler.useItem(player, item, false) && (reuseDelay > 0))
|
||||||
|
{
|
||||||
|
player.addTimeStampItem(item, reuseDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.ENABLE_AUTO_SKILL)
|
if (Config.ENABLE_AUTO_SKILL)
|
||||||
{
|
{
|
||||||
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
||||||
@@ -465,6 +494,18 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
stopAutoUseTask(player);
|
stopAutoUseTask(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().add(itemId);
|
||||||
|
startAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
stopAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
public void addAutoBuff(Player player, int skillId)
|
public void addAutoBuff(Player player, int skillId)
|
||||||
{
|
{
|
||||||
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
||||||
|
|||||||
@@ -659,6 +659,9 @@ EnableAutoPlay = True
|
|||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoPotion = True
|
EnableAutoPotion = True
|
||||||
|
|
||||||
|
# Default: True
|
||||||
|
EnableAutoPetPotion = True
|
||||||
|
|
||||||
# Default: True
|
# Default: True
|
||||||
EnableAutoSkill = True
|
EnableAutoSkill = True
|
||||||
|
|
||||||
|
|||||||
@@ -927,7 +927,7 @@
|
|||||||
<set name="commissionItemType" val="POTION" />
|
<set name="commissionItemType" val="POTION" />
|
||||||
<set name="is_sellable" val="false" />
|
<set name="is_sellable" val="false" />
|
||||||
<skills>
|
<skills>
|
||||||
<skill id="2038" level="1" /> <!-- Quick Healing Potion -->
|
<skill id="49100" level="1" /> <!-- Pet's HP Recovery Potion -->
|
||||||
</skills>
|
</skills>
|
||||||
</item>
|
</item>
|
||||||
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class" type="EtcItem">
|
<item id="93968" name="Best STR Dye (STR +3)" additionalName="3rd Class" type="EtcItem">
|
||||||
|
|||||||
+12
-2
@@ -1,9 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/skills.xsd">
|
||||||
<skill id="49100" toLevel="1" name="Pet's HP Recovery Potion">
|
<skill id="49100" toLevel="1" name="Pet's HP Recovery Potion">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<isMagic>2</isMagic> <!-- Static Skill -->
|
||||||
<icon>icon.skill0000</icon>
|
<magicLevel>1</magicLevel>
|
||||||
<operateType>A1</operateType>
|
<operateType>A1</operateType>
|
||||||
|
<magicCriticalRate>5</magicCriticalRate>
|
||||||
|
<hitCancelTime>0</hitCancelTime>
|
||||||
|
<targetType>PET</targetType>
|
||||||
|
<affectScope>SINGLE</affectScope>
|
||||||
|
<effects>
|
||||||
|
<effect name="Hp">
|
||||||
|
<amount>80</amount>
|
||||||
|
<mode>DIFF</mode>
|
||||||
|
</effect>
|
||||||
|
</effects>
|
||||||
</skill>
|
</skill>
|
||||||
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
<skill id="49101" toLevel="1" name="1st Pet Evolution">
|
||||||
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
<!-- AUTO GENERATED SKILL TODO: FIX IT -->
|
||||||
|
|||||||
@@ -621,6 +621,7 @@ public class Config
|
|||||||
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
|
||||||
public static boolean ENABLE_AUTO_PLAY;
|
public static boolean ENABLE_AUTO_PLAY;
|
||||||
public static boolean ENABLE_AUTO_POTION;
|
public static boolean ENABLE_AUTO_POTION;
|
||||||
|
public static boolean ENABLE_AUTO_PET_POTION;
|
||||||
public static boolean ENABLE_AUTO_SKILL;
|
public static boolean ENABLE_AUTO_SKILL;
|
||||||
public static boolean ENABLE_AUTO_ITEM;
|
public static boolean ENABLE_AUTO_ITEM;
|
||||||
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
public static boolean AUTO_PLAY_ATTACK_ACTION;
|
||||||
@@ -2253,6 +2254,7 @@ public class Config
|
|||||||
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = generalConfig.getBoolean("AllowReportsFromSameClanMembers", false);
|
||||||
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
ENABLE_AUTO_PLAY = generalConfig.getBoolean("EnableAutoPlay", true);
|
||||||
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
ENABLE_AUTO_POTION = generalConfig.getBoolean("EnableAutoPotion", true);
|
||||||
|
ENABLE_AUTO_PET_POTION = generalConfig.getBoolean("EnableAutoPetPotion", true);
|
||||||
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
ENABLE_AUTO_SKILL = generalConfig.getBoolean("EnableAutoSkill", true);
|
||||||
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
ENABLE_AUTO_ITEM = generalConfig.getBoolean("EnableAutoItem", true);
|
||||||
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
AUTO_PLAY_ATTACK_ACTION = generalConfig.getBoolean("AutoPlayAttackAction", true);
|
||||||
|
|||||||
+4
-2
@@ -10887,7 +10887,7 @@ public class Player extends Playable
|
|||||||
// Stop auto play.
|
// Stop auto play.
|
||||||
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
AutoPlayTaskManager.getInstance().stopAutoPlay(this);
|
||||||
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
AutoUseTaskManager.getInstance().stopAutoUseTask(this);
|
||||||
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting()));
|
sendPacket(new ExAutoPlaySettingSend(_autoPlaySettings.getOptions(), false, _autoPlaySettings.doPickup(), _autoPlaySettings.getNextTargetMode(), _autoPlaySettings.isShortRange(), _autoPlaySettings.getAutoPotionPercent(), _autoPlaySettings.isRespectfulHunting(), _autoPlaySettings.getAutoPetPotionPercent()));
|
||||||
restoreAutoShortcutVisual();
|
restoreAutoShortcutVisual();
|
||||||
|
|
||||||
// Send info to nearby players.
|
// Send info to nearby players.
|
||||||
@@ -14977,6 +14977,7 @@ public class Player extends Playable
|
|||||||
final boolean shortRange = settings.get(4) == 1;
|
final boolean shortRange = settings.get(4) == 1;
|
||||||
final int potionPercent = settings.get(5);
|
final int potionPercent = settings.get(5);
|
||||||
final boolean respectfulHunting = settings.get(6) == 1;
|
final boolean respectfulHunting = settings.get(6) == 1;
|
||||||
|
final int petPotionPercent = settings.size() < 8 ? 0 : settings.get(7);
|
||||||
|
|
||||||
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
getAutoPlaySettings().setAutoPotionPercent(potionPercent);
|
||||||
getAutoPlaySettings().setOptions(options);
|
getAutoPlaySettings().setOptions(options);
|
||||||
@@ -14984,8 +14985,9 @@ public class Player extends Playable
|
|||||||
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
getAutoPlaySettings().setNextTargetMode(nextTargetMode);
|
||||||
getAutoPlaySettings().setShortRange(shortRange);
|
getAutoPlaySettings().setShortRange(shortRange);
|
||||||
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
getAutoPlaySettings().setRespectfulHunting(respectfulHunting);
|
||||||
|
getAutoPlaySettings().setAutoPetPotionPercent(petPotionPercent);
|
||||||
|
|
||||||
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting));
|
sendPacket(new ExAutoPlaySettingSend(options, active, pickUp, nextTargetMode, shortRange, potionPercent, respectfulHunting, petPotionPercent));
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
|
|||||||
+11
@@ -30,6 +30,7 @@ public class AutoPlaySettingsHolder
|
|||||||
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
private final AtomicBoolean _shortRange = new AtomicBoolean();
|
||||||
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
private final AtomicBoolean _respectfulHunting = new AtomicBoolean();
|
||||||
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
private final AtomicInteger _autoPotionPercent = new AtomicInteger();
|
||||||
|
private final AtomicInteger _autoPetPotionPercent = new AtomicInteger();
|
||||||
|
|
||||||
public AutoPlaySettingsHolder()
|
public AutoPlaySettingsHolder()
|
||||||
{
|
{
|
||||||
@@ -94,4 +95,14 @@ public class AutoPlaySettingsHolder
|
|||||||
{
|
{
|
||||||
_autoPotionPercent.set(value);
|
_autoPotionPercent.set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getAutoPetPotionPercent()
|
||||||
|
{
|
||||||
|
return _autoPetPotionPercent.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoPetPotionPercent(int value)
|
||||||
|
{
|
||||||
|
_autoPetPotionPercent.set(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -28,6 +28,7 @@ public class AutoUseSettingsHolder
|
|||||||
{
|
{
|
||||||
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoSupplyItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
|
private final Collection<Integer> _autoPetPotionItems = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoActions = ConcurrentHashMap.newKeySet();
|
||||||
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
private final Collection<Integer> _autoBuffs = ConcurrentHashMap.newKeySet();
|
||||||
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
private final List<Integer> _autoSkills = new CopyOnWriteArrayList<>();
|
||||||
@@ -47,6 +48,11 @@ public class AutoUseSettingsHolder
|
|||||||
return _autoPotionItems;
|
return _autoPotionItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Integer> getAutoPetPotionItems()
|
||||||
|
{
|
||||||
|
return _autoPetPotionItems;
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<Integer> getAutoActions()
|
public Collection<Integer> getAutoActions()
|
||||||
{
|
{
|
||||||
return _autoActions;
|
return _autoActions;
|
||||||
@@ -99,6 +105,6 @@ public class AutoUseSettingsHolder
|
|||||||
|
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
return _autoSupplyItems.isEmpty() && _autoPotionItems.isEmpty() && _autoPetPotionItems.isEmpty() && _autoSkills.isEmpty() && _autoActions.isEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -39,6 +39,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
private int _nextTargetMode;
|
private int _nextTargetMode;
|
||||||
private boolean _shortRange;
|
private boolean _shortRange;
|
||||||
private int _potionPercent;
|
private int _potionPercent;
|
||||||
|
private int _petPotionPercent;
|
||||||
private boolean _respectfulHunting;
|
private boolean _respectfulHunting;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,7 +51,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
_nextTargetMode = packet.readH();
|
_nextTargetMode = packet.readH();
|
||||||
_shortRange = packet.readC() == 1;
|
_shortRange = packet.readC() == 1;
|
||||||
_potionPercent = packet.readD();
|
_potionPercent = packet.readD();
|
||||||
packet.readD(); // 272
|
_petPotionPercent = packet.readD(); // 272
|
||||||
_respectfulHunting = packet.readC() == 1;
|
_respectfulHunting = packet.readC() == 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -72,7 +73,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting));
|
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _shortRange, _potionPercent, _respectfulHunting, _petPotionPercent));
|
||||||
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
player.getAutoPlaySettings().setAutoPotionPercent(_potionPercent);
|
||||||
|
|
||||||
if (!Config.ENABLE_AUTO_PLAY)
|
if (!Config.ENABLE_AUTO_PLAY)
|
||||||
@@ -80,7 +81,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Integer> settings = new ArrayList<>(7);
|
final List<Integer> settings = new ArrayList<>(8);
|
||||||
settings.add(0, _options);
|
settings.add(0, _options);
|
||||||
settings.add(1, _active ? 1 : 0);
|
settings.add(1, _active ? 1 : 0);
|
||||||
settings.add(2, _pickUp ? 1 : 0);
|
settings.add(2, _pickUp ? 1 : 0);
|
||||||
@@ -88,6 +89,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
settings.add(4, _shortRange ? 1 : 0);
|
settings.add(4, _shortRange ? 1 : 0);
|
||||||
settings.add(5, _potionPercent);
|
settings.add(5, _potionPercent);
|
||||||
settings.add(6, _respectfulHunting ? 1 : 0);
|
settings.add(6, _respectfulHunting ? 1 : 0);
|
||||||
|
settings.add(7, _petPotionPercent);
|
||||||
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
player.getVariables().setIntegerList(PlayerVariables.AUTO_USE_SETTINGS, settings);
|
||||||
|
|
||||||
player.getAutoPlaySettings().setOptions(_options);
|
player.getAutoPlaySettings().setOptions(_options);
|
||||||
@@ -95,6 +97,7 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
|
|||||||
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
player.getAutoPlaySettings().setNextTargetMode(_nextTargetMode);
|
||||||
player.getAutoPlaySettings().setShortRange(_shortRange);
|
player.getAutoPlaySettings().setShortRange(_shortRange);
|
||||||
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
player.getAutoPlaySettings().setRespectfulHunting(_respectfulHunting);
|
||||||
|
player.getAutoPlaySettings().setAutoPetPotionPercent(_petPotionPercent);
|
||||||
|
|
||||||
if (_active)
|
if (_active)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-1
@@ -114,6 +114,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else // auto potion
|
else // auto potion
|
||||||
{
|
{
|
||||||
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
AutoUseTaskManager.getInstance().removeAutoPotionItem(player, item.getId());
|
||||||
|
AutoUseTaskManager.getInstance().removeAutoPetPotionItem(player, item.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
@@ -147,7 +148,9 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// auto potion
|
// auto potion
|
||||||
if ((_page == 23) && (_slot == 1))
|
if (_page == 23)
|
||||||
|
{
|
||||||
|
if (_slot == 1)
|
||||||
{
|
{
|
||||||
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
|
||||||
{
|
{
|
||||||
@@ -155,6 +158,15 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (_slot == 2)
|
||||||
|
{
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && (item != null) && item.isPotion())
|
||||||
|
{
|
||||||
|
AutoUseTaskManager.getInstance().addAutoPetPotionItem(player, item.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// auto skill
|
// auto skill
|
||||||
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
if (Config.ENABLE_AUTO_SKILL && (skill != null))
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-2
@@ -32,8 +32,9 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
private final boolean _shortRange;
|
private final boolean _shortRange;
|
||||||
private final int _potionPercent;
|
private final int _potionPercent;
|
||||||
private final boolean _respectfulHunting;
|
private final boolean _respectfulHunting;
|
||||||
|
private final int _petPotionPercent;
|
||||||
|
|
||||||
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting)
|
public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean shortRange, int potionPercent, boolean respectfulHunting, int petPotionPercent)
|
||||||
{
|
{
|
||||||
_options = options;
|
_options = options;
|
||||||
_active = active;
|
_active = active;
|
||||||
@@ -42,6 +43,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
_shortRange = shortRange;
|
_shortRange = shortRange;
|
||||||
_potionPercent = potionPercent;
|
_potionPercent = potionPercent;
|
||||||
_respectfulHunting = respectfulHunting;
|
_respectfulHunting = respectfulHunting;
|
||||||
|
_petPotionPercent = petPotionPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,7 +56,7 @@ public class ExAutoPlaySettingSend implements IClientOutgoingPacket
|
|||||||
packet.writeH(_nextTargetMode);
|
packet.writeH(_nextTargetMode);
|
||||||
packet.writeC(_shortRange ? 1 : 0);
|
packet.writeC(_shortRange ? 1 : 0);
|
||||||
packet.writeD(_potionPercent);
|
packet.writeD(_potionPercent);
|
||||||
packet.writeD(0); // 272
|
packet.writeD(_petPotionPercent); // 272
|
||||||
packet.writeC(_respectfulHunting ? 1 : 0);
|
packet.writeC(_respectfulHunting ? 1 : 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+41
@@ -35,6 +35,7 @@ import org.l2jmobius.gameserver.model.actor.Playable;
|
|||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
import org.l2jmobius.gameserver.model.actor.instance.Guard;
|
||||||
|
import org.l2jmobius.gameserver.model.actor.instance.Pet;
|
||||||
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
|
||||||
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.AttachSkillHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
import org.l2jmobius.gameserver.model.holders.ItemSkillHolder;
|
||||||
@@ -163,6 +164,34 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Config.ENABLE_AUTO_PET_POTION && !isInPeaceZone)
|
||||||
|
{
|
||||||
|
final Pet pet = player.getPet();
|
||||||
|
if ((pet != null) && (pet.getCurrentHpPercent() <= player.getAutoPlaySettings().getAutoPetPotionPercent()))
|
||||||
|
{
|
||||||
|
POTIONS: for (Integer itemId : player.getAutoUseSettings().getAutoPetPotionItems())
|
||||||
|
{
|
||||||
|
final Item item = player.getInventory().getItemByItemId(itemId.intValue());
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
continue POTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int reuseDelay = item.getReuseDelay();
|
||||||
|
if ((reuseDelay <= 0) || (player.getItemRemainingReuseTime(item.getObjectId()) <= 0))
|
||||||
|
{
|
||||||
|
final EtcItem etcItem = item.getEtcItem();
|
||||||
|
final IItemHandler handler = ItemHandler.getInstance().getHandler(etcItem);
|
||||||
|
if ((handler != null) && handler.useItem(player, item, false) && (reuseDelay > 0))
|
||||||
|
{
|
||||||
|
player.addTimeStampItem(item, reuseDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.ENABLE_AUTO_SKILL)
|
if (Config.ENABLE_AUTO_SKILL)
|
||||||
{
|
{
|
||||||
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
BUFFS: for (Integer skillId : player.getAutoUseSettings().getAutoBuffs())
|
||||||
@@ -465,6 +494,18 @@ public class AutoUseTaskManager implements Runnable
|
|||||||
stopAutoUseTask(player);
|
stopAutoUseTask(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().add(itemId);
|
||||||
|
startAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAutoPetPotionItem(Player player, int itemId)
|
||||||
|
{
|
||||||
|
player.getAutoUseSettings().getAutoPetPotionItems().remove(itemId);
|
||||||
|
stopAutoUseTask(player);
|
||||||
|
}
|
||||||
|
|
||||||
public void addAutoBuff(Player player, int skillId)
|
public void addAutoBuff(Player player, int skillId)
|
||||||
{
|
{
|
||||||
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
player.getAutoUseSettings().getAutoBuffs().add(skillId);
|
||||||
|
|||||||
Reference in New Issue
Block a user