Addition of RequestClanAskJoinByName.

This commit is contained in:
MobiusDev 2017-09-30 14:09:55 +00:00
parent 5e247445f0
commit f85299668b
8 changed files with 252 additions and 4 deletions

View File

@ -268,7 +268,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
REQUEST_MENTOR_LIST(0xB6, RequestMentorList::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_ADD(0xB7, RequestMenteeAdd::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_WAITING_LIST(0xB8, RequestMenteeWaitingList::new, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, null, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, RequestClanAskJoinByName::new, ConnectionState.IN_GAME),
REQUEST_IN_ZONE_WAITING_TIME(0xBA, RequestInzoneWaitingTime::new, ConnectionState.IN_GAME),
REQUEST_JOIN_CURIOUS_HOUSE(0xBB, RequestJoinCuriousHouse::new, ConnectionState.IN_GAME),
REQUEST_CANCEL_CURIOUS_HOUSE(0xBC, RequestCancelCuriousHouse::new, ConnectionState.IN_GAME),

View File

@ -0,0 +1,62 @@
/*
* 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 com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.AskJoinPledge;
/**
* @author Mobius
*/
public class RequestClanAskJoinByName implements IClientIncomingPacket
{
private String _playerName;
private int _pledgeType;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_playerName = packet.readS();
_pledgeType = packet.readD();
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if ((activeChar == null) || (activeChar.getClan() == null))
{
return;
}
final L2PcInstance invitedPlayer = L2World.getInstance().getPlayer(_playerName);
if (!activeChar.getClan().checkClanJoinCondition(activeChar, invitedPlayer, _pledgeType))
{
return;
}
if (!activeChar.getRequest().setRequest(invitedPlayer, this))
{
return;
}
invitedPlayer.sendPacket(new AskJoinPledge(activeChar.getObjectId(), activeChar.getClan().getSubPledge(_pledgeType) != null ? activeChar.getClan().getSubPledge(_pledgeType).getName() : null, _pledgeType, activeChar.getClan().getName()));
}
}

View File

@ -274,7 +274,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
REQUEST_MENTOR_LIST(0xB6, RequestMentorList::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_ADD(0xB7, RequestMenteeAdd::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_WAITING_LIST(0xB8, RequestMenteeWaitingList::new, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, null, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, RequestClanAskJoinByName::new, ConnectionState.IN_GAME),
REQUEST_IN_ZONE_WAITING_TIME(0xBA, RequestInzoneWaitingTime::new, ConnectionState.IN_GAME),
REQUEST_JOIN_CURIOUS_HOUSE(0xBB, RequestJoinCuriousHouse::new, ConnectionState.IN_GAME),
REQUEST_CANCEL_CURIOUS_HOUSE(0xBC, RequestCancelCuriousHouse::new, ConnectionState.IN_GAME),

View File

@ -0,0 +1,62 @@
/*
* 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 com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.AskJoinPledge;
/**
* @author Mobius
*/
public class RequestClanAskJoinByName implements IClientIncomingPacket
{
private String _playerName;
private int _pledgeType;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_playerName = packet.readS();
_pledgeType = packet.readD();
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if ((activeChar == null) || (activeChar.getClan() == null))
{
return;
}
final L2PcInstance invitedPlayer = L2World.getInstance().getPlayer(_playerName);
if (!activeChar.getClan().checkClanJoinCondition(activeChar, invitedPlayer, _pledgeType))
{
return;
}
if (!activeChar.getRequest().setRequest(invitedPlayer, this))
{
return;
}
invitedPlayer.sendPacket(new AskJoinPledge(activeChar.getObjectId(), activeChar.getClan().getSubPledge(_pledgeType) != null ? activeChar.getClan().getSubPledge(_pledgeType).getName() : null, _pledgeType, activeChar.getClan().getName()));
}
}

View File

@ -275,7 +275,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
REQUEST_MENTOR_LIST(0xB6, RequestMentorList::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_ADD(0xB7, RequestMenteeAdd::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_WAITING_LIST(0xB8, RequestMenteeWaitingList::new, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, null, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, RequestClanAskJoinByName::new, ConnectionState.IN_GAME),
REQUEST_IN_ZONE_WAITING_TIME(0xBA, RequestInzoneWaitingTime::new, ConnectionState.IN_GAME),
REQUEST_JOIN_CURIOUS_HOUSE(0xBB, RequestJoinCuriousHouse::new, ConnectionState.IN_GAME),
REQUEST_CANCEL_CURIOUS_HOUSE(0xBC, RequestCancelCuriousHouse::new, ConnectionState.IN_GAME),

View File

@ -0,0 +1,62 @@
/*
* 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 com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.AskJoinPledge;
/**
* @author Mobius
*/
public class RequestClanAskJoinByName implements IClientIncomingPacket
{
private String _playerName;
private int _pledgeType;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_playerName = packet.readS();
_pledgeType = packet.readD();
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if ((activeChar == null) || (activeChar.getClan() == null))
{
return;
}
final L2PcInstance invitedPlayer = L2World.getInstance().getPlayer(_playerName);
if (!activeChar.getClan().checkClanJoinCondition(activeChar, invitedPlayer, _pledgeType))
{
return;
}
if (!activeChar.getRequest().setRequest(invitedPlayer, this))
{
return;
}
invitedPlayer.sendPacket(new AskJoinPledge(activeChar.getObjectId(), activeChar.getClan().getSubPledge(_pledgeType) != null ? activeChar.getClan().getSubPledge(_pledgeType).getName() : null, _pledgeType, activeChar.getClan().getName()));
}
}

View File

@ -275,7 +275,7 @@ public enum ExIncomingPackets implements IIncomingPackets<L2GameClient>
REQUEST_MENTOR_LIST(0xB6, RequestMentorList::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_ADD(0xB7, RequestMenteeAdd::new, ConnectionState.IN_GAME),
REQUEST_MENTEE_WAITING_LIST(0xB8, RequestMenteeWaitingList::new, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, null, ConnectionState.IN_GAME),
REQUEST_CLAN_ASK_JOIN_BY_NAME(0xB9, RequestClanAskJoinByName::new, ConnectionState.IN_GAME),
REQUEST_IN_ZONE_WAITING_TIME(0xBA, RequestInzoneWaitingTime::new, ConnectionState.IN_GAME),
REQUEST_JOIN_CURIOUS_HOUSE(0xBB, RequestJoinCuriousHouse::new, ConnectionState.IN_GAME),
REQUEST_CANCEL_CURIOUS_HOUSE(0xBC, RequestCancelCuriousHouse::new, ConnectionState.IN_GAME),

View File

@ -0,0 +1,62 @@
/*
* 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 com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.AskJoinPledge;
/**
* @author Mobius
*/
public class RequestClanAskJoinByName implements IClientIncomingPacket
{
private String _playerName;
private int _pledgeType;
@Override
public boolean read(L2GameClient client, PacketReader packet)
{
_playerName = packet.readS();
_pledgeType = packet.readD();
return true;
}
@Override
public void run(L2GameClient client)
{
final L2PcInstance activeChar = client.getActiveChar();
if ((activeChar == null) || (activeChar.getClan() == null))
{
return;
}
final L2PcInstance invitedPlayer = L2World.getInstance().getPlayer(_playerName);
if (!activeChar.getClan().checkClanJoinCondition(activeChar, invitedPlayer, _pledgeType))
{
return;
}
if (!activeChar.getRequest().setRequest(invitedPlayer, this))
{
return;
}
invitedPlayer.sendPacket(new AskJoinPledge(activeChar.getObjectId(), activeChar.getClan().getSubPledge(_pledgeType) != null ? activeChar.getClan().getSubPledge(_pledgeType).getName() : null, _pledgeType, activeChar.getClan().getName()));
}
}