Last active
September 24, 2024 17:09
-
-
Save wRadion/6a015c7373e54c6dcd48f978a3ab6378 to your computer and use it in GitHub Desktop.
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
/* | |
* Chained Together - Autosplitter | |
* version: 2.3 | |
* game version: 1.8.6 | |
* authors: wRadion & xiaoxiao921 | |
*/ | |
state("ChainedTogether-Win64-Shipping") | |
{ | |
double coordX : 0x06FC4F48, 0x1B8, 0x38, 0x0, 0x30, 0x2D8, 0x1A0, 0x128; | |
double coordY : 0x06FC4F48, 0x1B8, 0x38, 0x0, 0x30, 0x2D8, 0x1A0, 0x130; | |
double coordZ : 0x06FC4F48, 0x1B8, 0x38, 0x0, 0x30, 0x2D8, 0x1A0, 0x138; | |
int timer : 0x06FC4F48, 0x180, 0x8, 0x320; | |
} | |
startup | |
{ | |
List<string> defaultSplits = new List<string>() { | |
"Underworld (73m)", | |
"Hell Cliffs (196m)", | |
"The Car Race (313m)", | |
"The Whispering Vault (446m)", | |
"The Subway Station (634m)", | |
"The City (1115m)", | |
"Over The Buildings (1370m)", | |
"The Warehouse (1532m)", | |
"The Harbor (1647m)", | |
"The Temple (2105m)", | |
"The Asian Shrine (2414m)", | |
"The Deities (2757m)", | |
"The Garden (3282m)", | |
"The Sun (3658m)" | |
}; | |
vars.splitsCoords = new Dictionary<string, double[]> { | |
{ "Underworld (73m)", new double[] {48169.70, -6670.38, 10415.32, 1600} }, | |
{ "- First Ladder", new double[] {57607, 57647, -4686, -4602} }, | |
{ "Hell Cliffs (196m)", new double[] {58518.04, -5896.68, 22762.73, 600} }, | |
{ "- Hell Cliffs Drone (258m)", new double[] {63361.97, -7714.82, 28700, 150} }, | |
{ "The Car Race (313m)", new double[] {60736, -5806, 34473, 2000} }, | |
{ "- Rotating Cube (372m)", new double[] {57840.65, -4092.85, 40061.93, 550} }, | |
{ "The Whispering Vault (446m)", new double[] {47380} }, | |
{ "- Open The Door (515m)", new double[] {70099.82, -12091.44, 54309.28, 1000} }, | |
{ "The Aqua Maze (582m)", new double[] {56175, -9616, 61161, 1900} }, | |
{ "The Subway Station (634m)", new double[] {61164.22, -16430.15, 66112.40, 875} }, | |
{ "- Station Drone (688m)", new double[] {43285.67, -19387.02, 71659.89, 85} }, | |
{ "- Red Elevator to City (830m)", new double[] {55934.05, -7474.58, 85888.98, 360} }, | |
{ "The City (1115m)", new double[] {114310} }, | |
{ "- City Crane (1167m)", new double[] {64600, -5950, 119450, 2340} }, | |
{ "- Double Crane Platforms (1228m)", new double[] {54500, -9000, 125818, 2100} }, | |
{ "- Elevator to Buildings (1305m)", new double[] {59656, -7845, 133400, 1050} }, | |
{ "Over The Buildings (1370m)", new double[] {139850} }, | |
{ "- Buildings Helicopter (1462m)", new double[] {61241, -7060, 149050, 150} }, | |
{ "The Warehouse (1532m)", new double[] {155996} }, | |
{ "The Harbor (1647m)", new double[] {58833.19, -10168.21, 167476.00, 4100} }, | |
{ "- Blue Railing Chariot (1726m)", new double[] {55267, -9424, 175450, 2200} }, | |
{ "- Elevator to stairs (1773m)", new double[] {60015, -5540, 180200, 1550} }, | |
{ "- Helicopter to Temple (2008m)", new double[] {63676.359, -12937.55, 203690, 150} }, | |
{ "The Temple (2105m)", new double[] {209230} }, | |
{ "- Elevator to Asian Shrine (2301m)", new double[] {60844, -13114, 233000, 1800} }, | |
{ "The Asian Shrine (2414m)", new double[] {244140} }, | |
{ "- Wooden Horse Wagon (2678m)", new double[] {57636, -9231, 270700, 1300} }, | |
{ "The Deities (2757m)", new double[] {40703.73, -1902.68, 278480.62, 2270} }, | |
{ "- Wooden Boat (2819m)", new double[] {52432, -1512, 284710, 1600} }, | |
{ "- Zeus Lightning (2989m)", new double[] {81930, -23160, 301710, 610} }, | |
{ "- Air Balloon Pump (3044m)", new double[] {45515, -11171, 307250, 100} }, | |
{ "The Garden (3282m)", new double[] {47610.46, -11083.54, 334514.26, 4200} }, | |
{ "The Final Trials (3352m)", new double[] {56907, -32509, 337997, 940} }, | |
{ "- Kiosk (3485m)", new double[] {56351, -23282, 351400, 650} }, | |
{ "- Carriage (3547m)", new double[] {60435, -27560, 357470, 450} }, | |
{ "The Sun (3658m)", new double[] {89000, -4500, 373000, 8500} }, | |
}; | |
int i = 0; | |
foreach (KeyValuePair<string, double[]> pos in vars.splitsCoords) | |
{ | |
if (pos.Key != "The Sun (3658m)") | |
settings.Add((i++).ToString(), defaultSplits.Contains(pos.Key), pos.Key); | |
} | |
Func<double, double, double, double, double, double, double> GetDistance = (x1, y1, z1, x2, y2, z2) => { | |
double dx = x2 - x1; | |
double dy = y2 - y1; | |
double dz = z2 - z1; | |
return Math.Sqrt(dx * dx + dy * dy + dz * dz); | |
}; | |
vars.GetDistance = GetDistance; | |
vars.currSplit = 0; | |
vars.currSplitName = ""; | |
Action DoNothing = () => {}; | |
vars.NextSplit = DoNothing; | |
vars.PrevSplit = DoNothing; | |
vars.ResetSplit = DoNothing; | |
} | |
start | |
{ | |
if (current.timer == 1 && old.timer == 0) | |
{ | |
timer.StartTime = TimeStamp.Now - (TimeSpan.FromSeconds(-1)); | |
return true; | |
} | |
} | |
gameTime | |
{ | |
return TimeSpan.FromSeconds(current.timer); | |
} | |
reset | |
{ | |
return current.timer == 0 && (vars.GetDistance(current.coordX, current.coordY, current.coordZ, 66649.54, -7418.37, 3118.52) <= 1 || (current.coordX == 0 && current.coordY == 0 && current.coordZ == 0)); | |
} | |
split | |
{ | |
if (vars.currSplitName == "") | |
return false; | |
var seg = vars.currSplitName; | |
// print(seg); | |
double[] coords = vars.splitsCoords[vars.currSplitName]; | |
if (coords.Length == 0) | |
return current.coordX == 0 && current.coordY == 0 && current.coordZ == 0; | |
if (coords.Length == 1) | |
return current.coordZ >= coords[0]; | |
else | |
{ | |
double dist = vars.GetDistance(current.coordX, current.coordY, current.coordZ, coords[0], coords[1], coords[2]); | |
double radius = coords[3]; | |
if (seg == "The Harbor (1647m)") | |
return dist <= radius && current.coordZ >= coords[2]; | |
else if (seg == "- First Ladder") { | |
return coords[0] <= current.coordX && current.coordX <= coords[1] && coords[2] <= current.coordY && current.coordY <= coords[3]; | |
} else | |
return dist <= radius; | |
} | |
} | |
onStart | |
{ | |
Action NextSplit = () => { | |
int j = 0; | |
foreach (KeyValuePair<string, double[]> pos in vars.splitsCoords) | |
{ | |
if ((j <= vars.currSplit || !settings[j.ToString()]) && pos.Key != "The Sun (3658m)") | |
{ | |
++j; | |
continue; | |
} | |
vars.currSplit = j; | |
vars.currSplitName = pos.Key; | |
break; | |
} | |
}; | |
vars.NextSplit = NextSplit; | |
Action ResetSplit = () => { | |
int j = 0; | |
foreach (KeyValuePair<string, double[]> pos in vars.splitsCoords) | |
{ | |
if (!settings[(j++).ToString()] && pos.Key != "The Sun (3658m)") continue; | |
vars.currSplit = j; | |
vars.currSplitName = pos.Key; | |
break; | |
} | |
}; | |
vars.ResetSplit = ResetSplit; | |
Action PrevSplit = () => { | |
int lastIndex = 0; | |
string lastName = null; | |
int j = 0; | |
foreach (KeyValuePair<string, double[]> pos in vars.splitsCoords) | |
{ | |
if (!settings[j.ToString()] && pos.Key != "The Sun (3658m)") | |
{ | |
++j; | |
continue; | |
} | |
if (j == vars.currSplit) | |
{ | |
if (lastName == null) | |
vars.ResetSplit(); | |
else | |
{ | |
vars.currSplit = lastIndex; | |
vars.currSplitName = lastName; | |
} | |
break; | |
} | |
lastIndex = j++; | |
lastName = pos.Key; | |
} | |
}; | |
vars.PrevSplit = PrevSplit; | |
timer.OnUndoSplit += (s, e) => vars.PrevSplit(); | |
timer.OnSkipSplit += (s, e) => vars.NextSplit(); | |
vars.ResetSplit(); | |
} | |
onSplit | |
{ | |
vars.NextSplit(); | |
} | |
onReset | |
{ | |
vars.ResetSplit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment