WoWInterface SVN MountRandomMount

[/] [trunk/] [script-import.php] - Rev 34

Compare with Previous | Blame | View Log

<?php
$URLs 
= array(
    
"http://legion.wowhead.com/items=15.5" => '1',
    
"http://www.wowhead.com/spells=-5.2?filter=cr=16;crs=1;crv=0" => '2',
    
"http://www.wowhead.com/spells=-5.3" => '4',
    
"http://www.wowhead.com/spells=-5.1?filter=cr=16;crs=3;crv=0" => '1',
    
"http://www.wowhead.com/spells=-5.2?filter=cr=16;crs=3;crv=0" => '2',
    
"http://www.wowhead.com/spells=-5.1?filter=cr=16;crs=4;crv=0" => '1',
    
"http://www.wowhead.com/spells=-5.2?filter=cr=16;crs=4;crv=0" => '2',
    
"http://www.wowhead.com/spells=-5.1?filter=cr=16;crs=5;crv=0" => '1',
    
"http://www.wowhead.com/spells=-5.2?filter=cr=16;crs=5;crv=0" => '2',
    
"http://www.wowhead.com/spells=-5.1?filter=cr=16;crs=6;crv=0" => '1',
    
"http://www.wowhead.com/spells=-5.2?filter=cr=16;crs=6;crv=0" => '2'
);
$completearray = array();

$notFlying = array();
$notFlying[169952] = 1;//Creeping Carpet

foreach($URLs as $URL => $type){
    
$outputfile "dl.html";
    
$cmd "wget.exe -q \"$URL\" -O $outputfile";
    
exec($cmd);
    
$page file_get_contents($outputfile);

    
$page str_replace(array("\r\n""\n""\r"), ''$page);


    
$pos strpos($page'" class="listview">');
    
$wokingstring substr($page$pos);
    
$pos strpos($page'_ = g_items;var _ = {};');
    
$wokingstring substr($page$pos);
    
$wokingstring str_replace('_ = g_items;var _ = {};'''$wokingstring);

    
$pos strpos($wokingstring'_ = g_spells;');
    
$wokingstring substr($wokingstring0$pos);

    
$wokingstring str_replace(';$.extend(true, g_spells, _);'""$wokingstring);

    
$workingarray explode(';'$wokingstring);

    foreach(
$workingarray as $mount){
        
$pos strpos($mount'","rank_enus":');
        
$mount substr($mount0$pos);
        
$mount str_replace(array("_["']={"name_enus":"'), array('''*-*'), $mount);
        
$mount str_replace(array("_["']={"name_ptr":"'), array('''*-*'), $mount);
        
$mount explode('*-*'$mount);
        
$currentType $type;
        if(isset(
$notFlying[$mount[0]])){
            
$currentType 1;
        }
        
$completearray[$currentType][$mount[0]] = str_replace('\\','',$mount[1]);
    }

}



require_once (
'./simple_html_dom.php');
$echo 1;

$URLs = array(
    
"http://eu.battle.net/wow/en/character/elune/R%C3%BBbis/mount",//ally
    
"http://eu.battle.net/wow/en/character/chogall/Tomatan/mount"//horde
);

$nonetyped = array();
foreach(
$URLs as $URL){
    
$page file_get_html($URL);
    
$page $page->find(".data-container",0);
    
$mounts $page->find("div[class!=no-results]");
    foreach(
$mounts as $mount){
        
$aMount $mount->find('a'0);
        
$id "data-collectible";
        
$id $aMount->$id;
        
$source "data-raw";
        
$source str_replace(array(' 4 type-2'' 4 type-1'' 4 type-3'' 3 type-2'' 3 type-1'' 3 type-3'' 1 type-2'' 1 type-1'' 1 type-3'), ''$mount->$source);
        
$nameMount $mount->find('span.name',0)->innertext;
        
$type str_replace(array('grid-item not-collected ''grid-item is-collected '), ''$mount->class);
        if(
$id == '64731' || $id == '30174'){
            
$type 'aquatic';
        }
        if(isset(
$notFlying[$id])){
            
$allMounts['ground'][$source][$id] = $nameMount;
        }
        
$allMounts[$type][$source][$id] = $nameMount;
        
$nonetyped[$id] = $nameMount;
    }
}

$classMount = array(
    
//death knight
    
48778 => 'Acherus Deathcharger',
    
//warlock
    
5784 => 'Felsteed',
    
23161 => 'Dreadsteed',
    
//paladin
    
13819 => 'Summon Warhorse',//HUMAN & DWARF
    
23214 => 'Summon Charger',
    
34767 => 'Summon Thalassian Charger',//BLOOD ELF
    
34769 => 'Summon Thalassian Warhorse',
    
69820 => 'Summon Sunwalker Kodo',//TAUREN
    
69826 => 'Summon Great Sunwalker Kodo',
    
73629 => 'Summon Exarch\'s Elekk',//DRAENEI
    
73630 => 'Summon Great Exarch\'s Elekk'
);

foreach(
$completearray as $types => $mounts){
    foreach(
$mounts as $k => $v){
        if(!isset(
$nonetyped[$k])){
            
$double '';
            if(
$k 1000){
                
$double '&nbsp;&nbsp;&nbsp;';
            }
            if(
$types == 1){
                
$type 'ground';
            }else{
                
$type 'flying';
            }
            
$source 'source-none';
            
$allMounts[$type][$source][$k] = $v;
        }
    }
}
$allMounts['ground']['source-class'] = $classMount;
$allMounts['flying']['source-class']['54729'] = 'Winged Steed of the Ebon Blade';

if(
$echo == '1'){
    foreach(
$allMounts as $mountType => $allMountTypes){
        echo 
'["'.$mountType.'"] = {<br />';
        foreach(
$allMountTypes as $mountSource => $allMountSources){
            echo 
'&nbsp;&nbsp;&nbsp;["'.$mountSource.'"] = {<br />';
            foreach(
$allMountSources as $mountId => $mountName){
                echo 
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$mountId.',&nbsp;&nbsp;&nbsp;--'.$mountName.'<br />';
            }
            echo 
'&nbsp;&nbsp;&nbsp;},<br />';
        }
        echo 
'},<br />';
    }
}

?>

Compare with Previous | Blame