Jump to content
  • 0

Problem with a bug.


Joκκєrino

Question

Hello community . As you know , there is a bug on L2jFrozen . If admin set to color clan leader title , you can make all players of this clan to have the same title by changing the clan leader .

 

Exemple : I am Leader . I have green color and then i change clan leader . After changing i'm not leader but i have green title color . My friend gonna give my clan back and then he will have green title color too as me , but he's not clan leader .

 

I tryied fix it and i successed.

 

 

                                L2jFrozen Code 

// Apply color settings to clan leader when entering  
	if (activeChar.getClan() != null && activeChar.isClanLeader() && Config.CLAN_LEADER_COLOR_ENABLED && activeChar.getClan().getLevel() >= Config.CLAN_LEADER_COLOR_CLAN_LEVEL)
	{
		if (Config.CLAN_LEADER_COLORED == 1)
			activeChar.getAppearance().setNameColor(Config.CLAN_LEADER_COLOR);
		else
			activeChar.getAppearance().setTitleColor(Config.CLAN_LEADER_COLOR);
	}

                   MY EDIT ADDED .
	if(activeChar.getClan() != null )
		if(!activeChar.isClanLeader())
			activeChar.getAppearance().setTitleColor(Config.CLAN_NOLEADER_COLOR);

 

But that's not really good , cuz player must restart to change his title color from "green"(Config.CLAN_LEADER_COLOR) to "white"Config.CLAN_NOLEADER_COLOR). Can you tell me how i can kill connection ? In moment when clan leader is changed , last clan leader to be kicked , not actually .

 

Sorry for my english ... :D But i hope you understand what i'm writing

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Hello community . As you know , there is a bug on L2jFrozen . If admin set to color clan leader title , you can make all players of this clan to have the same title by changing the clan leader .

 

Exemple : I am Leader . I have green color and then i change clan leader . After changing i'm not leader but i have green title color . My friend gonna give my clan back and then he will have green title color too as me , but he's not clan leader .

 

I tryied fix it and i successed.

 

 

                                L2jFrozen Code 

// Apply color settings to clan leader when entering  
	if (activeChar.getClan() != null && activeChar.isClanLeader() && Config.CLAN_LEADER_COLOR_ENABLED && activeChar.getClan().getLevel() >= Config.CLAN_LEADER_COLOR_CLAN_LEVEL)
	{
		if (Config.CLAN_LEADER_COLORED == 1)
			activeChar.getAppearance().setNameColor(Config.CLAN_LEADER_COLOR);
		else
			activeChar.getAppearance().setTitleColor(Config.CLAN_LEADER_COLOR);
	}

                   MY EDIT ADDED .
	if(activeChar.getClan() != null )
		if(!activeChar.isClanLeader())
			activeChar.getAppearance().setTitleColor(Config.CLAN_NOLEADER_COLOR);

 

But that's not really good , cuz player must restart to change his title color from "green"(Config.CLAN_LEADER_COLOR) to "white"Config.CLAN_NOLEADER_COLOR). Can you tell me how i can kill connection ? In moment when clan leader is changed , last clan leader to be kicked , not actually .

 

Sorry for my english ... :D But i hope you understand what i'm writing

 

 

 

    MY EDIT ADDED .

if(activeChar.getClan() != null )

if(!activeChar.isClanLeader())

-activeChar.getAppearance().setTitleColor(Config.CLAN_NOLEADER_COLOR);

                    +activeChar.getAppearance().setTitleColor(0xFFFFFF);

 

Link to comment
Share on other sites

  • 0

 

    MY EDIT ADDED .

if(activeChar.getClan() != null )

if(!activeChar.isClanLeader())

-activeChar.getAppearance().setTitleColor(Config.CLAN_NOLEADER_COLOR);

 

 

                    +activeChar.getAppearance().setTitleColor(0xFFFFFF);

 

 

 

