Post Pacific  

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

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 01.08.2006, 07:58   #1
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default [SHARE] Regular Expressions to Convert C4 Skills to C1

These are my regular expressions used in PHP to convert C4 Retail skilldata.txt into C1 compatible skills. I used L2ScriptExecutioner.exe by HF on skilldata.txt before running the regex. Search for it on PP if you dont have it.

Note that there are some skill substitutions in this which may or may not unbalance any existing balance of your server. This is not a leecher share, so you will still need to review everything to ensure it fits with your server.

The main point of this share is mostly for the regex which is a pain in the ass cause there are so many things that need to be changed.

Also, I was pretty lazy with the writing of this script so it is not optimized for performance. All regex works great though and will be usefull in your own tools.

[php:1:c548a2b132]
$skills = file_get_contents("npc/skilldata.txt");

$line = preg_split("/\r\n/", $skills);

for ($n=0; $n<count($line); $n++)
{
// {p_physical_armor_hit;{armor_light};2;diff}
preg_match_all("/\{p_physical_armor_hit;\{([a-zA-Z0-9_\-]{1,})\};([0-9\.\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_physical_armor_hit;{".$matches[1][0]."};".$matches[2][0].";".$matches[3][0]."}", "{p_hit;{all};".$matches[2][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {p_area_damage;-40;per}
preg_match_all("/\{p_area_damage\;([0-9\-]{1,})\;([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_area_damage;".$matches[1][0].";".$matches[2][0]."}", "", $line[$n]);
unset($matches);
}

// i_p_attack_over_hit
preg_match_all("/\{i_p_attack_over_hit\;([0-9]{1,})\;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_p_attack_over_hit;".$matches[1][0].";".$matches[2][0]."}", "{i_p_attack_over_hit;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// i_fatal_blow
preg_match_all("/\{i_fatal_blow\;([0-9]{1,})\;([0-9]{1,})\;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_fatal_blow;".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{i_p_attack_over_hit;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// p_reuse_delay
preg_match_all("/\{p_reuse_delay\;([0-9\-]{1,})\;([0-9\-]{1,})\;([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_reuse_delay;".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{p_reuse_delay;".$matches[2][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// p_max_cp
preg_match_all("/(;*)\{p_max_cp;([0-9\-]{1,});([a-zA-Z]{1,})\}(;*)/i", $line[$n], $matches);

if (count($matches[2]) >= 1)
{
$line[$n] = str_replace($matches[1][0]."{p_max_cp;".$matches[2][0].";".$matches[3][0]."}".$matches[4][0], "", $line[$n]);
unset($matches);
}

// p_hit_number
preg_match_all("/(;*)\{p_hit_number;([0-9\-]{1,});([a-zA-Z]{1,})\}(;*)/i", $line[$n], $matches);

if (count($matches[2]) >= 1)
{
$line[$n] = str_replace($matches[1][0]."{p_hit_number;".$matches[2][0].";".$matches[3][0]."}".$matches[4][0], "", $line[$n]);
unset($matches);
}

// i_summon
preg_match_all("/\{i_summon;(\[[a-zA-Z0-9\-\_\']{1,}\]);([0-9]{1,});(\[[a-zA-Z0-9\-\_\']{1,}\]);([0-9]{1,})\}(.*)\}\t/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_summon;".$matches[1][0].";".$matches[2][0].";".$matches[3][0].";".$matches[4][0]."}".$matches[5][0]."}\t", "{i_summon;".$this->npc_lookup($this->npc_c4pch_lookup($matches[1][0])).";".$matches[2][0]."}".$matches[5][0]."}\t"."item_consume={[".$this->item_lookup($this->item_c4pch_lookup($matches[3][0]))."];".$matches[4][0]."}\t", $line[$n]);
unset($matches);
}

// i_summon_npc
preg_match_all("/\{\{i_summon_npc;(\[[a-zA-Z0-9\-\_\']{1,}\]);([0-9]{1,})\}\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_summon_npc;".$matches[1][0].";".$matches[2][0]."}", "{i_summon;".$this->npc_lookup($this->npc_c4pch_lookup($matches[1][0])).";".$matches[2][0]."}", $line[$n]);
unset($matches);
}

// i_give_contribution
preg_match_all("/(;*)\{i_give_contribution;([0-9\-]{1,})\}(;*)/i", $line[$n], $matches);

if (count($matches[2]) >= 1)
{
$line[$n] = str_replace($matches[1][0]."{i_give_contribution;".$matches[2][0]."}".$matches[4][0], "", $line[$n]);
unset($matches);

// operate_cond={{op_unlock}}
$line[$n] = str_replace("operate_cond={{op_unlock}}", "item_consume={[key_of_thief];1}", $line[$n]);
}

// {op_energy_max;1}
preg_match_all("/(;*)\{op_energy_max;([0-9])\}(;*)/i", $line[$n], $matches);

if (count($matches[2]) >= 1)
{
$line[$n] = str_replace($matches[1][0]."{op_energy_max;".$matches[2][0]."}".$matches[3][0], "", $line[$n]);
unset($matches);
}

// i_energy_attack
preg_match_all("/\{i_energy_attack;([0-9]{1,});([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_energy_attack;".$matches[1][0].";".$matches[2][0]."}", "{i_energy_attack;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// {p_create_common_item;1}
preg_match_all("/\{p_create_common_item;([0-9])\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
if ($matches[1][0] > 4) $matches[1][0] = 4;

$line[$n] = str_replace("{p_create_common_item;".$matches[1][0]."}", "{p_create_item;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

if (strstr($line[$n], "i_dispel_by_category"))
{
for ($d=0; $d<=5; $d++)
{
// {i_dispel_by_category;slot_buff;25}
preg_match_all("/\{i_dispel_by_category;([a-zA-Z0-9_]{1,});([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_dispel_by_category;".$matches[1][0].";".$matches[2][0]."}", "", $line[$n]);
unset($matches);
}
}

$line[$n] = str_replace("effect={", "effect={{i_dispel_all};", $line[$n]);
}

// {p_pvp_magical_skill_dmg_bonus;-50;per}
preg_match_all("/(;*)\{p_pvp_magical_skill_dmg_bonus;([0-9\-]{1,});([a-zA-Z]{1,})\}(;*)/i", $line[$n], $matches);

if (count($matches[2]) >= 1)
{
$line[$n] = str_replace($matches[1][0]."{p_pvp_magical_skill_dmg_bonus;".$matches[2][0].";".$matches[3][0]."}".$matches[4][0], "", $line[$n]);
unset($matches);
}

// {p_pvp_physical_skill_dmg_bonus;-50;per}
preg_match_all("/(;*)\{p_pvp_physical_skill_dmg_bonus;([0-9\-]{1,});([a-zA-Z]{1,})\}(;*)/i", $line[$n], $matches);

if (count($matches[2]) >= 1)
{
$line[$n] = str_replace($matches[1][0]."{p_pvp_physical_skill_dmg_bonus;".$matches[2][0].";".$matches[3][0]."}".$matches[4][0], "", $line[$n]);
unset($matches);
}

// {p_reuse_delay;0;200;per}
preg_match_all("/\{p_reuse_delay;([0-9]);([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_reuse_delay;".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{p_reuse_delay;".$matches[2][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {p_physical_attack_by_hp1;32.9;diff}
preg_match_all("/\{p_physical_attack_by_hp(1|2);([0-9\.\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_physical_attack_by_hp".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{p_physical_attack;{all};".$matches[2][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {p_physical_defence_by_hp1;32.9;diff}
preg_match_all("/\{p_physical_defence_by_hp(1|2);([0-9\.\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_physical_defence_by_hp".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{p_physical_defence;{all};".$matches[2][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {p_critical_rate_by_hp1;32.9;diff}
preg_match_all("/\{p_critical_rate_by_hp(1|2);([0-9\.\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_critical_rate_by_hp".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{p_critical_rate;".$matches[2][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {p_2h_sword_bonus;4.5;diff;3;diff}
preg_match_all("/\{p_2h_sword_bonus;([0-9\.\-]{1,});([a-zA-Z]{1,});([0-9\.\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_2h_sword_bonus;".$matches[1][0].";".$matches[2][0].";".$matches[3][0].";".$matches[4][0]."}", "{p_physical_attack;{sword};".$matches[1][0].";".$matches[2][0]."};{p_hit;{sword};".$matches[3][0].";".$matches[4][0]."}", $line[$n]);
unset($matches);
}

// {p_2h_blunt_bonus;4.5;diff;3;diff}
preg_match_all("/\{p_2h_blunt_bonus;([0-9\.\-]{1,});([a-zA-Z]{1,});([0-9\.\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_2h_blunt_bonus;".$matches[1][0].";".$matches[2][0].";".$matches[3][0].";".$matches[4][0]."}", "{p_physical_attack;{blunt};".$matches[1][0].";".$matches[2][0]."};{p_hit;{blunt};".$matches[3][0].";".$matches[4][0]."}", $line[$n]);
unset($matches);
}

// {i_m_attack_over_hit;135}
preg_match_all("/\{i_m_attack_over_hit;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_m_attack_over_hit;".$matches[1][0]."}", "{i_m_attack;".$matches[1][0]."};{i_p_attack_over_hit;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// {p_vampiric_attack;6}
preg_match_all("/\{p_vampiric_attack;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_vampiric_attack;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {p_hit_at_night;3;diff}
preg_match_all("/\{p_hit_at_night;([0-9]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_hit_at_night;".$matches[1][0].";".$matches[2][0]."}", "{p_hit;{all};".$matches[1][0].";".$matches[2][0]."}", $line[$n]);
unset($matches);
}

// {p_area_damage;-40;per}
preg_match_all("/\{p_area_damage;([0-9]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_area_damage;".$matches[1][0].";".$matches[2][0]."}", "", $line[$n]);
unset($matches);
}

// {p_heal_effect;-50;per}
preg_match_all("/\{p_heal_effect;([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
if ($matches[1][0] <= -1)
{ // negative recharging effect
$abnormal_lv = 100+round(-($matches[1][0]/2));

if ($abnormal_lv > 150) $abnormal_lv = 150;
}
else
{
$abnormal_lv = round(($matches[1][0]/2));

if ($abnormal_lv > 100) $abnormal_lv = 100;

}

$line[$n] = str_replace("{p_heal_effect;".$matches[1][0].";".$matches[2][0]."}", "", $line[$n]);
$line[$n] = str_replace("abnormal_lv=1", "abnormal_lv=".$abnormal_lv, $line[$n]);
unset($matches);
}

// {c_chameleon_rest;-2;5}
preg_match_all("/\{c_chameleon_rest;([0-9\-\.]{1,});([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{c_chameleon_rest;".$matches[1][0].";".$matches[2][0]."}", "{c_mp;".$matches[1][0].";".$matches[2][0]."};{p_block_move};{p_attack_speed;{all};-100;per}", $line[$n]);
unset($matches);
}

// {p_avoid_agro;100}
preg_match_all("/\{p_avoid_agro;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_avoid_agro;".$matches[1][0]."}", "{p_avoid_agro}", $line[$n]);
unset($matches);
}

// {i_summon_paralyze_cubic;1}
preg_match_all("/\{i_summon_paralyze_cubic;([0-9])\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_summon_paralyze_cubic;".$matches[1][0]."}", "{i_summon_poison_cubic;".(6+$matches[1][0])."}", $line[$n]);
unset($matches);
}

// {i_summon_water_dot_cubic;1}
preg_match_all("/\{i_summon_water_dot_cubic;([0-9])\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_summon_water_dot_cubic;".$matches[1][0]."}", "{i_summon_dd_cubic;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// {i_summon_shock_cubic;1}
preg_match_all("/\{i_summon_shock_cubic;([0-9])\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_summon_shock_cubic;".$matches[1][0]."}", "{i_summon_poison_cubic;".(15+$matches[1][0])."}", $line[$n]);
unset($matches);
}

// {i_transmit_m_power;H}
preg_match_all("/\{i_transmit_m_power;([a-zA-Z])\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_transmit_m_power;".$matches[1][0]."}", "{i_focus_energy;3}", $line[$n]);
$line[$n] = str_replace("target_type=self", "target_type=other", $line[$n]);
unset($matches);
}

// {op_m_power_count;2}
preg_match_all("/\{op_m_power_count;([0-9])\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{op_m_power_count;".$matches[1][0]."}", "{energy_saved;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// {i_physical_attack_hp_link;2908}
preg_match_all("/\{i_physical_attack_hp_link;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_physical_attack_hp_link;".$matches[1][0]."}", "{i_p_attack_over_hit;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// {p_physical_shield_defence_angle_all}
preg_match_all("/\{(p_physical_shield_defence_angle_all)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_physical_shield_defence_angle_all} ", "{p_shield_defence_rate;80}", $line[$n]);
unset($matches);
}

// {p_physical_polarm_target_single}
preg_match_all("/\{(p_physical_polarm_target_single)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_physical_polarm_target_single}", "", $line[$n]);
unset($matches);
}

// {p_physical_shield_defence;-40;per}
preg_match_all("/\{p_physical_shield_defence;([0-9\-\.]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_physical_shield_defence;".$matches[1][0].";".$matches[2][0]."}", "{p_physical_defence;{shield};".$matches[1][0].";".$matches[2][0]."}", $line[$n]);
unset($matches);
}

// {op_2h_weapon;{sword;blunt}}
preg_match_all("/\{op_2h_weapon;\{([a-zA-Z;\-]{1,})\}\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{op_2h_weapon;{".$matches[1][0]."}}", "{equip_weapon;{".$matches[1][0]."}}", $line[$n]);
unset($matches);
}

// {p_magic_critical_rate;200;per}
preg_match_all("/\{p_magic_critical_rate;([0-9]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$p_magical_attack = round(($matches[1][0]/10));

$line[$n] = str_replace("{p_magic_critical_rate;".$matches[1][0].";".$matches[2][0]."}", "{p_magical_attack;{all};".$p_magical_attack.";".$ matches[2][0]."}", $line[$n]);
unset($matches);
}

// {i_cp;-7;per}
preg_match_all("/\{i_cp;([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_cp;".$matches[1][0].";".$matches[2][0]."}", "", $line[$n]);
$cp_am = $matches[1][0];
$cp_ty = $matches[2][0];
unset($matches);

preg_match_all("/(skill_id=[0-9]{1,})|(level=[0-9]{1,})/i", $line[$n], $matches);

$this->SkillDataEx[] = "skill_begin\t".$matches[0][0]."\t".$matches[0][1]."\teffect={{i_cp;".$cp_am.";".$cp_ty."}}\tskill_e nd";
}

// i_restoration_random
preg_match_all("/\{i_restoration_random;(.+)\}\t/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_restoration_random;".$matches[1][0]."}\t", "}\t", $line[$n]);
unset($matches);
}

// i_restoration
preg_match_all("/\{i_restoration;(.+)\}\t/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_restoration;".$matches[1][0]."}\t", "}\t", $line[$n]);
unset($matches);
}

// i_fishing_cast
preg_match_all("/\{(i_fishing_cast)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_fishing_cast}", "", $line[$n]);
unset($matches);
}

// {i_fishing_pumping;0.66}
preg_match_all("/\{(i_fishing_pumping|i_fishing_reeling|p_fishing_m astery);([0-9\.]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{".$matches[1][0].";".$matches[2][0]."}", "", $line[$n]);
unset($matches);
}

// {equip_weapon;{fishingrod}};{op_fishing_pumping}
preg_match_all("/\{(op_fishing_reeling|op_fishing_pumping)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{equip_weapon;{fishingrod}};{".$match es[1][0]."}", "", $line[$n]);
unset($matches);
}

// {i_open_dwarf_recipebook}
preg_match_all("/\{(i_open_dwarf_recipebook)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_open_dwarf_recipebook}", "", $line[$n]);
unset($matches);
}

// {i_open_common_recipebook}
preg_match_all("/\{(i_open_common_recipebook)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_open_common_recipebook}", "", $line[$n]);
unset($matches);
}

// {p_preserve_abnormal}
preg_match_all("/\{(p_preserve_abnormal)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_preserve_abnormal}", "", $line[$n]);
unset($matches);
}

// {i_install_camp_ex}
preg_match_all("/\{(i_install_camp_ex)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_install_camp_ex}", "", $line[$n]);
unset($matches);
}

// {p_reduce_drop_penalty}
preg_match_all("/\{(p_reduce_drop_penalty)\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_reduce_drop_penalty}", "", $line[$n]);
unset($matches);
}

$line[$n] = str_replace("{p_skill_critical;str}}", "{p_critical_rate;10;per}}\tbasic_property=str ", $line[$n]);
$line[$n] = str_replace("{p_skill_critical;int}}", "{p_magical_attack;{all};10;per}}\tbasic_property= int", $line[$n]);

// {p_enlarge_storage;trade_sell;1}
preg_match_all("/\{p_enlarge_storage;([a-zA-Z_]{1,});([0-9]{1,})\}(;*)/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_enlarge_storage;".$matches[1][0].";".$matches[2][0]."}".$matches[3][0], "", $line[$n]);
unset($matches);
}

