Hi there Im trying to get them to appear below something but it keeps giving me an error-
This is my petview.php
but Im trying to get it to appear below the pet- and right above the play, manage, freeze, etc links.
PHP Code:
<?php class PetView extends View{
public function profile(){ $mysidia = Registry::get('mysidia'); $d = $this->document; $adopt = $this->getField('adopt'); $isdead = $adopt->isdead; $name = $adopt->getName(); $title = 'Viewing '; if ($isdead) { $title = '<img src="/picuploads/dead.png"> Here Lies '; $name .= ' <img src="/picuploads/dead.png">'; } else{ if ($adopt->getOwner() == 'SYSTEM') { $title = '<img src="/picuploads/shackle.png"> ' . $title; $name .= '<img src="/picuploads/shackle.png">'; } } if ($adopt->getOwner() == $mysidia->user->username) $title = 'Managing '; $d->setTitle(' '); $d->addLangVar('<table border=1px><tr><td valign="top">'); $d->addLangvar("<b>{$title}{$name}</b><hr>"); if ($isdead == false) { if ($adopt->getOwner() == 'SYSTEM') { $d->addLangVar("Owned by <a href='/profile/view/POUND'>The Pound</a><br><br>"); }else{ $d->addLangVar("Owned by <a href='/profile/view/{$adopt->getOwner()}'>{$adopt->getOwner()}</a><br><br>"); } } if ($isdead) { $d->addLangvar("<div style='background:url({$mysidia->path->getAbsolute()}picuploads/paw.png); position:relative; height:248px; width:268px;'><div style='background:url({$mysidia->path->getAbsolute()}picuploads/wreath.png);height:248px; width:268px;position:absolute;z-index:30;'></div><div style='position:absolute;z-index:2;left:50px;bottom:10px'>".$adopt->getImage("gui") .'</div></div>'); }else{ if ($adopt->class == 'Colorful'){ $d->addLangvar($adopt->getImage('gui')); }else{ $d->add($adopt->getImage('gui')); } } if ($isdead){ $d->addLangvar('</div>'); } if ($adopt->isdead == false){ if($adopt->isfrozen() == 'no'){ $d->addLangvar("<br><a href='/levelup/click/{$adopt->aid}'>Play</a>"); }else{ $d->addLangvar('<br>Frozen'); } } $freeze = 'Freeze'; if ($adopt->isFrozen() == 'yes') $freeze = 'Unfreeze'; if ($mysidia->user->username == $adopt->getOwner()){ $d->addLangVar(" | <a href='/myadopts/manage/{$adopt->aid}'>Manage</a> | <a href='/myadopts/bbcode/{$adopt->aid}'>Codes</a> | <a href='/myadopts/freeze/{$adopt->aid}'>$freeze</a><br><a href='/pound/pound/{$adopt->aid}'>Pound $name</a><br> <a href='/pet/release/{$adopt->aid}'>Release $name</a>"); } $d->addLangVar('</td><td valign="top">');
$d->add(new Comment('<div id="tabs" class="c-tabs no-js"><div class="c-tabs-nav">',false));
if ($adopt->class != 'Colorful') { $d->addLangVar("<a href='#' class='c-tabs-nav__link'>Bio</a><a href='#' class='c-tabs-nav__link'>About</a>"); $d->addLangVar("</div><div class='c-tab is-active'><div class='c-tab__content'>{$adopt->getBio()}</div></div><div class='c-tab'> <div class='c-tab__content'>{$adopt->getDescription()}</div></div>"); }else{ $d->addLangVar("<a href='#' class='c-tabs-nav__link'>Bio</a><a href='#' class='c-tabs-nav__link'>Skills</a><a href='#' class='c-tabs-nav__link'>Lineage</a><a href='#' class='c-tabs-nav__link'>Offspring</a><a href='#' class='c-tabs-nav__link'>Stats</a>"); $d->addLangVar("</div><div class='c-tab is-active'> <div class='c-tab__content'>"); if ($mysidia->user->username == $adopt->getOwner()){ $d->addLangvar('<a href="/myadopts/updatebio/'.$adopt->aid.'">Click Here to Update Bio</a><br><br>'); } $d->addLangvar("{$adopt->getBio()}</div></div> <div class='c-tab'><div class='c-tab__content'><b>Trophies:</b> {$adopt->trophies}<br><br> <b>Sense:</b> {$adopt->sense}<br> <b>Speed:</b> {$adopt->speed}<br> <b>Strength:</b> {$adopt->strength}<br> <b>Stamina:</b> {$adopt->stamina}<br></div></div>");
// Lineage include('pedigree.php');
$offspring = []; $parent = 'sire_id'; if ($adopt->getGender() == 'f') $parent = 'dam_id'; $offspring = $mysidia->db->select('owned_adoptables', [], "$parent = {$adopt->aid}")->fetchAll(PDO::FETCH_CLASS,'OwnedAdoptable');
$d->addLangVar("<div class='c-tab'><div class='c-tab__content'><b>Offspring</b>"); if (count($offspring) == 0) $d->addLangVar('<hr>None.'); foreach ($offspring as $baby) { $d->addLangVar("<hr><a href='/pet/profile/{$baby->aid}'>{$baby->name}<br><img src='{$baby->getImage()}'></a>"); } $d->addLangVar('</div></div>');
$d->addLangVar("<div class='c-tab'><div class='c-tab__content'>"); $d->addLangvar("<b>Personality:</b> {$adopt->personality()}<br> <b>Happiness:</b> {$adopt->happiness}/50<br> <b>Hunger:</b> {$adopt->hunger}/50<br> <b>Thirst:</b> {$adopt->thirst}/50<br> <b>Closeness:</b> {$adopt->closeness}/50<br> "); $d->add($adopt->getStats()); if ($adopt->breeder != null) { $d->addLangvar("<br><br><b>Breeder:</b> <a href='/profile/view/{$adopt->breeder}'>{$adopt->breeder}</a>"); }
$d->addLangvar("</div></div>"); } $d->addLangVar('</td></tr></table>');
$d->add(new Comment( "<script src='/js/otherTabs.js'></script> <script> var myTabs = tabs({ el: '#tabs', tabNavigationLinks: '.c-tabs-nav__link', tabContentContainers: '.c-tab' });
myTabs.init(); </script>", FALSE)); }
public function release(){ $d = $this->document; $adopt = $this->getField('adopt'); $d->setTitle($this->lang->release); $d->addLangvar($adopt->getName().'<br>'.$adopt->getImage('gui').'<br><br>'); $d->addLangvar($this->lang->release_warning); $d->addLangvar('<br><br><form method="post" action="/myadopts/release/'.$adopt->aid.'"><label for="password">Type your password below to confirm:</label><br><input type="password" name="password"><br><input type="submit" value="Release Pet?"></form>'); }
public function bio(){ $d = $this->document; $adopt = $this->getField('adopt'); $d->setTitle('Update Bio'); $d->addLangvar($adopt->getName().'<br>'.$adopt->getImage('gui').'<br><br>'); $d->addLangvar('<form method="post"><textarea name="bio">'.$adopt->bio.'</textarea><br><input type="submit" value="Update Bio" name="submit"></form>'); }
}
Thanks in advance ^^;
Edit: Another question- how exactly do you set the companions and items to a pet?
EDIT 2-:
After installing this I also seem to be having a problem with "key" items working..
It gives me this error: Fatal error: Call to undefined function items_key() in /home/atrocity/public_html/classes/class_privateitem.php on line 109
Heres my items functions.php
PHP Code:
<?php
// File ID: functions_items.php // Purpose: Provides specific functions defined for items
function items_valuable($item, $adopt){ if (check_stats() == true){ $note = "{$item->itemname} has been used on {$adopt->name}."; $item->remove(); return $note; } return "The item {$item->itemname} is a valuable item, which cannot be used on any adoptable but may sell for a good deal of money."; } function items_chiku1($item, $adopt){ $mysidia = Registry::get("mysidia"); $mysidia->db->update("owned_adoptables", array("type" => 'Chiku-Banzai'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "The item has been successfully used on your adoptable, it is now a {$adopt->type}!<br>"; //Update item quantity... $delitem = $item->remove(); return $note; } function items_luv1($item, $adopt){ $mysidia = Registry::get("mysidia"); $mysidia->db->update("owned_adoptables", array("type" => 'Luv-Bug'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "The item has been successfully used on your adoptable, it is now a {$adopt->type}!<br>"; //Update item quantity... $delitem = $item->remove(); return $note; } function items_zoey1($item, $adopt){ $mysidia = Registry::get("mysidia"); $mysidia->db->update("owned_adoptables", array("type" => 'Zoey'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "The item has been successfully used on your adoptable, it is now a {$adopt->type}!<br>"; //Update item quantity... $delitem = $item->remove(); return $note; } function items_smoke1($item, $adopt){ $mysidia = Registry::get("mysidia"); $mysidia->db->update("owned_adoptables", array("type" => 'Smoke'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "The item has been successfully used on your adoptable, it is now a {$adopt->type}!<br>"; //Update item quantity... $delitem = $item->remove(); return $note; }
function items_level1($item, $adopt){ $mysidia = Registry::get("mysidia"); $newlevel = $adopt->currentlevel + $item->value; $lev = $mysidia->db->select("levels", array(), "adoptiename='{$adopt->type}' and thisislevel ='{$newlevel}'")->fetchObject(); //Check if the adoptable's level is already at maximum. if(!is_object($lev)){ // object not created, the level is already at maximum. $note = "Unfortunately, your selected adoptable's level cannot be raised by using item {$item->itemname}."; } else{ //Update item quantity... $delitem = $item->remove(); //Execute the script to update adoptable's level and clicks. $mysidia->db->update("owned_adoptables", array("currentlevel" => $newlevel, "totalclicks" => $lev->requiredclicks), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "Congratulations, the item {$item->itemname} raised your adoptable's level by {$item->value}"; } return $note; }
function items_level2($item, $adopt){ $mysidia = Registry::get("mysidia"); $newlevel = $item->value; $lev = $mysidia->db->select("levels", array(), "adoptiename='{$adopt->type}' and thisislevel ='{$newlevel}'")->fetchObject();
//Check if the adoptable's level is already at maximum. if(!is_object($lev)){ // object not created, the level is already at maximum. $note = "Unfortunately, your selected adoptable's level cannot be raised by using item {$item->itemname}."; } else{ //Update item quantity... $delitem = $item->remove(); //Execute the script to update adoptable's level and clicks. $mysidia->db->update("owned_adoptables", array("currentlevel" => $newlevel, "totalclicks" => $lev->requiredclicks), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "Congratulations, the item {$item->itemname} increases your adoptable's level to {$item->value}"; } return $note; }
function items_level3($item, $adopt){ $mysidia = Registry::get("mysidia"); //Update item quantity... $delitem = $item->remove(); //Execute the script to update adoptable's level and clicks. $mysidia->db->update("owned_adoptables", array("currentlevel" => 0, "totalclicks" => 0), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "Congratulations, the item {$item->itemname} has reset the level and clicks of your adoptable."; return $note; }
function items_click1($item, $adopt){ $mysidia = Registry::get("mysidia"); $newclicks = $adopt->totalclicks + $item->value; $mysidia->db->update("owned_adoptables", array("totalclicks" => $newclicks), "aid='{$adopt->aid}'and owner='{$item->owner}'"); $note = "By using {$item->itemname}, the adoptable's total number of clicks has raised by {$item->value}<br>"; //Now lets check if the adoptable has reached a new level. $ownedAdopt = new OwnedAdoptable($adopt->aid); if($ownedAdopt->hasNextLevel()){ //new level exists, time to check if the total clicks have reached required minimum clicks for next level. $nextLevel = $ownedAdopt->getNextLevel(); $requiredClicks = $nextLevel->getRequiredClicks(); if($newclicks >= $requiredClicks and $requiredClicks != 0 and $requiredClicks != ""){ // We need to level this adoptable up... $mysidia->db->update("owned_adoptables", array("currentlevel" => $nextLevel->getLevel()), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note .= "And moreover, it has gained a new level!"; } } //Update item quantity... $delitem = $item->remove(); return $note; }
function items_click2($item, $adopt){ $mysidia = Registry::get("mysidia"); $newclicks = $item->value; $mysidia->db->update("owned_adoptables", array("totalclicks" => $newclicks), "aid='{$adopt->aid}'and owner='{$item->owner}'"); $note = "By using {$item->itemname}, the adoptable's total number of clicks has raised by {$item->value}<br>"; //Now lets check if the adoptable has reached a new level. $ownedAdopt = new OwnedAdoptable($adopt->aid); if($ownedAdopt->hasNextLevel()){ //new level exists, time to check if the total clicks have reached required minimum clicks for next level. $nextLevel = $ownedAdopt->getNextLevel(); $requiredClicks = $nextLevel->getRequiredClicks(); if($newclicks >= $requiredClicks and $requiredClicks != 0 and $requiredClicks != ""){ // We need to level this adoptable up... $mysidia->db->update("owned_adoptables", array("currentlevel" => $nextlevel), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note .= "And moreover, it has gained a new level!"; } }
//Update item quantity... $delitem = $item->remove(); return $note; }
function items_click3($item, $adopt){ $mysidia = Registry::get("mysidia"); $date = date('Y-m-d'); $mysidia->db->delete("vote_voters", "adoptableid = '{$adopt->aid}' and date='{$date}'"); //Update item quantity... $delitem = $item->remove(); $note = "By using item {$item->name}, you have make your adoptables eligible for clicking by everyone again!"; return $note; }
function items_breed1($item, $adopt){ $mysidia = Registry::get("mysidia"); // Update the lastbred info. $mysidia->db->update("owned_adoptables", array("lastbred" => 0), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "The item has been successfully used on your adoptable, it can breed again!<br>"; //Update item quantity... $delitem = $item->remove(1, $item->owner); return $note; }
function items_breed2($item, $adopt){ $mysidia = Registry::get("mysidia"); // Note this function exists but is not useful until Mys v1.3.2, when adoptables can carry/attach items. $mysidia->db->update("owned_adoptables", array("lastbred" => 0), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "The item has been successfully used on your adoptable, it can breed again!<br>"; //Update item quantity... $delitem = $item->remove(); return $note; } function items_alts1($item, $adopt){ $mysidia = Registry::get("mysidia"); // First lets check if alternative image exists for an adoptable at this level. $lev = $mysidia->db->select("levels", array(), "adoptiename='{$adopt->type}' and thisislevel ='{$adopt->currentlevel}'")->fetchObject(); if($lev->alternateimage == ""){ // The alternate image does not exist, cannot convert adoptable into its alternate form $note = "It appears that your adoptable does not have an alternate image at its given level...<br>"; } else{ // The alternate image exists, conversion between primary and alternate image is possible. switch($adopt->usealternates){ case "yes": $mysidia->db->update("owned_adoptables", array("usealternates" => 'no'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "Your adoptable has assume the species primary form."; break; default: $mysidia->db->update("owned_adoptables", array("usealternates" => 'yes'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "Your adoptable {$adopt->name} has assume the species alternate form."; } //Update item quantity... $delitem = $item->remove(); return $note; }
function items_alts2($item, $adopt){ $note = "This feature will be available soon after we redesign the adoptable class, enjoy!"; return $note; }
function items_recipe($item, $adopt){ if (check_stats($item) == false){ return "The item {$item->itemname} is a recipe item, which is only useful if you are preforming alchemy."; } $note = "The item {$item->itemname} is a recipe item, which is more useful if you are performing alchemy. However your {$adopt->name} has greedily used it up anyway!"; $item->remove(); return $note; }
function items_name1($item, $adopt){ $note = "umm just realized that people can change adoptables names freely, will have to think about it later."; return $note; }
function items_name2($item, $adopt){ $note = "For now the items can only be used on adoptables, so user-based item usage will be implemented later."; return $note; }
/* Increase players pet storage size */ function items_space($item) { $mysidia = Registry::get("mysidia"); $max = $mysidia->user->getStatus()->max_pets; $limit = $mysidia->getSettings()->maximumpets; if ($max >= $limit) return $mysidia->lang->global_sitewide_maximum_pets_reached; $newMax = $max+$item->value; if ($newMax > $limit) return "Sorry but you can't use {$item}, it'd increase your size beyond the site pet limits.";
$mysidia->db->update('users_status', ['max_pets'=>$newMax], "username='{$mysidia->user->username}'"); $delitem = $item->remove(); return $mysidia->lang->global_size_increase_item_used; }
function items_key($item) { if (check_stats($item) == false) { return "This {$item->itemname} can not be used on your pet."; } $item->remove(); return $item->itemname . ' has been used.'; }
function check_stats($item) { $stats = ['hunger', 'thirst', 'closeness', 'happiness']; foreach ($stats as $s) { if ($item->$s != 0) { return TRUE; } } function items_unbindingcompanion($item, $adopt){ $mysidia = Registry::get("mysidia"); if ($adopt->companion != "nocompanion") { $itemgive = new StockItem($adopt->companion); $itemgive->append(1, $mysidia->user->username); }
$mysidia->db->update("owned_adoptables", array("companion" => 'nocompanion'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "You use the <b>{$item->itemname}</b> on your pet, breaking the bond between it and its companion. The companion has been returned to your inventory!<br /><br /> <a href='/inventory'><button type='button'>Return to Inventory</button></a><br>"; //Update item quantity... $delitem = $item->remove(); return $note; }
function items_unbindingitem($item, $adopt){ $mysidia = Registry::get("mysidia"); if ($adopt->item != "noitem") { $itemgive = new StockItem($adopt->item); $itemgive->append(1, $mysidia->user->username); }
$mysidia->db->update("owned_adoptables", array("item" => 'noitem'), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "You use the <b>{$item->itemname}</b> on your pet, breaking the bond between it and its held item. The held item has been returned to your inventory!<br /><br /> <a href='/inventory'><button type='button'>Return to Inventory</button></a><br>"; //Update item quantity... $delitem = $item->remove(); return $note; } function items_companion($item, $adopt){ $mysidia = Registry::get("mysidia"); if ($adopt->companion != "nocompanion") { $itemgive = new StockItem($adopt->companion); $itemgive->append(1, $mysidia->user->username); } $companion = $item->itemname; $mysidia->db->update("owned_adoptables", array("companion" => $companion), "aid ='{$adopt->aid}' and owner='{$item->owner}'"); $note = "You have given your pet a <b>{$item->itemname}</b>! It will now show up in your pet's profile. <br /><br /> <a href='http://mysgardia.com/inventory'><button type='button'>Return to Inventory</button></a><br>"; //Update item quantity... $delitem = $item->remove(); return $note; } return FALSE; } } ?>
Im really sorry that I suck at this so much x.x Im trying honest.
EDIT: I was trying to make it so that there was a seperate button for "Giving items to pets" For the Held items and pet companions because I have some items that can actually be used that I'd like them o be able to hold without using them for the stats.... This is what I tried to Do in my Inventoryview.php... in the Use area..
PHP Code:
# Rendering items now $document->add(new Comment(" <div class=\"s_panel sc_item\"> <img rel=\"tooltip\" title=\"{$item->description} <em>{$usage}</em>\" src=\"{$item->imageurl}\"/><br/> <b>{$item->itemname}</b><br> Own ×{$item->quantity}<br/>", FALSE));
# If item is consumable, add use button if ($item->consumable == "yes") { $useForm = new FormBuilder("useform", "inventory/uses", "post"); $useForm->setLineBreak(FALSE); $useForm->buildPasswordField("hidden", "action", "uses") ->buildPasswordField("hidden", "itemname", $item->itemname) ->buildButton("Use", "use", "use"); $document->add($useForm); } if ($item->helditem == "yes") { $useForm = new FormBuilder("useform", "inventory/uses", "post"); $useForm->setLineBreak(FALSE); $useForm->buildPasswordField("hidden", "action", "uses") ->buildPasswordField("hidden", "itemname", $item->itemname) ->buildButton("Give to Pet", "Give to Pet", "Give to Pet"); $document->add($useForm); } if ($item->companion == "yes") { $useForm = new FormBuilder("useform", "inventory/uses", "post"); $useForm->setLineBreak(FALSE); $useForm->buildPasswordField("hidden", "action", "uses") ->buildPasswordField("hidden", "itemname", $item->itemname) ->buildButton("Give to Pet", "Give to Pet", "Give to Pet"); $document->add($useForm); }
Im really trying to figure this out.. x.x
Last edited by Ittermat; 12-14-2016 at 10:09 PM.
|