Buddy , i already finished problem with bug , now i just want to kick last leader after changing leader

Link to comment
Share on other sites

  • 0

I don't know how l2jfrozen does clans but from the default interlude in L2Clan.java you could use this function after doing that crap.

 

public void removeClanMember(String name, long clanJoinExpiryTime)

 

 

Link to comment
Share on other sites

  • 0

I don't know how l2jfrozen does clans but from the default interlude in L2Clan.java you could use this function after doing that crap.

 

public void removeClanMember(String name, long clanJoinExpiryTime)

 

 

 

it's not about kicking him , just close his connection ( lineage 2 screen ).

Link to comment
Share on other sites

  • 0

it's not about kicking him , just close his connection ( lineage 2 screen ).

 

why do you want to close his connection? I don't really see the logic in that but, alright. What you can do is turn on the debugger, freeze your L2PcInstance and see what happens when you trigger a disconnect, perhaps there is a player disconnect function somewhere.

Link to comment
Share on other sites

  • 0

Hi, but about this, I can say, what I have been searching for leader color name changing, and I saw what, leaders name color is changing only when leader is crossing packet Enterworld (or in other words, he is starting playing) and then clan is destroying. But I didn't saw what clan leader color is changing, for example, when he creates the clan, or changes leader. So we can think like this:

Add these:

		if (Config.CLAN_LEADER_COLOR_ENABLED && getLevel() >= Config.CLAN_LEADER_COLOR_CLAN_LEVEL)
		{
			exLeader.getAppearance().setNameColor(0x000000);
			exLeader.getAppearance().setTitleColor(0x9900CC);
			exLeader.updateNameTitleColor();
		}

Below these:

public boolean setLeader(L2ClanMember member)
{
	if(member==null){
		return false;
	}

	L2ClanMember old_leader = _leader;
	_leader = member;
	_members.put(member.getName(), member);

	//refresh oldleader and new leader info
	if(old_leader!=null){

		L2PcInstance exLeader = old_leader.getPlayerInstance();
		exLeader.setClan(this);
		exLeader.setPledgeClass(exLeader.getClan().getClanMember(exLeader.getObjectId()).calculatePledgeClass(exLeader));
		exLeader.setClanPrivileges(L2Clan.CP_NOTHING);

And then, these:

		if (Config.CLAN_LEADER_COLOR_ENABLED && getLevel() >= Config.CLAN_LEADER_COLOR_CLAN_LEVEL)
		{
			if (Config.CLAN_LEADER_COLORED == 1)
				newLeader.getAppearance().setNameColor(Config.CLAN_LEADER_COLOR);
			else
				newLeader.getAppearance().setTitleColor(Config.CLAN_LEADER_COLOR);
			newLeader.updateNameTitleColor();
		}

Below these:

	updateClanInDB();


	if(member.getPlayerInstance()!=null){

		L2PcInstance newLeader = member.getPlayerInstance();
		newLeader.setClan(this);
		newLeader.setPledgeClass(member.calculatePledgeClass(newLeader));
		newLeader.setClanPrivileges(L2Clan.CP_ALL);

 

P.s. Sorry, I haven't finded good project with svn, so I couldn't put patch.

P.s.s. All this change is in L2Clan.java / setLeader method.

P.s.s.s. Sorry for bad English. :)

Link to comment
Share on other sites

  • 0

main thing:

exLeader.updateNameTitleColor();

But without these:

				exLeader.getAppearance().setNameColor(0x000000);
			exLeader.getAppearance().setTitleColor(0x9900CC);

You have nothing to update...  :-X

Link to comment
Share on other sites

  • 0

you set the colors, but you will not see them if you dont send some update packet to the client, that why the client still see the old colors, usualy its:

 

sendPacket(new ShortBuffStatusUpdate(0, 0, 0));

type

for example

 

but that function looks like it does send the packet inside it, check it, and if its ot doing it, the find what packet you need to send and send it

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...