
12-23-2014, 02:48 AM
|
 |
Premium Member
|
|
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 125,355
|
|
Inventory I'm also pleased to present a semi-matching Inventory view. The embedded stylesheet is identical to the shop mod above, therefore, if you already moved it to your actual css stylesheet, you won't need it here (my example here has .sc_item set with a width, the one in the shop mod above does not, but I did mention it's potential usage). ^^

Replace the index function in view/inventoryview.php:
PHP Code:
public function index(){ $mysidia = Registry::get("mysidia"); $document = $this->document; $document->setTitle($mysidia->lang->inventory); $inventory = $this->getField("inventory"); $document->add(new Comment(" <style> .sc_item { display: inline-table; padding: 5px; text-align: center; font-family: 'Trebuchet MS', Helvetica, sans-serif; font-size: 14px; margin-bottom: 3px; width: 120px; } .s_panel { border-radius: 2px; border: 1px solid #CCC; background-color: #FBFDF2; } </style> ", FALSE)); $iids = $inventory->getiids(); for($i = 0; $i < $iids->length(); $i++){ $item = $inventory->getitem($iids[$i]); # Descriptions of the item functions switch ($item->function) { case "Click1": $usage = "<br/><b>use:</b> Feed a pet to give them {$item->value} EXP."; break; case "Click2": $usage = "<br/><b>use:</b> Feed a pet to set their EXP to {$item->value}."; break; case "Click3": $usage = "<br/><b>use:</b> Resets EXP earned today to 0."; break; case "Level1": $usage = "<br/><b>use:</b> Raises the Level of your pet by {$item->value}."; break; case "Level2": $usage = "<br/><b>use:</b> Sets the Level of your pet to {$item->value}."; break; case "Level3": $usage = "<br/><b>use:</b> Makes your pet Level 0 again!"; break; case "Gender": $usage = "<br/><b>use:</b> Swaps the gender of your pet to its opposite!"; break; default; $usage = ""; break; } # End item function descriptions
# 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); }
# Add sellback button so long as the item is not a key item $sellback = $item->price / 2; $document->add(new Comment("<hr>{$sellback} {$mysidia->settings->cost} Each ", FALSE)); if($item->category != "Key Items") { $sellForm = new FormBuilder("sellform", "inventory/sell", "post"); $sellForm->setLineBreak(FALSE); $sellForm->buildPasswordField("hidden", "action", "sell") ->buildPasswordField("hidden", "itemname", $item->itemname); $quantity = new TextField("quantity"); $quantity->setSize(3); $quantity->setMaxLength(3); $quantity->setLineBreak(FALSE);
$sell = new Button("Sell", "sell", "sell"); $sell->setLineBreak(FALSE);
$sellForm->add($quantity); $sellForm->add($sell); $document->add($sellForm); }
$document->add(new Comment("</div>", FALSE));
} # END item for loop
} # END index function
Emphasis: Please replace the index function, not the entire file.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Last edited by Kyttias; 02-15-2016 at 07:53 PM.
|