runelite-api: add total level api

This commit is contained in:
Lotto
2018-08-08 04:04:17 +02:00
committed by Adam
parent 6aa646c7ba
commit 189d54122c
2 changed files with 27 additions and 0 deletions

View File

@@ -101,6 +101,13 @@ public interface Client extends GameEngine
*/ */
int getRealSkillLevel(Skill skill); int getRealSkillLevel(Skill skill);
/**
* Calculates the total level from real skill levels.
*
* @return the total level
*/
int getTotalLevel();
/** /**
* Adds a new chat message to the chatbox. * Adds a new chat message to the chatbox.
* *

View File

@@ -300,6 +300,26 @@ public abstract class RSClientMixin implements RSClient
return realLevels[skill.ordinal()]; return realLevels[skill.ordinal()];
} }
@Inject
@Override
public int getTotalLevel()
{
int totalLevel = 0;
int[] realLevels = client.getRealSkillLevels();
int lastSkillIdx = Skill.CONSTRUCTION.ordinal();
for (int i = 0; i < realLevels.length; i++)
{
if (i <= lastSkillIdx)
{
totalLevel += realLevels[i];
}
}
return totalLevel;
}
@Inject @Inject
@Override @Override
public void addChatMessage(ChatMessageType type, String name, String message, String sender) public void addChatMessage(ChatMessageType type, String name, String message, String sender)