PHP Personnages vue en 3D comme sur wowhead // MaNGOS
Bonjour,

Voici un petit script que j'ai trouvé sur AC-WEB pour voir les personnages choisi en 3D mais il faux l'adapter a son site Hihi :

demo: [Image: 3dchar.jpg]

codage:

Code PHP :
<?php
$_MYSQL
['host'] = "localhost"//Your MySQL Host
$_MYSQL['user'] = "root"//Your MySQL Username
$_MYSQL['pass'] = "ascent"//Your MySQL Password
$_MYSQL['data'] = "ascent"//Your Logon/Characters database
$link mysql_pconnect($_MYSQL['host'], $_MYSQL['user'], $_MYSQL['pass']);
mysql_select_db($_MYSQL['db'], $link);
$user $_GET['id'];
    
$sql mysql_query("SELECT * FROM characters WHERE guid = '".$user."'"$link);
$result mysql_fetch_assoc($sql);

$data explode(' ',$result['data']);

$item_head $data[258];
$item_neck $data[260];
$item_shoulder $data[262];
$item_shirt $data[264];
$item_chest $data[266];
$item_belt $data[268];
$item_legs $data[270];
$item_feet $data[272];
$item_wrist $data[274];
$item_gloves $data[276];
$item_finger1 $data[278];
$item_finger2 $data[280];
$item_trinket1 $data[282];
$item_trinket2 $data[284];
$item_back $data[286];
$item_main_hand $data[288];
$item_off_hand $data[290];
$item_ranged_slot $data[292];

function 
wowhead_did($item) {

    
$sql mysql_query("SELECT * FROM item_template WHERE entry = '$item'");
    
$row mysql_fetch_array($sql);
    
    
$displayid $row['displayid'];
    
    return 
$displayid;

}
?>
<div id="model_scene" align="center"><object id="wowhead" type="application/x-shockwave-flash" data="http://static.wowhead.com/modelviewer/ModelView.swf" height="200px" width="200px"><param name="quality" value="high"><param name="allowscriptaccess" value="always"><param name="menu" value="false"><param value="transparent" name="wmode"><param name="flashvars" value="model=<?= char_racesex($race$sexo); ?>&amp;modelType=16&amp;ha=0&amp;hc=0&amp;fa=0&amp;sk=0&amp;fh=0&amp;fc=0&amp;contentPath=http://static.wowhead.com/modelviewer/&amp;blur=1&amp;equipList=1,<?= wowhead_did($item_head); ?>,3,<?= wowhead_did($item_shoulder); ?>,16,<?= wowhead_did($item_back); ?>,5,<?= wowhead_did($item_chest); ?>,9,<?= wowhead_did($item_wrist); ?>,10,<?= wowhead_did($item_gloves); ?>,6,<?= wowhead_did($item_belt); ?>,7,<?= wowhead_did($item_legs); ?>,8,<?= wowhead_did($item_feet); ?>,14,<?= wowhead_did($item_off_hand); ?>,21,<?= wowhead_did($item_main_hand); ?>"><param name="movie" value="http://static.wowhead.com/modelviewer/ModelView.swf"></object></div> 

cordialement,
deathart
En es-tu l'auteur ?
J'allait dire ça, sa vien de AC WEB je croit
Oui c'est exacte
Un exemple ?
Oui voila j'ai mis un example
Nouvelle version de Elmsroth

-> Script effacé pour droit d'auteur.
"Allez le chercher sur TCForum si vous le voulez !"

Largement mieux codé que celui du haut! Smile
Merci bien
Pas essayé.
(20-03-2010 10:45)blackdown a écrit :  Nouvelle version de Elmsroth

Code PHP :
<?php
/*        CLASSE FCI3D 
 *  Créée le 20/01/2010 - © 
 *  Version: 1.0
 *    FCI3D = Flash Character Inspector 3D
 *  By Elmsroth using wowhead
 */

