|
| 1 | +/* |
| 2 | + * Copyright (c) dec4234 2021. Access is granted, without any express warranties or guarantees of |
| 3 | + * any kind, to all wishing to use this software for their benefit. No one may specifically claim credit, or |
| 4 | + * ownership of this software without the explicit permission of the author. |
| 5 | + * |
| 6 | + * GitHub -> https://github.com/dec4234/JavaDestinyAPI |
| 7 | + */ |
| 8 | + |
| 9 | +package material.stats; |
| 10 | + |
| 11 | +import com.google.gson.JsonObject; |
| 12 | +import material.manifest.ManifestEntityTypes; |
| 13 | +import utils.framework.ContentFramework; |
| 14 | + |
| 15 | +public class ActivityInfo extends ContentFramework { |
| 16 | + |
| 17 | + private String name, hash, completionUnlockHash, destinationHash, placeHash, activityTypeHash, activityModeHash, description, icon, pgcrImage, releaseIcon; |
| 18 | + private int modeType, activityModeCategory, releaseTime, activityLightLevel, tier, minParty, maxParty, maxPlayers; |
| 19 | + private ActivityMode activityMode; |
| 20 | + private boolean hasIcon, isPlaylist, inheritFromFreeRoam, suppressOtherRewards, isMatchmade, requiresGuardianOath, isPvP; |
| 21 | + |
| 22 | + public ActivityInfo(String hash) { |
| 23 | + super(ManifestEntityTypes.ACTIVITY, hash, source -> { |
| 24 | + return source.getAsJsonObject("Response"); |
| 25 | + }); |
| 26 | + |
| 27 | + // Intialize values of the Activity Mode |
| 28 | + this.name = getDisplayProperties().get("name").getAsString(); |
| 29 | + this.description = getDisplayProperties().get("description").getAsString(); |
| 30 | + |
| 31 | + this.hasIcon = getDisplayProperties().get("hasIcon").getAsBoolean(); |
| 32 | + |
| 33 | + if(hasIcon) { |
| 34 | + icon = getDisplayProperties().get("icon").getAsString(); |
| 35 | + } |
| 36 | + |
| 37 | + // this.pgcrImage = getJO().get("pgcrImage").getAsString(); |
| 38 | + this.releaseIcon = getJO().get("releaseIcon").getAsString(); |
| 39 | + |
| 40 | + // Hashes |
| 41 | + this.hash = hash; |
| 42 | + this.completionUnlockHash = getJO().get("completionUnlockHash").getAsString(); |
| 43 | + this.destinationHash = getJO().get("destinationHash").getAsString(); |
| 44 | + this.placeHash = getJO().get("placeHash").getAsString(); |
| 45 | + this.activityTypeHash = getJO().get("activityTypeHash").getAsString(); |
| 46 | + // this.activityModeHash = getJO().get("activityModeHash").getAsString(); |
| 47 | + |
| 48 | + // Numbers |
| 49 | + this.modeType = getJO().get("directActivityModeType").getAsInt(); |
| 50 | + this.activityMode = ActivityMode.fromBungieValue(modeType); |
| 51 | + this.activityModeCategory = getJO().get("activityModeCategory").getAsInt(); |
| 52 | + this.releaseTime = getJO().get("releaseTime").getAsInt(); |
| 53 | + this.tier = getJO().get("tier").getAsInt(); |
| 54 | + this.activityLightLevel = getJO().get("activityLightLevel").getAsInt(); |
| 55 | + |
| 56 | + // Random booleans |
| 57 | + this.isPlaylist = getJO().get("isPlaylist").getAsBoolean(); |
| 58 | + this.inheritFromFreeRoam = getJO().get("inheritFromFreeRoam").getAsBoolean(); |
| 59 | + this.suppressOtherRewards = getJO().get("suppressOtherRewards").getAsBoolean(); |
| 60 | + this.isPvP = getJO().get("isPvP").getAsBoolean(); |
| 61 | + |
| 62 | + // Matchmaking |
| 63 | + this.isMatchmade = getMatchmaking().get("isMatchmade").getAsBoolean(); |
| 64 | + this.minParty = getMatchmaking().get("minParty").getAsInt(); |
| 65 | + this.maxParty = getMatchmaking().get("maxParty").getAsInt(); |
| 66 | + this.maxPlayers = getMatchmaking().get("maxPlayers").getAsInt(); |
| 67 | + this.requiresGuardianOath = getMatchmaking().get("requiresGuardianOath").getAsBoolean(); |
| 68 | + } |
| 69 | + |
| 70 | + public JsonObject getDisplayProperties() { |
| 71 | + return getJO().getAsJsonObject("displayProperties"); |
| 72 | + } |
| 73 | + |
| 74 | + public JsonObject getMatchmaking() { |
| 75 | + return getJO().getAsJsonObject("matchmaking"); |
| 76 | + } |
| 77 | + |
| 78 | + public String getName() { |
| 79 | + return name; |
| 80 | + } |
| 81 | + |
| 82 | + public String getHash() { |
| 83 | + return hash; |
| 84 | + } |
| 85 | + |
| 86 | + public String getCompletionUnlockHash() { |
| 87 | + return completionUnlockHash; |
| 88 | + } |
| 89 | + |
| 90 | + public String getDestinationHash() { |
| 91 | + return destinationHash; |
| 92 | + } |
| 93 | + |
| 94 | + public String getPlaceHash() { |
| 95 | + return placeHash; |
| 96 | + } |
| 97 | + |
| 98 | + public String getActivityTypeHash() { |
| 99 | + return activityTypeHash; |
| 100 | + } |
| 101 | + |
| 102 | + public String getActivityModeHash() { |
| 103 | + return activityModeHash; |
| 104 | + } |
| 105 | + |
| 106 | + public String getDescription() { |
| 107 | + return description; |
| 108 | + } |
| 109 | + |
| 110 | + public String getIcon() { |
| 111 | + return icon; |
| 112 | + } |
| 113 | + |
| 114 | + public String getPgcrImage() { |
| 115 | + return pgcrImage; |
| 116 | + } |
| 117 | + |
| 118 | + public String getReleaseIcon() { |
| 119 | + return releaseIcon; |
| 120 | + } |
| 121 | + |
| 122 | + public int getModeType() { |
| 123 | + return modeType; |
| 124 | + } |
| 125 | + |
| 126 | + public int getActivityModeCategory() { |
| 127 | + return activityModeCategory; |
| 128 | + } |
| 129 | + |
| 130 | + public int getReleaseTime() { |
| 131 | + return releaseTime; |
| 132 | + } |
| 133 | + |
| 134 | + public int getActivityLightLevel() { |
| 135 | + return activityLightLevel; |
| 136 | + } |
| 137 | + |
| 138 | + public int getTier() { |
| 139 | + return tier; |
| 140 | + } |
| 141 | + |
| 142 | + public int getMinParty() { |
| 143 | + return minParty; |
| 144 | + } |
| 145 | + |
| 146 | + public int getMaxParty() { |
| 147 | + return maxParty; |
| 148 | + } |
| 149 | + |
| 150 | + public int getMaxPlayers() { |
| 151 | + return maxPlayers; |
| 152 | + } |
| 153 | + |
| 154 | + public ActivityMode getActivityMode() { |
| 155 | + return activityMode; |
| 156 | + } |
| 157 | + |
| 158 | + public boolean isHasIcon() { |
| 159 | + return hasIcon; |
| 160 | + } |
| 161 | + |
| 162 | + public boolean isPlaylist() { |
| 163 | + return isPlaylist; |
| 164 | + } |
| 165 | + |
| 166 | + public boolean isInheritFromFreeRoam() { |
| 167 | + return inheritFromFreeRoam; |
| 168 | + } |
| 169 | + |
| 170 | + public boolean isSuppressOtherRewards() { |
| 171 | + return suppressOtherRewards; |
| 172 | + } |
| 173 | + |
| 174 | + public boolean isMatchmade() { |
| 175 | + return isMatchmade; |
| 176 | + } |
| 177 | + |
| 178 | + public boolean isRequiresGuardianOath() { |
| 179 | + return requiresGuardianOath; |
| 180 | + } |
| 181 | + |
| 182 | + public boolean isPvP() { |
| 183 | + return isPvP; |
| 184 | + } |
| 185 | +} |
0 commit comments