예제 #1
0
파일: ajax.php 프로젝트: Roph/RMRKMon
        echo '<img src="' . $baseurl . 'images/a_seen_yes.png" title="You have encountered ' . $pokemon[round($encountered['id'])] . ' before" />';
    } else {
        echo '<img src="' . $baseurl . 'images/a_seen_no.png" title="This is your first encounter for ' . $pokemon[round($encountered['id'])] . '!" />';
    }
    if (in_array($encountered['id'], explode(',', $userdata[0]['pokemon']))) {
        echo '<img src="' . $baseurl . 'images/a_owned_yes.png" title="You already own ' . $pokemon[round($encountered['id'])] . '" />';
    } else {
        echo '<img src="' . $baseurl . 'images/a_owned_no.png" title="You don\'t own ' . $pokemon[round($encountered['id'])] . '!" />';
    }
    if (in_array(round($encountered['id']), explode(',', $userdata[0]['dex']))) {
        echo '<img src="' . $baseurl . 'images/a_dex_yes.png" title="' . $pokemon[round($encountered['id'])] . ' is in your Pokedex" />';
    } else {
        echo '<img src="' . $baseurl . 'images/a_dex_no.png" title="' . $pokemon[round($encountered['id'])] . ' is absent from your Pokedex!" />';
    }
    //Log this sighting.
    see_pokemon($context['user']['id'], $encountered['id']);
    $file_db = null;
} elseif ($_REQUEST['ajax'] == "capture") {
    //Attempt to capture the pokemon. For now, 100% success rate. Master balls for everyone!
    if (!isset($_SESSION[$context['user']['id']]['seen_pokemon'])) {
        exit('The pokemon ran away!');
    }
    //Immediately discard the session data - otherwise ultra-fast subsequent hits can catch multiple pokemon from one encounter.
    $seenpoke = $_SESSION[$context['user']['id']]['seen_pokemon'];
    unset($_SESSION[$context['user']['id']]);
    session_write_close();
    //To deal with spamming dickheads, we're going to do some extra analysis before deciding on a final capturing chance.
    $capture_chance = $pcfg['capture_chance_default'];
    //Default, in percent
    $capturenotice = '! ';
    $capture_userdata = userdata($context['user']['id']);
예제 #2
0
파일: index.php 프로젝트: Roph/RMRKMon
     //Is the pokemon we're gifting going to be a shiny one?
     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;