I've some variable on client. The variable is stored in the database when a customer leaves the game. But when player enters the game again I'll have to make some changes on the client which are based on data character_variables... And here my question, where I must do it, or how? Is it will be as new method in l2pcinstance or what?
This's one part of code. I've many changes, and many will be in future. For example on: val "experience". I need disable exp for char when it enters the game, and now I think how to do this better.
Code: Select all
// Example part of code, already done
if (param.equals("experience"))
{
try
{
boolean exp_isenabled = activeChar.getVariables().getBoolean("experience", false);
String s_state = "";
if (!exp_isenabled)
{
activeChar.addListener(new FunctionEventListener(activeChar, EventType.ON_PLAYABLE_EXP_CHANGED, (OnPlayableExpChanged event) -> onExperienceReceived(event.getActiveChar(), event.getNewExp() - event.getOldExp()), this));
activeChar.getVariables().set("experience", true);
s_state = "выключено";
}
else if (exp_isenabled)
{
activeChar.removeListenerIf(EventType.ON_PLAYABLE_EXP_CHANGED, listener -> listener.getOwner() == this);
activeChar.getVariables().set("experience", false);
s_state = "включено";
}
activeChar.sendMessage("Получение опыта: "+s_state+".");
SendReadyHTML(activeChar, htmltext);
return false;
}
catch (Exception e)
{
SendDenideAccess(activeChar, "Возникла ошибка при обработке: experience");
_log.info("**** VIP Manager **** < " + activeChar + " > got error in experience");
return false;
}
}