@echo off

del tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
del tb#tweaks\biff\debug\weidu  2> tb#tweaks\biff\debug\nul
rem remove unextracted oggs, mp3 and tiz

echo cleaning up after lazy mods...
cd override
del /f /q *.ogg 2> ..\tb#tweaks\biff\debug\nul
del /f /q *.mp3 2> ..\tb#tweaks\biff\debug\nul
del /f /q *.tiz 2> ..\tb#tweaks\biff\debug\nul
cd ..


rem create temporary directories

echo creating folders...
rem these mods are more wav-heavy
	rem ding0's miscelaney
mkdir tb#wd0
	rem keley TOB
mkdir tb#wkl25
	rem kelsey SOA
mkdir tb#wkel
	rem keto soa
mkdir tb#wket
	rem PPG's miscelaney
mkdir tb#wfw
	rem Kindrek
mkdir tb#wkin
	rem Saerileth
mkdir tb#wsae
	rem Tsujatha
mkdir tb#wtsu
	rem Yasraena, why the hell team Sillara's names are so difficult to type?  :)
mkdir tb#wyas
rem wav files in the a...z range
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 _ #) do mkdir tb#w%%a


rem directories are created, now move the files inside

echo moving files...
move override\d0*.wav		tb#wd0   >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\fwklsy*.wav	tb#wkel  >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\fwkl25*.wav	tb#wkl25 >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\fwketo*.wav	tb#wket  >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\fw*.wav		tb#wfw   >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\kindr*.wav	tb#wkin  >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\saeri*.wav	tb#wsae  >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\tsuja*.wav	tb#wtsu  >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
move override\yasra*.wav	tb#wyas  >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 _ #) do if 1==1 move override\%%a*.wav tb#w%%a >> tb#tweaks\biff\debug\moving 2> tb#tweaks\biff\debug\nul


rem create weidu.exe if missing

echo creating weidu.exe ...
if exist weidu.exe goto haveweidu
if not exist setup-tb#tweaks.exe goto haveweidu
copy setup-tb#tweaks.exe weidu.exe


rem unless the user is more mad than me, he has weidu. Time to biff!

: haveweidu

echo I'm  biffing the files, go have a coffee. The needed applications are iconified to avoid clustering your screen.

copy chitin.key tb#tweaks\backup\backup_chitin.key
for /d %%a in (tb#w*) do if 1==1 ( echo working on %%a...
start /w /min tb#tweaks\biff\installdir.bat %%a )

rem delete temp directories and free disk space
REM echo deleting temp directories...
REM for /d %%a in (tb#w*) do del /f /q %%a\*.*
REM for /d %%a in (tb#w*) do rmdir %%a

echo install finished!
