Created
May 26, 2021 14:58
-
-
Save absindx/765c6497233a77503132c5cfebcc93c2 to your computer and use it in GitHub Desktop.
Bubble Girl Auto split
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------- | |
// Bubble Girl - Auto split | |
// absindx | |
//-------------------------------------------------- | |
// regist pointers | |
state("BUBBLEGIRL"){ | |
// none. | |
} | |
// process attached event | |
init{ | |
// reset stage clear achievements. | |
// [HKEY_CURRENT_USER\Software\StrawberryField\BubbleGirl] | |
// "UnlockLevel_hXXXXXXXXXX"=dword:00000001 | |
Action<string> DebugOutput = (text) => { | |
print("[Bubble Girl Autosplitter] " + text); | |
}; | |
vars.DebugOutput = DebugOutput; | |
vars.RegistreyName = @"Software\StrawberryField\BubbleGirl"; | |
vars.Initialized = false; | |
vars.UnlockLevelKey = ""; | |
vars.UnlockLevel = 1; | |
Microsoft.Win32.RegistryKey registry = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(vars.RegistreyName, true); | |
if(registry == null){ | |
return; | |
} | |
try{ | |
foreach(string key in registry.GetValueNames()){ | |
if(key.IndexOf("UnlockLevel_") >= 0){ | |
vars.DebugOutput("The stage clear achievement has been reset."); | |
registry.SetValue(key, vars.UnlockLevel); | |
vars.Initialized = true; | |
vars.UnlockLevelKey = key; | |
break; | |
} | |
} | |
} | |
finally{ | |
registry.Close(); | |
} | |
} | |
// timer split check event | |
split{ | |
// check stage clear achievements. | |
var unlockedLevel = 1; | |
Microsoft.Win32.RegistryKey registry = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(vars.RegistreyName, false); | |
if(registry == null){ | |
return false; | |
} | |
try{ | |
unlockedLevel = registry.GetValue(vars.UnlockLevelKey, 1); | |
if(unlockedLevel > vars.UnlockLevel){ | |
vars.DebugOutput("Split : Stage clear achievement " + vars.UnlockLevel + " -> " + unlockedLevel); | |
vars.UnlockLevel = unlockedLevel; | |
return true; | |
} | |
else{ | |
return false; | |
} | |
} | |
finally{ | |
registry.Close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment