コード例 #1
0
ファイル: sched_ranking.php プロジェクト: thekabal/tki
<?php

// The Kabal Invasion - A web-based 4X space game
// Copyright © 2014 The Kabal Invasion development team, Ron Harwood, and the BNT development team
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Affero General Public License as
//  published by the Free Software Foundation, either version 3 of the
//  License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Affero General Public License for more details.
//
//  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_ranking.php
echo "<strong>Ranking</strong><br><br>";
$res = $db->Execute("SELECT ship_id FROM {$db->prefix}ships WHERE ship_destroyed='N'");
Tki\Db::LogDbErrors($pdo_db, $res, __LINE__, __FILE__);
while (!$res->EOF) {
    Tki\Score::updateScore($pdo_db, $res->fields['ship_id'], $tkireg, $playerinfo);
    $res->MoveNext();
}
echo "<br>";
$multiplier = 0;
コード例 #2
0
ファイル: bounty.php プロジェクト: thekabal/tki
 }
 if ($bounty_on == $playerinfo['ship_id']) {
     echo $langvars['l_by_yourself'] . "<br><br>";
     Tki\Text::gotomain($pdo_db, $lang);
     Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
     die;
 }
 if ($amount > $playerinfo['credits']) {
     echo $langvars['l_by_notenough'] . "<br><br>";
     Tki\Text::gotomain($pdo_db, $lang);
     Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
     die;
 }
 if ($tkireg->max_bountyvalue != 0) {
     $percent = $tkireg->max_bountyvalue * 100;
     $score = Tki\Score::updateScore($pdo_db, $playerinfo['ship_id'], $tkireg, $playerinfo);
     $maxtrans = $score * $score * $tkireg->max_bountyvalue;
     $previous_bounty = 0;
     $pb = $db->Execute("SELECT SUM(amount) AS totalbounty FROM {$db->prefix}bounty WHERE bounty_on = ? AND placed_by = ?;", array($bounty_on, $playerinfo['ship_id']));
     Tki\Db::LogDbErrors($pdo_db, $pb, __LINE__, __FILE__);
     if ($pb) {
         $prev = $pb->fields;
         $previous_bounty = $prev['totalbounty'];
     }
     if ($amount + $previous_bounty > $maxtrans) {
         $langvars['l_by_toomuch'] = str_replace("[percent]", $percent, $langvars['l_by_toomuch']);
         echo $langvars['l_by_toomuch'] . "<br><br>";
         Tki\Text::gotomain($pdo_db, $lang);
         Tki\Footer::display($pdo_db, $lang, $tkireg, $template);
         die;
     }
コード例 #3
0
ファイル: planet.php プロジェクト: thekabal/tki
             }
             $res->MoveNext();
         }
     }
     $update = $db->Execute("UPDATE {$db->prefix}ships SET turns = turns - 1, turns_used = turns_used + 1 WHERE ship_id = ?;", array($playerinfo['ship_id']));
     Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
 } elseif ($command == "capture" && $planetinfo['owner'] == 0) {
     echo $langvars['l_planet_captured'] . "<br>";
     $update = $db->Execute("UPDATE {$db->prefix}planets SET team = 0, owner = ?, base = 'N', defeated = 'N' WHERE planet_id = ?;", array($playerinfo['ship_id'], $planet_id));
     Tki\Db::LogDbErrors($pdo_db, $update, __LINE__, __FILE__);
     $ownership = Tki\Ownership::calc($pdo_db, $playerinfo['sector'], $tkireg, $langvars);
     if ($ownership !== null) {
         echo "{$ownership}<p>";
     }
     if ($planetinfo['owner'] != 0) {
         Tki\Score::updateScore($pdo_db, $planetinfo['owner'], $tkireg, $playerinfo);
     }
     if ($planetinfo['owner'] != 0) {
         $sql = "SELECT character_name FROM ::prefix::ships WHERE ship_id=:ship_id LIMIT 1";
         $stmt = $pdo_db->prepare($sql);
         $stmt->bindParam(':ship_id', $planetinfo['owner']);
         $stmt->execute();
         $planetowner = $stmt->fetch(PDO::FETCH_ASSOC);
     } else {
         $planetowner = $langvars['l_planet_noone'];
     }
     Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_PLANET_CAPTURED, "{$planetinfo['colonists']}|{$planetinfo['credits']}|{$planetowner}");
 } elseif ($command == "capture" && ($planetinfo['owner'] == 0 || $planetinfo['defeated'] == 'Y')) {
     echo $langvars['l_planet_notdef'] . "<br>";
     $resx = $db->Execute("UPDATE {$db->prefix}planets SET defeated='N' WHERE planet_id = ?;", array($planetinfo['planet_id']));
     Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);