Jump to content
  • 0

Help Editing Clan Comunity


Question

Posted
goodnight hello people , I 'll post a problem that took several days fighting with and you do not know what do to with the solution I tried to copy pieces of code with similar operations and have not gotten more than what you see in the image below . I 'm trying to leave the skills clan organized in the table on the right and when it exceeds the width of the table rather than leapfrog continue straight breaking the width of the table are 35 skill in all that I have and just 13 appear others  lost in the table ... , here you will see the image when the clan has skills: 
 
claninfo.png
 
in this clan has no skills yet:
claninfo2.png
 
this is the code in clanbbs:
 
This part is completely up -->  private static final String SKILL_LIST = "%clanskills%";
 
private void clanhome(L2PcInstance activeChar, int clanId)
{
L2Clan cl = ClanTable.getInstance().getClan(clanId);
if (cl != null)
{
if (cl.getLevel() < 2)
{
activeChar.sendPacket(SystemMessageId.NO_CB_IN_MY_CLAN);
cbByPass("_bbsmemo_clanlist", activeChar);
}
else
{
 
ClanHall clanhall = ClanHallManager.getInstance().getClanHallByOwner(cl);
Castle castle = CastleManager.getInstance().getCastleById(cl.getCastleId());
Fort fort = FortManager.getInstance().getFortById(cl.getFortId());
String content = "";
String path = "data/html/CommunityBoard/clanInfo.htm";
content = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), path);
content = content.replaceAll("%clan_name%", cl.getName());
content = content.replaceAll("%leader_name%", cl.getLeaderName());
content = content.replaceAll("%alliance%", (cl.getAllyName() != null ? cl.getAllyName() : "No"));
content = content.replaceAll("%level%", String.valueOf(cl.getLevel()));
content = content.replaceAll("%base%", (castle != null ? castle.getName() + " Castle" : (fort != null ? fort.getName() + " Fortress" : "No")));
content = content.replaceAll("%hall%", (clanhall != null ? clanhall.getName() : "No"));
content = content.replaceAll("%members%", (cl.getMembersCount() > 0 ? String.valueOf(cl.getMembersCount()) : "No"));
content = content.replaceAll("%reputation%", (cl.getReputationScore() > 0 ? String.valueOf(cl.getReputationScore()) : "No"));
content = content.replaceAll("%memberson%", (cl.getOnlineMembersCount() > 0 ? String.valueOf(cl.getOnlineMembersCount()) : "0"));
String list = "";
final Map<Integer, L2Skill> skills = cl.getSkills();
for (L2Skill s : skills.values())
{
String largo = Integer.toString(s.getId());
 
String largo3 = "0" + largo;
 
list += SKILL_LIST;
list = list.replace("%clanskills%", "<td align=center><button width=32 height=32 back=\"Icon.skill" + (largo.length() > 3 ? largo : largo3) + "\" fore=\"Icon.skill" + (largo.length() > 3 ? largo : largo3) + "\"></td>");
}
content = content.replace("%clanskills%", list);
 
separateAndSend(content, activeChar);
}
}
}
 
 
and here the htm part:
 
<td width=456>
<table width=456 height=180>
<tr>
<td valign="top" align="center">
<table border=0  width=456 height=249 cellspacing=4 cellpadding=3 background="l2ui_ct1.ComboBox_DF_Dropmenu_Bg">
<tr>
<td width=220 align=left valign=top>
<table width=439 height=25 bgcolor=0e0d0d>
<tr>
<td width=406 align=center valign=center>
<font color="LEVEL">Clan Skills</font>
</td>
</tr>
</table>
 
 
 
<table width=456 bgcolor=333333>
<tr>
 
%clanskills% 
 
 
</tr>
       </table>
</td>
</tr>
</table>
</td>
</tr>
</table>
 
