Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #21  
Old 12-14-2016, 01:45 AM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 38,344
Ittermat is on a distinguished road
Default

Okay- I got it to mostly work XD Im still havign issues though- For example I did the calling codes etc- but It still wont show me the amount-

Instead for my pet it says "Spooka has Trophies"

No number..I must be missing something...

Heres my adoptsview.php file-

PHP Code:
<?php

use Resource\Native\String;
use 
Resource\Collection\LinkedList;
use 
Resource\Collection\LinkedHashMap;

class 
MyadoptsView extends View{

    
/**
     * @throws Exception
     */
    
public function index(){
        
$document $this->document;
        
$document->setTitle($this->lang->title);

        
$groups $this->getField('groups');


        
$document->add($this->getField('pet_storage_info'));

        
$pagination $this->getField("pagination");
        
$stmt $this->getField("stmt")->get();
        if(
$stmt->rowCount() == 0){
            
$document->addLangvar($this->lang->empty);
            return;
        }

        
$adopts $stmt->fetchAll(PDO::FETCH_CLASS,'OwnedAdoptable');

        foreach (
$adopts as $a)
        {
            if (
$a->class == 'Colorful') {
              
$categoryArray[] = $a->type;
            }
            else{
              
$categoryArray[] = $a->class;
            }
        }

        
$categories array_unique($categoryArray);

        
$document->add(new Comment('<div id="tabs" class="c-tabs no-js">',false));

        foreach (
$categories as $tab) {
            
$document->add(new Comment("<a href='#' class='c-tabs-nav__link'>$tab</a>"FALSE));
        }

        
$i 0;
        
// Style for inventory like display.
        
$document->add(new Comment('<style>
            .sc_pet {
                display: inline-table;
                padding: 5px;
                text-align: center;
                font-family: "Trebuchet MS", Helvetica, sans-serif;
                font-size: 14px;
                margin-bottom: 3px;
                height: 300px;
            }
            .s_pet_panel {
                border-radius: 2px;
                border: 1px solid #CCC;
            }
        </style>'
FALSE));


        
$document->add(new Comment("<div class='c-tab is-active'>
            <div class='c-tab__content'>"
FALSE));

        
/*
        $adoptTable = new TableBuilder("adopttable", 650);
        $adoptTable->setAlign(new Align("center", "middle"));
        $adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
        */
        
foreach ($adopts as $adopt) {
            if (
$adopts[$i]->class == 'Colorful') {
                
$adopts[$i]->class $adopts[$i]->type;
                
$adopts[$i]->type 'Colorful';
            }
            if (
$i != AND ($adopts[$i]->class != $adopts[$i-1]->class))
            {
                
//$document->add($adoptTable);
                
$document->add(new Comment('</div></div>',false));
                
$document->add(new Comment('<div class="c-tab"><div class="c-tab__content">',false));

                
/*
                $adoptTable = new TableBuilder("adopttable", 650);
                $adoptTable->setAlign(new Align("center", "middle"));
                $adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
                */
            
}

            
// Display Like Inventory System
            
$document->add(new Comment("<div class='s_pet_panel sc_pet'>"));
            
$document->add(new Comment("<em>{$adopt->getName()}</em>",false));
            
$document->add($adopt->getGender("gui"));
            
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}""<br><img src='{$adopt->getImageFromWithin()}'>"));
            
               
                                     
                                
$document->add(new Comment("<br>Total Clicks: {$adopt->getTotalClicks()} for Current Level: {$adopt->getCurrentLevel()}",false));
            
$document->add(new Comment("</div>"FALSE));

            
/* Table Display
            $cells = new LinkedList;
            $cells->add(new TCell($adopt->getGender("gui")));
            $cells->add(new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}"));
            $cells->add(new TCell(new Link("myadopts/manage/{$adopt->getAdoptID()}", "<img src='{$adopt->getImageFromWithin()}'>")));
            $cells->add(new TCell($adopt->getTotalClicks()));
            $cells->add(new TCell($adopt->getCurrentLevel()));
            $adoptTable->buildRow($cells);
            */

            
$i++;
        }
        
//$document->add($adoptTable);

        
$document->add(new Comment(
            
"</div></div><script src='/js/otherTabs.js'></script>
            <script>
                var myTabs = tabs({
                    el: '#tabs',
                    tabNavigationLinks: '.c-tabs-nav__link',
                    tabContentContainers: '.c-tab'
                });

                myTabs.init();
            </script>"
FALSE));

        
/* Old original display code
        $adoptTable = new TableBuilder("adopttable", 650);
        $adoptTable->setAlign(new Align("center", "middle"));
        $adoptTable->buildHeaders("Gender", "Name/Type", "Image", "Clicks", "Level");
        while($aid = $stmt->fetchColumn()){
            $adopt = new OwnedAdoptable($aid);
            $cells = new LinkedList;
            $cells->add(new TCell($adopt->getGender("gui")));
            $cells->add(new TCell("<em>{$adopt->getName()}</em> the {$adopt->getType()}"));
            $cells->add(new TCell(new Link("myadopts/manage/{$aid}", $adopt->getImage("gui"))));
            $cells->add(new TCell($adopt->getTotalClicks()));
            $cells->add(new TCell($adopt->getCurrentLevel()));
            $adoptTable->buildRow($cells);
        }
        $document->add($adoptTable);
        */

        
$document->addLangvar($pagination->showPage());

    }

    public function 
