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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2012, 02:24 PM
schepers12's Avatar
schepers12 schepers12 is offline
Member
 
Join Date: Sep 2012
Location: netherlands
Posts: 30
Gender: Male
Credits: 3,853
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, 10 views)
__________________
~

Last edited by schepers12; 02-09-2013 at 02:03 PM. Reason: update for v1.3.2
Reply With Quote
  #2  
Old 11-28-2012, 09:42 PM
Corsair's Avatar
Corsair Corsair is offline
Member
 
Join Date: Jan 2012
Posts: 128
Gender: Female
Credits: 5,839
Corsair is on a distinguished road
Default

Houses? I'm not sure what that means.
__________________
Game Dev Forum
Reply With Quote
  #3  
Old 11-29-2012, 06:10 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is online now
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: Somerville
Posts: 4,391
Gender: Male
Credits: 158,170
Hall of Famer is on a distinguished road
Default

Well its similar to the concept of Pokebox, which acts as container for adoptables and can only hold a certain number of them. If you want to adopt more, you will have to switch to buy a new house.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #4  
Old 12-08-2012, 08:09 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,098
Gender: Female
Credits: 34,853
SilverDragonTears is on a distinguished road
Default

This is interesting. Anyone have a working site with this on it?
__________________

Check out Tale of Dragons
Reply With Quote
  #5  
Old 12-09-2012, 11:48 PM
LucasA33's Avatar
LucasA33 LucasA33 is offline
Member
 
Join Date: Jul 2011
Posts: 141
Gender: Male
Credits: 4,330
LucasA33 is on a distinguished road
Default

Anyone want to make this for 1.3.2? Will pay 500 creds C:
__________________
Reply With Quote
  #6  
Old 02-09-2013, 06:30 AM
schepers12's Avatar
schepers12 schepers12 is offline
Member
 
Join Date: Sep 2012
Location: netherlands
Posts: 30
Gender: Male
Credits: 3,853
schepers12 is on a distinguished road
Default

@silver kistune: yes, my site is running all my mods (running v1.3.1): touhoupets.com :)

edit: i can't get to know how to make this for v1.3.2, so i won't update this script until i know how to do it.. :/ EDIT: made a workaround for it, see start post!
__________________
~

Last edited by schepers12; 02-09-2013 at 02:05 PM.
Reply With Quote
  #7  
Old 02-10-2013, 01:06 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is online now
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: Somerville
Posts: 4,391
Gender: Male
Credits: 158,170
Hall of Famer is on a distinguished road
Default

Oh great, you made the script compatible with Mys v1.3.2 now. Actually its not that complex at all, just a change in the database query and text/article output syntax. The ACP change is much more dramatic though.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #8  
Old 07-28-2020, 08:53 PM
Micolai's Avatar
Micolai Micolai is offline
Loving Mysidia
 
Join Date: May 2020
Location: Tennessee
Posts: 67
Gender: Female
Credits: 2,024
Micolai is on a distinguished road
Default

Is this able to be updated to the current 1.3.4?
__________________
"You try you fail, you try you fail, but the only true failure is if you stop trying. So try again." - Haunted Mansion
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

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 04: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 05:22 PM.

Currently Active Users: 362 (1 members and 361 guests)
Threads: 4,018, Posts: 31,660, Members: 15,659
Welcome to our newest members, DjastinKoock.
BETA





What's New?

What's Hot?

What's Popular?


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