</td>
i try to add a counter variable called "cantidad" to count the result in a loop, and it work, but i dont know what to do to make it working fine, look the changes;
 
				int cantidad = 0;
				for (L2Skill s : skills.values())
				{
					String largo = Integer.toString(s.getId());
					String largo3 = "0" + largo;
					
					list += SKILL_LIST;
					list = list.replace("%clanskills%", "<td align=center><button width=32 height=32 back=\"Icon.skill" + (largo.length() > 3 ? largo : largo3) + "\" fore=\"Icon.skill" + (largo.length() > 3 ? largo : largo3) + "\"></td>");
					cantidad++;
					if (cantidad == 12)
					{
						break;
					}
				}
				content = content.replace("%clanskills%", list);
				
				separateAndSend(content, activeChar);
			}

when i test , it break the loop when 12 results but how can i do to change line and continue the results till the next change line? sorry for my english, 

if anyone knows where the error may be what I will be grateful 've tried everything and no where to take her to repair it , thanks in advance.

3 answers to this question

Recommended Posts

  • 0
Posted
list = list.replace("%clanskills%", "<td align=center><button width=32 height=32 back=\"Icon.skill" + (largo.length() > 3 ? largo : largo3) + "\" fore=\"Icon.skill" + (largo.length() > 3 ? largo : largo3) + "\"></td>");

This seems wrong

You should use StringBuilder to add next TDs. For example:

StringBuilder builder = new StringBuilder();
for(L2Skill s : skills.values())
builder.append("<td blabla");

