SETLOCAL
cd /d %DPATH%

Call %EINST% crefixer "0"

findstr /I /M "ITEM_PACK.TP2~.*#.*#0./" %ELOG%>nul
if not errorlevel 1 call ".\%BWIPFIX%\sr_wastaff.bat
Call %EINST% tooltipfix "0"

if %PREVIEW%==0 (
	%IFS%LongerRoad.exe %IF% ".\override\ahjon.BCS" move ".\override\ahjon.BCS" ".\BWP_workspace\override" | %M%
)
%IFNS%BPSeries.exe Call %EINST% Innate_Fix "0"
if %PREVIEW%==0 (
	%IFS%LongerRoad.exe %IF% ".\BWP_workspace\override\ahjon.BCS" move ".\BWP_workspace\override\ahjon.BCS" ".\override" | %M%
)

Call %EINST% Area_Patcher "0 2001 2002"
findstr /I /M "BG1NPC.TP2~.*#.*#15./" %ELOG%>nul
if %errorlevel%==0 Call %EINST% Area_Patcher "5000 5001"

Call %EINST% Cre_Patcher "0"
findstr /I /M "SOS.TP2~.*#.*#0./" %ELOG%>nul
if %errorlevel%==0 Call %EINST% Cre_Patcher "100"

Call ".\%BWIPI%\Item_Patcher.bat"

if %PREVIEW%==0 (
	%IF% lolfixer_ONLY_DEBUG_MODE.bat (
		%IF% StopLBar del StopLBar
		start "pulse bar" "%BWIPS%\pulse_bar.bat"
		rem Without a title the directory will be misinterpreted when it is enclosed in quotation marks.
		rem call lolfixer_ONLY_DEBUG_MODE.bat
		type NUL> StopLBar
	)
)
if %PREVIEW%==0 (
	%IF% ".\override\ESX01.wav" move ".\override\ESX01.wav" ".\BWP_workspace\override" | %M%
	%IF% ".\override\ISHXAR1.wav" move ".\override\ISHXAR1.wav" ".\BWP_workspace\override" | %M%
	%IF% ".\override\ISHXAR6.wav" move ".\override\ISHXAR6.wav" ".\BWP_workspace\override" | %M%
	%IF% ".\override\ISHXAR7.wav" move ".\override\ISHXAR7.wav" ".\BWP_workspace\override" | %M%
	%IF% ".\override\ISHXAR8.wav" move ".\override\ISHXAR8.wav" ".\BWP_workspace\override" | %M%
	%IF% ".\override\ISHXAR9.wav" move ".\override\ISHXAR9.wav" ".\BWP_workspace\override" | %M%
	%IF% ".\override\DGMAIN.wav" move ".\override\DGMAIN.wav" ".\BWP_workspace\override" | %M%
	%IF% ".\override\F_6666.ARE" move ".\override\F_6666.ARE" ".\BWP_workspace\override" | %M%
)
Call %EINSTI% lolfixer "0"
if %PREVIEW%==0 (
	%IF% ".\BWP_workspace\override\ESX01.wav" move ".\BWP_workspace\override\ESX01.wav" ".\override" | %M%
	%IF% ".\BWP_workspace\override\ISHXAR1.wav" move ".\BWP_workspace\override\ISHXAR1.wav" ".\override" | %M%
	%IF% ".\BWP_workspace\override\ISHXAR6.wav" move ".\BWP_workspace\override\ISHXAR6.wav" ".\override" | %M%
	%IF% ".\BWP_workspace\override\ISHXAR7.wav" move ".\BWP_workspace\override\ISHXAR7.wav" ".\override" | %M%
	%IF% ".\BWP_workspace\override\ISHXAR8.wav" move ".\BWP_workspace\override\ISHXAR8.wav" ".\override" | %M%
	%IF% ".\BWP_workspace\override\ISHXAR9.wav" move ".\BWP_workspace\override\ISHXAR9.wav" ".\override" | %M%
	%IF% ".\BWP_workspace\override\DGMAIN.wav" move ".\BWP_workspace\override\DGMAIN.wav" ".\override" | %M%
	%IF% ".\BWP_workspace\override\F_6666.ARE" move ".\BWP_workspace\override\F_6666.ARE" ".\override" | %M%
)
Call %EINSTI% lolfixer "1 2 3 4 5 6"
if %PREVIEW%==0 (
	%IF% ".\override\RJDTEARS.ITM" move ".\override\RJDTEARS.ITM" ".\BWP_workspace\override" | %M%
)
Call %EINSTI% lolfixer "7"
if %PREVIEW%==0 (
	%IF% ".\BWP_workspace\override\RJDTEARS.ITM" move ".\BWP_workspace\override\RJDTEARS.ITM" ".\override" | %M%
)
Call %EINSTI% lolfixer "8 9 10 11 12 13 14 15"

findstr /I /M "SANDRAHNPC.TP2~.*#.*#0./" %ELOG%>nul
if %errorlevel%==0 Call %EINST% SandrahItem "0"