// {p_skill_critical_probability;1000;per}
preg_match_all("/\{p_skill_critical_probability;([0-9]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_skill_critical_probability;".$matc hes[1][0].";".$matches[2][0]."}", "{p_critical_damage;".$matches[1][0].";diff}", $line[$n]);
unset($matches);
}

// {p_magic_mp_cost;1;-30;per}
preg_match_all("/\{p_magic_mp_cost;([0-9]{1,});([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_magic_mp_cost;".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{p_mp_regen;{all};".$matches[2][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {{p_reflect_skill;0;30};{p_reflect_skill;1;10}}
preg_match_all("/\{\{p_reflect_skill;([0-9]);([0-9]{1,})\};\{p_reflect_skill;([0-9]);([0-9]{1,})\}\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_reflect_skill;".$matches[1][0].";".$matches[2][0]."};{p_reflect_skill;".$matches[3][0].";".$matches[4][0]."}", "{p_damage_shield;".$matches[2][0]."}", $line[$n]);
unset($matches);
}

// {p_reflect_skill;0;30};{p_reflect_skill;1;10}
preg_match_all("/\{p_reflect_skill;([0-9]);([0-9]{1,})\};\{p_reflect_skill;([0-9]);([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_reflect_skill;".$matches[1][0].";".$matches[2][0]."};{p_reflect_skill;".$matches[3][0].";".$matches[4][0]."}", "", $line[$n]);
unset($matches);
}

