-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.cmd
400 lines (360 loc) · 12.1 KB
/
events.cmd
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
@TITLE FNaF Events
@ECHO OFF
SET TIMER=1
SET FREDDY=0
SET TIMER_FREDDY=0
SET CHICA=0
SET BONNIE=0
SET FOXY=0
SET TIMER_FOXY=1
SET S_TIMER_FOXY=0
SET A_TIMER_FOXY=31
SET FOXY_ATTACKS=0
SET PLAYED_BG=
SET BATTERY=10000
SET SEND_BATTERY=99
SET OLD_BATTERY=99
SET WIN=0
BREAK>MOVEMENTS.cmd
CALL ".\io.cmd" READ "%APPDATA%\fnaf-terminal\freddy" freddy
:: ::::::::::::: ::
:: AI difficulty ::
SET MO_FREDDY=%1
SET MO_CHICA=%2
SET MO_BONNIE=%3
SET MO_FOXY=%4
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO.freddy[level]=%freddy[level]%
ECHO.DIFFICULTY: %MO_FREDDY%/%MO_CHICA%/%MO_BONNIE%/%MO_FOXY%
ECHO.MO: %FREDDY% FREDDY
ECHO.MO: %CHICA% CHICA
ECHO.MO: %BONNIE% BONNIE
ECHO.MO: %FOXY% FOXY
:TIMER
:: :::::::::::: ::
:: Share States ::
SET STATES=
SET /P STATES=<office_states
IF EXIST cams_state (
SET /P CAMS_STATES=<cams_state
) ELSE SET CAMS_STATES=_
:: ::::::: ::
:: Battery ::
SET DRAIN=5
(ECHO.!STATES! | findstr /C:"_doorL") >NUL && SET /A DRAIN+=15
(ECHO.!STATES! | findstr /C:"_doorR") >NUL && SET /A DRAIN+=15
(ECHO.!STATES! | findstr /C:"_lightL") >NUL && SET /A DRAIN+=15
(ECHO.!STATES! | findstr /C:"_lightR") >NUL && SET /A DRAIN+=15
(ECHO.!STATES! | findstr /C:"_bonnie") >NUL && SET /A DRAIN+=15
(ECHO.!STATES! | findstr /C:"_chica") >NUL && SET /A DRAIN+=15
IF EXIST cams_state SET /A DRAIN+=13
SET /A BATTERY-=DRAIN
SET /A SEND_BATTERY=BATTERY/100
IF NOT !OLD_BATTERY! EQU !SEND_BATTERY! (
ECHO.!SEND_BATTERY!>BATTERY
BREAK>refresh
)
SET OLD_BATTERY=!SEND_BATTERY!
:: ::::: ::
:: Title ::
TITLE FNaF Events - Time: !TIMER! Power: !SEND_BATTERY! ^(Real: %BATTERY% - Drain: %DRAIN%^)
:: :::::::::::::::::::::::::::::: ::
:: Increase MO based on the timer ::
IF %freddy[level]% GEQ 2 IF NOT !MO_BONNIE! GTR 19 IF !TIMER! EQU 25 SET /A MO_BONNIE+=1&ECHO.DIFFICULTY: !MO_BONNIE! BONNIE &:: 0.5 minutes in
IF %freddy[level]% GEQ 2 IF NOT !MO_CHICA! GTR 19 IF !TIMER! EQU 60 SET /A MO_CHICA+=1&ECHO.DIFFICULTY: !MO_CHICA! CHICA&:: 1.0 minutes in
IF %freddy[level]% GEQ 1 IF NOT !MO_BONNIE! GTR 19 IF !TIMER! EQU 150 SET /A MO_BONNIE+=1&ECHO.DIFFICULTY: !MO_BONNIE! BONNIE &:: 2.5 minutes in
IF %freddy[level]% GEQ 4 IF NOT !MO_FREDDY! GTR 19 IF !TIMER! EQU 240 SET /A MO_FREDDY+=1&ECHO.DIFFICULTY: !MO_FREDDY! FREDDY&:: 4 minutes in
IF %freddy[level]% GEQ 2 IF NOT !MO_CHICA! GTR 19 IF !TIMER! EQU 300 SET /A MO_CHICA+=1&ECHO.DIFFICULTY: !MO_CHICA! CHICA&:: 5 minutes in
IF %freddy[level]% GEQ 3 IF NOT !MO_FOXY! GTR 19 IF !TIMER! EQU 300 SET /A MO_FOXY+=1&ECHO.DIFFICULTY: !MO_FOXY! FOXY&:: 5 minutes in
IF %freddy[level]% GEQ 5 IF NOT !MO_FREDDY! GTR 19 IF !TIMER! EQU 330 SET /A MO_FREDDY+=1&ECHO.DIFFICULTY: !MO_FREDDY! FREDDY &:: 5.5 minutes in
IF %freddy[level]% GEQ 4 IF NOT !MO_FOXY! GTR 19 IF !TIMER! EQU 360 SET /A MO_FOXY+=1&ECHO.DIFFICULTY: !MO_FOXY! FOXY&:: 6 minutes in
IF %freddy[level]% GEQ 1 IF NOT !MO_CHICA! GTR 19 IF !TIMER! EQU 420 SET /A MO_CHICA+=1&ECHO.DIFFICULTY: !MO_CHICA! CHICA&:: 7 minutes in
IF %freddy[level]% GEQ 3 IF NOT !MO_BONNIE! GTR 19 IF !TIMER! EQU 450 SET /A MO_BONNIE+=1&ECHO.DIFFICULTY: !MO_BONNIE! BONNIE &:: 7.5 minutes in
IF %freddy[level]% GEQ 4 IF NOT !MO_FREDDY! GTR 19 IF !TIMER! EQU 480 SET /A MO_FREDDY+=1&ECHO.DIFFICULTY: !MO_FREDDY! FREDDY &:: 8 minutes in
:: ::::::::::::::::::::: ::
:: Movement Calculations :: [Bonnie & Chica]
SET /A S_CALC=TIMER %% 4
IF !S_CALC! EQU 0 (
SET /A "RND_CHICA=%RANDOM% %% 19 + 1"
IF !RND_CHICA! LEQ !MO_CHICA! (
IF !CHICA! LEQ 1 (
SET /A CHICA+=1
) ELSE IF !CHICA! GEQ 5 (
SET /A CHICA+=1
) ELSE (
START /B "" CMD /C CALL ".\audiomanager.cmd" START deepsteps.mp3 sfx False 22 ^& EXIT >NUL 2>&1
SET /A "RND_CHICA=%RANDOM% %% 5 + 1"
IF !RND_CHICA! LEQ 3 (
SET /A CHICA+=1
) ELSE (
SET /A CHICA-=1
)
)
IF !CHICA! GTR 6 (ECHO.!STATES! | findstr /C:"doorR") >NUL && SET CHICA=1
ECHO.MO: !CHICA! CHICA
BREAK>refresh
)
SET /A "RND_BONNIE=%RANDOM% %% 19 + 1"
IF !RND_BONNIE! LEQ !MO_BONNIE! (
IF !BONNIE! EQU 1 (
SET /A BONNIE=%RANDOM% %% 4 + 1
IF !BONNIE! EQU 1 SET /A BONNIE+=2
START /B "" CMD /C CALL ".\audiomanager.cmd" START deepsteps.mp3 sfx False 22 ^& EXIT >NUL 2>&1
) ELSE IF !BONNIE! EQU 2 (
SET /A BONNIE=%RANDOM% %% 4 + 1
IF !BONNIE! EQU 2 SET /A BONNIE+=2
START /B "" CMD /C CALL ".\audiomanager.cmd" START deepsteps.mp3 sfx False 22 ^& EXIT >NUL 2>&1
) ELSE IF !BONNIE! EQU 3 (
SET /A BONNIE=%RANDOM% %% 5 + 1
IF !BONNIE! EQU 3 SET /A BONNIE+=2
START /B "" CMD /C CALL ".\audiomanager.cmd" START deepsteps.mp3 sfx False 22 ^& EXIT >NUL 2>&1
) ELSE IF !BONNIE! EQU 4 (
SET /A BONNIE=%RANDOM% %% 5 + 1
IF !BONNIE! EQU 4 SET /A BONNIE+=1
START /B "" CMD /C CALL ".\audiomanager.cmd" START deepsteps.mp3 sfx False 22 ^& EXIT >NUL 2>&1
) ELSE (
SET /A BONNIE+=1
)
IF !BONNIE! GTR 6 (ECHO.!STATES! | findstr /C:"doorL") >NUL && SET /A BONNIE=%RANDOM% %% 3 + 1
ECHO.MO: !BONNIE! BONNIE
BREAK>refresh
)
)
:: :::: ::
:: Foxy ::
IF !FOXY! GEQ 5 (ECHO.!STATES! | findstr /C:"doorL") >NUL && (
START /B "" CMD /C CALL ".\audiomanager.cmd" START knock2.mp3 sfx False 95 ^& EXIT >NUL 2>&1
SET FOXY=0
SET S_TIMER_FOXY=31
DEL /Q ".\SEEN_FOXY"
BREAK>refresh
) || (
SET /A FOXY+=1
BREAK>refresh
)
IF EXIST cams_state SET TIMER_FOXY=0
IF EXIST saw_cams (
SET TIMER_FOXY=0
DEL /Q ".\saw_cams"
)
IF !TIMER_FOXY! GEQ 5 (SET /A F_CALC=TIMER_FOXY %% 5) ELSE SET F_CALC=1
SET /A "RND_FOXY=%RANDOM% %% 19 + 1"
IF !F_CALC! EQU 0 IF !RND_FOXY! LEQ !MO_FOXY! IF !FOXY! LSS 3 (
IF NOT EXIST cams_state (
SET /A FOXY+=1
BREAK>refresh
ECHO.MO: !FOXY! FOXY
)
)
IF EXIST SEEN_FOXY (
IF !FOXY! GEQ 3 (
IF !A_TIMER_FOXY! NEQ 31 SET A_TIMER_FOXY=31
IF !S_TIMER_FOXY! EQU 0 (
START /B "" CMD /C CALL ".\audiomanager.cmd" START run.mp3 sfx False 100 ^& EXIT >NUL 2>&1
)
IF !S_TIMER_FOXY! EQU 1 (
SET S_TIMER_FOXY=5
SET /A FOXY+=1
BREAK>refresh
ECHO.MO: !FOXY! FOXY
) ELSE IF !S_TIMER_FOXY! EQU 5 (
(ECHO.!STATES! | findstr /C:"doorL") >NUL && (
START /B "" CMD /C CALL ".\audiomanager.cmd" START knock2.mp3 sfx False 95 ^& EXIT >NUL 2>&1
SET FOXY=0
SET S_TIMER_FOXY=0
SET /A FOXY_ATTACKS+=1
SET /A "FOXY_DRAIN=(FOXY_ATTACKS*2)*100"
SET /A BATTERY-=FOXY_DRAIN
ECHO.FOXY DRAINED: !FOXY_DRAIN!
DEL /Q ".\SEEN_FOXY"
) || (
SET /A FOXY+=1
DEL /Q ".\SEEN_FOXY"
)
BREAK>refresh
ECHO.MO: !FOXY! FOXY
) ELSE (
IF !S_TIMER_FOXY! LSS 3 (
SET /A S_TIMER_FOXY+=1
)
IF !S_TIMER_FOXY! GTR 3 (
SET /A S_TIMER_FOXY-=1
)
)
) ELSE DEL /Q ".\SEEN_FOXY"
) ELSE IF !FOXY! GEQ 3 (
IF !A_TIMER_FOXY! EQU 29 (
SET /A A_TIMER_FOXY+=1
IF !FOXY! EQU 3 (
START /B "" CMD /C CALL ".\audiomanager.cmd" START run.mp3 sfx False 100 ^& EXIT >NUL 2>&1
SET /A FOXY+=1
ECHO.MO: !FOXY! FOXY
BREAK>refresh
)
) ELSE IF !A_TIMER_FOXY! EQU 31 (
SET /A A_TIMER_FOXY+=1
IF !FOXY! EQU 4 (
(ECHO.!STATES! | findstr /C:"doorL") >NUL && (
START /B "" CMD /C CALL ".\audiomanager.cmd" START knock2.mp3 sfx False 95 ^& EXIT >NUL 2>&1
SET FOXY=0
SET A_TIMER_FOXY=0
SET /A FOXY_ATTACKS+=1
SET /A "FOXY_DRAIN=(FOXY_ATTACKS*2)*100"
SET /A BATTERY-=FOXY_DRAIN
ECHO.FOXY DRAINED: !FOXY_DRAIN!
DEL /Q ".\SEEN_FOXY"
) || (
SET /A FOXY+=1
DEL /Q ".\SEEN_FOXY"
)
ECHO.MO: !FOXY! FOXY
BREAK>refresh
)
) ELSE IF !A_TIMER_FOXY! GTR 31 (
SET A_TIMER_FOXY=0
) ELSE SET /A A_TIMER_FOXY+=1
)
:: :::::: ::
:: Freddy ::
SET /A "RND_FREDDY=%RANDOM% %% 19 + 1"
SET /A F_CALC=TIMER %% 5
IF !FREDDY! GTR 0 (
IF !FREDDY! LEQ 3 (
IF !TIMER_FREDDY! GTR 1 (
IF NOT EXIST saw_freddy (
SET /A TIMER_FREDDY-=1*MO_FREDDY
IF !FREDDY! EQU 1 IF !CAMS_STATES!==_2 SET /A TIMER_FREDDY+=1*MO_FREDDY
IF !FREDDY! EQU 2 IF !CAMS_STATES!==_4 SET /A TIMER_FREDDY+=1*MO_FREDDY
IF !FREDDY! EQU 3 IF !CAMS_STATES!==_10 SET /A TIMER_FREDDY+=1*MO_FREDDY
IF !TIMER_FREDDY! LSS 1 SET TIMER_FREDDY=1
) ELSE DEL /Q ".\saw_freddy"
)
IF !TIMER_FREDDY! EQU 1 (
SET /A RND=!RANDOM! %% 3 + 1
START /B "" CMD /C CALL ".\audiomanager.cmd" START running_fast3.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 1 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_1d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 2 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_2d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 3 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_8d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
SET /A FREDDY+=1,TIMER_FREDDY=0
BREAK>refresh
ECHO.MO: !FREDDY! FREDDY
)
IF !F_CALC! EQU 0 IF !RND_FREDDY! LEQ !MO_FREDDY! IF !TIMER_FREDDY! EQU 0 (
SET TIMER_FREDDY=10
)
) ELSE IF !FREDDY! EQU 4 (
IF !F_CALC! EQU 0 IF !RND_FREDDY! LEQ !MO_FREDDY! IF NOT EXIST saw_freddy (
IF NOT !CAMS_STATES!==_11 (ECHO.!STATES! | findstr /C:"doorR") >NUL && (
SET /A RND=!RANDOM! %% 3 + 1
START /B "" CMD /C CALL ".\audiomanager.cmd" START running_fast3.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 1 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_1d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 2 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_2d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 3 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_8d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
SET /A FREDDY-=!RND!
BREAK>refresh
ECHO.MO: !FREDDY! FREDDY
) || (
SET /A FREDDY+=1
BREAK>refresh
)
) ELSE DEL /Q ".\saw_freddy"
) ELSE SET /A FREDDY-=1
) ELSE (
IF !F_CALC! EQU 0 IF !RND_FREDDY! LEQ !MO_FREDDY! IF !TIMER_FREDDY! EQU 0 IF !BONNIE! GTR 0 IF !CHICA! GTR 0 (
SET /A RND=!RANDOM! %% 3 + 1
START /B "" CMD /C CALL ".\audiomanager.cmd" START running_fast3.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 1 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_1d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 2 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_2d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
IF !RND! EQU 3 START /B "" CMD /C CALL ".\audiomanager.cmd" START Laugh_Giggle_Girl_8d.mp3 sfx False 40 ^& EXIT >NUL 2>&1
SET /A FREDDY+=1
ECHO.MO: !FREDDY! FREDDY
BREAK>refresh
)
)
:: :::::::::::::::: ::
:: Movement Signals ::
IF EXIST .\refresh (
ECHO SET FREDDY=!FREDDY!
ECHO SET BONNIE=!BONNIE!
ECHO SET CHICA=!CHICA!
ECHO SET FOXY=!FOXY!
)>.\MOVEMENTS.cmd
IF %TIMER% EQU 89 (
ECHO.1>TIME
ECHO.Time: 1 AM
BREAK>refresh
) ELSE IF %TIMER% EQU 178 (
ECHO.2>TIME
ECHO.Time: 2 AM
BREAK>refresh
) ELSE IF %TIMER% EQU 267 (
ECHO.3>TIME
ECHO.Time: 3 AM
BREAK>refresh
) ELSE IF %TIMER% EQU 356 (
ECHO.4>TIME
ECHO.Time: 4 AM
BREAK>refresh
) ELSE IF %TIMER% EQU 445 (
ECHO.5>TIME
ECHO.Time: 5 AM
BREAK>refresh
)
:: Send a "refesh animatronic movements" signal to the main game, only if needed (forced)
:FORCE_REFRESH
IF !SEND_BATTERY! LEQ 0 (
TASKKILL /IM xcopy.exe /F >NUL 2>&1 && (
ECHO. [Q] Events safely stopped.
GOTO :AfterOutage
) || (
ECHO.[-] Attempting to update the main process...
GOTO :FORCE_REFRESH
)
)
IF EXIST .\refresh (
TASKKILL /IM xcopy.exe /F >NUL 2>&1 && (
DEL /Q .\refresh
ECHO.[+] Sent update to the main process^^^!
) || (
ECHO.[-] Attempting to update the main process...
GOTO :FORCE_REFRESH
)
)
:: If survived 534 seconds, send a "win" signal to the main game (forced)
:FORCE_REFRESH_
IF !BATTERY! LEQ -1 EXIT
IF !TIMER! GEQ 534 (
IF !WIN! EQU 0 BREAK>WIN
SET WIN=1
TASKKILL /IM xcopy.exe /F || GOTO :FORCE_REFRESH_
ENDLOCAL
EXIT 0
)
:: ::::::::::::: ::
:: Random Sounds ::
SET /A RND_SFX=%RANDOM% %% 770 +1
IF !RND_SFX! EQU 1 START /B "" CMD /C CALL ".\audiomanager.cmd" START circus.mp3 sfx False 10 ^& EXIT >NUL 2>&1
SET /A RND_SFX=%RANDOM% %% 770 +1
IF !RND_SFX! EQU 1 START /B "" CMD /C CALL ".\audiomanager.cmd" START pirate_song2.mp3 sfx False 14 ^& EXIT >NUL 2>&1
SET /A RND_SFX=%RANDOM% %% 550 +1
IF !RND_SFX! EQU 1 IF NOT DEFINED PLAYED_BG (
SET PLAYED_BG=1
START /B "" CMD /C CALL ".\audiomanager.cmd" START EerieAmbienceLargeSca_MV005.mp3 sfx False 75 ^& EXIT >NUL 2>&1
)
:: :::::: ::
:: Timers ::
SET /A TIMER+=1
SET /A TIMER_FOXY+=1
TIMEOUT /T 1 /NOBREAK >NUL
:: Repeat
GOTO :TIMER
:AfterOutage
TIMEOUT /T 1 /NOBREAK >NUL
IF !TIMER! GEQ 534 (
BREAK>WIN
EXIT 0
)
ECHO.After Outage Timer: !TIMER!
:: Timers
SET /A TIMER+=1
GOTO :AfterOutage