Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RPG-CLUB npc rate compare -> test
- <?php
- $st=file('stock.txt');
- foreach($st as $k=>$v)$st[$k]=trim($v);
- $res=file('res.txt');
- foreach($res as $k=>$v)$res[$k]=trim($v);
- $c1='corpse_make_list=';
- $c2='additional_make_list=';
- $c3='additional_make_multi_list=';
- $c4='ex_item_drop_list=';
- $c5='};{{{';
- $c6='};{';
- $npc='';
- $npc_id=0;
- $grate='';
- function np($v){
- global $npc,$npc_id;
- $a=explode("\t",$v);
- if(count($a)>3)
- $npc_id=trim($a[2]);
- $npc=trim($a[3]);
- }
- function p3($l){
- return str_replace('=','',$l);
- }
- function p2($l){
- return str_replace('{','',str_replace('}','',$l));
- }
- $pzz=array();$pza=array();$oth=array();
- function p1($v,$c,$o1,$o2,$lo=false){
- global $npc,$npc_id,$op,$c1,$c2,$c3,$c4,$st,$res,$grate,$ii,$il,$pzz,$pza,$oth;
- $il2=0;$ii2=0;
- $cc=trim($c);
- $z=explode($c,$v);
- $bb=explode('acquire_rp=',$v);
- if(count($bb)>1){
- $bb=explode("\t",$bb[1]);
- $bb=intval(trim($bb[0]));
- }else $bb=0;
- if(count($z)>1){
- $op=0;
- $z=explode("\t",$z[1]);
- $z=trim($z[0]);
- $old=$z;
- $ol2='';
- $z=explode($o1,$z);
- if($z[0]!='{}')
- foreach($z as $v2){
- $z2=explode($o2,$v2);
- $pz2='';
- $oz=explode('}};',$v2);
- if(count($oz)>1){
- $pz2=p2(end($oz));
- $op+=$pz2;
- }
- $op2=0;
- $op3=0;
- $ao=array();
- $x=0;
- foreach($z2 as $v2){
- $p='';
- $o=explode('}};',$v2);
- if(count($o)>1){
- $p=p2(end($o));
- $op2+=$p;
- }
- $o=explode(';',$v2);
- foreach($o as $ov=>$ok)$o[$ov]=trim(p2($ok));
- $op3+=$o[3];
- $ozz=$o[0];
- $ao[$x][0]=$o[0];
- $ao[$x][1]=$o[1];
- $ao[$x][2]=$o[2];
- $ao[$x][3]=$o[3];
- $x++;
- }
- if($op3>0){
- $op4=$op3;
- if($c1==$c){
- $opz=0;
- $ol='';
- foreach($ao as $opp) { if($opp[0]!=''){
- if($lo){
- if(!isset($pza[$npc]))$pza[$npc]=array();if(!isset($pza[$npc][$opp[0]]))$pza[$npc][$opp[0]]=0;
- $pza[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3];
- }else{
- if(!isset($pzz[$npc]))$pzz[$npc]=array();if(!isset($pzz[$npc][$opp[0]]))$pzz[$npc][$opp[0]]=0;
- $pzz[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3];
- }
- if($ol!='')$ol.=';'; $ol.='{'.$opp[0].';'.$opp[1].';'.$opp[2].';'.$opp[3].'}';
- }
- }
- $ol='{'.$ol.'}';
- $ol2=$ol;
- }else
- if($c2==$c){
- $ol='';
- foreach($ao as $opk=>$opp) { if($opp[0]!=''){
- if($lo){
- if(!isset($pza[$npc]))$pza[$npc]=array();if(!isset($pza[$npc][$opp[0]]))$pza[$npc][$opp[0]]=0;
- $pza[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3];
- }else{
- if(!isset($pzz[$npc]))$pzz[$npc]=array();if(!isset($pzz[$npc][$opp[0]]))$pzz[$npc][$opp[0]]=0;
- $pzz[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3];
- }
- if($ol!='')$ol.=';'; $ol.='{'.$opp[0].';'.$opp[1].';'.$opp[2].';'.$opp[3].'}';
- }
- }
- $ol='{'.$ol.'}';
- $ol2=$ol;
- }else
- if($c3==$c){
- if($ao[$opk][2]<1)$ao[$opk][2]=1;
- $ol='';
- foreach($ao as $opp) { if($opp[0]!=''){
- if($lo){
- if(!isset($pza[$npc]))$pza[$npc]=array();if(!isset($pza[$npc][$opp[0]]))$pza[$npc][$opp[0]]=0;
- $pza[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3]*$pz2/100;
- }else{
- if(!isset($pzz[$npc]))$pzz[$npc]=array();if(!isset($pzz[$npc][$opp[0]]))$pzz[$npc][$opp[0]]=0;
- $pzz[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3]*$pz2/100;
- }
- if($ol!='')$ol.=';'; $ol.='{'.$opp[0].';'.$opp[1].';'.$opp[2].';'.$opp[3].'}';
- }
- }
- $ol='{'.$ol.'};'.$pz2;
- if($ol2!='')$ol2.=';';
- $ol2.='{'.$ol.'}';
- }else
- if($c4==$c){
- if($ao[$opk][2]<1)$ao[$opk][2]=1;
- $ol='';
- foreach($ao as $opp) { if($opp[0]!=''){
- if($lo){
- if(!isset($pza[$npc]))$pza[$npc]=array();if(!isset($pza[$npc][$opp[0]]))$pza[$npc][$opp[0]]=0;
- $pza[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3]*$pz2/100;
- }else{
- if(!isset($pzz[$npc]))$pzz[$npc]=array();if(!isset($pzz[$npc][$opp[0]]))$pzz[$npc][$opp[0]]=0;
- $pzz[$npc][$opp[0]]+=(($opp[1]+$opp[2])/2)*$opp[3]*$pz2/100;
- }
- if($ol!='')$ol.=';'; $ol.='{'.$opp[0].';'.$opp[1].';'.$opp[2].';'.$opp[3].'}';
- }
- }
- $ol='{'.$ol.'};'.$pz2;
- if($ol2!='')$ol2.=';';
- $ol2.='{'.$ol.'}';
- }
- }
- }
- if(!$lo){
- if(is_array($pzz[$npc]))foreach($pzz[$npc] as $kzz=>$gzz){
- if($gzz<$pza[$npc][$kzz]){
- if(!isset($oth[$npc]))$oth[$npc]=array();
- $oth[$npc][$kzz]=array($gzz,$pza[$npc][$kzz]);
- }
- }
- }
- }
- return $v;
- }
- if(file_exists('debug.txt'))
- unlink('debug.txt');
- set_time_limit(0);
- ini_set('memory_limit','3200000000');
- function fopen_utf8($filename){
- $encoding='';
- $handle = fopen($filename, 'r');
- $bom = fread($handle, 2);
- rewind($handle);
- if($bom === chr(0xff).chr(0xfe) || $bom === chr(0xfe).chr(0xff)){
- $encoding = 'UTF-16';
- } else {
- $file_sample = fread($handle, 1000) + 'e';
- rewind($handle);
- $encoding = mb_detect_encoding($file_sample , 'UTF-8, UTF-7, ASCII, EUC-JP,SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP');
- }
- if ($encoding){
- stream_filter_append($handle, 'convert.iconv.'.$encoding.'/UTF-8');
- }
- return ($handle);
- }
- $k=0;
- function npc($d,$lo=true){
- global $grate,$ii,$k,$c1,$c2,$c3,$c4,$c5,$c6,$npc,$op,$il,$oth;
- $ii=0;$il=0;
- $grate=$d;
- $handle = fopen_utf8("../npcdata{$d}.txt");
- $bb = array();
- $gg=1;
- if ($handle) {
- while (($b = fgets($handle, 20000)) !== false) {
- np($b);
- $b=p1($b,$c1,$c5,$c6,$lo);
- $b=p1($b,$c2,$c5,$c6,$lo);
- $b=p1($b,$c3,$c5,$c6,$lo);
- $b=p1($b,$c4,$c5,$c6,$lo);
- $k++;
- }
- fclose($handle);
- print_r($oth);
- }
- }
- npc("_x7",true);
- npc("_x30",false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement