View Single Post
  #29  
Old 02-15-2016, 04:31 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 88,507
Kyttias is on a distinguished road
Default

About the Inventory - you're absolutely right, although... I was going off of existing code in class_itemtablehelper.php, which used if($item->category == "Key Items") return "N/A"; . . . . obviously, yeah, that'd only take effect if the item's category was "Key Items".

It'd probably be better to check for $item->function.

I updated the chunk of code above, but also here -
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 &times;{$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->function !== "Key") {
                
$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 
If the problem persists, perhaps try changing it to "!=" instead of "!==".

Anyway, do the tooltips work on the Inventory, but not elsewhere? Do any of your item names or descriptions happen to have apostrophes or quotations in them (this might be relevant and would be good to know, I thought I'd caught all of this).
__________________
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.
Reply With Quote