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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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
 


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 12:23 AM.

Currently Active Users: 403 (0 members and 403 guests)
Threads: 4,080, Posts: 32,024, 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