Addition of ExRequestActivateAutoShortcut packet.

Author: JoeAlisson
Source: 0b2fe08347
This commit is contained in:
MobiusDevelopment 2019-11-01 13:24:56 +00:00
parent 921b24bdb4
commit 01a75d72a5
16 changed files with 464 additions and 177 deletions

View File

@ -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;

View File

@ -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<GameClient>
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

View File

@ -14,12 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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));
}
}
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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

View File

@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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

View File

@ -175,11 +175,18 @@
<!-- Instantly recovers 50 HP. The remaining points are used to recover CP. -->
<set name="icon" val="icon.etc_lesser_potion_red_i00" />
<set name="default_action" val="SKILL_REDUCE" />
<set name="immediate_effect" val="true"/>
<set name="etcitem_type" val="POTION"/>
<set name="commissionItemType" val="POTION"/>
<set name="handler" val="ItemSkills"/>
<set name="material" val="STEEL" />
<set name="weight" val="1" />
<set name="price" val="30" />
<set name="is_sellable" val="false" />
<set name="is_stackable" val="true" />
<skills>
<skill id="50151" level="1"/> <!-- HP Potion -->
</skills>
</item>
<item id="91913" name="Aden Spellbook Chest" type="EtcItem">
<!-- Double-click to obtain a spellbook for learning skills (for all races, except Orcs). <Spellbook List>. Spellbook: Empower, Spellbook: Focus, Spellbook: Wild Magic, Spellbook: Haste, Spellbook: Acumen, Spellbook: Death Whisper, Spellbook: Clarity, Spellbook: Berserker Spirit. -->

View File

@ -338,7 +338,17 @@
<reuseDelay>60000</reuseDelay>
</skill>
<skill id="50151" toLevel="1" name="HP Potion">
<isMagic>2</isMagic> <!-- Static Skill -->
<magicLvl>1</magicLvl>
<operateType>A1</operateType>
<targetType>SELF</targetType>
<affectScope>SINGLE</affectScope>
<effects>
<effect name="HpCpHeal">
<amount>50</amount>
<mode>DIFF</mode>
</effect>
</effects>
</skill>
<skill id="50152" toLevel="1" name="Scroll of Escape: Effective Training">
<operateType>A1</operateType>

View File

@ -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;

View File

@ -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<GameClient>
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

View File

@ -14,12 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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));
}
}
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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

View File

@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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