chatcommands: fix showing -1 experience/rank in lvl
This commit is contained in:
@@ -55,8 +55,8 @@ import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.vars.AccountType;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import static net.runelite.api.widgets.WidgetID.ADVENTURE_LOG_ID;
|
||||
import static net.runelite.api.widgets.WidgetID.KILL_LOGS_GROUP_ID;
|
||||
import static net.runelite.api.widgets.WidgetID.COUNTERS_LOG_GROUP_ID;
|
||||
import static net.runelite.api.widgets.WidgetID.KILL_LOGS_GROUP_ID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatCommandManager;
|
||||
@@ -119,7 +119,6 @@ public class ChatCommandsPlugin extends Plugin
|
||||
@VisibleForTesting
|
||||
static final int ADV_LOG_EXPLOITS_TEXT_INDEX = 1;
|
||||
|
||||
private final HiscoreClient hiscoreClient = new HiscoreClient();
|
||||
private final ChatClient chatClient = new ChatClient();
|
||||
|
||||
private boolean bossLogLoaded;
|
||||
@@ -157,6 +156,9 @@ public class ChatCommandsPlugin extends Plugin
|
||||
@Inject
|
||||
private ChatKeyboardListener chatKeyboardListener;
|
||||
|
||||
@Inject
|
||||
private HiscoreClient hiscoreClient;
|
||||
|
||||
@Override
|
||||
public void startUp()
|
||||
{
|
||||
@@ -1005,21 +1007,27 @@ public class ChatCommandsPlugin extends Plugin
|
||||
|
||||
final Skill hiscoreSkill = result.getSkill();
|
||||
|
||||
final String response = new ChatMessageBuilder()
|
||||
ChatMessageBuilder chatMessageBuilder = new ChatMessageBuilder()
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("Level ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(skill.getName()).append(": ").append(String.valueOf(hiscoreSkill.getLevel()))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" Experience: ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(String.format("%,d", hiscoreSkill.getExperience()))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" Rank: ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(String.format("%,d", hiscoreSkill.getRank()))
|
||||
.build();
|
||||
.append(ChatColorType.NORMAL);
|
||||
if (hiscoreSkill.getExperience() != -1)
|
||||
{
|
||||
chatMessageBuilder.append(" Experience: ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(String.format("%,d", hiscoreSkill.getExperience()))
|
||||
.append(ChatColorType.NORMAL);
|
||||
}
|
||||
if (hiscoreSkill.getRank() != -1)
|
||||
{
|
||||
chatMessageBuilder.append(" Rank: ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(String.format("%,d", hiscoreSkill.getRank()));
|
||||
}
|
||||
|
||||
final String response = chatMessageBuilder.build();
|
||||
log.debug("Setting response {}", response);
|
||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||
messageNode.setRuneLiteFormatMessage(response);
|
||||
|
||||
Reference in New Issue
Block a user