manage(){
           
        
$mysidia Registry::get("mysidia");
        
$aid $this->getField("aid")->getValue();
        
$name $this->getField("name")->getValue();
        
$image $this->getField("image");

        
$document $this->document;        
        
$document->setTitle("Managing {$name}");
            
        
$document->add($image);
        
$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br>
 <center>
{$name} has {$trophies} trophies!</center><br>"));
        
$document->add(new Link("pet/profile/$aid"' View Public Profile'TRUE));
        
$document->add(new Image("templates/icons/add.gif"));
        
$document->add(new Link("levelup/click/{$aid}"" Level Up {$name}"TRUE));
        
$document->add(new Image("templates/icons/stats.gif"));
        
$document->add(new Link("myadopts/stats/{$aid}"" Get Stats for {$name}"TRUE));
        
$document->add(new Image("templates/icons/bbcodes.gif"));
        
$document->add(new Link("myadopts/bbcode/{$aid}"" Get BBCodes / HTML Codes for {$name}"TRUE));
        
$document->add(new Image("templates/icons/title.gif"));
        
$document->add(new Link("myadopts/rename/{$aid}"" Rename {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/trade.gif"));
        
$document->add(new Link("myadopts/trade/{$aid}"" Change Trade status for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/freeze.gif"));
        
$document->add(new Link("myadopts/freeze/{$aid}"" Freeze or Unfreeze {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/delete.gif"));
        
$document->add(new Link("pound/pound/{$aid}"" Pound {$name}"TRUE)); 
        
    }

    public function 
stats(){
        
$mysidia Registry::get("mysidia");
        
$adopt $this->getField("adopt");        
        
$image $this->getField("image");
        
$stmt $this->getField("stmt")->get();

        
$document $this->document;            
        
$document->setTitle($adopt->getName().$this->lang->stats);
        
$document->add($image);    
        
$document->add($adopt->getStats());                                              
        
$document->addLangvar("<h2>{$adopt->getName()}'s Voters:</h2><br>{$this->lang->voters}<br><br>");    

        
$fields = new LinkedHashMap;
        
$fields->put(new String("username"), new String("getUsername"));
        
$fields->put(new String("date"), NULL);
        
$fields->put(new String("username::profile"), new String("getProfileImage"));
        
$fields->put(new String("username::message"), new String("getPMImage"));

        
$voterTable = new TableBuilder("voters"500);
        
$voterTable->setAlign(new Align("center"));
        
$voterTable->buildHeaders("User""Date Voted""Profile""PM");
        
$voterTable->setHelper(new UserTableHelper);
        
$voterTable->buildTable($stmt$fields);
        
$document->add($voterTable);
    }

    public function 
