Jump to content
  • 0

Maximum 2 healers allowed in party


Question

Posted (edited)

Hello i try to make maximum 2 healers allowed in 1 party but im getting some problems maybe can someone help me ?

 

i added this lines to requestjoinparty but is not working properly

 

            if (target.getClassId().getId() == 97 && (party.getMembersCount() >= 2) ) 
                {
                    requestor.sendMessage("Maximum 2 healers are allowed in party !");
                    return;
                }

 

 

Edited by arm4729

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

Your "party.getMembersCount() >= 2" condition is for the party overall.
You need to store the healers at-invite and remove them at-leave, so you know they are actually in the party.

 

filter(player -> player.getClassId() == 97).size()

 

or

 

Fast and ugly for the sake of L2J:

 

private static final List<Player> HEALER_LIST = new ArrayList<>();

 

If player.getClassId == 97:

HEALES_LIST.add(player);

HEALER_LIST.remove(player);

 

You can use the condition If HEALER_LIST.size() >= 2 to forbid an amount and you don't need to check getClassId, because you already checked that at add/remove.

 

You also got this: for (Player healer : HEALER_LIST)

So you can do stuff with the healer while being in the party.

 

Make the player to leave party while changing subclasses.

Edited by Trance
  • 0
Posted
37 minutes ago, Trance said:

Your "party.getMembersCount() >= 2" condition is for the party overall.
You need to store the healers at-invite and remove them at-leave, so you know they are actually in the party.

 

private static final List<Player> HEALER_LIST = new ArrayList<>();

 

If player.getClassId == 97:

HEALES_LIST.add(player);

HEALER_LIST.remove(player);

 

You can use the condition If HEALER_LIST.size() >= 2 to forbid an amount and you don't need to check getClassId, because you already checked that at add/remove.

 

You also got this: for (Player healer : HEALER_LIST)

So you can do stuff with the healer while being in the party.

 

Make the player to leave party while changing subclasses.

Your code is unnecessary.

 

@arm4729

 

if (party.getMembers().stream().filter(k -> k.getClassId() == ClassId.bishop).count() > 2)
{
	// Failed to add		
}

 

  • 0
Posted (edited)
17 minutes ago, EdithFinch said:

Your code is unnecessary.

 

@arm4729

 


if (party.getMembers().stream().filter(k -> k.getClassId() == ClassId.bishop).count() > 2)
{
	// Failed to add		
}

 

 

I included that as well, edited before your reply, I had a feeling someone would take it more seriously.

Edited by Trance
  • 0
Posted (edited)

very thank you guys !!

 

i only tried this 

 

            if (party.getMembers().stream().filter(k -> k.getClassId() == (ClassId.CARDINAL)).count() >= 2)

 

is working fine thx

Edited by arm4729
Guest
This topic is now closed to further replies.


  • Posts

    • TG Support: https://t.me/buyingproxysup | Channel: https://t.me/buyingproxycom Discord support: #buyingproxy | Server: Join the BuyingProxy Discord Server!  Create your free account here
    • I think you should check the video more carefully you missing something very important 😛      
    • Im responding to an anonymous account with 3 posts, almost no background, and practically zero useful information added to the discussion. On top of that, the topic title is misleading  calling it "Lucera Source Code" gives a completely different impression from what is actually being presented.   I didn’t say anything different. Therefore, I have no clue how his process produces the same desirable result.   And here you are creating drama. Your topic title clearly says "Lucera Source Code," which is not actually the case, or at least that’s how it looked when I first clicked on it, so I don’t think I was completely off. There’s also no significant information about your process like  what difficulties you faced, what tools you used, or anything else meaningful. Yet you still expect others to provide value based on what? I’m not talking about your project itself which, by the way, good job. I’m talking about the topic itself as a source of value for this forum, because right now it doesn’t really offer much in that regard. So regarding the semantics, yes, wording does matter.  
    • You are funny guy! 😄 😄 😄    I was working with Lucera long before “AI apps” became fashionable. This was not something I generated in one day with a prompt. It took me years of work, testing, debugging and fixing broken decompiled code.   Of course a decompiled source is not the original private repository with the original comments, history and developer structure. Nobody said it is the same Git repository. But saying it is only “guesses” is also wrong.   When you decompile, rebuild, fix thousands of compile/runtime issues, restore broken logic, reconnect scripts, fix bad casts, repair database calls, compile it again and run it in-game, at that point it is no longer just a guess.   It becomes a working reconstructed source base!   The important part is not whether it is byte-for-byte identical to the original private source. The important part is that I can now work directly inside the code, change core logic, rebuild scripts, fix bugs and continue development without being locked behind closed binaries.   Does it compile? Yes. Does it run in-game? Yes. Can I modify core systems directly? Yes. Can I continue development independently? Yes.   So call it reconstructed, decompiled, cleaned, restored or whatever name you prefer. The result is still the same: I have a working source environment that gives me control over the lucera2 project.   And that was exactly the goal!   🙂 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..