Closed ScriptExec closed 4 years ago
Could you give me an example?
I just found out that it wasnt your api but the user played in different region and thats what was causing the different rank, and about the gold IV, its in the source code somewhere with rank urls etc. Sorry for false information, my bad :tired_face:
Hello. You can manually convert using this.
Convert mmr to rankId
def mmr_to_rankId(mmr):
if mmr <= 1099: return 0
elif mmr <= 1199: return 1
elif mmr <= 1299: return 2
elif mmr <= 1399: return 3
elif mmr <= 1499: return 4
elif mmr <= 1599: return 5
elif mmr <= 1699: return 6
elif mmr <= 1799: return 7
elif mmr <= 1899: return 8
elif mmr <= 1999: return 9
elif mmr <= 2099: return 10
elif mmr <= 2199: return 11
elif mmr <= 2299: return 12
elif mmr <= 2399: return 13
elif mmr <= 2499: return 14
elif mmr <= 2599: return 15
elif mmr <= 2799: return 16
elif mmr <= 2999: return 17
elif mmr <= 3199: return 18
elif mmr <= 3599: return 19
elif mmr <= 3999: return 20
elif mmr <= 4399: return 21
elif mmr <= 4999: return 22
else: return 23
Get rank by rankId
def get_rank(rank_id, season):
rank = "Unranked", "https://i.imgur.com/jNJ1BBl.png"
if season >= 15:
if rank_id == 0: return "Unranked", "https://i.imgur.com/jNJ1BBl.png"
elif rank_id <= 5:
if rank_id == 1: rank = "Copper Ⅴ", "https://i.imgur.com/B8NCTyX.png"
elif rank_id == 2: rank = "Copper Ⅳ", "https://i.imgur.com/ehILQ3i.jpg"
elif rank_id == 3: rank = "Copper Ⅲ", "https://i.imgur.com/6CxJoMn.jpg"
elif rank_id == 4: rank = "Copper Ⅱ", "https://i.imgur.com/eI11lah.jpg"
elif rank_id == 5: rank = "Copper Ⅰ", "https://i.imgur.com/0J0jSWB.jpg"
return rank
elif rank_id <= 10:
if rank_id == 6: rank = "Bronze Ⅴ", "https://i.imgur.com/TIWCRyO.png"
elif rank_id == 7: rank = "Bronze Ⅳ", "https://i.imgur.com/42AC7RD.jpg"
elif rank_id == 8: rank = "Bronze Ⅲ", "https://i.imgur.com/QD5LYD7.jpg"
elif rank_id == 9: rank = "Bronze Ⅱ", "https://i.imgur.com/9AORiNm.jpg"
elif rank_id == 10: rank = "Bronze Ⅰ", "https://i.imgur.com/hmPhPBj.jpg"
return rank
elif rank_id <= 15:
if rank_id == 11: rank = "Silver Ⅴ", "https://i.imgur.com/PY2p17k.png"
elif rank_id == 12: rank = "Silver Ⅳ", "https://i.imgur.com/D36ZfuR.jpg"
elif rank_id == 13: rank = "Silver Ⅲ", "https://i.imgur.com/m8GToyF.jpg"
elif rank_id == 14: rank = "Silver Ⅱ", "https://i.imgur.com/EswGcx1.jpg"
elif rank_id == 15: rank = "Silver Ⅰ", "https://i.imgur.com/KmFpkNc.jpg"
return rank
elif rank_id <= 18:
if rank_id == 16: rank = "Gold Ⅲ", "https://i.imgur.com/B0s1o1h.jpg"
elif rank_id == 17: rank = "Gold Ⅱ", "https://i.imgur.com/ELbGMc7.jpg"
elif rank_id == 18: rank = "Gold Ⅰ", "https://i.imgur.com/ffDmiPk.jpg"
return rank
elif rank_id <= 21:
if rank_id == 19: rank = "Platinum Ⅲ", "https://i.imgur.com/tmcWQ6I.png"
elif rank_id == 20: rank = "Platinum Ⅱ", "https://i.imgur.com/CYMO3Er.png"
elif rank_id == 21: rank = "Platinum Ⅰ", "https://i.imgur.com/qDYwmah.png"
return rank
elif rank_id <= 22:
return "Diamond", "https://i.imgur.com/37tSxXm.png"
else: return "Champion", "https://i.imgur.com/VlnwLGk.png"
else:
if rank_id == 0:
return "Unranked", "https://i.imgur.com/jNJ1BBl.png"
elif rank_id <= 4:
if rank_id == 1: rank = "Copper Ⅳ", "https://i.imgur.com/ehILQ3i.jpg"
elif rank_id == 2: rank = "Copper Ⅲ", "https://i.imgur.com/6CxJoMn.jpg"
elif rank_id == 3: rank = "Copper Ⅱ", "https://i.imgur.com/eI11lah.jpg"
elif rank_id == 4: rank = "Copper Ⅰ", "https://i.imgur.com/0J0jSWB.jpg"
return rank
elif rank_id <= 8:
if rank_id == 5: rank = "Bronze Ⅳ", "https://i.imgur.com/42AC7RD.jpg"
elif rank_id == 6: rank = "Bronze Ⅲ", "https://i.imgur.com/QD5LYD7.jpg"
elif rank_id == 7: rank = "Bronze Ⅱ", "https://i.imgur.com/9AORiNm.jpg"
elif rank_id == 8: rank = "Bronze Ⅰ", "https://i.imgur.com/hmPhPBj.jpg"
return rank
elif rank_id <= 12:
if rank_id == 9: rank = "Silver Ⅳ", "https://i.imgur.com/D36ZfuR.jpg"
elif rank_id == 10: rank = "Silver Ⅲ", "https://i.imgur.com/m8GToyF.jpg"
elif rank_id == 11: rank = "Silver Ⅱ", "https://i.imgur.com/EswGcx1.jpg"
elif rank_id == 12: rank = "Silver Ⅰ", "https://i.imgur.com/KmFpkNc.jpg"
return rank
elif rank_id <= 16:
if rank_id == 13: rank = "Gold Ⅳ", "https://i.imgur.com/6Qg6aaH.jpg"
elif rank_id == 14: rank = "Gold Ⅲ", "https://i.imgur.com/B0s1o1h.jpg"
elif rank_id == 15: rank = "Gold Ⅱ", "https://i.imgur.com/ELbGMc7.jpg"
elif rank_id == 16: rank = "Gold Ⅰ", "https://i.imgur.com/ffDmiPk.jpg"
return rank
elif rank_id <= 19:
if rank_id == 17: rank = "Platinum Ⅲ", "https://i.imgur.com/Sv3PQQE.jpg"
elif rank_id == 18: rank = "Platinum Ⅱ", "https://i.imgur.com/Uq3WhzZ.jpg"
elif rank_id == 19: rank = "Platinum Ⅰ", "https://i.imgur.com/xx03Pc5.jpg"
return rank
else: return "Diamond", "https://i.imgur.com/nODE0QI.jpg"
Example
mmr_to_rankId(2350) 13 get_rank(13, 15) #New rank system ('Silver Ⅲ', 'https://i.imgur.com/m8GToyF.jpg') get_rank(13, 14) #Old rank system ('Gold Ⅳ', 'https://i.imgur.com/6Qg6aaH.jpg')
Good to know thanks! 😯
Theres a problem with your api not showing the ranks correctly - gold IV is no longer in the game and the champion rank isnt shown, but diamond