Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Reply
 
Thread Tools Display Modes
  #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: 1,102
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
  #2  
Old 05-05-2017, 12:21 PM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 1,102
KatFennec is on a distinguished road
Default

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 Code:
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.
__________________
Reply With Quote
Reply

Thread Tools
Display Modes

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 05:38 AM.

Currently Active Users: 236 (1 members and 235 guests)
Threads: 3,942, Posts: 31,405, Members: 15,530
Welcome to our newest members, ancrsbys01.
BER





What's New?

What's Hot?

What's Popular?


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