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
  #1  
Old 11-14-2012, 01:24 PM
schepers12's Avatar
schepers12 schepers12 is offline
Member
 
Join Date: Sep 2012
Location: netherlands
Posts: 30
Gender: Male
Credits: 7,867
schepers12 is on a distinguished road
Default [now also for 1.3.2!] adding houses for your pets

hello all,
as promised, my houses modification, still far from perfect, but it works pretty good already~

i hope you'll get the idea of how to apply/extend this mod.

i'm also glad to hear any update you've made of this~

instructions provided in the board aswell the zip file~



please don't shoot me if i did something wrong, i'm a human and i do make mistakes, so please back-up your adoptables site before you start~!
THIS IS FOR V1.3.1, for v1.3.2, see the end of this post!


(It works for me though.. :3c)


instructions below:


insert into the users table a new column:
Code:
houses int(11) default 1
__________________________________________________ _________________________________________

copy functions_houses into your functions folder

in the main functions file, find:
PHP Code:
    $GLOBALS['isloggedin'] = $isloggedin;
    
$GLOBALS['username'] = $username;
    
$GLOBALS['loggedinname'] = $username;
    
$GLOBALS['money'] = $GLOBALS['usersettings']['money'];
    
$GLOBALS['group'] = $usergroup
and add this underneath it:
PHP Code:
    $GLOBALS['houses'] = $houses
find:
PHP Code:
        $luid=$GLOBALS['usersettings']['uid'];
        
$lsess=$GLOBALS['usersettings']['session'];
        
$usergroup=$GLOBALS['usersettings']['usergroup']; 
and add this line underneath them:
PHP Code:
        $houses=$GLOBALS['usersettings']['houses']; 
__________________________________________________ _________________________________________
next, edit adopt.php:

include this line at the beginning:
PHP Code:
include("functions/functions_houses.php"); 
find:
PHP Code:
    // Begin the output of all the adoptables to the user...
    
$stmt $adopts->join("adoptables_conditions""adoptables_conditions.id = adoptables.id")
    ->