content = content.replace("%clanskills%, builder.toString());

You also should replace "break" in the loop with

builder.append("</tr><tr>");

  • 0
Posted

hello yes exactly i used your answer and worked as a charm , very thanks , I can take advantage for the title post and ask one more thing? i am trying to edit the simple clan list from comunity board , and it work fine but it show the clans order by clan members count and i want to do it by clan level, can you tell me please where to add a piece of code to organize the result descendant from clan level 11 to 0? because i trying some ways and nothing work for me, thanks in advance. here the clanlist method;
 

	private void clanlist(L2PcInstance activeChar, int index)
	{
		if (index < 1)
		{
			index = 1;
		}
		
		// header
		final StringBuilder html = StringUtil.startAppend(2000, "<html><body><br><br><br><center><table border=0 cellspacing=0 cellpadding=2 bgcolor=5A5A5A width=650><tr><td FIXWIDTH=5></td><td FIXWIDTH=50 align=center>Clan Name</td><td FIXWIDTH=50 align=center>Clan Leader</td><td FIXWIDTH=50 align=center>Clan Level</td><td FIXWIDTH=50 align=center>Clan Members</td><td FIXWIDTH=50 align=center>Info</td><td FIXWIDTH=5 align=center></td></tr></table><img src=\"L2UI.Squareblank\" width=\"1\" height=\"5\">");
		
		int i = 0;
		
		for (L2Clan cl : ClanTable.getInstance().getClans())
		{
			
			if (i > ((index + 1) * 7))
			{
				
				break;
			}
			
			if (i++ >= ((index - 1) * 7))
			{
				
				StringUtil.append(html, "<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\"><table border=0 cellspacing=0 cellpadding=0 width=650><tr> <td FIXWIDTH=5></td><td FIXWIDTH=55 align=center><font color=\"99FF66\">" + cl.getName(), " <br1></font></td><td FIXWIDTH=50 align=center>", cl.getLeaderName(), "</td><td FIXWIDTH=50 align=center>", "<font color=\"LEVEL\">" + String.valueOf(cl.getLevel()), "</font></td><td FIXWIDTH=40 align=center>", String.valueOf(cl.getMembersCount()), "</td><td FIXWIDTH=60 align=center><button action=\"bypass _bbsmemo_clanhome;" + String.valueOf(cl.getId()) + "\"  back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td><td FIXWIDTH=5></td></tr><tr><td height=5></tr><tr><td height=5></td></tr></table><img src=\"L2UI.SquareBlank\" width=\"610\" height=\"3\"><img src=\"L2UI.SquareGray\" width=\"610\" height=\"1\"><br>");
			}
		}
		
		html.append("<img src=\"L2UI.SquareBlank\" width=\"610\" height=\"2\"><table cellpadding=0 cellspacing=2 border=0><tr>");
		
		if (index == 1)
		{
			html.append("<td><button action=\"\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");
		}
		else
		{
			StringUtil.append(html, "<td><button action=\"_bbsmemo_clanlist;", String.valueOf(index - 1), "\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");
		}
		
		i = 0;
		int nbp = ClanTable.getInstance().getClanCount() / 8;
		if ((nbp * 8) != ClanTable.getInstance().getClanCount())
		{
			nbp++;
		}
		for (i = 1; i <= nbp; i++)
		{
			if (i == index)
			{
				StringUtil.append(html, "<td width=8></td>");
				StringUtil.append(html, "<td> ", String.valueOf(i), " </td>");
				StringUtil.append(html, "<td width=8></td>");
			}
			else
			{
				StringUtil.append(html, "<td><a action=\"bypass _bbsmemo_clanlist;", String.valueOf(i), "\"> ", String.valueOf(i), " </a></td>");
			}
			
		}
		if (index == nbp)
		{
			html.append("<td><button action=\"\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>");
		}
		else
		{
			StringUtil.append(html, "<td><button action=\"bypass _bbsmemo_clanlist;", String.valueOf(index + 1), "\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>");
		}
		html.append("</tr></table><table border=0 cellspacing=0 cellpadding=0><tr><td width=610><br><img src=\"sek.cbui141\" width=\"610\" height=\"1\"><br><br></td></tr></table></center></body></html>");
		separateAndSend(html.toString(), activeChar);
	}

 and here a screenshot to see what i am asking...

 

clanlist.png

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.



  • Posts

    • its not imagination we skip that on this topic my offer still stands i am accepting a house Mr. @ERROR501 for more information please contact me
    • Sell ready interlude server files, with all popular features and tested, stable source + fully functional premium geodata for free.   Features include: Events: DM CTF TVT LM Dressme system Custom Buffer GM Shop Custom community board Donation manager  Auto Farm   Album: sell c6 — ImgBB   Test Server online: Patch link: https://drive.google.com/file/d/1mvEbv9XESsvfWwc638xFyyzyESeE2U95/view?usp=drive_link Auto acc create and auto admin   Price: 300$. Discord: l2retro
    • Faltan demasiados archivos,  y lógicas en clases claves como L2pcInstance, entre otras. si bien muchas cosas están y el flujo es valorable.  Gracias por tu esfuerzo es bastante... pero realmente no esta completo el código, falta que subas todas las modificaciones en clases colaterales... podrías intentar subir un diff de todo el mod  completo de tu pack y bueno ahí si que cada uno adapte... pero faltan muchas cosas, dudo que haya gente que lo haya echo funcionar con esto... 
    • I know people who have fully bypassed and reversed AAC. One day, they might even release the full source code, but for now, they’re still making money off it. I won’t name anyone, but it’s clear that there aren’t any truly solid anticheats for Lineage2. As I’ve said before, kernel level anticheats are the only real solution. Anything that runs as Internal and injects gets flagged, and your account ends up getting kicked or banned. That’s just how most games handle it nowadays. To TL;DR the whole thing cheating will always exist because there are people out there smart enough to bypass any protection and run private cheats. Public cheats are always detected eventually, so I don’t see any point in buying AAC, especially when they claim it blocks adr, which simply isn’t true.
    • 🌐 Website: https://l2adonis.com 📅 GRAND OPENING: July 18, 2025 – 20:00 (UTC+2) 💬 Discord: https://discord.com/invite/tZBj8JxAwx 🚫 No auto-farm • No auto-macro • No pay-to-win • No custom   Some Basic Info's (More detalied info's on website)  EXP/SP: x25  Adena: x15  Drop: x15  Spoil: x15  Seal Stones: x15  Raid Boss Drop: x10  Epic Boss Drop: x1  Manor: x10  Safe Enchant: +4  Max Enchant: +16  Normal Scroll Chance: 50%  Blessed Scroll Chance: 66% (If enchant fail item remain +4)  Buff Slots (30+4 extra with Divine Inspiration)  Dances/Songs Slots 14  Auto-learn skills  ⚔️ Real PvP • Real Progression • Retail-like experience JOIN NOW and relive the real L2 experience!
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock