-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRelic.py
43 lines (40 loc) · 1.64 KB
/
Relic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from Drop import Drop
class Relic(Drop):
def __init__(self, c, name):
super().__init__(c, name)
self.vaulted = False
self.drops = []
for k, v in self.get_drops().items():
if k == "Forma BP":
continue
temp = Drop(c, k)
temp.chance = v
self.drops.append(temp)
def get_drops(self):
# Modify search string
suffixes = ["Exceptional", "Flawless", "Radiant"]
temp = self.name.split(" ")
if temp[-1] in suffixes:
search_string = " ".join([temp[0], temp[1], "Relic"]) + " (" + temp[2] + ")"
elif temp[-1] == "Intact":
search_string = " ".join([temp[0], temp[1], "Relic"])
else:
search_string = self.name + " Relic"
response = self.cache.get("https://api.warframestat.us/drops/search/" + search_string.lower())
if response.status_code != 200:
return "N/A"
drops = response.json_data
# Check if relic is vaulted
intact_search_string = " ".join([temp[0], temp[1], "Relic"])
intact_response = self.cache.get("https://api.warframestat.us/drops/search/" + intact_search_string.lower())
intact_drops = intact_response.json_data
if intact_drops[0]["vaulted"]:
self.vaulted = True
if intact_search_string[0:6] in ["Neo O1", "Axi A2", "Axi A5", "Axi V8"]:
self.vaulted = "Baro"
# Aggregate possible drops
loot_table = {}
for drop in drops:
if drop["place"] == search_string:
loot_table[drop["item"]] = drop["chance"]
return loot_table