Skip to content
Snippets Groups Projects
Commit 4adc9838 authored by JimWails's avatar JimWails Committed by Melledy
Browse files

Fixed can set avatar level more than 90 and cause game to freeze

Limit the avatar level given by "/givechar" command.
If avatar level >90, the game will freeze if open the character interface.
parent a8b808ba
Branches
Tags
No related merge requests found
...@@ -73,6 +73,12 @@ public final class GiveCharCommand implements CommandHandler { ...@@ -73,6 +73,12 @@ public final class GiveCharCommand implements CommandHandler {
return; return;
} }
// Check level.
if (level > 90) {
CommandHandler.sendMessage(sender, "Invalid avatar level.");
return;
}
// Calculate ascension level. // Calculate ascension level.
if (level <= 40) { if (level <= 40) {
ascension = (int) Math.ceil(level / 20f); ascension = (int) Math.ceil(level / 20f);
...@@ -88,6 +94,6 @@ public final class GiveCharCommand implements CommandHandler { ...@@ -88,6 +94,6 @@ public final class GiveCharCommand implements CommandHandler {
avatar.recalcStats(); avatar.recalcStats();
targetPlayer.addAvatar(avatar); targetPlayer.addAvatar(avatar);
CommandHandler.sendMessage(sender, String.format("Given %s to %s.", avatarId, target)); CommandHandler.sendMessage(sender, String.format("Given %s with level %s to %s.", avatarId, level, target));
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment