Beispiel #1
0
 $lastcapture = time() - $userdata[0]['lastcaught'];
 //If it's been less than 30 minutes, you can't encounter any more.
 if ($lastcapture < $pcfg['encounter_cooldown_block']) {
     die('<!-- Too soon since last capture -->');
 }
 //If it's been under an hour, you have a 50/50 chance to not get this encounter.
 if ($lastcapture < $pcfg['encounter_cooldown_half']) {
     $test = mt_rand(0, 10);
     if ($test < 5) {
         die('<!-- Too soon since last capture, partially blocked -->');
     }
 }
 //If you don't have a version yet, this is probably your first encounter. Or, I've just added the version update.
 if (empty($userdata[0]['version'])) {
     $version = mt_rand(1, 2);
     update_trainer($context['user']['id'], 'version', $version);
 }
 if (!isset($version)) {
     $version = $userdata[0]['version'];
 }
 if ($version == 1) {
     $blocked = 2;
 } else {
     $blocked = 1;
 }
 //Now we want to remove pokemon of the opposite version from the pool.
 foreach ($affinity as $key => $value) {
     if ($value == $blocked) {
         unset($pokemon[$key]);
         unset($e_chance[$key]);
         unset($c_chance[$key]);
Beispiel #2
0
            }
        } elseif (isset($_REQUEST['otrade'])) {
            if (isset($_POST['opentrade']) && $_POST['opentrade'] == 'da') {
                update_trainer($context['user']['id'], 'opentrade', 1);
            } else {
                update_trainer($context['user']['id'], 'opentrade', 0);
            }
            echo '<span id="response" style="color:#0f0;">Updated!</span>';
        } elseif (isset($_REQUEST['favetype'])) {
            if (!is_numeric($_REQUEST['favetype'])) {
                die('<span id="response" style="color:#f00;">Failed!</span>');
            }
            if ($_REQUEST['favetype'] > 18 || $_REQUEST['favetype'] < 1) {
                die('<span id="response" style="color:#f00;">Failed!</span>');
            }
            update_trainer($context['user']['id'], 'favetype', (int) $_REQUEST['favetype']);
            echo '<span id="response" style="color:#0f0;">Updated!</span>';
        }
        //Whatever we responded to, we don't want to output anything but ajax responses.
        exit;
    }
    layout_above('PC', $context['user']['name'] . '\'s PC');
    //Now that's done and dusted, on to functions... At this point, we know the very least that you can choose a trainer picture.
    echo '<style type="text/css">
	h2 {
		color: #FDCE00;
		text-shadow: -2px -2px 0 #385CA8, 2px -2px 0 #385CA8, -2px 2px 0 #385CA8, -2px 0px 0 #385CA8, 2px 0px 0 #385CA8, 2px 2px 0 #385CA8;
	 
	margin-top: 25px;
	}</style>
	<h2>Trainer Picture <input type="submit" form="trainerpic" value="Update" /><span id="result" style="float:right;"></span></h2>';