Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.2.x Mods

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-10-2011, 02:00 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 488,558
Hall of Famer is on a distinguished road
Default Hall of Famer's Evolution Mod v1.2

Well its been a long time since the old evolution script for Mys v1.1 was designed. I eventually decided to make a new one, which has its codes completely rewritten compared to the old program. I've included an installer in order to make you guys/gals lives easier, it is also more flexible for admins to manage evolution lines through ACP.

So what are the differences between Evolution Mod v1.2 and the old script released for Mys v1.1:
1. The entire script is redesigned, with much more advanced PHP codes that I'd hardly recommend to absolute beginners. Of course, it optimizes site performance to a certain extent. Installation becomes much easier for Evolution system, as it was indeed a pain back in the old days.
2. The new script introduces a concept called Evolution Line, it can be rather useful for long series evolution line and multi-evolution outcome branches in future. Also adoptables can have a certain percentage of chance to evolve or not even when their evolution conditions are all met. Apparently the admins decide the difficulty for evolution to occur.
3. The old script inserts many columns into table prefix.adoptables and prefix.owned_adoptables, which causes fatal errors while upgrading Mys and incompatibility issues with other scripts. Evolution Mod v1.2, on the other hand, creates a new table and does not interfere with any existing tables. Incompatibility with other Mods should not be a problem this time.
4. The new script introduces different approaches of evolution system, compared to merely level-based evolution. The trade-based evolution will be made available soon, and item-based evolution will also become possible once Mys v1.3.0 is released to public. There is even possibility for Trade - Item evolution integration, and time-based evolution if you dont mind using Cronjobs.
5. Powerful Admin Control Panel for Evolution system. Admins can create, edit and delete an evolution line at will, the product itself can be turned off and on(simply enable/disable the plugin through ACP or PHPmyadmin). I've also provided a section called FAQs for users to read as manual, they should pretty much explain what you can do with Evolution Mod V1.2.


Alright, let us begin. First of all you need to add the following three functions to your inc/functions.php file. They can be placed anywhere, and Id recommend the very end of your script file:

PHP Code:
function pluginenabled($plug) {
$query "SELECT * FROM {$GLOBALS['prefix']}acp_hooks WHERE pluginname='{$plug}'";
$result mysql_query($query);
$row mysql_fetch_array($result);
  switch(
$row['pluginstatus']){
  case 
"1":
  
$plugin "enabled";
  break;
  default:
  
$plugin "disabled";
  }
return 
$plugin;  
}

function 
checkevolution($adopt$level$item$trade$gender){

$query "SELECT * FROM {$GLOBALS['prefix']}adoptables_evolution WHERE preevoform='{$adopt}'";
$result runquery($query);
$row mysql_fetch_array($result);
$randnum mt_rand(0,99);
switch(
$row['evotype']){
  case 
"level":
  
$canevolve = ($level >= $row['requiredlevel'] and $row['evochance'] > $randnum)?yes:no;
  break;
  case 
"item":
  
$canevolve = ($item == $row['requireditem'] and $row['evochance'] > $randnum)?yes:no;
  break;
  case 
"trade":
  
$canevolve = ($trade == "true" and $row['evochance'] > $randnum)?yes:no;
  break;
  default:
  
$canevolve "no";
}

// Check the gender restriction setting
if($row['requiredgender'] != "no" and $row['requiredgender'] != $gender){
$canevolve "no";
}
return 
$canevolve;

}

function 
execevolution($id$adopt){
$result runquery("SELECT * FROM {$GLOBALS['prefix']}adoptables_evolution WHERE preevoform='{$adopt}'");
$row mysql_fetch_array($result);
$result2 runquery("SELECT * FROM {$GLOBALS['prefix']}owned_adoptables WHERE aid='{$id}'");
$row2 mysql_fetch_array($result2);
// Update adoptables type to the evolution form
if($row2['type'] == $row2['name']){
runquery("UPDATE {$GLOBALS['prefix']}owned_adoptables SET name='{$row['postevoform']}' WHERE aid = '{$id}'");
}
runquery("UPDATE {$GLOBALS['prefix']}owned_adoptables SET type='{$row['postevoform']}' WHERE aid = '{$id}'");
$message "Congratulations! Your {$adopt} has successfully evolved into {$row['postevoform']}.";
return 
$message;
}
?> 
The next thing to do is to modify the level increment engine a little bit. Find the following line in your levelup.php:

