}
}
echo "<br> <br>";
//now generate bars
for ($trace = 0; $trace < 30; $trace++) {
    for ($tclass = 0; $tclass < 30; $tclass++) {
        if ($p_bars[$trace][$tclass]) {
            //get the index for this race class combination
            $get_query = "select `index` from playercreateinfo where class={$tclass} and race={$trace}";
            $get_res = mysql_query($get_query, $dbi) or die(" Q200611231501411 " . mysql_error($dbi));
            list($zindex) = mysql_fetch_row($get_res);
            $vect = convert_line_to_elements($p_bars[$trace][$tclass]);
            $line_index = 0;
            $unk = convert_from_line_to_int8($vect);
            for ($i = 0; $i < 144; $i++) {
                $but_action = convert_from_line_to_int16($vect);
                $but_type = convert_from_line_to_int8($vect);
                $but_misc = convert_from_line_to_int8($vect);
                if ($but_type != 0 || $but_action != 0 || $but_misc != 0) {
                    echo "insert into playercreateinfo_bars (race,class,button,action,type,misc) values ( {$trace},{$tclass},{$i},{$but_action},{$but_type},{$but_misc} );<br>";
                }
            }
        }
    }
}
function convert_to_float($value)
{
    $val2 = $value;
    settype($val2, "integer");
    $packed = pack("L*", $val2);
    list(, $unpacked) = unpack("f*", $packed);
function extract_states($from)
{
    global $line_index;
    $vect = convert_line_to_elements($from);
    $line_index = 0;
    $mapid = convert_from_line_to_int($vect);
    $zone = convert_from_line_to_int($vect);
    $area = convert_from_line_to_int($vect);
    $state_count = convert_from_line_to_int16($vect);
    for ($i = 0; $i < $state_count * 2; $i += 2) {
        $ret[$i] = convert_from_line_to_int($vect);
        $ret[$i + 1] = convert_from_line_to_int($vect);
    }
    return $ret;
}