Addition of new packet opcodes.

Contributed by Index.
This commit is contained in:
MobiusDevelopment
2022-10-24 21:21:50 +00:00
parent 24d974bc84
commit 11955ae57f
6 changed files with 188 additions and 5 deletions

View File

@@ -777,7 +777,15 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_VARIATION_CLOSE_UI(0x246, ExVariationCloseUi::new, ConnectionState.IN_GAME),
EX_APPLY_VARIATION_OPTION(0x247, ExApplyVariationOption::new, ConnectionState.IN_GAME),
EX_BR_VERSION(0x248, null, ConnectionState.IN_GAME),
EX_MAX(0x249, null, ConnectionState.IN_GAME);
EX_WRANKING_FESTIVAL_INFO(0x249, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_OPEN(0x24A, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_BUY(0x24B, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_BONUS(0x24C, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_RANKING(0x24D, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_MY_RECEIVED_BONUS(0x24E, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_REWARD(0x24F, null, ConnectionState.IN_GAME),
EX_HENNA_UNEQUIP_INFO(0x250, RequestNewHennaUnequipInfo::new, ConnectionState.IN_GAME),
EX_MAX(0x251, null, ConnectionState.IN_GAME);
public static final ExIncomingPackets[] PACKET_ARRAY;

View File

@@ -1066,7 +1066,17 @@ public enum OutgoingPackets
EX_TIME_RESTRICT_FIELD_DIE_LIMT_TIME(0xFE, 0x306),
EX_APPLY_VARIATION_OPTION(0xFE, 0x307),
EX_BR_VERSION(0xFE, 0x308),
EX_MAX(0xFE, 0x309);
EX_NOTIFY_ATTENDANCE(0xFE, 0x309),
EX_WRANKING_FESTIVAL_INFO(0xFE, 0x30A),
EX_WRANKING_FESTIVAL_SIDEBAR_INFO(0xFE, 0x30B),
EX_WRANKING_FESTIVAL_BUY(0xFE, 0x30C),
EX_WRANKING_FESTIVAL_BONUS(0xFE, 0x30D),
EX_WRANKING_FESTIVAL_RANKING(0xFE, 0x30E),
EX_WRANKING_FESTIVAL_MYINFO(0xFE, 0x30F),
EX_WRANKING_FESTIVAL_MY_RECEIVED_BONUS(0xFE, 0x310),
EX_WRANKING_FESTIVAL_REWARD(0xFE, 0x311),
EX_TOOLTIP_PARAM(0xFE, 0x312),
EX_MAX(0xFE, 0x313);
private final int _id1;
private final int _id2;

View File

@@ -0,0 +1,61 @@
/*
* 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;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.HennaData;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.item.Henna;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.PacketLogger;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.HennaItemRemoveInfo;
/**
* @author Index
*/
public class RequestNewHennaUnequipInfo implements IClientIncomingPacket
{
private int _hennaId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_hennaId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if ((player == null) || (_hennaId == 0))
{
return;
}
final Henna henna = HennaData.getInstance().getHenna(_hennaId);
if (henna == null)
{
PacketLogger.warning("Invalid Henna Id: " + _hennaId + " from " + player);
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
player.sendPacket(new HennaItemRemoveInfo(henna, player));
}
}

View File

@@ -129,6 +129,7 @@ import org.l2jmobius.gameserver.network.clientpackets.newhenna.RequestNewHennaLi
import org.l2jmobius.gameserver.network.clientpackets.newhenna.RequestNewHennaPotenEnchant;
import org.l2jmobius.gameserver.network.clientpackets.newhenna.RequestNewHennaPotenSelect;
import org.l2jmobius.gameserver.network.clientpackets.newhenna.RequestNewHennaUnequip;
import org.l2jmobius.gameserver.network.clientpackets.newhenna.RequestNewHennaUnequipInfo;
import org.l2jmobius.gameserver.network.clientpackets.pet.ExEvolvePet;
import org.l2jmobius.gameserver.network.clientpackets.pet.ExPetEquipItem;
import org.l2jmobius.gameserver.network.clientpackets.pet.ExPetUnequipItem;
@@ -809,7 +810,15 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
EX_VARIATION_CLOSE_UI(0x246, ExVariationCloseUi::new, ConnectionState.IN_GAME),
EX_APPLY_VARIATION_OPTION(0x247, ExApplyVariationOption::new, ConnectionState.IN_GAME),
EX_BR_VERSION(0x248, RequestBRVersion::new, ConnectionState.AUTHENTICATED, ConnectionState.CONNECTED),
EX_MAX(0x249, null, ConnectionState.IN_GAME);
EX_WRANKING_FESTIVAL_INFO(0x249, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_OPEN(0x24A, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_BUY(0x24B, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_BONUS(0x24C, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_RANKING(0x24D, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_MY_RECEIVED_BONUS(0x24E, null, ConnectionState.IN_GAME),
EX_WRANKING_FESTIVAL_REWARD(0x24F, null, ConnectionState.IN_GAME),
EX_HENNA_UNEQUIP_INFO(0x250, RequestNewHennaUnequipInfo::new, ConnectionState.IN_GAME),
EX_MAX(0x251, null, ConnectionState.IN_GAME);
public static final ExIncomingPackets[] PACKET_ARRAY;

View File

@@ -888,7 +888,7 @@ public enum OutgoingPackets
EX_HOMUNCULUS_INSERT_RESULT(0xFE, 0x258),
EX_HOMUNCULUS_SUMMON_RESULT(0xFE, 0x259),
EX_SHOW_HOMUNCULUS_LIST(0xFE, 0x25A),
EX_DELETE_HOMUNCLUS_DATA_RESULT(0xFE, 0x25B),
EX_DELETE_HOMUNCULUS_DATA_RESULT(0xFE, 0x25B),
EX_ACTIVATE_HOMUNCULUS_RESULT(0xFE, 0x25C),
EX_HOMUNCULUS_GET_ENCHANT_POINT_RESULT(0xFE, 0x25D),
EX_HOMUNCULUS_INIT_POINT_RESULT(0xFE, 0x25E),
@@ -1066,7 +1066,17 @@ public enum OutgoingPackets
EX_TIME_RESTRICT_FIELD_DIE_LIMT_TIME(0xFE, 0x306),
EX_APPLY_VARIATION_OPTION(0xFE, 0x307),
EX_BR_VERSION(0xFE, 0x308),
EX_MAX(0xFE, 0x309);
EX_NOTIFY_ATTENDANCE(0xFE, 0x309),
EX_WRANKING_FESTIVAL_INFO(0xFE, 0x30A),
EX_WRANKING_FESTIVAL_SIDEBAR_INFO(0xFE, 0x30B),
EX_WRANKING_FESTIVAL_BUY(0xFE, 0x30C),
EX_WRANKING_FESTIVAL_BONUS(0xFE, 0x30D),
EX_WRANKING_FESTIVAL_RANKING(0xFE, 0x30E),
EX_WRANKING_FESTIVAL_MYINFO(0xFE, 0x30F),
EX_WRANKING_FESTIVAL_MY_RECEIVED_BONUS(0xFE, 0x310),
EX_WRANKING_FESTIVAL_REWARD(0xFE, 0x311),
EX_TOOLTIP_PARAM(0xFE, 0x312),
EX_MAX(0xFE, 0x313);
private final int _id1;
private final int _id2;

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.newhenna;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.item.henna.Henna;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.newhenna.NewHennaUnequip;
/**
* @author Index
*/
public class RequestNewHennaUnequipInfo implements IClientIncomingPacket
{
private int _hennaId;
@Override
public boolean read(GameClient client, PacketReader packet)
{
_hennaId = packet.readD();
return true;
}
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
Henna henna = null;
int slotId = 0;
for (int slot = 1; slot <= 4; slot++)
{
if (player.getHenna(slot) == null)
{
continue;
}
if (player.getHenna(slot).getDyeId() == _hennaId)
{
henna = player.getHenna(slot);
slotId = slot;
break;
}
}
if ((henna == null) || !client.getFloodProtectors().canPerformTransaction())
{
player.sendPacket(ActionFailed.STATIC_PACKET);
player.sendPacket(new NewHennaUnequip(slotId, 0));
return;
}
if (player.getAdena() >= henna.getCancelFee())
{
player.removeHenna(slotId);
player.sendPacket(new NewHennaUnequip(slotId, 1));
}
else
{
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
player.sendPacket(ActionFailed.STATIC_PACKET);
player.sendPacket(new NewHennaUnequip(slotId, 0));
}
}
}