select("adoptables", array()); 
put this under it:
PHP Code:
if ($freespace 0) { 
and put before:
} // This bracket ends the else statements for whether or not an ID was entered
PHP Code:
this:
}}else { 
$article_content .= "You don't have enough free space in your houses left anymore, you need to buy new houses for your new adopts!"
__________________________________________________ _____________
breeding.php:

add:
PHP Code:
  include("functions/functions_houses.php"); 
on top

find:
PHP Code:
if($isloggedin == "yes" and $userstatus['canbreed'] == "yes"){ 
and add underneath it:
PHP Code:
if ($freespace 0) { 
find:
PHP Code:
}// this is the end of if($isloggedin == "yes") 
and add this above it:
PHP Code:
}else { 
$article_content .= "You don't have enough free space in your houses left anymore, you need to buy new houses for your new adopts!";

__________________________________________________ _________________________________________
trade.php

add as usual in the beginning:
PHP Code:
include("functions/functions_houses.php"); 
and find:
PHP Code:
if($isloggedin == "yes"){ 
add underneath it:
PHP Code:
if ($freespace 0) { 
next, find:
PHP Code:
else{

$article_title "Trading Not Enabled";
$article_content "Trading is either not enabled or not currently available for your site.";


}

}


add this under it:
PHP Code:
else {
$article_content .= "You don't have enough free space in your houses left anymore, you need to buy new houses for your new adopts!";
}} 
__________________________________________________ _________________________________________
and pound.php:

add this at the beginning:
PHP Code:
include("functions/functions_houses.php"); 
find:
PHP Code:
elseif($poundsettings->adopt->active == "no" and $poundsettings->system->active == "yes"){
  
$article_title "Access Denied";
  
$article_content "The admin has specified that pounded pets cannot be readopted.";

place above it:
PHP Code:
else { 
$article_content .= "You don't have enough free space in your houses left anymore, you need to buy new houses for your new adopts!"; }

and add after:
PHP Code:
  if($isloggedin == "yes" and $userstatus['canpound'] == "yes"){ 
this:
PHP Code:
if ($freespace 0) { 
____________________________
__________________________________________________ _________________________________________
Next, copy the houses.php file into the main directory, and make a link to it in the admin panel.




optional, you can edit functions.php again, and add this to the function getsidebar (if you haven't done so already):
before the logout.php link:
PHP Code:
$wpath $GLOBALS['houses'];
$housing $wpath;
$sidebar .= "<li><a href='houses.php'>You have {$housing} house(s)</a></li>"
optional, you can edit the variables in functions_houses.php
PHP Code:
($req_monforhouse$maximumhouses$spots
to your desires~ :3c

This works with MYS 1.3.1


now the updated version for V1.3.2 :




simple houses system (workaround for the OOP php of mysidia, i hope this also works for people who don't know OOP php programming ;3)

edit functions_houses.php variables to your desires.

place functions_houses into your functions folder

in inc/init.php, add this just before the end:
PHP Code:
$function_houses "{$dir}functions/functions_houses.php";
include(
$function_houses); 
adopt.php:
find:
PHP Code:
if($canadopt == "yes"){
            
//If we can adopt the adoptable, show the image and adoption link...
            
$adoptform .= "<tr><td><input type='radio' name='id' id='id' value='{$row->id}' /></td><td style='text-align: center'><img src='{$row->eggimage}' /></td>
                           <td><strong>
{$row->type}</strong><br />{$row->description}</td></tr>";
      } 
replace by:
PHP Code:
if($canadopt == "yes"){
      if (
$freespace 0) {  
            
//If we can adopt the adoptable, show the image and adoption link...
            
$adoptform .= "<tr><td><input type='radio' name='id' id='id' value='{$row->id}' /></td><td style='text-align: center'><img src='{$row->eggimage}' /></td>
                           <td><strong>
{$row->type}</strong><br />{$row->description}</td></tr>";
      } else {
         
$mysidia->page->addcontent($houseserror);
      }
      } 
breeding.php

find:
PHP Code:
 else{
       
// we choose the type!
       
$types = array($female->type$male->type);
       
$typerand rand(0,1);        
            
       
// we choose the gender
       
$genders = array('f''m');
       
$genderrand rand(0,1);    

       
// Get other related information       
       
$code codegen(100);
       
$alts getaltstatus($female_species->id00);
       
$time time();
       
       
// Insert a baby adoptable to the database
       
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $types[$typerand], "name" => $types[$typerand], "owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                      
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$genderrand], "lastbred" => 0));
       
$congrats =     "Congratulations! Breeding is successful, you have acquired a baby {$types[$typerand]} from breeding center.
                    <br><a href='myadopts.php'>Manage your new 
{$types[$typerand]} now!</a></p>";
       
$mysidia->page->addcontent($congratsTRUE);                    
       
$mysidia->db->update("owned_adoptables", array("lastbred" => $time), "aid = '{$mysidia->input->post("female")}'");
       
$mysidia->db->update("owned_adoptables", array("lastbred" => $time), "aid = '{$mysidia->input->post("male")}'");       
   } 
replace by:
PHP Code:
   else{
   
      if (
$freespace 0) { 
       
// we choose the type!
       
$types = array($female->type$male->type);
       
$typerand rand(0,1);        
            
       
// we choose the gender
       
$genders = array('f''m');
       
$genderrand rand(0,1);    

       
// Get other related information       
       
$code codegen(100);
       
$alts getaltstatus($female_species->id00);
       
$time time();
       
       
// Insert a baby adoptable to the database
       
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $types[$typerand], "name" => $types[$typerand], "owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                      
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$genderrand], "lastbred" => 0));
       
$congrats =     "Congratulations! Breeding is successful, you have acquired a baby {$types[$typerand]} from breeding center.
                    <br><a href='myadopts.php'>Manage your new 
{$types[$typerand]} now!</a></p>";
       
$mysidia->page->addcontent($congratsTRUE);                    
       
$mysidia->db->update("owned_adoptables", array("lastbred" => $time), "aid = '{$mysidia->input->post("female")}'");
       
$mysidia->db->update("owned_adoptables", array("lastbred" => $time), "aid = '{$mysidia->input->post("male")}'");       
       } else {
                
$mysidia->page->addcontent($houseserror);
       }
   } 
doadopt.php:

find:
PHP Code:
      $canadopt canadopt($row->id"adopting""none"$row);
      if(
$canadopt == "yes"){
         
$name = (!$mysidia->input->post("name"))?$row->type:$mysidia->input->post("name");
         
$alts getaltstatus($row->id00);
         
$code codegen(100);
         
$genders = array('f''m');
         
$rand rand(0,1);
         
$mysidia->user->changecash(-$row->cost);
         
$mysidia->page->settitle("{$name} adopted successfully");
         
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0));
         
$aid $mysidia->db->select("owned_adoptables", array("aid"), "code='{$code}' and owner='{$mysidia->user->username}'")->fetchColumn();
         
$message "<img src='{$row->eggimage}'><br>Congratulations!  You just adopted {$name}.  You can now manage {$name} on the 
                     <a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id=
{$aid}'>Click Here to Manage {$name}</a><br>
                     <a href='myadopts.php?action=bbcode&id=
{$aid}'>Click Here to get BBCodes / HTML Codes for {$name}</a></b><br><br>
                     Be sure and <a href='levelup.php?id=
{$aid}'>feed</a> {$name} with clicks so that they grow!";
         
$mysidia->page->addcontent($message);
         
$mysidia->session->terminate("adopt");
      }
      else 
