<?php
	require_once('../common/scripts/connect.inc.php');
	require_once('../common/scripts/template.inc.php');

if(isset($_POST['id']))
{
$template = new Template(".");
$template->set_file("info", "infoArme.tpl");
$template->set_block("info", "ARME","Arme");

//informations de l'arme
$infoArme=pg_query($dbconn,"select obj_infos from objects where obj_id = $id ");
$infoArme=pg_fetch_row($infoArme);

$objName=pg_query($dbconn,"select obj_name from objects where obj_id ='$id'"); 
$name=pg_fetch_array($objName);
$template->set_var("NAMEARME",$name[0]);
$image=$name[0];
$template->set_var("IMAGE",$image);
$template->set_var("INFOARME",$infoArme[0]);

$objDuration=pg_query($dbconn,"select obj_duration from objects where obj_id ='$id'"); 
$objDuration=pg_fetch_row($objDuration);
$template->set_var("DURATION",$objDuration[0]);

$objDead=pg_query($dbconn,"select obj_use_dead from objects where obj_id ='$id'"); 
$objDead=pg_fetch_row($objDead);
if ($objDead[0]==true) $objDead[0]="oui";
else $objDead[0]="non";
$template->set_var("DEAD",$objDead[0]);
/*
$obj_skill_id_melee =pg_query($dbconn,"select obj_skill_id_melee from objects where obj_id ='$id'"); 
$obj_skill_id_melee =pg_fetch_row($obj_skill_id_melee);
$template->set_var("SKILLIDMELEE",$obj_skill_id_melee[0]);
*/

$obj_use_dist_max  =pg_query($dbconn,"select obj_use_dist_max  from objects where obj_id ='$id'"); 
$obj_use_dist_max  =pg_fetch_row($obj_use_dist_max);
$template->set_var("USEDISTMAX",$obj_use_dist_max[0]);

$obj_use_dist_min  =pg_query($dbconn,"select obj_use_dist_min  from objects where obj_id ='$id'"); 
$obj_use_dist_min  =pg_fetch_row($obj_use_dist_min);
$template->set_var("USEDISTMIN",$obj_use_dist_min[0]);

$obj_use_pa_self   =pg_query($dbconn,"select obj_use_pa_self   from objects where obj_id ='$id'"); 
$obj_use_pa_self   =pg_fetch_row($obj_use_pa_self);
$template->set_var("USEPASELF",$obj_use_pa_self [0]);

$obj_use_pv_self   =pg_query($dbconn,"select obj_use_pv_self   from objects where obj_id ='$id'"); 
$obj_use_pv_self   =pg_fetch_row($obj_use_pv_self);
$template->set_var("USEPVSELF",$obj_use_pv_self [0]);

$obj_use_pv_target   =pg_query($dbconn,"select obj_use_pv_target   from objects where obj_id ='$id'"); 
$obj_use_pv_target   =pg_fetch_row($obj_use_pv_target);
$template->set_var("USEPVTARGET",$obj_use_pv_target[0]);
 
$obj_use_pa_target   =pg_query($dbconn,"select obj_use_pa_target   from objects where obj_id ='$id'"); 
$obj_use_pa_target   =pg_fetch_row($obj_use_pa_target);
$template->set_var("USEPATARGET",$obj_use_pa_target[0]);

$obj_use_limit    =pg_query($dbconn,"select obj_use_limit  from objects where obj_id ='$id'"); 
$obj_use_limit   =pg_fetch_row($obj_use_limit);
$template->set_var("USELIMIT",$obj_use_limit [0]);

$obj_skill_id_distance     =pg_query($dbconn,"select obj_skill_id_distance   from objects where obj_id ='$id'"); 
$obj_skill_id_distance    =pg_fetch_row($obj_skill_id_distance);
$template->set_var("SKILLIDDIST",$obj_skill_id_distance  [0]);

$obj_impact_pa_self=pg_query($dbconn,"select obj_impact_pa_self from objects where obj_id ='$id'"); 
$obj_impact_pa_self=pg_fetch_row($obj_impact_pa_self);
$template->set_var("IMPACTPASELF",$obj_impact_pa_self  [0]);

$obj_impact_pa_target=pg_query($dbconn,"select obj_impact_pa_target from objects where obj_id ='$id'"); 
$obj_impact_pa_target=pg_fetch_row($obj_impact_pa_target);
$template->set_var("IMPACTPATARGET",$obj_impact_pa_target   [0]);

$obj_impact_pv_self=pg_query($dbconn,"select obj_impact_pv_self from objects where obj_id ='$id'"); 
$obj_impact_pv_self=pg_fetch_row($obj_impact_pv_self);
$template->set_var("IMPACTPVSELF",$obj_impact_pv_self[0]);

$obj_impact_dam_min=pg_query($dbconn,"select obj_impact_dam_min from objects where obj_id ='$id'"); 
$obj_impact_dam_min=pg_fetch_row($obj_impact_dam_min);
$template->set_var("IMPACTDAMMIN",$obj_impact_dam_min[0]);

$obj_impact_dam_max=pg_query($dbconn,"select obj_impact_dam_max from objects where obj_id ='$id'"); 
$obj_impact_dam_max=pg_fetch_row($obj_impact_dam_max);
$template->set_var("IMPACTDAMMAX",$obj_impact_dam_max[0]);

$obj_equip=pg_query($dbconn,"select obj_equip from objects where obj_id ='$id'"); 
$obj_equip=pg_fetch_row($obj_equip);
$template->set_var("EQUIP",$obj_equip[0]);

$obj_equip_pa=pg_query($dbconn,"select obj_equip_pa from objects where obj_id ='$id'"); 
$obj_equip_pa=pg_fetch_row($obj_equip_pa);
$template->set_var("EQUIPPA",$obj_equip_pa[0]);

$obj_equip_defense =pg_query($dbconn,"select obj_equip_defense  from objects where obj_id ='$id'"); 
$obj_equip_defense =pg_fetch_row($obj_equip_defense);
$template->set_var("EQUIPDEFENSE",$obj_equip_defense [0]);

$obj_equip_bonus_strength =pg_query($dbconn,"select obj_equip_bonus_strength  from objects where obj_id ='$id'"); 
$obj_equip_bonus_strength =pg_fetch_row($obj_equip_bonus_strength);
$template->set_var("EQUIPBONUSSTRENGTH",$obj_equip_bonus_strength [0]);

$obj_equip_bonus_const =pg_query($dbconn,"select obj_equip_bonus_const  from objects where obj_id ='$id'"); 
$obj_equip_bonus_const =pg_fetch_row($obj_equip_bonus_const);
$template->set_var("EQUIPBONUSCONST",$obj_equip_bonus_const [0]);

$obj_equip_bonus_dext =pg_query($dbconn,"select obj_equip_bonus_dext  from objects where obj_id ='$id'"); 
$obj_equip_bonus_dext =pg_fetch_row($obj_equip_bonus_dext);
$template->set_var("EQUIPBONUSDEXT",$obj_equip_bonus_dext [0]);
 
$obj_equip_bonus_psy =pg_query($dbconn,"select obj_equip_bonus_psy  from objects where obj_id ='$id'"); 
$obj_equip_bonus_psy =pg_fetch_row($obj_equip_bonus_psy);
$template->set_var("EQUIPBONUSPSY",$obj_equip_bonus_psy [0]);
 
$obj_equip_bonus_pa =pg_query($dbconn,"select obj_equip_bonus_pa  from objects where obj_id ='$id'"); 
$obj_equip_bonus_pa =pg_fetch_row($obj_equip_bonus_pa);
$template->set_var("EQUIPBONUSPA",$obj_equip_bonus_pa [0]);
 
$obj_graph =pg_query($dbconn,"select obj_graph  from objects where obj_id ='$id'"); 
$obj_graph =pg_fetch_row($obj_graph);
$template->set_var("GRAPH",$obj_graph [0]);
 

$template->parse("Arme","ARME",true);
$template->parse("output","info");
$template->p("output");


$idMimi=pg_query($dbconn,"select char_id from equipements where obj_id =$id ");
$idMimi = pg_fetch_row($idMimi);
echo"<div class=\"PancarteInventaire\">";
	echo"<img style=\"cursor:pointer\" onclick='inventaire($idMimi[0])' src=\"images/gif/inventaire.gif\" >";
echo"</div>";
}
?>