Initial work on web api, with a basic hiscore api
This commit is contained in:
84
http-api/pom.xml
Normal file
84
http-api/pom.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.runelite</groupId>
|
||||
<artifactId>runelite-parent</artifactId>
|
||||
<version>1.1.20-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>Web API</name>
|
||||
<artifactId>http-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 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;
|
||||
|
||||
public class RuneliteAPI
|
||||
{
|
||||
private static final String BASE = "https://api.runelite.net/runelite-";
|
||||
private static String version = RuneliteAPI.class.getPackage().getImplementationVersion();
|
||||
|
||||
public static String getApiBase()
|
||||
{
|
||||
return BASE + getVersion();
|
||||
}
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public static void setVersion(String version)
|
||||
{
|
||||
RuneliteAPI.version = version;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 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 com.google.gson.Gson;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import net.runelite.http.api.RuneliteAPI;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class HiscoreClient
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(HiscoreClient.class);
|
||||
|
||||
private static final String URL = RuneliteAPI.getApiBase() + "/hiscore";
|
||||
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
public HiscoreResult lookup(String username) throws IOException, URISyntaxException
|
||||
{
|
||||
URIBuilder builder = new URIBuilder(URL)
|
||||
.addParameter("username", username);
|
||||
|
||||
URI uri = builder.build();
|
||||
|
||||
logger.debug("Built URI: {}", uri);
|
||||
|
||||
HttpUriRequest request = new HttpGet(uri);
|
||||
|
||||
try (CloseableHttpClient client = HttpClients.createDefault();
|
||||
CloseableHttpResponse response = client.execute(request))
|
||||
{
|
||||
InputStream in = response.getEntity().getContent();
|
||||
return gson.fromJson(new InputStreamReader(in), HiscoreResult.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 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 HiscoreResult
|
||||
{
|
||||
private String player;
|
||||
private Skill overall;
|
||||
private Skill attack;
|
||||
private Skill defence;
|
||||
private Skill strength;
|
||||
private Skill hitpoints;
|
||||
private Skill ranged;
|
||||
private Skill prayer;
|
||||
private Skill magic;
|
||||
private Skill cooking;
|
||||
private Skill woodcutting;
|
||||
private Skill fletching;
|
||||
private Skill fishing;
|
||||
private Skill firemaking;
|
||||
private Skill crafting;
|
||||
private Skill smithing;
|
||||
private Skill mining;
|
||||
private Skill herblore;
|
||||
private Skill agility;
|
||||
private Skill thieving;
|
||||
private Skill slayer;
|
||||
private Skill farming;
|
||||
private Skill runecraft;
|
||||
private Skill hunter;
|
||||
private Skill construction;
|
||||
|
||||
public String getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
public void setPlayer(String player)
|
||||
{
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public Skill getOverall()
|
||||
{
|
||||
return overall;
|
||||
}
|
||||
|
||||
public void setOverall(Skill overall)
|
||||
{
|
||||
this.overall = overall;
|
||||
}
|
||||
|
||||
public Skill getAttack()
|
||||
{
|
||||
return attack;
|
||||
}
|
||||
|
||||
public void setAttack(Skill attack)
|
||||
{
|
||||
this.attack = attack;
|
||||
}
|
||||
|
||||
public Skill getDefence()
|
||||
{
|
||||
return defence;
|
||||
}
|
||||
|
||||
public void setDefence(Skill defence)
|
||||
{
|
||||
this.defence = defence;
|
||||
}
|
||||
|
||||
public Skill getStrength()
|
||||
{
|
||||
return strength;
|
||||
}
|
||||
|
||||
public void setStrength(Skill strength)
|
||||
{
|
||||
this.strength = strength;
|
||||
}
|
||||
|
||||
public Skill getHitpoints()
|
||||
{
|
||||
return hitpoints;
|
||||
}
|
||||
|
||||
public void setHitpoints(Skill hitpoints)
|
||||
{
|
||||
this.hitpoints = hitpoints;
|
||||
}
|
||||
|
||||
public Skill getRanged()
|
||||
{
|
||||
return ranged;
|
||||
}
|
||||
|
||||
public void setRanged(Skill ranged)
|
||||
{
|
||||
this.ranged = ranged;
|
||||
}
|
||||
|
||||
public Skill getPrayer()
|
||||
{
|
||||
return prayer;
|
||||
}
|
||||
|
||||
public void setPrayer(Skill prayer)
|
||||
{
|
||||
this.prayer = prayer;
|
||||
}
|
||||
|
||||
public Skill getMagic()
|
||||
{
|
||||
return magic;
|
||||
}
|
||||
|
||||
public void setMagic(Skill magic)
|
||||
{
|
||||
this.magic = magic;
|
||||
}
|
||||
|
||||
public Skill getCooking()
|
||||
{
|
||||
return cooking;
|
||||
}
|
||||
|
||||
public void setCooking(Skill cooking)
|
||||
{
|
||||
this.cooking = cooking;
|
||||
}
|
||||
|
||||
public Skill getWoodcutting()
|
||||
{
|
||||
return woodcutting;
|
||||
}
|
||||
|
||||
public void setWoodcutting(Skill woodcutting)
|
||||
{
|
||||
this.woodcutting = woodcutting;
|
||||
}
|
||||
|
||||
public Skill getFletching()
|
||||
{
|
||||
return fletching;
|
||||
}
|
||||
|
||||
public void setFletching(Skill fletching)
|
||||
{
|
||||
this.fletching = fletching;
|
||||
}
|
||||
|
||||
public Skill getFishing()
|
||||
{
|
||||
return fishing;
|
||||
}
|
||||
|
||||
public void setFishing(Skill fishing)
|
||||
{
|
||||
this.fishing = fishing;
|
||||
}
|
||||
|
||||
public Skill getFiremaking()
|
||||
{
|
||||
return firemaking;
|
||||
}
|
||||
|
||||
public void setFiremaking(Skill firemaking)
|
||||
{
|
||||
this.firemaking = firemaking;
|
||||
}
|
||||
|
||||
public Skill getCrafting()
|
||||
{
|
||||
return crafting;
|
||||
}
|
||||
|
||||
public void setCrafting(Skill crafting)
|
||||
{
|
||||
this.crafting = crafting;
|
||||
}
|
||||
|
||||
public Skill getSmithing()
|
||||
{
|
||||
return smithing;
|
||||
}
|
||||
|
||||
public void setSmithing(Skill smithing)
|
||||
{
|
||||
this.smithing = smithing;
|
||||
}
|
||||
|
||||
public Skill getMining()
|
||||
{
|
||||
return mining;
|
||||
}
|
||||
|
||||
public void setMining(Skill mining)
|
||||
{
|
||||
this.mining = mining;
|
||||
}
|
||||
|
||||
public Skill getHerblore()
|
||||
{
|
||||
return herblore;
|
||||
}
|
||||
|
||||
public void setHerblore(Skill herblore)
|
||||
{
|
||||
this.herblore = herblore;
|
||||
}
|
||||
|
||||
public Skill getAgility()
|
||||
{
|
||||
return agility;
|
||||
}
|
||||
|
||||
public void setAgility(Skill agility)
|
||||
{
|
||||
this.agility = agility;
|
||||
}
|
||||
|
||||
public Skill getThieving()
|
||||
{
|
||||
return thieving;
|
||||
}
|
||||
|
||||
public void setThieving(Skill thieving)
|
||||
{
|
||||
this.thieving = thieving;
|
||||
}
|
||||
|
||||
public Skill getSlayer()
|
||||
{
|
||||
return slayer;
|
||||
}
|
||||
|
||||
public void setSlayer(Skill slayer)
|
||||
{
|
||||
this.slayer = slayer;
|
||||
}
|
||||
|
||||
public Skill getFarming()
|
||||
{
|
||||
return farming;
|
||||
}
|
||||
|
||||
public void setFarming(Skill farming)
|
||||
{
|
||||
this.farming = farming;
|
||||
}
|
||||
|
||||
public Skill getRunecraft()
|
||||
{
|
||||
return runecraft;
|
||||
}
|
||||
|
||||
public void setRunecraft(Skill runecraft)
|
||||
{
|
||||
this.runecraft = runecraft;
|
||||
}
|
||||
|
||||
public Skill getHunter()
|
||||
{
|
||||
return hunter;
|
||||
}
|
||||
|
||||
public void setHunter(Skill hunter)
|
||||
{
|
||||
this.hunter = hunter;
|
||||
}
|
||||
|
||||
public Skill getConstruction()
|
||||
{
|
||||
return construction;
|
||||
}
|
||||
|
||||
public void setConstruction(Skill construction)
|
||||
{
|
||||
this.construction = construction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 7;
|
||||
hash = 29 * hash + Objects.hashCode(this.player);
|
||||
hash = 29 * hash + Objects.hashCode(this.overall);
|
||||
hash = 29 * hash + Objects.hashCode(this.attack);
|
||||
hash = 29 * hash + Objects.hashCode(this.defence);
|
||||
hash = 29 * hash + Objects.hashCode(this.strength);
|
||||
hash = 29 * hash + Objects.hashCode(this.hitpoints);
|
||||
hash = 29 * hash + Objects.hashCode(this.ranged);
|
||||
hash = 29 * hash + Objects.hashCode(this.prayer);
|
||||
hash = 29 * hash + Objects.hashCode(this.magic);
|
||||
hash = 29 * hash + Objects.hashCode(this.cooking);
|
||||
hash = 29 * hash + Objects.hashCode(this.woodcutting);
|
||||
hash = 29 * hash + Objects.hashCode(this.fletching);
|
||||
hash = 29 * hash + Objects.hashCode(this.fishing);
|
||||
hash = 29 * hash + Objects.hashCode(this.firemaking);
|
||||
hash = 29 * hash + Objects.hashCode(this.crafting);
|
||||
hash = 29 * hash + Objects.hashCode(this.smithing);
|
||||
hash = 29 * hash + Objects.hashCode(this.mining);
|
||||
hash = 29 * hash + Objects.hashCode(this.herblore);
|
||||
hash = 29 * hash + Objects.hashCode(this.agility);
|
||||
hash = 29 * hash + Objects.hashCode(this.thieving);
|
||||
hash = 29 * hash + Objects.hashCode(this.slayer);
|
||||
hash = 29 * hash + Objects.hashCode(this.farming);
|
||||
hash = 29 * hash + Objects.hashCode(this.runecraft);
|
||||
hash = 29 * hash + Objects.hashCode(this.hunter);
|
||||
hash = 29 * hash + Objects.hashCode(this.construction);
|
||||
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 HiscoreResult other = (HiscoreResult) obj;
|
||||
if (!Objects.equals(this.player, other.player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.overall, other.overall))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.attack, other.attack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.defence, other.defence))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.strength, other.strength))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.hitpoints, other.hitpoints))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.ranged, other.ranged))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.prayer, other.prayer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.magic, other.magic))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.cooking, other.cooking))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.woodcutting, other.woodcutting))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.fletching, other.fletching))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.fishing, other.fishing))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.firemaking, other.firemaking))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.crafting, other.crafting))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.smithing, other.smithing))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.mining, other.mining))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.herblore, other.herblore))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.agility, other.agility))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.thieving, other.thieving))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.slayer, other.slayer))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.farming, other.farming))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.runecraft, other.runecraft))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.hunter, other.hunter))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.construction, other.construction))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "HiscoreResult{" + "player=" + player + ", overall=" + overall + ", attack=" + attack + ", defence=" + defence + ", strength=" + strength + ", hitpoints=" + hitpoints + ", ranged=" + ranged + ", prayer=" + prayer + ", magic=" + magic + ", cooking=" + cooking + ", woodcutting=" + woodcutting + ", fletching=" + fletching + ", fishing=" + fishing + ", firemaking=" + firemaking + ", crafting=" + crafting + ", smithing=" + smithing + ", mining=" + mining + ", herblore=" + herblore + ", agility=" + agility + ", thieving=" + thieving + ", slayer=" + slayer + ", farming=" + farming + ", runecraft=" + runecraft + ", hunter=" + hunter + ", construction=" + construction + '}';
|
||||
}
|
||||
}
|
||||
101
http-api/src/main/java/net/runelite/http/api/hiscore/Skill.java
Normal file
101
http-api/src/main/java/net/runelite/http/api/hiscore/Skill.java
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 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 + '}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user