Manual Leveling Items

Forum
Last Post
Threads / Messages

KatFennec

Member
Member
Joined
Apr 21, 2017
Messages
57
Points
0
Age
30
Mysidian Dollar
4,476
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:
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:
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 != 0 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:
case "LevelCheck":
$message = items_levelcheck($this, $owned_adoptable);
break;

(finishing this in a second post)
 
Now, log into your database, and browse to the prefix_items_functions table, and copy the row for "Level1", changing the name to "LevelCheck", and setting a description such as "This item checks the total clicks of your pet against the clicks required for a specified level."


Finally, you need to open levelup.php, found in the root of your mysidia install, and comment out or remove the following entry:
PHP:
if($this->adopt->hasNextLevel()){
$nextLevel = $this->adopt->getNextLevel();
$requiredClicks = $nextLevel->getRequiredClicks();
if($requiredClicks and $newClicks >= $requiredClicks) $this->adopt
->setCurrentLevel($nextLevel->getLevel(), "update");
}

Now, all you need to do is to create the items you want to use, and remember to set their values to the level you want them to advance the pet to.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

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

Latest Threads

Latest Posts

Top