Add dmmt world type and tournament hiscore endpoint
This commit is contained in:
@@ -26,8 +26,10 @@
|
|||||||
|
|
||||||
package net.runelite.http.api.hiscore;
|
package net.runelite.http.api.hiscore;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import okhttp3.HttpUrl;
|
import okhttp3.HttpUrl;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum HiscoreEndpoint
|
public enum HiscoreEndpoint
|
||||||
{
|
{
|
||||||
NORMAL("Normal", "https://services.runescape.com/m=hiscore_oldschool/index_lite.ws"),
|
NORMAL("Normal", "https://services.runescape.com/m=hiscore_oldschool/index_lite.ws"),
|
||||||
@@ -35,7 +37,8 @@ public enum HiscoreEndpoint
|
|||||||
HARDCORE_IRONMAN("Hardcore Ironman", "https://services.runescape.com/m=hiscore_oldschool_hardcore_ironman/index_lite.ws"),
|
HARDCORE_IRONMAN("Hardcore Ironman", "https://services.runescape.com/m=hiscore_oldschool_hardcore_ironman/index_lite.ws"),
|
||||||
ULTIMATE_IRONMAN("Ultimate Ironman", "https://services.runescape.com/m=hiscore_oldschool_ultimate/index_lite.ws"),
|
ULTIMATE_IRONMAN("Ultimate Ironman", "https://services.runescape.com/m=hiscore_oldschool_ultimate/index_lite.ws"),
|
||||||
DEADMAN("Deadman", "https://services.runescape.com/m=hiscore_oldschool_deadman/index_lite.ws"),
|
DEADMAN("Deadman", "https://services.runescape.com/m=hiscore_oldschool_deadman/index_lite.ws"),
|
||||||
LEAGUE("Twisted League", "https://services.runescape.com/m=hiscore_oldschool_seasonal/index_lite.ws");
|
LEAGUE("Twisted League", "https://services.runescape.com/m=hiscore_oldschool_seasonal/index_lite.ws"),
|
||||||
|
TOURNAMENT("Tournament", "https://services.runescape.com/m=hiscore_oldschool_tournament/index_lite.ws");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final HttpUrl hiscoreURL;
|
private final HttpUrl hiscoreURL;
|
||||||
@@ -45,14 +48,4 @@ public enum HiscoreEndpoint
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.hiscoreURL = HttpUrl.parse(hiscoreURL);
|
this.hiscoreURL = HttpUrl.parse(hiscoreURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HttpUrl getHiscoreURL()
|
|
||||||
{
|
|
||||||
return hiscoreURL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,5 +34,6 @@ public enum WorldType
|
|||||||
LAST_MAN_STANDING,
|
LAST_MAN_STANDING,
|
||||||
TOURNAMENT,
|
TOURNAMENT,
|
||||||
DEADMAN,
|
DEADMAN,
|
||||||
|
DEADMAN_TOURNAMENT,
|
||||||
LEAGUE;
|
LEAGUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ enum ServiceWorldType
|
|||||||
HIGH_RISK(WorldType.HIGH_RISK, 1 << 10),
|
HIGH_RISK(WorldType.HIGH_RISK, 1 << 10),
|
||||||
LAST_MAN_STANDING(WorldType.LAST_MAN_STANDING, 1 << 14),
|
LAST_MAN_STANDING(WorldType.LAST_MAN_STANDING, 1 << 14),
|
||||||
TOURNAMENT(WorldType.TOURNAMENT, 1 << 25),
|
TOURNAMENT(WorldType.TOURNAMENT, 1 << 25),
|
||||||
|
DEADMAN_TOURNAMENT(WorldType.DEADMAN_TOURNAMENT, 1 << 26),
|
||||||
DEADMAN(WorldType.DEADMAN, 1 << 29),
|
DEADMAN(WorldType.DEADMAN, 1 << 29),
|
||||||
LEAGUE(WorldType.LEAGUE, 1 << 30);
|
LEAGUE(WorldType.LEAGUE, 1 << 30);
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ public enum WorldType
|
|||||||
* Tournament world type.
|
* Tournament world type.
|
||||||
*/
|
*/
|
||||||
TOURNAMENT(1 << 25),
|
TOURNAMENT(1 << 25),
|
||||||
|
/**
|
||||||
|
* Deadman Tournament world type.
|
||||||
|
*/
|
||||||
|
DEADMAN_TOURNAMENT(1 << 26),
|
||||||
/**
|
/**
|
||||||
* Deadman world type.
|
* Deadman world type.
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +81,7 @@ public enum WorldType
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final EnumSet<WorldType> PVP_WORLD_TYPES = EnumSet.of(
|
private static final EnumSet<WorldType> PVP_WORLD_TYPES = EnumSet.of(
|
||||||
DEADMAN,
|
DEADMAN, // dmmt worlds are also flaged as DEADMAN
|
||||||
PVP
|
PVP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ import net.runelite.http.api.hiscore.HiscoreSkill;
|
|||||||
import static net.runelite.http.api.hiscore.HiscoreSkill.*;
|
import static net.runelite.http.api.hiscore.HiscoreSkill.*;
|
||||||
import net.runelite.http.api.hiscore.HiscoreSkillType;
|
import net.runelite.http.api.hiscore.HiscoreSkillType;
|
||||||
import net.runelite.http.api.hiscore.Skill;
|
import net.runelite.http.api.hiscore.Skill;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -113,6 +114,10 @@ public class HiscorePanel extends PluginPanel
|
|||||||
ZALCANO, ZULRAH
|
ZALCANO, ZULRAH
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static final HiscoreEndpoint[] ENDPOINTS = new HiscoreEndpoint[] {
|
||||||
|
HiscoreEndpoint.NORMAL, HiscoreEndpoint.IRONMAN, HiscoreEndpoint.HARDCORE_IRONMAN, HiscoreEndpoint.ULTIMATE_IRONMAN, HiscoreEndpoint.DEADMAN, HiscoreEndpoint.TOURNAMENT
|
||||||
|
};
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ScheduledExecutorService executor;
|
ScheduledExecutorService executor;
|
||||||
|
|
||||||
@@ -200,7 +205,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
tabGroup = new MaterialTabGroup();
|
tabGroup = new MaterialTabGroup();
|
||||||
tabGroup.setLayout(new GridLayout(1, 5, 7, 7));
|
tabGroup.setLayout(new GridLayout(1, 5, 7, 7));
|
||||||
|
|
||||||
for (HiscoreEndpoint endpoint : HiscoreEndpoint.values())
|
for (HiscoreEndpoint endpoint : ENDPOINTS)
|
||||||
{
|
{
|
||||||
final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), endpoint.name().toLowerCase() + ".png");
|
final BufferedImage iconImage = ImageUtil.getResourceStreamFromClass(getClass(), endpoint.name().toLowerCase() + ".png");
|
||||||
|
|
||||||
@@ -681,7 +686,9 @@ public class HiscorePanel extends PluginPanel
|
|||||||
private void resetEndpoints()
|
private void resetEndpoints()
|
||||||
{
|
{
|
||||||
// Select the correct tab based on the world type.
|
// Select the correct tab based on the world type.
|
||||||
tabGroup.select(tabGroup.getTab(selectWorldEndpoint().ordinal()));
|
HiscoreEndpoint endpoint = selectWorldEndpoint();
|
||||||
|
int idx = ArrayUtils.indexOf(ENDPOINTS, endpoint);
|
||||||
|
tabGroup.select(tabGroup.getTab(idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
private HiscoreEndpoint selectWorldEndpoint()
|
private HiscoreEndpoint selectWorldEndpoint()
|
||||||
@@ -690,7 +697,11 @@ public class HiscorePanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
EnumSet<WorldType> wTypes = client.getWorldType();
|
EnumSet<WorldType> wTypes = client.getWorldType();
|
||||||
|
|
||||||
if (wTypes.contains(WorldType.DEADMAN))
|
if (wTypes.contains(WorldType.DEADMAN_TOURNAMENT))
|
||||||
|
{
|
||||||
|
return HiscoreEndpoint.TOURNAMENT;
|
||||||
|
}
|
||||||
|
else if (wTypes.contains(WorldType.DEADMAN))
|
||||||
{
|
{
|
||||||
return HiscoreEndpoint.DEADMAN;
|
return HiscoreEndpoint.DEADMAN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,11 @@ public class OpponentInfoPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
final EnumSet<WorldType> worldType = client.getWorldType();
|
final EnumSet<WorldType> worldType = client.getWorldType();
|
||||||
if (worldType.contains(WorldType.DEADMAN))
|
if (worldType.contains(WorldType.DEADMAN_TOURNAMENT))
|
||||||
|
{
|
||||||
|
hiscoreEndpoint = HiscoreEndpoint.TOURNAMENT;
|
||||||
|
}
|
||||||
|
else if (worldType.contains(WorldType.DEADMAN))
|
||||||
{
|
{
|
||||||
hiscoreEndpoint = HiscoreEndpoint.DEADMAN;
|
hiscoreEndpoint = HiscoreEndpoint.DEADMAN;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 227 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
Reference in New Issue
Block a user