Fixed auto consume items.

This commit is contained in:
MobiusDevelopment
2020-01-02 01:36:23 +00:00
parent 2afcbf6bd6
commit 235203c5f8
4 changed files with 26 additions and 18 deletions

View File

@@ -25,15 +25,16 @@ import org.l2jmobius.gameserver.network.GameClient;
*/ */
public class RequestShortCutDel implements IClientIncomingPacket public class RequestShortCutDel implements IClientIncomingPacket
{ {
private int _id;
private int _slot; private int _slot;
private int _page; private int _page;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
final int id = packet.readD(); _id = packet.readD();
_slot = id % 12; _slot = _id % 12;
_page = id / 12; _page = _id / 12;
return true; return true;
} }
@@ -52,6 +53,10 @@ public class RequestShortCutDel implements IClientIncomingPacket
} }
player.deleteShortCut(_slot, _page); player.deleteShortCut(_slot, _page);
// client needs no confirmation. this packet is just to inform the server
// Remove auto used ids.
player.removeAutoSupplyItem(_id);
player.removeAutoPotionItem(_id);
player.removeAutoSkill(_id);
} }
} }

View File

@@ -72,7 +72,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
if (item != null) if (item != null)
{ {
// auto supply // auto supply
if (_room == -1) if (_room > 263)
{ {
player.removeAutoSupplyItem(item.getId()); player.removeAutoSupplyItem(item.getId());
} }
@@ -81,7 +81,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
player.removeAutoPotionItem(item.getId()); player.removeAutoPotionItem(item.getId());
} }
} }
// TODO: auto skill // auto skill
if (skill != null) if (skill != null)
{ {
player.removeAutoSkill(skill.getId()); player.removeAutoSkill(skill.getId());
@@ -90,13 +90,12 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
} }
// start // start
if (_room == -1) if (_room > 263)
{ {
// auto supply // auto supply
if (item != null) if (item != null)
{ {
player.addAutoSupplyItem(item.getId()); player.addAutoSupplyItem(item.getId());
return;
} }
} }
else else
@@ -110,7 +109,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
return; return;
} }
} }
// TODO: auto skill // auto skill
if (skill != null) if (skill != null)
{ {
player.addAutoSkill(skill.getId()); player.addAutoSkill(skill.getId());

View File

@@ -25,15 +25,16 @@ import org.l2jmobius.gameserver.network.GameClient;
*/ */
public class RequestShortCutDel implements IClientIncomingPacket public class RequestShortCutDel implements IClientIncomingPacket
{ {
private int _id;
private int _slot; private int _slot;
private int _page; private int _page;
@Override @Override
public boolean read(GameClient client, PacketReader packet) public boolean read(GameClient client, PacketReader packet)
{ {
final int id = packet.readD(); _id = packet.readD();
_slot = id % 12; _slot = _id % 12;
_page = id / 12; _page = _id / 12;
return true; return true;
} }
@@ -52,6 +53,10 @@ public class RequestShortCutDel implements IClientIncomingPacket
} }
player.deleteShortCut(_slot, _page); player.deleteShortCut(_slot, _page);
// client needs no confirmation. this packet is just to inform the server
// Remove auto used ids.
player.removeAutoSupplyItem(_id);
player.removeAutoPotionItem(_id);
player.removeAutoSkill(_id);
} }
} }

View File

@@ -72,7 +72,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
if (item != null) if (item != null)
{ {
// auto supply // auto supply
if (_room == -1) if (_room > 263)
{ {
player.removeAutoSupplyItem(item.getId()); player.removeAutoSupplyItem(item.getId());
} }
@@ -81,7 +81,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
player.removeAutoPotionItem(item.getId()); player.removeAutoPotionItem(item.getId());
} }
} }
// TODO: auto skill // auto skill
if (skill != null) if (skill != null)
{ {
player.removeAutoSkill(skill.getId()); player.removeAutoSkill(skill.getId());
@@ -90,13 +90,12 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
} }
// start // start
if (_room == -1) if (_room > 263)
{ {
// auto supply // auto supply
if (item != null) if (item != null)
{ {
player.addAutoSupplyItem(item.getId()); player.addAutoSupplyItem(item.getId());
return;
} }
} }
else else
@@ -110,7 +109,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
return; return;
} }
} }
// TODO: auto skill // auto skill
if (skill != null) if (skill != null)
{ {
player.addAutoSkill(skill.getId()); player.addAutoSkill(skill.getId());