PHP Code:
    runquery("UPDATE {$prefix}owned_adoptables SET currentlevel='{$nextlevel}' WHERE aid='{$id}'"); 
Add below:
PHP Code:
      if(pluginenabled("Evolution Mod v1.2 by Hall of Famer") == "enabled"){
        
$item "";
        
$trade "false";
        switch(
checkevolution($owned_adoptable['type'], $nextlevel$item$trade ,$owned_adoptable['gender'])){
          case 
"yes":
          
// Evolution Checkpoint passed, the process shall begin!
          
$message execevolution($owned_adoptable['aid'],$owned_adoptable['type']);
          
$evolution "true";
          break;
          default:
          
$message "evolution does not occur...";
          
$evolution "false";        
        }                  
      } 
This should pretty much do the job already. If you want to notice your users of their adoptables evolution, you may add this line to levelup.php too. Place it somewhere around line 150-160:

PHP Code:
    if($evolution == "true"){
    
$article_content $article_content "<div align='center'><br />Congratulations! Your adoptable {$owned_adoptable['name']} has evolved.</div>";
    } 
For those of you interested in Trade based Evolution system, simply copy/paste the following codes below to your redeem.php at around line 225:

PHP Code:
        // Trade Evolution Script Here:
        
if(pluginenabled("Evolution Mod v1.2 by Hall of Famer") == "enabled"){
        
$item "";
        
$trade "true";
        
$result5 runquery("SELECT * FROM {$prefix}owned_adoptables WHERE aid = '{$row['adoptabledesired']}'");
        
$adoptdesired mysql_fetch_array($result5);
        switch(
checkevolution($adoptdesired['type'], $adoptdesired['currentlevel'], $item$trade $adoptdesired['gender'])){
          case 
"yes":
          
// Evolution Checkpoint passed, the process shall begin!
          
$message execevolution($adoptdesired['aid'],$adoptdesired['type']);
          
$evolution "true";
          break;
          default:
          
$message "evolution does not occur...";
          
$evolution "false";        
        }                  
      } 
Similarly, the user can be notified of his/her adoptables evolution by adding the following lines to near the bottom of redeem.php:

PHP Code:
        if($evolution == "true"){
        
$article_content $article_content "<div align='center'><br />Congratulations! Your adoptable {$adoptdesired['name']} has evolved.</div>";
        } 
So we are done with script modification already, isnt it easy this time? Well you will still need to download the following two script files I've uploaded, and make sure to run install_evolution.php script so the new table prefix.adoptables_evolution will be added into your database. Now have fun everyone, I am a bit tired already since its 2AM...

Hall of Famer
Attached Files
File Type: php admin_evolution.php (12.4 KB, 25 views)
File Type: php install_evolution.php (1.2 KB, 22 views)
File Type: php levelup.php (6.4 KB, 11 views)
File Type: php redeem.php (14.6 KB, 18 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
^_^ Happy Birthday Hall Of Famer ^_^ Alaric Other Chat 10 05-23-2012 12:35 AM
Hall of Famer's HP system Hall of Famer Mys v1.1.x Mods 13 04-25-2012 08:08 AM
Hall of Famer's Gender Ratio Mod v1.2 Hall of Famer Mys v1.2.x Mods 45 04-02-2012 01:42 PM
New interview with Hall of Famer! cpvr Other Chat 6 03-08-2011 11:51 PM
Hall of Famer's gender ratio system Hall of Famer Mys v1.1.x Mods 34 01-25-2011 02:19 AM


All times are GMT -5. The time now is 06:19 AM.

Currently Active Users: 753 (0 members and 753 guests)
Threads: 4,081, Posts: 32,031, 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