class FCI3D
{
    private  
$sqlLink ;
    private  
$WORLD_DB ;
    private  
$CHARACTERS_DB ;
    private  
$characterInfos ;
    private  
$characterData ;
    
    
    function 
__construct(&$SQL_CONN$CHAR_GUID$CHARACTERS_DBNAME$WORLD_DBNAME//SQL_CONN is a MySQLi Object, $CHAR_GUID is the charatcer ingame guid
    
{        
        
$this->sqlLink $SQL_CONN ;
        
$this->WORLD_DB $WORLD_DBNAME ;
        
$this->CHARACTERS_DB $CHARACTERS_DBNAME ;
        
$this->sqlLink->select_db($this->CHARACTERS_DB);
        
$dataQuery $this->sqlLink->query("SELECT data, race, gender FROM characters WHERE guid = '".$this->sqlLink->real_escape_string($CHAR_GUID)."' ") ;
        
        
$this->characterInfos $dataQuery->fetch_object() ;
        
$this->characterData explode(" "$this->characterInfos->data) ;
        
        
//Initializing dynamic attributes
        
eval("\$this->item_head = ".$this->characterData[258]." ;") ;
        eval(
"\$this->item_neck = ".$this->characterData[260]." ;") ;
        eval(
"\$this->item_shoulder = ".$this->characterData[262]." ;") ;
        eval(
"\$this->item_shirt = ".$this->characterData[264]." ;") ;
        eval(
"\$this->item_chest = ".$this->characterData[266]." ;") ;
        eval(
"\$this->item_belt = ".$this->characterData[268]." ;") ;
        eval(
"\$this->item_legs = ".$this->characterData[270]." ;") ;
        eval(
"\$this->item_feet = ".$this->characterData[272]." ;") ;
        eval(
"\$this->item_wrist = ".$this->characterData[274]." ;") ;
        eval(
"\$this->item_gloves = ".$this->characterData[276]." ;") ;
        eval(
"\$this->item_finger1 = ".$this->characterData[278]." ;") ;
        eval(
"\$this->item_finger2 = ".$this->characterData[280]." ;") ;
        eval(
"\$this->item_trinket1 = ".$this->characterData[282]." ;") ;
        eval(
"\$this->item_trinket2 = ".$this->characterData[284]." ;") ;
        eval(
"\$this->item_back = ".$this->characterData[286]." ;") ;
        eval(
"\$this->item_main_hand = ".$this->characterData[288]." ;") ;
        eval(
"\$this->item_off_hand = ".$this->characterData[290]." ;") ;
        eval(
"\$this->item_ranged_slot = ".$this->characterData[292]." ;") ;

    }
    
    private function 
getGameItemDisplayId($itemId)
    {
        if(
is_numeric($itemId))
        {
            
$this->sqlLink->select_db($this->WORLD_DB) ;
            
$query "SELECT displayid FROM item_template WHERE entry = ".$itemId." " ;
            
$itemQuery $this->sqlLink->query($query) ;
            
//echo "<br> requete: ".$query ;
            
$dataResult $itemQuery->fetch_object() ;
            return 
$dataResult->displayid ;
        }
        else
        {
            return 
;
        }
        
    }
    
    private function 
char_racegender($race$gender
    {

        
$char_race = array(
            
=> 'human',
            
=> 'orc',
            
=> 'dwarf',
            
=> 'nightelf',
            
=> 'scourge',
            
=> 'tauren',
            
=> 'gnome',
            
=> 'troll',
            
10 => 'bloodelf',
            
11 => 'draenei');
            
        
$char_gender = array(
            
=> 'male',
            
=> 'female');
            
            return 
$char_race[$race].$char_gender[$gender];

    } 
    
    function 
displayHTML()
    {
        
/*
        echo "<pre>" ;
        print_r($this);
        echo "</pre>" ;
        */
        
$HTML_FLASH '
        <object id="wowhead" type="application/x-shockwave-flash" data="http://static.wowhead.com/modelviewer/ModelView.swf" height="640px" width="480px">
<param name="quality" value="high">
<param name="allowscriptaccess" value="always">
<param name="menu" value="false">
<param value="transparent" name="wmode">
<param name="flashvars" value="model='
.$this->char_racegender($this->characterInfos->race$this->characterInfos->gender).'&amp;modelType=16&amp;ha=0&amp;hc=0&amp;fa=0&amp;sk=0&amp;fh=0&amp;fc=0&amp;contentPath=http://static.wowhead.com/modelviewer/&amp;blur=1&amp;equipList=1,'.$this->getGameItemDisplayId($this->item_head).',3,'.$this->getGameItemDisplayId($this->item_shoulder).',16,'.$this->getGameItemDisplayId($this->item_back).',5,'.$this->getGameItemDisplayId($this->item_chest).',9,'.$this->getGameItemDisplayId($this->item_wrist).',10,'.$this->getGameItemDisplayId($this->item_gloves).',6,'.$this->getGameItemDisplayId($this->item_belt).',7,'.$this->getGameItemDisplayId($this->item_legs).',8,'.$this->getGameItemDisplayId($this->item_feet).',14,'.$this->getGameItemDisplayId($this->item_off_hand).',21,'.$this->getGameItemDisplayId($this->item_main_hand).'">
<param name="movie" value="http://static.wowhead.com/modelviewer/ModelView.swf">
</object>'
;


        return 
$HTML_FLASH ;
    }
    
    
}
;
?>

Largement mieux codé que celui du haut! Smile

Je comprends pas trop le fonctionnement...
Pas de fichier config rien ?

Retourner en haut Accueil