Tools -> Chests -> Pity Timers errors
alexyuscott opened this issue · 2 comments
alexyuscott commented
djravine commented
This has been fixed in my build for you.
https://github.com/djravine/idlecombos/releases/tag/v3.27
This was caused by a change in the JSON structure so the data was no longer being read correctly.
ShowPityTimers() {
pitylist := ""
pityjsonoutput := "{"
jsoncount := 0
for k, v in (UserDetails.details.stats) {
if (InStr(k,"forced_win_counter_")) {
if (jsoncount > 0) {
pityjsonoutput := pityjsonoutput ","
}
jsoncount += 1
pityjsonoutput := pityjsonoutput """" k """:""" v """"
}
}
pityjsonoutput := pityjsonoutput "}"
pityjson := JSON.parse( pityjsonoutput )
pityjsonoutput := "" ; Free Memory
newestchamp := JSON.stringify(UserDetails.details.heroes[UserDetails.details.heroes.MaxIndex()].hero_id)
newestchamp := StrReplace(newestchamp, """")
chestsforepic := 1
while (chestsforepic < 11) {
if (chestsforepic == 1) {
pitylist := pitylist "Epic in Next Chest for:`n "
} else {
pitylist := pitylist "Epic in next " chestsforepic " Chests for:`n "
}
currentchamp := 14
currentcount := 0
currentchest := 0
currentpity := ""
while (currentchamp < newestchamp) {
currentchest := "forced_win_counter_" ChestIDFromChampID(currentchamp)
for k, v in (pityjson) {
if (k = currentchest) {
currentpity := v
}
}
if (currentpity = chestsforepic) {
pitylist := pitylist ChampFromID(currentchamp) ", "
currentcount += 1
}
switch currentchamp {
case "17": currentchamp += 2
case "29": currentchamp += 2
case "66": currentchamp += 3
default: currentchamp += 1
}
}
if !(currentcount) {
pitylist := pitylist "(None)`n"
} else {
StringTrimRight, pitylist, pitylist, 2
pitylist := pitylist "`n"
}
chestsforepic += 1
}
MsgBox % pitylist
return
}
alexyuscott commented
That appears to work nicely! Thank you!