// {p_resist_abnormal_by_category;slot_debuff;-30;per}
preg_match_all("/\{p_resist_abnormal_by_category;([a-zA-Z_]{1,});([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_resist_abnormal_by_category;".$mat ches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{p_defence_attribute;attr_etc;".$matches[2][0]."};{p_defence_attribute;attr_poison;".$matches[2][0]."};{p_defence_attribute;attr_hold;".$matches[2][0]."};{p_defence_attribute;attr_bleed;".$matches[2][0]."};{p_defence_attribute;attr_sleep;".$matches[2][0]."};{p_defence_attribute;attr_shock;".$matches[2][0]."};{p_defence_attribute;attr_derangement;".$match es[2][0]."};{p_defence_attribute;attr_unholy;".$matches[2][0]."};{p_defence_attribute;attr_paralyze;".$match es[2][0]."}", $line[$n]);
unset($matches);
}

// {p_resist_dispel_by_category;slot_buff;-60;per}
preg_match_all("/\{p_resist_dispel_by_category;([a-zA-Z_]{1,});([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_resist_dispel_by_category;".$match es[1][0].";".$matches[2][0].";".$matches[3][0]."}", "", $line[$n]);
unset($matches);
}

// {p_max_cp;-90;per}
preg_match_all("/\{p_max_cp;([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_max_cp;".$matches[1][0].";".$matches[2][0]."}", "{p_max_hp;".round(($matches[1][0]/2)).";".$matches[2][0]."}", $line[$n]);
unset($matches);
}

