-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from dec4234/dec4234-patch-1
Introduction of new features and various improvements
- Loading branch information
Showing
12 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
JavaDestinyAPI/src/main/java/material/inventory/DestinyItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,97 @@ | ||
package material.inventory; | ||
|
||
import com.google.gson.JsonObject; | ||
import material.manifest.ManifestEntityTypes; | ||
import utils.HttpUtils; | ||
|
||
public class DestinyItem { | ||
|
||
HttpUtils hu = new HttpUtils(); | ||
|
||
private String hashID; | ||
private String name; | ||
private String icon; | ||
private String description; | ||
private boolean hasIcon; | ||
private String collectibleHash; | ||
private String screenshot; | ||
private ItemTier itemType; | ||
|
||
private ItemTier tier; | ||
|
||
private JsonObject jo; | ||
|
||
public DestinyItem(String hashID) { | ||
this.hashID = hashID; | ||
jo = hu.manifestGET(ManifestEntityTypes.INVENTORYITEM, hashID).getAsJsonObject("Response"); | ||
assignValues(); | ||
} | ||
|
||
private void assignValues() { | ||
JsonObject dp = jo.getAsJsonObject("displayProperties"); | ||
name = dp.get("name").getAsString(); | ||
description = dp.get("description").getAsString(); | ||
icon = dp.get("icon").getAsString(); | ||
hasIcon = dp.get("hasIcon").getAsBoolean(); | ||
collectibleHash = jo.get("collectibleHash").getAsString(); | ||
screenshot = jo.get("screenshot").getAsString(); | ||
itemType = asessItemTier(); | ||
} | ||
|
||
public String getHashID() { | ||
return hashID; | ||
} | ||
|
||
/** | ||
* Gets the name of the item | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* Plug this after https://www.bungie.net/ in a browser | ||
*/ | ||
public String getIcon() { | ||
return icon; | ||
} | ||
|
||
/** | ||
* Gets the lore descriptions associated with this item | ||
*/ | ||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public boolean hasIcon() { | ||
return hasIcon; | ||
} | ||
|
||
public String getCollectibleHash() { | ||
return collectibleHash; | ||
} | ||
|
||
public ItemTier asessItemTier() { | ||
switch(jo.getAsJsonObject("inventory").get("tierTypeName").getAsString()) { | ||
case "Common": | ||
return ItemTier.COMMON; | ||
case "Uncommon": | ||
return ItemTier.UNCOMMON; | ||
case "Rare": | ||
return ItemTier.RARE; | ||
case "Legendary": | ||
return ItemTier.LEGENDARY; | ||
case "Exotic": | ||
return ItemTier.EXOTIC; | ||
} | ||
return null; | ||
} | ||
|
||
enum ItemTier { | ||
COMMON, | ||
UNCOMMON, | ||
RARE, | ||
LEGENDARY, | ||
EXOTIC; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.28 KB
JavaDestinyAPI/target/classes/material/inventory/DestinyItem$ItemTier.class
Binary file not shown.
Binary file modified
BIN
+2.37 KB
(660%)
JavaDestinyAPI/target/classes/material/inventory/DestinyItem.class
Binary file not shown.
Binary file modified
BIN
+6 Bytes
(100%)
JavaDestinyAPI/target/classes/material/user/BungieUser.class
Binary file not shown.
Binary file not shown.