bbcode(){
        
$mysidia Registry::get("mysidia");
        
$adopt $this->getField("adopt");            
        
$document $this->document;
        
$document->setTitle($this->lang->bbcode.$adopt->getName()); 
        
$document->addLangvar($this->lang->bbcode_info);
        
$document->add(new Comment("<br>"));

        
$forumComment = new Comment("Forum BBCode: ");        
        
$forumComment->setUnderlined();
        
$forumcode "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}[/img][/url]";        
        
$forumArea = new TextArea("forumcode"$forumcode450);
        
$forumArea->setReadOnly(TRUE);

        
$altComment = new Comment("Alternative BBCode: ");        
        
$altComment->setUnderlined();
        
$altcode "[url={$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}][img]{$mysidia->path->getAbsolute()}get/{$adopt->getAdoptID()}"[/img][/url]";
        
$altArea = new TextArea("altcode", $altcode, 4, 50);
        
$altArea->setReadOnly(TRUE);

        
$htmlComment = new Comment("HTML BBCode");        
        
$htmlComment->setUnderlined();
        
$htmlcode = "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$adopt->getAdoptID()}' target='_blank'>
<
img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$adopt->getAdoptID()}' border=0></a>";
        
$htmlArea = new TextArea("htmlcode", $htmlcode, 4, 50);
        
$htmlArea->setReadOnly(TRUE);

        
$document->add($forumComment);
        
$document->add($forumArea);
        
$document->add($altComment);
        
$document->add(($mysidia->settings->usealtbbcode == "yes")?$altArea:new Comment("The Admin has disabled Alt BBCode for this site."));
        
$document->add($htmlComment);
        
$document->add($htmlArea);
    }

    public function rename(){
        
$mysidia = Registry::get("mysidia");
        
$adopt = $this->getField("adopt");        
        
$image = $this->getField("image");        
        
$document = $this->document;

        if(
$mysidia->input->post("submit")){
            
$document->setTitle($this->lang->rename_success_title);
            
$document->add($image);
            
$message = "<br>{$this->lang->rename_success}{$mysidia->input->post("adoptname")}. 
            
You can now manage {$mysidia->input->post("adoptname")} on the";
            
$document->addLangvar($message);
            
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));
            return;
        }

        
$document->setTitle($this->lang->rename.$adopt->getName());
        
$document->add($image);
        
$document->addLangvar("<br />{$this->lang->rename_default}{$adopt->getName()}{$this->lang->rename_details}<br />");

        
$renameForm = new FormBuilder("renameform", "", "post");
        
$renameForm->buildTextField("adoptname")->buildButton("Rename Adopt", "submit", "submit");
        
$document->add($renameForm);           
    }

    public function updatebio(){
 
        
$mysidia = Registry::get('mysidia');
        
$adopt = $this->getField('adopt');
        
$d = $this->document;
        
$d->setTitle($this->lang->updatebio . $adopt->getName());
        
$d->addLangvar('<form method="post"><textarea name="bio" rows="10" cols="50">'.$adopt->getBio().'</textarea><br><input type="submit" name="submit" value="Update Bio"></form>');
      
    }

    public function trade(){
        
$mysidia = Registry::get("mysidia");
        
$aid = $this->getField("aid")->getValue();        
        
$image = $this->getField("image");    
        
$message = $this->getField("message")->getValue();        
        
$document = $this->document;
        
$document->setTitle($this->lang->trade);
        
$document->add($image);
        
$document->addLangvar($message);
    }

    public function freeze(){
        
$mysidia = Registry::get("mysidia");
        
$adopt = $this->getField("adopt");        
        
$image = $this->getField("image");    
        
$message = $this->getField("message")->getValue();            
        
$document = $this->document;        
        
$document->setTitle($this->lang->freeze);    

        if(
$mysidia->input->get("confirm") == "confirm"){
            
$document->addLangvar($message);
            
$document->add(new Link("myadopts/manage/{$adopt->getAdoptID()}", "My Adopts Page"));        
        }     
        else{
            
$document->add($image);
            
$document->add(new Comment("<br /><b>{$adopt->getName()}'s Current Status: "));

            if($adopt->isfrozen() == "yes"){                
                $document->add(new Image("templates/icons/freeze.gif", "Frozen"));
                $document->add(new Comment("Frozen<br<br>"));
                $document->add(new Comment($this->lang->freeze));
                $document->add(new Image("templates/icons/unfreeze.gif", "Unfreeze"));
                $document->addLangvar("<form method='
post''><input type='submit' name='confirm' value='Unfreeze {$adopt->getName()}' class='button'></form>");
                //
$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Unfreeze this Adoptable", TRUE));
            }
            else{
                
$document->add(new Image("templates/icons/unfreeze.gif", "Not Frozen"));
                
$document->add(new Comment("Not Frozen<br><br>"));
                
$document->add(new Comment($this->lang->freeze));
                
$document->add(new Image("templates/icons/freeze.gif", "Greeze"));
                
$document->addLangvar("<form method='post'><input type='submit' name='confirm' value='Freeze {$adopt->getName()}' class='button'></form>");
                //
$document->add(new Link("myadopts/freeze/{$adopt->getAdoptID()}/confirm", "Freeze this Adoptable", TRUE));
            }
            
$document->add(new Comment("<br><br>"));
            
$document->add(new Image("templates/icons/warning.gif"));
            
$document->addLangvar($this->lang->freeze_warning);
        }
    }

    public function release(){
        
$document = $this->document;        
        
$document->setTitle($this->lang->released);
        
$document->addLangvar($this->lang->pet_released);  
    }
}
The other issue Is im trying to Add the trophies also to the Petview.php

