![]() |
|
|
#11 |
|
Архивный участник
Join Date: Feb 2005
Posts: 357
|
well i coded this, change exp sp spoil rate and quantity, drop rate and quantity and adena quantity. could be bugged i dont know.
read npcdata in ansi and output it in ansi. enjoy [php:1:15106188ca] <?php ## coded by Sauron ## $exp = 15; $sp = 15; // drop rate modifiers $p_drop = 15; $p_spoil = 15; // drop quantity modifiers $q_drop = 15; $q_spoli = 15; $adena = 15; $oh = fopen("npcdata.txt", 'r'); $gh = fopen("npcdata_moded.txt", 'w'); $tab = " "; // <<== that should be a tab, replace it if the site converts it to space while(!feof($oh)) { $row = trim(fgets($oh)); $row = explode($tab,$row); $output = ""; for($i=0; $i<count($row);$i++){ if(strripos($row[$i], "e_exp_rate=")){ $len = strlen("acquire_exp_rate="); $value = substr($row[$i], $len, strlen($row[$i]) - $len); $output .= "acquire_exp_rate=".floatval($value*$exp).$tab ; } else if(strripos($row[$i], "e_sp=")){ $len = strlen("acquire_sp="); $value = substr($row[$i], $len, strlen($row[$i]) - $len); $output .= "acquire_sp=".floatval($value*$sp).$tab; } else if(strripos($row[$i], "l_make_list=") || strripos($row[$i], "l_make_multi_list=") || strripos($row[$i], "e_make_list=")){ if(strripos($row[$i], "l_make_list=")){ $len = strlen("additional_make_list="); $output .= "additional_make_list="; $drop = $p_drop; $quant = $q_drop; } elseif(strripos($row[$i], "l_make_multi_list=")){ $len = strlen("additional_make_multi_list="); $output .= "additional_make_multi_list="; $drop = $p_drop; $quant = $q_drop; } elseif(strripos($row[$i], "e_make_list=")){ $len = strlen("corpse_make_list="); $output .= "corpse_make_list="; $drop = $p_spoil; $quant = $q_spoli; } $pos = 0; $list = ""; $item = ""; $drop_a = explode(";", substr($row[$i],$len, strlen($row[$i]) - $len)); for($e=0; $e < count($drop_a); $e++){ if($drop_a[$e] == "{}") { $list = "{}}"; break; } if($drop_a[$e][0] != "{"){ $initial = strlen($drop_a[$e]); $line = str_replace("}", "", $drop_a[$e]); $final = strlen($line); $pos = $initial - $final; if($pos != 0){ if(($return = floatval($line*$drop)) > 100) $return = 100; $list .= $return.str_repeat("}",$pos).";"; } else if($item == "adena" && $max < 2){ $list .= ($line * $adena).";"; $max++; } else { $item = ""; $list .= ($line*$quant).";"; } } else { $item = str_replace(array("{","[","]"),"",$drop_a[$e]); $list .= $drop_a[$e].";"; $max = 0; } } if(strpos($row[$i], "}")) $list = substr($list, 0, (strlen($list)-1)); $output .= $list.$tab; } else $output .= $row[$i].$tab; } fputs($gh,$output."\r\n"); } fclose($gh); fclose($oh); ?>[/php:1:15106188ca] |
|
|
|
|