Пример #1
0
$oldTeamIds = getUserTeamIds($uid);
if (count($oldTeamIds) > 0) {
    foreach ($oldTeamIds as $pid) {
        if ($pid == 0) {
            continue;
        }
        $query = mysql_query("SELECT * FROM `user_pokemon` WHERE `id`='{$pid}' AND `uid`='{$uid}'");
        if (mysql_num_rows($query) == 1) {
            $newTeamIds[] = $pid;
        }
    }
}
$query = mysql_query("SELECT * FROM `user_pokemon` WHERE `uid`='{$uid}' ORDER BY `exp` DESC");
if (mysql_num_rows($query) == 0) {
    // they have no pokemon
    $pid = giveUserPokemonByName($uid, 'Weedle', 5, '');
    $newTeamIds[] = $pid;
} else {
    if (mysql_num_rows($query) > count($newTeamIds)) {
        // pad out their team with pokemon from their box
        while (count($newTeamIds) < 6 && ($pokeInfo = mysql_fetch_assoc($query))) {
            if (!in_array($pokeInfo['id'], $newTeamIds)) {
                $newTeamIds[] = $pokeInfo['id'];
            }
        }
    }
}
$pokeIdSqlArray = array();
foreach ($newTeamIds as $key => $pid) {
    $key += 1;
    $pokeIdSqlArray[] = "`poke{$key}`='{$pid}'";
Пример #2
0
}
if ($_GET['type'] == 'shiny') {
    $defaultPrice = 500000;
    $salePokemon = array('Blastoise' => 200000, 'Arcanine' => 200000, 'Gyarados' => 200000, 'Latios' => 200000, 'Latias' => 550000, 'Deoxys' => 200000, 'Electivire' => 250000, 'Lickilicky' => 250000, 'Halloween Magikarp' => 200000);
}
include '_header.php';
echo '<table><tr><th><font size="4"><img src="http://pkmnplanet.net/rpg/images/mugshots/ck/Roark.png" style="float:right"/>You can buy very rare and uncatchable Pokemon here, the Halloween Pokemon are only for a limited time, so collect and buy as many as you possibly can before they are removed or changed! </th></tr></table>';
if (isset($_POST['buyPoke'])) {
    $pokeName = $_POST['buyPoke'];
    if (in_array($pokeName, array_keys($salePokemon))) {
        $price = $salePokemon[$pokeName];
        if ($price > $userMoney) {
            echo '<div class="error">You do now have enough money!</div>';
        } else {
            $userMoney -= $price;
            giveUserPokemonByName($uid, $pokeName, 5, $type);
            updateUserMoney($uid, $userMoney);
            echo '
				<div class="notice">
					<img src="images/pokemon/' . $type . $pokeName . '.png" /><br />
					You bought a ' . $type . $pokeName . '.
				</div>
			';
        }
    } else {
        echo '<div class="error">This pokemon is not for sale!</div>';
    }
}
$cells = array();
foreach ($salePokemon as $name => $price) {
    $cells[] = '
Пример #3
0
$midnightToday = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$midnightTomorrow = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y'));
$timeNow = time();
echo '<div style="text-align: center; margin: 30px 0px;">';
if ($lastPromo < $midnightToday) {
    $legends = array('Genesect', 'Meloetta', 'Keldeo', 'Kyurem', 'Zekrom', 'Reshiram', 'Landorus', 'Thundurus', 'Tornadus', 'Terrakion', 'Cobalion', 'Victini', 'Rotom', 'Mesprit', 'Uxie', 'Azelf', 'Palkia', 'Heatran', 'Darkrai', 'Cresselia', 'Regigigas', 'Mew', 'Rayquaza', 'Arceus', 'Giratina', 'Lugia', 'Ho-oh', 'Jirachi', 'Kyogre', 'Groudon', 'Registeel', 'Regice', 'Regirock', 'Latias', 'Latios', 'Celebi', 'Raikou', 'Suicune', 'Entei', 'Deoxys', 'Dialga', 'Mewtwo', 'Articuno', 'Moltres', 'Zapdos', 'Manaphy', 'Shaymin', 'Phione', 'Virizion', 'Arceus (Bug)', 'Arceus (Dark)', 'Arceus (Dragon)', 'Arceus (Electric)', 'Arceus (Fighting)', 'Arceus (Fire)', 'Arceus (Flying)', 'Arceus (Ghost)', 'Arceus (Grass)', 'Arceus (Ground)', 'Arceus (Ice)', 'Arceus (Poison)', 'Arceus (Psychic)', 'Arceus (Rock)', 'Arceus (Steel)', 'Arceus (Unknown)', 'Arceus (Water)', 'Deoxys (Attack)', 'Deoxys (Defence)', 'Deoxys (Speed)', 'Rotom (Cut)', 'Rotom (Frost)', 'Rotom (Heat)', 'Rotom (Spin)', 'Rotom (Wash)');
    $nonLegendsSqlArray = array();
    foreach ($legends as $legend) {
        $nonLegendsSqlArray[] = " `name`!='{$legend}' ";
    }
    $nonLegendsSql = implode(' AND ', $nonLegendsSqlArray);
    $query = mysql_query("SELECT `name` FROM `pokemon` WHERE {$nonLegendsSql} ORDER BY RAND() LIMIT 1") or die;
    $rPoke = mysql_fetch_assoc($query);
    $level = rand(20, 40);
    $type = rand(1, 5) == 3 ? 'Shiny ' : '';
    giveUserPokemonByName($uid, $rPoke['name'], $level, $type);
    mysql_query("UPDATE `users` SET `last_promo`='{$timeNow}' WHERE `id`='{$uid}'");
    echo '

		<img src="images/pokemon/' . $type . $rPoke['name'] . '.png" /><br />

		You have received a level ' . $level . ', ' . $type . $rPoke['name'] . '!

	';
} else {
    echo '

		You already got the promo for today!<br />

		The next free gift will be available in ' . secondsToTimeSince($midnightTomorrow - $timeNow) . '