From 4812c878dc03a3297c0027c507f45e29acb5b415 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 3 Nov 2017 10:58:41 +0000 Subject: [PATCH] Addition of RequestPledgeSignInForOpenJoiningMethod. --- .../gameserver/data/sql/impl/ClanTable.java | 4 ++ .../gameserver/network/ExIncomingPackets.java | 2 +- ...questPledgeSignInForOpenJoiningMethod.java | 61 +++++++++++++++++++ .../gameserver/data/sql/impl/ClanTable.java | 4 ++ .../gameserver/network/ExIncomingPackets.java | 2 +- ...questPledgeSignInForOpenJoiningMethod.java | 61 +++++++++++++++++++ 6 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java create mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index 93625c6b3c..699808b0fe 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -35,6 +35,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.idfactory.IdFactory; +import com.l2jmobius.gameserver.instancemanager.ClanEntryManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.FortSiegeManager; import com.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -217,6 +218,9 @@ public class ClanTable } clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.CLAN_HAS_DISPERSED)); + + ClanEntryManager.getInstance().removeFromClanList(clan.getId()); + final int castleId = clan.getCastleId(); if (castleId == 0) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java index 1a5b96e4c2..d52932e6d9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -356,7 +356,7 @@ public enum ExIncomingPackets implements IIncomingPackets EX_REQUEST_VIP_INFO(0x10E, null, ConnectionState.IN_GAME), REQUEST_CAPTCHA_ANSWER(0x10F, null, ConnectionState.IN_GAME), REQUEST_REFRESH_CAPTCHA_IMAGE(0x110, null, ConnectionState.IN_GAME), - REQUEST_PLEDGE_SIGN_IN_FOR_OPEN_JOINING_METHOD(0x111, null, ConnectionState.IN_GAME), + REQUEST_PLEDGE_SIGN_IN_FOR_OPEN_JOINING_METHOD(0x111, RequestPledgeSignInForOpenJoiningMethod::new, ConnectionState.IN_GAME), EX_REQUEST_MATCH_ARENA(0x112, null, ConnectionState.IN_GAME), EX_CONFIRM_MATCH_ARENA(0x113, null, ConnectionState.IN_GAME), EX_CANCEL_MATCH_ARENA(0x114, null, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java new file mode 100644 index 0000000000..cdcb77ff20 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java @@ -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 . + */ +package com.l2jmobius.gameserver.network.clientpackets; + +import com.l2jmobius.commons.network.PacketReader; +import com.l2jmobius.gameserver.instancemanager.ClanEntryManager; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.clan.entry.PledgeRecruitInfo; +import com.l2jmobius.gameserver.network.L2GameClient; +import com.l2jmobius.gameserver.network.serverpackets.JoinPledge; +import com.l2jmobius.gameserver.network.serverpackets.UserInfo; + +/** + * @author Mobius + */ +public class RequestPledgeSignInForOpenJoiningMethod implements IClientIncomingPacket +{ + private int _clanId; + + @Override + public boolean read(L2GameClient client, PacketReader packet) + { + _clanId = packet.readD(); + packet.readD(); + return true; + } + + @Override + public void run(L2GameClient client) + { + final L2PcInstance activeChar = client.getActiveChar(); + if (activeChar == null) + { + return; + } + + final PledgeRecruitInfo pledgeRecruitInfo = ClanEntryManager.getInstance().getClanById(_clanId); + if (pledgeRecruitInfo.getRecruitType() == 1) + { + pledgeRecruitInfo.getClan().addClanMember(activeChar); + activeChar.sendPacket(new JoinPledge(_clanId)); + activeChar.sendPacket(new UserInfo(activeChar)); + activeChar.broadcastInfo(); + return; + } + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index 93625c6b3c..699808b0fe 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -35,6 +35,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jmobius.gameserver.data.xml.impl.ClanHallData; import com.l2jmobius.gameserver.enums.UserInfoType; import com.l2jmobius.gameserver.idfactory.IdFactory; +import com.l2jmobius.gameserver.instancemanager.ClanEntryManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.FortSiegeManager; import com.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -217,6 +218,9 @@ public class ClanTable } clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.CLAN_HAS_DISPERSED)); + + ClanEntryManager.getInstance().removeFromClanList(clan.getId()); + final int castleId = clan.getCastleId(); if (castleId == 0) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java index 1fbd3fb74d..54f6de56d3 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -356,7 +356,7 @@ public enum ExIncomingPackets implements IIncomingPackets EX_REQUEST_VIP_INFO(0x10E, null, ConnectionState.IN_GAME), REQUEST_CAPTCHA_ANSWER(0x10F, null, ConnectionState.IN_GAME), REQUEST_REFRESH_CAPTCHA_IMAGE(0x110, null, ConnectionState.IN_GAME), - REQUEST_PLEDGE_SIGN_IN_FOR_OPEN_JOINING_METHOD(0x111, null, ConnectionState.IN_GAME), + REQUEST_PLEDGE_SIGN_IN_FOR_OPEN_JOINING_METHOD(0x111, RequestPledgeSignInForOpenJoiningMethod::new, ConnectionState.IN_GAME), EX_REQUEST_MATCH_ARENA(0x112, null, ConnectionState.IN_GAME), EX_CONFIRM_MATCH_ARENA(0x113, null, ConnectionState.IN_GAME), EX_CANCEL_MATCH_ARENA(0x114, null, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java new file mode 100644 index 0000000000..cdcb77ff20 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPledgeSignInForOpenJoiningMethod.java @@ -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 . + */ +package com.l2jmobius.gameserver.network.clientpackets; + +import com.l2jmobius.commons.network.PacketReader; +import com.l2jmobius.gameserver.instancemanager.ClanEntryManager; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.clan.entry.PledgeRecruitInfo; +import com.l2jmobius.gameserver.network.L2GameClient; +import com.l2jmobius.gameserver.network.serverpackets.JoinPledge; +import com.l2jmobius.gameserver.network.serverpackets.UserInfo; + +/** + * @author Mobius + */ +public class RequestPledgeSignInForOpenJoiningMethod implements IClientIncomingPacket +{ + private int _clanId; + + @Override + public boolean read(L2GameClient client, PacketReader packet) + { + _clanId = packet.readD(); + packet.readD(); + return true; + } + + @Override + public void run(L2GameClient client) + { + final L2PcInstance activeChar = client.getActiveChar(); + if (activeChar == null) + { + return; + } + + final PledgeRecruitInfo pledgeRecruitInfo = ClanEntryManager.getInstance().getClanById(_clanId); + if (pledgeRecruitInfo.getRecruitType() == 1) + { + pledgeRecruitInfo.getClan().addClanMember(activeChar); + activeChar.sendPacket(new JoinPledge(_clanId)); + activeChar.sendPacket(new UserInfo(activeChar)); + activeChar.broadcastInfo(); + return; + } + } +} \ No newline at end of file