L2JMobius

High Five Subclass/community board

oRiGiNaL · 6 · 2927

Offline oRiGiNaL

  • Black Sheep
  • Knight
  • ***
    • Posts: 68
Hello everyone. Today i decide to do something interesting. I want to add on community board when player have subclass, to display there.
and the code it is like that.
Code: [Select]
returnHtml = returnHtml.replace("%subclass%", ClassListData.getInstance().getClass(player.getSubClasses().get(1).getClassId()).getClientCode());All good untill now, but when player doesn`t have subclass, he can't open cb and i get error on gameserver:
https://ibb.co/FKz1Hkx
Can someone tell em how and where i can add !=null ?
Greetings !!


Offline felipeafa

  • Knight
  • ***
    • Posts: 56
Hello everyone. Today i decide to do something interesting. I want to add on community board when player have subclass, to display there.
and the code it is like that.
Code: [Select]
returnHtml = returnHtml.replace("%subclass%", ClassListData.getInstance().getClass(player.getSubClasses().get(1).getClassId()).getClientCode());All good untill now, but when player doesn`t have subclass, he can't open cb and i get error on gameserver:
https://ibb.co/FKz1Hkx
Can someone tell em how and where i can add !=null ?
Greetings !!
Quote
replace("%subclass%", ClassListData.getInstance().getClass(player.getSubClasses().get(1).getClassId()).getClientCode() != null ? player.getActiveClass() : null);
maybe it work...


Offline oRiGiNaL

  • Black Sheep
  • Knight
  • ***
    • Posts: 68
I get this code by Excellence
Code: [Select]
for (int i = 0; i < player.getSubClasses().size(); i++)
{
final String subName = ClassListData.getInstance().getClass(player.getSubClasses().get(i).getClassId()).getClientCode();
returnHtml = returnHtml.replace("%subclass" + i + "%", subName);
}
But it doesn't work. I want to do this for max 3 subclasses. I tryes %subclass1%/%subclass2%/%subclass3%. NOthing happend. In game, i see just %subclass1%/%subclass2%/%subclass3%. Not the subclasses. Help please?


Offline Pirsys

  • Knight
  • ***
    • Posts: 67
And if instead of trying to call that data through core code ... you will use the data that you have in the database, it would be more practical it seems to me.


Offline oRiGiNaL

  • Black Sheep
  • Knight
  • ***
    • Posts: 68