diff --git a/README.md b/README.md index f7d6bd1..a514514 100644 --- a/README.md +++ b/README.md @@ -98,9 +98,15 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/achievements -+ /v2/characters/<name>/core ++ /v2/achievements/* -+ /v2/characters/<name>/inventory ++ /v2/backstory/* + ++ /v2/build + ++ /v2/cats + ++ /v2/characters + /v2/colors @@ -108,6 +114,8 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/commerce/transactions ++ /v2/continents + + /v2/currencies + /v2/dungeons @@ -132,6 +140,10 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/outfits ++ /v2/professions + ++ /v2/pvp/amulets + + /v2/pvp/heroes + /v2/raids @@ -140,14 +152,22 @@ So if you see anything I missed, please don't hesitate to create an issue to let + /v2/recipes/search ++ /v2/skills + + /v2/skins ++ /v2/specializations + + /v2/titles + /v2/tokeninfo ++ /v2/traits + + /v2/worlds ++ /v2/wvw/abilities + ## Download @@ -157,7 +177,7 @@ Download latest [release](https://github.com/xhsun/gw2wrapper/releases) in Maven me.xhsun.gw2wrapper gw2wrapper - 0.4.1 + 0.6.2 ``` @@ -166,7 +186,7 @@ Or Gradle: ```groovy dependencies { ... - compile 'me.xhsun.gw2wrapper:gw2wrapper:0.4.1' + compile 'me.xhsun.gw2wrapper:gw2wrapper:0.6.2' ... } ``` diff --git a/comm.properties b/comm.properties index 6b8e50a..d5c7ad8 100644 --- a/comm.properties +++ b/comm.properties @@ -1,5 +1,5 @@ -currentVer=0.4.1 -verDesc=Release All Account Endpoints +currentVer=0.6.2 +verDesc=Release More Endpoints groupID=me.xhsun.gw2wrapper projectName=gw2wrapper siteUrl=https://github.com/xhsun/gw2wrapper diff --git a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java index 3bca50b..8dcf8b8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java @@ -4,16 +4,27 @@ import me.xhsun.guildwars2wrapper.model.*; import me.xhsun.guildwars2wrapper.model.account.*; import me.xhsun.guildwars2wrapper.model.achievements.Achievement; -import me.xhsun.guildwars2wrapper.model.character.CharacterInventory; -import me.xhsun.guildwars2wrapper.model.character.Core; +import me.xhsun.guildwars2wrapper.model.achievements.AchievementCategory; +import me.xhsun.guildwars2wrapper.model.achievements.AchievementGroup; +import me.xhsun.guildwars2wrapper.model.achievements.DailyAchievement; +import me.xhsun.guildwars2wrapper.model.backstory.BackStoryAnswer; +import me.xhsun.guildwars2wrapper.model.backstory.BackStoryQuestion; +import me.xhsun.guildwars2wrapper.model.character.Character; +import me.xhsun.guildwars2wrapper.model.character.*; import me.xhsun.guildwars2wrapper.model.commerce.Prices; import me.xhsun.guildwars2wrapper.model.commerce.Transaction; +import me.xhsun.guildwars2wrapper.model.continent.Continent; +import me.xhsun.guildwars2wrapper.model.continent.ContinentFloor; +import me.xhsun.guildwars2wrapper.model.continent.ContinentMap; +import me.xhsun.guildwars2wrapper.model.continent.ContinentRegion; import me.xhsun.guildwars2wrapper.model.guild.Upgrade; +import me.xhsun.guildwars2wrapper.model.pvp.Amulet; import me.xhsun.guildwars2wrapper.model.pvp.Hero; import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; import me.xhsun.guildwars2wrapper.model.unlockable.Glider; import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; import me.xhsun.guildwars2wrapper.model.unlockable.Outfit; +import me.xhsun.guildwars2wrapper.model.wvw.Ability; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -358,7 +369,6 @@ public void getWallet(String API, Callback> callback) throws GuildW } //Achievements - /** * For more info on achievement API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -386,6 +396,181 @@ public void getAchievementInfo(int[] ids, Callback> callback) gw2API.getAchievementInfo(processIds(ids)).enqueue(callback); } + /** + * For more info on achievements categories API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see AchievementCategory achievement category info + */ + public void getAllAchievementCategoryIDs(Callback> callback) throws NullPointerException { + gw2API.getAllAchievementCategoryIDs().enqueue(callback); + } + + /** + * For more info on achievements categories API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of achievement category id(s) + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see AchievementCategory achievement category info + */ + public void getAchievementCategoryInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getAchievementCategoryInfo(processIds(ids)).enqueue(callback); + } + + /** + * For more info on achievements daily API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see DailyAchievement daily achievement info + */ + public void getCurrentDailyAchievements(Callback callback) throws NullPointerException { + gw2API.getCurrentDailyAchievements().enqueue(callback); + } + + /** + * For more info on next achievements daily API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see DailyAchievement daily achievement info + */ + public void getNextDailyAchievements(Callback callback) throws GuildWars2Exception, NullPointerException { + gw2API.getNextDailyAchievements().enqueue(callback); + } + + /** + * For more info on achievements groups API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see AchievementGroup achievement group info + */ + public void getAllAchievementGroupID(Callback> callback) throws NullPointerException { + gw2API.getAllAchievementGroupIDs().enqueue(callback); + } + + /** + * For more info on achievements groups API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of achievement group id(s) + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see AchievementGroup achievement group info + */ + public void getAchievementGroupInfo(String[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getAchievementGroupInfo(processIds(ids)).enqueue(callback); + } + + //Back Story + /** + * For more info on back story answer API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see BackStoryAnswer back story answer info + */ + public void getAllBackStoryAnswerID(Callback> callback) throws NullPointerException { + gw2API.getAllBackStoryAnswerIDs().enqueue(callback); + } + + /** + * For more info on back story answer API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of back story answer id(s) + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see BackStoryAnswer back story answer info + */ + public void getBackStoryAnswerInfo(String[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getBackStoryAnswerInfo(processIds(ids)).enqueue(callback); + } + + /** + * For more info on back story questions API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see BackStoryQuestion back story question info + */ + public void getAllBackStoryQuestionID(Callback> callback) throws NullPointerException { + gw2API.getAllBackStoryQuestionIDs().enqueue(callback); + } + + /** + * For more info on back story questions API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of back story question id(s) + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key + * @throws NullPointerException if given {@link Callback} is empty + * @see BackStoryQuestion back story question info + */ + public void getBackStoryQuestionInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getBackStoryQuestionInfo(processIds(ids)).enqueue(callback); + } + + /** + * For more info on build API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see GameBuild game build info + */ + public void getCurrentGameBuild(Callback callback) throws NullPointerException { + gw2API.getCurrentGameBuild().enqueue(callback); + } + + //Cats + + /** + * For more info on cats API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Cat cat info + */ + public void getAllCatID(Callback> callback) throws NullPointerException { + gw2API.getAllCatIDs().enqueue(callback); + } + + /** + * For more info on cats API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of cat id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Cat cat info + */ + public void getCatInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getCatInfo(processIds(ids)).enqueue(callback); + } + //Characters /** * For more info on Character API go here
@@ -402,7 +587,7 @@ public void getAllCharacterName(String API, Callback> callback) thr } /** - * For more info on Character Core API go here
+ * For more info on character overview API go here
* Get character information for the given character name that is linked to given API key * * @param API API key @@ -410,13 +595,88 @@ public void getAllCharacterName(String API, Callback> callback) thr * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} * @throws GuildWars2Exception invalid API key | empty character name * @throws NullPointerException if given {@link Callback} is empty - * @see Core character info + * @see Character character info + */ + public void getCharacter(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacter(name, API).enqueue(callback); + } + + /** + * For more info on character back story API go here
+ * + * @param API API key + * @param name name of character + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see CharacterBackStory back store answer info + */ + public void getCharacterBackStory(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterBackStory(name, API).enqueue(callback); + } + + /** + * For more info on Character Core API go here
+ * Get basic character information for the given character name that is linked to given API key + * + * @param API API key + * @param name name of character + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see Core basic character info */ public void getCharacterInformation(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterCore(name, API).enqueue(callback); } + /** + * For more info on character crafting API go here
+ * + * @param API API key + * @param name name of character + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see CraftingLevel character crafting info + */ + public void getCharacterCrafting(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterCrafting(name, API).enqueue(callback); + } + + /** + * For more info on character equipment API go here
+ * + * @param API API key + * @param name name of character + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see CharacterEquipment equipment info + */ + public void getCharacterEquipment(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterEquipment(name, API).enqueue(callback); + } + + /** + * For more info on character hero points API go here
+ * + * @param API API key + * @param name name of character + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + */ + public void getCharacterHeroPoints(String API, String name, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterHeroPoints(name, API).enqueue(callback); + } + /** * For more info on Character Inventory API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -433,8 +693,87 @@ public void getCharacterInventory(String API, String name, Callbackhere
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param name character name + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see Recipe recipe info + */ + public void getCharacterUnlockedRecipes(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterUnlockedRecipes(name, API).enqueue(callback); + } + + /** + * For more info on Character SAB API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param name character name + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see CharacterSAB character SAB info + */ + public void getCharacterSAB(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterSAB(name, API).enqueue(callback); + } + + /** + * For more info on Character Skills API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param name character name + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see CharacterSkills character skills info + */ + public void getCharacterSkills(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterSkills(name, API).enqueue(callback); + } + + /** + * For more info on Character Specialization API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param name character name + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see CharacterSpecialization character specialization info + */ + public void getCharacterSpecialization(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterSpecialization(name, API).enqueue(callback); + } + + /** + * For more info on Character Training API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param API API key + * @param name character name + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception invalid API key | empty character name + * @throws NullPointerException if given {@link Callback} is empty + * @see CharacterTraining character training info + */ + public void getCharacterTraining(String API, String name, Callback callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + gw2API.getCharacterTraining(name, API).enqueue(callback); + } + //Colors /** * For more info on Color API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -506,8 +845,233 @@ public void getPrices(int[] ids, Callback> callback) throws GuildWa gw2API.getPrices(processIds(ids)).enqueue(callback); } - //Currencies + //Continents + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Continent continents info + */ + public void getAllContinentID(Callback> callback) throws NullPointerException { + gw2API.getAllContinentIDs().enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of continents id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Continent continents info + */ + public void getContinentInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getContinentInfo(processIds(ids)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentFloor continents floor info + */ + public void getAllContinentFloorID(int continentID, Callback> callback) throws NullPointerException { + gw2API.getAllContinentFloorIDs(Integer.toString(continentID)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param ids list of floor id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentFloor continents floor info + */ + public void getContinentFloorInfo(int continentID, int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getContinentFloorInfo(Integer.toString(continentID), processIds(ids)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentRegion continents region info + */ + public void getAllContinentRegionID(int continentID, int floorID, Callback> callback) throws NullPointerException { + gw2API.getAllContinentRegionIDs(Integer.toString(continentID), Integer.toString(floorID)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param ids list of region id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentRegion continents region info + */ + public void getContinentRegionInfo(int continentID, int floorID, int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getContinentRegionInfo(Integer.toString(continentID), Integer.toString(floorID), processIds(ids)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap continents map info + */ + public void getAllContinentMapID(int continentID, int floorID, int regionID, Callback> callback) throws NullPointerException { + gw2API.getAllContinentMapIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param ids list of region map id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap continents map info + */ + public void getContinentMapInfo(int continentID, int floorID, int regionID, int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getContinentMapInfo(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), processIds(ids)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap.Sector continents map sector info + */ + public void getAllContinentSectorID(int continentID, int floorID, int regionID, int mapID, Callback> callback) throws NullPointerException { + gw2API.getAllContinentSectorIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param ids list of region map sector id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap.Sector continents map sector info + */ + public void getContinentSectorInfo(int continentID, int floorID, int regionID, int mapID, int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getContinentSectorInfo(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap.PoI continents map PoI info + */ + public void getAllContinentPOIID(int continentID, int floorID, int regionID, int mapID, Callback> callback) throws NullPointerException { + gw2API.getAllContinentPOIIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param ids list of region map PoI id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap.PoI continents map PoI info + */ + public void getContinentPOIInfo(int continentID, int floorID, int regionID, int mapID, int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getContinentPOIInfo(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap.Task continents map task info + */ + public void getAllContinentTaskID(int continentID, int floorID, int regionID, int mapID, Callback> callback) throws NullPointerException { + gw2API.getAllContinentTaskIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).enqueue(callback); + } + + /** + * For more info on continents API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param ids list of region map task id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see ContinentMap.Task continents map task info + */ + public void getContinentTaskInfo(int continentID, int floorID, int regionID, int mapID, int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getContinentTaskInfo(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids)).enqueue(callback); + } + //Currencies /** * For more info on Currency API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @@ -770,7 +1334,7 @@ public void getMasteryInfo(int[] ids, Callback> callback) throws G //Material Categories /** - * For more info on Material Category API go here
+ * For more info on Material MaterialCategory API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @@ -782,7 +1346,7 @@ public void getAllMaterialCategoryID(Callback> callback) throws Nu } /** - * For more info on Material Category API go here
+ * For more info on Material MaterialCategory API go here
* Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions * * @param ids list of category id @@ -854,6 +1418,64 @@ public void getOutfitInfo(int[] ids, Callback> callback) throws Gui gw2API.getOutfitInfo(processIds(ids)).enqueue(callback); } + //Professions + + /** + * For more info on professions API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Profession profession info + */ + public void getAllProfessionID(Callback> callback) throws NullPointerException { + gw2API.getAllProfessionIDs().enqueue(callback); + } + + /** + * For more info on professions API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of profession id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Profession profession info + */ + public void getProfessionInfo(String[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getProfessionInfo(processIds(ids)).enqueue(callback); + } + + //PvP Amulets + + /** + * For more info on pvp amulets API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Amulet amulet info + */ + public void getAllPvPAmuletID(Callback> callback) throws NullPointerException { + gw2API.getAllPvPAmuletIDs().enqueue(callback); + } + + /** + * For more info on pvp amulets API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of amulet id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Amulet amulet info + */ + public void getPvPAmuletInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getPvPAmuletInfo(processIds(ids)).enqueue(callback); + } + //PvP Heroes /** @@ -956,6 +1578,35 @@ public void searchRecipes(boolean isInput, int id, Callback> callb else gw2API.searchOutputRecipes(Integer.toString(id)).enqueue(callback); } + //Skills + + /** + * For more info on Skills API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Skill skill info + */ + public void getAllSkillID(Callback> callback) throws NullPointerException { + gw2API.getAllSkillIDs().enqueue(callback); + } + + /** + * For more info on Skills API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of skill id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Skill skill info + */ + public void getSkillInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getSkillInfo(processIds(ids)).enqueue(callback); + } + //Skins /** @@ -985,6 +1636,35 @@ public void getSkinInfo(int[] ids, Callback> callback) throws GuildWa gw2API.getSkinInfo(processIds(ids)).enqueue(callback); } + //Specializations + + /** + * For more info on specializations API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Specialization specialization info + */ + public void getAllSpecializationID(Callback> callback) throws NullPointerException { + gw2API.getAllSpecializationIDs().enqueue(callback); + } + + /** + * For more info on specializations API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of specialization id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Specialization specialization info + */ + public void getSpecializationInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getSpecializationInfo(processIds(ids)).enqueue(callback); + } + //Titles /** @@ -1014,6 +1694,35 @@ public void getTitleInfo(int[] ids, Callback> callback) throws Guild gw2API.getTitleInfo(processIds(ids)).enqueue(callback); } + //Traits + + /** + * For more info on traits API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Trait trait info + */ + public void getAllTraitID(Callback> callback) throws NullPointerException { + gw2API.getAllTraitIDs().enqueue(callback); + } + + /** + * For more info on traits API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of trait id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Trait trait info + */ + public void getTraitInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getTraitInfo(processIds(ids)).enqueue(callback); + } + //Worlds /** @@ -1042,4 +1751,34 @@ public void getWorldInfo(int[] ids, Callback> callback) throws Guild isParamValid(new ParamChecker(ids)); gw2API.getWorldsInfo(processIds(ids)).enqueue(callback); } + + //WvW Abilities + + /** + * For more info on WvW abilities API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws NullPointerException if given {@link Callback} is empty + * @see Ability WvW abilities info + */ + public void getAllWvWAbilityID(Callback> callback) throws NullPointerException { + gw2API.getAllWvWAbilityIDs().enqueue(callback); + } + + /** + * For more info on WvW abilities API go here
+ * Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions + * + * @param ids list of WvW abilities id + * @param callback callback that is going to be used for {@link Call#enqueue(Callback)} + * @throws GuildWars2Exception empty ID list + * @throws NullPointerException if given {@link Callback} is empty + * @see Ability WvW abilities info + */ + public void getWvWAbilityInfo(int[] ids, Callback> callback) throws GuildWars2Exception, NullPointerException { + isParamValid(new ParamChecker(ids)); + gw2API.getWvWAbilityInfo(processIds(ids)).enqueue(callback); + } + } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java index ae7b05c..b4ea04e 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java @@ -14,7 +14,9 @@ * 1) use methods provided by {@link SynchronousRequest} to get data synchronously
* 2) use methods provided by {@link AsynchronousRequest} to get/process data asynchronously * TODO chatLinkToItemID - * TODO language selection, default english + * TODO language selection(en - english, de - german, es - spanish, fr - french), default english + * TODO method to resolve back story question using answer id + * TODO coins to gold/sliver/copper * @author xhsun * @since 2017-02-06 */ diff --git a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java index 767ab7f..3be073d 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2API.java @@ -3,16 +3,27 @@ import me.xhsun.guildwars2wrapper.model.*; import me.xhsun.guildwars2wrapper.model.account.*; import me.xhsun.guildwars2wrapper.model.achievements.Achievement; -import me.xhsun.guildwars2wrapper.model.character.CharacterInventory; -import me.xhsun.guildwars2wrapper.model.character.Core; +import me.xhsun.guildwars2wrapper.model.achievements.AchievementCategory; +import me.xhsun.guildwars2wrapper.model.achievements.AchievementGroup; +import me.xhsun.guildwars2wrapper.model.achievements.DailyAchievement; +import me.xhsun.guildwars2wrapper.model.backstory.BackStoryAnswer; +import me.xhsun.guildwars2wrapper.model.backstory.BackStoryQuestion; +import me.xhsun.guildwars2wrapper.model.character.Character; +import me.xhsun.guildwars2wrapper.model.character.*; import me.xhsun.guildwars2wrapper.model.commerce.Prices; import me.xhsun.guildwars2wrapper.model.commerce.Transaction; +import me.xhsun.guildwars2wrapper.model.continent.Continent; +import me.xhsun.guildwars2wrapper.model.continent.ContinentFloor; +import me.xhsun.guildwars2wrapper.model.continent.ContinentMap; +import me.xhsun.guildwars2wrapper.model.continent.ContinentRegion; import me.xhsun.guildwars2wrapper.model.guild.Upgrade; +import me.xhsun.guildwars2wrapper.model.pvp.Amulet; import me.xhsun.guildwars2wrapper.model.pvp.Hero; import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; import me.xhsun.guildwars2wrapper.model.unlockable.Glider; import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; import me.xhsun.guildwars2wrapper.model.unlockable.Outfit; +import me.xhsun.guildwars2wrapper.model.wvw.Ability; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; @@ -102,16 +113,88 @@ interface GuildWars2API { @GET("/v2/achievements") Call> getAchievementInfo(@Query("ids") String ids); + @GET("/v2/achievements/categories") + Call> getAllAchievementCategoryIDs(); + + @GET("/v2/achievements/categories") + Call> getAchievementCategoryInfo(@Query("ids") String ids); + + @GET("/v2/achievements/daily") + Call getCurrentDailyAchievements(); + + @GET("/v2/achievements/daily/tomorrow") + Call getNextDailyAchievements(); + + @GET("/v2/achievements/groups") + Call> getAllAchievementGroupIDs(); + + @GET("/v2/achievements/groups") + Call> getAchievementGroupInfo(@Query("ids") String ids); + + //back story + @GET("/v2/backstory/answers") + Call> getAllBackStoryAnswerIDs(); + + @GET("/v2/backstory/answers") + Call> getBackStoryAnswerInfo(@Query("ids") String ids); + + @GET("/v2/backstory/questions") + Call> getAllBackStoryQuestionIDs(); + + @GET("/v2/backstory/questions") + Call> getBackStoryQuestionInfo(@Query("ids") String ids); + + //Current Game Build + @GET("/v2/build") + Call getCurrentGameBuild(); + + //Cats + @GET("/v2/cats") + Call> getAllCatIDs(); + + @GET("/v2/cats") + Call> getCatInfo(@Query("ids") String ids); + //characters @GET("/v2/characters") Call> getAllCharacterName(@Query("access_token") String token); + @GET("/v2/characters/{name}") + Call getCharacter(@Path("name") String name, @Query("access_token") String token); + + @GET("/v2/characters/{name}/backstory") + Call getCharacterBackStory(@Path("name") String name, @Query("access_token") String token); + @GET("/v2/characters/{name}/core") Call getCharacterCore(@Path("name") String name, @Query("access_token") String token); + @GET("/v2/characters/{name}/crafting") + Call getCharacterCrafting(@Path("name") String name, @Query("access_token") String token); + + @GET("/v2/characters/{name}/equipment") + Call getCharacterEquipment(@Path("name") String name, @Query("access_token") String token); + + @GET("/v2/characters/{name}/heropoints") + Call> getCharacterHeroPoints(@Path("name") String name, @Query("access_token") String token); + @GET("/v2/characters/{name}/inventory") Call getCharacterInventory(@Path("name") String name, @Query("access_token") String token); + @GET("/v2/characters/{name}/recipes") + Call getCharacterUnlockedRecipes(@Path("name") String name, @Query("access_token") String token); + + @GET("/v2/characters/{name}/sab") + Call getCharacterSAB(@Path("name") String name, @Query("access_token") String token); + + @GET("/v2/characters/{name}/skills") + Call getCharacterSkills(@Path("name") String name, @Query("access_token") String token); + + @GET("/v2/characters/{name}/specializations") + Call getCharacterSpecialization(@Path("name") String name, @Query("access_token") String token); + + @GET("/v2/characters/{name}/training") + Call getCharacterTraining(@Path("name") String name, @Query("access_token") String token); + //colors @GET("/v2/colors") Call> getAllColorIDs(); @@ -129,6 +212,49 @@ interface GuildWars2API { @GET("/v2/commerce/prices") Call> getPrices(@Query("ids") String ids); + //continents + @GET("/v2/continents") + Call> getAllContinentIDs(); + + @GET("/v2/continents") + Call> getContinentInfo(@Query("ids") String ids); + + @GET("/v2/continents/{continentId}/floors") + Call> getAllContinentFloorIDs(@Path("continentId") String continent); + + @GET("/v2/continents/{continentId}/floors") + Call> getContinentFloorInfo(@Path("continentId") String continent, @Query("ids") String ids); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions") + Call> getAllContinentRegionIDs(@Path("continentId") String continent, @Path("floorId") String floor); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions") + Call> getContinentRegionInfo(@Path("continentId") String continent, @Path("floorId") String floor, @Query("ids") String ids); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps") + Call> getAllContinentMapIDs(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps") + Call> getContinentMapInfo(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region, @Query("ids") String ids); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps/{mapId}/sectors") + Call> getAllContinentSectorIDs(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region, @Path("mapId") String map); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps/{mapId}/sectors") + Call> getContinentSectorInfo(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region, @Path("mapId") String map, @Query("ids") String ids); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps/{mapId}/pois") + Call> getAllContinentPOIIDs(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region, @Path("mapId") String map); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps/{mapId}/pois") + Call> getContinentPOIInfo(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region, @Path("mapId") String map, @Query("ids") String ids); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps/{mapId}/tasks") + Call> getAllContinentTaskIDs(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region, @Path("mapId") String map); + + @GET("/v2/continents/{continentId}/floors/{floorId}/regions/{regionId}/maps/{mapId}/tasks") + Call> getContinentTaskInfo(@Path("continentId") String continent, @Path("floorId") String floor, @Path("regionId") String region, @Path("mapId") String map, @Query("ids") String ids); + //currencies @GET("/v2/currencies") Call> getAllCurrencies(); @@ -213,6 +339,20 @@ interface GuildWars2API { @GET("/v2/outfits") Call> getOutfitInfo(@Query("ids") String ids); + //Professions + @GET("/v2/professions") + Call> getAllProfessionIDs(); + + @GET("/v2/professions") + Call> getProfessionInfo(@Query("ids") String ids); + + //PvP Amulets + @GET("/v2/pvp/amulets") + Call> getAllPvPAmuletIDs(); + + @GET("/v2/pvp/amulets") + Call> getPvPAmuletInfo(@Query("ids") String ids); + //PvP Heroes @GET("/v2/pvp/heroes") Call> getAllPvPHeroIDs(); @@ -241,6 +381,13 @@ interface GuildWars2API { @GET("/v2/recipes/search") Call> searchOutputRecipes(@Query("output") String id); + //Skills + @GET("/v2/skills") + Call> getAllSkillIDs(); + + @GET("/v2/skills") + Call> getSkillInfo(@Query("ids") String ids); + //skins @GET("/v2/skins") Call> getAllSkinIDs(); @@ -248,6 +395,13 @@ interface GuildWars2API { @GET("/v2/skins") Call> getSkinInfo(@Query("ids") String ids); + //Specializations + @GET("/v2/specializations") + Call> getAllSpecializationIDs(); + + @GET("/v2/specializations") + Call> getSpecializationInfo(@Query("ids") String ids); + //Titles @GET("/v2/titles") Call> getAllTitleIDs(); @@ -255,10 +409,24 @@ interface GuildWars2API { @GET("/v2/titles") Call> getTitleInfo(@Query("ids") String ids); + //Traits + @GET("/v2/traits") + Call> getAllTraitIDs(); + + @GET("/v2/traits") + Call> getTraitInfo(@Query("ids") String ids); + //worlds @GET("/v2/worlds") Call> getAllWorldsIDs(); @GET("/v2/worlds") Call> getWorldsInfo(@Query("ids") String ids); + + //WvW Abilities + @GET("/v2/wvw/abilities") + Call> getAllWvWAbilityIDs(); + + @GET("/v2/wvw/abilities") + Call> getWvWAbilityInfo(@Query("ids") String ids); } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/Request.java b/src/main/java/me/xhsun/guildwars2wrapper/Request.java index eaf77be..3990675 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/Request.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/Request.java @@ -97,7 +97,6 @@ void isParamValid(ParamChecker... items) throws GuildWars2Exception { throw new GuildWars2Exception(ErrorCode.ID, "List of id cannot be empty"); } } - } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java index b5a3179..657c5c7 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java @@ -5,16 +5,27 @@ import me.xhsun.guildwars2wrapper.model.*; import me.xhsun.guildwars2wrapper.model.account.*; import me.xhsun.guildwars2wrapper.model.achievements.Achievement; -import me.xhsun.guildwars2wrapper.model.character.CharacterInventory; -import me.xhsun.guildwars2wrapper.model.character.Core; +import me.xhsun.guildwars2wrapper.model.achievements.AchievementCategory; +import me.xhsun.guildwars2wrapper.model.achievements.AchievementGroup; +import me.xhsun.guildwars2wrapper.model.achievements.DailyAchievement; +import me.xhsun.guildwars2wrapper.model.backstory.BackStoryAnswer; +import me.xhsun.guildwars2wrapper.model.backstory.BackStoryQuestion; +import me.xhsun.guildwars2wrapper.model.character.Character; +import me.xhsun.guildwars2wrapper.model.character.*; import me.xhsun.guildwars2wrapper.model.commerce.Prices; import me.xhsun.guildwars2wrapper.model.commerce.Transaction; +import me.xhsun.guildwars2wrapper.model.continent.Continent; +import me.xhsun.guildwars2wrapper.model.continent.ContinentFloor; +import me.xhsun.guildwars2wrapper.model.continent.ContinentMap; +import me.xhsun.guildwars2wrapper.model.continent.ContinentRegion; import me.xhsun.guildwars2wrapper.model.guild.Upgrade; +import me.xhsun.guildwars2wrapper.model.pvp.Amulet; import me.xhsun.guildwars2wrapper.model.pvp.Hero; import me.xhsun.guildwars2wrapper.model.unlockable.Finisher; import me.xhsun.guildwars2wrapper.model.unlockable.Glider; import me.xhsun.guildwars2wrapper.model.unlockable.MailCarrier; import me.xhsun.guildwars2wrapper.model.unlockable.Outfit; +import me.xhsun.guildwars2wrapper.model.wvw.Ability; import retrofit2.Response; import java.io.IOException; @@ -505,19 +516,686 @@ public List getAchievementInfo(int[] ids) throws GuildWars2Exceptio } } + /** + * For more info on achievements categories API go here
+ * Get list of all available achievement categories id(s) + * + * @return list of achievement categories id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see AchievementCategory achievement categories info + */ + public List getAllAchievementCategoryID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllAchievementCategoryIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on achievements categories API go here
+ * Get list of achievement categories info corresponding to the given id(s) + * + * @param ids list of achievement categories id(s) + * @return list of achievement categories info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see AchievementCategory achievement categories info + */ + public List getAchievementCategoryInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getAchievementCategoryInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on achievements daily API go here
+ * Get list of current daily achievements + * + * @return list of current daily achievements + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see DailyAchievement daily achievement info + */ + public DailyAchievement getCurrentDailyAchievements() throws GuildWars2Exception { + try { + Response response = gw2API.getCurrentDailyAchievements().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on next achievements daily API go here
+ * Get list of tomorrow's daily achievements + * + * @return list of tomorrow's daily achievements + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see DailyAchievement daily achievement info + */ + public DailyAchievement getNextDailyAchievements() throws GuildWars2Exception { + try { + Response response = gw2API.getNextDailyAchievements().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on achievements groups API go here
+ * Get list of all available achievement group id(s) + * + * @return list of achievement group id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see AchievementGroup achievement group info + */ + public List getAllAchievementGroupID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllAchievementGroupIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on achievements groups API go here
+ * Get list of achievement group info corresponding to the given id(s) + * + * @param ids list of achievement group id(s) + * @return list of achievement group info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see AchievementGroup achievement group info + */ + public List getAchievementGroupInfo(String[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getAchievementGroupInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Back Story + /** + * For more info on back story answer API go here
+ * Get list of all back story answer id(s) + * + * @return list of back story answer id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see BackStoryAnswer back story answer info + */ + public List getAllBackStoryAnswerID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllBackStoryAnswerIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on back story answer API go here
+ * Get list of back story answer info corresponding to the given id(s) + * + * @param ids list of back story answer id(s) + * @return list of back story answer info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see BackStoryAnswer back story answer info + */ + public List getBackStoryAnswerInfo(String[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getBackStoryAnswerInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on back story questions API go here
+ * Get list of all available back story question id(s) + * + * @return list of back story question id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see BackStoryQuestion back story question info + */ + public List getAllBackStoryQuestionID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllBackStoryQuestionIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on back story questions API go here
+ * Get list of back story question info corresponding to the given id(s) + * + * @param ids list of back story question id(s) + * @return list of back story question info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see BackStoryQuestion back story question info + */ + public List getBackStoryQuestionInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getBackStoryQuestionInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Game Build + /** + * For more info on build API go here
+ * get current game bild + * + * @return current game build + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see GameBuild game build info + */ + public GameBuild getCurrentGameBuild() throws GuildWars2Exception { + try { + Response response = gw2API.getCurrentGameBuild().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Cats + + /** + * For more info on cats API go here
+ * Get list of all available cat id(s) + * + * @return list of cat id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Color cat info + */ + public List getAllCatID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllCatIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on cats API go here
+ * Get cat info for the given cat id(s) + * + * @param ids array of cat id + * @return list of cat info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Cat cat info + */ + public List getCatInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getCatInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + //Characters /** - * For more info on Character API go here
- * Get all character names linked to given API key + * For more info on Character API go here
+ * + * @param API API key + * @return list of character name + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getAllCharacterName(String API) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getAllCharacterName(API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on character overview API go here
+ * + * @param API API key + * @param name name of character + * @return character detail + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Character character info + */ + public Character getCharacter(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacter(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on character back story API go here
+ * + * @param API API key + * @param name name of character + * @return list of {@link BackStoryAnswer#id} + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see CharacterBackStory back store answer info + */ + public CharacterBackStory getCharacterBackStory(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterBackStory(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Character Core API go here
+ * + * @param API API key + * @param name name of character + * @return character detail + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Core basic character info + */ + public Core getCharacterInformation(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterCore(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on character crafting API go here
+ * + * @param API API key + * @param name name of character + * @return list of character crafting info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see CraftingLevel character crafting info + */ + public CraftingLevel getCharacterCrafting(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterCrafting(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on character equipment API go here
+ * + * @param API API key + * @param name name of character + * @return list of equipment + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see CharacterEquipment equipment info + */ + public CharacterEquipment getCharacterEquipment(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterEquipment(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on character hero points API go here
+ * + * @param API API key + * @param name name of character + * @return list of {@link BackStoryAnswer#id} + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see BackStoryAnswer hero points info + */ + public List getCharacterHeroPoints(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response> response = gw2API.getCharacterHeroPoints(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Character Inventory API go here
+ * + * @param API API key + * @param name name of character + * @return character inventory detail + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see me.xhsun.guildwars2wrapper.model.util.Bag character inventory info + */ + public CharacterInventory getCharacterInventory(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterInventory(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Character Recipes API go here
+ * + * @param API API key + * @param name name of character + * @return list of {@link Recipe#id} + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Recipe recipe info + */ + public CharacterRecipes getCharacterUnlockedRecipes(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterUnlockedRecipes(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Character SAB API go here
+ * + * @param API API key + * @param name name of character + * @return character SAB detail + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see CharacterSAB character SAB info + */ + public CharacterSAB getCharacterSAB(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterSAB(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Character Skills API go here
+ * + * @param API API key + * @param name name of character + * @return character inventory detail + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see CharacterSkills character skills info + */ + public CharacterSkills getCharacterSkills(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterSkills(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Character Specialization API go here
+ * + * @param API API key + * @param name name of character + * @return character specialization detail + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see CharacterSpecialization character specialization info + */ + public CharacterSpecialization getCharacterSpecialization(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterSpecialization(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Character Training API go here
+ * + * @param API API key + * @param name name of character + * @return list of character training detail + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see CharacterTraining character training info + */ + public CharacterTraining getCharacterTraining(String API, String name) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + try { + Response response = gw2API.getCharacterTraining(name, API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Colors + + /** + * For more info on Color API go here
+ * Get list of all available color id(s) + * + * @return list of color id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Color color info + */ + public List getAllColorID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllColorIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Color API go here
+ * Get color info for the given color id(s) + * + * @param ids array of color id + * @return list of color info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Color color info + */ + public List getColorInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getColorInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //TP + /** + * For more info on Transaction API go here
+ * Get transaction info linked to given API key + * + * @param API API key + * @param time current | History + * @param type buy | sell + * @return list of transaction base on the selection, if there is nothing, return empty list + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Transaction transaction info + */ + public List getListing(String API, Transaction.Time time, Transaction.Type type) throws GuildWars2Exception { + isParamValid(new ParamChecker(ParamType.API, API)); + try { + Response> response = gw2API.getListing(processListingTime(time), processListingType(type), API).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Listing Price API go here
+ * Get all id of items that is on the TP + * + * @return list of item ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + */ + public List getAllListedItemID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllPrices().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Listing Price API go here
+ * Get price info for the given item id(s) + * + * @param ids list of item id + * @return list of listing price for given id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Prices listing price info + */ + public List getPrices(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getPrices(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //Continents + + /** + * For more info on continents API go here
+ * Get all continent ids + * + * @return list of continent ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Continent continent info + */ + public List getAllContinentID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllContinentIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on continents API go here
+ * Get continent info for the given continent id(s) + * + * @param ids list of continent id + * @return list of continent info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Continent continent info + */ + public List getContinentInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getContinentInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on continents API go here
+ * Get all continent floor ids + * + * @param continentID {@link Continent#id} + * @return list of continent floor ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ContinentFloor continent floor info + */ + public List getAllContinentFloorID(int continentID) throws GuildWars2Exception { + try { + Response> response = gw2API.getAllContinentFloorIDs(Integer.toString(continentID)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on continents API go here
+ * Get continent info for the given continent floor id(s) * - * @param API API key - * @return list of character name + * @param continentID {@link Continent#id} + * @param ids list of continent floor id + * @return list of continent floor info * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ContinentFloor continent floor info */ - public List getAllCharacterName(String API) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.API, API)); + public List getContinentFloorInfo(int continentID, int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { - Response> response = gw2API.getAllCharacterName(API).execute(); + Response> response = gw2API.getContinentFloorInfo(Integer.toString(continentID), processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -526,41 +1204,64 @@ public List getAllCharacterName(String API) throws GuildWars2Exception { } /** - * For more info on Character Core API go here
- * Get character information for the given character name that is linked to given API key + * For more info on continents API go here
+ * Get all continent region ids * - * @param API API key - * @param name name of character - * @return character detail + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @return list of continent region ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Core character info + * @see ContinentRegion continent region info */ - public Core getCharacterInformation(String API, String name) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + public List getAllContinentRegionID(int continentID, int floorID) throws GuildWars2Exception { try { - Response response = gw2API.getCharacterCore(name, API).execute(); + Response> response = gw2API.getAllContinentRegionIDs(Integer.toString(continentID), + Integer.toString(floorID)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } + } + /** + * For more info on continents API go here
+ * Get continent region info for the given continent region id(s) + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param ids list of continent region id + * @return list of continent region info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ContinentRegion continent region info + */ + public List getContinentRegionInfo(int continentID, int floorID, int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getContinentRegionInfo(Integer.toString(continentID), + Integer.toString(floorID), processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } } /** - * For more info on Character Inventory API go here
- * Get inventory info for the given character that is linked to given API key + * For more info on continents API go here
+ * Get all continent map ids * - * @param API API key - * @param name name of character to get inventory info - * @return character inventory detail + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @return list of continent map ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see me.xhsun.guildwars2wrapper.model.util.Bag character inventory info + * @see ContinentMap continent map info */ - public CharacterInventory getCharacterInventory(String API, String name) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); + public List getAllContinentMapID(int continentID, int floorID, int regionID) throws GuildWars2Exception { try { - Response response = gw2API.getCharacterInventory(name, API).execute(); + Response> response = gw2API.getAllContinentMapIDs(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -568,19 +1269,46 @@ public CharacterInventory getCharacterInventory(String API, String name) throws } } - //Colors + /** + * For more info on continents API go here
+ * Get continent map info for the given continent map id(s) + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param ids list of continent map id + * @return list of continent map info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ContinentMap continent map info + */ + public List getContinentMapInfo(int continentID, int floorID, int regionID, int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getContinentMapInfo(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID), processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } /** - * For more info on Color API go here
- * Get list of all available color id(s) + * For more info on continents API go here
+ * Get all continent map sector ids * - * @return list of color id(s) + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @return list of continent map sector ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Color color info + * @see ContinentMap.Sector continent map sector info */ - public List getAllColorID() throws GuildWars2Exception { + public List getAllContinentSectorID(int continentID, int floorID, int regionID, int mapID) throws GuildWars2Exception { try { - Response> response = gw2API.getAllColorIDs().execute(); + Response> response = gw2API.getAllContinentSectorIDs(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -589,18 +1317,23 @@ public List getAllColorID() throws GuildWars2Exception { } /** - * For more info on Color API go here
- * Get color info for the given color id(s) + * For more info on continents API go here
+ * Get continent map sector info for the given continent map sector id(s) * - * @param ids array of color id - * @return list of color info + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param ids list of continent map sector id + * @return list of continent map sector info * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Color color info + * @see ContinentMap.Sector continent map sector info */ - public List getColorInfo(int[] ids) throws GuildWars2Exception { + public List getContinentSectorInfo(int continentID, int floorID, int regionID, int mapID, int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response> response = gw2API.getColorInfo(processIds(ids)).execute(); + Response> response = gw2API.getContinentSectorInfo(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -608,22 +1341,22 @@ public List getColorInfo(int[] ids) throws GuildWars2Exception { } } - //TP /** - * For more info on Transaction API go here
- * Get transaction info linked to given API key + * For more info on continents API go here
+ * Get all continent map PoI ids * - * @param API API key - * @param time current | History - * @param type buy | sell - * @return list of transaction base on the selection, if there is nothing, return empty list + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @return list of continent map PoI ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Transaction transaction info + * @see ContinentMap.Sector continent map PoI info */ - public List getListing(String API, Transaction.Time time, Transaction.Type type) throws GuildWars2Exception { - isParamValid(new ParamChecker(ParamType.API, API)); + public List getAllContinentPOIID(int continentID, int floorID, int regionID, int mapID) throws GuildWars2Exception { try { - Response> response = gw2API.getListing(processListingTime(time), processListingType(type), API).execute(); + Response> response = gw2API.getAllContinentPOIIDs(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -632,15 +1365,23 @@ public List getListing(String API, Transaction.Time time, Transacti } /** - * For more info on Listing Price API go here
- * Get all id of items that is on the TP + * For more info on continents API go here
+ * Get continent map PoI info for the given continent map PoI id(s) * - * @return list of item ids + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param ids list of continent map PoI id + * @return list of continent map PoI info * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ContinentMap.PoI continent map PoI info */ - public List getAllListedItemID() throws GuildWars2Exception { + public List getContinentPOIInfo(int continentID, int floorID, int regionID, int mapID, int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); try { - Response> response = gw2API.getAllPrices().execute(); + Response> response = gw2API.getContinentPOIInfo(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -649,18 +1390,46 @@ public List getAllListedItemID() throws GuildWars2Exception { } /** - * For more info on Listing Price API go here
- * Get price info for the given item id(s) + * For more info on continents API go here
+ * Get all continent map task ids * - * @param ids list of item id - * @return list of listing price for given id(s) + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @return list of continent map task ids * @throws GuildWars2Exception see {@link ErrorCode} for detail - * @see Prices listing price info + * @see ContinentMap.Task continent map task info */ - public List getPrices(int[] ids) throws GuildWars2Exception { + public List getAllContinentTaskID(int continentID, int floorID, int regionID, int mapID) throws GuildWars2Exception { + try { + Response> response = gw2API.getAllContinentTaskIDs(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on continents API go here
+ * Get continent map task info for the given continent map task id(s) + * + * @param continentID {@link Continent#id} + * @param floorID {@link ContinentFloor#id} + * @param regionID {@link ContinentRegion#id} + * @param mapID {@link ContinentMap#id} + * @param ids list of continent map task id + * @return list of continent map task info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see ContinentMap.Task continent map task info + */ + public List getContinentTaskInfo(int continentID, int floorID, int regionID, int mapID, int[] ids) throws GuildWars2Exception { isParamValid(new ParamChecker(ids)); try { - Response> response = gw2API.getPrices(processIds(ids)).execute(); + Response> response = gw2API.getContinentTaskInfo(Integer.toString(continentID), + Integer.toString(floorID), Integer.toString(regionID), Integer.toString(mapID), processIds(ids)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { @@ -1031,7 +1800,7 @@ public List getMasteryInfo(int[] ids) throws GuildWars2Exception { //Material Categories /** - * For more info on Material Category API go here
+ * For more info on Material MaterialCategory API go here
* Get list of all available material category ids * * @return list of material category id @@ -1049,7 +1818,7 @@ public List getAllMaterialCategoryID() throws GuildWars2Exception { } /** - * For more info on Material Category API go here
+ * For more info on Material MaterialCategory API go here
* Get material category info for the given category id(s) * * @param ids list of category id @@ -1148,6 +1917,86 @@ public List getOutfitInfo(int[] ids) throws GuildWars2Exception { } } + //Professions + + /** + * For more info on professions API go here
+ * Get all profession id(s) + * + * @return list of profession id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Profession profession info + */ + public List getAllProfessionID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllProfessionIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on professions API go here
+ * Get profession info for the given profession id(s) + * + * @param ids list of profession id(s) + * @return list of profession info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Profession Profession info + */ + public List getProfessionInfo(String[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getProfessionInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + //PvP Amulets + + /** + * For more info on pvp amulets API go here
+ * Get all amulet id(s) + * + * @return list of amulet id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Amulet amulet info + */ + public List getAllPvPAmuletID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllPvPAmuletIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on pvp amulets API go here
+ * Get amulet info for the given amulet id(s) + * + * @param ids list of amulet id(s) + * @return list of amulet info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Amulet amulet info + */ + public List getPvPAmuletInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getPvPAmuletInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + //PvP Heroes /** @@ -1290,6 +2139,46 @@ public List searchRecipes(boolean isInput, int id) throws GuildWars2Exc } } + //Skills + + /** + * For more info on Skills API go here
+ * Get list of all available skill ids + * + * @return list of skill ids + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Skill skill info + */ + public List getAllSkillID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllSkillIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on Skills API go here
+ * Get skill info for the given skill id(s) + * + * @param ids list of skill id + * @return list of skill info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Skill skill info + */ + public List getSkillInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getSkillInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + //Skins /** @@ -1330,6 +2219,46 @@ public List getSkinInfo(int[] ids) throws GuildWars2Exception { } } + //Specializations + + /** + * For more info on specializations API go here
+ * Get all specialization id(s) + * + * @return list of specialization id(s) + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Specialization specialization info + */ + public List getAllSpecializationID() throws GuildWars2Exception { + try { + Response> response = gw2API.getAllSpecializationIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on specializations API go here
+ * Get specialization info for the specialization title id(s) + * + * @param ids list of specialization id(s) + * @return list of specialization info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Specialization specialization info + */ + public List getSpecializationInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response> response = gw2API.getSpecializationInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + //Titles /** @@ -1370,6 +2299,46 @@ public List getTitleInfo(int[] ids) throws GuildWars2Exception { } } + //Trait + + /** + * For more info on traits API go <a href="https://wiki.guildwars2.com/wiki/API:2/traits">here</a><br/> + * Get list of all available trait id(s) + * + * @return list of trait id + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Trait trait info + */ + public List<Integer> getAllTraitID() throws GuildWars2Exception { + try { + Response<List<Integer>> response = gw2API.getAllTraitIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on traits API go <a href="https://wiki.guildwars2.com/wiki/API:2/traits">here</a><br/> + * Get trait info for the given trait id(s) + * + * @param ids list of trait id + * @return list of trait info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Trait trait info + */ + public List<Trait> getTraitInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response<List<Trait>> response = gw2API.getTraitInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + //Worlds /** @@ -1409,4 +2378,44 @@ public List<World> getWorldInfo(int[] ids) throws GuildWars2Exception { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } } + + //WvW Abilities + + /** + * For more info on WvW abilities API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/abilities">here</a><br/> + * Get list of all available wvw ability id(s) + * + * @return list of wvw ability id + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Ability wvw ability info + */ + public List<Integer> getAllWvWAbilityID() throws GuildWars2Exception { + try { + Response<List<Integer>> response = gw2API.getAllWvWAbilityIDs().execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } + + /** + * For more info on WvW abilities API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/abilities">here</a><br/> + * Get wvw ability info for the given world id(s) + * + * @param ids list of wvw ability id + * @return list of wvw ability info + * @throws GuildWars2Exception see {@link ErrorCode} for detail + * @see Ability wvw ability info + */ + public List<Ability> getWvWAbilityInfo(int[] ids) throws GuildWars2Exception { + isParamValid(new ParamChecker(ids)); + try { + Response<List<Ability>> response = gw2API.getWvWAbilityInfo(processIds(ids)).execute(); + if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); + return response.body(); + } catch (IOException e) { + throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); + } + } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/error/ErrorCode.java b/src/main/java/me/xhsun/guildwars2wrapper/error/ErrorCode.java index e0f45fa..4c8d7db 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/error/ErrorCode.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/error/ErrorCode.java @@ -43,7 +43,7 @@ public static GuildWars2Exception checkErrorResponse(int code, String error) { case 400://no such character if (errorResponse != null && (errorResponse.getText().contains("key"))) return new GuildWars2Exception(ErrorCode.Key, "Invalid key"); - else if (errorResponse != null && (errorResponse.getText().contains("input") || errorResponse.getText().contains("output"))) + else if (errorResponse != null && errorResponse.getText().matches(".*\\b(input|output|id|ids|floor|region|map)\\b.*")) return new GuildWars2Exception(ErrorCode.ID, "Invalid id"); return new GuildWars2Exception(ErrorCode.Character, "No such character for this account"); case 200://what... why pass OK response diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Cat.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Cat.java new file mode 100644 index 0000000..92ee646 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Cat.java @@ -0,0 +1,26 @@ +package me.xhsun.guildwars2wrapper.model; + +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + +/** + * For more info on cats API go <a href="https://wiki.guildwars2.com/wiki/API:2/cats">here</a><br/> + * Model class for cats + * + * @author xhsun + * @since 2017-06-05 + */ +public class Cat extends IdentifiableInt { + private String hint; + + public String getHint() { + return hint; + } + + @Override + public String toString() { + return "Cat{" + + "id=" + getId() + + ", hint='" + hint + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java index 05e8200..522e3e2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Color.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model; import com.google.gson.annotations.Expose; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; import java.util.Arrays; import java.util.List; @@ -12,15 +13,13 @@ * @author xhsun * @since 2017-06-05 */ -public class Color { +public class Color extends NameableInt { public enum Categories { Gray, Brown, Red, Orange, Yellow, Green, Blue, Purple, Vibrant, Leather, Metal, Starter, Common, Uncommon, Rare } - private int id; - private String name; private int[] base_rgb; private ColorDetail cloth; private ColorDetail leather; @@ -28,14 +27,6 @@ public enum Categories { private int item;//item id for the dye private List<Categories> categories; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public int[] getBaseRgb() { return base_rgb; } @@ -63,28 +54,28 @@ public List<Categories> getCategories() { return categories; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Color color = (Color) o; - - return id == color.id && item == color.item; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + item; - return result; - } +// @Override +// public boolean equals(Object o) { +// if (this == o) return true; +// if (o == null || getClass() != o.getClass()) return false; +// +// Color color = (Color) o; +// +// return getId() == color.getId() && item == color.item; +// } +// +// @Override +// public int hashCode() { +// int result = getId(); +// result = 31 * result + item; +// return result; +// } @Override public String toString() { return "Color{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", base_rgb=" + Arrays.toString(base_rgb) + ", cloth=" + cloth + ", leather=" + leather + @@ -135,37 +126,6 @@ public int[] getRgb() { return rgb; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ColorDetail that = (ColorDetail) o; - - return brightness == that.brightness && - Double.compare(that.contrast, contrast) == 0 && - hue == that.hue && - Double.compare(that.saturation, saturation) == 0 && - Double.compare(that.lightness, lightness) == 0 && - Arrays.equals(rgb, that.rgb); - } - - @Override - public int hashCode() { - int result; - long temp; - result = brightness; - temp = Double.doubleToLongBits(contrast); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + hue; - temp = Double.doubleToLongBits(saturation); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - temp = Double.doubleToLongBits(lightness); - result = 31 * result + (int) (temp ^ (temp >>> 32)); - result = 31 * result + Arrays.hashCode(rgb); - return result; - } - @Override public String toString() { return "ColorDetail{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java index b4589d8..573c3ad 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Currency.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + /** * For more info on Currency API go <a href="https://wiki.guildwars2.com/wiki/API:2/currencies">here</a><br/> * Currency model class<br/> @@ -9,21 +11,11 @@ * @since 2017-02-07 */ -public class Currency { - private int id; - private String name; +public class Currency extends NameableInt { private String description; private String icon; private int order; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public String getDescription() { return description; } @@ -36,26 +28,11 @@ public int getOrder() { return order; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Currency currency = (Currency) o; - - return id == currency.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Currency{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", description='" + description + '\'' + ", icon='" + icon + '\'' + ", order=" + order + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java index 5d441fc..2dd7e13 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Dungeon.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableStr; + import java.util.List; /** @@ -9,67 +11,27 @@ * @author xhsun * @since 2017-06-06 */ -public class Dungeon { - private String id; +public class Dungeon extends IdentifiableStr { private List<Path> paths; - public String getId() { - return id; - } - public List<Path> getPaths() { return paths; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Dungeon dungeon = (Dungeon) o; - - return id != null ? id.equals(dungeon.id) : dungeon.id == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - @Override public String toString() { return "Dungeon{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + ", paths=" + paths + '}'; } - public class Path { - private String id; - - public String getId() { - return id; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Path path = (Path) o; - - return id != null ? id.equals(path.id) : path.id == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } + public class Path extends IdentifiableStr { @Override public String toString() { return "Path{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/GameBuild.java b/src/main/java/me/xhsun/guildwars2wrapper/model/GameBuild.java new file mode 100644 index 0000000..522158b --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/GameBuild.java @@ -0,0 +1,38 @@ +package me.xhsun.guildwars2wrapper.model; + +/** + * For more info on build API go <a href="https://wiki.guildwars2.com/wiki/API:2/build">here</a><br/> + * Model class for current game guild + * + * @author xhsun + * @since 2017-06-07 + */ +public class GameBuild { + private long id; + + public long getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + GameBuild build = (GameBuild) o; + + return id == build.id; + } + + @Override + public int hashCode() { + return (int) (id ^ (id >>> 32)); + } + + @Override + public String toString() { + return "GameBuild{" + + "id=" + id + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java index 695ab20..84a8405 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Item.java @@ -1,5 +1,6 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.Linkable; import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemDetail; import java.util.List; @@ -12,7 +13,7 @@ * @since 2017-02-07 */ -public class Item { +public class Item extends Linkable { public enum Type { Armor, Back, Bag, Consumable, Container, CraftingMaterial, Gathering, Gizmo, MiniPet, Tool, Trait, Trinket, Trophy, UpgradeComponent, Weapon @@ -32,9 +33,6 @@ public enum Restriction { public enum GameType {Activity, Dungeon, Pve, Pvp, PvpLobby, Wvw} - private int id; - private String chat_link; - private String name; private String icon; private String description; private Type type; @@ -47,18 +45,6 @@ public enum GameType {Activity, Dungeon, Pve, Pvp, PvpLobby, Wvw} private List<Restriction> restrictions; private ItemDetail details; - public int getId() { - return id; - } - - public String getChatLink() { - return chat_link; - } - - public String getName() { - return name; - } - public String getIcon() { return icon; } @@ -103,27 +89,12 @@ public ItemDetail getDetails() { return details; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Item item = (Item) o; - - return id == item.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Item{" + - "id=" + id + - ", chat_link='" + chat_link + '\'' + - ", name='" + name + '\'' + + "id=" + getId() + + ", chat_link='" + getChatLink() + '\'' + + ", name='" + getName() + '\'' + ", icon='" + icon + '\'' + ", description='" + description + '\'' + ", type=" + type + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java b/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java index c41f52f..ba21432 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/ItemStats.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemAttributes; /** @@ -11,48 +12,18 @@ * @see ItemAttributes item attribute * @since 2017-02-07 */ -public class ItemStats { - private int id; - private String name; +public class ItemStats extends NameableInt { private ItemAttributes attributes; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public ItemAttributes getAttributes() { return attributes; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ItemStats itemStats = (ItemStats) o; - - return id == itemStats.id && - (name != null ? name.equals(itemStats.name) : itemStats.name == null) && - (attributes != null ? attributes.equals(itemStats.attributes) : itemStats.attributes == null); - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (attributes != null ? attributes.hashCode() : 0); - return result; - } - @Override public String toString() { return "ItemStats{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", attributes=" + attributes + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java index 0792472..71c15e2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Mastery.java @@ -1,5 +1,6 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; import me.xhsun.guildwars2wrapper.model.util.comm.Region; import java.util.List; @@ -11,23 +12,13 @@ * @author xhsun * @since 2017-06-06 */ -public class Mastery { - private int id; - private String name; +public class Mastery extends NameableInt { private String requirement; private int order; private String background; private Region region; private List<Detail> levels; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public String getRequirement() { return requirement; } @@ -48,26 +39,11 @@ public List<Detail> getLevels() { return levels; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Mastery mastery = (Mastery) o; - - return id == mastery.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Mastery{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", requirement='" + requirement + '\'' + ", order=" + order + ", background='" + background + '\'' + @@ -108,32 +84,6 @@ public int getExpCost() { return exp_cost; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Detail details = (Detail) o; - - return point_cost == details.point_cost && - exp_cost == details.exp_cost && - (name != null ? name.equals(details.name) : details.name == null) && - (description != null ? description.equals(details.description) : details.description == null) && - (instruction != null ? instruction.equals(details.instruction) : details.instruction == null) && - (icon != null ? icon.equals(details.icon) : details.icon == null); - } - - @Override - public int hashCode() { - int result = name != null ? name.hashCode() : 0; - result = 31 * result + (description != null ? description.hashCode() : 0); - result = 31 * result + (instruction != null ? instruction.hashCode() : 0); - result = 31 * result + (icon != null ? icon.hashCode() : 0); - result = 31 * result + point_cost; - result = 31 * result + exp_cost; - return result; - } - @Override public String toString() { return "Details{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java index 7748d7a..cf24b4b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/MaterialCategory.java @@ -1,9 +1,11 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + import java.util.List; /** - * For more info on Material Category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> + * For more info on Material category API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> * Material category model class * * @author xhsun @@ -11,43 +13,18 @@ * @since 2017-02-07 */ -public class MaterialCategory { - private int id; - private String name; +public class MaterialCategory extends NameableInt { private List<Integer> items; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public List<Integer> getItems() { return items; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - MaterialCategory that = (MaterialCategory) o; - - return id == that.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "MaterialCategory{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", items=" + items + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java index e815100..9ee98f9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Mini.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + /** * For more info on Mini API go <a href="https://wiki.guildwars2.com/wiki/API:2/minis">here</a><br/> * Model class for minis @@ -7,22 +9,12 @@ * @author xhsun * @since 2017-06-05 */ -public class Mini { - private int id; - private String name; +public class Mini extends NameableInt { private String unlock; private String icon; private int order; private int item_id; - public int getId() { - return id; - } - - public String getName() { - return name; - } - /** * @return A description of how to unlock the mini (only present on a few entries). */ @@ -42,26 +34,11 @@ public int getItemId() { return item_id; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Mini minis = (Mini) o; - - return id == minis.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Mini{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", unlock='" + unlock + '\'' + ", icon='" + icon + '\'' + ", order=" + order + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Profession.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Profession.java new file mode 100644 index 0000000..6465a15 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Profession.java @@ -0,0 +1,196 @@ +package me.xhsun.guildwars2wrapper.model; + +import me.xhsun.guildwars2wrapper.model.Skill.Slot; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableStr; +import me.xhsun.guildwars2wrapper.model.util.comm.Type; + +import java.util.List; +import java.util.Map; + +/** + * For more info on professions API go <a href="https://wiki.guildwars2.com/wiki/API:2/professions">here</a><br/> + * Model class for professions + * + * @author xhsun + * @since 2017-06-15 + */ +public class Profession extends NameableStr { + public enum TrainingCategory {Skills, Specializations, EliteSpecializations} + + private enum TrackType {Trait, Skill} + + public enum Attunement {Fire, Water, Air, Earth} + + public enum Flag {Mainhand, Offhand, TwoHand, Aquatic, NoRacialSkills, NoWeaponSwap} + + private String icon, icon_big; + private List<Flag> flags; + private List<Integer> specializations; + private List<Training> training; + private List<Skill> skills; + private Map<String, Weapon> weapons; + + public String getIcon() { + return icon; + } + + public String getIconBig() { + return icon_big; + } + + public List<Integer> getSpecializations() { + return specializations; + } + + public List<Training> getTraining() { + return training; + } + + public Map<String, Weapon> getWeapons() { + return weapons; + } + + public List<Flag> getFlags() { + return flags; + } + + public List<Skill> getSkills() { + return skills; + } + + @Override + public String toString() { + return "Profession{" + + super.toString() + + ", icon='" + icon + '\'' + + ", icon_big='" + icon_big + '\'' + + ", flags=" + flags + + ", specializations=" + specializations + + ", training=" + training + + ", skills=" + skills + + ", weapons=" + weapons + + '}'; + } + + public class Training extends NameableInt { + private TrainingCategory category; + private List<TrainingTrack> track; + + public TrainingCategory getCategory() { + return category; + } + + public List<TrainingTrack> getTrack() { + return track; + } + + @Override + public String toString() { + return "Training{" + + super.toString() + + ", category=" + category + + ", track=" + track + + '}'; + } + } + + public class TrainingTrack { + private int cost, skill_id, trait_id; + private TrackType type; + + public int getCost() { + return cost; + } + + public int getSkill_id() { + return skill_id; + } + + public int getTrait_id() { + return trait_id; + } + + public TrackType getType() { + return type; + } + + @Override + public String toString() { + return "TrainingTrack{" + + "cost=" + cost + + ", skill_id=" + skill_id + + ", trait_id=" + trait_id + + ", type=" + type + + '}'; + } + } + + public class Weapon { + private int specialization; + private List<Skill> skills; + private List<Flag> flags; + + public int getSpecialization() { + return specialization; + } + + public List<Skill> getSkills() { + return skills; + } + + public List<Flag> getFlags() { + return flags; + } + + @Override + public String toString() { + return "Weapon{" + + "specialization=" + specialization + + ", skills=" + skills + + ", flags=" + flags + + '}'; + } + } + + public class Skill extends IdentifiableInt { + private Slot slot; + private Type offhand; + private Type type; + private Attunement attunement; + private Item.Restriction source; + + public Slot getSlot() { + return slot; + } + + public Type getOffhand() { + return offhand; + } + + public Attunement getAttunement() { + return attunement; + } + + public Item.Restriction getSource() { + return source; + } + + public Type getType() { + return type; + } + + @Override + public String toString() { + return "Skill{" + + "id=" + getId() + + ", slot=" + slot + + ", offhand=" + offhand + + ", type=" + type + + ", attunement=" + attunement + + ", source=" + source + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java index 098c149..5d82183 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Raid.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableStr; + import java.util.List; /** @@ -9,110 +11,49 @@ * @author xhsun * @since 2017-06-06 */ -public class Raid { +public class Raid extends IdentifiableStr { public enum EventType {Checkpoint, Boss} - - private String id; private List<Wing> wings; - public String getId() { - return id; - } - public List<Wing> getWings() { return wings; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Raid raid = (Raid) o; - - return id != null ? id.equals(raid.id) : raid.id == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - @Override public String toString() { return "Raid{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + ", wings=" + wings + '}'; } - public class Wing { - private String id; + public class Wing extends IdentifiableStr { private List<Event> events; - public String getId() { - return id; - } - public List<Event> getEvents() { return events; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Wing wing = (Wing) o; - - return id != null ? id.equals(wing.id) : wing.id == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - @Override public String toString() { return "Wing{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + ", events=" + events + '}'; } } - public class Event { - private String id; + public class Event extends IdentifiableStr { private EventType type; - public String getId() { - return id; - } - public EventType getType() { return type; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Event event = (Event) o; - - return id != null ? id.equals(event.id) : event.id == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - @Override public String toString() { return "Event{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + ", type=" + type + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java index 8741727..f6c729f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Recipe.java @@ -1,6 +1,6 @@ package me.xhsun.guildwars2wrapper.model; -import com.google.gson.annotations.Expose; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; import me.xhsun.guildwars2wrapper.model.util.comm.CraftingDisciplines; import me.xhsun.guildwars2wrapper.model.util.comm.Type; @@ -13,10 +13,8 @@ * @author xhsun * @since 2017-06-05 */ -public class Recipe { +public class Recipe extends IdentifiableInt { public enum Flag {AutoLearned, LearnedFromItem} - - private int id; private Type type; private int output_item_id; private int output_item_count; @@ -29,10 +27,6 @@ public enum Flag {AutoLearned, LearnedFromItem} private long output_upgrade_id; private String chat_link; - public int getId() { - return id; - } - public Type getType() { return type; } @@ -77,25 +71,10 @@ public String getChatLink() { return chat_link; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Recipe recipe = (Recipe) o; - - return id == recipe.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Recipe{" + - "id=" + id + + "id=" + getId() + ", type=" + type + ", output_item_id=" + output_item_id + ", output_item_count=" + output_item_count + @@ -114,17 +93,17 @@ public String toString() { * recipe ingredients */ public class Ingredient { - @Expose private int item_id; - @Expose private int upgrade_id; - @Expose private int count; public int getItemId() { return item_id; } + /** + * @return {@link me.xhsun.guildwars2wrapper.model.guild.Upgrade#id} + */ public int getUpgradeId() { return upgrade_id; } @@ -133,26 +112,6 @@ public int getCount() { return count; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Ingredient that = (Ingredient) o; - - return item_id == that.item_id && - upgrade_id == that.upgrade_id && - count == that.count; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + upgrade_id; - result = 31 * result + count; - return result; - } - @Override public String toString() { return "Ingredient{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Skill.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Skill.java new file mode 100644 index 0000000..4759268 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Skill.java @@ -0,0 +1,156 @@ +package me.xhsun.guildwars2wrapper.model; + +import me.xhsun.guildwars2wrapper.model.indentifiable.Linkable; +import me.xhsun.guildwars2wrapper.model.util.comm.Type; +import me.xhsun.guildwars2wrapper.model.util.skillFact.SkillFact; +import me.xhsun.guildwars2wrapper.model.util.skillFact.SkillTraitedFact; + +import java.util.List; + +/** + * For more info on Skills API go <a href="https://wiki.guildwars2.com/wiki/API:2/skills">here</a><br/> + * Model class for Skill + * + * @author xhsun + * @since 2017-06-15 + */ +public class Skill extends Linkable { + public enum Flag {GroundTargeted, NoUnderwater} + + public enum Category { + Physical, Glyph, Signet, Shout, Well, Consecration, Meditation, + SpiritWeapon, Symbol, Virtue, Ward, Legend, LegendaryAssassin, + LegendaryCentaur, LegendaryDemon, LegendaryDragon, LegendaryDwarf, + Banner, Burst, PrimalBurst, Rage, Stance, kit, Elixir, Gadget, Gyro, + Turret, CelestialAvatar, Pet, Spirit, Survival, Deception, DualWield, + StealthAttack, Trick, Venom, Arcane, Cantrip, Conjure, Overload, + Clone, Glamour, Manipulation, Mantra, Phantasm, Corruption, Mark, + Minion, Spectral, Transform + } + + public enum Slot { + Weapon_1, Weapon_2, Weapon_3, Weapon_4, Weapon_5, + Profession_1, Profession_2, Profession_3, Profession_4, Profession_5, + Downed_1, Downed_2, Downed_3, Downed_4, + Utility, Heal, Elite, Pet + } + + private String description, icon; + private Type type, weapon_type, dual_wield; + private List<Item.Restriction> professions; + private Slot slot; + private List<Flag> flags; + private List<SkillFact> facts; + private List<SkillTraitedFact> traited_facts; + private List<Category> categories; + private Profession.Attunement attunement; + private int cost, flip_skill, initiative, next_chain, prev_chain, toolbelt_skill; + private List<Integer> transform_skills, bundle_skills;//list of skill id + + public String getDescription() { + return description; + } + + public String getIcon() { + return icon; + } + + public Type getType() { + return type; + } + + public Type getWeapon_type() { + return weapon_type; + } + + public Type getDual_wield() { + return dual_wield; + } + + public List<Item.Restriction> getProfessions() { + return professions; + } + + public Slot getSlot() { + return slot; + } + + public List<Flag> getFlags() { + return flags; + } + + public List<SkillFact> getFacts() { + return facts; + } + + public List<SkillTraitedFact> getTraited_facts() { + return traited_facts; + } + + public List<Category> getCategories() { + return categories; + } + + public Profession.Attunement getAttunement() { + return attunement; + } + + public int getCost() { + return cost; + } + + public int getFlip_skill() { + return flip_skill; + } + + public int getInitiative() { + return initiative; + } + + public int getNext_chain() { + return next_chain; + } + + public int getPrev_chain() { + return prev_chain; + } + + public int getToolbelt_skill() { + return toolbelt_skill; + } + + public List<Integer> getTransform_skills() { + return transform_skills; + } + + public List<Integer> getBundle_skills() { + return bundle_skills; + } + + @Override + public String toString() { + return "Skill{" + + super.toString() + + ", description='" + description + '\'' + + ", icon='" + icon + '\'' + + ", type=" + type + + ", weapon_type=" + weapon_type + + ", dual_wield=" + dual_wield + + ", professions=" + professions + + ", slot=" + slot + + ", flags=" + flags + + ", facts=" + facts + + ", traited_facts=" + traited_facts + + ", categories=" + categories + + ", attunement=" + attunement + + ", cost=" + cost + + ", flip_skill=" + flip_skill + + ", initiative=" + initiative + + ", next_chain=" + next_chain + + ", prev_chain=" + prev_chain + + ", toolbelt_skill=" + toolbelt_skill + + ", transform_skills=" + transform_skills + + ", bundle_skills=" + bundle_skills + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java index 2338a14..cd5dac5 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Skin.java @@ -1,6 +1,6 @@ package me.xhsun.guildwars2wrapper.model; -import com.google.gson.annotations.Expose; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; import me.xhsun.guildwars2wrapper.model.util.comm.Type; import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemDetail; @@ -16,11 +16,8 @@ * @since 2017-02-07 */ -public class Skin { +public class Skin extends NameableInt { public enum Flag {ShowInWardrobe, NoCost, HideIfLocked, OverrideRarity} - - private int id; - private String name; private Item.Type type; private List<Flag> flags; private List<Item.Restriction> restrictions; @@ -29,14 +26,6 @@ public enum Flag {ShowInWardrobe, NoCost, HideIfLocked, OverrideRarity} private String description; private Detail details; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public Item.Type getType() { return type; } @@ -65,26 +54,11 @@ public Detail getDetails() { return details; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Skin skin = (Skin) o; - - return id == skin.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Skin{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", type=" + type + ", flags=" + flags + ", restrictions=" + restrictions + @@ -103,11 +77,8 @@ public String toString() { */ public class Detail { - @Expose private Type type; - @Expose private ItemDetail.Weight weight_class; - @Expose private ItemDetail.Damage damage_type; public Type getType() { @@ -122,27 +93,6 @@ public ItemDetail.Damage getDamageType() { return damage_type; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Detail detail = (Detail) o; - - return type == detail.type && - weight_class == detail.weight_class && - damage_type == detail.damage_type; - - } - - @Override - public int hashCode() { - int result = type != null ? type.hashCode() : 0; - result = 31 * result + (weight_class != null ? weight_class.hashCode() : 0); - result = 31 * result + (damage_type != null ? damage_type.hashCode() : 0); - return result; - } - @Override public String toString() { return "Detail{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Specialization.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Specialization.java new file mode 100644 index 0000000..ee6795c --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Specialization.java @@ -0,0 +1,56 @@ +package me.xhsun.guildwars2wrapper.model; + +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + +import java.util.List; + +/** + * For more info on specializations API go <a href="https://wiki.guildwars2.com/wiki/API:2/specializations">here</a><br/> + * Model class for specialization + * + * @author xhsun + * @since 2017-06-15 + */ +public class Specialization extends NameableInt { + private Item.Restriction profession; + private boolean elite; + private String background, icon; + private List<Integer> minor_traits, major_traits; + + public Item.Restriction getProfession() { + return profession; + } + + public boolean isElite() { + return elite; + } + + public String getIcon() { + return icon; + } + + public String getBackground() { + return background; + } + + public List<Integer> getMinor_traits() { + return minor_traits; + } + + public List<Integer> getMajor_traits() { + return major_traits; + } + + @Override + public String toString() { + return "Specialization{" + + super.toString() + + ", profession=" + profession + + ", elite=" + elite + + ", icon='" + icon + '\'' + + ", background='" + background + '\'' + + ", minor_traits=" + minor_traits + + ", major_traits=" + major_traits + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Title.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Title.java index f01f049..c2adfce 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/Title.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Title.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model; import me.xhsun.guildwars2wrapper.model.achievements.Achievement; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; import java.util.List; @@ -11,21 +12,11 @@ * @author xhsun * @since 2017-06-06 */ -public class Title { - private int id; - private String name; +public class Title extends NameableInt { private int achievement; private List<Integer> achievements; private int ap_required; - public int getId() { - return id; - } - - public String getName() { - return name; - } - /** * @return {@link Achievement} id */ @@ -44,26 +35,11 @@ public int getApRequired() { return ap_required; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Title title = (Title) o; - - return id == title.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Title{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", achievement=" + achievement + ", achievements=" + achievements + ", ap_required=" + ap_required + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java b/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java index 939d4fc..bac95e8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/TokenInfo.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableStr; + import java.util.List; /** @@ -10,15 +12,10 @@ * @since 2017-02-07 */ -public class TokenInfo { - private String id; +public class TokenInfo extends IdentifiableStr { private String name; private List<String> permissions; - public String getId() { - return id; - } - public String getName() { return name; } @@ -27,25 +24,10 @@ public List<String> getPermissions() { return permissions; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - TokenInfo tokenInfo = (TokenInfo) o; - - return id != null ? id.equals(tokenInfo.id) : tokenInfo.id == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - @Override public String toString() { return "TokenInfo{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + ", name='" + name + '\'' + ", permissions=" + permissions + '}'; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/Trait.java b/src/main/java/me/xhsun/guildwars2wrapper/model/Trait.java new file mode 100644 index 0000000..c4ed9e6 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/Trait.java @@ -0,0 +1,110 @@ +package me.xhsun.guildwars2wrapper.model; + +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; +import me.xhsun.guildwars2wrapper.model.util.skillFact.SkillFact; +import me.xhsun.guildwars2wrapper.model.util.skillFact.SkillTraitedFact; + +import java.util.List; + +/** + * For more info on traits API go <a href="https://wiki.guildwars2.com/wiki/API:2/traits">here</a><br/> + * Model class for traits + * + * @author xhsun + * @since 2017-06-05 + */ +public class Trait extends NameableInt { + public enum Slot {Major, Minor} + + private String icon, description; + private Slot slot; + private int specialization, tier, order; + private List<SkillFact> facts; + private List<SkillTraitedFact> traited_facts; + private List<Skill> skills; + + public String getIcon() { + return icon; + } + + public String getDescription() { + return description; + } + + public Slot getSlot() { + return slot; + } + + public int getSpecialization() { + return specialization; + } + + public int getTier() { + return tier; + } + + public int getOrder() { + return order; + } + + public List<SkillFact> getFacts() { + return facts; + } + + public List<SkillTraitedFact> getTraited_facts() { + return traited_facts; + } + + public List<Skill> getSkills() { + return skills; + } + + @Override + public String toString() { + return "Trait{" + + super.toString() + + ", icon='" + icon + '\'' + + ", description='" + description + '\'' + + ", slot=" + slot + + ", specialization=" + specialization + + ", order=" + order + + ", tier=" + tier + + ", facts=" + facts + + ", traited_facts=" + traited_facts + + ", skills=" + skills + + '}'; + } + + public class Skill extends NameableInt { + private String description, icon; + private List<SkillFact> facts; + private List<SkillTraitedFact> traited_facts; + + public String getDescription() { + return description; + } + + public String getIcon() { + return icon; + } + + public List<SkillFact> getFacts() { + return facts; + } + + public List<SkillTraitedFact> getTraited_facts() { + return traited_facts; + } + + @Override + public String toString() { + return "Skill{" + + super.toString() + + ", description='" + description + '\'' + + ", icon='" + icon + '\'' + + ", facts=" + facts + + ", traited_facts=" + traited_facts + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/World.java b/src/main/java/me/xhsun/guildwars2wrapper/model/World.java index 7f2afc3..c197657 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/World.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/World.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + /** * For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/> * World detail model class<br/> @@ -14,23 +16,12 @@ * @since 2017-02-07 */ -public class World { +public class World extends NameableInt { public enum Region {EU, NA, ERROR} - - private int id; - private String name; private String population; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public Region getRegion() { - switch (Integer.parseInt(Integer.toString(id).substring(0, 1))) { + switch (Integer.parseInt(Integer.toString(getId()).substring(0, 1))) { case 1: return Region.NA; case 2: @@ -44,26 +35,11 @@ public String getPopulation() { return population; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - World world = (World) o; - - return id == world.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "World{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", population='" + population + '\'' + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java index b880828..ad0c1ad 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Account.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model.account; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableStr; + import java.util.List; /** @@ -12,10 +14,9 @@ * @since 2017-02-06 */ -public class Account { +public class Account extends IdentifiableStr { public enum Access {None, PlayForFree, GuildWars2, HeartOfThorns} - private String id; private long age; private String name; private int world = -1; @@ -29,10 +30,6 @@ public enum Access {None, PlayForFree, GuildWars2, HeartOfThorns} private long monthly_ap; private long wvw_rank; - public String getId() { - return id; - } - public long getAge() { return age; } @@ -84,28 +81,10 @@ public long getWvwRank() { return wvw_rank; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Account account = (Account) o; - - return (id != null ? id.equals(account.id) : account.id == null) && - (name != null ? name.equals(account.name) : account.name == null); - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (name != null ? name.hashCode() : 0); - return result; - } - @Override public String toString() { return "Account{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + ", age=" + age + ", name='" + name + '\'' + ", world=" + world + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java index 363959b..5d5d250 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/AchievementProgression.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model.account; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + import java.util.Arrays; /** @@ -9,18 +11,13 @@ * @author xhsun * @since 2017-06-05 */ -public class AchievementProgression { - private int id; +public class AchievementProgression extends IdentifiableInt { private int current; private int max;//default -1 or 0 private boolean done; private long repeated; private int[] bits; - public int getId() { - return id; - } - public int getCurrent() { return current; } @@ -52,25 +49,10 @@ public int[] getBits() { return bits; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - AchievementProgression that = (AchievementProgression) o; - - return id == that.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "AchievementProgression{" + - "id=" + id + + "id=" + getId() + ", current=" + current + ", max=" + max + ", done=" + done + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java index 668016e..8184e48 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Bank.java @@ -1,78 +1,17 @@ package me.xhsun.guildwars2wrapper.model.account; -import me.xhsun.guildwars2wrapper.model.util.Storage; - -import java.util.List; +import me.xhsun.guildwars2wrapper.model.util.Inventory; /** * For more info on Bank API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/bank">here</a><br/> * Bank item model class<br/> * Note: if slot is empty, API will return null - * + * TODO empty class * @author xhsun * @see me.xhsun.guildwars2wrapper.model.Item item info * @see me.xhsun.guildwars2wrapper.model.Skin skin info * @since 2017-02-07 */ -public class Bank extends Storage { - private int skin; - private List<Integer> upgrades; - private List<Integer> infusions; - - public int getSkinId() { - return skin; - } - - public List<Integer> getUpgradeIds() { - return upgrades; - } - - public List<Integer> getInfusionIds() { - return infusions; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Bank bank = (Bank) o; - - return getItemId() == bank.getItemId() && - getCount() == bank.getCount() && - getCharges() == bank.getCharges() && - skin == bank.skin && - getBinding() == bank.getBinding() && - (getBoundTo() != null ? getBoundTo().equals(bank.getBoundTo()) : bank.getBoundTo() == null) && - (upgrades != null ? upgrades.equals(bank.upgrades) : bank.upgrades == null) && - (infusions != null ? infusions.equals(bank.infusions) : bank.infusions == null); - } - - @Override - public int hashCode() { - int result = getItemId(); - result = 31 * result + getCount(); - result = 31 * result + getCharges(); - result = 31 * result + (getBinding() != null ? getBinding().hashCode() : 0); - result = 31 * result + (getBoundTo() != null ? getBoundTo().hashCode() : 0); - result = 31 * result + skin; - result = 31 * result + (upgrades != null ? upgrades.hashCode() : 0); - result = 31 * result + (infusions != null ? infusions.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Bank{" + - "id=" + getItemId() + - ", count=" + getCount() + - ", charges=" + getCharges() + - ", binding=" + getBinding() + - ", bound_to='" + getBoundTo() + '\'' + - ", skin=" + skin + - ", upgrades=" + upgrades + - ", infusions=" + infusions + - '}'; - } +public class Bank extends Inventory { } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java deleted file mode 100644 index 3081c44..0000000 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Cat.java +++ /dev/null @@ -1,43 +0,0 @@ -package me.xhsun.guildwars2wrapper.model.account; - -/** - * <a href="https://wiki.guildwars2.com/wiki/API:2/account/home/cats">Cat</a> - * - * @author xhsun - * @since 2017-06-05 - */ -public class Cat { - private int id; - private String hint; - - public int getId() { - return id; - } - - public String getHint() { - return hint; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Cat cat = (Cat) o; - - return id == cat.id; - } - - @Override - public int hashCode() { - return id; - } - - @Override - public String toString() { - return "Cat{" + - "id=" + id + - ", hint='" + hint + '\'' + - '}'; - } -} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java index f0c399b..465b5ac 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/Material.java @@ -1,5 +1,6 @@ package me.xhsun.guildwars2wrapper.model.account; +import me.xhsun.guildwars2wrapper.model.MaterialCategory; import me.xhsun.guildwars2wrapper.model.util.Storage; /** @@ -9,7 +10,7 @@ * * @author xhsun * @see me.xhsun.guildwars2wrapper.model.Item item info - * @see me.xhsun.guildwars2wrapper.model.MaterialCategory material category info + * @see MaterialCategory material category info * @since 2017-02-07 */ diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java index b29a3e9..ae242ad 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/SharedInventory.java @@ -1,56 +1,16 @@ package me.xhsun.guildwars2wrapper.model.account; -import me.xhsun.guildwars2wrapper.model.util.Storage; +import me.xhsun.guildwars2wrapper.model.util.Inventory; /** * For more info on Shared Inventory API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/inventory">here</a><br/> * Shared Inventory item model class<br/> * if slot is empty, return null - * + * TODO empty class * @author xhsun * @see me.xhsun.guildwars2wrapper.model.Item item info * @since 2017-02-07 */ -public class SharedInventory extends Storage { - private int skin; - - public int getSkin() { - return skin; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - SharedInventory that = (SharedInventory) o; - - return getItemId() == that.getItemId() && - getCount() == that.getCount() && - getCharges() == that.getCharges() && - skin == that.skin && - getBinding() == that.getBinding(); - } - - @Override - public int hashCode() { - int result = getItemId(); - result = 31 * result + getCount(); - result = 31 * result + getCharges(); - result = 31 * result + (getBinding() != null ? getBinding().hashCode() : 0); - result = 31 * result + skin; - return result; - } - - @Override - public String toString() { - return "SharedInventory{" + - "id=" + getItemId() + - ", count=" + getCount() + - ", charges=" + getCharges() + - ", binding=" + getBinding() + - ", skin=" + skin + - '}'; - } +public class SharedInventory extends Inventory { } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java index cf35072..46f2019 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedFinisher.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model.account; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + /** * For more info on Account finishers API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/finishers">here</a><br/> * Model class for account finishers @@ -7,15 +9,10 @@ * @author xhsun * @since 2017-06-05 */ -public class UnlockedFinisher { - private int id; +public class UnlockedFinisher extends IdentifiableInt { private boolean permanent; private int quantity; - public int getId() { - return id; - } - public boolean isPermanent() { return permanent; } @@ -24,25 +21,10 @@ public int getQuantity() { return quantity; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - UnlockedFinisher finisher = (UnlockedFinisher) o; - - return id == finisher.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "UnlockedFinisher{" + - "id=" + id + + "id=" + getId() + ", permanent=" + permanent + ", quantity=" + quantity + '}'; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java index 650fdda..5fae4a2 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/account/UnlockedMastery.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model.account; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + /** * For more info on Account masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/account/masteries">here</a><br/> * Model class of account masteries @@ -7,14 +9,9 @@ * @author xhsun * @since 2017-06-05 */ -public class UnlockedMastery { - private int id; +public class UnlockedMastery extends IdentifiableInt { private int level; - public int getId() { - return id; - } - /** * @return level at which the mastery is on the account | 0 if not started */ @@ -22,25 +19,10 @@ public int getLevel() { return level; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - UnlockedMastery that = (UnlockedMastery) o; - - return id == that.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "UnlockedMastery{" + - "id=" + id + + "id=" + getId() + ", level=" + level + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java index 97f4c85..09a6cbc 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/Achievement.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model.achievements; import com.google.gson.annotations.Expose; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; import me.xhsun.guildwars2wrapper.model.util.comm.Region; import java.util.List; @@ -12,7 +13,7 @@ * @author xhsun * @since 2017-06-05 */ -public class Achievement { +public class Achievement extends NameableInt { private enum Type { Default, ItemSet, Coins, Item, Mastery, Title, @@ -24,9 +25,7 @@ private enum Flag { RequiresUnlock, RepairOnLogin, Daily, Weekly, Monthly, Permanent } - private int id; private String icon; - private String name; private String description; private String requirement; private String locked_text; @@ -37,18 +36,10 @@ private enum Flag { private List<Reward> rewards; private List<Bits> bits; - public int getId() { - return id; - } - public String getIcon() { return icon; } - public String getName() { - return name; - } - public String getDescription() { return description; } @@ -85,27 +76,12 @@ public List<Bits> getBits() { return bits; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Achievement that = (Achievement) o; - - return id == that.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Achievement{" + - "id=" + id + + "id=" + getId() + ", icon='" + icon + '\'' + - ", name='" + name + '\'' + + ", name='" + getName() + '\'' + ", description='" + description + '\'' + ", requirement='" + requirement + '\'' + ", locked_text='" + locked_text + '\'' + @@ -119,9 +95,7 @@ public String toString() { } public class Tier { - @Expose private int count; - @Expose private int points; public int getCount() { @@ -132,23 +106,6 @@ public int getPoints() { return points; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Tier that = (Tier) o; - - return count == that.count && points == that.points; - } - - @Override - public int hashCode() { - int result = count; - result = 31 * result + points; - return result; - } - @Override public String toString() { return "AchievementTier{" + @@ -159,13 +116,9 @@ public String toString() { } public class Reward { - @Expose private Type type; - @Expose private int id; - @Expose private long count; - @Expose private Region region; /** diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/AchievementCategory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/AchievementCategory.java new file mode 100644 index 0000000..4b026a6 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/AchievementCategory.java @@ -0,0 +1,49 @@ +package me.xhsun.guildwars2wrapper.model.achievements; + +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + +import java.util.List; + +/** + * For more info on achievements categories API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements/categories">here</a><br/> + * Model class for achievement category + * + * @author xhsun + * @since 2017-06-07 + */ +public class AchievementCategory extends NameableInt { + private String description, icon; + private int order; + private List<Integer> achievements; + + public String getDescription() { + return description; + } + + public String getIcon() { + return icon; + } + + public int getOrder() { + return order; + } + + /** + * @return list of {@link Achievement#id} + */ + public List<Integer> getAchievements() { + return achievements; + } + + @Override + public String toString() { + return "MaterialCategory{" + + "id=" + getId() + + ", name='" + getName() + '\'' + + ", description='" + description + '\'' + + ", icon='" + icon + '\'' + + ", order=" + order + + ", achievements=" + achievements + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/AchievementGroup.java b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/AchievementGroup.java new file mode 100644 index 0000000..e96bebc --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/AchievementGroup.java @@ -0,0 +1,48 @@ +package me.xhsun.guildwars2wrapper.model.achievements; + +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableStr; + +import java.util.List; + +/** + * For more info on achievements groups API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements/groups">here</a><br/> + * Model class for achievement group + * + * @author xhsun + * @since 2017-06-07 + */ +public class AchievementGroup extends IdentifiableStr { + private String name, description; + private int order; + private List<Integer> categories; + + public String getName() { + return name; + } + + public String getDescription() { + return description; + } + + public int getOrder() { + return order; + } + + /** + * @return list of {@link AchievementCategory#id} + */ + public List<Integer> getCategories() { + return categories; + } + + @Override + public String toString() { + return "AchievementGroup{" + + "id='" + getId() + '\'' + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + ", order=" + order + + ", categories=" + categories + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/DailyAchievement.java b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/DailyAchievement.java new file mode 100644 index 0000000..764ec60 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/achievements/DailyAchievement.java @@ -0,0 +1,90 @@ +package me.xhsun.guildwars2wrapper.model.achievements; + +import me.xhsun.guildwars2wrapper.model.account.Account; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + +import java.util.List; + +/** + * For more info on achievements daily API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements/daily">here</a><br/> + * Model class for achievement daily + * + * @author xhsun + * @since 2017-06-07 + */ +public class DailyAchievement { + private List<Daily> pve, pvp, wvw, fractals, special; + + public List<Daily> getPve() { + return pve; + } + + public List<Daily> getPvp() { + return pvp; + } + + public List<Daily> getWvw() { + return wvw; + } + + public List<Daily> getFractals() { + return fractals; + } + + public List<Daily> getSpecial() { + return special; + } + + @Override + public String toString() { + return "DailyAchievement{" + + "pve=" + pve + + ", pvp=" + pvp + + ", wvw=" + wvw + + ", fractals=" + fractals + + ", special=" + special + + '}'; + } + + public class Daily extends IdentifiableInt { + private AchievementLevel level; + private List<Account.Access> required_access; + + public AchievementLevel getLevel() { + return level; + } + + public List<Account.Access> getRequiredAccess() { + return required_access; + } + + @Override + public String toString() { + return "Daily{" + + "id=" + getId() + + ", level=" + level + + ", required_access=" + required_access + + '}'; + } + } + + public class AchievementLevel { + private int min, max; + + public int getMin() { + return min; + } + + public int getMax() { + return max; + } + + @Override + public String toString() { + return "AchievementLevel{" + + "min=" + min + + ", max=" + max + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/backstory/BackStoryAnswer.java b/src/main/java/me/xhsun/guildwars2wrapper/model/backstory/BackStoryAnswer.java new file mode 100644 index 0000000..5579e7a --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/backstory/BackStoryAnswer.java @@ -0,0 +1,58 @@ +package me.xhsun.guildwars2wrapper.model.backstory; + +import me.xhsun.guildwars2wrapper.model.Item; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableStr; + +import java.util.List; + +/** + * For more info on back story answer API go <a href="https://wiki.guildwars2.com/wiki/API:2/backstory/answers">here</a><br/> + * Model class for back story answer + * + * @author xhsun + * @since 2017-06-07 + */ +public class BackStoryAnswer extends IdentifiableStr { + private String title, description, journal; + private int question; + private List<Item.Restriction> professions, races; + + public String getTitle() { + return title; + } + + public String getDescription() { + return description; + } + + public String getJournal() { + return journal; + } + + /** + * @return {@link BackStoryQuestion#id} + */ + public int getQuestion() { + return question; + } + + public List<Item.Restriction> getProfessions() { + return professions; + } + + public List<Item.Restriction> getRaces() { + return races; + } + + @Override + public String toString() { + return "BackStoryAnswer{" + + "title='" + title + '\'' + + ", description='" + description + '\'' + + ", journal='" + journal + '\'' + + ", question=" + question + + ", professions=" + professions + + ", races=" + races + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/backstory/BackStoryQuestion.java b/src/main/java/me/xhsun/guildwars2wrapper/model/backstory/BackStoryQuestion.java new file mode 100644 index 0000000..457eae5 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/backstory/BackStoryQuestion.java @@ -0,0 +1,59 @@ +package me.xhsun.guildwars2wrapper.model.backstory; + +import me.xhsun.guildwars2wrapper.model.Item; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + +import java.util.List; + +/** + * For more info on back story questions API go <a href="https://wiki.guildwars2.com/wiki/API:2/backstory/questions">here</a><br/> + * Model class for back story question + * + * @author xhsun + * @since 2017-06-07 + */ +public class BackStoryQuestion extends IdentifiableInt { + private String title, description; + private List<String> answers; + private int order; + private List<Item.Restriction> professions, races; + + public String getTitle() { + return title; + } + + public String getDescription() { + return description; + } + + /** + * @return list of {@link BackStoryAnswer#id} + */ + public List<String> getAnswers() { + return answers; + } + + public int getOrder() { + return order; + } + + public List<Item.Restriction> getProfessions() { + return professions; + } + + public List<Item.Restriction> getRaces() { + return races; + } + + @Override + public String toString() { + return "BackStoryQuestion{" + + "title='" + title + '\'' + + ", description='" + description + '\'' + + ", answers=" + answers + + ", order=" + order + + ", professions=" + professions + + ", races=" + races + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/Character.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/Character.java new file mode 100644 index 0000000..5258b24 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/Character.java @@ -0,0 +1,125 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; +import me.xhsun.guildwars2wrapper.model.util.Bag; + +import java.util.List; + +/** + * For more info on character overview API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters">here</a><br/> + * Model class for character overview + * + * @author xhsun + * @since 2017-06-07 + */ +public class Character extends Core { + private List<CraftingLevel.Discipline> crafting; + private List<String> backstory; + private List<WvWAbility> wvw_abilities; + private CharacterSpecialization.Specialization specializations; + private CharacterSkills.Skills skills; + private List<CharacterEquipment.Equipment> equipment; + private List<Integer> recipes; + private PvPEquipment equipment_pvp; + private List<CharacterTraining.Training> training; + private List<Bag> bags; + + public List<CraftingLevel.Discipline> getCrafting() { + return crafting; + } + + public List<String> getBackStory() { + return backstory; + } + + public List<WvWAbility> getWvWAbilities() { + return wvw_abilities; + } + + public CharacterSpecialization.Specialization getSpecializations() { + return specializations; + } + + public CharacterSkills.Skills getSkills() { + return skills; + } + + public List<CharacterEquipment.Equipment> getEquipment() { + return equipment; + } + + public List<Integer> getRecipes() { + return recipes; + } + + public PvPEquipment getEquipmentPvP() { + return equipment_pvp; + } + + public List<CharacterTraining.Training> getTraining() { + return training; + } + + public List<Bag> getBags() { + return bags; + } + + @Override + public String toString() { + return "Character{" + + super.toString() + + ", crafting=" + crafting + + ", backstory=" + backstory + + ", wvw_abilities=" + wvw_abilities + + ", specializations=" + specializations + + ", skills=" + skills + + ", equipment=" + equipment + + ", recipes=" + recipes + + ", equipment_pvp=" + equipment_pvp + + ", training=" + training + + ", bags=" + bags + + '}'; + } + + public class WvWAbility extends IdentifiableInt { + private int rank; + + public int getRank() { + return rank; + } + + @Override + public String toString() { + return "CharacterWvW{" + + "id=" + getId() + + ", rank=" + rank + + '}'; + } + } + + public class PvPEquipment { + private int amulet, rune; + private List<Integer> sigils; + + public int getAmulet() { + return amulet; + } + + public int getRune() { + return rune; + } + + public List<Integer> getSigils() { + return sigils; + } + + @Override + public String toString() { + return "PvPEquipment{" + + "amulet=" + amulet + + ", rune=" + rune + + ", sigils=" + sigils + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterBackStory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterBackStory.java new file mode 100644 index 0000000..63de9f4 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterBackStory.java @@ -0,0 +1,25 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import java.util.List; + +/** + * For more info on character back story API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Backstory">here</a><br/> + * Model class for character back story + * + * @author xhsun + * @since 2017-06-07 + */ +public class CharacterBackStory { + private List<String> backstory; + + public List<String> getBackStory() { + return backstory; + } + + @Override + public String toString() { + return "CharacterBackStory{" + + "backstory=" + backstory + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterEquipment.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterEquipment.java new file mode 100644 index 0000000..8569dfc --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterEquipment.java @@ -0,0 +1,71 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import me.xhsun.guildwars2wrapper.model.util.Inventory; + +import java.util.List; + +/** + * For more info on character equipment API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Equipment">here</a><br/> + * Model class for character equipment + * + * @author xhsun + * @since 2017-06-07 + */ + +public class CharacterEquipment { + public enum Slot { + HelmAquatic, Backpack, Coat, Boots, Gloves, Helm, Leggings, Shoulders, + Accessory1, Accessory2, Ring1, Ring2, Amulet, + WeaponAquaticA, WeaponAquaticB, + WeaponA1, WeaponA2, WeaponB1, WeaponB2, + Sickle, Axe, Pick + } + + private List<Equipment> equipment; + + public List<Equipment> getEquipment() { + return equipment; + } + + @Override + public String toString() { + return "CharacterEquipment{" + + "equipment=" + equipment + + '}'; + } + + public class Equipment extends Inventory { + + + private Slot slot; + private List<Integer> dyes; + + public Slot getSlot() { + return slot; + } + + /** + * @return list of {@link me.xhsun.guildwars2wrapper.model.Color#id} + */ + public List<Integer> getDyes() { + return dyes; + } + + @Override + public String toString() { + return "Equipment{" + + "id=" + getId() + + ", slot=" + slot + + ", infusions=" + getInfusions() + + ", upgrades=" + getUpgrades() + + ", skin=" + getSkin() + + ", stats=" + getStats() + + ", binding=" + getBinding() + + ", charges=" + getCharges() + + ", bound_to='" + getBoundTo() + '\'' + + ", dyes=" + dyes + + '}'; + } + } +} + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterInventory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterInventory.java index f56edb3..f65c684 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterInventory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterInventory.java @@ -20,21 +20,6 @@ public List<Bag> getBags() { return bags; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CharacterInventory that = (CharacterInventory) o; - - return bags != null ? bags.equals(that.bags) : that.bags == null; - } - - @Override - public int hashCode() { - return bags != null ? bags.hashCode() : 0; - } - @Override public String toString() { return "CharacterInventory{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterRecipes.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterRecipes.java new file mode 100644 index 0000000..76ca68c --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterRecipes.java @@ -0,0 +1,25 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import java.util.List; + +/** + * For more info on Character Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters">here</a><br/> + * Model class for character recipes + * + * @author xhsun + * @since 2017-06-07 + */ +public class CharacterRecipes { + private List<Integer> recipes; + + public List<Integer> getRecipes() { + return recipes; + } + + @Override + public String toString() { + return "CharacterRecipes{" + + "recipes=" + recipes + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSAB.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSAB.java new file mode 100644 index 0000000..d46d94c --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSAB.java @@ -0,0 +1,66 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + +import java.util.List; + +/** + * For more info on character SAB API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Super_Adventure_Box_.28sab.29">here</a><br/> + * Model class for character SAB + * + * @author xhsun + * @since 2017-06-07 + */ +public class CharacterSAB { + private List<Zone> zones; + private List<NameableInt> unlocks, songs; + + public List<Zone> getZones() { + return zones; + } + + public List<NameableInt> getUnlocks() { + return unlocks; + } + + public List<NameableInt> getSongs() { + return songs; + } + + @Override + public String toString() { + return "CharacterSAB{" + + "zones=" + zones + + ", unlocks=" + unlocks + + ", songs=" + songs + + '}'; + } + + public class Zone extends IdentifiableInt { + private String mode; + private int world, zone; + + public String getMode() { + return mode; + } + + public int getWorld() { + return world; + } + + public int getZone() { + return zone; + } + + @Override + public String toString() { + return "Zone{" + + "id=" + getId() + + ", mode='" + mode + '\'' + + ", world=" + world + + ", zone=" + zone + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSkills.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSkills.java new file mode 100644 index 0000000..6746219 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSkills.java @@ -0,0 +1,85 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import java.util.List; + +/** + * For more info on character skills API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Skills">here</a><br/> + * Model class for character skills level + * + * @see me.xhsun.guildwars2wrapper.model.Skill + * @author xhsun + * @since 2017-06-07 + */ +public class CharacterSkills { + private Skills skills; + + public Utility getPve() { + return skills.pve; + } + + public Utility getPvp() { + return skills.pvp; + } + + public Utility getWvw() { + return skills.wvw; + } + + @Override + public String toString() { + return "CharacterSkills{" + + "skills=" + skills + + '}'; + } + + public class Skills { + private Utility pve, pvp, wvw; + + public Utility getPve() { + return pve; + } + + public Utility getPvp() { + return pvp; + } + + public Utility getWvw() { + return wvw; + } + + @Override + public String toString() { + return "CharacterSkills{" + + "pve=" + pve + + ", pvp=" + pvp + + ", wvw=" + wvw + + '}'; + } + } + public class Utility { + private int heal; + private List<Integer> utilities; + private int elite; + + public int getHeal() { + return heal; + } + + public List<Integer> getUtilities() { + return utilities; + } + + public int getElite() { + return elite; + } + + @Override + public String toString() { + return "Utility{" + + "heal=" + heal + + ", utilities=" + utilities + + ", elite=" + elite + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSpecialization.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSpecialization.java new file mode 100644 index 0000000..baf934e --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterSpecialization.java @@ -0,0 +1,97 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + +import java.util.List; + +/** + * For more info on character specializations API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Specialization">here</a><br/> + * Model class for character specialization + * + * @author xhsun + * @since 2017-06-07 + */ +public class CharacterSpecialization { + private Specialization specializations; + + public List<Trait> getPve() { + return specializations.pve; + } + + public List<Trait> getPvp() { + return specializations.pvp; + } + + public List<Trait> getWvw() { + return specializations.wvw; + } + + @Override + public String toString() { + return "CharacterSpecialization{" + + "specializations=" + specializations + + '}'; + } + + public class Specialization { + private List<Trait> pve, pvp, wvw; + + public List<Trait> getPve() { + return pve; + } + + public List<Trait> getPvp() { + return pvp; + } + + public List<Trait> getWvw() { + return wvw; + } + + @Override + public String toString() { + return "Specialization{" + + "pve=" + pve + + ", pvp=" + pvp + + ", wvw=" + wvw + + '}'; + } + } + + public class Trait extends IdentifiableInt { + private List<Integer> traits; + + /** + * @return list of selected traits id + */ + public List<Integer> getTraits() { + return traits; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Trait trait = (Trait) o; + + return getId() == trait.getId() && + (traits != null ? traits.equals(trait.traits) : trait.traits == null); + } + + @Override + public int hashCode() { + int result = getId(); + result = 31 * result + (traits != null ? traits.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "Trait{" + + "SpecializationId=" + getId() + + ", traits=" + traits + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterTraining.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterTraining.java new file mode 100644 index 0000000..4a95607 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CharacterTraining.java @@ -0,0 +1,49 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + +import java.util.List; + +/** + * For more info on character training API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Training">here</a><br/> + * Model class for character training + * @see me.xhsun.guildwars2wrapper.model.Profession.Training + * @author xhsun + * @since 2017-06-07 + */ +public class CharacterTraining { + private List<Training> training; + + public List<Training> getTraining() { + return training; + } + + @Override + public String toString() { + return "CharacterTraining{" + + "training=" + training + + '}'; + } + + public class Training extends IdentifiableInt { + private int spent; + private boolean done; + + public int getSpent() { + return spent; + } + + public boolean isDone() { + return done; + } + + @Override + public String toString() { + return "Training{" + + "id=" + getId() + + ", spent=" + spent + + ", done=" + done + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/Core.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/Core.java index 0d7cf0a..2d30ba5 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/character/Core.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/Core.java @@ -23,7 +23,7 @@ public enum Gender {Male, Female} private String guild;//guild id private long age;//in seconds private String created; - private long death; + private long deaths; private long title;//title id public String getName() { @@ -62,7 +62,7 @@ public String getCreated() { } public long getDeath() { - return death; + return deaths; } public long getTitle() { @@ -98,7 +98,7 @@ public String toString() { ", guild='" + guild + '\'' + ", age=" + age + ", created='" + created + '\'' + - ", death=" + death + + ", death=" + deaths + ", title=" + title + '}'; } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/character/CraftingLevel.java b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CraftingLevel.java new file mode 100644 index 0000000..d6da751 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/character/CraftingLevel.java @@ -0,0 +1,54 @@ +package me.xhsun.guildwars2wrapper.model.character; + +import me.xhsun.guildwars2wrapper.model.util.comm.CraftingDisciplines; + +import java.util.List; + +/** + * For more info on character crafting API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Crafting">here</a><br/> + * Model class for character crafting level + * + * @author xhsun + * @since 2017-06-07 + */ +public class CraftingLevel { + private List<Discipline> crafting; + + public List<Discipline> getCrafting() { + return crafting; + } + + @Override + public String toString() { + return "CraftingLevel{" + + "crafting=" + crafting + + '}'; + } + + public class Discipline { + private CraftingDisciplines discipline; + private int rating; + private boolean active; + + public CraftingDisciplines getDiscipline() { + return discipline; + } + + public int getRating() { + return rating; + } + + public boolean isActive() { + return active; + } + + @Override + public String toString() { + return "Discipline{" + + "discipline=" + discipline + + ", rating=" + rating + + ", active=" + active + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java index f21df07..b596bd1 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/commerce/Prices.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model.commerce; import com.google.gson.annotations.Expose; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; /** * For more info on Listing Price API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/prices">here</a><br/> @@ -13,14 +14,13 @@ * @since 2017-02-07 */ -public class Prices { - private int id; +public class Prices extends IdentifiableInt { private boolean whitelisted; private Price buys; private Price sells; public int getItemId() { - return id; + return getId(); } public boolean isWhitelisted() { @@ -35,27 +35,10 @@ public Price getSells() { return sells; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Prices prices = (Prices) o; - - return id == prices.id && whitelisted == prices.whitelisted; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (whitelisted ? 1 : 0); - return result; - } - @Override public String toString() { return "Prices{" + - "id=" + id + + "id=" + getId() + ", whitelisted=" + whitelisted + ", buys=" + buys + ", sells=" + sells + @@ -82,23 +65,6 @@ public long getQuantity() { return quantity; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Price price = (Price) o; - - return unit_price == price.unit_price && quantity == price.quantity; - } - - @Override - public int hashCode() { - int result = (int) (unit_price ^ (unit_price >>> 32)); - result = 31 * result + (int) (quantity ^ (quantity >>> 32)); - return result; - } - @Override public String toString() { return "Price{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/continent/Continent.java b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/Continent.java new file mode 100644 index 0000000..5154b1b --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/Continent.java @@ -0,0 +1,46 @@ +package me.xhsun.guildwars2wrapper.model.continent; + +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + +import java.util.Arrays; +import java.util.List; + +/** + * For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> + * Model class for continents + * + * @author xhsun + * @since 2017-06-15 + */ +public class Continent extends NameableInt { + private double[] continent_dims; + private int min_zoom, max_zoom; + private List<Integer> floors; + + public double[] getContinent_dims() { + return continent_dims; + } + + public int getMin_zoom() { + return min_zoom; + } + + public int getMax_zoom() { + return max_zoom; + } + + public List<Integer> getFloors() { + return floors; + } + + @Override + public String toString() { + return "Continent{" + + super.toString() + + "continent_dims=" + Arrays.toString(continent_dims) + + ", min_zoom=" + min_zoom + + ", max_zoom=" + max_zoom + + ", floors=" + floors + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentFloor.java b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentFloor.java new file mode 100644 index 0000000..d0afabd --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentFloor.java @@ -0,0 +1,35 @@ +package me.xhsun.guildwars2wrapper.model.continent; + +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + +import java.util.Arrays; +import java.util.Map; + +/** + * For more info on continents floors API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> + * Model class for continents floor + * + * @author xhsun + * @since 2017-06-15 + */ +public class ContinentFloor extends IdentifiableInt { + private double[] texture_dims; + private Map<Integer, ContinentRegion> regions; + + public double[] getTexture_dims() { + return texture_dims; + } + + public Map<Integer, ContinentRegion> getRegions() { + return regions; + } + + @Override + public String toString() { + return "ContinentFloor{" + + "id=" + getId() + + ", texture_dims=" + Arrays.toString(texture_dims) + + ", regions=" + regions + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentMap.java b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentMap.java new file mode 100644 index 0000000..d816c44 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentMap.java @@ -0,0 +1,253 @@ +package me.xhsun.guildwars2wrapper.model.continent; + +import me.xhsun.guildwars2wrapper.model.indentifiable.*; +import me.xhsun.guildwars2wrapper.model.util.comm.Region; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * For more info on continents map API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> + * Model class for continents map + * + * @author xhsun + * @since 2017-06-15 + */ +public class ContinentMap extends NameableInt { + public enum PoIType {landmark, waypoint, vista, unlock} + + private int min_level, max_level; + private int default_floor; + private double[] label_coord; + private double[][] continent_rect, map_rect; + private Map<Integer, PoI> points_of_interest; + private Map<Integer, Task> tasks; + private List<SkillChallenge> skill_challenges; + private Map<Integer, Sector> sectors; + private List<Adventure> adventures; + private List<Mastery> mastery_points; + + public int getMin_level() { + return min_level; + } + + public int getMax_level() { + return max_level; + } + + public int getDefault_floor() { + return default_floor; + } + + public double[] getLabel_coord() { + return label_coord; + } + + public double[][] getContinent_rect() { + return continent_rect; + } + + public double[][] getMap_rect() { + return map_rect; + } + + public Map<Integer, PoI> getPoints_of_interest() { + return points_of_interest; + } + + public Map<Integer, Task> getTasks() { + return tasks; + } + + public List<SkillChallenge> getSkill_challenges() { + return skill_challenges; + } + + public Map<Integer, Sector> getSectors() { + return sectors; + } + + public List<Adventure> getAdventures() { + return adventures; + } + + public List<Mastery> getMastery_points() { + return mastery_points; + } + + @Override + public String toString() { + return "ContinentMap{" + + super.toString() + + "min_level=" + min_level + + ", max_level=" + max_level + + ", default_floor=" + default_floor + + ", label_coord=" + Arrays.toString(label_coord) + + ", continent_rect=" + Arrays.deepToString(continent_rect) + + ", map_rect=" + Arrays.deepToString(map_rect) + + ", points_of_interest=" + points_of_interest + + ", tasks=" + tasks + + ", skill_challenges=" + skill_challenges + + ", sectors=" + sectors + + ", adventures=" + adventures + + ", mastery_points=" + mastery_points + + '}'; + } + + public class PoI extends Linkable { + private PoIType type; + private int floor; + private double[] coord; + + public PoIType getType() { + return type; + } + + public int getFloor() { + return floor; + } + + public double[] getCoord() { + return coord; + } + + @Override + public String toString() { + return "PoI{" + + super.toString() + + ", type=" + type + + ", floor=" + floor + + ", coord=" + Arrays.toString(coord) + + '}'; + } + } + + public class Sector extends Linkable { + private int level; + private double[] coord; + private double[][] bounds; + + public int getLevel() { + return level; + } + + public double[] getCoord() { + return coord; + } + + public double[][] getBounds() { + return bounds; + } + + @Override + public String toString() { + return "Sector{" + + super.toString() + + "level=" + level + + ", coord=" + Arrays.toString(coord) + + ", bounds=" + Arrays.deepToString(bounds) + + '}'; + } + } + + public class Task extends IdentifiableInt { + private String objective; + private String chat_link; + private int level; + private double[] coord; + private double[][] bounds; + + public String getObjective() { + return objective; + } + + public String getChatLink() { + return chat_link; + } + + public int getLevel() { + return level; + } + + public double[] getCoord() { + return coord; + } + + public double[][] getBounds() { + return bounds; + } + + @Override + public String toString() { + return "Task{" + + "id=" + getId() + + ", objective='" + objective + '\'' + + ", chat_link='" + chat_link + '\'' + + ", level=" + level + + ", coord=" + Arrays.toString(coord) + + ", bounds=" + Arrays.deepToString(bounds) + + '}'; + } + } + + public class Mastery extends IdentifiableInt { + private double[] coord; + private Region region; + + public double[] getCoord() { + return coord; + } + + public Region getRegion() { + return region; + } + + @Override + public String toString() { + return "Mastery{" + + "id=" + getId() + + ", coord=" + Arrays.toString(coord) + + ", region=" + region + + '}'; + } + } + + public class Adventure extends NameableStr { + private String description; + private double[] coord; + + public String getDescription() { + return description; + } + + public double[] getCoord() { + return coord; + } + + @Override + public String toString() { + return "Adventure{" + + super.toString() + + "description='" + description + '\'' + + ", coord=" + Arrays.toString(coord) + + '}'; + } + } + + public class SkillChallenge extends IdentifiableStr { + private double[] coord; + + public double[] getCoord() { + return coord; + } + + @Override + public String toString() { + return "SkillChallenge{" + + "id=" + getId() + + ", coord=" + Arrays.toString(coord) + + '}'; + } + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentRegion.java b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentRegion.java new file mode 100644 index 0000000..44bd806 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/continent/ContinentRegion.java @@ -0,0 +1,41 @@ +package me.xhsun.guildwars2wrapper.model.continent; + +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + +import java.util.Arrays; +import java.util.Map; + +/** + * For more info on continents region API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> + * Model class for continents region + * + * @author xhsun + * @since 2017-06-15 + */ +public class ContinentRegion extends NameableInt { + private double[] label_coord; + private double[][] continent_rect; + private Map<Integer, ContinentMap> maps; + + public double[] getLabel_coord() { + return label_coord; + } + + public double[][] getContinent_rect() { + return continent_rect; + } + + public Map<Integer, ContinentMap> getMaps() { + return maps; + } + + @Override + public String toString() { + return "ContinentRegion{" + + super.toString() + + "label_coord=" + Arrays.toString(label_coord) + + ", continent_rect=" + Arrays.deepToString(continent_rect) + + ", maps=" + maps + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java b/src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java index 0fe1004..de19edf 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/guild/Upgrade.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model.guild; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + import java.util.List; /** @@ -9,7 +11,7 @@ * @author xhsun * @since 2017-06-06 */ -public class Upgrade { +public class Upgrade extends NameableInt { public enum Type { AccumulatingCurrency, BankBag, Boost, Claimable, Consumable, Decoration, GuildHall, GuildHallExpedition, Hub, Queue, Unlock @@ -17,8 +19,6 @@ public enum Type { public enum CostType {Item, Collectible, Currency, Coins} - private int id; - private String name; private String description; private Type type; private int bag_max_items; @@ -30,14 +30,6 @@ public enum CostType {Item, Collectible, Currency, Coins} private List<Integer> prerequisites; private List<Cost> costs; - public int getId() { - return id; - } - - public String getName() { - return name; - } - public String getDescription() { return description; } @@ -87,26 +79,11 @@ public List<Cost> getCosts() { return costs; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Upgrade upgrade = (Upgrade) o; - - return id == upgrade.id; - } - - @Override - public int hashCode() { - return id; - } - @Override public String toString() { return "Upgrade{" + - "id=" + id + - ", name='" + name + '\'' + + "id=" + getId() + + ", name='" + getName() + '\'' + ", description='" + description + '\'' + ", type=" + type + ", bag_max_items=" + bag_max_items + @@ -151,14 +128,12 @@ public boolean equals(Object o) { return count == cost.count && item_id == cost.item_id && - type == cost.type && - (name != null ? name.equals(cost.name) : cost.name == null); + type == cost.type; } @Override public int hashCode() { int result = type != null ? type.hashCode() : 0; - result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + count; result = 31 * result + item_id; return result; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/IdentifiableInt.java b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/IdentifiableInt.java new file mode 100644 index 0000000..a68b247 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/IdentifiableInt.java @@ -0,0 +1,30 @@ +package me.xhsun.guildwars2wrapper.model.indentifiable; + +/** + * For models that have an int id + * + * @author xhsun + * @since 2017-06-07 + */ +public class IdentifiableInt { + private int id; + + public int getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + IdentifiableInt identifiable = (IdentifiableInt) o; + + return id == identifiable.id; + } + + @Override + public int hashCode() { + return id; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/IdentifiableStr.java b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/IdentifiableStr.java new file mode 100644 index 0000000..c0bd2aa --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/IdentifiableStr.java @@ -0,0 +1,30 @@ +package me.xhsun.guildwars2wrapper.model.indentifiable; + +/** + * For models that have a string id + * + * @author xhsun + * @since 2017-06-07 + */ +public class IdentifiableStr { + private String id; + + public String getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + IdentifiableStr that = (IdentifiableStr) o; + + return id != null ? id.equals(that.id) : that.id == null; + } + + @Override + public int hashCode() { + return id != null ? id.hashCode() : 0; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/Linkable.java b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/Linkable.java new file mode 100644 index 0000000..f0b0030 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/Linkable.java @@ -0,0 +1,24 @@ +package me.xhsun.guildwars2wrapper.model.indentifiable; + +/** + * For models that have an int id, string name, and string chat_link + * + * @author xhsun + * @since 2017-06-07 + */ +public class Linkable extends NameableInt { + private String chat_link; + + public String getChatLink() { + return chat_link; + } + + @Override + public String toString() { + return "{" + + "id=" + getId() + + ", name='" + getName() + '\'' + + ", chat_link='" + chat_link + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/NameableInt.java b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/NameableInt.java new file mode 100644 index 0000000..35c4cd9 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/NameableInt.java @@ -0,0 +1,23 @@ +package me.xhsun.guildwars2wrapper.model.indentifiable; + +/** + * For models that have an int id and string name + * + * @author xhsun + * @since 2017-06-07 + */ +public class NameableInt extends IdentifiableInt { + private String name; + + public String getName() { + return name; + } + + @Override + public String toString() { + return "{" + + "id=" + getId() + + ", name='" + name + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/NameableStr.java b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/NameableStr.java new file mode 100644 index 0000000..e66c5b0 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/indentifiable/NameableStr.java @@ -0,0 +1,23 @@ +package me.xhsun.guildwars2wrapper.model.indentifiable; + +/** + * For models that have an string id and string name + * + * @author xhsun + * @since 2017-06-07 + */ +public class NameableStr extends IdentifiableStr { + private String name; + + public String getName() { + return name; + } + + @Override + public String toString() { + return "{" + + "id=" + getId() + + ", name='" + name + '\'' + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Amulet.java b/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Amulet.java new file mode 100644 index 0000000..c6619c8 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Amulet.java @@ -0,0 +1,33 @@ +package me.xhsun.guildwars2wrapper.model.pvp; + +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; +import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemAttributes; + +/** + * For more info on pvp amulets API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/amulets">here</a><br/> + * Model class for pvp amulet + * + * @author xhsun + * @since 2017-06-15 + */ +public class Amulet extends NameableInt { + private String icon; + private ItemAttributes attributes; + + public String getIcon() { + return icon; + } + + public ItemAttributes getAttributes() { + return attributes; + } + + @Override + public String toString() { + return "Amulet{" + + super.toString() + + ", icon='" + icon + '\'' + + ", attributes=" + attributes + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java b/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java index 2141c2f..ac0c263 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/pvp/Hero.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model.pvp; import com.google.gson.annotations.SerializedName; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableStr; import me.xhsun.guildwars2wrapper.model.unlockable.Unlockable; import java.util.Arrays; @@ -13,8 +14,7 @@ * @author xhsun * @since 2017-06-06 */ -public class Hero { - private String id; +public class Hero extends IdentifiableStr { private String name; private String type; private Stat stats; @@ -22,10 +22,6 @@ public class Hero { private String underlay; private List<Skin> skins; - public String getId() { - return id; - } - public String getName() { return name; } @@ -50,25 +46,10 @@ public List<Skin> getSkins() { return skins; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Hero hero = (Hero) o; - - return id != null ? id.equals(hero.id) : hero.id == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - @Override public String toString() { return "Hero{" + - "id='" + id + '\'' + + "id='" + getId() + '\'' + ", name='" + name + '\'' + ", type='" + type + '\'' + ", stats=" + stats + @@ -86,21 +67,6 @@ public boolean isDefault() { return _default; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Skin skin = (Skin) o; - - return super.getId() == skin.getId(); - } - - @Override - public int hashCode() { - return super.getId(); - } - @Override public String toString() { return "Skin{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java index ffc9cda..d027f84 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Finisher.java @@ -16,21 +16,6 @@ public String getUnlockDetails() { return unlock_details; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Finisher finisher = (Finisher) o; - - return getId() == finisher.getId(); - } - - @Override - public int hashCode() { - return getId(); - } - @Override public String toString() { return "Finisher{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java index 50bcc38..d20dd76 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Glider.java @@ -28,21 +28,6 @@ public List<Integer> getDefaultDyes() { return default_dyes; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Glider glider = (Glider) o; - - return getId() == glider.getId(); - } - - @Override - public int hashCode() { - return getId(); - } - @Override public String toString() { return "Glider{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java index e055be0..95c96d7 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/MailCarrier.java @@ -17,21 +17,6 @@ public List<String> getFlags() { return flags; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - MailCarrier that = (MailCarrier) o; - - return getId() == that.getId(); - } - - @Override - public int hashCode() { - return getId(); - } - @Override public String toString() { return "MailCarrier{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java index e37260d..5d04a1f 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Outfit.java @@ -10,20 +10,6 @@ * @since 2017-06-06 */ public class Outfit extends Unlockable { - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Outfit outfit = (Outfit) o; - - return getId() == outfit.getId(); - } - - @Override - public int hashCode() { - return getId(); - } @Override public String toString() { diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java index 6702c85..b757e67 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/unlockable/Unlockable.java @@ -1,6 +1,7 @@ package me.xhsun.guildwars2wrapper.model.unlockable; import me.xhsun.guildwars2wrapper.model.Item; +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; import me.xhsun.guildwars2wrapper.model.pvp.Hero.Skin; /** * Super class for model classes that have unlock item field @@ -8,16 +9,10 @@ * @author xhsun * @since 2017-06-06 */ -public class Unlockable { - private int id; +public class Unlockable extends NameableInt { private int[] unlock_items;//item id private int order; private String icon; - private String name; - - public int getId() { - return id; - } /** * @return array of {@link Item} id(s) @@ -38,8 +33,4 @@ public int getOrder() { public String getIcon() { return icon; } - - public String getName() { - return name; - } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java index 2b2bca9..ceded86 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Bag.java @@ -1,5 +1,7 @@ package me.xhsun.guildwars2wrapper.model.util; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + import java.util.List; /** @@ -9,15 +11,10 @@ * @see Inventory character inventory item * @since 2017-02-07 */ -public class Bag { - private int id; +public class Bag extends IdentifiableInt { private int size; private List<Inventory> inventory; - public int getId() { - return id; - } - public int getSize() { return size; } @@ -26,30 +23,10 @@ public List<Inventory> getInventory() { return inventory; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Bag bag = (Bag) o; - - return id == bag.id && - size == bag.size && - (inventory != null ? inventory.equals(bag.inventory) : bag.inventory == null); - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + size; - result = 31 * result + (inventory != null ? inventory.hashCode() : 0); - return result; - } - @Override public String toString() { return "Bag{" + - "id=" + id + + "id=" + getId() + ", size=" + size + ", inventory=" + inventory + '}'; diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java index 78d5af8..39bcfe7 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Inventory.java @@ -5,7 +5,7 @@ import java.util.List; /** - * Character inventory bag inventory model class + * inventory model class * * @author xhsun * @see me.xhsun.guildwars2wrapper.model.Item item info @@ -69,7 +69,7 @@ public int hashCode() { @Override public String toString() { - return "Inventory{" + + return "{" + "id=" + getItemId() + ", count=" + getCount() + ", charges=" + getCharges() + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java index af3c54a..a8f24a9 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/Storage.java @@ -1,20 +1,20 @@ package me.xhsun.guildwars2wrapper.model.util; +import me.xhsun.guildwars2wrapper.model.indentifiable.IdentifiableInt; + /** * @author xhsun * @since 2017-02-13 */ -public class Storage { +public class Storage extends IdentifiableInt { public enum Binding {Account, Character} - - private int id; private int count; private int charges; private Binding binding; private String bound_to; public int getItemId() { - return id; + return getId(); } public int getCount() { diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Type.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Type.java index f2dc421..974654d 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Type.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/comm/Type.java @@ -38,5 +38,9 @@ public enum Type { //Guild recipes type GuildConsumable, GuildDecoration, GuildConsumableWvw, //Other recipes type - Backpack, Bag, Bulk, Consumable, Dye, Potion, UpgradeComponent + Backpack, Bag, Bulk, Consumable, Dye, Potion, UpgradeComponent, + //Other + Nothing, None, + //Skill Type + Profession, Heal, Elite, Bundle, Weapon } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java index 9aa0c99..c45c117 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Armor.java @@ -1,10 +1,6 @@ package me.xhsun.guildwars2wrapper.model.util.itemDetail; import me.xhsun.guildwars2wrapper.model.util.comm.Type; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; - -import java.util.List; /** * For more info on Armor detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Armor">here</a><br/> @@ -14,7 +10,7 @@ * @see ItemDetail item details * @since 2017-02-07 */ -public class Armor extends ItemDetail { +public class Armor extends StatSelectable { public Type getType() { return type; } @@ -27,56 +23,6 @@ public int getDefense() { return defense; } - public List<InfusionSlot> getInfusionSlots() { - return infusion_slots; - } - - public InfixUpgrade getInfixUpgrade() { - return infix_upgrade; - } - - public int getSuffixID() { - return suffix_item_id; - } - - public String getSecSuffixID() { - return secondary_suffix_item_id; - } - - public List<String> getStatChoice() { - return stat_choices; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Armor armor = (Armor) o; - - return (defense == armor.defense) && - (suffix_item_id == armor.suffix_item_id) && - (type == armor.type) && - (weight_class == armor.weight_class) && - (infusion_slots != null ? infusion_slots.equals(armor.infusion_slots) : armor.infusion_slots == null) && - (infix_upgrade != null ? infix_upgrade.equals(armor.infix_upgrade) : armor.infix_upgrade == null) && - (secondary_suffix_item_id != null ? secondary_suffix_item_id.equals(armor.secondary_suffix_item_id) : armor.secondary_suffix_item_id == null) && - (stat_choices != null ? stat_choices.equals(armor.stat_choices) : armor.stat_choices == null); - } - - @Override - public int hashCode() { - int result = type != null ? type.hashCode() : 0; - result = 31 * result + (weight_class != null ? weight_class.hashCode() : 0); - result = 31 * result + defense; - result = 31 * result + (infusion_slots != null ? infusion_slots.hashCode() : 0); - result = 31 * result + (infix_upgrade != null ? infix_upgrade.hashCode() : 0); - result = 31 * result + suffix_item_id; - result = 31 * result + (secondary_suffix_item_id != null ? secondary_suffix_item_id.hashCode() : 0); - result = 31 * result + (stat_choices != null ? stat_choices.hashCode() : 0); - return result; - } - @Override public String toString() { return "Armor{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java index 120b6e8..e91b107 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Back.java @@ -1,11 +1,6 @@ package me.xhsun.guildwars2wrapper.model.util.itemDetail; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; - -import java.util.List; - /** * For more info on Back detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Back_item">here</a><br/> * Item detail for back item @@ -14,50 +9,7 @@ * @see ItemDetail item details * @since 2017-02-10 */ -public class Back extends ItemDetail { - public List<InfusionSlot> getInfusionSlots() { - return infusion_slots; - } - - public InfixUpgrade getInfixUpgrade() { - return infix_upgrade; - } - - public int getSuffixID() { - return suffix_item_id; - } - - public String getSecSuffixID() { - return secondary_suffix_item_id; - } - - public List<String> getStatChoice() { - return stat_choices; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Back back = (Back) o; - - return suffix_item_id == back.suffix_item_id && - (infusion_slots != null ? infusion_slots.equals(back.infusion_slots) : back.infusion_slots == null) && - (infix_upgrade != null ? infix_upgrade.equals(back.infix_upgrade) : back.infix_upgrade == null) && - (secondary_suffix_item_id != null ? secondary_suffix_item_id.equals(back.secondary_suffix_item_id) : back.secondary_suffix_item_id == null) && - (stat_choices != null ? stat_choices.equals(back.stat_choices) : back.stat_choices == null); - } - - @Override - public int hashCode() { - int result = infusion_slots != null ? infusion_slots.hashCode() : 0; - result = 31 * result + (infix_upgrade != null ? infix_upgrade.hashCode() : 0); - result = 31 * result + suffix_item_id; - result = 31 * result + (secondary_suffix_item_id != null ? secondary_suffix_item_id.hashCode() : 0); - result = 31 * result + (stat_choices != null ? stat_choices.hashCode() : 0); - return result; - } +public class Back extends StatSelectable { @Override public String toString() { diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Bag.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Bag.java index 1ce4459..08e219d 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Bag.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Bag.java @@ -9,6 +9,7 @@ * @since 2017-02-10 */ public class Bag extends ItemDetail { + public int getSize() { return size; } @@ -17,23 +18,6 @@ private boolean isInvisible() { return no_sell_or_sort; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Bag bag = (Bag) o; - - return size == bag.size && no_sell_or_sort == bag.no_sell_or_sort; - } - - @Override - public int hashCode() { - int result = size; - result = 31 * result + (no_sell_or_sort ? 1 : 0); - return result; - } - @Override public String toString() { return "Bag{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java index 9909701..10c3a1a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Consumable.java @@ -11,10 +11,15 @@ * @since 2017-02-10 */ public class Consumable extends ItemDetail { + public String getIcon() { return icon; } + public int getApplyCount() { + return apply_count; + } + public Type getType() { return type; } @@ -43,35 +48,6 @@ private String getName() { return name; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Consumable that = (Consumable) o; - - return duration_ms == that.duration_ms && - color_id == that.color_id && - recipe_id == that.recipe_id && - (icon != null ? icon.equals(that.icon) : that.icon == null) && - type == that.type && (description != null ? description.equals(that.description) : that.description == null) && - unlock_type == that.unlock_type && - (name != null ? name.equals(that.name) : that.name == null); - } - - @Override - public int hashCode() { - int result = icon != null ? icon.hashCode() : 0; - result = 31 * result + (type != null ? type.hashCode() : 0); - result = 31 * result + (description != null ? description.hashCode() : 0); - result = 31 * result + (int) (duration_ms ^ (duration_ms >>> 32)); - result = 31 * result + (unlock_type != null ? unlock_type.hashCode() : 0); - result = 31 * result + color_id; - result = 31 * result + recipe_id; - result = 31 * result + (name != null ? name.hashCode() : 0); - return result; - } - @Override public String toString() { return "Consumable{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemAttributes.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemAttributes.java index 3e573cc..248b4a5 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemAttributes.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemAttributes.java @@ -10,6 +10,11 @@ * @since 2017-02-07 */ public class ItemAttributes { + public enum Attribute { + Power, Precision, Toughness, Vitality, ConditionDamage, + ConditionDuration, Healing, BoonDuration, CritDamage, + AgonyResistance + } private float Power; private float Precision; private float Toughness; @@ -20,6 +25,8 @@ public class ItemAttributes { private float cond_duration; private float Healing; private float BoonDuration; + private float CritDamage; + private float AgonyResistance; public float getPower() { return Power; @@ -53,34 +60,12 @@ public float getBoonDuration() { return BoonDuration; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ItemAttributes that = (ItemAttributes) o; - - return Float.compare(that.Power, Power) == 0 && - Float.compare(that.Precision, Precision) == 0 && - Float.compare(that.Toughness, Toughness) == 0 && - Float.compare(that.Vitality, Vitality) == 0 && - Float.compare(that.cond_dmg, cond_dmg) == 0 && - Float.compare(that.cond_duration, cond_duration) == 0 && - Float.compare(that.Healing, Healing) == 0 && - Float.compare(that.BoonDuration, BoonDuration) == 0; + public float getFerocity() { + return CritDamage; } - @Override - public int hashCode() { - int result = (Power != +0.0f ? Float.floatToIntBits(Power) : 0); - result = 31 * result + (Precision != +0.0f ? Float.floatToIntBits(Precision) : 0); - result = 31 * result + (Toughness != +0.0f ? Float.floatToIntBits(Toughness) : 0); - result = 31 * result + (Vitality != +0.0f ? Float.floatToIntBits(Vitality) : 0); - result = 31 * result + (cond_dmg != +0.0f ? Float.floatToIntBits(cond_dmg) : 0); - result = 31 * result + (cond_duration != +0.0f ? Float.floatToIntBits(cond_duration) : 0); - result = 31 * result + (Healing != +0.0f ? Float.floatToIntBits(Healing) : 0); - result = 31 * result + (BoonDuration != +0.0f ? Float.floatToIntBits(BoonDuration) : 0); - return result; + public float getAgonyResistance() { + return AgonyResistance; } @Override @@ -94,6 +79,8 @@ public String toString() { ", cond_duration=" + cond_duration + ", Healing=" + Healing + ", BoonDuration=" + BoonDuration + + ", CritDamage=" + CritDamage + + ", AgonyResistance=" + AgonyResistance + '}'; } } \ No newline at end of file diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java index 2eb04a7..dce2a1b 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/ItemDetail.java @@ -26,11 +26,6 @@ public enum Unlock { GliderSkin, Champion } - public enum Attribute { - BoonDuration, ConditionDamage, ConditionDuration, CritDamage, Healing, - Power, Precision, Toughness, Vitality - } - public enum Flag { //Upgrade component flag Axe, Dagger, Mace, Pistol, Scepter, Sword, Focus, Shield, Torch, Warhorn, Greatsword, Hammer, @@ -61,6 +56,7 @@ public enum Flag { int recipe_id; String name; String icon; + int apply_count; //Mini int minipet_id; //Salvage kit diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java index a2e53f2..f12fd75 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Mini.java @@ -13,21 +13,6 @@ public int getMiniID() { return minipet_id; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Mini mini = (Mini) o; - - return minipet_id == mini.minipet_id; - } - - @Override - public int hashCode() { - return minipet_id; - } - @Override public String toString() { return "Mini{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/StatSelectable.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/StatSelectable.java new file mode 100644 index 0000000..ffb40d0 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/StatSelectable.java @@ -0,0 +1,34 @@ +package me.xhsun.guildwars2wrapper.model.util.itemDetail; + +import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; +import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; + +import java.util.List; + +/** + * Method container class for all item detail that have a stat + * + * @author xhsun + * @since 2017-06-07 + */ +class StatSelectable extends ItemDetail { + public List<InfusionSlot> getInfusionSlots() { + return infusion_slots; + } + + public InfixUpgrade getInfixUpgrade() { + return infix_upgrade; + } + + public int getSuffixID() { + return suffix_item_id; + } + + public String getSecSuffixID() { + return secondary_suffix_item_id; + } + + public List<String> getStatChoice() { + return stat_choices; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java index b5ac467..be54086 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Trinket.java @@ -1,9 +1,6 @@ package me.xhsun.guildwars2wrapper.model.util.itemDetail; import me.xhsun.guildwars2wrapper.model.util.comm.Type; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; - -import java.util.List; /** * For more info on Trinket detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Trinket">here</a><br/> @@ -13,63 +10,19 @@ * @see ItemDetail item details * @since 2017-02-10 */ -public class Trinket extends ItemDetail { +public class Trinket extends StatSelectable { public Type getType() { return type; } - public List<Flag> getFlags() { - return flags; - } - - public List<Infusion> getInfusionUpgradeFlag() { - return infusion_upgrade_flags; - } - - public String getSuffix() { - return suffix; - } - - public InfixUpgrade getInfixUpgrade() { - return infix_upgrade; - } - - public List<String> getBonuses() { - return bonuses; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Trinket trinket = (Trinket) o; - - return type == trinket.type && - (flags != null ? flags.equals(trinket.flags) : trinket.flags == null) && - (infusion_upgrade_flags != null ? infusion_upgrade_flags.equals(trinket.infusion_upgrade_flags) : trinket.infusion_upgrade_flags == null) && - (suffix != null ? suffix.equals(trinket.suffix) : trinket.suffix == null) && - (bonuses != null ? bonuses.equals(trinket.bonuses) : trinket.bonuses == null); - } - - @Override - public int hashCode() { - int result = type != null ? type.hashCode() : 0; - result = 31 * result + (flags != null ? flags.hashCode() : 0); - result = 31 * result + (infusion_upgrade_flags != null ? infusion_upgrade_flags.hashCode() : 0); - result = 31 * result + (suffix != null ? suffix.hashCode() : 0); - result = 31 * result + (bonuses != null ? bonuses.hashCode() : 0); - return result; - } - @Override public String toString() { return "Trinket{" + - "type=" + type + - ", flags=" + flags + - ", infusion_upgrade_flags=" + infusion_upgrade_flags + - ", suffix='" + suffix + '\'' + - ", bonuses=" + bonuses + + ", infusion_slots=" + infusion_slots + + ", infix_upgrade=" + infix_upgrade + + ", suffix_item_id=" + suffix_item_id + + ", secondary_suffix_item_id='" + secondary_suffix_item_id + '\'' + + ", stat_choices=" + stat_choices + '}'; } } diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/UpgradeComponent.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/UpgradeComponent.java new file mode 100644 index 0000000..c45b50c --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/UpgradeComponent.java @@ -0,0 +1,50 @@ +package me.xhsun.guildwars2wrapper.model.util.itemDetail; + +import me.xhsun.guildwars2wrapper.model.util.comm.Type; +import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; + +import java.util.List; + +/** + * For more info on upgrade component detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Upgrade_component">here</a><br/> + * + * @author xhsun + * @since 2017-06-07 + */ +public class UpgradeComponent extends ItemDetail { + public Type getType() { + return type; + } + + public List<ItemDetail.Flag> getFlags() { + return flags; + } + + public List<ItemDetail.Infusion> getInfusion_upgrade_flags() { + return infusion_upgrade_flags; + } + + public String getSuffix() { + return suffix; + } + + public InfixUpgrade getInfix_upgrade() { + return infix_upgrade; + } + + public List<String> getBonuses() { + return bonuses; + } + + @Override + public String toString() { + return "UpgradeComponent{" + + "type=" + type + + ", flags=" + flags + + ", infusion_upgrade_flags=" + infusion_upgrade_flags + + ", suffix='" + suffix + '\'' + + ", infix_upgrade=" + infix_upgrade + + ", bonuses=" + bonuses + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Utility.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Utility.java index 2392aaf..84d0d73 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Utility.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Utility.java @@ -19,23 +19,6 @@ public int getCharges() { return charges; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Utility utility = (Utility) o; - - return charges == utility.charges && type == utility.type; - } - - @Override - public int hashCode() { - int result = type != null ? type.hashCode() : 0; - result = 31 * result + charges; - return result; - } - @Override public String toString() { return "Utility{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java index 5ac62d6..bf63841 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/Weapon.java @@ -1,10 +1,6 @@ package me.xhsun.guildwars2wrapper.model.util.itemDetail; import me.xhsun.guildwars2wrapper.model.util.comm.Type; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfixUpgrade; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject.InfusionSlot; - -import java.util.List; /** * For more info on Weapon detail API go <a href="https://wiki.guildwars2.com/wiki/API:2/items#Weapon">here</a><br/> @@ -14,7 +10,7 @@ * @see ItemDetail item details * @since 2017-02-10 */ -public class Weapon extends ItemDetail { +public class Weapon extends StatSelectable { public Type getType() { return type; } @@ -35,60 +31,6 @@ public int getDefense() { return defense; } - public List<InfusionSlot> getInfusionSlots() { - return infusion_slots; - } - - public InfixUpgrade getInfixUpgrade() { - return infix_upgrade; - } - - public int getSuffixID() { - return suffix_item_id; - } - - public String getSecSuffixID() { - return secondary_suffix_item_id; - } - - public List<String> getStatChoice() { - return stat_choices; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Weapon weapon = (Weapon) o; - - return min_power == weapon.min_power && - max_power == weapon.max_power && - defense == weapon.defense && - suffix_item_id == weapon.suffix_item_id && - type == weapon.type && - damage_type == weapon.damage_type && - (infusion_slots != null ? infusion_slots.equals(weapon.infusion_slots) : weapon.infusion_slots == null) && - (infix_upgrade != null ? infix_upgrade.equals(weapon.infix_upgrade) : weapon.infix_upgrade == null) && - (secondary_suffix_item_id != null ? secondary_suffix_item_id.equals(weapon.secondary_suffix_item_id) : weapon.secondary_suffix_item_id == null) && - (stat_choices != null ? stat_choices.equals(weapon.stat_choices) : weapon.stat_choices == null); - } - - @Override - public int hashCode() { - int result = type != null ? type.hashCode() : 0; - result = 31 * result + (damage_type != null ? damage_type.hashCode() : 0); - result = 31 * result + min_power; - result = 31 * result + max_power; - result = 31 * result + defense; - result = 31 * result + (infusion_slots != null ? infusion_slots.hashCode() : 0); - result = 31 * result + (infix_upgrade != null ? infix_upgrade.hashCode() : 0); - result = 31 * result + suffix_item_id; - result = 31 * result + (secondary_suffix_item_id != null ? secondary_suffix_item_id.hashCode() : 0); - result = 31 * result + (stat_choices != null ? stat_choices.hashCode() : 0); - return result; - } - @Override public String toString() { return "Weapon{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java index 6f1723b..74f8c5a 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/Buff.java @@ -27,15 +27,12 @@ public boolean equals(Object o) { Buff buff = (Buff) o; - return (skill_id == buff.skill_id) && - (description != null ? description.equals(buff.description) : buff.description == null); + return (skill_id == buff.skill_id); } @Override public int hashCode() { - int result = skill_id; - result = 31 * result + (description != null ? description.hashCode() : 0); - return result; + return skill_id; } @Override diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixAttribute.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixAttribute.java index e6a9d8a..c4b4a09 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixAttribute.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixAttribute.java @@ -1,6 +1,6 @@ package me.xhsun.guildwars2wrapper.model.util.itemDetail.subobject; -import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemDetail; +import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemAttributes; /** * Infix attribute model class @@ -11,10 +11,10 @@ */ public class InfixAttribute { - private ItemDetail.Attribute attribute; + private ItemAttributes.Attribute attribute; private int modifier; - public ItemDetail.Attribute getAttribute() { + public ItemAttributes.Attribute getAttribute() { return attribute; } @@ -22,23 +22,6 @@ public int getModifier() { return modifier; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - InfixAttribute that = (InfixAttribute) o; - - return modifier == that.modifier && attribute == that.attribute; - } - - @Override - public int hashCode() { - int result = attribute != null ? attribute.hashCode() : 0; - result = 31 * result + modifier; - return result; - } - @Override public String toString() { return "InfixAttribute{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java index 46834e8..86f13a1 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfixUpgrade.java @@ -24,24 +24,6 @@ public Buff getBuff() { return buff; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - InfixUpgrade that = (InfixUpgrade) o; - - return (attributes != null ? attributes.equals(that.attributes) : that.attributes == null) && - (buff != null ? buff.equals(that.buff) : that.buff == null); - } - - @Override - public int hashCode() { - int result = attributes != null ? attributes.hashCode() : 0; - result = 31 * result + (buff != null ? buff.hashCode() : 0); - return result; - } - @Override public String toString() { return "InfixUpgrade{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java index 4053a59..f3566d8 100644 --- a/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/itemDetail/subobject/InfusionSlot.java @@ -24,24 +24,6 @@ public int getID() { return item_id; } - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - InfusionSlot that = (InfusionSlot) o; - - return item_id == that.item_id && - (flags != null ? flags.equals(that.flags) : that.flags == null); - } - - @Override - public int hashCode() { - int result = flags != null ? flags.hashCode() : 0; - result = 31 * result + item_id; - return result; - } - @Override public String toString() { return "InfusionSlot{" + diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/BooleanAdapter.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/BooleanAdapter.java new file mode 100644 index 0000000..a877987 --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/BooleanAdapter.java @@ -0,0 +1,27 @@ +package me.xhsun.guildwars2wrapper.model.util.skillFact; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; + +import java.lang.reflect.Type; + +/** + * Use for {@link SkillFact} for when type is {@link me.xhsun.guildwars2wrapper.model.util.skillFact.SkillFact.Type#Unblockable} + * the value is boolean instead of int + * + * @author xhsun + * @since 2017-06-15 + */ +public class BooleanAdapter implements JsonDeserializer<Integer> { + + @Override + public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + try { + return json.getAsInt(); + } catch (NumberFormatException e) { + return (json.getAsBoolean()) ? 1 : 0; + } + } +} \ No newline at end of file diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/SkillFact.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/SkillFact.java new file mode 100644 index 0000000..79f9aae --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/SkillFact.java @@ -0,0 +1,137 @@ +package me.xhsun.guildwars2wrapper.model.util.skillFact; + +import com.google.gson.annotations.JsonAdapter; +import me.xhsun.guildwars2wrapper.model.util.itemDetail.ItemAttributes; + +/** + * Skill fact class for {@link me.xhsun.guildwars2wrapper.model.Skill} + * + * @author xhsun + * @since 2017-06-17 + */ +public class SkillFact { + public enum Type { + AttributeAdjust, Buff, ComboField, ComboFinisher, + Damage, Distance, Duration, Heal, HealingAdjust, + NoData, Number, Percent, PrefixedBuff, Radius, + Range, Recharge, Time, Unblockable + } + + public enum Effect { + Aegis, Fury, Might, Protection, Quickness, Regeneration, Resistance, + Retaliation, Stability, Swiftness, Vigor, + Bleeding, Blind, Burning, Chilled, Confusion, Crippled, Fear, Immobile, Poison, Slow, Taunt, Torment, + Vulnerability, Weakness, + Daze, Float, Knockback, Knockdown, Launch, Pull, Sink, Stun, + Agony, Alacrity, Invulnerability, Revealed, Stealth, Superspeed + } + + public enum Field { + Air, Dark, Fire, Ice, Light, Lightning, Poison, Smoke, Ethereal, Water + } + + public enum Finisher {Blast, Leap, Projectile, Whirl} + + private String text, icon, description; + private Type type; + private int apply_count, duration, percent, hit_count, distance; + @JsonAdapter(BooleanAdapter.class) + private int value; + private float dmg_multiplier; + private ItemAttributes.Attribute target, source; + private Effect status; + private Field field_type; + private Finisher finisher_type; + private SkillFact prefix; + + public String getText() { + return text; + } + + public String getIcon() { + return icon; + } + + public String getDescription() { + return description; + } + + public Type getType() { + return type; + } + + public int getApplyCount() { + return apply_count; + } + + public int getDuration() { + return duration; + } + + public int getPercent() { + return percent; + } + + public int getHitCount() { + return hit_count; + } + + public int getDistance() { + return distance; + } + + public float getDamageMultiplier() { + return dmg_multiplier; + } + + public ItemAttributes.Attribute getTarget() { + return target; + } + + public int getValue() { + return value; + } + + public ItemAttributes.Attribute getSource() { + return source; + } + + public Effect getStatus() { + return status; + } + + public Field getFieldType() { + return field_type; + } + + public Finisher getFinisherType() { + return finisher_type; + } + + public SkillFact getPrefix() { + return prefix; + } + + @Override + public String toString() { + return "SkillFact{" + + "text='" + text + '\'' + + ", icon='" + icon + '\'' + + ", description='" + description + '\'' + + ", type=" + type + + ", apply_count=" + apply_count + + ", duration=" + duration + + ", percent=" + percent + + ", hit_count=" + hit_count + + ", distance=" + distance + + ", value=" + value + + ", dmg_multiplier=" + dmg_multiplier + + ", target=" + target + + ", source=" + source + + ", status=" + status + + ", field_type=" + field_type + + ", finisher_type=" + finisher_type + + ", prefix=" + prefix + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/SkillTraitedFact.java b/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/SkillTraitedFact.java new file mode 100644 index 0000000..9ec427e --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/util/skillFact/SkillTraitedFact.java @@ -0,0 +1,28 @@ +package me.xhsun.guildwars2wrapper.model.util.skillFact; + +/** + * Skill traited fact class for {@link me.xhsun.guildwars2wrapper.model.Skill} + * + * @author xhsun + * @since 2017-06-17 + */ +public class SkillTraitedFact extends SkillFact { + private int requires_trait, overrides; + + public int getRequires_trait() { + return requires_trait; + } + + public int getOverrides() { + return overrides; + } + + @Override + public String toString() { + return "SkillTraitedFact{" + + super.toString() + + ", requires_trait=" + requires_trait + + ", overrides=" + overrides + + '}'; + } +} diff --git a/src/main/java/me/xhsun/guildwars2wrapper/model/wvw/Ability.java b/src/main/java/me/xhsun/guildwars2wrapper/model/wvw/Ability.java new file mode 100644 index 0000000..bbf578d --- /dev/null +++ b/src/main/java/me/xhsun/guildwars2wrapper/model/wvw/Ability.java @@ -0,0 +1,60 @@ +package me.xhsun.guildwars2wrapper.model.wvw; + +import me.xhsun.guildwars2wrapper.model.indentifiable.NameableInt; + +import java.util.List; + +/** + * For more info on WvW abilities API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/abilities">here</a><br/> + * Model class for WvW abilities + * + * @author xhsun + * @since 2017-06-15 + */ +public class Ability extends NameableInt { + private String icon, description; + private List<Rank> ranks; + + public String getIcon() { + return icon; + } + + public String getDescription() { + return description; + } + + public List<Rank> getRanks() { + return ranks; + } + + @Override + public String toString() { + return "Ability{" + + super.toString() + + ", icon='" + icon + '\'' + + ", description='" + description + '\'' + + ", ranks=" + ranks + + '}'; + } + + public class Rank { + private int cost; + private String effect; + + public int getCost() { + return cost; + } + + public String getEffect() { + return effect; + } + + @Override + public String toString() { + return "Rank{" + + "cost=" + cost + + ", effect='" + effect + '\'' + + '}'; + } + } +}