##############################
#this is the part you'll want to modify however you want
#you'll have to modify them, since I only have the elvm you specified
galka_hex = "ffff5c00"
elvm_hex = "ffff5900"
elvf_hex = "ffff2b00"
humeM_hex = "ffff0f00"
humeF_hex = "ffff5C00"
mithra_hex = "ffff5800"
taru_hex = "ffff3e00"
##############################
def openFile (input)
file = File.open(input, 'rb')
#read input file
text = file.read
return text.unpack('H*').first
#unpack into a hexdump, returns an array of size 1
end
def writeFile (name, input)
file = File.open(name, 'w')
#open a new file w/ specified name
input = input.to_a
file.puts input.pack('H*')
#repack the array back
end
puts "Usage: ruby mooshy.rb inputdat.dat" if ARGV.size != 1
galka = ARGV[0] #input file name
dat = openFile(galka) #read hex content
original_name = galka.gsub(".dat","") #get rid of the .dat in the file name
elvM = dat.gsub(galka_hex, elvm_hex) #sub data and assign it to elv
writeFile(original_name + "_elvM.dat", elvM) #write it to originalname_elvM.dat
elvF = dat.gsub(galka_hex, elvf_hex)
writeFile(original_name + "_elvF.dat", elvF)
mithra = dat.gsub(galka_hex, mithra_hex)
writeFile(original_name + "_mithra.dat", mithra)
humeM = dat.gsub(galka_hex, humeM_hex)
writeFile(original_name + "_humeM.dat", humeM)
humeF = dat.gsub(galka_hex, humeF_hex)
writeFile(original_name + "_humeF.dat", humeF)
taru = dat.gsub(galka_hex, taru_hex)
writeFile(original_name + "_taru.dat", taru)