Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 14.07.2006, 20:08   #1
Xari0n
Архивный участник
 
Join Date: Jul 2006
Posts: 119
Default [SHARE] Converter for c4 retail itemdata-npcdata to c1

The script is universal for converting npcdata and itemdata, check it.

[php:1:0b4601f89b]<pre>
<?php
// Xelat Copyright(c) 2006
//xelat_z@mail.ru
//ICQ 195187980
$orig_dir = "c4\\orig";
$off_dir = "c4\\off";
$out_dir = "c4";
$include["npc"] = explode(",","level,acquire_exp_rate,exp,acquire_sp ,clan,ignore_clan_list,clan_help_range,slot_chest, slot_rhand,slot_lhand,skill_list,npc_ai,category,r ace,sex,undying,can_be_attacked,corpse_time,no_sle ep_mode,agro_range,ground_high,ground_low,org_hp,o rg_hp_regen,org_mp,org_mp_regen,str,int,dex,wit,co n,men,base_attack_type,base_attack_range,base_dama ge_range,base_rand_dam,base_physical_attack,base_c ritical,physical_hit_modify,base_attack_speed,base _reuse_delay,base_magic_attack,base_defend,base_ma gic_defend,physical_avoid_modify,item_make_list,co rpse_make_list,additional_make_list,additional_mak e_multi_list,hp_increase,mp_increase");
$exclude["npc"] = explode(",","");
$bad_type["npc"] = explode(",","");

$bad_type["item"] = explode(",","");
$include["item"] = explode(",","item_type,slot_bit_type,armor_type,et citem_type,consume_type,default_action,weight,soul shot_count,spiritshot_count,default_price,item_ski ll,critical_attack_skill,material_type,crystal_typ e,crystal_count,is_trade,is_drop,is_destruct,physi cal_damage,random_damage,weapon_type,can_penetrate ,critical,hit_modify,avoid_modify,dual_fhit_rate,s hield_defense,shield_defense_rate,attack_range,dam age_range,attack_speed,reuse_delay,mp_consume,magi cal_damage,durability,damaged,physical_defense,mag ical_defense,mp_bonus,category,enchanted,equip_pet ,magic_weapon,,,,,");
//$exclude["item"] = explode(",","recipe_id,reduced_soulshot,reduced_sp iritshot,reduced_mp_consume,attack_skill,magic_ski ll,item_skill_enchanted_four,html,enchant_enable,, ,,");
$exlude["item"] = explode(",","");
//Structure: <file type>_begin <type> <id> <name> <params> <file type>_end
$ftype = "item";
$fname = $ftype."data.txt";
$f = fopen($off_dir."\\".$fname,"r");
while (!feof($f)) {
$s = fgets($f);
if (preg_match("/".$ftype."_begin\s+(\w+)\s+(\d+)\s+\[([\w_\'\`\.\-0-9]+)\]\s+(.+)\s+".$ftype."_end/i",$s,$m)) {
$type = $m[1];
$id = $m[2];
$name = $m[3];
$params = $m[4];
preg_match_all("/([^\s]+)\s+/i",$params,$p);
$p = $p[1];
$params = array();
foreach ($p as $val) {
$p1 = explode("=",$val,2);
$params[$p1[0]] = $p1[1];
}
$data[$id]->type = $type;
$data[$id]->name = $name;
$data[$id]->params = $params;
}
}
fclose($f);
$fn = fopen($out_dir."\\".$fname,"w");
$f = fopen($orig_dir."\\".$fname,"r");
while (!feof($f)) {
$s = fgets($f);
if (preg_match("/".$ftype."_begin\s+(\w+)\s+(\d+)\s+\[([\w_\'\`\.\-0-9]+)\]\s+(.+)\s+".$ftype."_end/i",$s,$m)) {
$type = $m[1];
$id = $m[2];
$name = $m[3];
$params = $m[4];
preg_match_all("/\s?([^\s]+)\s?/i",$params,$p);
$p = $p[1];
$params = "";
foreach ($p as $val) {
$pp = explode("=",$val,2);
$p1 = $pp[0];
$p2 = $pp[1];
if (in_array($p1,$include) && $data[$id]->params[$p1]) $params[]=$p1."=".$data[$id]->params[$p1];
else $params[]=$p1."=".$p2;

//if (in_array($p1,$include[$ftype]) || !in_array($p1,$exclude[$ftype]))
//$params[]=$p1."=".($data[$id]->params[$p1]?$data[$id]->params[$p1]:$p2);
//else $params[]=$p1."=".$p2;
}
$name = $data[$id]->name;
$type = $data[$id]->type;
if (!in_array($type,$bad_type[$ftype])) $s = $ftype."_begin\t".$type."\t".$id."\t[".$name."]\t".implode("\t",$params)."\t".$ftype."_end\r\n" ;
}
fputs($fn,$s);
}
fclose($f);
fclose($fn);

?>
</pre>
[/php:1:0b4601f89b]

Thnx for all who test this conveter
Xari0n is offline  
Old 14.07.2006, 20:42   #2
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

Respect, Xari0n!

I'll kill you.
I was made a script, and you made the same?
hel is offline  
Old 14.07.2006, 21:02   #3
Xari0n
Архивный участник
 
Join Date: Jul 2006
Posts: 119
Default

Xari0n is offline  
Old 14.07.2006, 23:53   #4
nowak2006
Архивный участник
 
Join Date: May 2006
Posts: 53
Default

give me c4 retail script and i'll test it 1000 times =)
nowak2006 is offline  
Old 15.07.2006, 01:28   #5
Johnson
Архивный участник
 
Join Date: May 2006
Posts: 26
Default

500$ pm me, lawl
Johnson is offline  
Old 15.07.2006, 02:31   #6
horyfilipe
Архивный участник
 
Join Date: Jul 2005
Posts: 242
Default

good work man, now skilldata would be perfect
horyfilipe is offline  
Old 15.07.2006, 02:51   #7
testdude
Архивный участник
 
Join Date: Nov 2005
Posts: 504
Default

Quote:
Originally Posted by Johnson
500$ pm me, lawl
300$ pm me instead lawlzoriusiuoiuflawl
testdude is offline  
Old 15.07.2006, 03:06   #8
Bacek
Архивный участник
 
Join Date: Apr 2006
Posts: 110
Default

People share it free, coz, any body has it!
Bacek is offline  
Old 15.07.2006, 06:08   #9
SlayerX
Архивный участник
 
Join Date: Dec 2005
Posts: 82
Default

very nice work
SlayerX is offline  
Old 15.07.2006, 09:44   #10
Darkraven
Архивный участник
 
Join Date: Apr 2006
Posts: 76
Default

Quote:
Originally Posted by Bacek
People share it free, coz, any body has it!
Where? =)
Darkraven is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:27.