View Single Post
  #1  
Old 05-05-2017, 12:21 PM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 7,817
KatFennec is on a distinguished road
Default Manual Leveling Items

The following is a mod that will disable the standard checks when an adoptable is clicked that will cause it to gain a level when it reaches its EXP threshold, and instead adds an item that takes over that function. This, in essence, converts leveling up to a manual function, allowing a user to keep their adopt at a specific level without freezing it.


To begin, open your function_items.php, found in the function folder of your mysidia install, and copy/paste the following at the bottom.
PHP Code:
function items_levelcheck($item$adopt){
  
$mysidia Registry::get("mysidia");
  

  
$newlevel $item->value;
  
$lev $mysidia->db->select("levels", array(), "adoptiename='{$adopt->type}' and thisislevel ='{$newlevel}'")->fetchObject();
  if (
$lev->requiredclicks <= $adopt->totalclicks) {  
    
//Check if the adoptable's level is already at maximum.    
  
if(!is_object($lev)){
    
// object not created, the level is already at maximum.
    
$note "Unfortunately, your selected adoptable's level cannot be raised by using item {$item->itemname}.";
  }
  else{
    
//Update item quantity...
    
$delitem $item->remove();
    
//Execute the script to update adoptable's level.
    
$mysidia->db->update("owned_adoptables", array("currentlevel" => $newlevel), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
    
$note "Congratulations, the item {$item->itemname} raised your adoptable to level  {$item->value}";
  };
  }
  else{
  
$note "Your pet does not have the required number of clicks";
  };
  return 
$note;

While you have the function_items file open, either comment out or remove the entries under click1 and click2 that read:
PHP Code:
if($ownedAdopt->hasNextLevel()){
      
//new level exists, time to check if the total clicks have reached required minimum clicks for next level.
     
$nextLevel $ownedAdopt->getNextLevel();
     
$requiredClicks $nextLevel->getRequiredClicks();
     if(
$newclicks >= $requiredClicks and $requiredClicks != and $requiredClicks != ""){
        
// We need to level this adoptable up...
        
$mysidia->db->update("owned_adoptables", array("currentlevel" => $nextLevel->getLevel()), "aid ='{$adopt->aid}' and owner='{$item->owner}'");             
        
$note .= "And moreover, it has gained a new level!";
     }
  } 
This disables their ability to level up the adoptables. Close function_items.
Next, open class_privateitem.php, found in the classes folder, and paste the following in after the entries that it resembles:
PHP Code:
case "LevelCheck":
$message items_levelcheck($this$owned_adoptable);
break; 
(finishing this in a second post)
__________________
Reply With Quote