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; }
<?php //$line="27 67 4E 8E 9D 09 3A 32 76 24 E8 69 D0 93 A1 27 47 4E C6 9D 0D 3A 1A 74 34 EC C9 D9 93 B3 27 47 4E CC 9D 0D 3A 30"; //$line="27 66 4E CC 95 89 3B 12 76 24 EC E9 D8 D3 B1 A7 62 4E CE 9D 9D 3B 12 76 74 EC C9 D8 80"; //$line="27 46 4A 84 9D 09 3A 12 74 74 E8 69 D9 D3 B1 A7 46 4E 84 9D 09 3A 12 74 74 E8 E9 D9 93 A1 27 47 4E 84 9D 1D 3A 30"; $line = "07 6A 0E D4 1D B8 3B 70"; $required_bits = array(5, 6, 6, 5, 5, 5, 6, 5, 5, 6, 6, 6, 6, 6, 5, 5, 5, 6, 5, 6); $pieces = convert_line_to_elements($line); $bin_str = convert_vect_to_bin($pieces, 999999, 8); $bin_str2 = convert_vect_to_bin($required_bits, 999999, 8); echo "Total number of ones in bytes : " . count_onces($bin_str[0]) . "<br>"; echo "Total number of ones required : " . count_onces($bin_str2[0]) . "<br>"; //print_r( $pieces ); //for( $i = 15; $i< 35; $i++) // print_test( $pieces, $i ); /* $pieces2 = merge_byte_touint16( $pieces ); print_r( $pieces ); echo "<br>"; print_r( $pieces2 ); /**/ //$pieces = merge_byte_touint16( $pieces ); print_test($pieces, 15, $required_bits); //print_test( $pieces, 16 ,$required_bits ); //print_test( $pieces, 17 ,$required_bits); //print_test( $pieces, 30 ,$required_bits); //print_test( $pieces, 120 ,$required_bits); function print_test($pieces, $i, $required_bits = "", $highlight_bits = 5) { echo "Testing len {$i} <br>"; $bin_str = convert_vect_to_bin($pieces, $i, 8);
echo "insert ignore into playercreateinfo_spells (indexid,spellid) values ( {$zindex},{$spell_id} );<br>"; } } } } } 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) {
$Unk11 = 0x4000000; $SearchForFlag1 = 0xff; $SearchForFlag2 = 0x1000000; // 0xFFFFFFFF to skip using $SearchForFlagNOT2 = 0x0; // 0 to skip using $debugging_rows = 11111150; //echo ToHex( 0x0F,4 )."-".ToHex( 0xFF,4 )."-".ToHex( 0xABC,4 ); while ($inp_h && !feof($inp_h)) { $debugging_rows--; if ($debugging_rows <= 0) { break; } //take 1 line $line = fgets($inp_h); $vect = convert_line_to_elements($line); $line_size = count($vect); $line_index = 0; $guid1 = convert_from_line_to_guid($vect); //echo "$line_index<br>"; $guid2 = convert_from_line_to_guid($vect); //echo "$line_index<br>"; $x = convert_to_float(convert_from_line_to_int($vect)); //echo "$line_index<br>"; $y = convert_to_float(convert_from_line_to_int($vect)); //echo "$line_index<br>"; $z = convert_to_float(convert_from_line_to_int($vect)); //echo "$line_index<br>"; $sync = convert_from_line_to_int($vect); //echo "$line_index<br>"; $f1 = $vect[$line_index++];