equip armor


/**
* Code used when a player equip an armor.
*/

$info=object_info($id);
if(inventory_check($id,$_GET["USED"]) > 0)
{
switch($info["TYPE"])
{
case "B": // Boots
$piece="SHOES";
break;
case "G": // Gloves
$piece="GLOVES";
break;
case "t": // Hat
$piece="HAT";
break;
case "p": // Pants
$piece="PANTS";
break;
case "C": // Cape
$piece="CAPE";
break;
case "A":
default:
$piece="ARMOR";
}

if($uservals[$piece]+0 != 0)
{
echo "
";
echo "\n";
echo "
Result
";
echo "You can only equip one armor or cape at a given time !\n";
echo "

\n";
}
else
{
$uservals["ATTACK"]+=$info["ATTACK"];
$uservals["PROTECTION"]+=$info["PROTECTION"];
$uservals["DEXMOD"]+=$info["DEXTERITY"];
$uservals["STRMOD"]+=$info["STRONGNESS"];
$uservals["CHAMOD"]+=$info["CHARISMA"];
$uservals["INTMOD"]+=$info["INTELLIGENCE"];
$uservals["HPMOD"]+=$info["HP"];
$uservals["MPMOD"]+=$info["MP"];
$uservals["BLOCK"]+=$info["BLOCK"];
$uservals[$piece]=$id;

if(($uservals["HP"]+0) > ($uservals["HPMOD"]+$uservals["MAXHP"]))
$uservals["HP"]=$uservals["HPMOD"]+$uservals["MAXHP"];

if(($uservals["MP"]+0) > ($uservals["MPMOD"]+$uservals["MAXMP"]))
$uservals["MP"]=$uservals["MPMOD"]+$uservals["MAXMP"];

$sql="UPDATE PLAYER SET ATTACK={$uservals['ATTACK']}, PROTECTION={$uservals['PROTECTION']},
DEXMOD={$uservals['DEXMOD']}, STRMOD={$uservals['STRMOD']}, CHAMOD={$uservals['CHAMOD']},
INTMOD={$uservals['INTMOD']}, HPMOD={$uservals['HPMOD']}, MPMOD={$uservals['MPMOD']},
HP={$uservals['HP']}, MP={$uservals['MP']}, BLOCK={$uservals['BLOCK']},
$piece=".$uservals[$piece]." WHERE ID=$userid";
//echo $sql;
$db->Execute($sql);
echo "
";
echo "\n";
echo "
Result
";
echo "You equipped your ".$info["NAME"]." successfully.\n";
echo "

\n";
inventory_add($id,-1,$_GET["USED"]);
$db->Execute("REPLACE INTO USED_OBJECTS(USERID,OBJECTID,NBTIMES) VALUES($userid,$id,".$_GET["USED"].")");
}
}
?>

Wyszukiwarka

Podobne podstrony:
equip armor
equip armor
equip shield
equip ring
equip ring
Operation And Function Light Anti Armor Weapons M72 And M136
Better Her Hand Armor Enchantments (Better) Readme
Fuzion Generic Weapons & Armor Tables
armor?d
equip weapon
equip ring
equip shield

więcej podobnych podstron