Exemple #1
0
            //8hrs
            $capturenotice = ' <span title="Your capture chance has been affected by cooldown. Leniency: ' . $capture_chance . '">(!)</span>';
        }
    }
    //The following two rules overwrite any pre-calculated chance for special cases.
    if (is_shiny($seenpoke)) {
        $capture_chance = $pcfg['capture_chance_shiny'];
    }
    //Default shiny capture chance.
    //if ($context['user']['id'] == 7408) $capture_chance = 1; // TDS. Even if it's shiny.
    if ($context['user']['id'] == 1) {
        $capture_chance = 99;
    }
    if (mt_rand(0, 100) < $capture_chance) {
        //Successful catch
        capture_pokemon($context['user']['id'], $seenpoke);
        dex_pokemon($context['user']['id'], round($seenpoke));
        //Don't have shinies in pokedexes! They count as normal.
        echo '<img src="' . $baseurl . 'images/catch.gif" alt="pokeball" /><br /><span style="font-size: 10px; font-weight:bold;">' . (is_shiny($seenpoke) ? 'Shiny ' : '') . '' . $pokemon[round($seenpoke)] . ' was caught!</span>';
    } else {
        echo $pokemon[round($seenpoke)] . ' escaped' . $capturenotice;
    }
    $file_db = null;
} elseif ($_REQUEST['ajax'] == "list") {
    //Spit out various collections of pokemon images.
    //We require a user ID no matter what.
    if (!isset($_REQUEST['id'])) {
        die('ID required!');
    }
    $id = (int) $_REQUEST['id'];
    //Before we go further, we need to know what type of list they want.
Exemple #2
0
function complete_trade($tradeid)
{
    //Removes trainer1's pokemon and gives them to trainer 2. Then vice versa. Then marks the trade as completed. As a traded pokemon is not "caught", supply a $source other than organic to capture_pokemon().
    global $file_db;
    //Bring up this trade's data.
    $tradedata = $file_db->query("SELECT * FROM trades WHERE id=" . $tradeid . "")->fetchAll();
    //Build our arrays ready for the switcheroo.
    $pokemon1 = explode(',', $tradedata[0]['pokemon1']);
    $pokemon2 = explode(',', $tradedata[0]['pokemon2']);
    //First up, trainer1. Say goodbye to your pokemon.
    $r1 = release_pokemon($tradedata[0]['trainer1'], $pokemon1);
    //Now give these pokemon to trainer2.
    foreach ($pokemon1 as $p1poke) {
        dex_pokemon($tradedata[0]['trainer2'], round($p1poke));
        capture_pokemon($tradedata[0]['trainer2'], $p1poke, $source = "trade");
    }
    //Now it's trainer 2's turn.
    $r2 = release_pokemon($tradedata[0]['trainer2'], $pokemon2);
    //Now give these pokemon to trainer1.
    foreach ($pokemon2 as $p2poke) {
        dex_pokemon($tradedata[0]['trainer1'], round($p2poke));
        capture_pokemon($tradedata[0]['trainer1'], $p2poke, $source = "trade");
    }
    //Release the trade slots for both users.
    releasetrade($tradedata[0]['trainer1'], $tradeid, $reason = "complete");
    releasetrade($tradedata[0]['trainer2'], $tradeid, $reason = "complete");
    //Add this successful trade to the log.
    $file_db->exec("INSERT INTO tradelog (\n\t\t\t\ttrainer1, \n\t\t\t\ttrainer2, \n\t\t\t\tpokemon1, \n\t\t\t\tpokemon2,\n\t\t\t\tdate)\n\t\tVALUES (\n\t\t\t\t" . $tradedata[0]['trainer1'] . ", \n\t\t\t\t" . $tradedata[0]['trainer2'] . ",\n\t\t\t\t'" . $tradedata[0]['pokemon1'] . "',\n\t\t\t\t'" . $tradedata[0]['pokemon2'] . "',\n\t\t\t\t" . time() . ")\n\t\t\t\t");
    //Increase our total trades stat.
    $file_db->exec('UPDATE stats
							SET total_trades = total_trades + 1');
    //Finally, this trade is now complete!
    $file_db->exec("UPDATE trades\n\t\t\t\t\t\t\tSET stage=99\n\t\t\t\t\t\t\tWHERE id=" . $tradeid . "");
}
Exemple #3
0
     if (isset($_POST['is_shiny']) && $_POST['is_shiny'] == "affirmative") {
         $_POST['pokemon_to_give'] = $_POST['pokemon_to_give'] . '.3';
     }
     $smf_userdata = ssi_fetchMember($member_ids = $_POST['trainer_list'], $output_method = 'array');
     //First thing's first, if you're gifting to a user who does not have a trainer profile yet, we gotta create it for them.
     foreach ($_POST['trainer_list'] as $recipient) {
         $recipient = (int) $recipient;
         $recipientdata = userdata($recipient);
         if (empty($recipientdata)) {
             //This user is a virgin!
             newtrainer($recipient);
             echo '<br>' . $warning_symbol . ' No trainer profile for ' . $smf_userdata[$recipient]['name'] . ', creating one.<br>';
         }
         //Now we know they have a trainer profile, bypass encounters and chances and just give them the pokemon.
         see_pokemon($recipient, $_POST['pokemon_to_give']);
         capture_pokemon($recipient, $_POST['pokemon_to_give']);
         dex_pokemon($recipient, round($_POST['pokemon_to_give']));
         echo '<br>' . (is_shiny($_POST['pokemon_to_give']) ? 'Shiny ' : '') . $pokemon[round($_POST['pokemon_to_give'])] . ' was gifted to User ' . $smf_userdata[$recipient]['name'];
         admin_log(1, $_POST['pokemon_to_give'], $recipient);
         //$type, $params(pokemon), $extra(receiving user(s))
     }
 } elseif (isset($_GET['dbbackup'])) {
     //Just spit out our DB, with a nice timestamp
     //To help avoid locking, explicitly close our database before proceeding. We're ending execution in a few lines so this is fine.
     $file_db = null;
     header('Content-Type: application/octet-stream');
     header('Content-disposition: attachment; filename=RMRKMon.' . date('Y-m-d--H-i-s') . '.sqlite3');
     header('Content-Length: ' . filesize($pcfg['sqlite_db']));
     readfile($pcfg['sqlite_db']);
     exit;
 } elseif (isset($_POST['pokemonwipe'])) {