diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 8c0b67a3a9..75164c4ef4 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -278,7 +278,6 @@ import org.l2jmobius.gameserver.network.serverpackets.EtcStatusUpdate; import org.l2jmobius.gameserver.network.serverpackets.ExAbnormalStatusUpdateFromTarget; import org.l2jmobius.gameserver.network.serverpackets.ExAdenaInvenCount; import org.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; -import org.l2jmobius.gameserver.network.serverpackets.ExAutoPlayDoMacro; import org.l2jmobius.gameserver.network.serverpackets.ExAutoSoulShot; import org.l2jmobius.gameserver.network.serverpackets.ExBrPremiumState; import org.l2jmobius.gameserver.network.serverpackets.ExDuelUpdateUserInfo; @@ -336,6 +335,7 @@ import org.l2jmobius.gameserver.network.serverpackets.TradeOtherDone; import org.l2jmobius.gameserver.network.serverpackets.TradeStart; import org.l2jmobius.gameserver.network.serverpackets.UserInfo; import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation; +import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlayDoMacro; import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo; import org.l2jmobius.gameserver.network.serverpackets.friend.FriendStatus; import org.l2jmobius.gameserver.network.serverpackets.monsterbook.ExMonsterBook; diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java index 0cd9d2c13e..530152478e 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -45,6 +45,8 @@ import org.l2jmobius.gameserver.network.clientpackets.attendance.RequestVipAtten import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeCancel; import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeItem; import org.l2jmobius.gameserver.network.clientpackets.attributechange.SendChangeAttributeTargetItem; +import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExAutoPlaySetting; +import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivateAutoShortcut; import org.l2jmobius.gameserver.network.clientpackets.awakening.RequestCallToChangeClass; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCancelCuriousHouse; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCuriousHouseHtml; @@ -476,7 +478,7 @@ public enum ExIncomingPackets implements IIncomingPackets UNK_16E(0x16E, null, ConnectionState.IN_GAME), // 228 UNK_16F(0x16F, null, ConnectionState.IN_GAME), // 228 UNK_170(0x170, null, ConnectionState.IN_GAME), // 228 - EX_REQUEST_AUTO_SUPPLY_SETTING(0x171, null, ConnectionState.IN_GAME), // 228 + EX_ACTIVATE_AUTO_SHORTCUT(0x171, ExRequestActivateAutoShortcut::new, ConnectionState.IN_GAME), // 228 UNK_172(0x172, null, ConnectionState.IN_GAME), // 228 UNK_173(0x173, null, ConnectionState.IN_GAME), // 228 UNK_174(0x174, null, ConnectionState.IN_GAME), // 228 diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/ExAutoPlaySetting.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExAutoPlaySetting.java similarity index 89% rename from L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/ExAutoPlaySetting.java rename to L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExAutoPlaySetting.java index f9f7de18c2..60ab62828e 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/ExAutoPlaySetting.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExAutoPlaySetting.java @@ -14,12 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.l2jmobius.gameserver.network.clientpackets; +package org.l2jmobius.gameserver.network.clientpackets.autoplay; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.serverpackets.ExAutoPlaySettingSend; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend; /** * @author Mobius diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java new file mode 100644 index 0000000000..fbd43fbd71 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java @@ -0,0 +1,85 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.network.clientpackets.autoplay; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.Shortcut; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExActivateAutoShortcut; + +/** + * @author JoeAlisson + */ +public class ExRequestActivateAutoShortcut implements IClientIncomingPacket +{ + private boolean _activate; + private int _room; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _room = packet.readH(); + _activate = packet.readC() == 1; + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + if (!_activate) + { + client.sendPacket(new ExActivateAutoShortcut(_room, _activate)); + return; + } + + if (_room == -1) + { + // TODO: auto supply + client.sendPacket(new ExActivateAutoShortcut(_room, _activate)); + } + else + { + final int slot = _room % 12; + final int page = _room / 12; + final Shortcut shortcut = player.getShortCut(slot, page); + if (shortcut != null) + { + if ((page == 23) && (slot == 1)) + { + // auto potion + final ItemInstance item = player.getInventory().getItemByObjectId(shortcut.getId()); + if ((item == null) || !item.isPotion()) + { + return; + } + } + + // TODO: auto skill + client.sendPacket(new ExActivateAutoShortcut(_room, _activate)); + } + } + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExActivateAutoShortcut.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExActivateAutoShortcut.java new file mode 100644 index 0000000000..9c8fd0bdf4 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExActivateAutoShortcut.java @@ -0,0 +1,45 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.network.serverpackets.autoplay; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author JoeAlisson + */ +public class ExActivateAutoShortcut implements IClientOutgoingPacket +{ + private final int _room; + private final boolean _activate; + + public ExActivateAutoShortcut(int room, boolean activate) + { + _room = room; + _activate = activate; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ACTIVATE_AUTO_SHORTCUT.writeId(packet); + packet.writeH(_room); + packet.writeC(_activate ? 0x01 : 0x00); + return true; + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlayDoMacro.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlayDoMacro.java similarity index 89% rename from L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlayDoMacro.java rename to L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlayDoMacro.java index 2f9245e936..bf546aeca2 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlayDoMacro.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlayDoMacro.java @@ -14,10 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.l2jmobius.gameserver.network.serverpackets; +package org.l2jmobius.gameserver.network.serverpackets.autoplay; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; /** * @author Mobius diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlaySettingSend.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlaySettingSend.java similarity index 93% rename from L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlaySettingSend.java rename to L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlaySettingSend.java index 0ede045993..b30b6593a1 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlaySettingSend.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlaySettingSend.java @@ -14,10 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.l2jmobius.gameserver.network.serverpackets; +package org.l2jmobius.gameserver.network.serverpackets.autoplay; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; /** * @author JoeAlisson diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml index 149e97498e..2db51fca62 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml @@ -175,11 +175,18 @@ + + + + + + + diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/50100-50199.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/50100-50199.xml index 3f076da1ad..8ee0e84065 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/50100-50199.xml +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/50100-50199.xml @@ -338,7 +338,17 @@ 60000 + 2 + 1 A1 + SELF + SINGLE + + + 50 + DIFF + + A1 diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index b6741ff010..6deec55984 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -278,7 +278,6 @@ import org.l2jmobius.gameserver.network.serverpackets.ConfirmDlg; import org.l2jmobius.gameserver.network.serverpackets.EtcStatusUpdate; import org.l2jmobius.gameserver.network.serverpackets.ExAbnormalStatusUpdateFromTarget; import org.l2jmobius.gameserver.network.serverpackets.ExAdenaInvenCount; -import org.l2jmobius.gameserver.network.serverpackets.ExAutoPlayDoMacro; import org.l2jmobius.gameserver.network.serverpackets.ExAutoSoulShot; import org.l2jmobius.gameserver.network.serverpackets.ExBrPremiumState; import org.l2jmobius.gameserver.network.serverpackets.ExDuelUpdateUserInfo; @@ -336,6 +335,7 @@ import org.l2jmobius.gameserver.network.serverpackets.TradeOtherDone; import org.l2jmobius.gameserver.network.serverpackets.TradeStart; import org.l2jmobius.gameserver.network.serverpackets.UserInfo; import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation; +import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlayDoMacro; import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo; import org.l2jmobius.gameserver.network.serverpackets.friend.FriendStatus; import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java index 0f9aec89d0..4e9b46bc25 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -37,6 +37,8 @@ import org.l2jmobius.gameserver.network.clientpackets.attendance.RequestVipAtten import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeCancel; import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestChangeAttributeItem; import org.l2jmobius.gameserver.network.clientpackets.attributechange.SendChangeAttributeTargetItem; +import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExAutoPlaySetting; +import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivateAutoShortcut; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCancelCuriousHouse; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCuriousHouseHtml; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestJoinCuriousHouse; @@ -467,7 +469,7 @@ public enum ExIncomingPackets implements IIncomingPackets UNK_16E(0x16E, null, ConnectionState.IN_GAME), // 228 UNK_16F(0x16F, null, ConnectionState.IN_GAME), // 228 UNK_170(0x170, null, ConnectionState.IN_GAME), // 228 - EX_REQUEST_AUTO_SUPPLY_SETTING(0x171, null, ConnectionState.IN_GAME), // 228 + EX_ACTIVATE_AUTO_SHORTCUT(0x171, ExRequestActivateAutoShortcut::new, ConnectionState.IN_GAME), // 228 UNK_172(0x172, null, ConnectionState.IN_GAME), // 228 UNK_173(0x173, null, ConnectionState.IN_GAME), // 228 UNK_174(0x174, null, ConnectionState.IN_GAME), // 228 diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/ExAutoPlaySetting.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExAutoPlaySetting.java similarity index 86% rename from L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/ExAutoPlaySetting.java rename to L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExAutoPlaySetting.java index f9f7de18c2..2792b838e0 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/ExAutoPlaySetting.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExAutoPlaySetting.java @@ -1,70 +1,71 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.clientpackets; - -import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.network.GameClient; -import org.l2jmobius.gameserver.network.serverpackets.ExAutoPlaySettingSend; - -/** - * @author Mobius - */ -public class ExAutoPlaySetting implements IClientIncomingPacket -{ - private int _options; - private boolean _active; - private boolean _pickUp; - private int _nextTargetMode; - private boolean _longRange; - private int _potionPercent; - private boolean _respectfulHunting; - - @Override - public boolean read(GameClient client, PacketReader packet) - { - _options = packet.readH(); - _active = packet.readC() == 1; - _pickUp = packet.readC() == 1; - _nextTargetMode = packet.readH(); - _longRange = packet.readC() == 0; - _potionPercent = packet.readD(); - _respectfulHunting = packet.readC() == 1; - return true; - } - - @Override - public void run(GameClient client) - { - final PlayerInstance player = client.getPlayer(); - if (player == null) - { - return; - } - - player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting)); - - if (_active) - { - player.startAutoPlayTask(_pickUp, _longRange, _respectfulHunting); - } - else - { - player.stopAutoPlayTask(); - } - } -} +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.network.clientpackets.autoplay; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlaySettingSend; + +/** + * @author Mobius + */ +public class ExAutoPlaySetting implements IClientIncomingPacket +{ + private int _options; + private boolean _active; + private boolean _pickUp; + private int _nextTargetMode; + private boolean _longRange; + private int _potionPercent; + private boolean _respectfulHunting; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _options = packet.readH(); + _active = packet.readC() == 1; + _pickUp = packet.readC() == 1; + _nextTargetMode = packet.readH(); + _longRange = packet.readC() == 0; + _potionPercent = packet.readD(); + _respectfulHunting = packet.readC() == 1; + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting)); + + if (_active) + { + player.startAutoPlayTask(_pickUp, _longRange, _respectfulHunting); + } + else + { + player.stopAutoPlayTask(); + } + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java new file mode 100644 index 0000000000..fbd43fbd71 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java @@ -0,0 +1,85 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.network.clientpackets.autoplay; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.Shortcut; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExActivateAutoShortcut; + +/** + * @author JoeAlisson + */ +public class ExRequestActivateAutoShortcut implements IClientIncomingPacket +{ + private boolean _activate; + private int _room; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _room = packet.readH(); + _activate = packet.readC() == 1; + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + if (!_activate) + { + client.sendPacket(new ExActivateAutoShortcut(_room, _activate)); + return; + } + + if (_room == -1) + { + // TODO: auto supply + client.sendPacket(new ExActivateAutoShortcut(_room, _activate)); + } + else + { + final int slot = _room % 12; + final int page = _room / 12; + final Shortcut shortcut = player.getShortCut(slot, page); + if (shortcut != null) + { + if ((page == 23) && (slot == 1)) + { + // auto potion + final ItemInstance item = player.getInventory().getItemByObjectId(shortcut.getId()); + if ((item == null) || !item.isPotion()) + { + return; + } + } + + // TODO: auto skill + client.sendPacket(new ExActivateAutoShortcut(_room, _activate)); + } + } + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExActivateAutoShortcut.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExActivateAutoShortcut.java new file mode 100644 index 0000000000..9c8fd0bdf4 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExActivateAutoShortcut.java @@ -0,0 +1,45 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.network.serverpackets.autoplay; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author JoeAlisson + */ +public class ExActivateAutoShortcut implements IClientOutgoingPacket +{ + private final int _room; + private final boolean _activate; + + public ExActivateAutoShortcut(int room, boolean activate) + { + _room = room; + _activate = activate; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_ACTIVATE_AUTO_SHORTCUT.writeId(packet); + packet.writeH(_room); + packet.writeC(_activate ? 0x01 : 0x00); + return true; + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlayDoMacro.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlayDoMacro.java similarity index 86% rename from L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlayDoMacro.java rename to L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlayDoMacro.java index 2f9245e936..fb4738cd0f 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlayDoMacro.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlayDoMacro.java @@ -1,40 +1,41 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.serverpackets; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.network.OutgoingPackets; - -/** - * @author Mobius - */ -public class ExAutoPlayDoMacro implements IClientOutgoingPacket -{ - public static final ExAutoPlayDoMacro STATIC_PACKET = new ExAutoPlayDoMacro(); - - public ExAutoPlayDoMacro() - { - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_AUTOPLAY_DO_MACRO.writeId(packet); - packet.writeD(0x114); - return true; - } -} +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.network.serverpackets.autoplay; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExAutoPlayDoMacro implements IClientOutgoingPacket +{ + public static final ExAutoPlayDoMacro STATIC_PACKET = new ExAutoPlayDoMacro(); + + public ExAutoPlayDoMacro() + { + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_AUTOPLAY_DO_MACRO.writeId(packet); + packet.writeD(0x114); + return true; + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlaySettingSend.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlaySettingSend.java similarity index 90% rename from L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlaySettingSend.java rename to L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlaySettingSend.java index 0ede045993..d09d0c5b60 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExAutoPlaySettingSend.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/autoplay/ExAutoPlaySettingSend.java @@ -1,59 +1,60 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.serverpackets; - -import org.l2jmobius.commons.network.PacketWriter; -import org.l2jmobius.gameserver.network.OutgoingPackets; - -/** - * @author JoeAlisson - */ -public class ExAutoPlaySettingSend implements IClientOutgoingPacket -{ - private final int _options; - private final boolean _active; - private final boolean _pickUp; - private final int _nextTargetMode; - private final boolean _longRange; - private final int _potionPercent; - private final boolean _respectfulHunting; - - public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean longRange, int potionPercent, boolean respectfulHunting) - { - _options = options; - _active = active; - _pickUp = pickUp; - _nextTargetMode = nextTargetMode; - _longRange = longRange; - _potionPercent = potionPercent; - _respectfulHunting = respectfulHunting; - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_AUTOPLAY_SETTING.writeId(packet); - packet.writeH(_options); - packet.writeC(_active ? 1 : 0); - packet.writeC(_pickUp ? 1 : 0); - packet.writeH(_nextTargetMode); - packet.writeC(_longRange ? 1 : 0); - packet.writeD(_potionPercent); - packet.writeC(_respectfulHunting ? 1 : 0); - return true; - } -} +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.network.serverpackets.autoplay; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author JoeAlisson + */ +public class ExAutoPlaySettingSend implements IClientOutgoingPacket +{ + private final int _options; + private final boolean _active; + private final boolean _pickUp; + private final int _nextTargetMode; + private final boolean _longRange; + private final int _potionPercent; + private final boolean _respectfulHunting; + + public ExAutoPlaySettingSend(int options, boolean active, boolean pickUp, int nextTargetMode, boolean longRange, int potionPercent, boolean respectfulHunting) + { + _options = options; + _active = active; + _pickUp = pickUp; + _nextTargetMode = nextTargetMode; + _longRange = longRange; + _potionPercent = potionPercent; + _respectfulHunting = respectfulHunting; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_AUTOPLAY_SETTING.writeId(packet); + packet.writeH(_options); + packet.writeC(_active ? 1 : 0); + packet.writeC(_pickUp ? 1 : 0); + packet.writeH(_nextTargetMode); + packet.writeC(_longRange ? 1 : 0); + packet.writeD(_potionPercent); + packet.writeC(_respectfulHunting ? 1 : 0); + return true; + } +}