Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Random Adoption Process ? (http://www.mysidiaadoptables.com/forum/showthread.php?t=5368)

Silver_Brick 02-12-2017 01:11 PM

Random Adoption Process ?
 
I want to do random adoption process so 4 random egg will appear horizontally and user can click them to adopt them and there will be no submit button or naming option and they have chances to adopt rare egg very less...

kristhasirah 02-13-2017 12:13 PM

there's an old thread here with a code doing what you want, but you will need to edit it so it can work with the new script:
http://mysidiaadoptables.com/forum/s...ead.php?t=3527

I manage to make it work, so is not that hard ^^ you just need to add a new row in the database in the adopt_adoptables called rarity and made the changes to the code so it can appear

PHP Code:

   $adoptform "<form name='form1' method='post' action='$adopt'><table id='adoptdark' name='adopt' class='adopt'>";
    
$common 0
    
$uncommon rand(1,50);   
    
$rare rand(1,100);   
    
$ultrarare rand(1,200);
    
$legendary rand(1,300);   

    if (
$uncommon==&& $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }   
    else if (
$rare==&& $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }       
    else if (
$ultrarare==1  && $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }  
    else if (
$legendary==1  && $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }     
    else{   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";   
    }   
    
$stmt $mysidia->db->query($query);  
    
        while(
$row $stmt->fetchObject()) {

            
$adoptform .= "<td width='25%' VALIGN='center'><div align=center><img src='http://127.0.0.1/pokeupdate/picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center><strong>{$row->description}</strong></td>";
        
        }
    
    
    
$common 0
    
$uncommon rand(1,50);   
    
$rare rand(1,100);   
    
$ultrarare rand(1,200);
    
$legendary rand(1,300);   

    if (
$uncommon==&& $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }   
    else if (
$rare==&& $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }       
    else if (
$ultrarare==1  && $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }  
    else if (
$legendary==1  && $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }     
    else{   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";   
    }   
    
$stmt $mysidia->db->query($query);  

    while(
$row $stmt->fetchObject()) {

            
$adoptform2 .= "<td width='25%' VALIGN='center'><div align=center><img src='http://127.0.0.1/pokeupdate/picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center><strong>{$row->description}</strong></div></td>";

            
   } 
   
    
$common 0
    
$uncommon rand(1,50);   
    
$rare rand(1,100);   
    
$ultrarare rand(1,200);
    
$legendary rand(1,300);   

    if (
$uncommon==&& $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='1' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }   
    else if (
$rare==&& $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='2' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }       
    else if (
$ultrarare==1  && $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='3' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }  
    else if (
$legendary==1  && $onlyone==0){   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='4' ORDER BY RAND() LIMIT 1"
$onlyone 1;   
    }     
    else{   
    
$query "SELECT * FROM ".constant('PREFIX'). "adoptables WHERE rarity='0' ORDER BY RAND() LIMIT 1";   
    }   
    
$stmt $mysidia->db->query($query);  

    while(
$row $stmt->fetchObject()) {

            
$adoptform3 .= "<td width='25%' VALIGN='center'><div align=center><img src='http://127.0.0.1/pokeupdate/picuploads/unknownegg.png' /></div></a><br><div align=center><input type='radio' name='id' id='id' value='{$row->id}' /></div><div align=center><strong>{$row->description}</strong></div></td>";
    }
  
   
        
$document->add(new Comment("{$adoptform}{$adoptform2}{$adoptform3}")); 

probably is not the best way of doing it, but it works for me ^^
I have mine below the lines:
PHP Code:

            $document->addLangvar((!$mysidia->user->isloggedin)?$mysidia->lang->guest:$mysidia->lang->member);          
            
$adoptForm = new Form("form""adopt""post");
            
$adoptTitle = new Comment("Available Adoptables");
            
$adoptTitle->setHeading(3);
            
$adoptForm->add($adoptTitle);
            
$adoptTable = new Table("table"""FALSE); 

and above the lines:
PHP Code:

            $adoptForm->add($adoptTable);        
            
$adoptForm->add(new Button("Adopt Me""submit""submit"));
            
$document->add($adoptForm);
        }
    }
}
?> 

this part of the code:
PHP Code:

$document->add(new Comment("{$adoptform}{$adoptform2}{$adoptform3}")); 

replaces the
PHP Code:

$document->add(new Comment($adoptform)); 

cant post my full adoptview.php file because is very modified.
hope this can be use full for you^^

this code shows 3 eggs at the same time.

Silver_Brick 02-13-2017 12:42 PM

Thanks for the help :)

Chaos77777 02-19-2017 11:25 AM

Hey guys. I started using this too. But there's a big problem I can't seem to figure out. If someone were to get a really rare adopt, all they would have to do is keep refreshing to get the same one over and over again. Any way around that?

Silver_Brick 02-19-2017 12:06 PM

i thinks its random So it won't happen :)

Chaos77777 02-19-2017 01:10 PM

Doesn't seem random to me. I keep getting the same thing over and over when I refresh after I adopt one. I have it set up to cost money, so the money does reduce. But it does give me the same adopt

Abronsyth 02-19-2017 01:39 PM

You could probably work around this by setting it up so that once they adopt you quickly redirect them, which would mostly disable them from being able to refresh to just keep getting the same pet.

kristhasirah 02-19-2017 02:55 PM

you can change the value in (1,300); 1 means one adopt and 300 the amount of clicks so is 1 adopt every 300 clicks, if i remember correctly from the original thread, maybe you can change it to a bigger number?
I dint make any more changes, but i think theres was a solution for that in the original thread... you just need to edit it to make it work in the new script

no need to edit the code just paste this:
http://mysidiaadoptables.com/forum/s...5&postcount=36 in the functions.php

and $clicked = 0; in the adopt.php

i pasted mine below
$total = ($ids)?count($ids):0;

Nevermind... Dont work on a cellphone :/
But it seems to work on a computer/laptop i used firefox to test it

Chaos77777 02-19-2017 04:50 PM

I don't really know how to make a gif pic to show you what I mean. A redirect would work, but wouldn't show them the "Congrats you got this adopt" unless there's a way to show the same page in like a fake page type thing, which I don't know how to go about doing (Plus, "back" would still give them a loophole). Or a way to unset post, but I'm not really sure where to put that or how to set that up. But to recreate this (glitch):
1. Click which adopt you want.
2. Click the "Adopt me" button
3. When it shows you which adopt you got, just keep refreshing. In Chrome, it'll ask you if you want to submit form resubmission. You'll get the same one every time

kristhasirah 02-19-2017 05:47 PM

It seems the glitch is part of mysidia script..i have the default one and got that problem too... Unless i forgot and edited something... But i thik the only thing i edited was ti add kytias female male images code... Rigth now i cant test that, using my phone...still even if the glitch is caused by the code i posted i have no idea in how to fix it... Maybe theres a fix somewhere in the forum...


All times are GMT -5. The time now is 08:30 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.