L2JMobius
Free Users => Work in Progress => Topic started by: oRiGiNaL on February 15, 2021, 10:52:16 PM
-
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.
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 (https://ibb.co/FKz1Hkx)
Can someone tell em how and where i can add !=null ?
Greetings !!
-
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.
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 (https://ibb.co/FKz1Hkx)
Can someone tell em how and where i can add !=null ?
Greetings !!
replace("%subclass%", ClassListData.getInstance().getClass(player.getSubClasses().get(1).getClassId()).getClientCode() != null ? player.getActiveClass() : null);
maybe it work...
-
I get this code by Excellence
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?
-
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.
-
I really don't know how to do that.
-
(https://ibb.co/JR34Ybt) Fixed. Thank you!