Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   [SHARE] Converter for c4 retail itemdata-npcdata to c1 (https://postpacific.mmorpg-game.online/showthread.php?t=5146)

Xari0n 14.07.2006 20:08

[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
:)

hel 14.07.2006 20:42

Respect, Xari0n!
;)
I'll kill you. :D
I was made a script, and you made the same? :D

Xari0n 14.07.2006 21:02

:)

nowak2006 14.07.2006 23:53

give me c4 retail script and i'll test it 1000 times =)

Johnson 15.07.2006 01:28

500$ pm me, lawl

horyfilipe 15.07.2006 02:31

good work man, now skilldata would be perfect :)

testdude 15.07.2006 02:51

Quote:

Originally Posted by Johnson
500$ pm me, lawl

300$ pm me instead lawlzoriusiuoiuflawl

Bacek 15.07.2006 03:06

People share it free, coz, any body has it!

SlayerX 15.07.2006 06:08

very nice work

Darkraven 15.07.2006 09:44

Quote:

Originally Posted by Bacek
People share it free, coz, any body has it!

Where? =)


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