$mysidia->displayerror("action"); 
replace by:
PHP Code:
      if ($freespace 0) { 
      
$canadopt canadopt($row->id"adopting""none"$row);
      if(
$canadopt == "yes"){
         
$name = (!$mysidia->input->post("name"))?$row->type:$mysidia->input->post("name");
         
$alts getaltstatus($row->id00);
         
$code codegen(100);
         
$genders = array('f''m');
         
$rand rand(0,1);
         
$mysidia->user->changecash(-$row->cost);
         
$mysidia->page->settitle("{$name} adopted successfully");
         
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0));
         
$aid $mysidia->db->select("owned_adoptables", array("aid"), "code='{$code}' and owner='{$mysidia->user->username}'")->fetchColumn();
         
$message "<img src='{$row->eggimage}'><br>Congratulations!  You just adopted {$name}.  You can now manage {$name} on the 
                     <a href='myadopts.php'>My Adopts</a> page.<br><br><b><a href='myadopts.php?act=manage&id=
{$aid}'>Click Here to Manage {$name}</a><br>
                     <a href='myadopts.php?action=bbcode&id=
{$aid}'>Click Here to get BBCodes / HTML Codes for {$name}</a></b><br><br>
                     Be sure and <a href='levelup.php?id=
{$aid}'>feed</a> {$name} with clicks so that they grow!";
         
$mysidia->page->addcontent($message);
         
$mysidia->session->terminate("adopt");
      }
      else 
$mysidia->displayerror("action");
      }else {
               
$mysidia->page->addcontent($houseserror);
      } 
trade.php:

find:
PHP Code:
   // At the very last, evaluate if the user can afford this transaction
   
if($mysidia->settings->cashenabled){
      
$moneyleft $mysidia->user->getcash() - $mysidia->input->post("cashgiven");
      if(
$moneyleft 0){
         
$error++;
         
$mysidia->page->addcontent($lang->cash);
      }      
   } 
replace by:
PHP Code:
      if ($freespace 0) { 
   
// At the very last, evaluate if the user can afford this transaction
   
if($mysidia->settings->cashenabled){
      
$moneyleft $mysidia->user->getcash() - $mysidia->input->post("cashgiven");
      if(
$moneyleft 0){
         
$error++;
         
$mysidia->page->addcontent($lang->cash);
      }      
   }
         }else {
               
$mysidia->page->addcontent($houseserror);
             
$error++;
      } 
pound.php:

find:
PHP Code:
   else{
      
// An id has been entered, let's process the request
      
$poundadopt = new Pound($mysidia->input->post("aid"), "adopt");
      if(!
$poundadopt->validate()) $mysidia->page->settitle($lang->global_error);
      else{
         
// Validation completed, yay!
         
$mysidia->page->settitle($lang->global_action_complete);
         
$poundadopt->doadopt();
      }     
   } 
replace by:
PHP Code:
   else{
      if (
$freespace 0) { 
      
// An id has been entered, let's process the request
      
$poundadopt = new Pound($mysidia->input->post("aid"), "adopt");
      if(!
$poundadopt->validate()) $mysidia->page->settitle($lang->global_error);
      else{
         
// Validation completed, yay!
         
$mysidia->page->settitle($lang->global_action_complete);
         
$poundadopt->doadopt();
      }    
      } else{
         
// Validation completed, yay!
         
$mysidia->page->settitle($lang->global_action_complete);
         
$poundadopt->doadopt();
      }    
   } 
last: copy houses.php into your main adopts folder, and add a link to it.
Attached Files
File Type: zip house add.zip (6.1 KB, 11 views)
File Type: zip house v132.zip (3.7 KB, 11 views)
__________________
~

Last edited by schepers12; 02-09-2013 at 01:03 PM. Reason: update for v1.3.2
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
Adding backgrounds/items [ behind and in front of Pets] Missy Master Questions and Supports 2 04-14-2015 11:36 PM
Adding adoptable >.< blondbananamix Questions and Supports 12 03-20-2011 05:29 PM
Adding items on pets Amerfira Suggestions and Feature Requests 12 01-05-2011 03:43 AM
Adding Picture SJC Questions and Supports 3 05-19-2009 12:24 AM
Adding levels lady jive Questions and Supports 3 03-29-2009 06:18 AM


All times are GMT -5. The time now is 04:34 AM.

Currently Active Users: 9777 (0 members and 9777 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