Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- EncodedSaveState := Clipboard
- StringCaseSense On
- Chars = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
- Seperator_String := "Fe12NAfA3R6z4k0z"
- StringLeft, EncodedSaveState_LessSplitAndHash, EncodedSaveState, InStr(EncodedSaveState, Seperator_String)
- StringSplit, temp, EncodedSaveState_LessSplitAndHash
- Length := StrLen(EncodedSaveState_LessSplitAndHash) - 1
- loop % Length
- {
- if (mod(A_Index, 2) = 0)
- continue
- tempstr := tempstr . temp%A_Index%
- }
- DecodedString := InvBase64(tempstr)
- ; FileAppend, %DecodedString%, DecodedSaveState.txt
- titanDamage := json(DecodedString, "titanDamage")
- rubies := json(DecodedString, "rubies")
- FormatTime, timeVar, A_Now, ddd, h:mmt
- FileAppend, % timeVar . "`t" . A_TickCount . "`t" . titanDamage . "`t" . rubies . "`n", titanDamage.txt
- Solomon_Level := json(DecodedString, "ancients.ancients.3.level")
- Solomon_Level_plus5 := Solomon_Level + 5
- if (Solomon_Level <= 20)
- Solomon_Modifier := 1 + Solomon_Level * 5 / 100
- else if (Solomon_Level <= 40)
- Solomon_Modifier := 1 + (100 + (Solomon_Level - 20) * 4) / 100
- else if (Solomon_Level <= 60)
- Solomon_Modifier := 1 + (180 + (Solomon_Level - 40) * 3) / 100
- else if (Solomon_Level <= 80)
- Solomon_Modifier := 1 + (240 + (Solomon_Level - 60) * 2) / 100
- else
- Solomon_Modifier := 1 + (200 + Solomon_Level) / 100
- if (Solomon_Level_plus5 <= 20)
- Solomon_Modifier_plus5 := 1 + Solomon_Level_plus5 * 5 / 100
- else if (Solomon_Level_plus5 <= 40)
- Solomon_Modifier_plus5 := 1 + (100 + (Solomon_Level_plus5 - 20) * 4) / 100
- else if (Solomon_Level_plus5 <= 60)
- Solomon_Modifier_plus5 := 1 + (180 + (Solomon_Level_plus5 - 40) * 3) / 100
- else if (Solomon_Level_plus5 <= 80)
- Solomon_Modifier_plus5 := 1 + (240 + (Solomon_Level_plus5 - 60) * 2) / 100
- else
- Solomon_Modifier_plus5 := 1 + (200 + Solomon_Level_plus5) / 100
- ; Value list in terms of increase in HS/hr per point
- bonusType1Value := 0 ; Siyalatas, Ancient of Abandonment +X% DPS when idle (no clicks for 60 seconds)
- bonusType2Value := 0 ; Fragsworth, Ancient of Wrath +X% Click Damage
- bonusType3Value := 0 ; Chronos, Ancient of Time +X seconds to Boss Fight timers
- bonusType4Value := 0 ; Chawedo, Ancient of Agitation +X seconds to duration of Clickstorm
- bonusType5Value := 0.8 ; Revolc, Ancient of Luck +X% Chance of double rubies from clickable treasures, when you get a ruby.
- bonusType6Value := 0 ; Iris, Ancient of Vision +X to starting zone after Ascension
- bonusType7Value := 0 ; Argaiv, Ancient of Enhancement +X% to Gilded damage bonus (per Gild)
- bonusType8Value := 0 ; Energon, Ancient of Battery Life +X seconds to duration of Metal Detector
- bonusType9Value := 0.0006 ; Kleptos, Ancient of Thieves +X seconds to duration of Golden Clicks
- bonusType10Value := 0.0006 ; Sniperino, Ancient of Accuracy +X seconds to duration of Lucky Strikes
- bonusType11Value := 0 ; Berserker, Ancient of Rage +X seconds to duration of Powersurge
- bonusType12Value := 0 ; Hecatoncheir, Ancient of Wallops +X seconds to duration of Super Clicks
- bonusType13Value := 0.015625 ; Bubos, Ancient of Diseases -X% Boss Life
- bonusType14Value := 0 ; Morgulis, Ancient of Death +X% to Hero Soul DPS (additive)
- bonusType15Value := 0 ; Bhaal, Ancient of Murder +X% damage to Critical Clicks
- bonusType16Value := 0.015625 ; (PER10) Dora, Ancient of Discovery +X% more Treasure Chests
- bonusType17Value := 1.9 ; Atman, Ancient of Souls +X% Chance of Primal Bosses
- bonusType18Value := 0.034375 ; Fortuna, Ancient of Chance +X% Chance of 10x Gold
- bonusType19Value := 0.121875 ; Dogcog, Ancient of Thrift -X% Hero Hiring and Level-Up cost
- bonusType20Value := 0 ; Pluto, Ancient of Wealth +X% Gold from Golden Clicks
- bonusType21Value := 0 ; Mimzee, Ancient of Riches +X% Gold From Treasure Chests
- bonusType22Value := 0 ; Mammon, Ancient of Greed +X% Gold Dropped
- bonusType24Value := 0 ; Libertas, Ancient of Freedom +X% Gold gained from monsters when idle
- bonusType25Value := ((Solomon_Modifier_plus5 / Solomon_Modifier) - 1) * 100 ; (PER5)Solomon, Ancient of Wisdom +X% Primal Hero Souls
- /*
- relic<1-5> = relic's id
- relic<1-5>bonus<1-4>Type = 0-25 (0 doesn't exist)
- relic<1-5>bonus<1-4>Level = 0-50 (0 doesn't exist)
- relic<1-5>Value = relic<1-5>bonus<1-4>Level * bonusType<1-25>Value
- */
- filename := "relicSummary.txt"
- FileDelete, %filename%
- loop 5
- {
- rID := A_Index
- relic%rID% := json(DecodedString, "items.slots." . rID) ; the relic's ID
- FileAppend, % "relic" . rID . "'s JSON ID: " . relic%rID% . "`n", %filename%
- relic%rID%Value := 0
- loop 4
- {
- bNum := A_index ; which bonus
- Relic%rID%bonus%bNum%Type := json(DecodedString, "items.items." . relic%rID% . ".bonusType" . bNum)
- FileAppend, % "relic" . rID . "bonus" . bNum . "Type:` " . relic%rID%bonus%bNum%Type . "`n", %filename%
- Relic%rID%bonus%bNum%Level := json(DecodedString, "items.items." . relic%rID% . ".bonus" . bNum . "Level")
- FileAppend, % "relic" . rID . "bonus" . bNum . "Level: " . relic%rID%bonus%bNum%Level . "`n", %filename%
- tType := relic%rID%bonus%bNum%Type
- relic%rID%Value += relic%rID%bonus%bNum%Level * bonusType%tType%Value
- }
- FileAppend, % "relic" . rID . "Value: " . relic%rID%Value . "`n`n", %filename%
- }
- Return_Value := 0 ; 1-4 means swap 5 with 1-4, 0 means no swaps necessary
- loop 4
- {
- if (relic%A_Index%Value < relic5Value)
- {
- if Return_Value ; checks which is lowest if there are multiple that are worse then relic5
- {
- if (relic%A_Index%Value < relic%Return_Value%Value)
- Return_Value := A_Index
- }
- else
- Return_Value := A_Index
- }
- }
- if (not Return_Value = 0)
- FileAppend, % "relic" . RelicNum . " swapped!`n", ClickerHeroesLog.txt
- ; I use a message system, a function return would work just as easily
- SetTitleMatchMode, 2
- DetectHiddenWindows, on
- SendMessage, 0x9200, Return_Value,,, ClickerHeroes.ahk - AutoHotkey v
- return
- ; http://www.autohotkey.com/board/topic/5545-base64-coderdecoder/
- InvBase64(code)
- {
- StringReplace code, code, =,,All
- Loop Parse, code
- {
- If Mod(A_Index,4) = 1
- buffer := DeCode(A_LoopField) << 18
- Else If Mod(A_Index,4) = 2
- buffer += DeCode(A_LoopField) << 12
- Else If Mod(A_Index,4) = 3
- buffer += DeCode(A_LoopField) << 6
- Else {
- buffer += DeCode(A_LoopField)
- out := out . Chr(buffer>>16) . Chr(255 & buffer>>8) . Chr(255 & buffer)
- }
- }
- If Mod(StrLen(code),4) = 0
- Return out
- If Mod(StrLen(code),4) = 2
- Return out . Chr(buffer>>16)
- Return out . Chr(buffer>>16) . Chr(255 & buffer>>8)
- }
- Code(i) ; <== Chars[i & 63], 0-base index
- {
- Global Chars
- StringMid i, Chars, (i&63)+1, 1
- Return i
- }
- DeCode(c) ; c = a char in Chars ==> position [0,63]
- {
- Global Chars
- Return InStr(Chars,c,1) - 1
- }
- ; http://www.autohotkey.com/board/topic/31619-json-readwrite-parser/
- ; https://github.com/polyethene/AutoHotkey-Scripts/blob/master/json.ahk
- json(ByRef js, s, v = "") {
- j = %js%
- Loop, Parse, s, .
- {
- p = 2
- RegExMatch(A_LoopField, "([+\-]?)([^[]+)((?:\[\d+\])*)", q)
- Loop {
- If (!p := RegExMatch(j, "(?<!\\)(""|')([^\1]+?)(?<!\\)(?-1)\s*:\s*((\{(?:[^{}]++|(?-1))*\})|(\[(?:[^[\]]++|(?-1))*\])|"
- . "(?<!\\)(""|')[^\7]*?(?<!\\)(?-1)|[+\-]?\d+(?:\.\d*)?|true|false|null?)\s*(?:,|$|\})", x, p))
- Return
- Else If (x2 == q2 or q2 == "*") {
- j = %x3%
- z += p + StrLen(x2) - 2
- If (q3 != "" and InStr(j, "[") == 1) {
- StringTrimRight, q3, q3, 1
- Loop, Parse, q3, ], [
- {
- z += 1 + RegExMatch(SubStr(j, 2, -1), "^(?:\s*((\[(?:[^[\]]++|(?-1))*\])|(\{(?:[^{\}]++|(?-1))*\})|[^,]*?)\s*(?:,|$)){" . SubStr(A_LoopField, 1) + 1 . "}", x)
- j = %x1%
- }
- }
- Break
- }
- Else p += StrLen(x)
- }
- }
- If v !=
- {
- vs = " ;" just to fix my text editor coloring
- If (RegExMatch(v, "^\s*(?:""|')*\s*([+\-]?\d+(?:\.\d*)?|true|false|null?)\s*(?:""|')*\s*$", vx)
- and (vx1 + 0 or vx1 == 0 or vx1 == "true" or vx1 == "false" or vx1 == "null" or vx1 == "nul"))
- vs := "", v := vx1
- StringReplace, v, v, ", \", All
- js := SubStr(js, 1, z := RegExMatch(js, ":\s*", zx, z) + StrLen(zx) - 1) . vs . v . vs . SubStr(js, z + StrLen(x3) + 1)
- }
- Return, j == "false" ? 0 : j == "true" ? 1 : j == "null" or j == "nul"
- ? "" : SubStr(j, 1, 1) == """" ? SubStr(j, 2, -1) : j
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement