Ejemplo n.º 1
0
                 $success = 95;
             }
             $roll = random_int(1, 100);
             if ($roll < $success) {
                 echo "<strong>" . $row['character_name'] . " " . $langvars['l_planet_ison'] . "</strong><br>";
             }
             $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'];
     }
Ejemplo n.º 2
0
         Tki\Db::LogDbErrors($pdo_db, $resy, __LINE__, __FILE__);
         $resz = $db->Execute("UPDATE {$db->prefix}teams SET number_of_members = number_of_members - 1, creator = ? WHERE id = ?;", array($newcreator, $whichteam));
         Tki\Db::LogDbErrors($pdo_db, $resz, __LINE__, __FILE__);
         $res = $db->Execute("SELECT DISTINCT sector_id FROM {$db->prefix}planets WHERE owner = ? AND base = 'Y' AND team <> 0;", array($playerinfo['ship_id']));
         Tki\Db::LogDbErrors($pdo_db, $res, __LINE__, __FILE__);
         $i = 0;
         while (!$res->EOF) {
             $sectors[$i] = $res->fields['sector_id'];
             $i++;
             $res->MoveNext();
         }
         $resx = $db->Execute("UPDATE {$db->prefix}planets SET team = 0 WHERE owner = ?;", array($playerinfo['ship_id']));
         Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
         if ($sectors !== null) {
             foreach ($sectors as $sector) {
                 Tki\Ownership::calc($pdo_db, $sector, $tkireg->min_bases_to_own, $langvars);
             }
         }
         Tki\PlayerLog::WriteLog($pdo_db, $playerinfo['ship_id'], LOG_TEAM_NEWLEAD, $team['team_name'] . "|" . $newcreatorname['character_name']);
         Tki\PlayerLog::WriteLog($pdo_db, $newcreator, LOG_TEAM_LEAD, $team['team_name']);
     }
     echo "<br><br><a href=\"teams.php\">" . $langvars['l_clickme'] . "</a> " . $langvars['l_team_menu'] . ".<br><br>";
     break;
 case 3:
     // Join a team
     if ($playerinfo['team'] != 0) {
         echo $langvars['l_team_leavefirst'] . "<br>";
     } else {
         if ($playerinfo['team_invite'] == $whichteam) {
             $resx = $db->Execute("UPDATE {$db->prefix}ships SET team = ?, team_invite = 0 WHERE ship_id = ?;", array($whichteam, $playerinfo['ship_id']));
             Tki\Db::LogDbErrors($pdo_db, $resx, __LINE__, __FILE__);
Ejemplo n.º 3
0
    $planetinfo = $result2->fields;
}
if ($planetinfo['owner'] == $playerinfo['ship_id'] || $planetinfo['team'] == $playerinfo['team'] && $playerinfo['team'] > 0) {
    echo "<h1>" . $title . "</h1>\n";
    if ($action == "planetteam") {
        echo $langvars['l_teamm_toteam'] . "<br>";
        $result = $db->Execute("UPDATE {$db->prefix}planets SET team=?, owner=? WHERE planet_id = ?;", array($playerinfo['team'], $playerinfo['ship_id'], $planet_id));
        Tki\Db::LogDbErrors($pdo_db, $result, __LINE__, __FILE__);
        $ownership = Tki\Ownership::calc($pdo_db, $playerinfo['sector'], $tkireg->min_bases_to_own, $langvars);
        if ($ownership !== null) {
            echo "<p>{$ownership}<p>";
        }
    }
    if ($action == "planetpersonal") {
        echo $langvars['l_teamm_topersonal'] . "<br>";
        $result = $db->Execute("UPDATE {$db->prefix}planets SET team='0', owner = ? WHERE planet_id = ?;", array($playerinfo['ship_id'], $planet_id));
        Tki\Db::LogDbErrors($pdo_db, $result, __LINE__, __FILE__);
        $ownership = Tki\Ownership::calc($pdo_db, $playerinfo['sector'], $tkireg->min_bases_to_own, $langvars);
        // Kick other players off the planet
        $result = $db->Execute("UPDATE {$db->prefix}ships SET on_planet='N' WHERE on_planet='Y' AND planet_id = ? AND ship_id <> ?;", array($planet_id, $playerinfo['ship_id']));
        Tki\Db::LogDbErrors($pdo_db, $result, __LINE__, __FILE__);
        if ($ownership !== null) {
            echo "<p>" . $ownership . "<p>";
        }
    }
    Tki\Text::gotomain($pdo_db, $lang);
} else {
    echo "<br>" . $langvars['l_team_exploit'] . "<br>";
    Tki\Text::gotomain($pdo_db, $lang);
}
Tki\Footer::display($pdo_db, $lang, $tkireg, $template);