authorName = 'Toups';
$this->authorWeb = 'http://www.open-designs.org';
$this->authorEmail = 'toups@open-designs.org';
$this->name = 'Super Treat';
$this->desc = 'Increases your pet\'s total skill points by 1';
$this->price = 150;
$this->require_input = true;
$this->can_use_item = true;
}
function getAddInput()
{
global $item_info, $db_prefix;
return 'Amount to increase skill points by
Phrase to output upon use: (use xNAMEx for pet name)
';
}
function getUseInput()
{
global $db_prefix, $ID_MEMBER;
$result = db_query("SELECT numpets FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row['numpets'] == 0) {
return "You have no pets. Using this item will simply cause it to die and you to lose money.";
}
$string = "";
return "Select a pet to give this item to: ".$string;
}
function onUse()
{
global $db_prefix, $ID_MEMBER, $item_info;
if (!isset($_POST['petid'])) {
return "I told you it would die!";
}
else {
$result = db_query("UPDATE {$db_prefix}shop_pets SET maxap = maxap + {$item_info[1]} WHERE pet_id = {$_POST['petid']} AND ownerid = {$ID_MEMBER}", __FILE__, __LINE__);
$result = db_query("SELECT name, maxap from {$db_prefix}shop_pets WHERE pet_id = {$_POST['petid']} AND ownerid = {$ID_MEMBER}", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
$banana = array();
$explode = explode(' ' , $item_info[2]);
foreach ($explode as $word) {
if ($word == 'xNAMEx') {
$banana[] = $row['name'];
}
else {
$banana[] = $word;
}
}
$return = implode(' ', $banana);
return $return;
}
}
}
?>