diff --git a/http-api/pom.xml b/http-api/pom.xml
index cbb637626e..bba80a65f8 100644
--- a/http-api/pom.xml
+++ b/http-api/pom.xml
@@ -58,11 +58,6 @@
lombokprovided
-
- org.apache.commons
- commons-csv
- 1.4
- junit
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/SingleHiscoreSkillResult.java b/http-api/src/main/java/net/runelite/http/api/hiscore/SingleHiscoreSkillResult.java
deleted file mode 100644
index c2ab3407a1..0000000000
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/SingleHiscoreSkillResult.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2017. l2-
- * 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.http.api.hiscore;
-
-import java.util.Objects;
-
-public class SingleHiscoreSkillResult
-{
- private String player;
- private String skillName;
- private Skill skill;
-
- public String getPlayer()
- {
- return player;
- }
-
- public void setPlayer(String player)
- {
- this.player = player;
- }
-
- public String getSkillName()
- {
- return skillName;
- }
-
- public void setSkillName(String skillName)
- {
- this.skillName = skillName;
- }
-
- public Skill getSkill()
- {
- return skill;
- }
-
- public void setSkill(Skill skill)
- {
- this.skill = skill;
- }
-
- @Override
- public int hashCode()
- {
- int hash = 7;
- hash = 37 * hash + Objects.hashCode(this.player);
- hash = 37 * hash + Objects.hashCode(this.skillName);
- hash = 37 * hash + Objects.hashCode(this.skill);
- return hash;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- final SingleHiscoreSkillResult other = (SingleHiscoreSkillResult) obj;
- if (!Objects.equals(this.player, other.player))
- {
- return false;
- }
- if (!Objects.equals(this.skillName, other.skillName))
- {
- return false;
- }
- if (!Objects.equals(this.skill, other.skill))
- {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString()
- {
- return "SingleHiscoreSkillResult{" + "player=" + player + ", skillName=" + skillName + ", skill=" + skill + '}';
- }
-}
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/Skill.java b/http-api/src/main/java/net/runelite/http/api/hiscore/Skill.java
deleted file mode 100644
index fa779381bc..0000000000
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/Skill.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2017, Adam
- * 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.http.api.hiscore;
-
-public class Skill
-{
- private final int rank;
- private final int level;
- private final long experience;
-
- public Skill(int rank, int level, long experience)
- {
- this.rank = rank;
- this.level = level;
- this.experience = experience;
- }
-
- public int getRank()
- {
- return rank;
- }
-
- public int getLevel()
- {
- return level;
- }
-
- public long getExperience()
- {
- return experience;
- }
-
- @Override
- public int hashCode()
- {
- int hash = 3;
- hash = 59 * hash + this.rank;
- hash = 59 * hash + this.level;
- hash = 59 * hash + (int) (this.experience ^ (this.experience >>> 32));
- return hash;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- {
- return true;
- }
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- final Skill other = (Skill) obj;
- if (this.rank != other.rank)
- {
- return false;
- }
- if (this.level != other.level)
- {
- return false;
- }
- if (this.experience != other.experience)
- {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString()
- {
- return "Skill{" + "rank=" + rank + ", level=" + level + ", experience=" + experience + '}';
- }
-}
diff --git a/http-api/src/main/java/net/runelite/http/api/xp/XpData.java b/http-api/src/main/java/net/runelite/http/api/xp/XpData.java
deleted file mode 100644
index 348faa5c78..0000000000
--- a/http-api/src/main/java/net/runelite/http/api/xp/XpData.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2018, Adam
- * 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.http.api.xp;
-
-import java.time.Instant;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-@Data
-@EqualsAndHashCode(exclude = "time")
-public class XpData
-{
- private Instant time;
-
- private int attack_xp;
- private int defence_xp;
- private int strength_xp;
- private int hitpoints_xp;
- private int ranged_xp;
- private int prayer_xp;
- private int magic_xp;
- private int cooking_xp;
- private int woodcutting_xp;
- private int fletching_xp;
- private int fishing_xp;
- private int firemaking_xp;
- private int crafting_xp;
- private int smithing_xp;
- private int mining_xp;
- private int herblore_xp;
- private int agility_xp;
- private int thieving_xp;
- private int slayer_xp;
- private int farming_xp;
- private int runecraft_xp;
- private int hunter_xp;
- private int construction_xp;
-
- private int overall_rank;
- private int attack_rank;
- private int defence_rank;
- private int strength_rank;
- private int hitpoints_rank;
- private int ranged_rank;
- private int prayer_rank;
- private int magic_rank;
- private int cooking_rank;
- private int woodcutting_rank;
- private int fletching_rank;
- private int fishing_rank;
- private int firemaking_rank;
- private int crafting_rank;
- private int smithing_rank;
- private int mining_rank;
- private int herblore_rank;
- private int agility_rank;
- private int thieving_rank;
- private int slayer_rank;
- private int farming_rank;
- private int runecraft_rank;
- private int hunter_rank;
- private int construction_rank;
-}
diff --git a/http-service/pom.xml b/http-service/pom.xml
index 9c34fb8984..2664f354a4 100644
--- a/http-service/pom.xml
+++ b/http-service/pom.xml
@@ -37,7 +37,6 @@
1.5.6.RELEASE
- 1.4.2.Final
@@ -60,11 +59,6 @@
spring-jdbc
-
- org.mapstruct
- mapstruct
- ${mapstruct.version}
- org.projectlomboklombok
@@ -163,31 +157,6 @@
runelite-${project.version}
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.8
- 1.8
-
-
- org.mapstruct
- mapstruct-processor
- ${mapstruct.version}
-
-
- org.projectlombok
- lombok-mapstruct-binding
- 0.2.0
-
-
- org.projectlombok
- lombok
- ${lombok.version}
-
-
-
- org.apache.maven.pluginsmaven-war-plugin
diff --git a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java
index 177561cf59..c4d46210b8 100644
--- a/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java
+++ b/http-service/src/main/java/net/runelite/http/service/SpringBootWebApplication.java
@@ -118,13 +118,6 @@ public class SpringBootWebApplication extends SpringBootServletInitializer
return new DataSourceProperties();
}
- @ConfigurationProperties(prefix = "datasource.runelite-tracker")
- @Bean("dataSourceRuneLiteTracker")
- public DataSourceProperties dataSourcePropertiesTracker()
- {
- return new DataSourceProperties();
- }
-
@Bean(value = "runelite", destroyMethod = "")
public DataSource runeliteDataSource(@Qualifier("dataSourceRuneLite") DataSourceProperties dataSourceProperties)
{
@@ -137,12 +130,6 @@ public class SpringBootWebApplication extends SpringBootServletInitializer
return getDataSource(dataSourceProperties);
}
- @Bean(value = "runelite-tracker", destroyMethod = "")
- public DataSource runeliteTrackerDataSource(@Qualifier("dataSourceRuneLiteTracker") DataSourceProperties dataSourceProperties)
- {
- return getDataSource(dataSourceProperties);
- }
-
@Bean("Runelite SQL2O")
public Sql2o sql2o(@Qualifier("runelite") DataSource dataSource)
{
@@ -155,12 +142,6 @@ public class SpringBootWebApplication extends SpringBootServletInitializer
return createSql2oFromDataSource(dataSource);
}
- @Bean("Runelite XP Tracker SQL2O")
- public Sql2o trackerSql2o(@Qualifier("runelite-tracker") DataSource dataSource)
- {
- return createSql2oFromDataSource(dataSource);
- }
-
@Bean(destroyMethod = "")
public MongoClient mongoClient(@Value("${mongo.host:}") String host, @Value("${mongo.jndiName:}") String jndiName) throws NamingException
{
diff --git a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreController.java b/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreController.java
deleted file mode 100644
index 25a89e6a8d..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreController.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2017, Adam
- * 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.http.service.hiscore;
-
-import java.util.concurrent.ExecutionException;
-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.service.util.HiscoreEndpointEditor;
-import net.runelite.http.service.xp.XpTrackerService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.InitBinder;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/hiscore")
-public class HiscoreController
-{
- @Autowired
- private HiscoreService hiscoreService;
-
- @Autowired
- private XpTrackerService xpTrackerService;
-
- @GetMapping("/{endpoint}")
- public HiscoreResult lookup(@PathVariable HiscoreEndpoint endpoint, @RequestParam String username) throws ExecutionException
- {
- HiscoreResult result = hiscoreService.lookupUsername(username, endpoint);
-
- // Submit to xp tracker?
- switch (endpoint)
- {
- case NORMAL:
- case IRONMAN:
- case ULTIMATE_IRONMAN:
- case HARDCORE_IRONMAN:
- xpTrackerService.update(username, result);
- }
-
- return result;
- }
-
- @GetMapping("/{endpoint}/{skillName}")
- public SingleHiscoreSkillResult singleSkillLookup(@PathVariable HiscoreEndpoint endpoint, @PathVariable String skillName, @RequestParam String username) throws ExecutionException
- {
- HiscoreSkill skill = HiscoreSkill.valueOf(skillName.toUpperCase());
-
- // RS api only supports looking up all stats
- HiscoreResult result = hiscoreService.lookupUsername(username, endpoint);
-
- // Find the skill to return
- Skill requested = result.getSkill(skill);
-
- SingleHiscoreSkillResult skillResult = new SingleHiscoreSkillResult();
- skillResult.setPlayer(username);
- skillResult.setSkillName(skillName);
- skillResult.setSkill(requested);
-
- return skillResult;
- }
-
- @InitBinder
- public void initBinder(WebDataBinder binder)
- {
- binder.registerCustomEditor(HiscoreEndpoint.class, new HiscoreEndpointEditor());
- }
-}
diff --git a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreKey.java b/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreKey.java
deleted file mode 100644
index b15603a224..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreKey.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2018, Adam
- * 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.http.service.hiscore;
-
-import lombok.Value;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
-
-@Value
-class HiscoreKey
-{
- String username;
- HiscoreEndpoint endpoint;
-}
diff --git a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreService.java b/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreService.java
deleted file mode 100644
index fd73e17359..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/hiscore/HiscoreService.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2017, Adam
- * 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.http.service.hiscore;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import net.runelite.http.api.RuneLiteAPI;
-import net.runelite.http.api.hiscore.HiscoreClient;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
-import net.runelite.http.api.hiscore.HiscoreResult;
-import okhttp3.HttpUrl;
-import org.springframework.stereotype.Service;
-
-@Service
-public class HiscoreService
-{
- private final HiscoreClient hiscoreClient = new HiscoreClient(RuneLiteAPI.CLIENT);
- private final LoadingCache hiscoreCache = CacheBuilder.newBuilder()
- .maximumSize(128)
- .expireAfterWrite(1, TimeUnit.MINUTES)
- .build(
- new CacheLoader()
- {
- @Override
- public HiscoreResult load(HiscoreKey key) throws IOException
- {
- return hiscoreClient.lookup(key.getUsername(), key.getEndpoint());
- }
- });
-
- @VisibleForTesting
- HiscoreResult lookupUsername(String username, HttpUrl httpUrl) throws IOException
- {
- return hiscoreClient.lookup(username, httpUrl);
- }
-
- public HiscoreResult lookupUsername(String username, HiscoreEndpoint endpoint) throws ExecutionException
- {
- return hiscoreCache.get(new HiscoreKey(username, endpoint));
- }
-}
diff --git a/http-service/src/main/java/net/runelite/http/service/util/HiscoreEndpointEditor.java b/http-service/src/main/java/net/runelite/http/service/util/HiscoreEndpointEditor.java
deleted file mode 100644
index 816981f99a..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/util/HiscoreEndpointEditor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, Adam
- * 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.http.service.util;
-
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
-
-import java.beans.PropertyEditorSupport;
-
-public class HiscoreEndpointEditor extends PropertyEditorSupport
-{
- @Override
- public void setAsText(String text) throws IllegalArgumentException
- {
- setValue(HiscoreEndpoint.valueOf(text.toUpperCase()));
- }
-}
diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpMapper.java b/http-service/src/main/java/net/runelite/http/service/xp/XpMapper.java
deleted file mode 100644
index 068c6e5438..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/xp/XpMapper.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018, Adam
- * 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.http.service.xp;
-
-import net.runelite.http.api.hiscore.HiscoreResult;
-import net.runelite.http.api.xp.XpData;
-import net.runelite.http.service.xp.beans.XpEntity;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.factory.Mappers;
-
-@Mapper
-public interface XpMapper
-{
- XpMapper INSTANCE = Mappers.getMapper(XpMapper.class);
-
- XpData xpEntityToXpData(XpEntity xpEntity);
-
- @Mapping(target = "time", ignore = true)
-
- @Mapping(source = "attack.experience", target = "attack_xp")
- @Mapping(source = "defence.experience", target = "defence_xp")
- @Mapping(source = "strength.experience", target = "strength_xp")
- @Mapping(source = "hitpoints.experience", target = "hitpoints_xp")
- @Mapping(source = "ranged.experience", target = "ranged_xp")
- @Mapping(source = "prayer.experience", target = "prayer_xp")
- @Mapping(source = "magic.experience", target = "magic_xp")
- @Mapping(source = "cooking.experience", target = "cooking_xp")
- @Mapping(source = "woodcutting.experience", target = "woodcutting_xp")
- @Mapping(source = "fletching.experience", target = "fletching_xp")
- @Mapping(source = "fishing.experience", target = "fishing_xp")
- @Mapping(source = "firemaking.experience", target = "firemaking_xp")
- @Mapping(source = "crafting.experience", target = "crafting_xp")
- @Mapping(source = "smithing.experience", target = "smithing_xp")
- @Mapping(source = "mining.experience", target = "mining_xp")
- @Mapping(source = "herblore.experience", target = "herblore_xp")
- @Mapping(source = "agility.experience", target = "agility_xp")
- @Mapping(source = "thieving.experience", target = "thieving_xp")
- @Mapping(source = "slayer.experience", target = "slayer_xp")
- @Mapping(source = "farming.experience", target = "farming_xp")
- @Mapping(source = "runecraft.experience", target = "runecraft_xp")
- @Mapping(source = "hunter.experience", target = "hunter_xp")
- @Mapping(source = "construction.experience", target = "construction_xp")
-
- @Mapping(source = "overall.rank", target = "overall_rank")
- @Mapping(source = "attack.rank", target = "attack_rank")
- @Mapping(source = "defence.rank", target = "defence_rank")
- @Mapping(source = "strength.rank", target = "strength_rank")
- @Mapping(source = "hitpoints.rank", target = "hitpoints_rank")
- @Mapping(source = "ranged.rank", target = "ranged_rank")
- @Mapping(source = "prayer.rank", target = "prayer_rank")
- @Mapping(source = "magic.rank", target = "magic_rank")
- @Mapping(source = "cooking.rank", target = "cooking_rank")
- @Mapping(source = "woodcutting.rank", target = "woodcutting_rank")
- @Mapping(source = "fletching.rank", target = "fletching_rank")
- @Mapping(source = "fishing.rank", target = "fishing_rank")
- @Mapping(source = "firemaking.rank", target = "firemaking_rank")
- @Mapping(source = "crafting.rank", target = "crafting_rank")
- @Mapping(source = "smithing.rank", target = "smithing_rank")
- @Mapping(source = "mining.rank", target = "mining_rank")
- @Mapping(source = "herblore.rank", target = "herblore_rank")
- @Mapping(source = "agility.rank", target = "agility_rank")
- @Mapping(source = "thieving.rank", target = "thieving_rank")
- @Mapping(source = "slayer.rank", target = "slayer_rank")
- @Mapping(source = "farming.rank", target = "farming_rank")
- @Mapping(source = "runecraft.rank", target = "runecraft_rank")
- @Mapping(source = "hunter.rank", target = "hunter_rank")
- @Mapping(source = "construction.rank", target = "construction_rank")
- XpData hiscoreResultToXpData(HiscoreResult hiscoreResult);
-}
diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerController.java b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerController.java
deleted file mode 100644
index d247d735a4..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerController.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2018, Adam
- * 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.http.service.xp;
-
-import java.time.Instant;
-import net.runelite.http.api.xp.XpData;
-import net.runelite.http.service.xp.beans.XpEntity;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/xp")
-public class XpTrackerController
-{
- @Autowired
- private XpTrackerService xpTrackerService;
-
- @GetMapping("/update")
- public void update(@RequestParam String username)
- {
- xpTrackerService.tryUpdate(username);
- }
-
- @GetMapping("/get")
- public XpData get(@RequestParam String username, @RequestParam(required = false) Instant time)
- {
- if (time == null)
- {
- time = Instant.now();
- }
- XpEntity xpEntity = xpTrackerService.findXpAtTime(username, time);
- return XpMapper.INSTANCE.xpEntityToXpData(xpEntity);
- }
-}
diff --git a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java b/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java
deleted file mode 100644
index 9e8e0a5e06..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/xp/XpTrackerService.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
- * Copyright (c) 2018, Adam
- * 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.http.service.xp;
-
-import com.google.common.hash.BloomFilter;
-import com.google.common.hash.Funnels;
-import java.nio.charset.Charset;
-import java.time.Duration;
-import java.time.Instant;
-import java.util.ArrayDeque;
-import java.util.Queue;
-import java.util.concurrent.ExecutionException;
-import lombok.extern.slf4j.Slf4j;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
-import net.runelite.http.api.hiscore.HiscoreResult;
-import net.runelite.http.api.xp.XpData;
-import net.runelite.http.service.hiscore.HiscoreService;
-import net.runelite.http.service.xp.beans.PlayerEntity;
-import net.runelite.http.service.xp.beans.XpEntity;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Service;
-import org.sql2o.Connection;
-import org.sql2o.Sql2o;
-
-@Service
-@Slf4j
-public class XpTrackerService
-{
- private static final int QUEUE_LIMIT = 32768;
- private static final int BLOOMFILTER_EXPECTED_INSERTIONS = 100_000;
-
- @Autowired
- @Qualifier("Runelite XP Tracker SQL2O")
- private Sql2o sql2o;
-
- @Autowired
- private HiscoreService hiscoreService;
-
- private final Queue usernameUpdateQueue = new ArrayDeque<>();
- private BloomFilter usernameFilter = createFilter();
-
- public void update(String username) throws ExecutionException
- {
- HiscoreResult hiscoreResult = hiscoreService.lookupUsername(username, HiscoreEndpoint.NORMAL);
- update(username, hiscoreResult);
- }
-
- public void tryUpdate(String username)
- {
- if (usernameFilter.mightContain(username))
- {
- return;
- }
-
- try (Connection con = sql2o.open())
- {
- PlayerEntity playerEntity = findOrCreatePlayer(con, username);
- Duration frequency = updateFrequency(playerEntity);
- Instant now = Instant.now();
- Duration timeSinceLastUpdate = Duration.between(playerEntity.getLast_updated(), now);
- if (timeSinceLastUpdate.toMillis() < frequency.toMillis())
- {
- log.debug("User {} updated too recently", username);
- usernameFilter.put(username);
- return;
- }
-
- synchronized (usernameUpdateQueue)
- {
- if (usernameUpdateQueue.size() >= QUEUE_LIMIT)
- {
- log.warn("Username update queue is full ({})", QUEUE_LIMIT);
- return;
- }
-
- usernameUpdateQueue.add(username);
- }
- }
-
- usernameFilter.put(username);
- }
-
- public void update(String username, HiscoreResult hiscoreResult)
- {
- try (Connection con = sql2o.open())
- {
- PlayerEntity playerEntity = findOrCreatePlayer(con, username);
-
- Instant now = Instant.now();
- XpEntity currentXp = findXpAtTime(con, username, now);
- if (currentXp != null)
- {
- XpData hiscoreData = XpMapper.INSTANCE.hiscoreResultToXpData(hiscoreResult);
- XpData existingData = XpMapper.INSTANCE.xpEntityToXpData(currentXp);
-
- if (hiscoreData.equals(existingData))
- {
- log.debug("Hiscore for {} already up to date", username);
- return;
- }
- }
-
- con.createQuery("insert into xp (player,attack_xp,defence_xp,strength_xp,hitpoints_xp,ranged_xp,prayer_xp,magic_xp,cooking_xp,woodcutting_xp,"
- + "fletching_xp,fishing_xp,firemaking_xp,crafting_xp,smithing_xp,mining_xp,herblore_xp,agility_xp,thieving_xp,slayer_xp,farming_xp,"
- + "runecraft_xp,hunter_xp,construction_xp,attack_rank,defence_rank,strength_rank,hitpoints_rank,ranged_rank,prayer_rank,magic_rank,"
- + "cooking_rank,woodcutting_rank,fletching_rank,fishing_rank,firemaking_rank,crafting_rank,smithing_rank,mining_rank,herblore_rank,"
- + "agility_rank,thieving_rank,slayer_rank,farming_rank,runecraft_rank,hunter_rank,construction_rank,overall_rank) values (:player,:attack_xp,:defence_xp,"
- + ":strength_xp,:hitpoints_xp,:ranged_xp,:prayer_xp,:magic_xp,:cooking_xp,:woodcutting_xp,:fletching_xp,:fishing_xp,:firemaking_xp,"
- + ":crafting_xp,:smithing_xp,:mining_xp,:herblore_xp,:agility_xp,:thieving_xp,:slayer_xp,:farming_xp,:runecraft_xp,:hunter_xp,"
- + ":construction_xp,:attack_rank,:defence_rank,:strength_rank,:hitpoints_rank,:ranged_rank,:prayer_rank,:magic_rank,:cooking_rank,"
- + ":woodcutting_rank,:fletching_rank,:fishing_rank,:firemaking_rank,:crafting_rank,:smithing_rank,:mining_rank,:herblore_rank,"
- + ":agility_rank,:thieving_rank,:slayer_rank,:farming_rank,:runecraft_rank,:hunter_rank,:construction_rank,:overall_rank)")
- .addParameter("player", playerEntity.getId())
- .addParameter("attack_xp", hiscoreResult.getAttack().getExperience())
- .addParameter("defence_xp", hiscoreResult.getDefence().getExperience())
- .addParameter("strength_xp", hiscoreResult.getStrength().getExperience())
- .addParameter("hitpoints_xp", hiscoreResult.getHitpoints().getExperience())
- .addParameter("ranged_xp", hiscoreResult.getRanged().getExperience())
- .addParameter("prayer_xp", hiscoreResult.getPrayer().getExperience())
- .addParameter("magic_xp", hiscoreResult.getMagic().getExperience())
- .addParameter("cooking_xp", hiscoreResult.getCooking().getExperience())
- .addParameter("woodcutting_xp", hiscoreResult.getWoodcutting().getExperience())
- .addParameter("fletching_xp", hiscoreResult.getFletching().getExperience())
- .addParameter("fishing_xp", hiscoreResult.getFishing().getExperience())
- .addParameter("firemaking_xp", hiscoreResult.getFiremaking().getExperience())
- .addParameter("crafting_xp", hiscoreResult.getCrafting().getExperience())
- .addParameter("smithing_xp", hiscoreResult.getSmithing().getExperience())
- .addParameter("mining_xp", hiscoreResult.getMining().getExperience())
- .addParameter("herblore_xp", hiscoreResult.getHerblore().getExperience())
- .addParameter("agility_xp", hiscoreResult.getAgility().getExperience())
- .addParameter("thieving_xp", hiscoreResult.getThieving().getExperience())
- .addParameter("slayer_xp", hiscoreResult.getSlayer().getExperience())
- .addParameter("farming_xp", hiscoreResult.getFarming().getExperience())
- .addParameter("runecraft_xp", hiscoreResult.getRunecraft().getExperience())
- .addParameter("hunter_xp", hiscoreResult.getHunter().getExperience())
- .addParameter("construction_xp", hiscoreResult.getConstruction().getExperience())
- .addParameter("attack_rank", hiscoreResult.getAttack().getRank())
- .addParameter("defence_rank", hiscoreResult.getDefence().getRank())
- .addParameter("strength_rank", hiscoreResult.getStrength().getRank())
- .addParameter("hitpoints_rank", hiscoreResult.getHitpoints().getRank())
- .addParameter("ranged_rank", hiscoreResult.getRanged().getRank())
- .addParameter("prayer_rank", hiscoreResult.getPrayer().getRank())
- .addParameter("magic_rank", hiscoreResult.getMagic().getRank())
- .addParameter("cooking_rank", hiscoreResult.getCooking().getRank())
- .addParameter("woodcutting_rank", hiscoreResult.getWoodcutting().getRank())
- .addParameter("fletching_rank", hiscoreResult.getFletching().getRank())
- .addParameter("fishing_rank", hiscoreResult.getFishing().getRank())
- .addParameter("firemaking_rank", hiscoreResult.getFiremaking().getRank())
- .addParameter("crafting_rank", hiscoreResult.getCrafting().getRank())
- .addParameter("smithing_rank", hiscoreResult.getSmithing().getRank())
- .addParameter("mining_rank", hiscoreResult.getMining().getRank())
- .addParameter("herblore_rank", hiscoreResult.getHerblore().getRank())
- .addParameter("agility_rank", hiscoreResult.getAgility().getRank())
- .addParameter("thieving_rank", hiscoreResult.getThieving().getRank())
- .addParameter("slayer_rank", hiscoreResult.getSlayer().getRank())
- .addParameter("farming_rank", hiscoreResult.getFarming().getRank())
- .addParameter("runecraft_rank", hiscoreResult.getRunecraft().getRank())
- .addParameter("hunter_rank", hiscoreResult.getHunter().getRank())
- .addParameter("construction_rank", hiscoreResult.getConstruction().getRank())
- .addParameter("overall_rank", hiscoreResult.getOverall().getRank())
- .executeUpdate();
-
- con.createQuery("update player set rank = :rank, last_updated = CURRENT_TIMESTAMP where id = :id")
- .addParameter("id", playerEntity.getId())
- .addParameter("rank", hiscoreResult.getOverall().getRank())
- .executeUpdate();
- }
- }
-
- private synchronized PlayerEntity findOrCreatePlayer(Connection con, String username)
- {
- PlayerEntity playerEntity = con.createQuery("select * from player where name = :name")
- .addParameter("name", username)
- .executeAndFetchFirst(PlayerEntity.class);
- if (playerEntity != null)
- {
- return playerEntity;
- }
-
- Instant now = Instant.now();
-
- int id = con.createQuery("insert into player (name, tracked_since) values (:name, :tracked_since)")
- .addParameter("name", username)
- .addParameter("tracked_since", now)
- .executeUpdate()
- .getKey(int.class);
-
- playerEntity = new PlayerEntity();
- playerEntity.setId(id);
- playerEntity.setName(username);
- playerEntity.setTracked_since(now);
- playerEntity.setLast_updated(now);
- return playerEntity;
- }
-
- private XpEntity findXpAtTime(Connection con, String username, Instant time)
- {
- return con.createQuery("select * from xp join player on player.id=xp.player where player.name = :username and time <= :time order by time desc limit 1")
- .throwOnMappingFailure(false)
- .addParameter("username", username)
- .addParameter("time", time)
- .executeAndFetchFirst(XpEntity.class);
- }
-
- public XpEntity findXpAtTime(String username, Instant time)
- {
- try (Connection con = sql2o.open())
- {
- return findXpAtTime(con, username, time);
- }
- }
-
- @Scheduled(fixedDelay = 1000)
- public void update() throws ExecutionException
- {
- String next;
- synchronized (usernameUpdateQueue)
- {
- next = usernameUpdateQueue.poll();
- }
-
- if (next == null)
- {
- return;
- }
-
- update(next);
- }
-
- @Scheduled(fixedDelay = 6 * 60 * 60 * 1000) // 6 hours
- public void clearFilter()
- {
- usernameFilter = createFilter();
- }
-
- private BloomFilter createFilter()
- {
- final BloomFilter filter = BloomFilter.create(
- Funnels.stringFunnel(Charset.defaultCharset()),
- BLOOMFILTER_EXPECTED_INSERTIONS
- );
-
- synchronized (usernameUpdateQueue)
- {
- for (String toUpdate : usernameUpdateQueue)
- {
- filter.put(toUpdate);
- }
- }
-
- return filter;
- }
-
- /**
- * scale how often to check hiscore updates for players based on their rank
- * @param playerEntity
- * @return
- */
- private static Duration updateFrequency(PlayerEntity playerEntity)
- {
- Integer rank = playerEntity.getRank();
- if (rank == null || rank == -1)
- {
- return Duration.ofDays(7);
- }
- else if (rank < 10_000)
- {
- return Duration.ofHours(6);
- }
- else if (rank < 50_000)
- {
- return Duration.ofDays(2);
- }
- else if (rank < 100_000)
- {
- return Duration.ofDays(5);
- }
- else
- {
- return Duration.ofDays(7);
- }
- }
-}
diff --git a/http-service/src/main/java/net/runelite/http/service/xp/beans/XpEntity.java b/http-service/src/main/java/net/runelite/http/service/xp/beans/XpEntity.java
deleted file mode 100644
index acab775873..0000000000
--- a/http-service/src/main/java/net/runelite/http/service/xp/beans/XpEntity.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2018, Adam
- * 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.http.service.xp.beans;
-
-import java.time.Instant;
-import lombok.Data;
-
-@Data
-public class XpEntity
-{
- private Integer id;
- private Instant time;
- private Integer player;
- private int overall_xp;
- private int attack_xp;
- private int defence_xp;
- private int strength_xp;
- private int hitpoints_xp;
- private int ranged_xp;
- private int prayer_xp;
- private int magic_xp;
- private int cooking_xp;
- private int woodcutting_xp;
- private int fletching_xp;
- private int fishing_xp;
- private int firemaking_xp;
- private int crafting_xp;
- private int smithing_xp;
- private int mining_xp;
- private int herblore_xp;
- private int agility_xp;
- private int thieving_xp;
- private int slayer_xp;
- private int farming_xp;
- private int runecraft_xp;
- private int hunter_xp;
- private int construction_xp;
-
- private int overall_rank;
- private int attack_rank;
- private int defence_rank;
- private int strength_rank;
- private int hitpoints_rank;
- private int ranged_rank;
- private int prayer_rank;
- private int magic_rank;
- private int cooking_rank;
- private int woodcutting_rank;
- private int fletching_rank;
- private int fishing_rank;
- private int firemaking_rank;
- private int crafting_rank;
- private int smithing_rank;
- private int mining_rank;
- private int herblore_rank;
- private int agility_rank;
- private int thieving_rank;
- private int slayer_rank;
- private int farming_rank;
- private int runecraft_rank;
- private int hunter_rank;
- private int construction_rank;
-}
diff --git a/http-service/src/main/resources/application-dev.yaml b/http-service/src/main/resources/application-dev.yaml
index 9397951858..2b24790c51 100644
--- a/http-service/src/main/resources/application-dev.yaml
+++ b/http-service/src/main/resources/application-dev.yaml
@@ -18,13 +18,6 @@ datasource:
url: jdbc:mariadb://localhost:3306/cache
username: runelite
password: runelite
- runelite-tracker:
- jndiName:
- driverClassName: org.mariadb.jdbc.Driver
- type: org.mariadb.jdbc.MariaDbDataSource
- url: jdbc:mariadb://localhost:3306/xptracker
- username: runelite
- password: runelite
# Development mongo
mongo:
diff --git a/http-service/src/main/resources/application.yaml b/http-service/src/main/resources/application.yaml
index e573e9ae2a..9eedd33c01 100644
--- a/http-service/src/main/resources/application.yaml
+++ b/http-service/src/main/resources/application.yaml
@@ -3,8 +3,6 @@ datasource:
jndiName: java:comp/env/jdbc/runelite
runelite-cache:
jndiName: java:comp/env/jdbc/runelite-cache2
- runelite-tracker:
- jndiName: java:comp/env/jdbc/runelite-tracker
# By default Spring tries to register the datasource as an MXBean,
# so if multiple apis are deployed on one web container with
diff --git a/http-service/src/main/resources/net/runelite/http/service/xp/schema.sql b/http-service/src/main/resources/net/runelite/http/service/xp/schema.sql
deleted file mode 100644
index 70f83a30fd..0000000000
--- a/http-service/src/main/resources/net/runelite/http/service/xp/schema.sql
+++ /dev/null
@@ -1,135 +0,0 @@
--- MySQL dump 10.16 Distrib 10.2.18-MariaDB, for Linux (x86_64)
---
--- Host: localhost Database: xptracker
--- ------------------------------------------------------
--- Server version 10.2.18-MariaDB
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Table structure for table `player`
---
-
-DROP TABLE IF EXISTS `player`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `player` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(32) NOT NULL,
- `tracked_since` timestamp NOT NULL DEFAULT current_timestamp(),
- `last_updated` timestamp NOT NULL DEFAULT current_timestamp(),
- `rank` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `xp`
---
-
-DROP TABLE IF EXISTS `xp`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `xp` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `time` timestamp NOT NULL DEFAULT current_timestamp(),
- `player` int(11) NOT NULL,
- `attack_xp` int(11) NOT NULL,
- `defence_xp` int(11) NOT NULL,
- `strength_xp` int(11) NOT NULL,
- `hitpoints_xp` int(11) NOT NULL,
- `ranged_xp` int(11) NOT NULL,
- `prayer_xp` int(11) NOT NULL,
- `magic_xp` int(11) NOT NULL,
- `cooking_xp` int(11) NOT NULL,
- `woodcutting_xp` int(11) NOT NULL,
- `fletching_xp` int(11) NOT NULL,
- `fishing_xp` int(11) NOT NULL,
- `firemaking_xp` int(11) NOT NULL,
- `crafting_xp` int(11) NOT NULL,
- `smithing_xp` int(11) NOT NULL,
- `mining_xp` int(11) NOT NULL,
- `herblore_xp` int(11) NOT NULL,
- `agility_xp` int(11) NOT NULL,
- `thieving_xp` int(11) NOT NULL,
- `slayer_xp` int(11) NOT NULL,
- `farming_xp` int(11) NOT NULL,
- `runecraft_xp` int(11) NOT NULL,
- `hunter_xp` int(11) NOT NULL,
- `construction_xp` int(11) NOT NULL,
- `overall_xp` int(11) GENERATED ALWAYS AS (`attack_xp` + `defence_xp` + `strength_xp` + `hitpoints_xp` + `ranged_xp` + `prayer_xp` + `magic_xp` + `cooking_xp` + `woodcutting_xp` + `fletching_xp` + `fishing_xp` + `firemaking_xp` + `crafting_xp` + `smithing_xp` + `mining_xp` + `herblore_xp` + `agility_xp` + `thieving_xp` + `slayer_xp` + `farming_xp` + `runecraft_xp` + `hunter_xp` + `construction_xp`) VIRTUAL,
- `attack_level` int(11) GENERATED ALWAYS AS (level_for_xp(`attack_xp` AS `attack_xp`)) VIRTUAL,
- `defence_level` int(11) GENERATED ALWAYS AS (level_for_xp(`defence_xp` AS `defence_xp`)) VIRTUAL,
- `strength_level` int(11) GENERATED ALWAYS AS (level_for_xp(`strength_xp` AS `strength_xp`)) VIRTUAL,
- `hitpoints_level` int(11) GENERATED ALWAYS AS (level_for_xp(`hitpoints_xp` AS `hitpoints_xp`)) VIRTUAL,
- `ranged_level` int(11) GENERATED ALWAYS AS (level_for_xp(`ranged_xp` AS `ranged_xp`)) VIRTUAL,
- `prayer_level` int(11) GENERATED ALWAYS AS (level_for_xp(`prayer_xp` AS `prayer_xp`)) VIRTUAL,
- `magic_level` int(11) GENERATED ALWAYS AS (level_for_xp(`magic_xp` AS `magic_xp`)) VIRTUAL,
- `cooking_level` int(11) GENERATED ALWAYS AS (level_for_xp(`cooking_xp` AS `cooking_xp`)) VIRTUAL,
- `woodcutting_level` int(11) GENERATED ALWAYS AS (level_for_xp(`woodcutting_xp` AS `woodcutting_xp`)) VIRTUAL,
- `fletching_level` int(11) GENERATED ALWAYS AS (level_for_xp(`fletching_xp` AS `fletching_xp`)) VIRTUAL,
- `fishing_level` int(11) GENERATED ALWAYS AS (level_for_xp(`fishing_xp` AS `fishing_xp`)) VIRTUAL,
- `firemaking_level` int(11) GENERATED ALWAYS AS (level_for_xp(`firemaking_xp` AS `firemaking_xp`)) VIRTUAL,
- `crafting_level` int(11) GENERATED ALWAYS AS (level_for_xp(`crafting_xp` AS `crafting_xp`)) VIRTUAL,
- `smithing_level` int(11) GENERATED ALWAYS AS (level_for_xp(`smithing_xp` AS `smithing_xp`)) VIRTUAL,
- `mining_level` int(11) GENERATED ALWAYS AS (level_for_xp(`mining_xp` AS `mining_xp`)) VIRTUAL,
- `herblore_level` int(11) GENERATED ALWAYS AS (level_for_xp(`herblore_xp` AS `herblore_xp`)) VIRTUAL,
- `agility_level` int(11) GENERATED ALWAYS AS (level_for_xp(`agility_xp` AS `agility_xp`)) VIRTUAL,
- `thieving_level` int(11) GENERATED ALWAYS AS (level_for_xp(`thieving_xp` AS `thieving_xp`)) VIRTUAL,
- `slayer_level` int(11) GENERATED ALWAYS AS (level_for_xp(`slayer_xp` AS `slayer_xp`)) VIRTUAL,
- `farming_level` int(11) GENERATED ALWAYS AS (level_for_xp(`farming_xp` AS `farming_xp`)) VIRTUAL,
- `runecraft_level` int(11) GENERATED ALWAYS AS (level_for_xp(`runecraft_xp` AS `runecraft_xp`)) VIRTUAL,
- `hunter_level` int(11) GENERATED ALWAYS AS (level_for_xp(`hunter_xp` AS `hunter_xp`)) VIRTUAL,
- `construction_level` int(11) GENERATED ALWAYS AS (level_for_xp(`construction_xp` AS `construction_xp`)) VIRTUAL,
- `overall_level` int(11) GENERATED ALWAYS AS (`attack_level` + `defence_level` + `strength_level` + `hitpoints_level` + `ranged_level` + `prayer_level` + `magic_level` + `cooking_level` + `woodcutting_level` + `fletching_level` + `fishing_level` + `firemaking_level` + `crafting_level` + `smithing_level` + `mining_level` + `herblore_level` + `agility_level` + `thieving_level` + `slayer_level` + `farming_level` + `runecraft_level` + `hunter_level` + `construction_level`) VIRTUAL,
- `attack_rank` int(11) NOT NULL,
- `defence_rank` int(11) NOT NULL,
- `strength_rank` int(11) NOT NULL,
- `hitpoints_rank` int(11) NOT NULL,
- `ranged_rank` int(11) NOT NULL,
- `prayer_rank` int(11) NOT NULL,
- `magic_rank` int(11) NOT NULL,
- `cooking_rank` int(11) NOT NULL,
- `woodcutting_rank` int(11) NOT NULL,
- `fletching_rank` int(11) NOT NULL,
- `fishing_rank` int(11) NOT NULL,
- `firemaking_rank` int(11) NOT NULL,
- `crafting_rank` int(11) NOT NULL,
- `smithing_rank` int(11) NOT NULL,
- `mining_rank` int(11) NOT NULL,
- `herblore_rank` int(11) NOT NULL,
- `agility_rank` int(11) NOT NULL,
- `thieving_rank` int(11) NOT NULL,
- `slayer_rank` int(11) NOT NULL,
- `farming_rank` int(11) NOT NULL,
- `runecraft_rank` int(11) NOT NULL,
- `hunter_rank` int(11) NOT NULL,
- `construction_rank` int(11) NOT NULL,
- `overall_rank` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `player_time` (`player`,`time`),
- KEY `idx_time` (`time`),
- CONSTRAINT `fk_player` FOREIGN KEY (`player`) REFERENCES `player` (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2019-02-15 21:01:17
\ No newline at end of file
diff --git a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java
deleted file mode 100644
index 798116e7ee..0000000000
--- a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreServiceTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 2017, Adam
- * 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.http.service.hiscore;
-
-import java.io.IOException;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
-import net.runelite.http.api.hiscore.HiscoreResult;
-import okhttp3.mockwebserver.MockResponse;
-import okhttp3.mockwebserver.MockWebServer;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class HiscoreServiceTest
-{
- 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
- {
- HiscoreTestService hiscores = new HiscoreTestService(server.url("/"));
-
- HiscoreResult result = hiscores.lookupUsername("zezima", HiscoreEndpoint.NORMAL.getHiscoreURL());
-
- Assert.assertEquals(50, result.getAttack().getLevel());
- Assert.assertEquals(159727L, result.getFishing().getExperience());
- Assert.assertEquals(492790, result.getConstruction().getRank());
- Assert.assertEquals(1432, result.getClueScrollAll().getLevel());
- Assert.assertEquals(324, result.getClueScrollBeginner().getRank());
- Assert.assertEquals(8008, result.getClueScrollEasy().getRank());
- Assert.assertEquals(911, result.getClueScrollMedium().getLevel());
- Assert.assertEquals(42, result.getClueScrollHard().getRank());
- Assert.assertEquals(777, result.getClueScrollElite().getLevel());
- Assert.assertEquals(254, result.getClueScrollMaster().getRank());
- Assert.assertEquals(-1, result.getLastManStanding().getLevel());
- Assert.assertEquals(241, result.getSoulWarsZeal().getLevel());
- Assert.assertEquals(2460, result.getLeaguePoints().getLevel());
- Assert.assertEquals(37, result.getAbyssalSire().getLevel());
- Assert.assertEquals(92357, result.getCallisto().getRank());
- Assert.assertEquals(4920, result.getNex().getLevel());
- Assert.assertEquals(2336, result.getPhosanisNightmare().getRank());
- Assert.assertEquals(5678, result.getTempoross().getLevel());
- Assert.assertEquals(42, result.getTheatreOfBloodHardMode().getLevel());
- Assert.assertEquals(5847, result.getZulrah().getLevel());
- }
-
-}
diff --git a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreTestService.java b/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreTestService.java
deleted file mode 100644
index bdd59b077a..0000000000
--- a/http-service/src/test/java/net/runelite/http/service/hiscore/HiscoreTestService.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2017, Adam
- * 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.http.service.hiscore;
-
-import java.io.IOException;
-import net.runelite.http.api.hiscore.HiscoreResult;
-import okhttp3.HttpUrl;
-
-class HiscoreTestService extends HiscoreService
-{
- private final HttpUrl testUrl;
-
- HiscoreTestService(HttpUrl testUrl)
- {
- this.testUrl = testUrl;
- }
-
- @Override
- public HiscoreResult lookupUsername(String username, HttpUrl endpoint) throws IOException
- {
- return super.lookupUsername(username, testUrl);
- }
-}
diff --git a/http-service/src/test/java/net/runelite/http/service/xp/XpMapperTest.java b/http-service/src/test/java/net/runelite/http/service/xp/XpMapperTest.java
deleted file mode 100644
index f337cb635d..0000000000
--- a/http-service/src/test/java/net/runelite/http/service/xp/XpMapperTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2018, Adam
- * 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.http.service.xp;
-
-import net.runelite.http.api.hiscore.HiscoreResult;
-import net.runelite.http.api.hiscore.Skill;
-import net.runelite.http.api.xp.XpData;
-import net.runelite.http.service.xp.beans.XpEntity;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
-public class XpMapperTest
-{
- @Test
- public void testXpEntityToXpData()
- {
- XpEntity xpEntity = new XpEntity();
- xpEntity.setAgility_rank(42);
- xpEntity.setAgility_xp(9001);
-
- XpData xpData = XpMapper.INSTANCE.xpEntityToXpData(xpEntity);
- assertEquals(42, xpData.getAgility_rank());
- assertEquals(9001, xpData.getAgility_xp());
- }
-
- @Test
- public void testHiscoreResultToXpData()
- {
- HiscoreResult hiscoreResult = new HiscoreResult();
- hiscoreResult.setAgility(new Skill(42, 9, 9001));
-
- XpData xpData = XpMapper.INSTANCE.hiscoreResultToXpData(hiscoreResult);
- assertEquals(42, xpData.getAgility_rank());
- assertEquals(9001, xpData.getAgility_xp());
- }
-
-}
diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml
index 9b282461bb..95b36353c8 100644
--- a/runelite-client/pom.xml
+++ b/runelite-client/pom.xml
@@ -110,6 +110,32 @@
commons-text1.2
+
+ org.apache.commons
+ commons-csv
+ 1.4
+
+
+ net.runelite
+ archive-patcher
+ 1.0
+
+
+ net.java.dev.jna
+ jna
+ 5.9.0
+
+
+ net.java.dev.jna
+ jna-platform
+ 5.9.0
+
+
+ com.google.code.findbugs
+ jsr305
+
+
+
net.runelite.jogljogl-all
@@ -174,6 +200,8 @@
2.4.0-rc-20210117runtime
+
+
net.runelite.jocljocl
@@ -193,25 +221,6 @@
macos-arm64runtime
-
- net.runelite
- archive-patcher
- 1.0
-
-
- net.java.dev.jna
- jna
- 5.9.0
-
-
- net.java.dev.jna
- jna-platform
- 5.9.0
-
-
- com.google.code.findbugs
- jsr305
- net.runelite
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreClient.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreClient.java
similarity index 86%
rename from http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreClient.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreClient.java
index cad7b00094..d6c2db19ea 100644
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreClient.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreClient.java
@@ -22,7 +22,7 @@
* (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.http.api.hiscore;
+package net.runelite.client.hiscore;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
@@ -64,28 +64,6 @@ public class HiscoreClient
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
{
try (Response response = client.newCall(buildRequest(username, hiscoreUrl)).execute())
@@ -109,7 +87,7 @@ public class HiscoreClient
@Override
public void onResponse(Call call, Response response) throws IOException
{
- try
+ try // NOPMD: UseTryWithResources
{
future.complete(processResponse(username, response));
}
@@ -156,9 +134,7 @@ public class HiscoreClient
{
CSVParser parser = CSVParser.parse(responseStr, CSVFormat.DEFAULT);
- HiscoreResultBuilder hiscoreBuilder = new HiscoreResultBuilder();
- hiscoreBuilder.setPlayer(username);
-
+ HiscoreResultBuilder hiscoreBuilder = new HiscoreResultBuilder(username);
int count = 0;
for (CSVRecord record : parser.getRecords())
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreEndpoint.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreEndpoint.java
similarity index 96%
rename from http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreEndpoint.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreEndpoint.java
index 6edfdda64b..6f1c7e8b8b 100644
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreEndpoint.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreEndpoint.java
@@ -23,8 +23,7 @@
* 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.http.api.hiscore;
+package net.runelite.client.hiscore;
import lombok.Getter;
import okhttp3.HttpUrl;
@@ -46,6 +45,6 @@ public enum HiscoreEndpoint
HiscoreEndpoint(String name, String hiscoreURL)
{
this.name = name;
- this.hiscoreURL = HttpUrl.parse(hiscoreURL);
+ this.hiscoreURL = HttpUrl.get(hiscoreURL);
}
}
diff --git a/runelite-client/src/main/java/net/runelite/client/game/HiscoreLoader.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreLoader.java
similarity index 90%
rename from runelite-client/src/main/java/net/runelite/client/game/HiscoreLoader.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreLoader.java
index 36b6024e35..97a1b26ee0 100644
--- a/runelite-client/src/main/java/net/runelite/client/game/HiscoreLoader.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreLoader.java
@@ -22,7 +22,7 @@
* (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.game;
+package net.runelite.client.hiscore;
import com.google.common.cache.CacheLoader;
import com.google.common.util.concurrent.ListenableFuture;
@@ -31,11 +31,8 @@ import com.google.common.util.concurrent.MoreExecutors;
import java.io.IOException;
import java.util.concurrent.ScheduledExecutorService;
import lombok.extern.slf4j.Slf4j;
-import static net.runelite.client.game.HiscoreManager.EMPTY;
-import static net.runelite.client.game.HiscoreManager.NONE;
-import net.runelite.http.api.hiscore.HiscoreClient;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
-import net.runelite.http.api.hiscore.HiscoreResult;
+import static net.runelite.client.hiscore.HiscoreManager.EMPTY;
+import static net.runelite.client.hiscore.HiscoreManager.NONE;
@Slf4j
class HiscoreLoader extends CacheLoader
diff --git a/runelite-client/src/main/java/net/runelite/client/game/HiscoreManager.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreManager.java
similarity index 93%
rename from runelite-client/src/main/java/net/runelite/client/game/HiscoreManager.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreManager.java
index 9e05b20373..cf8ef66bdd 100644
--- a/runelite-client/src/main/java/net/runelite/client/game/HiscoreManager.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreManager.java
@@ -22,7 +22,7 @@
* (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.game;
+package net.runelite.client.hiscore;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.LoadingCache;
@@ -33,9 +33,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AllArgsConstructor;
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;
@Singleton
@@ -56,7 +53,7 @@ public class HiscoreManager
private final HiscoreClient hiscoreClient;
@Inject
- public HiscoreManager(ScheduledExecutorService executor, OkHttpClient okHttpClient)
+ private HiscoreManager(ScheduledExecutorService executor, OkHttpClient okHttpClient)
{
hiscoreClient = new HiscoreClient(okHttpClient);
hiscoreCache = CacheBuilder.newBuilder()
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreResult.java
similarity index 86%
rename from http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreResult.java
index af6c461562..bfc6d46b6e 100644
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResult.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreResult.java
@@ -22,7 +22,7 @@
* (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.http.api.hiscore;
+package net.runelite.client.hiscore;
import lombok.Data;
@@ -120,77 +120,77 @@ public class HiscoreResult
switch (skill)
{
case ATTACK:
- return getAttack();
+ return attack;
case DEFENCE:
- return getDefence();
+ return defence;
case STRENGTH:
- return getStrength();
+ return strength;
case HITPOINTS:
- return getHitpoints();
+ return hitpoints;
case RANGED:
- return getRanged();
+ return ranged;
case PRAYER:
- return getPrayer();
+ return prayer;
case MAGIC:
- return getMagic();
+ return magic;
case COOKING:
- return getCooking();
+ return cooking;
case WOODCUTTING:
- return getWoodcutting();
+ return woodcutting;
case FLETCHING:
- return getFletching();
+ return fletching;
case FISHING:
- return getFishing();
+ return fishing;
case FIREMAKING:
- return getFiremaking();
+ return firemaking;
case CRAFTING:
- return getCrafting();
+ return crafting;
case SMITHING:
- return getSmithing();
+ return smithing;
case MINING:
- return getMining();
+ return mining;
case HERBLORE:
- return getHerblore();
+ return herblore;
case AGILITY:
- return getAgility();
+ return agility;
case THIEVING:
- return getThieving();
+ return thieving;
case SLAYER:
- return getSlayer();
+ return slayer;
case FARMING:
- return getFarming();
+ return farming;
case RUNECRAFT:
- return getRunecraft();
+ return runecraft;
case HUNTER:
- return getHunter();
+ return hunter;
case CONSTRUCTION:
- return getConstruction();
+ return construction;
case LEAGUE_POINTS:
- return getLeaguePoints();
+ return leaguePoints;
case OVERALL:
- return getOverall();
+ return overall;
case BOUNTY_HUNTER_HUNTER:
- return getBountyHunterHunter();
+ return bountyHunterHunter;
case BOUNTY_HUNTER_ROGUE:
- return getBountyHunterRogue();
+ return bountyHunterRogue;
case CLUE_SCROLL_ALL:
- return getClueScrollAll();
+ return clueScrollAll;
case CLUE_SCROLL_BEGINNER:
- return getClueScrollBeginner();
+ return clueScrollBeginner;
case CLUE_SCROLL_EASY:
- return getClueScrollEasy();
+ return clueScrollEasy;
case CLUE_SCROLL_MEDIUM:
- return getClueScrollMedium();
+ return clueScrollMedium;
case CLUE_SCROLL_HARD:
- return getClueScrollHard();
+ return clueScrollHard;
case CLUE_SCROLL_ELITE:
- return getClueScrollElite();
+ return clueScrollElite;
case CLUE_SCROLL_MASTER:
- return getClueScrollMaster();
+ return clueScrollMaster;
case LAST_MAN_STANDING:
- return getLastManStanding();
+ return lastManStanding;
case SOUL_WARS_ZEAL:
- return getSoulWarsZeal();
+ return soulWarsZeal;
case ABYSSAL_SIRE:
return abyssalSire;
case ALCHEMICAL_HYDRA:
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreResultBuilder.java
similarity index 97%
rename from http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreResultBuilder.java
index ee8504bc8a..e5a7ec20eb 100644
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreResultBuilder.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreResultBuilder.java
@@ -22,21 +22,18 @@
* (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.http.api.hiscore;
+package net.runelite.client.hiscore;
import java.util.ArrayList;
import java.util.List;
+import lombok.RequiredArgsConstructor;
+@RequiredArgsConstructor
class HiscoreResultBuilder
{
- private String player;
+ private final String player;
private final List skills = new ArrayList<>();
- public void setPlayer(String player)
- {
- this.player = player;
- }
-
void setNextSkill(Skill skill)
{
skills.add(skill);
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreSkill.java
similarity index 95%
rename from http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreSkill.java
index 0856e9270a..6cf3dc94ca 100644
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkill.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreSkill.java
@@ -22,13 +22,13 @@
* (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.http.api.hiscore;
+package net.runelite.client.hiscore;
import lombok.AllArgsConstructor;
import lombok.Getter;
-import static net.runelite.http.api.hiscore.HiscoreSkillType.SKILL;
-import static net.runelite.http.api.hiscore.HiscoreSkillType.ACTIVITY;
-import static net.runelite.http.api.hiscore.HiscoreSkillType.BOSS;
+import static net.runelite.client.hiscore.HiscoreSkillType.SKILL;
+import static net.runelite.client.hiscore.HiscoreSkillType.ACTIVITY;
+import static net.runelite.client.hiscore.HiscoreSkillType.BOSS;
@AllArgsConstructor
@Getter
diff --git a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkillType.java b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreSkillType.java
similarity index 97%
rename from http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkillType.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreSkillType.java
index 67e695364b..9adc4fac0d 100644
--- a/http-api/src/main/java/net/runelite/http/api/hiscore/HiscoreSkillType.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/HiscoreSkillType.java
@@ -22,7 +22,7 @@
* (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.http.api.hiscore;
+package net.runelite.client.hiscore;
public enum HiscoreSkillType
{
diff --git a/http-service/src/main/java/net/runelite/http/service/xp/beans/PlayerEntity.java b/runelite-client/src/main/java/net/runelite/client/hiscore/Skill.java
similarity index 81%
rename from http-service/src/main/java/net/runelite/http/service/xp/beans/PlayerEntity.java
rename to runelite-client/src/main/java/net/runelite/client/hiscore/Skill.java
index 11bec532d7..137f8a6750 100644
--- a/http-service/src/main/java/net/runelite/http/service/xp/beans/PlayerEntity.java
+++ b/runelite-client/src/main/java/net/runelite/client/hiscore/Skill.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Adam
+ * Copyright (c) 2021, Adam
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,17 +22,14 @@
* (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.http.service.xp.beans;
+package net.runelite.client.hiscore;
-import java.time.Instant;
-import lombok.Data;
+import lombok.Value;
-@Data
-public class PlayerEntity
+@Value
+public class Skill
{
- private Integer id;
- private String name;
- private Instant tracked_since;
- private Instant last_updated;
- private Integer rank;
+ int rank;
+ int level;
+ long experience;
}
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
index b15cebb7e4..4105a926a5 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java
@@ -82,6 +82,11 @@ import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ChatInput;
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.plugins.Plugin;
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.http.api.chat.ChatClient;
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 okhttp3.OkHttpClient;
import org.apache.commons.text.WordUtils;
@@ -1372,16 +1371,14 @@ public class ChatCommandsPlugin extends Plugin
try
{
- final SingleHiscoreSkillResult result = hiscoreClient.lookup(lookup.getName(), skill, lookup.getEndpoint());
-
+ final HiscoreResult result = hiscoreClient.lookup(lookup.getName(), lookup.getEndpoint());
if (result == null)
{
log.warn("unable to look up skill {} for {}: not found", skill, search);
return;
}
- final Skill hiscoreSkill = result.getSkill();
-
+ final Skill hiscoreSkill = result.getSkill(skill);
ChatMessageBuilder chatMessageBuilder = new ChatMessageBuilder()
.append(ChatColorType.NORMAL)
.append("Level ")
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java
index b823a57f62..8f529b7834 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java
@@ -61,13 +61,13 @@ import net.runelite.client.ui.components.materialtabs.MaterialTab;
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.QuantityFormatter;
-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 static net.runelite.http.api.hiscore.HiscoreSkill.*;
-import net.runelite.http.api.hiscore.HiscoreSkillType;
-import net.runelite.http.api.hiscore.Skill;
+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 static net.runelite.client.hiscore.HiscoreSkill.*;
+import net.runelite.client.hiscore.HiscoreSkillType;
+import net.runelite.client.hiscore.Skill;
import okhttp3.OkHttpClient;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java
index 6123055d1c..8e567d37d7 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePlugin.java
@@ -56,7 +56,7 @@ import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.Text;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
+import net.runelite.client.hiscore.HiscoreEndpoint;
@PluginDescriptor(
name = "HiScore",
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java
index 672ab50e16..48989d2d29 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java
@@ -42,7 +42,7 @@ import net.runelite.api.ParamID;
import net.runelite.api.Player;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
-import net.runelite.client.game.HiscoreManager;
+import net.runelite.client.hiscore.HiscoreManager;
import net.runelite.client.game.NPCManager;
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
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.TitleComponent;
import net.runelite.client.util.Text;
-import net.runelite.http.api.hiscore.HiscoreResult;
+import net.runelite.client.hiscore.HiscoreResult;
class OpponentInfoOverlay extends OverlayPanel
{
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java
index 330f4dfb42..855ac8953c 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoPlugin.java
@@ -49,7 +49,7 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
+import net.runelite.client.hiscore.HiscoreEndpoint;
@PluginDescriptor(
name = "Opponent Information",
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/PlayerComparisonOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/PlayerComparisonOverlay.java
index 840e4cae0e..03dc34f883 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/PlayerComparisonOverlay.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/PlayerComparisonOverlay.java
@@ -34,7 +34,7 @@ import net.runelite.api.Client;
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
import net.runelite.api.Player;
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.OverlayLayer;
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.TitleComponent;
import net.runelite.client.util.Text;
-import net.runelite.http.api.hiscore.HiscoreResult;
-import net.runelite.http.api.hiscore.HiscoreSkill;
+import net.runelite.client.hiscore.HiscoreResult;
+import net.runelite.client.hiscore.HiscoreSkill;
class PlayerComparisonOverlay extends Overlay
{
@@ -153,7 +153,7 @@ class PlayerComparisonOverlay extends Overlay
final HiscoreSkill hiscoreSkill = HISCORE_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)
{
diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java
index 1cb0a21044..8572cacbe7 100644
--- a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java
+++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java
@@ -58,13 +58,13 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
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.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
-import net.runelite.http.api.hiscore.HiscoreEndpoint;
-import net.runelite.http.api.hiscore.HiscoreResult;
-import net.runelite.http.api.hiscore.Skill;
+import net.runelite.client.hiscore.HiscoreEndpoint;
+import net.runelite.client.hiscore.HiscoreResult;
+import net.runelite.client.hiscore.Skill;
@PluginDescriptor(
name = "Player-owned House",
diff --git a/runelite-client/src/test/java/net/runelite/client/hiscore/HiscoreClientTest.java b/runelite-client/src/test/java/net/runelite/client/hiscore/HiscoreClientTest.java
new file mode 100644
index 0000000000..fbc2e7b48f
--- /dev/null
+++ b/runelite-client/src/test/java/net/runelite/client/hiscore/HiscoreClientTest.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2021, Adam
+ * 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());
+ }
+}
\ No newline at end of file
diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java
index ab2ec35046..8ac44d3a6a 100644
--- a/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java
+++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatcommands/ChatCommandsPluginTest.java
@@ -54,17 +54,19 @@ import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager;
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.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 org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.nullable;
import org.mockito.Mock;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.atLeastOnce;
@@ -545,11 +547,11 @@ public class ChatCommandsPluginTest
{
when(chatCommandsConfig.lvl()).thenReturn(true);
- SingleHiscoreSkillResult skillResult = new SingleHiscoreSkillResult();
- skillResult.setPlayer(PLAYER_NAME);
- skillResult.setSkill(new Skill(10, 1000, -1));
+ HiscoreResult hiscoreResult = new HiscoreResult();
+ hiscoreResult.setPlayer(PLAYER_NAME);
+ 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);
diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java
index 3b130c2b81..06f811a785 100644
--- a/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java
+++ b/runelite-client/src/test/java/net/runelite/client/plugins/hiscore/HiscorePanelTest.java
@@ -25,7 +25,7 @@
package net.runelite.client.plugins.hiscore;
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 static org.junit.Assert.assertEquals;
import org.junit.Test;