Beispiel #1
0
while (!$result3->EOF) {
    $row = $result3->fields;
    if ($row['link_dest'] == $sector && $row['link_start'] == $playerinfo['sector']) {
        $flag = 1;
    }
    $i++;
    $result3->MoveNext();
}
// Check if there was a valid warp link to move to
if ($flag == 1) {
    $ok = 1;
    $calledfrom = "move.php";
    include_once './check_fighters.php';
    if ($ok > 0) {
        $stamp = date("Y-m-d H:i:s");
        Tki\LogMove::writeLog($pdo_db, $playerinfo['ship_id'], $sector);
        $move_result = $db->Execute("UPDATE {$db->prefix}ships SET last_login = ?,turns = turns - 1, turns_used = turns_used + 1, sector = ? WHERE ship_id = ?;", array($stamp, $sector, $playerinfo['ship_id']));
        Tki\Db::LogDbErrors($pdo_db, $move_result, __LINE__, __FILE__);
        if (!$move_result) {
            // is this really STILL needed?
            $error = $db->ErrorMsg();
            mail($tkireg->admin_mail, "Move Error", "Start Sector: {$sectorinfo['sector_id']}\nEnd Sector: {$sector}\nPlayer: {$playerinfo['character_name']} - {$playerinfo['ship_id']}\n\nQuery:  {$query}\n\nSQL error: {$error}");
        }
    }
    // Enter code for checking dangers in new sector
    include_once './check_mines.php';
    if ($ok == 1) {
        header("Location: main.php");
    } else {
        Tki\Text::gotomain($pdo_db, $lang);
    }
Beispiel #2
0
                // You do not have enough turns left, and cannot embark on this journey.
                $langvars['l_rs_movetime'] = str_replace("[triptime]", number_format($triptime, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']), $langvars['l_rs_movetime']);
                echo $langvars['l_rs_movetime'] . "<br><br>";
                echo $langvars['l_rs_noturns'] . "<br><br>";
                $resx = $db->Execute("UPDATE {$db->prefix}ships SET cleared_defenses=' ' WHERE ship_id = ?;", array($playerinfo['ship_id']));
                Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
            } else {
                $ok = 1;
                $sector = $destination;
                $calledfrom = "rsmove.php";
                include_once './check_fighters.php';
                if ($ok > 0) {
                    // Output:
                    // You are now in sector X. You used Y turns, and gained Z energy units.
                    $langvars = Tki\Translate::load($pdo_db, $lang, array('rsmove', 'common', 'global_funcs', 'global_includes', 'combat', 'footer', 'news'));
                    $stamp = date("Y-m-d H:i:s");
                    $update = $db->Execute("UPDATE {$db->prefix}ships SET last_login = ?, sector = ?, ship_energy = ship_energy + ?, turns = turns - ?, turns_used = turns_used + ? WHERE ship_id = ?;", array($stamp, $destination, $energyscooped, $triptime, $triptime, $playerinfo['ship_id']));
                    Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
                    Tki\LogMove::writeLog($pdo_db, $playerinfo['ship_id'], $destination);
                    $langvars['l_rs_ready'] = str_replace("[sector]", $destination, $langvars['l_rs_ready']);
                    $langvars['l_rs_ready'] = str_replace("[triptime]", number_format($triptime, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']), $langvars['l_rs_ready']);
                    $langvars['l_rs_ready'] = str_replace("[energy]", number_format($energyscooped, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']), $langvars['l_rs_ready']);
                    echo $langvars['l_rs_ready'] . "<br><br>";
                    include_once './check_mines.php';
                }
            }
        }
    }
}
Tki\Text::gotomain($pdo_db, $lang);
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
Beispiel #3
0
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// File: sched_tow.php
echo "<strong>ZONES</strong><br><br>";
echo "Towing bigger players out of restricted zones...";
$num_to_tow = 0;
do {
    $res = $db->Execute("SELECT ship_id,character_name,hull,sector,{$db->prefix}universe.zone_id,max_hull FROM {$db->prefix}ships,{$db->prefix}universe,{$db->prefix}zones WHERE sector=sector_id AND {$db->prefix}universe.zone_id={$db->prefix}zones.zone_id AND max_hull<>0 AND (({$db->prefix}ships.hull + {$db->prefix}ships.engines + {$db->prefix}ships.computer + {$db->prefix}ships.beams + {$db->prefix}ships.torp_launchers + {$db->prefix}ships.shields + {$db->prefix}ships.armor)/7) >max_hull AND ship_destroyed='N'");
    Tki\Db::LogDbErrors($pdo_db, $res, __LINE__, __FILE__);
    if ($res) {
        $num_to_tow = $res->RecordCount();
        echo "<br>{$num_to_tow} players to tow:<br>";
        while (!$res->EOF) {
            $row = $res->fields;
            echo "...towing {$row['character_name']} out of {$row['sector']} ...";
            $newsector = random_int(0, (int) $max_sectors - 1);
            echo " to sector {$newsector}.<br>";
            $query = $db->Execute("UPDATE {$db->prefix}ships SET sector = ?, cleared_defenses=' ' WHERE ship_id=?", array($newsector, $row['ship_id']));
            Tki\Db::LogDbErrors($pdo_db, $query, __LINE__, __FILE__);
            Tki\PlayerLog::WriteLog($pdo_db, $row['ship_id'], LOG_TOW, "{$row['sector']}|{$newsector}|{$row['max_hull']}");
            Tki\LogMove::writeLog($pdo_db, $row['ship_id'], $newsector);
            $res->MoveNext();
        }
    } else {
        echo "<br>No players to tow.<br>";
    }
} while ($num_to_tow);
echo "<br>";
$multiplier = 0;
// No need to run this again
Beispiel #4
0
 if ($shipavg > $tkireg->max_ewdhullsize) {
     $chance = ($shipavg - $tkireg->max_ewdhullsize) * 10;
 } else {
     $chance = 0;
 }
 $random_value = random_int(1, 100);
 if ($targetinfo['dev_emerwarp'] > 0 && $random_value > $chance) {
     // Need to change warp destination to random sector in universe
     $rating_change = round($targetinfo['rating'] * 0.1);
     $dest_sector = random_int(1, (int) $tkireg->max_sectors - 1);
     $resx = $db->Execute("UPDATE {$db->prefix}ships SET turns = turns - 1, turns_used = turns_used + 1, " . "rating = rating - ? " . "WHERE ship_id = ?;", array($rating_change, $playerinfo['ship_id']));
     Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
     Tki\PlayerLog::WriteLog($pdo_db, $targetinfo['ship_id'], LOG_ATTACK_EWD, "{$playerinfo['character_name']}");
     $result_warp = $db->Execute("UPDATE {$db->prefix}ships SET sector = {$dest_sector}, " . "dev_emerwarp = dev_emerwarp - 1, cleared_defenses = ' ' " . "WHERE ship_id = ?;", array($targetinfo['ship_id']));
     Tki\Db::LogDbErrors($pdo_db, $result_warp, __LINE__, __FILE__);
     Tki\LogMove::writeLog($pdo_db, $targetinfo['ship_id'], $dest_sector);
     echo $langvars['l_att_ewd'] . "<br><br>";
 } else {
     // Bounty-free Xenobe attacking allowed
     if (($targetscore / $playerscore < $bounty_ratio || $targetinfo['turns_used'] < $bounty_minturns) && preg_match("/(\\@xenobe)\$/", $targetinfo['email']) === 0) {
         // Changed xenobe check to a regexp cause a player could put
         // @xen or whatever in his email address
         // so (\@xenobe) is an exact match and the $ symbol means
         // "this is the *end* of the string
         // Our custom @xenobe names will match, nothing else will
         // Check to see if there is Federation bounty on the player.
         // If there is, people can attack regardless.
         $btyamount = 0;
         $hasbounty = $db->Execute("SELECT SUM(amount) AS btytotal FROM {$db->prefix}bounty WHERE " . "bounty_on = ? AND placed_by = 0;", array($targetinfo['ship_id']));
         Tki\Db::LogDbErrors($pdo_db, $hasbounty, __LINE__, __FILE__);
         if ($hasbounty) {
Beispiel #5
0
 $result2 = $db->Execute("SELECT ship_id FROM {$db->prefix}ships WHERE email = ?;", array($username));
 Tki\Db::LogDbErrors($pdo_db, $result2, __LINE__, __FILE__);
 $shipid = $result2->fields;
 // To do: build a bit better "new player" message
 $langvars['l_new_message'] = str_replace('[pass]', $filtered_post_password, $langvars['l_new_message']);
 $langvars['l_new_message'] = str_replace('[ip]', $request->server->get('REMOTE_ADDR'), $langvars['l_new_message']);
 // Some reason \r\n is broken, so replace them now.
 $langvars['l_new_message'] = str_replace('\\r\\n', "\r\n", $langvars['l_new_message']);
 $link_to_game_unsafe = 'https://' . $request->server->get('HTTP_HOST') . Tki\SetPaths::setGamepath();
 $link_to_game = htmlentities($link_to_game_unsafe, ENT_QUOTES | ENT_HTML5, 'UTF-8');
 $langvars['l_new_message'] = str_replace('[website]', $link_to_game, $langvars['l_new_message']);
 $langvars['l_new_message'] = str_replace('[npg]', $link_to_game . 'newplayerguide.php', $langvars['l_new_message']);
 $langvars['l_new_message'] = str_replace('[faq]', $link_to_game . 'faq.php', $langvars['l_new_message']);
 $langvars['l_new_message'] = str_replace('[forums]', 'https://kabal-invasion.com/forums/', $langvars['l_new_message']);
 mail("{$username}", $langvars['l_new_topic'], $langvars['l_new_message'] . "\r\n\r\n" . $link_to_game, 'From: ' . $tkireg->admin_mail . "\r\nReply-To: " . $tkireg->admin_mail . "\r\nX-Mailer: PHP/" . phpversion());
 Tki\LogMove::writeLog($pdo_db, $shipid['ship_id'], 0);
 // A new player is placed into sector 0. Make sure his movement log shows it, so they see it on the galaxy map.
 $resx = $db->Execute("INSERT INTO {$db->prefix}zones VALUES (NULL, ?, ?, 'N', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 0);", array($character . "\\'s Territory", $shipid['ship_id']));
 Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
 $resx = $db->Execute("INSERT INTO {$db->prefix}ibank_accounts (ship_id,balance,loan) VALUES (?,0,0);", array($shipid['ship_id']));
 Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
 // Add presets for new player
 for ($zz = 0; $zz < $tkireg->max_presets; $zz++) {
     $sql = "INSERT INTO ::prefix::presets (ship_id, preset, type) " . "VALUES (:ship_id, :preset, :type)";
     $stmt = $pdo_db->prepare($sql);
     $stmt->bindParam(':ship_id', $shipid['ship_id']);
     $stmt->bindValue(':preset', 1);
     $stmt->bindValue(':type', 'R');
     $resxx = $stmt->execute();
 }
 echo $langvars['l_new_welcome_sent'] . '<br><br>';