Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -19,7 +19,6 @@ import net.runelite.asm.Type;
|
|||||||
import net.runelite.asm.attributes.Code;
|
import net.runelite.asm.attributes.Code;
|
||||||
import net.runelite.asm.attributes.code.Instruction;
|
import net.runelite.asm.attributes.code.Instruction;
|
||||||
import net.runelite.asm.attributes.code.Instructions;
|
import net.runelite.asm.attributes.code.Instructions;
|
||||||
import net.runelite.asm.attributes.code.instructions.CheckCast;
|
|
||||||
import net.runelite.asm.attributes.code.instructions.GetField;
|
import net.runelite.asm.attributes.code.instructions.GetField;
|
||||||
import net.runelite.asm.attributes.code.instructions.GetStatic;
|
import net.runelite.asm.attributes.code.instructions.GetStatic;
|
||||||
import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
|
import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ public final class WidgetID
|
|||||||
public static final int GRAVESTONE_GROUP_ID = 672;
|
public static final int GRAVESTONE_GROUP_ID = 672;
|
||||||
public static final int POH_TREASURE_CHEST_INVENTORY_GROUP_ID = 674;
|
public static final int POH_TREASURE_CHEST_INVENTORY_GROUP_ID = 674;
|
||||||
public static final int GROUP_IRON_GROUP_ID = 726;
|
public static final int GROUP_IRON_GROUP_ID = 726;
|
||||||
|
public static final int GROUP_STORAGE_GROUP_ID = 724;
|
||||||
|
|
||||||
static class WorldMap
|
static class WorldMap
|
||||||
{
|
{
|
||||||
@@ -308,6 +309,11 @@ public final class WidgetID
|
|||||||
static final int EQUIPMENT_BUTTON = 113;
|
static final int EQUIPMENT_BUTTON = 113;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class GroupStorage
|
||||||
|
{
|
||||||
|
static final int ITEM_CONTAINER = 10;
|
||||||
|
}
|
||||||
|
|
||||||
static class GrandExchange
|
static class GrandExchange
|
||||||
{
|
{
|
||||||
static final int WINDOW_CONTAINER = 0;
|
static final int WINDOW_CONTAINER = 0;
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ public enum WidgetInfo
|
|||||||
BANK_SETTINGS_BUTTON(WidgetID.BANK_GROUP_ID, WidgetID.Bank.SETTINGS_BUTTON),
|
BANK_SETTINGS_BUTTON(WidgetID.BANK_GROUP_ID, WidgetID.Bank.SETTINGS_BUTTON),
|
||||||
BANK_TUTORIAL_BUTTON(WidgetID.BANK_GROUP_ID, WidgetID.Bank.TUTORIAL_BUTTON),
|
BANK_TUTORIAL_BUTTON(WidgetID.BANK_GROUP_ID, WidgetID.Bank.TUTORIAL_BUTTON),
|
||||||
|
|
||||||
|
GROUP_STORAGE_ITEM_CONTAINER(WidgetID.GROUP_STORAGE_GROUP_ID, WidgetID.GroupStorage.ITEM_CONTAINER),
|
||||||
|
|
||||||
GRAND_EXCHANGE_WINDOW_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.WINDOW_CONTAINER),
|
GRAND_EXCHANGE_WINDOW_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.WINDOW_CONTAINER),
|
||||||
GRAND_EXCHANGE_OFFER_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.OFFER_CONTAINER),
|
GRAND_EXCHANGE_OFFER_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.OFFER_CONTAINER),
|
||||||
GRAND_EXCHANGE_OFFER_TEXT(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.OFFER_DESCRIPTION),
|
GRAND_EXCHANGE_OFFER_TEXT(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.OFFER_DESCRIPTION),
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ dependencies {
|
|||||||
implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4")
|
implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4")
|
||||||
implementation(group = "org.madlonkay", name = "desktopsupport", version = "0.6.0")
|
implementation(group = "org.madlonkay", name = "desktopsupport", version = "0.6.0")
|
||||||
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")
|
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")
|
||||||
|
implementation(group = "org.apache.commons", name = "commons-csv", version = "1.9.0")
|
||||||
implementation(group = "commons-io", name = "commons-io", version = "2.8.0")
|
implementation(group = "commons-io", name = "commons-io", version = "2.8.0")
|
||||||
implementation(group = "org.jetbrains", name = "annotations", version = "22.0.0")
|
implementation(group = "org.jetbrains", name = "annotations", version = "22.0.0")
|
||||||
implementation(group = "com.github.zafarkhaja", name = "java-semver", version = "0.9.0")
|
implementation(group = "com.github.zafarkhaja", name = "java-semver", version = "0.9.0")
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ import net.runelite.client.eventbus.EventBus;
|
|||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.ItemMapping;
|
import net.runelite.client.game.ItemMapping;
|
||||||
|
import net.runelite.client.hiscore.HiscoreClient;
|
||||||
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
import net.runelite.client.util.PvPUtil;
|
import net.runelite.client.util.PvPUtil;
|
||||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
|
||||||
import net.runelite.http.api.item.ItemEquipmentStats;
|
import net.runelite.http.api.item.ItemEquipmentStats;
|
||||||
import net.runelite.http.api.item.ItemStats;
|
import net.runelite.http.api.item.ItemStats;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.http.api.hiscore;
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -64,28 +64,6 @@ public class HiscoreClient
|
|||||||
return lookup(username, HiscoreEndpoint.NORMAL);
|
return lookup(username, HiscoreEndpoint.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SingleHiscoreSkillResult lookup(String username, HiscoreSkill skill, HiscoreEndpoint endpoint) throws IOException
|
|
||||||
{
|
|
||||||
HiscoreResult result = lookupSync(username, endpoint.getHiscoreURL());
|
|
||||||
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Skill requested = result.getSkill(skill);
|
|
||||||
SingleHiscoreSkillResult skillResult = new SingleHiscoreSkillResult();
|
|
||||||
skillResult.setPlayer(username);
|
|
||||||
skillResult.setSkillName(skill.getName());
|
|
||||||
skillResult.setSkill(requested);
|
|
||||||
return skillResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SingleHiscoreSkillResult lookup(String username, HiscoreSkill skill) throws IOException
|
|
||||||
{
|
|
||||||
return lookup(username, skill, HiscoreEndpoint.NORMAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HiscoreResult lookupSync(String username, HttpUrl hiscoreUrl) throws IOException
|
private HiscoreResult lookupSync(String username, HttpUrl hiscoreUrl) throws IOException
|
||||||
{
|
{
|
||||||
try (Response response = client.newCall(buildRequest(username, hiscoreUrl)).execute())
|
try (Response response = client.newCall(buildRequest(username, hiscoreUrl)).execute())
|
||||||
@@ -109,7 +87,7 @@ public class HiscoreClient
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException
|
public void onResponse(Call call, Response response) throws IOException
|
||||||
{
|
{
|
||||||
try
|
try // NOPMD: UseTryWithResources
|
||||||
{
|
{
|
||||||
future.complete(processResponse(username, response));
|
future.complete(processResponse(username, response));
|
||||||
}
|
}
|
||||||
@@ -156,9 +134,7 @@ public class HiscoreClient
|
|||||||
{
|
{
|
||||||
CSVParser parser = CSVParser.parse(responseStr, CSVFormat.DEFAULT);
|
CSVParser parser = CSVParser.parse(responseStr, CSVFormat.DEFAULT);
|
||||||
|
|
||||||
HiscoreResultBuilder hiscoreBuilder = new HiscoreResultBuilder();
|
HiscoreResultBuilder hiscoreBuilder = new HiscoreResultBuilder(username);
|
||||||
hiscoreBuilder.setPlayer(username);
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (CSVRecord record : parser.getRecords())
|
for (CSVRecord record : parser.getRecords())
|
||||||
@@ -186,4 +162,4 @@ public class HiscoreClient
|
|||||||
|
|
||||||
return hiscoreBuilder.build();
|
return hiscoreBuilder.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum HiscoreEndpoint
|
||||||
|
{
|
||||||
|
NORMAL("Normal", "https://services.runescape.com/m=hiscore_oldschool/index_lite.ws"),
|
||||||
|
IRONMAN("Ironman", "https://services.runescape.com/m=hiscore_oldschool_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"),
|
||||||
|
DEADMAN("Deadman", "https://services.runescape.com/m=hiscore_oldschool_deadman/index_lite.ws"),
|
||||||
|
LEAGUE("Leagues", "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 HttpUrl hiscoreURL;
|
||||||
|
|
||||||
|
HiscoreEndpoint(String name, String hiscoreURL)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.hiscoreURL = HttpUrl.get(hiscoreURL);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.game;
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@@ -31,11 +31,8 @@ import com.google.common.util.concurrent.MoreExecutors;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import static net.runelite.client.game.HiscoreManager.EMPTY;
|
import static net.runelite.client.hiscore.HiscoreManager.EMPTY;
|
||||||
import static net.runelite.client.game.HiscoreManager.NONE;
|
import static net.runelite.client.hiscore.HiscoreManager.NONE;
|
||||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
class HiscoreLoader extends CacheLoader<HiscoreManager.HiscoreKey, HiscoreResult>
|
class HiscoreLoader extends CacheLoader<HiscoreManager.HiscoreKey, HiscoreResult>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.game;
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
@@ -33,9 +33,6 @@ import javax.inject.Inject;
|
|||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -56,7 +53,7 @@ public class HiscoreManager
|
|||||||
private final HiscoreClient hiscoreClient;
|
private final HiscoreClient hiscoreClient;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public HiscoreManager(ScheduledExecutorService executor, OkHttpClient okHttpClient)
|
private HiscoreManager(ScheduledExecutorService executor, OkHttpClient okHttpClient)
|
||||||
{
|
{
|
||||||
hiscoreClient = new HiscoreClient(okHttpClient);
|
hiscoreClient = new HiscoreClient(okHttpClient);
|
||||||
hiscoreCache = CacheBuilder.newBuilder()
|
hiscoreCache = CacheBuilder.newBuilder()
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.http.api.hiscore;
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -120,77 +120,77 @@ public class HiscoreResult
|
|||||||
switch (skill)
|
switch (skill)
|
||||||
{
|
{
|
||||||
case ATTACK:
|
case ATTACK:
|
||||||
return getAttack();
|
return attack;
|
||||||
case DEFENCE:
|
case DEFENCE:
|
||||||
return getDefence();
|
return defence;
|
||||||
case STRENGTH:
|
case STRENGTH:
|
||||||
return getStrength();
|
return strength;
|
||||||
case HITPOINTS:
|
case HITPOINTS:
|
||||||
return getHitpoints();
|
return hitpoints;
|
||||||
case RANGED:
|
case RANGED:
|
||||||
return getRanged();
|
return ranged;
|
||||||
case PRAYER:
|
case PRAYER:
|
||||||
return getPrayer();
|
return prayer;
|
||||||
case MAGIC:
|
case MAGIC:
|
||||||
return getMagic();
|
return magic;
|
||||||
case COOKING:
|
case COOKING:
|
||||||
return getCooking();
|
return cooking;
|
||||||
case WOODCUTTING:
|
case WOODCUTTING:
|
||||||
return getWoodcutting();
|
return woodcutting;
|
||||||
case FLETCHING:
|
case FLETCHING:
|
||||||
return getFletching();
|
return fletching;
|
||||||
case FISHING:
|
case FISHING:
|
||||||
return getFishing();
|
return fishing;
|
||||||
case FIREMAKING:
|
case FIREMAKING:
|
||||||
return getFiremaking();
|
return firemaking;
|
||||||
case CRAFTING:
|
case CRAFTING:
|
||||||
return getCrafting();
|
return crafting;
|
||||||
case SMITHING:
|
case SMITHING:
|
||||||
return getSmithing();
|
return smithing;
|
||||||
case MINING:
|
case MINING:
|
||||||
return getMining();
|
return mining;
|
||||||
case HERBLORE:
|
case HERBLORE:
|
||||||
return getHerblore();
|
return herblore;
|
||||||
case AGILITY:
|
case AGILITY:
|
||||||
return getAgility();
|
return agility;
|
||||||
case THIEVING:
|
case THIEVING:
|
||||||
return getThieving();
|
return thieving;
|
||||||
case SLAYER:
|
case SLAYER:
|
||||||
return getSlayer();
|
return slayer;
|
||||||
case FARMING:
|
case FARMING:
|
||||||
return getFarming();
|
return farming;
|
||||||
case RUNECRAFT:
|
case RUNECRAFT:
|
||||||
return getRunecraft();
|
return runecraft;
|
||||||
case HUNTER:
|
case HUNTER:
|
||||||
return getHunter();
|
return hunter;
|
||||||
case CONSTRUCTION:
|
case CONSTRUCTION:
|
||||||
return getConstruction();
|
return construction;
|
||||||
case LEAGUE_POINTS:
|
case LEAGUE_POINTS:
|
||||||
return getLeaguePoints();
|
return leaguePoints;
|
||||||
case OVERALL:
|
case OVERALL:
|
||||||
return getOverall();
|
return overall;
|
||||||
case BOUNTY_HUNTER_HUNTER:
|
case BOUNTY_HUNTER_HUNTER:
|
||||||
return getBountyHunterHunter();
|
return bountyHunterHunter;
|
||||||
case BOUNTY_HUNTER_ROGUE:
|
case BOUNTY_HUNTER_ROGUE:
|
||||||
return getBountyHunterRogue();
|
return bountyHunterRogue;
|
||||||
case CLUE_SCROLL_ALL:
|
case CLUE_SCROLL_ALL:
|
||||||
return getClueScrollAll();
|
return clueScrollAll;
|
||||||
case CLUE_SCROLL_BEGINNER:
|
case CLUE_SCROLL_BEGINNER:
|
||||||
return getClueScrollBeginner();
|
return clueScrollBeginner;
|
||||||
case CLUE_SCROLL_EASY:
|
case CLUE_SCROLL_EASY:
|
||||||
return getClueScrollEasy();
|
return clueScrollEasy;
|
||||||
case CLUE_SCROLL_MEDIUM:
|
case CLUE_SCROLL_MEDIUM:
|
||||||
return getClueScrollMedium();
|
return clueScrollMedium;
|
||||||
case CLUE_SCROLL_HARD:
|
case CLUE_SCROLL_HARD:
|
||||||
return getClueScrollHard();
|
return clueScrollHard;
|
||||||
case CLUE_SCROLL_ELITE:
|
case CLUE_SCROLL_ELITE:
|
||||||
return getClueScrollElite();
|
return clueScrollElite;
|
||||||
case CLUE_SCROLL_MASTER:
|
case CLUE_SCROLL_MASTER:
|
||||||
return getClueScrollMaster();
|
return clueScrollMaster;
|
||||||
case LAST_MAN_STANDING:
|
case LAST_MAN_STANDING:
|
||||||
return getLastManStanding();
|
return lastManStanding;
|
||||||
case SOUL_WARS_ZEAL:
|
case SOUL_WARS_ZEAL:
|
||||||
return getSoulWarsZeal();
|
return soulWarsZeal;
|
||||||
case ABYSSAL_SIRE:
|
case ABYSSAL_SIRE:
|
||||||
return abyssalSire;
|
return abyssalSire;
|
||||||
case ALCHEMICAL_HYDRA:
|
case ALCHEMICAL_HYDRA:
|
||||||
@@ -22,21 +22,18 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.http.api.hiscore;
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
class HiscoreResultBuilder
|
class HiscoreResultBuilder
|
||||||
{
|
{
|
||||||
private String player;
|
private final String player;
|
||||||
private final List<Skill> skills = new ArrayList<>();
|
private final List<Skill> skills = new ArrayList<>();
|
||||||
|
|
||||||
public void setPlayer(String player)
|
|
||||||
{
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setNextSkill(Skill skill)
|
void setNextSkill(Skill skill)
|
||||||
{
|
{
|
||||||
skills.add(skill);
|
skills.add(skill);
|
||||||
@@ -22,13 +22,13 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.http.api.hiscore;
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import static net.runelite.http.api.hiscore.HiscoreSkillType.SKILL;
|
import static net.runelite.client.hiscore.HiscoreSkillType.SKILL;
|
||||||
import static net.runelite.http.api.hiscore.HiscoreSkillType.ACTIVITY;
|
import static net.runelite.client.hiscore.HiscoreSkillType.ACTIVITY;
|
||||||
import static net.runelite.http.api.hiscore.HiscoreSkillType.BOSS;
|
import static net.runelite.client.hiscore.HiscoreSkillType.BOSS;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Bram91 <https://github.com/bram91>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
|
public enum HiscoreSkillType
|
||||||
|
{
|
||||||
|
OVERALL,
|
||||||
|
SKILL,
|
||||||
|
ACTIVITY,
|
||||||
|
BOSS
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
|
import lombok.Value;
|
||||||
|
|
||||||
|
@Value
|
||||||
|
public class Skill
|
||||||
|
{
|
||||||
|
int rank;
|
||||||
|
int level;
|
||||||
|
long experience;
|
||||||
|
}
|
||||||
@@ -82,6 +82,11 @@ import net.runelite.client.config.RuneLiteConfig;
|
|||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.events.ChatInput;
|
import net.runelite.client.events.ChatInput;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.hiscore.HiscoreClient;
|
||||||
|
import net.runelite.client.hiscore.HiscoreEndpoint;
|
||||||
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
|
import net.runelite.client.hiscore.HiscoreSkill;
|
||||||
|
import net.runelite.client.hiscore.Skill;
|
||||||
import net.runelite.client.input.KeyManager;
|
import net.runelite.client.input.KeyManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -90,12 +95,6 @@ import net.runelite.client.util.QuantityFormatter;
|
|||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.chat.ChatClient;
|
import net.runelite.http.api.chat.ChatClient;
|
||||||
import net.runelite.http.api.chat.Duels;
|
import net.runelite.http.api.chat.Duels;
|
||||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreSkill;
|
|
||||||
import net.runelite.http.api.hiscore.SingleHiscoreSkillResult;
|
|
||||||
import net.runelite.http.api.hiscore.Skill;
|
|
||||||
import net.runelite.http.api.item.ItemPrice;
|
import net.runelite.http.api.item.ItemPrice;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import org.apache.commons.text.WordUtils;
|
import org.apache.commons.text.WordUtils;
|
||||||
@@ -1372,16 +1371,14 @@ public class ChatCommandsPlugin extends Plugin
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final SingleHiscoreSkillResult result = hiscoreClient.lookup(lookup.getName(), skill, lookup.getEndpoint());
|
final HiscoreResult result = hiscoreClient.lookup(lookup.getName(), lookup.getEndpoint());
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
log.warn("unable to look up skill {} for {}: not found", skill, search);
|
log.warn("unable to look up skill {} for {}: not found", skill, search);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Skill hiscoreSkill = result.getSkill();
|
final Skill hiscoreSkill = result.getSkill(skill);
|
||||||
|
|
||||||
ChatMessageBuilder chatMessageBuilder = new ChatMessageBuilder()
|
ChatMessageBuilder chatMessageBuilder = new ChatMessageBuilder()
|
||||||
.append(ChatColorType.NORMAL)
|
.append(ChatColorType.NORMAL)
|
||||||
.append("Level ")
|
.append("Level ")
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ import net.runelite.client.util.Text;
|
|||||||
import net.runelite.http.api.ge.GrandExchangeClient;
|
import net.runelite.http.api.ge.GrandExchangeClient;
|
||||||
import net.runelite.http.api.ge.GrandExchangeTrade;
|
import net.runelite.http.api.ge.GrandExchangeTrade;
|
||||||
import net.runelite.http.api.item.ItemStats;
|
import net.runelite.http.api.item.ItemStats;
|
||||||
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
|
|
||||||
import net.runelite.http.api.worlds.WorldType;
|
import net.runelite.http.api.worlds.WorldType;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||||
@@ -260,12 +259,6 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
return configManager.getConfig(GrandExchangeConfig.class);
|
return configManager.getConfig(GrandExchangeConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
OSBGrandExchangeClient provideOsbGrandExchangeClient(OkHttpClient okHttpClient)
|
|
||||||
{
|
|
||||||
return new OSBGrandExchangeClient(okHttpClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
GrandExchangeClient provideGrandExchangeClient(OkHttpClient okHttpClient)
|
GrandExchangeClient provideGrandExchangeClient(OkHttpClient okHttpClient)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,13 +61,13 @@ import net.runelite.client.ui.components.materialtabs.MaterialTab;
|
|||||||
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
|
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.QuantityFormatter;
|
import net.runelite.client.util.QuantityFormatter;
|
||||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
import net.runelite.client.hiscore.HiscoreClient;
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
import net.runelite.client.hiscore.HiscoreEndpoint;
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
import net.runelite.http.api.hiscore.HiscoreSkill;
|
import net.runelite.client.hiscore.HiscoreSkill;
|
||||||
import static net.runelite.http.api.hiscore.HiscoreSkill.*;
|
import static net.runelite.client.hiscore.HiscoreSkill.*;
|
||||||
import net.runelite.http.api.hiscore.HiscoreSkillType;
|
import net.runelite.client.hiscore.HiscoreSkillType;
|
||||||
import net.runelite.http.api.hiscore.Skill;
|
import net.runelite.client.hiscore.Skill;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import net.runelite.client.ui.ClientToolbar;
|
|||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
import net.runelite.client.hiscore.HiscoreEndpoint;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "HiScore",
|
name = "HiScore",
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import net.runelite.api.ParamID;
|
|||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.VarPlayer;
|
import net.runelite.api.VarPlayer;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.client.game.HiscoreManager;
|
import net.runelite.client.hiscore.HiscoreManager;
|
||||||
import net.runelite.client.game.NPCManager;
|
import net.runelite.client.game.NPCManager;
|
||||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||||
@@ -53,7 +53,7 @@ import net.runelite.client.ui.overlay.components.ComponentConstants;
|
|||||||
import net.runelite.client.ui.overlay.components.ProgressBarComponent;
|
import net.runelite.client.ui.overlay.components.ProgressBarComponent;
|
||||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
|
|
||||||
class OpponentInfoOverlay extends OverlayPanel
|
class OpponentInfoOverlay extends OverlayPanel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ import net.runelite.client.eventbus.Subscribe;
|
|||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
import net.runelite.client.hiscore.HiscoreEndpoint;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Opponent Information",
|
name = "Opponent Information",
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import net.runelite.api.Client;
|
|||||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.client.game.HiscoreManager;
|
import net.runelite.client.hiscore.HiscoreManager;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||||
@@ -44,8 +44,8 @@ import net.runelite.client.ui.overlay.components.LineComponent;
|
|||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
import net.runelite.http.api.hiscore.HiscoreSkill;
|
import net.runelite.client.hiscore.HiscoreSkill;
|
||||||
|
|
||||||
class PlayerComparisonOverlay extends Overlay
|
class PlayerComparisonOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -153,7 +153,7 @@ class PlayerComparisonOverlay extends Overlay
|
|||||||
final HiscoreSkill hiscoreSkill = HISCORE_COMBAT_SKILLS[i];
|
final HiscoreSkill hiscoreSkill = HISCORE_COMBAT_SKILLS[i];
|
||||||
final Skill skill = COMBAT_SKILLS[i];
|
final Skill skill = COMBAT_SKILLS[i];
|
||||||
|
|
||||||
final net.runelite.http.api.hiscore.Skill opponentSkill = opponentSkills.getSkill(hiscoreSkill);
|
final net.runelite.client.hiscore.Skill opponentSkill = opponentSkills.getSkill(hiscoreSkill);
|
||||||
|
|
||||||
if (opponentSkill == null || opponentSkill.getLevel() == -1)
|
if (opponentSkill == null || opponentSkill.getLevel() == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,13 +58,13 @@ import net.runelite.api.events.GameStateChanged;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.events.ConfigChanged;
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.game.HiscoreManager;
|
import net.runelite.client.hiscore.HiscoreManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
import net.runelite.client.hiscore.HiscoreEndpoint;
|
||||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
import net.runelite.http.api.hiscore.Skill;
|
import net.runelite.client.hiscore.Skill;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Player-owned House",
|
name = "Player-owned House",
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ public abstract class WidgetItemOverlay extends Overlay
|
|||||||
protected void showOnBank()
|
protected void showOnBank()
|
||||||
{
|
{
|
||||||
drawAfterLayer(WidgetInfo.BANK_ITEM_CONTAINER);
|
drawAfterLayer(WidgetInfo.BANK_ITEM_CONTAINER);
|
||||||
|
drawAfterLayer(WidgetInfo.GROUP_STORAGE_ITEM_CONTAINER);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showOnEquipment()
|
protected void showOnEquipment()
|
||||||
|
|||||||
@@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.hiscore;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
|
import okhttp3.mockwebserver.MockResponse;
|
||||||
|
import okhttp3.mockwebserver.MockWebServer;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class HiscoreClientTest
|
||||||
|
{
|
||||||
|
private static final String RESPONSE = "654683,705,1304518\n"
|
||||||
|
+ "679419,50,107181\n"
|
||||||
|
+ "550667,48,85764\n"
|
||||||
|
+ "861497,50,101366\n"
|
||||||
|
+ "891591,48,87843\n"
|
||||||
|
+ "-1,1,4\n"
|
||||||
|
+ "840255,27,10073\n"
|
||||||
|
+ "1371912,10,1310\n"
|
||||||
|
+ "432193,56,199795\n"
|
||||||
|
+ "495638,56,198304\n"
|
||||||
|
+ "514466,37,27502\n"
|
||||||
|
+ "456981,54,159727\n"
|
||||||
|
+ "459159,49,93010\n"
|
||||||
|
+ "1028855,8,823\n"
|
||||||
|
+ "862906,29,12749\n"
|
||||||
|
+ "795020,31,16097\n"
|
||||||
|
+ "673591,5,495\n"
|
||||||
|
+ "352676,51,112259\n"
|
||||||
|
+ "428419,40,37235\n"
|
||||||
|
+ "461887,43,51971\n"
|
||||||
|
+ "598582,1,10\n"
|
||||||
|
+ "638177,1,0\n"
|
||||||
|
+ "516239,9,1000\n"
|
||||||
|
+ "492790,1,0\n"
|
||||||
|
+ "2,2460\n" // leagues
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "73,1738\n"
|
||||||
|
+ "531,1432\n"
|
||||||
|
+ "324,212\n"
|
||||||
|
+ "8008,131\n"
|
||||||
|
+ "1337,911\n"
|
||||||
|
+ "42,14113\n"
|
||||||
|
+ "1,777\n"
|
||||||
|
+ "254,92\n"
|
||||||
|
+ "-1,-1\n" // lms
|
||||||
|
+ "1,241\n" // soul wars
|
||||||
|
+ "24870,37\n"
|
||||||
|
+ "15020,388\n"
|
||||||
|
+ "50463,147\n"
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "92357,1\n"
|
||||||
|
+ "22758,637\n"
|
||||||
|
+ "22744,107\n"
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "20150,17\n"
|
||||||
|
+ "29400,18\n"
|
||||||
|
+ "13465,172\n"
|
||||||
|
+ "1889,581\n"
|
||||||
|
+ "42891,11\n"
|
||||||
|
+ "1624,1957\n"
|
||||||
|
+ "1243,2465\n"
|
||||||
|
+ "1548,2020\n"
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "16781,327\n"
|
||||||
|
+ "19004,149\n"
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "72046,5\n"
|
||||||
|
+ "5158,374\n"
|
||||||
|
+ "20902,279\n"
|
||||||
|
+ "702,6495\n"
|
||||||
|
+ "10170,184\n"
|
||||||
|
+ "8064,202\n"
|
||||||
|
+ "6936,2\n" // Mimic
|
||||||
|
+ "1,4920\n" // Nex
|
||||||
|
+ "2335,9\n" // Nightmare
|
||||||
|
+ "2336,10\n" // Phosanis Nightmare
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "19779,22\n"
|
||||||
|
+ "58283,10\n"
|
||||||
|
+ "1234,5678\n" // Tempoross
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "-1,-1\n"
|
||||||
|
+ "-1,-1\n" // TOB
|
||||||
|
+ "42,42\n" // TOB: Hard Mode
|
||||||
|
+ "29347,130\n"
|
||||||
|
+ "723,4\n"
|
||||||
|
+ "1264,38\n"
|
||||||
|
+ "44595,4\n"
|
||||||
|
+ "24820,4\n"
|
||||||
|
+ "12116,782\n"
|
||||||
|
+ "2299,724\n"
|
||||||
|
+ "19301,62\n"
|
||||||
|
+ "1498,5847\n";
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public final MockWebServer server = new MockWebServer();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before() throws IOException
|
||||||
|
{
|
||||||
|
server.enqueue(new MockResponse().setBody(RESPONSE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNormalLookup() throws Exception
|
||||||
|
{
|
||||||
|
HiscoreClient hiscoreClient = new HiscoreClient(RuneLiteAPI.CLIENT);
|
||||||
|
|
||||||
|
HiscoreResult result = hiscoreClient.lookup("zezima", server.url("/"));
|
||||||
|
|
||||||
|
assertEquals(50, result.getAttack().getLevel());
|
||||||
|
assertEquals(159727L, result.getFishing().getExperience());
|
||||||
|
assertEquals(492790, result.getConstruction().getRank());
|
||||||
|
assertEquals(1432, result.getClueScrollAll().getLevel());
|
||||||
|
assertEquals(324, result.getClueScrollBeginner().getRank());
|
||||||
|
assertEquals(8008, result.getClueScrollEasy().getRank());
|
||||||
|
assertEquals(911, result.getClueScrollMedium().getLevel());
|
||||||
|
assertEquals(42, result.getClueScrollHard().getRank());
|
||||||
|
assertEquals(777, result.getClueScrollElite().getLevel());
|
||||||
|
assertEquals(254, result.getClueScrollMaster().getRank());
|
||||||
|
assertEquals(-1, result.getLastManStanding().getLevel());
|
||||||
|
assertEquals(241, result.getSoulWarsZeal().getLevel());
|
||||||
|
assertEquals(2460, result.getLeaguePoints().getLevel());
|
||||||
|
assertEquals(37, result.getAbyssalSire().getLevel());
|
||||||
|
assertEquals(92357, result.getCallisto().getRank());
|
||||||
|
assertEquals(4920, result.getNex().getLevel());
|
||||||
|
assertEquals(2336, result.getPhosanisNightmare().getRank());
|
||||||
|
assertEquals(5678, result.getTempoross().getLevel());
|
||||||
|
assertEquals(42, result.getTheatreOfBloodHardMode().getLevel());
|
||||||
|
assertEquals(5847, result.getZulrah().getLevel());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,17 +54,19 @@ import net.runelite.client.chat.ChatMessageManager;
|
|||||||
import net.runelite.client.config.ChatColorConfig;
|
import net.runelite.client.config.ChatColorConfig;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.config.RuneLiteConfig;
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
|
import net.runelite.client.hiscore.HiscoreClient;
|
||||||
|
import net.runelite.client.hiscore.HiscoreEndpoint;
|
||||||
|
import net.runelite.client.hiscore.HiscoreResult;
|
||||||
|
import net.runelite.client.hiscore.Skill;
|
||||||
import net.runelite.http.api.RuneLiteAPI;
|
import net.runelite.http.api.RuneLiteAPI;
|
||||||
import net.runelite.http.api.chat.ChatClient;
|
import net.runelite.http.api.chat.ChatClient;
|
||||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
|
||||||
import net.runelite.http.api.hiscore.HiscoreSkill;
|
|
||||||
import net.runelite.http.api.hiscore.SingleHiscoreSkillResult;
|
|
||||||
import net.runelite.http.api.hiscore.Skill;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.ArgumentMatchers.nullable;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import static org.mockito.Mockito.any;
|
import static org.mockito.Mockito.any;
|
||||||
import static org.mockito.Mockito.atLeastOnce;
|
import static org.mockito.Mockito.atLeastOnce;
|
||||||
@@ -545,11 +547,11 @@ public class ChatCommandsPluginTest
|
|||||||
{
|
{
|
||||||
when(chatCommandsConfig.lvl()).thenReturn(true);
|
when(chatCommandsConfig.lvl()).thenReturn(true);
|
||||||
|
|
||||||
SingleHiscoreSkillResult skillResult = new SingleHiscoreSkillResult();
|
HiscoreResult hiscoreResult = new HiscoreResult();
|
||||||
skillResult.setPlayer(PLAYER_NAME);
|
hiscoreResult.setPlayer(PLAYER_NAME);
|
||||||
skillResult.setSkill(new Skill(10, 1000, -1));
|
hiscoreResult.setZulrah(new Skill(10, 1000, -1));
|
||||||
|
|
||||||
when(hiscoreClient.lookup(PLAYER_NAME, HiscoreSkill.ZULRAH, null)).thenReturn(skillResult);
|
when(hiscoreClient.lookup(eq(PLAYER_NAME), nullable(HiscoreEndpoint.class))).thenReturn(hiscoreResult);
|
||||||
|
|
||||||
MessageNode messageNode = mock(MessageNode.class);
|
MessageNode messageNode = mock(MessageNode.class);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ import static net.runelite.client.plugins.grandexchange.GrandExchangePlugin.find
|
|||||||
import static net.runelite.http.api.RuneLiteAPI.GSON;
|
import static net.runelite.http.api.RuneLiteAPI.GSON;
|
||||||
import net.runelite.http.api.ge.GrandExchangeClient;
|
import net.runelite.http.api.ge.GrandExchangeClient;
|
||||||
import net.runelite.http.api.ge.GrandExchangeTrade;
|
import net.runelite.http.api.ge.GrandExchangeTrade;
|
||||||
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
@@ -112,10 +111,6 @@ public class GrandExchangePluginTest
|
|||||||
@Bind
|
@Bind
|
||||||
private GrandExchangeClient grandExchangeClient;
|
private GrandExchangeClient grandExchangeClient;
|
||||||
|
|
||||||
@Mock
|
|
||||||
@Bind
|
|
||||||
private OSBGrandExchangeClient osbGrandExchangeClient;
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@Bind
|
@Bind
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
package net.runelite.client.plugins.hiscore;
|
package net.runelite.client.plugins.hiscore;
|
||||||
|
|
||||||
import static net.runelite.client.plugins.hiscore.HiscorePanel.formatLevel;
|
import static net.runelite.client.plugins.hiscore.HiscorePanel.formatLevel;
|
||||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
import net.runelite.client.hiscore.HiscoreEndpoint;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
Reference in New Issue
Block a user