Bläddra i källkod

Party update. Thx Kerberos

Gigiikun 16 år sedan
förälder
incheckning
389795aa64

+ 3 - 8
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Party.java

@@ -59,7 +59,7 @@ public class L2Party {
 	//private static Logger _log = Logger.getLogger(L2Party.class.getName());
 
 	private FastList<L2PcInstance> _members = null;
-    private int _pendingInvitation = 0;       // Number of players that already have been invited (but not replied yet)
+    private boolean _pendingInvitation = false;
 	private int _partyLvl = 0;
 	private int _itemDistribution = 0;
 	private int _itemLastLoot = 0;
@@ -95,18 +95,13 @@ public class L2Party {
      * returns number of players that already been invited, but not replied yet
      * @return
      */
-    public int getPendingInvitationNumber() { return _pendingInvitation; }
+    public boolean getPendingInvitation() { return _pendingInvitation; }
 
     /**
      * decrease number of players that already been invited but not replied yet
      * happens when: player join party or player decline to join
      */
-    public void decreasePendingInvitationNumber() { _pendingInvitation--; }
-
-    /**
-     * increase number of players that already been invite but not replied yet
-     */
-    public void increasePendingInvitationNumber() { _pendingInvitation++; }
+    public void setPendingInvitation(boolean val) { _pendingInvitation = val; }
 
 	/**
 	 * returns all party members

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestAnswerJoinParty.java

@@ -68,7 +68,7 @@ public final class RequestAnswerJoinParty extends L2GameClientPacket
     			if (requestor.getParty() != null && requestor.getParty().getMemberCount() == 1) requestor.setParty(null);
     		}
     		if (requestor.getParty() != null)
-    			requestor.getParty().decreasePendingInvitationNumber(); // if party is null, there is no need of decreasing
+    			requestor.getParty().setPendingInvitation(false); // if party is null, there is no need of decreasing
 
     		player.setActiveRequester(null);
     		requestor.onTransactionResponse();

+ 13 - 27
L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestJoinParty.java

@@ -100,12 +100,6 @@ public final class RequestJoinParty extends L2GameClientPacket
 			return;
 		}
 		
-		if (target.getInstanceId() != requestor.getInstanceId())
-  	 	{
-  	 		requestor.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
-  	 	 	return;
-  	 	}
-
 		if (target.isInJail() || requestor.isInJail())
         {
 			requestor.sendMessage("Player is in Jail");
@@ -115,9 +109,6 @@ public final class RequestJoinParty extends L2GameClientPacket
         if (target.isInOlympiadMode() || requestor.isInOlympiadMode())
             return;
 
-        if (target.isInDuel() || requestor.isInDuel())
-            return;
-
         if (!requestor.isInParty())     //Asker has no party
         {
             createNewParty(target, requestor);
@@ -146,35 +137,37 @@ public final class RequestJoinParty extends L2GameClientPacket
 		SystemMessage msg;
 
        // summary of ppl already in party and ppl that get invitation
-        if (requestor.getParty().getMemberCount() + requestor.getParty().getPendingInvitationNumber() >= 9 )
+		if (!requestor.getParty().isLeader(requestor))
         {
-			requestor.sendPacket(new SystemMessage(SystemMessageId.PARTY_FULL));
+			requestor.sendPacket(new SystemMessage(SystemMessageId.ONLY_LEADER_CAN_INVITE));
 			return;
 		}
-
-		if (!requestor.getParty().isLeader(requestor))
+        if (requestor.getParty().getMemberCount() >= 9 )
         {
-			requestor.sendPacket(new SystemMessage(SystemMessageId.ONLY_LEADER_CAN_INVITE));
+			requestor.sendPacket(new SystemMessage(SystemMessageId.PARTY_FULL));
 			return;
 		}
+        if (requestor.getParty().getPendingInvitation())
+        {
+        	requestor.sendPacket(new SystemMessage(SystemMessageId.WAITING_FOR_ANOTHER_REPLY));
+        	return;
+        }
 
 		if (!target.isProcessingRequest())
 		{
 		    requestor.onTransactionRequest(target);
 		    // in case a leader change has happened, use party's mode
 		    target.sendPacket(new AskJoinParty(requestor.getName(), requestor.getParty().getLootDistribution()));
-		    requestor.getParty().increasePendingInvitationNumber();
+		    requestor.getParty().setPendingInvitation(true);
 
 		    if (Config.DEBUG)
 		        _log.fine("sent out a party invitation to:"+target.getName());
 
-		    msg = new SystemMessage(SystemMessageId.YOU_INVITED_S1_TO_PARTY);
-		    msg.addString(target.getName());
-		    requestor.sendPacket(msg);
 		}
 		else
 		{
 		    msg = new SystemMessage(SystemMessageId.S1_IS_BUSY_TRY_LATER);
+		    msg.addString(target.getName());
 		    requestor.sendPacket(msg);
 
 		    if (Config.DEBUG)
@@ -192,28 +185,21 @@ public final class RequestJoinParty extends L2GameClientPacket
 	 */
 	private void createNewParty(L2PcInstance target, L2PcInstance requestor)
 	{
-		SystemMessage msg;
-
 		if (!target.isProcessingRequest())
 		{
 		    requestor.setParty(new L2Party(requestor, _itemDistribution));
 
 		    requestor.onTransactionRequest(target);
 		    target.sendPacket(new AskJoinParty(requestor.getName(), _itemDistribution));
-		    requestor.getParty().increasePendingInvitationNumber();
+		    requestor.getParty().setPendingInvitation(true);
 
 		    if (Config.DEBUG)
 		        _log.fine("sent out a party invitation to:"+target.getName());
 
-		    msg = new SystemMessage(SystemMessageId.YOU_INVITED_S1_TO_PARTY);
-		    msg.addString(target.getName());
-		    requestor.sendPacket(msg);
 		}
 		else
 		{
-		    msg = new SystemMessage(SystemMessageId.S1_IS_BUSY_TRY_LATER);
-		    msg.addString(target.getName());
-		    requestor.sendPacket(msg);
+		    requestor.sendPacket(new SystemMessage(SystemMessageId.WAITING_FOR_ANOTHER_REPLY));
 
 		    if (Config.DEBUG)
 		        _log.warning(requestor.getName() + " already received a party invitation");