Skip to content

Commit 34e8fc1

Browse files
authored
Add files via upload
1 parent 044f861 commit 34e8fc1

File tree

75 files changed

+5019
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+5019
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.sn1pe2win.DestinyEntityObjects;
2+
3+
import com.google.gson.JsonObject;
4+
import com.sn1pe2win.core.DestinyEntity;
5+
import com.sn1pe2win.core.Response;
6+
import com.sn1pe2win.definitions.DestinyMaterialRequirementSetDefinition;
7+
8+
public class AcquisitionInfo extends DestinyEntity {
9+
10+
JsonObject object;
11+
12+
@Override
13+
public JsonObject getRawJson() {
14+
return object;
15+
}
16+
17+
@Override
18+
public void parse(JsonObject object) {
19+
this.object = object;
20+
}
21+
22+
public long getAcquireMaterialRequirementHash() {
23+
return optionalLong(object.getAsJsonPrimitive("acquireMaterialRequirementHash"), 0);
24+
}
25+
26+
@SuppressWarnings("unchecked")
27+
public Response<DestinyMaterialRequirementSetDefinition> getAcquireMaterialRequirement() {
28+
long hash = getAcquireMaterialRequirementHash();
29+
if(hash != 0) {
30+
return (Response<DestinyMaterialRequirementSetDefinition>) new DestinyMaterialRequirementSetDefinition(hash).getAsResponse();
31+
} else return new Response<DestinyMaterialRequirementSetDefinition>(null, 404, "Not Found", "This key was not found inside this object, because this is an optional value.", 0);
32+
}
33+
34+
public boolean runOnlyAcquisitionRewardSite() {
35+
return object.getAsJsonPrimitive("runOnlyAcquisitionRewardSite").getAsBoolean();
36+
}
37+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.sn1pe2win.DestinyEntityObjects;
2+
3+
import com.google.gson.JsonObject;
4+
import com.sn1pe2win.core.DestinyEntity;
5+
import com.sn1pe2win.core.Response;
6+
import com.sn1pe2win.definitions.DestinyActivityDefinition;
7+
import com.sn1pe2win.definitions.MembershipType;
8+
9+
public class ActivityDetails extends DestinyEntity {
10+
11+
JsonObject object;
12+
13+
@Override
14+
public JsonObject getRawJson() {
15+
return object;
16+
}
17+
18+
@Override
19+
public void parse(JsonObject object) {
20+
this.object = object;
21+
}
22+
23+
public long getActivityHash() {
24+
return object.getAsJsonPrimitive("directorActivityHash").getAsLong();
25+
}
26+
27+
@SuppressWarnings("unchecked")
28+
public Response<DestinyActivityDefinition> getActivity() {
29+
return (Response<DestinyActivityDefinition>) new DestinyActivityDefinition(getActivityHash()).getAsResponse();
30+
}
31+
32+
/**Good for the pgcr*/ //TODO load pgcr from here
33+
public String getInstanceId() {
34+
return object.getAsJsonPrimitive("instanceId").getAsString();
35+
}
36+
37+
//TODO enum names
38+
public int getMode() {
39+
return object.getAsJsonPrimitive("mode").getAsInt();
40+
}
41+
42+
public int[] getModes() {
43+
return optionalIntArray(object.getAsJsonArray("modes"), new int[] {});
44+
}
45+
46+
public boolean isPrivate() {
47+
return object.getAsJsonPrimitive("isPrivate").getAsBoolean();
48+
}
49+
50+
public MembershipType getMembershipType() {
51+
return MembershipType.of(object.getAsJsonPrimitive("membershipType").getAsShort());
52+
}
53+
54+
public boolean isMode(int mode) {
55+
for(int m : getModes()) {
56+
if(m == mode) return true;
57+
}
58+
return false;
59+
}
60+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.sn1pe2win.DestinyEntityObjects;
2+
3+
import com.google.gson.JsonObject;
4+
import com.sn1pe2win.core.DestinyEntity;
5+
6+
public class ActivityStats extends DestinyEntity {
7+
JsonObject object;
8+
@Override
9+
public JsonObject getRawJson() {
10+
return object;
11+
}
12+
13+
@Override
14+
public void parse(JsonObject object) {
15+
this.object = object;
16+
}
17+
18+
/**This class only wraps the most common stats.
19+
* You can always get custom stats with this method*/
20+
public String getStatDisplayValue(String statId) {
21+
JsonObject stat = object.getAsJsonObject(statId);
22+
if(stat == null) return null;
23+
else {
24+
return stat.getAsJsonObject("basic").getAsJsonPrimitive("displayValue").getAsString();
25+
}
26+
}
27+
28+
/**This class only wraps the most common stats.
29+
* You can always get custom stats with this method*/
30+
public int getStatValue(String statId) {
31+
JsonObject stat = object.getAsJsonObject(statId);
32+
if(stat == null) return 0;
33+
else {
34+
return stat.getAsJsonObject("basic").getAsJsonPrimitive("value").getAsInt();
35+
}
36+
}
37+
38+
public int getDeaths() {
39+
return getStatValue("deaths");
40+
}
41+
42+
public int getKills() {
43+
return getStatValue("kills");
44+
}
45+
46+
public boolean completed() {
47+
return getStatValue("completed") == 1;
48+
}
49+
50+
public int getTimePlayedSeconds() {
51+
return getStatValue("timePlayedSeconds");
52+
}
53+
54+
public int getActivityDurationSeconds() {
55+
return getStatValue("activityDurationSeconds");
56+
}
57+
58+
//TODO wrap methods
59+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.sn1pe2win.DestinyEntityObjects;
2+
3+
import com.google.gson.JsonObject;
4+
import com.sn1pe2win.core.DestinyEntity;
5+
import com.sn1pe2win.core.Response;
6+
import com.sn1pe2win.definitions.DestinyActivityDefinition;
7+
8+
public class AvailableActivities extends DestinyEntity {
9+
10+
JsonObject object;
11+
12+
@Override
13+
public JsonObject getRawJson() {
14+
return object;
15+
}
16+
17+
@Override
18+
public void parse(JsonObject object) {
19+
this.object = object;
20+
}
21+
22+
public long getActivityHash() {
23+
return object.getAsJsonPrimitive("activityHash").getAsLong();
24+
}
25+
26+
@SuppressWarnings("unchecked")
27+
public Response<DestinyActivityDefinition> getActivity() {
28+
return (Response<DestinyActivityDefinition>) new DestinyActivityDefinition(getActivityHash()).getAsResponse();
29+
}
30+
31+
public boolean isNew() {
32+
return object.getAsJsonPrimitive("isNew").getAsBoolean();
33+
}
34+
35+
public boolean canLead() {
36+
return object.getAsJsonPrimitive("canLead").getAsBoolean();
37+
}
38+
39+
public boolean canJoin() {
40+
return object.getAsJsonPrimitive("canJoin").getAsBoolean();
41+
}
42+
43+
public boolean isCompleted() {
44+
return object.getAsJsonPrimitive("isCompleted").getAsBoolean();
45+
}
46+
47+
public boolean isVisible() {
48+
return object.getAsJsonPrimitive("isVisible").getAsBoolean();
49+
}
50+
51+
public int getDisplayLevel() {
52+
return object.getAsJsonPrimitive("displayLevel").getAsInt();
53+
}
54+
55+
public int getRecommendetLight() {
56+
return object.getAsJsonPrimitive("recommendedLight").getAsInt();
57+
}
58+
59+
public int getDifficultyTier() {
60+
return object.getAsJsonPrimitive("difficultyTier").getAsInt();
61+
}
62+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.sn1pe2win.DestinyEntityObjects;
2+
3+
import com.google.gson.JsonObject;
4+
import com.sn1pe2win.core.DestinyEntity;
5+
6+
public class Color extends DestinyEntity {
7+
8+
JsonObject colorObject;
9+
10+
@Override
11+
public JsonObject getRawJson() {
12+
return colorObject;
13+
}
14+
15+
@Override
16+
public void parse(JsonObject object) {
17+
colorObject = object;
18+
}
19+
20+
public int getRed() {
21+
return colorObject.getAsJsonPrimitive("red").getAsInt();
22+
}
23+
24+
public int getBlue() {
25+
return colorObject.getAsJsonPrimitive("blue").getAsInt();
26+
}
27+
28+
public int getGreen() {
29+
return colorObject.getAsJsonPrimitive("green").getAsInt();
30+
}
31+
32+
public int getAlpha() {
33+
return colorObject.getAsJsonPrimitive("alpha").getAsInt();
34+
}
35+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.sn1pe2win.DestinyEntityObjects;
2+
3+
import com.google.gson.JsonObject;
4+
import com.sn1pe2win.core.DestinyEntity;
5+
import com.sn1pe2win.definitions.MembershipType;
6+
7+
public class DestinyUserInfo extends DestinyEntity {
8+
9+
JsonObject object;
10+
11+
@Override
12+
public JsonObject getRawJson() {
13+
return object;
14+
}
15+
16+
@Override
17+
public void parse(JsonObject object) {
18+
this.object = object;
19+
}
20+
21+
public String getIconPath() {
22+
return object.getAsJsonPrimitive("iconPath").getAsString();
23+
}
24+
25+
public MembershipType getCrossSaveOverride() {
26+
return MembershipType.of(object.getAsJsonPrimitive("crossSaveOverride").getAsShort());
27+
}
28+
29+
public boolean isPublic() {
30+
return object.getAsJsonPrimitive("isPublic").getAsBoolean();
31+
}
32+
33+
public MembershipType getMembershipType() {
34+
return MembershipType.of(object.getAsJsonPrimitive("membershipType").getAsShort());
35+
}
36+
37+
public long getMembershipId() {
38+
return object.getAsJsonPrimitive("membershipId").getAsLong();
39+
}
40+
41+
public String getDisplayName() {
42+
return object.getAsJsonPrimitive("displayName").getAsString();
43+
}
44+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.sn1pe2win.DestinyEntityObjects;
2+
3+
import com.google.gson.JsonArray;
4+
import com.google.gson.JsonObject;
5+
import com.google.gson.JsonPrimitive;
6+
import com.sn1pe2win.core.DestinyEntity;
7+
8+
public class DisplayProperties extends DestinyEntity {
9+
10+
private String description = "";
11+
private String name = "";
12+
private String iconPath = "";
13+
private String iconUrl = "";
14+
private boolean hasIcon = false;
15+
private IconSequenceProperty[] iconSequences = new IconSequenceProperty[0];
16+
17+
/**This object should contain the display property values*/
18+
@Override
19+
public void parse(JsonObject obj) {
20+
if(obj == null) return;
21+
JsonPrimitive jdesc = obj.getAsJsonPrimitive("description");
22+
if(jdesc != null) this.description = jdesc.getAsString();
23+
JsonPrimitive jname = obj.getAsJsonPrimitive("name");
24+
if(jname != null) this.name = jname.getAsString();
25+
boolean hi = false;
26+
JsonPrimitive icon = obj.getAsJsonPrimitive("hasIcon");
27+
if(icon != null) {
28+
hi = icon.getAsBoolean();
29+
if(hi) {
30+
JsonPrimitive iconpath = obj.getAsJsonPrimitive("icon");
31+
if(iconpath != null) this.iconPath = iconpath.getAsString();
32+
this.iconUrl = "https://bungie.net" + this.iconPath;
33+
}
34+
}
35+
JsonArray jiconSequence = obj.getAsJsonArray("iconSequences");
36+
if(jiconSequence != null) {
37+
iconSequences = new IconSequenceProperty[jiconSequence.size()];
38+
for(int i = 0; i < iconSequences.length; i++) {
39+
IconSequenceProperty ic = new IconSequenceProperty();
40+
ic.parse(jiconSequence.get(i).getAsJsonObject());
41+
iconSequences[i] = ic;
42+
}
43+
} else iconSequences = new IconSequenceProperty[0];
44+
}
45+
46+
@Override
47+
public JsonObject getRawJson() {
48+
return null;
49+
}
50+
51+
public String getDescription() {
52+
return description;
53+
}
54+
55+
public String getName() {
56+
return name;
57+
}
58+
59+
public String getIconUrl() {
60+
return iconUrl;
61+
}
62+
63+
public String getIconPath() {
64+
return iconPath;
65+
}
66+
67+
public boolean isHasIcon() {
68+
return hasIcon;
69+
}
70+
}

0 commit comments

Comments
 (0)