Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.3.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=42)
-   -   Mys v1.3.4 Item Shop Mod(s): NPC + Item Display + Tooltips (http://www.mysidiaadoptables.com/forum/showthread.php?t=4741)

tahbikat 02-05-2016 03:58 PM

@Ittermat In class_itemshop.php, you basically replace the whole public function display section. Clicking the first opening bracket next to 'public function display' should also highlight the closing bracket. So you take everything inside that, erase it, and replace with new code. Make sure to save your original code first.

Ittermat 02-05-2016 03:59 PM

Okay so...Can we make this a bit easier?

We start at public display- and end at? where? XD

Kyttias 02-05-2016 05:53 PM

End at the end of the display function. Brackets always line up. You'll have to see where that function ends. In a text editor meant for code, such as Sublime Text 2 or Notepad++, syntax highlighting will help you recognize where code ends and begins, and as Tahbikat said, if you click on a bracket, the closing bracket will highlight itself, showing where it ends.

Anyway, obviously one function must end before the next begins. Just look for the start of the next one?

Ittermat 02-05-2016 06:08 PM

ohhh!! OKAY! See I didnt know that small bit of info... actually that will help alot and puts a main puzzle piece in place! thank you!

Corsair 02-14-2016 11:35 AM

For some reason tool tips will not work (in shop or inventory) even after following all the steps. I'm not sure if it's because I'm using the bookstore theme. I double checked the tootip.css, tooltip.js and the header file.

Kyttias 02-14-2016 12:04 PM

Does that theme have jQuery? If not, include a link to the jQuery library. For the tooltips to work, its .js file must come after jQuery, as it is dependant on it. Keep in mind that this may break your profile pages since they come with their own link to jQuery and having two links to different versions will cause errors on that page!

This should have been covered in section 2, in the third code block.

Corsair 02-14-2016 03:24 PM

I did follow that part as well but no luck. So I thought i'd ask just in case. I'm going to go over it a third time to see if I missed something.

Corsair 02-15-2016 12:31 AM

Unrelated to my last post but I'm having a issue with key items being able to be sold in the inventory.

I saw:
Quote:

if($item->category !== "Key Items") {
So I assumed if the category was "Key Items" that would fix it but I got a error.
Quote:

Catchable fatal error: Argument 1 passed to GUIContainer::add() must be an instance of GUIComponent, null given, called in /home/monstari/public_html/view/inventoryview.php on line 72 and defined in /home/monstari/public_html/classes/class_guicontainer.php on line 361
I tried to I tried to figure it out but I am stumped. I am not to far along my php studies so maybe the fix is right in front of my face but I can't see it.

Kyttias 02-15-2016 04:31 AM

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).

Corsair 02-15-2016 10:11 AM

I seem to be getting the same error even after changing the !== to !=

Quote:

Catchable fatal error: Argument 1 passed to GUIContainer::add() must be an instance of GUIComponent, null given, called in /home/monstari/public_html/view/inventoryview.php on line 72 and defined in /home/monstari/public_html/classes/class_guicontainer.php on line 361
As for tooltips they do show up in both shops and the inventory but as plan boxes. I did move the CSS to the main theme but I don't think that's it either.

http://orig05.deviantart.net/c6e0/f/...ir-d9ruuyf.png

I'm not sure if it's related but I've been noticing errors with drop downs and radio buttons related to this GUIContainer even in the admin panel where I have your bootstrap theme installed.


All times are GMT -5. The time now is 04:41 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.