|
@@ -15,7 +15,6 @@
|
|
|
package com.l2jserver.gameserver.network.clientpackets;
|
|
|
|
|
|
import com.l2jserver.gameserver.model.L2Party;
|
|
|
-import com.l2jserver.gameserver.model.L2Skill;
|
|
|
import com.l2jserver.gameserver.model.L2World;
|
|
|
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
|
|
import com.l2jserver.gameserver.network.SystemMessageId;
|
|
@@ -23,11 +22,9 @@ import com.l2jserver.gameserver.network.serverpackets.ExAskJoinMPCC;
|
|
|
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
|
|
|
|
|
/**
|
|
|
- * Format: (ch) S
|
|
|
- * @author chris_00
|
|
|
- *
|
|
|
+ * Format: (ch) S<br>
|
|
|
* D0 0D 00 5A 00 77 00 65 00 72 00 67 00 00 00
|
|
|
- *
|
|
|
+ * @author chris_00
|
|
|
*/
|
|
|
public final class RequestExAskJoinMPCC extends L2GameClientPacket
|
|
|
{
|
|
@@ -43,33 +40,39 @@ public final class RequestExAskJoinMPCC extends L2GameClientPacket
|
|
|
@Override
|
|
|
protected void runImpl()
|
|
|
{
|
|
|
- L2PcInstance activeChar = getClient().getActiveChar();
|
|
|
- if(activeChar == null)
|
|
|
+ final L2PcInstance activeChar = getClient().getActiveChar();
|
|
|
+ if (activeChar == null)
|
|
|
+ {
|
|
|
return;
|
|
|
+ }
|
|
|
|
|
|
- L2PcInstance player = L2World.getInstance().getPlayer(_name);
|
|
|
- if(player == null)
|
|
|
+ final L2PcInstance player = L2World.getInstance().getPlayer(_name);
|
|
|
+ if (player == null)
|
|
|
+ {
|
|
|
return;
|
|
|
+ }
|
|
|
// invite yourself? ;)
|
|
|
- if(activeChar.isInParty() && player.isInParty() && activeChar.getParty().equals(player.getParty()))
|
|
|
+ if (activeChar.isInParty() && player.isInParty() && activeChar.getParty().equals(player.getParty()))
|
|
|
+ {
|
|
|
return;
|
|
|
+ }
|
|
|
|
|
|
SystemMessage sm;
|
|
|
- //activeChar is in a Party?
|
|
|
+ // activeChar is in a Party?
|
|
|
if (activeChar.isInParty())
|
|
|
{
|
|
|
L2Party activeParty = activeChar.getParty();
|
|
|
- //activeChar is PartyLeader? && activeChars Party is already in a CommandChannel?
|
|
|
+ // activeChar is PartyLeader? && activeChars Party is already in a CommandChannel?
|
|
|
if (activeParty.getLeader().equals(activeChar))
|
|
|
{
|
|
|
// if activeChars Party is in CC, is activeChar CCLeader?
|
|
|
if (activeParty.isInCommandChannel() && activeParty.getCommandChannel().getChannelLeader().equals(activeChar))
|
|
|
{
|
|
|
- //in CC and the CCLeader
|
|
|
- //target in a party?
|
|
|
+ // in CC and the CCLeader
|
|
|
+ // target in a party?
|
|
|
if (player.isInParty())
|
|
|
{
|
|
|
- //targets party already in a CChannel?
|
|
|
+ // targets party already in a CChannel?
|
|
|
if (player.getParty().isInCommandChannel())
|
|
|
{
|
|
|
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ALREADY_MEMBER_OF_COMMAND_CHANNEL);
|
|
@@ -78,8 +81,8 @@ public final class RequestExAskJoinMPCC extends L2GameClientPacket
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //ready to open a new CC
|
|
|
- //send request to targets Party's PartyLeader
|
|
|
+ // ready to open a new CC
|
|
|
+ // send request to targets Party's PartyLeader
|
|
|
askJoinMPCC(activeChar, player);
|
|
|
}
|
|
|
}
|
|
@@ -91,16 +94,16 @@ public final class RequestExAskJoinMPCC extends L2GameClientPacket
|
|
|
}
|
|
|
else if (activeParty.isInCommandChannel() && !activeParty.getCommandChannel().getChannelLeader().equals(activeChar))
|
|
|
{
|
|
|
- //in CC, but not the CCLeader
|
|
|
+ // in CC, but not the CCLeader
|
|
|
sm = SystemMessage.getSystemMessage(SystemMessageId.CANNOT_INVITE_TO_COMMAND_CHANNEL);
|
|
|
activeChar.sendPacket(sm);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //target in a party?
|
|
|
+ // target in a party?
|
|
|
if (player.isInParty())
|
|
|
{
|
|
|
- //targets party already in a CChannel?
|
|
|
+ // targets party already in a CChannel?
|
|
|
if (player.getParty().isInCommandChannel())
|
|
|
{
|
|
|
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ALREADY_MEMBER_OF_COMMAND_CHANNEL);
|
|
@@ -109,8 +112,8 @@ public final class RequestExAskJoinMPCC extends L2GameClientPacket
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //ready to open a new CC
|
|
|
- //send request to targets Party's PartyLeader
|
|
|
+ // ready to open a new CC
|
|
|
+ // send request to targets Party's PartyLeader
|
|
|
askJoinMPCC(activeChar, player);
|
|
|
}
|
|
|
}
|
|
@@ -130,22 +133,21 @@ public final class RequestExAskJoinMPCC extends L2GameClientPacket
|
|
|
private void askJoinMPCC(L2PcInstance requestor, L2PcInstance target)
|
|
|
{
|
|
|
boolean hasRight = false;
|
|
|
- if (requestor.getClan() != null && requestor.getClan().getLeaderId() == requestor.getObjectId()
|
|
|
- && requestor.getClan().getLevel() >= 5) // Clanleader of lvl5 Clan or higher
|
|
|
+ if (requestor.isClanLeader() && (requestor.getClan().getLevel() >= 5))
|
|
|
+ {
|
|
|
+ // Clan leader of lvl5 Clan or higher.
|
|
|
hasRight = true;
|
|
|
- else if (requestor.getInventory().getItemByItemId(8871) != null) // 8871 Strategy Guide. Should destroyed after sucessfull invite?
|
|
|
+ }
|
|
|
+ else if (requestor.getInventory().getItemByItemId(8871) != null)
|
|
|
+ {
|
|
|
+ // 8871 Strategy Guide.
|
|
|
+ // TODO: Should destroyed after successful invite?
|
|
|
hasRight = true;
|
|
|
- else if(requestor.getPledgeClass() >= 5) // At least Baron or higher and the skill Clan Imperium
|
|
|
+ }
|
|
|
+ else if ((requestor.getPledgeClass() >= 5) && (requestor.getKnownSkill(391) != null))
|
|
|
{
|
|
|
- for (L2Skill skill : requestor.getAllSkills())
|
|
|
- {
|
|
|
- // Skill Clan Imperium
|
|
|
- if (skill.getId() == 391)
|
|
|
- {
|
|
|
- hasRight = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ // At least Baron or higher and the skill Clan Imperium
|
|
|
+ hasRight = true;
|
|
|
}
|
|
|
|
|
|
if (!hasRight)
|
|
@@ -153,21 +155,24 @@ public final class RequestExAskJoinMPCC extends L2GameClientPacket
|
|
|
requestor.sendPacket(SystemMessageId.COMMAND_CHANNEL_ONLY_BY_LEVEL_5_CLAN_LEADER_PARTY_LEADER);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ // Get the target's party leader, and do whole actions on him.
|
|
|
+ final L2PcInstance targetLeader = target.getParty().getLeader();
|
|
|
SystemMessage sm;
|
|
|
- if (!target.isProcessingRequest())
|
|
|
+ if (!targetLeader.isProcessingRequest())
|
|
|
{
|
|
|
- requestor.onTransactionRequest(target);
|
|
|
+ requestor.onTransactionRequest(targetLeader);
|
|
|
sm = SystemMessage.getSystemMessage(SystemMessageId.COMMAND_CHANNEL_CONFIRM_FROM_C1);
|
|
|
sm.addString(requestor.getName());
|
|
|
- target.getParty().getLeader().sendPacket(sm);
|
|
|
- target.getParty().getLeader().sendPacket(new ExAskJoinMPCC(requestor.getName()));
|
|
|
+ targetLeader.sendPacket(sm);
|
|
|
+ targetLeader.sendPacket(new ExAskJoinMPCC(requestor.getName()));
|
|
|
|
|
|
- requestor.sendMessage("You invited " + target.getName() + " to your Command Channel.");
|
|
|
+ requestor.sendMessage("You invited " + targetLeader.getName() + " to your Command Channel.");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_BUSY_TRY_LATER);
|
|
|
- sm.addString(target.getName());
|
|
|
+ sm.addString(targetLeader.getName());
|
|
|
requestor.sendPacket(sm);
|
|
|
}
|
|
|
}
|