Stand/mp_event_enums/crunch_data.php
2024-10-16 11:20:42 +08:00

29 lines
567 B
PHP

<?php
function hex2signed($hex)
{
return unpack("la", pack("l", hexdec($hex)))["a"];
}
function joaat_hex($key)
{
return hash("joaat", strtolower($key));
}
function joaat_signed($key)
{
return hex2signed(joaat_hex($key));
}
$fh = fopen("mp_event_enums.csv", "w");
fwrite($fh, "Key, 11, 12, 13, 14, 15\n");
foreach(explode("\n", file_get_contents("data.txt")) as $line)
{
$line = trim($line);
fwrite($fh, $line);
for ($i = 11; $i <= 15; ++$i)
{
fwrite($fh, ", ");
fwrite($fh, joaat_signed("Globals.MP_Event_Enums".$i.".".$line));
}
fwrite($fh, "\n");
}