-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfallout3.asl
More file actions
423 lines (355 loc) · 12.1 KB
/
fallout3.asl
File metadata and controls
423 lines (355 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
state("Fallout3","Steam")
{
bool introDone : 0xE3AFCC;
bool loading : 0xE3ABBC;
int quest: 0x00E23230, 0x4;
float speed: 0x00E3C674, 0x60, 0x138, 0x344;
float HorizontalSpeed: 0x00E3C674, 0x60, 0x138, 0x340;
string16 QuestName: 0x00E3C674, 0x614, 0x64,0x0;
int QuestStage: 0x00E3C674, 0x614, 0x60;
int CellRefID : 0x00E3C674, 0x3C, 0xC;
int playerControlFlag: 0x00E3C674, 0x5DC;
}
state("Fallout3","GOG")
{
bool loading : 0xC76CE8;
bool introDone : 0xC771D0;
int quest: 0xC6F2F8 , 0x4;
float speed : 0xC7A104, 0x60, 0x138, 0x344;
float HorizontalSpeed: 0xC7A104, 0x60, 0x138, 0x340;
string16 QuestName: 0xC7A104, 0x614, 0x64,0x0;
int QuestStage: 0xC7A104, 0x614, 0x60;
int CellRefID : 0xC7A104, 0x3C, 0xC;
int playerControlFlag: 0xC7A104, 0x5DC;
}
state("Fallout3","DownPatch")
{
bool loading : 0xC76CE8;
bool introDone : 0xC771D0;
int quest: 0xC6F2F8 , 0x4;
float speed : 0xC7A104, 0x60, 0x138, 0x344;
float HorizontalSpeed: 0xC7A104, 0x60, 0x138, 0x340;
//Not Supported
//int quest: 0x00E23230, 0x4;
//bool introDone : 0xDFF280;
//bool loading : 0xE3ABBC;
}
//copied from nv so sorry for game inconsistencies :)
startup
{
String speedometer;
String questcounter;
//creates text components for quest counter and speedometer
vars.SetTextComponent = (Action<string, string>)((id, text) =>
{
var textSettings = timer.Layout.Components.Where(x => x.GetType().Name == "TextComponent").Select(x => x.GetType().GetProperty("Settings").GetValue(x, null));
var textSetting = textSettings.FirstOrDefault(x => (x.GetType().GetProperty("Text1").GetValue(x, null) as string) == id);
if (textSetting == null)
{
var textComponentAssembly = Assembly.LoadFrom("Components\\LiveSplit.Text.dll");
var textComponent = Activator.CreateInstance(textComponentAssembly.GetType("LiveSplit.UI.Components.TextComponent"), timer);
timer.Layout.LayoutComponents.Add(new LiveSplit.UI.Components.LayoutComponent("LiveSplit.Text.dll", textComponent as LiveSplit.UI.Components.IComponent));
textSetting = textComponent.GetType().GetProperty("Settings", BindingFlags.Instance | BindingFlags.Public).GetValue(textComponent, null);
textSetting.GetType().GetProperty("Text1").SetValue(textSetting, id);
}
if (textSetting != null)
textSetting.GetType().GetProperty("Text2").SetValue(textSetting, text);
});
settings.Add("Quest Counter", false, "Quest Counter");
settings.Add("Speed", false, "Speed");
settings.Add("AutoStart",true,"AutoStart");
settings.Add("Autosplitter", false, "Autosplitter");
settings.Add("Quest&Cell_Splitter",true,"Category Autosplitters","Autosplitter");
settings.Add("Quest_Splitter",false,"Quest Counter Autoplitter","Autosplitter");
settings.Add("Debug",false,"Debug");
//Categories
settings.Add("Any%",true,"Any%","Quest&Cell_Splitter");
settings.Add("Glitchless",false,"Glitchless","Quest&Cell_Splitter");
settings.Add("Custom",false,"Custom","Quest&Cell_Splitter");
settings.SetToolTip("Quest&Cell_Splitter","Splits based on set Quest and cell");
settings.SetToolTip("Quest_Splitter", "Causes timer to split when the quest counter is the same as the quest number in your splits surrounded by () eg: (1) Infinite Dash\n Will not split if anything else surrounds the number ");
settings.SetToolTip("Debug","Shows player info such as cell, questname and stage");
settings.SetToolTip("Custom","Allows custom splits depending on a .txt file located in the same folder as the .asl file. Read the .asl for documentation");
settings.SetToolTip("AutoStart","Automatically start the timer when a run starts. It will not restart the timer mid run :)");
vars.splitCount=0;
//The hex code for cells can be found either using the debug tools or getting the cell ref id from a wiki page :)
vars.any_Quests = new List<String>{"","","","","","","","","","","","","","","","","",""}; //if quest blank allow any quest to be active
vars.any_Cell = new List<String>{"10C1","D3E","20F91","18539","D3C","18520"};
//split: Leave 101, Enter citadel, Enter LL, Enter RR, Ft Citadel, End
//NEED TO UPDATE FOR F3
vars.glitchless_Quests = new List<String>{"","","","","","","","","","","","","","","",""};
vars.glitchless_Cell = new List<String>{"10C1","","","","","","","","","","",""};
//split:
//Normalise Lists so they are same length - Avoid out of range error
if(vars.glitchless_Quests.Count == vars.glitchless_Cell.Count){}
else if(vars.glitchless_Quests.Count > vars.glitchless_Cell.Count)
{
int len = vars.glitchless_Quests.Count - vars.glitchless_Cell.Count;
for(int x=0;x<len;x++)
{
vars.glitchless_Cell.Add("");
}
}
else
{
int len = vars.glitchless_Cell.Count - vars.glitchless_Quests.Count;
for(int x=0;x<len;x++)
{
vars.glitchless_Quests.Add("");
}
}
if(vars.any_Quests.Count == vars.any_Cell.Count){}
else if(vars.any_Quests.Count > vars.any_Cell.Count)
{
int len = vars.any_Quests.Count - vars.any_Cell.Count;
for(int x=0;x<len;x++)
{
vars.any_Cell.Add("");
}
}
else
{
int len = vars.any_Cell.Count - vars.any_Quests.Count;
for(int x=0;x<len;x++)
{
vars.any_Quests.Add("");
}
}
vars.custom_Quests = new List<String>();
vars.custom_Stage = new List<String>();
vars.custom_Cell = new List<String>();
}
init
{
switch (modules.First().ModuleMemorySize) { // This is to know what version you are playing on
case (17952768):
version = "Steam";
break;
case (16166912):
version = "GOG";
break;
case (16171008):
version = "DownPatch";
break;
default:
version = "Steam";
break;
}
//Allow splitting at custom times
/*
Make a text file with values seperated by commas
First Line is the questname, use any for any quest
Second Line is quest stage, use any for any stage
Third Line is Cell ID , use any for any cell
eg:
VMQ01,any,VMQ02
any,any,20
BBEA3,BBEA3,109311
*/
if(settings["Custom"])
{
vars.temp = new List<String>();
var lines = File.ReadAllLines("Components/CustomSplitsF3.txt");
for (var i = 0; i < lines.Length; i++ )
{
var line = lines[i].Split(',').ToList();
// Process line
switch (i)
{
case 0: //Quest Name
foreach(var Quest in line)
{
vars.custom_Quests.Add(Quest.ToUpper());
//print(Quest);
}
break;
case 1: //Quest Stage
foreach(var QuestStage in line)
{
vars.custom_Stage.Add(QuestStage.ToUpper());
//print(QuestStage);
}
break;
case 2:
foreach(var CellID in line)
{
vars.custom_Cell.Add(CellID.ToUpper());
//print(CellID.ToUpper());
}
break;
default:
break;
}
}
//Normalise Lists so they are same length - Avoid out of range error
if(vars.custom_Quests.Count == vars.custom_Cell.Count){}
else if(vars.custom_Quests.Count > vars.custom_Cell.Count)
{
int len = vars.custom_Quests.Count - vars.custom_Cell.Count;
for(int x=0;x<len;x++)
{
vars.custom_Cell.Add("any");
}
}
else
{
int len = vars.custom_Cell.Count - vars.custom_Quests.Count;
for(int x=0;x<len;x++)
{
vars.custom_Quests.Add("any");
}
}
if(vars.custom_Quests.Count == vars.custom_Stage.Count){}
else if(vars.custom_Quests.Count > vars.custom_Stage.Count)
{
int len = vars.custom_Quests.Count - vars.custom_Stage.Count;
for(int x=0;x<len;x++)
{
vars.custom_Stage.Add("any");
}
}
else
{
int len = vars.custom_Stage.Count - vars.custom_Quests.Count;
for(int x=0;x<len;x++)
{
vars.custom_Quests.Add("any");
}
}
}
}
update
{
//print(modules.First().ModuleMemorySize.ToString());
vars.split = false;
vars.isLoading = false;
vars.doStart = false;
string hexCell = "";
if(settings["Debug"] || settings["Autosplitter"] || settings["AutoStart"])
{
hexCell = Convert.ToString(current.CellRefID,16).ToUpper();
}
if ((current.loading) || (!current.introDone)) {
vars.isLoading = true;
}
if (settings["Speed"])
{
if(vars.isLoading == false)
{
if(current.speed > 10000)
{
current.speed = 0;
}
current.speedometer = (Math.Sqrt(Math.Pow(current.speed,2)+Math.Pow(current.HorizontalSpeed,2))).ToString("000.0000");
vars.SetTextComponent("Speed:", (current.speedometer));
}
}
if (settings["Quest Counter"])
{
current.questcounter = current.quest.ToString("0");
vars.SetTextComponent("Quests:", (current.questcounter));
}
if(settings["Debug"])
{
String PaddedCellName = hexCell.PadLeft(8,'0');
String QName = current.QuestName;
int QStage = current.QuestStage;
if(current.QuestName==null)
{
QName = "No Active Quest";
QStage = 0;
}
vars.SetTextComponent("Cell Name:",PaddedCellName);
vars.SetTextComponent("Quest Name:",QName);
vars.SetTextComponent("Quest Stage:",QStage.ToString());
}
if(settings["AutoStart"])
{
timer.IsGameTimePaused = true;
vars.doStart = hexCell=="28138" && old.CellRefID!=current.CellRefID;
}
vars.splitCount= timer.CurrentSplitIndex;
//Splitting
//TODO: Find better way to make settings
if(settings["Autosplitter"] && timer.CurrentPhase != TimerPhase.NotRunning)
{
if(settings["Quest&Cell_Splitter"])
{
if(settings["Any%"])
{
//print(Convert.ToString(current.CellRefID,16).ToUpper());
if(vars.any_Quests[vars.splitCount]=="")
{
//Sequential splitting due to the nature of the run
vars.split = vars.any_Cell[vars.splitCount] == hexCell && current.CellRefID!=old.CellRefID;
//vars.split = vars.any_Cell.Contains(hexCell) && current.CellRefID!=old.CellRefID;
if(hexCell=="18520")
{
vars.split = current.playerControlFlag!=old.playerControlFlag;
}
}
else
{
vars.split = ((vars.any_Cell[vars.splitCount % vars.any_Cell.Count] == hexCell) && (vars.any_Quests[vars.splitCount % vars.any_Cell.Count] == current.QuestName) && (current.CellRefID!=old.CellRefID));
}
}
else if(settings["Glitchless"])
{
if(vars.glitchless_Quests[vars.splitCount % vars.glitchless_Cell.Count]=="")
{
vars.split = vars.glitchless_Cell[vars.splitCount % vars.glitchless_Cell.Count] == hexCell && current.CellRefID!=old.CellRefID;
}
else
{
vars.split = ((vars.glitchless_Cell[vars.splitCount % vars.glitchless_Cell.Count] == hexCell) && (vars.glitchless_Quests[vars.splitCount % vars.glitchless_Cell.Count] == current.QuestName) && (current.CellRefID!=old.CellRefID));
}
}
else if(settings["Custom"])
{
//print(vars.custom_Quests[vars.splitCount % vars.custom_Cell.Count].ToLower());
if(vars.custom_Quests[vars.splitCount % vars.custom_Cell.Count].ToLower()=="any")
{
vars.split = vars.custom_Cell[vars.splitCount % vars.custom_Cell.Count] == hexCell && current.CellRefID!=old.CellRefID;
}
else
{
if(vars.custom_Stage[vars.splitCount % vars.custom_Cell.Count].ToLower()=="any")
{
vars.split = ((vars.custom_Cell[vars.splitCount % vars.custom_Cell.Count] == hexCell) && (vars.custom_Quests[vars.splitCount % vars.custom_Cell.Count] == current.QuestName) && (current.CellRefID!=old.CellRefID));
}
else
{
//print(((vars.custom_Quests[vars.splitCount % vars.custom_Cell.Count] == current.QuestName)).ToString());
//print(vars.custom_Quests[vars.splitCount % vars.custom_Cell.Count]);
//print(current.QuestName);
vars.split = ((vars.custom_Cell[vars.splitCount % vars.custom_Cell.Count] == hexCell) && (vars.custom_Quests[vars.splitCount % vars.custom_Cell.Count] == current.QuestName) && (current.CellRefID!=old.CellRefID) && (current.QuestStage.ToString() == vars.custom_Stage[vars.splitCount % vars.custom_Cell.Count]));
}
}
}
}
//splits when current split contains (x) where x is the current number of completed quests
if(settings["Quest_Splitter"])
{
if(timer.CurrentSplit.Name.ToLower().Contains("("+current.questcounter+")"))
{
vars.split=true;
}
}
}
}
start
{
return vars.doStart;
}
split
{
return vars.split;
}
isLoading
{
return vars.isLoading;
}
exit
{
timer.IsGameTimePaused = true;
}