Would anyone have this separate Tooltip to make available?
where the character's status, HP and CP are available on the target
Below is the written code and an image of the tooltip from another server.
where the character's status, HP and CP are available on the target
Below is the written code and an image of the tooltip from another server.
Java:
public class StatusRealTime
{
protected StatusRealTime()
{
ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new LoadStatus(), 500, 500);
System.out.println("[StatusRealTime] Real-time status updater started.");
}
public static StatusRealTime getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final StatusRealTime INSTANCE = new StatusRealTime();
}
}
class LoadStatus implements Runnable
{
@Override
public void run()
{
try
{
Collection<L2PcInstance> allPlayers = L2World.getInstance().getPlayers();
for (L2PcInstance player : allPlayers)
{
if ((player == null) || !player.isOnline() || player.isInOfflineMode())
{
continue;
}
if (player.getTarget() instanceof L2PcInstance)
{
L2PcInstance target = (L2PcInstance) player.getTarget();
StatusUpdate su = new StatusUpdate(target);
su.addAttribute(StatusUpdate.CUR_HP, (int) target.getCurrentHp());
su.addAttribute(StatusUpdate.MAX_HP, target.getMaxHp());
su.addAttribute(StatusUpdate.CUR_CP, (int) target.getCurrentCp());
su.addAttribute(StatusUpdate.MAX_CP, target.getMaxCp());
su.addAttribute(StatusUpdate.CUR_MP, (int) target.getCurrentMp());
su.addAttribute(StatusUpdate.MAX_MP, target.getMaxMp());
player.sendPacket(su);
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