// {i_death;2}
preg_match_all("/\{i_death;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_death;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {i_target_cancel}
preg_match_all("/(\{i_target_cancel\})/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_target_cancel}", "", $line[$n]);
unset($matches);
}

// {i_rebalance_hp}
preg_match_all("/(\{i_rebalance_hp\})/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_rebalance_hp}", "{i_hp_per_max;10}", $line[$n]);
unset($matches);
}

// {p_block_skill_physical}
preg_match_all("/(\{p_block_skill_physical\})/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_block_skill_physical}", "{p_block_spell}", $line[$n]);
unset($matches);
}

// {i_p_attack;1973;15}
preg_match_all("/\{i_p_attack;([0-9]{1,});([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_p_attack;".$matches[1][0].";".$matches[2][0]."}", "{i_p_attack_over_hit;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// {i_p_attack;1973;15}
preg_match_all("/\{i_p_attack;([0-9]{1,});([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_p_attack;".$matches[1][0].";".$matches[2][0]."}", "{i_p_attack_over_hit;".$matches[1][0]."}", $line[$n]);
unset($matches);
}

// {i_backstab;5479;300;0}
preg_match_all("/\{i_backstab;([0-9]{1,});([0-9]{1,});([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_backstab;".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "{i_backstab;".$matches[1][0].";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {p_fatal_blow_rate;60;per}
preg_match_all("/\{p_fatal_blow_rate;([0-9]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_fatal_blow_rate;".$matches[1][0].";".$matches[2][0]."}", "{p_critical_damage;".round(($matches[1][0]/2)).";".$matches[2][0]."}", $line[$n]);
unset($matches);
}

