From f1c3c74f0332a50869027a9c5d9c16c9fad83f51 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 22 Apr 2017 15:48:48 +0000 Subject: [PATCH] Faction packets. Contributed by Mathael. --- .../gameserver/network/ExIncomingPackets.java | 3 +- .../faction/RequestUserFactionInfo.java | 47 ++++++++++++++++ .../serverpackets/faction/ExFactionInfo.java | 56 +++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/clientpackets/faction/RequestUserFactionInfo.java create mode 100644 L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/serverpackets/faction/ExFactionInfo.java diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java index 76d050ac5c..5f71b629d9 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -64,6 +64,7 @@ import com.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrys import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive; import com.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList; import com.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul; +import com.l2jmobius.gameserver.network.clientpackets.faction.RequestUserFactionInfo; import com.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo; import com.l2jmobius.gameserver.network.clientpackets.mentoring.ConfirmMenteeAdd; import com.l2jmobius.gameserver.network.clientpackets.mentoring.RequestMenteeAdd; @@ -359,7 +360,7 @@ public enum ExIncomingPackets implements IIncomingPackets EX_CHANGE_CLASS_ARENA(0x115, null, ConnectionState.IN_GAME), EX_CONFIRM_CLASS_ARENA(0x116, null, ConnectionState.IN_GAME), // TODO: Check Helios updates - REQUEST_USER_FACTION_INFO(0x119, null, ConnectionState.IN_GAME), + REQUEST_USER_FACTION_INFO(0x119, RequestUserFactionInfo::new, ConnectionState.IN_GAME), EX_EXIT_ARENA(0x11A, null, ConnectionState.IN_GAME), REQUEST_EVENT_BALTHUS_TOKEN(0x11B, null, ConnectionState.IN_GAME), REQUEST_PARTY_MATCHING_HISTORY(0x11C, null, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/clientpackets/faction/RequestUserFactionInfo.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/clientpackets/faction/RequestUserFactionInfo.java new file mode 100644 index 0000000000..8380e26124 --- /dev/null +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/clientpackets/faction/RequestUserFactionInfo.java @@ -0,0 +1,47 @@ +/* + * 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 com.l2jmobius.gameserver.network.clientpackets.faction; + +import com.l2jmobius.commons.network.PacketReader; +import com.l2jmobius.gameserver.network.L2GameClient; +import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import com.l2jmobius.gameserver.network.serverpackets.faction.ExFactionInfo; + +/** + * @author Mathael + */ +public class RequestUserFactionInfo implements IClientIncomingPacket +{ + + private int _playerId; + private boolean _openDialog; + + @Override + public boolean read(L2GameClient client, PacketReader packet) + { + _playerId = packet.readD(); + _openDialog = packet.readC() != 0; + + return true; + } + + @Override + public void run(L2GameClient client) + { + client.getActiveChar().sendPacket(new ExFactionInfo(_playerId, _openDialog)); + } +} \ No newline at end of file diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/serverpackets/faction/ExFactionInfo.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/serverpackets/faction/ExFactionInfo.java new file mode 100644 index 0000000000..fcf3d96407 --- /dev/null +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/serverpackets/faction/ExFactionInfo.java @@ -0,0 +1,56 @@ +/* + * 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 com.l2jmobius.gameserver.network.serverpackets.faction; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mathael + */ +public class ExFactionInfo implements IClientOutgoingPacket +{ + + private final int _playerId; + private final boolean _openDialog; + + public ExFactionInfo(int playerId, boolean openDialog) + { + _playerId = playerId; + _openDialog = openDialog; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_FACTION_INFO.writeId(packet); + + packet.writeD(_playerId); + packet.writeC(_openDialog ? 1 : 0); + packet.writeD(6); + + for (int i = 0; i < 6; i++) + { + packet.writeC(i); + packet.writeH(0); + packet.writeE(0); + } + + return true; + } +}