But my coder added stuff and Im not sure how to do that.. I want it in the "Skills" Tab...

Here's my Petviewphp..

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>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.. Sorry im such a noob
Reply With Quote
  #22  
Old 12-14-2016, 09:35 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 132,404
Abronsyth is on a distinguished road
Default

In the myadopts.view I see that you place {$trophies} but I do not see anywhere that you actually designated what $trophies means, so that script basically doesn't know what you're asking it to show. Here's a version I modified of your manage function, try using it and let me know if it works:
PHP Code:
    public function manage(){ 
            
        
$mysidia Registry::get("mysidia"); 
        
$aid $this->getField("aid")->getValue(); 
        
$name $this->getField("name")->getValue(); 
        
$image $this->getField("image"); 
        
$trophies $mysidia->db->select("owned_adoptables", array("trophies"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn();

        
$document $this->document;         
        
$document->setTitle("Managing {$name}"); 
             
        
$document->add($image); 
        
$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br> 
 <center>
{$name} has {$trophies} trophies!</center><br>")); 
        
$document->add(new Link("pet/profile/$aid"' View Public Profile'TRUE)); 
        
$document->add(new Image("templates/icons/add.gif")); 
        
$document->add(new Link("levelup/click/{$aid}"" Level Up {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/stats.gif")); 
        
$document->add(new Link("myadopts/stats/{$aid}"" Get Stats for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/bbcodes.gif")); 
        
$document->add(new Link("myadopts/bbcode/{$aid}"" Get BBCodes / HTML Codes for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/title.gif")); 
        
$document->add(new Link("myadopts/rename/{$aid}"" Rename {$name}"TRUE));  
        
$document->add(new Image("templates/icons/trade.gif")); 
        
$document->add(new Link("myadopts/trade/{$aid}"" Change Trade status for {$name}"TRUE));  
        
$document->add(new Image("templates/icons/freeze.gif")); 
        
$document->add(new Link("myadopts/freeze/{$aid}"" Freeze or Unfreeze {$name}"TRUE));  
        
$document->add(new Image("templates/icons/delete.gif")); 
        
$document->add(new Link("pound/pound/{$aid}"" Pound {$name}"TRUE));  
         
    } 
OK, so I think this should work for petview.php (cool system, btw), just replace the file with this;
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>Trohpies:</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>'); 
           
    } 
     

}
Let me know if this works!
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #23  
Old 12-14-2016, 10:24 AM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 38,344
Ittermat is on a distinguished road
Default

Okay the one for myadopts.php gives me this error

Fatal error: Call to a member function getAdoptID() on null in /home/atrocity/public_html/view/myadoptsview.php on line 157

second one works like a charm ^^
Reply With Quote
  #24  
Old 12-14-2016, 03:29 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 132,404
Abronsyth is on a distinguished road
Default

Did you put it into myadoptsview.php or myadopts.php?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #25  
Old 12-14-2016, 03:33 PM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 38,344
Ittermat is on a distinguished road
Default

in myadoptsview
Reply With Quote
  #26  
Old 12-14-2016, 07:16 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 132,404
Abronsyth is on a distinguished road
Default