$line[$n] = str_replace("{{p_critical_rate_position_bonus;fron t;-30;per};{p_critical_rate_position_bonus;side;30;pe r};{p_critical_rate_position_bonus;back;60;per}}", "{{p_critical_rate;10;per}}", $line[$n]);
$line[$n] = str_replace("{i_align_direction}", "", $line[$n]);

// {p_critical_damage_position;front;-30;per}
preg_match_all("/\{p_critical_damage_position;([a-zA-Z]{1,});([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_critical_damage_position;".$matche s[1][0].";".$matches[2][0].";".$matches[3][0]."}", "", $line[$n]);
unset($matches);
}

// {p_critical_rate_position_bonus;front;-30;per}
preg_match_all("/\{p_critical_rate_position_bonus;([a-zA-Z]{1,});([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_critical_rate_position_bonus;".$ma tches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "", $line[$n]);
unset($matches);
}

//{p_block_getdamage;block_hp}
preg_match_all("/(\{p_block_getdamage;block_hp\})/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_block_getdamage;block_hp}", "{p_block_getdamage}", $line[$n]);
unset($matches);
}

//{p_block_getdamage;block_mp}
preg_match_all("/(\{p_block_getdamage;block_mp\})/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_block_getdamage;block_mp}", "{p_block_move}", $line[$n]);
unset($matches);
}

