[SCRIPT] Скрипт убирания мусора с нпцдаты для пвп серверов

Тема в разделе "Веб скрипты (WEB)", создана пользователем root, 1 окт 2014.

  1. root

    root Administrator Команда форума Administrator Moderator Developers Team

    Регистрация:
    23 авг 2014
    Сообщения:
    253
    Симпатии:
    56
    Баллы:
    11
    Код:
    <?php // fix RB {[sb_blazing_skin1];1;1;24.5663} 
    echo "<pre>"; 
    //$arr = array(); 
    $fp2 = fopen("rm_npcdata.txt","w"); 
    
    
    $fp = fopen("new_npcdata.txt","r"); 
    while (!feof($fp)) { 
    $line = fgets($fp); 
    if (!ereg("npc_begin (citizen|warehouse_keeper|teleporter|guard|pet|summon)",$line)) { 
    //if (preg_match_all("/\[(sb_[^]]+)\];/",$line,$match)) { 
    //foreach ($match[1] as $val) { 
    //$arr[$val] = ""; 
    //} 
    //} 
    $line = preg_replace("/\{\[(sb|amulet|spellbook)(_[^]]+)\];([0-9]+;[0-9]+);[0-9\.]+\}/","{[\\1\\2];\\3;0.0111}",$line); 
    $line = preg_replace("/\{\[(leather_shoes_texture|animal_skin|animal_bone|charcoal|coal|braided_hemp| 
    
    
    iron_ore|stem|suede|thread|varnish|cokes|high_grade_suede|silver_nugget|compound 
    
    
    _braid|cord|admantite_nugget|coarse_bone_powder|leather|steel|mithril_ore|crafte 
    
    
    d_leather|oriharukon_ore|stone_of_purity|asofe|mold_glue|mold_hardener|mold_lubr 
    
    
    icant|enria|thons|wooden_arrow|bone_arrow|fine_steel_arrow|silver_arrow|mithril_ 
    
    
    arrow)\];([0-9]+;[0-9]+);[0-9\.]+\}/","{[\\1];\\2;0.0111}",$line); 
    
    
    
    
    //$line = preg_replace("/\{\[(sb|amulet|spellbook)_[^]]+\];[0-9]+;[0-9]+;[0-9\.]+\};?/","",$line); 
    //$line = preg_replace("/\{\{([;]+)?\};[0-9\.]+\}/","",$line); 
    //$line = preg_replace("/\}[;]+\}/","}}",$line); 
    echo $line; 
    } 
    fputs($fp2,$line); 
    } 
    //print_r($arr); 
    fclose($fp); 
    fclose($fp2); 
    ?>