Alright, try changing the manage function in myadoptsview.php to this:
PHP Code:
   public function manage(){ 
            
        
$mysidia Registry::get("mysidia"); 
        
$aid $this->getField("aid")->getValue(); 
        
$name $this->getField("name")->getValue(); 
        
$image $this->getField("image"); 
        
$trophies $mysidia->db->select("owned_adoptables", array("trophies"), "aid = '{$aid}'")->fetchColumn();

        
$document $this->document;         
        
$document->setTitle("Managing {$name}"); 
             
        
$document->add($image); 
        
$document->add(new Comment("<br><br>This page allows you to manage {$name}.  Click on an option below to change settings.<br> 
 <center>
{$name} has {$trophies} trophies!</center><br>")); 
        
$document->add(new Link("pet/profile/$aid"' View Public Profile'TRUE)); 
        
$document->add(new Image("templates/icons/add.gif")); 
        
$document->add(new Link("levelup/click/{$aid}"" Level Up {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/stats.gif")); 
        
$document->add(new Link("myadopts/stats/{$aid}"" Get Stats for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/bbcodes.gif")); 
        
$document->add(new Link("myadopts/bbcode/{$aid}"" Get BBCodes / HTML Codes for {$name}"TRUE)); 
        
$document->add(new Image("templates/icons/title.gif")); 
        
$document->add(new Link("myadopts/rename/{$aid}"" Rename {$name}"TRUE));  
        
$document->add(new Image("templates/icons/trade.gif")); 
        
$document->add(new Link("myadopts/trade/{$aid}"" Change Trade status for {$name}"TRUE));  
        
$document->add(new Image("templates/icons/freeze.gif")); 
        
$document->add(new Link("myadopts/freeze/{$aid}"" Freeze or Unfreeze {$name}"TRUE));  
        
$document->add(new Image("templates/icons/delete.gif")); 
        
$document->add(new Link("pound/pound/{$aid}"" Pound {$name}"TRUE));  
         
    } 
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #27  
Old 12-14-2016, 07:34 PM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 38,344
Ittermat is on a distinguished road
Default

That worked thanks!
Reply With Quote
  #28  
Old 12-15-2016, 08:08 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 132,404
Abronsyth is on a distinguished road
Default

Great! Let me know if you have other problems.
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #29  
Old 12-15-2016, 07:10 PM
Corsair's Avatar
Corsair Corsair is offline
Member
 
Join Date: Jan 2012
Posts: 128
Gender: Female
Credits: 13,262
Corsair is on a distinguished road
Default

I'm not sure if I did something wrong when I changed the price of training but I absentmindedly pressed the button for training while I testing and noticed my money was in the negative.
Reply With Quote
  #30  
Old 12-16-2016, 03:20 PM
lotus's Avatar
lotus lotus is offline
Member
 
Join Date: Oct 2016
Posts: 7
Gender: Female
Credits: 1,043
lotus is on a distinguished road
Default

@Corsair
Try adding this to see if it'll help (make sure to define $traincost):
PHP Code:
if($mysidia->user->money $traincost) {
   
$document->add(new Comment(" You don't have enough money to train your companion!"));
  return;


Came up with a code to automatically change an adopt's stats emulating $mysidia->user->changecash(). This should be helpful updating the db with less code. Add it to /classes/class_ownedadoptable.php
PHP Code:
public function changestat($stat$gainstat){
    
$mysidia Registry::get("mysidia");
        if(!
is_numeric($gainstat)) throw new Exception('Cannot change crocuta stats by a non-numeric value!'); 
       
# Define $newstat...
       
if($stat == "sense"){
          
$newstat $this->sense;
          } elseif(
$stat == "strength"){
          
$newstat $this->strength;
          }
                 
      
$newstat += $gainstat;     
      
      
$profile $mysidia->user->getprofile();
         
$mysidia->db->update("owned_adoptables", array("{$stat}=> $newstat), "aid = '{$profile->getFavPetID()}'"); 
         return 
TRUE;               
      
      } 
To use:
PHP Code:
$randgain rand(1,20);
$favpet->changestat(strength$randgain); 

Last edited by lotus; 12-16-2016 at 03:24 PM.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:35 AM.

Currently Active Users: 818 (0 members and 818 guests)
Threads: 4,081, Posts: 32,029, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636