//{p_block_buff}
preg_match_all("/(\{p_block_buff\})/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_block_buff}", "", $line[$n]);
unset($matches);
}

//{p_block_debuff}
preg_match_all("/(\{p_block_debuff\})/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_block_debuff}", "", $line[$n]);
unset($matches);
}

if (strstr($line[$n], "i_dispel_by_slot_probability"))
{
for ($d=0; $d<=5; $d++)
{
// {i_dispel_by_slot_probability;ma_up;40}
preg_match_all("/\{i_dispel_by_slot_probability;([a-zA-Z0-9_]{1,});([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_dispel_by_slot_probability;".$matc hes[1][0].";".$matches[2][0]."}", "{i_dispel_by_slot;".$matches[1][0].";".$matches[2][0]."}", $line[$n]);
unset($matches);
}
}
}

// {op_not_territory;
preg_match_all("/\{\{op_not_territory;(.*)\}\}\}\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{{op_not_territory;".$matches[1][0]."}}}}", "{}", $line[$n]);
unset($matches);
}

// {i_change_face;0}
preg_match_all("/\{i_change_face;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_change_face;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {i_change_hair_color;0}
preg_match_all("/\{i_change_hair_color;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_change_hair_color;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {i_change_hair_style;0}
preg_match_all("/\{i_change_hair_style;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_change_hair_style;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {i_sp;500;diff}
preg_match_all("/\{i_sp;([0-9\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_sp;".$matches[1][0].";".$matches[2][0]."}", "", $line[$n]);
unset($matches);
}

// {i_fishing_shot;100}
preg_match_all("/\{i_fishing_shot;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_fishing_shot;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {i_summon_soul_shot;100}
preg_match_all("/\{i_summon_soul_shot;([0-9]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_summon_soul_shot;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {i_summon_spirit_shot;100;40;1.0}
preg_match_all("/\{i_summon_spirit_shot;([0-9\-]{1,});([0-9]{1,});([0-9\.]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_summon_spirit_shot;".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "", $line[$n]);
unset($matches);
}

// {i_teleport;83378;147999;-3400}
preg_match_all("/\{i_teleport;([0-9\-]{1,});([0-9\-]{1,});([0-9\-]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_teleport;".$matches[1][0].";".$matches[2][0].";".$matches[3][0]."}", "", $line[$n]);
unset($matches);
}

// {op_alignment;lawful}
preg_match_all("/\{op_alignment;([a-zA-Z_]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{op_alignment;".$matches[1][0]."}", "", $line[$n]);
unset($matches);
}

// {p_avoid_rate_by_hp2;3.84;diff}
preg_match_all("/\{p_avoid_rate_by_hp2;([0-9\-\.]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_avoid_rate_by_hp2;".$matches[1][0].";".$matches[2][0]."}", "{p_avoid;{all};".($matches[1][0]*2).";".$matches[2][0]."}", $line[$n]);
unset($matches);
}

// {p_avoid_rate_by_hp2;3.84;diff}
preg_match_all("/\{p_attack_speed_by_hp2;([0-9\-\.]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_attack_speed_by_hp2;".$matches[1][0].";".$matches[2][0]."}", "{p_attack_speed;{all};".($matches[1][0]*2).";".$matches[2][0]."}", $line[$n]);
unset($matches);
}

// {p_pvp_physical_attack_dmg_bonus;5;per}
preg_match_all("/\{p_pvp_physical_attack_dmg_bonus;([0-9\-\.]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_pvp_physical_attack_dmg_bonus;".$m atches[1][0].";".$matches[2][0]."}", "", $line[$n]);
unset($matches);
}

// {p_pvp_magical_skill_dmg_bonus;5;per}
preg_match_all("/\{p_pvp_magical_skill_dmg_bonus;([0-9\-\.]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_pvp_magical_skill_dmg_bonus;".$mat ches[1][0].";".$matches[2][0]."}", "", $line[$n]);
unset($matches);
}

