Mys 1.3.x Stat/SKill System

Forum
Last Post
Threads / Messages
Now if only I could get the stat value to show in from the levelupview.php file, haha (unfortunately {$adopt->getStatname()}, {$this->adopt->getStatname()}, and {$statname} do not work, though {$statname} works just fine in the levelup.php file).

Ooh, that's a cool idea, Kyttias!
 
Ended up with this error;
Fatal error: Cannot access protected property OwnedAdoptable::$magic in /home/catisserie/public_html/view/levelupview.php on line 27

(magic being the name of the stat)

Still trying several things to try to work around it.
 
In classes/class_ownedadoptable.php add public $magic; to the variables at the start.
 
Well, it's not coming up with an error now, but instead it's simply displaying a blank where the data should be displayed.
(.../view/levelupview.php):
PHP:
	public function click(){
	    $mysidia = Registry::get("mysidia");
		$document = $this->document;				
        $adopt = $this->getField("adopt");
		$reward = $this->getField("reward")->getValue();
		$document->setTitle("{$this->lang->gave} {$adopt->getName()} one {$this->lang->unit}");
		
		$image = $adopt->getImage("gui"); 
		$image->setLineBreak(TRUE);		
		$summary = new Division;
        $summary->add($image);	
		$summary->add (new Comment("<ul>
										<li><b>Name:</b> {$adopt->getName()}</li>
										<li><b>Owner:</b> <a href='/profile/view/{$adopt->getOwner()}'>{$adopt->getOwner()}</a></li>
										<li><b>Birthday:</b> {$adopt->getBirthday()}</li>
										<li><b>Type:</b> {$adopt->getType()}</li>
										<li><b>Sex:</b> {$adopt->getGender()}</li>
										<li><b>LVL:</b> {$adopt->getCurrentLevel()}</li>
										<li><b>Total EXP:</b> {$adopt->getTotalClicks()}</li> 
										<li><b>Magic:</b> {$adopt->magic}</li>
									</ul>"));
        $summary->add(new Comment("{$this->lang->gave}{$adopt->getName()} one {$this->lang->unit}."));
        $summary->add(new Comment($this->lang->encourage));
        $summary->add(new Comment("<br> You have earned {$reward} {$mysidia->settings->cost} for leveling up this cat. "));
        $summary->add(new Comment("You now have {$mysidia->user->getcash()} {$mysidia->settings->cost}"));
        $document->add($summary);			
	}

And, just to make things even more fun, I'm also having a funny issue with the item that raises the stat. For some reason instead of adding +1 to the stat, it sets the stat itself to 1. I'll play around with this, though, and see if I can get it to work by studying the other functions more.

Edit:
OK, I got the function to work by doing this;
PHP:
 function items_magic($item, $adopt){
  $mysidia = Registry::get("mysidia");
  $magic = $mysidia->db->select("owned_adoptables", array("magic"), "aid='{$adopt->aid}'");
  $newmagic = $magic + $item->value;
  $mysidia->db->update("owned_adoptables", array("magic" => $newmagic), "aid='{$adopt->aid}'and owner='{$item->owner}'");
  $note = "By using {$item->itemname}, the cat's magical skill has raised by {$item->value}! This cat now has {$newmagic} skill!<br>";
    //Update item quantity...
  $delitem = $item->remove(); 
  return $note;
}
So at least I fixed that issue ^^
 
Last edited:
*shrug* Bizarre. This is exactly what I use for my pet's personality (so, same concept of rendering it to levelupview.php):

Code:
This is a {$adopt->size}-sized, {$adopt->nature} {$adopt->type} that likes {$adopt->likes} and dislikes {$adopt->dislikes}.

Keeping in mind that in just levelup.php it has to be:

Code:
This is a {$this->adopt->size}-sized, {$this->adopt->nature} {$this->adopt->type} that likes {$this->adopt->likes} and dislikes {$this->adopt->dislikes}.

Because it wants the '$this' involved.

If you really wanted to you could create a function by copying over one of the existing ones in class_ownedadoptable.php but it seems really redundant.

Then again, I also display my birthdays with just $adopt->birthday and you should also really be able to call gender with just $adopt->gender (after making it no longer protected). At least in v1.3.4, because of how things pull from the database. Basically any column name should be able to show up this way. Check if there's value in it for that specific adopt???
 
Last edited:
There is indeed a value in for that adopt (and for all of them I've tested), but it simply will not show up (though it does show up when I re-visit that adopt so it loads the "you've already seen this pet today" page). I've even tried adding the function to the levelupview.php page. I'm having the same issue with displaying the "medals" with the levelupview.php file, as well. What's really odd is that I use {$adopt->getBirthday();} to show the adoptable's birth-date, and that shows up just fine, so I do not understand why {$adopt->getMagic();} isn't working, since they're both defined in all the same places, the same way in class_ownedadoptable.php:
PHP:
	public function getBirthday(){
	    return $this->birthday;
	}
	
	public function getMagic(){
		return $this->magic;
	}
	
	public function getMagicMedalStatus(){
		return $this->magicmedalstatus;
	}
 
Does anyone have a copy of the screenshots for this mod since the images aren't avalible in the first post?

:)
 
Thank you!

Sorry, Is there a way to have more than one stat, would I just add another colum or would it change the directions? I'm fairly new thisthis so I'm not really sure.
 
Last edited:
Yes! Just add more columns as necessary. You could technically even store minipet data with a pet this way - just a thought. Letting user's name their pet's minipet would be more complicated, but, just displaying an image by the pet of a minipet species would be really easy - so long as the data in the column correlates to a file name. I personally use this mod just to show pets likes/dislikes/personality.
 
Is there a way to do a max limit for a stat? I want to do a stat like hp or energy that doesn't go beyond a certain number like 10 or 100. Exploring will take down the stat a random number but giving the pet food will increase the stat again. I don't want it to go past the max number.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top