if (User.squaredDistanceTo(x, y) < 15 * 15) {
final int amount = newXp - xp;
if (amount > 0) {
addTextIndicator("+" + amount,
NotificationType.SIGNIFICANT_POSITIVE);
ClientSingletonRepository.getUserInterface().addEventLine(new HeaderLessEventLine(
getTitle()
+ " earns "
+ Grammar.quantityplnoun(amount,
"experience point") + ".",
NotificationType.SIGNIFICANT_POSITIVE));
} else if (amount < 0) {
addTextIndicator("" + amount,
NotificationType.SIGNIFICANT_NEGATIVE);
ClientSingletonRepository.getUserInterface().addEventLine(new HeaderLessEventLine(
getTitle()
+ " loses "
+ Grammar.quantityplnoun(-amount,
"experience point") + ".",
NotificationType.SIGNIFICANT_NEGATIVE));
}
}
}
xp = newXp;
}
if (changes.has("level") && object.has("level")) {
if (User.squaredDistanceTo(x, y) < 15 * 15) {
final String text = getTitle() + " reaches Level " + getLevel();
ClientSingletonRepository.getUserInterface().addEventLine(new HeaderLessEventLine(text,
NotificationType.SIGNIFICANT_POSITIVE));
ClientSingletonRepository.getUserInterface().addGameScreenText(
getX() + (getWidth() / 2.0), getY(),
text, NotificationType.SIGNIFICANT_POSITIVE, false);