$line[$n] = preg_replace("/\{op_m_power_type_2;[a-zA-Z];[a-zA-Z]\}/i", "{energy_saved;3}", $line[$n]);
$line[$n] = str_replace("{i_remove_m_power}", "", $line[$n]);

// handle abnormal types
$line[$n] = str_replace("=shield_defence_up", "=none", $line[$n]);
$line[$n] = str_replace("=magic_critical_up", "=none", $line[$n]);
$line[$n] = str_replace("=snipe", "=none", $line[$n]);
$line[$n] = str_replace("=song_of_storm_guard", "=none", $line[$n]);
$line[$n] = str_replace("=song_of_vengeance", "=none", $line[$n]);
$line[$n] = str_replace("=public_slot", "=none", $line[$n]);
$line[$n] = str_replace("=attr_boss", "=attr_etc", $line[$n]);
$line[$n] = str_replace("=resist_spiritless", "=none", $line[$n]);
$line[$n] = str_replace("=heal_effect_down", "=remove_from_hatelist", $line[$n]);
$line[$n] = str_replace("=heal_effect_up", "=remove_from_hatelist", $line[$n]);
$line[$n] = str_replace("=vampiric_attack", "=weapon_durability_down", $line[$n]);
$line[$n] = str_replace("=duelist_spirit", "=attack_speed_up_bow", $line[$n]);
$line[$n] = str_replace("=song_of_flame_guard", "=dance_of_fire", $line[$n]);
$line[$n] = str_replace("=song_of_vitality", "=none", $line[$n]);
$line[$n] = str_replace("=dance_of_vampire", "=weapon_durability_down", $line[$n]);
$line[$n] = str_replace("=song_of_vampire", "=weapon_durability_down", $line[$n]);
$line[$n] = str_replace("=dance_of_vengeance", "=none", $line[$n]);
$line[$n] = str_replace("=dance_of_aqua_guard", "=none", $line[$n]);
$line[$n] = str_replace("=dance_of_earth_guard", "=none", $line[$n]);
$line[$n] = str_replace("=dance_of_protection", "=none", $line[$n]);

// ================================================== ============
// damage nerfs
// ================================================== ============
// {p_magical_attack;{all};10;per}
preg_match_all("/\{p_magical_attack;\{([a-zA-Z_;]{1,})\};([0-9\.\-]{1,});([a-zA-Z]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_magical_attack;{".$matches[1][0]."};".$matches[2][0].";".$matches[3][0]."}", "{p_magical_attack;{".$matches[1][0]."};".($matches[2][0]/2).";".$matches[3][0]."}", $line[$n]);
unset($matches);
}

// {p_critical_rate;10;per}
preg_match_all("/\{p_critical_rate;([0-9\.\-]{1,});per\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{p_critical_rate;".$matches[1][0].";per}", "{p_critical_rate;".($matches[1][0]/4).";per}", $line[$n]);
unset($matches);
}

// {i_p_attack_over_hit;268}
preg_match_all("/\{i_p_attack_over_hit;([0-9\.\-]{1,})\}/i", $line[$n], $matches);

if (count($matches[1]) >= 1)
{
$line[$n] = str_replace("{i_p_attack_over_hit;".$matches[1][0]."}", "{i_p_attack_over_hit;".round(($matches[1][0]*2))."}", $line[$n]);
unset($matches);
}

$line[$n] = preg_replace("/(;{2,})/", ";", $line[$n]);
$line[$n] = str_replace("}{", "};{", $line[$n]);
$line[$n] = str_replace("{;", "{", $line[$n]);
$line[$n] = str_replace(";}", "}", $line[$n]);
$line[$n] = str_replace("{;}", "{}", $line[$n]);

print $line[$n]."\r\n";
}
}
[/php:1:c548a2b132]
Firedaemon 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 16:02.