当前位置: 首页>>代码示例>>PHP>>正文


PHP LoadUniverse函数代码示例

本文整理汇总了PHP中LoadUniverse函数的典型用法代码示例。如果您正苦于以下问题:PHP LoadUniverse函数的具体用法?PHP LoadUniverse怎么用?PHP LoadUniverse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LoadUniverse函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SendNotActivated

function SendNotActivated()
{
    global $GlobalUser;
    $unitab = LoadUniverse();
    $uni = $unitab['num'];
    echo "<html>\n";
    echo " <head>\n";
    echo "  <link rel='stylesheet' type='text/css' href='css/default.css' />\n";
    echo "  <link rel='stylesheet' type='text/css' href='css/formate.css' />\n";
    echo "  <link rel=\"stylesheet\" type=\"text/css\" href=\"formate.css\" />\n";
    echo "  <link rel=\"stylesheet\" type=\"text/css\" href=\"css/combox.css\">\n";
    echo "  <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\n";
    echo "  <title>Вселенная {$uni} ОГейм</title>\n";
    echo " </head>\n\n";
    echo " <body>\n";
    echo "  <center><font size=\"3\"><b>\n";
    echo "    <br /><br />\n";
    echo "    <font color=\"#FF0000\">Произошла ошбка</font>\n";
    echo "    <br /><br />\n";
    echo "    Эта функция доступна только после активации аккаунта.    \n";
    echo "    <br /><br />\n";
    echo "    Error-ID: 123456  </b></font></center>\n\n";
    echo " </body>\n";
    echo "</html>\n\n";
}
开发者ID:vksavochkin,项目名称:ogame-opensource,代码行数:25,代码来源:writemessages.php

示例2: SetUniParam

function SetUniParam($speed, $fspeed, $acs, $fid, $did, $defrepair, $defrepair_delta, $galaxies, $systems, $rapid, $moons, $freeze, $lang)
{
    global $db_prefix;
    global $GlobalUni;
    $query = "UPDATE " . $db_prefix . "uni SET lang='" . $lang . "', freeze={$freeze}, speed={$speed}, fspeed={$fspeed}, acs={$acs}, fid={$fid}, did={$did}, defrepair={$defrepair}, defrepair_delta={$defrepair_delta}, galaxies={$galaxies}, systems={$systems}, rapid={$rapid}, moons={$moons}";
    dbquery($query);
    $GlobalUni = LoadUniverse();
}
开发者ID:vksavochkin,项目名称:ogame-opensource,代码行数:8,代码来源:uni.php

示例3: loca_add

loca_add("menu", $GlobalUni['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
PageHeader("messages");
// *******************************************************************
$MAXMSG = 25;
// Количество сообщений на странице.
$uni = LoadUniverse();
DeleteExpiredMessages($GlobalUser['player_id']);
// Удалить сообщения которые хранятся дольше 24 часов.
// Заголовок таблицы
echo "<!-- CONTENT AREA -->\n";
echo "<div id='content'>\n";
echo "<center>\n";
//echo "GET: "; print_r ($_GET); echo "<br>";
//echo "POST: "; print_r ($_POST); echo "<br>";
if (method() === "POST") {
    //print_r ($_POST);
    $player_id = $GlobalUser['player_id'];
    if ($_POST['deletemessages'] === "deleteall") {
        DeleteAllMessages($player_id);
    } else {
        $result = EnumMessages($GlobalUser['player_id'], $MAXMSG);
开发者ID:vksavochkin,项目名称:ogame-opensource,代码行数:31,代码来源:messages.php

示例4: va

function va($subject)
{
    $num_arg = func_num_args();
    $pattern = array();
    for ($i = 1; $i < $num_arg; $i++) {
        $pattern[$i - 1] = "/#{$i}/";
        $replace[$i - 1] = func_get_arg($i);
    }
    return preg_replace($pattern, $replace, $subject);
}
// Соединиться с базой данных
dbconnect($db_host, $db_user, $db_pass, $db_name);
dbquery("SET NAMES 'utf8';");
dbquery("SET CHARACTER SET 'utf8';");
dbquery("SET SESSION collation_connection = 'utf8_general_ci';");
$GlobalUni = LoadUniverse();
if (!$GlobalUni['freeze']) {
    echo "<html><head><meta http-equiv='refresh' content='0;url={$StartPage}' /></head><body></body>";
    ob_end_flush();
    die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?php 
echo loca("MAINTAIN_TITLE");
?>
</title>
    <style type="text/css" >
开发者ID:Ansty93,项目名称:ogame-opensource,代码行数:31,代码来源:maintenance.php

示例5: loca_add

loca_add("techlong", $GlobalUser['lang']);
loca_add("jumpgate", $GlobalUser['lang']);
if (key_exists('cp', $_GET)) {
    SelectPlanet($GlobalUser['player_id'], intval($_GET['cp']));
}
$GlobalUser['aktplanet'] = GetSelectedPlanet($GlobalUser['player_id']);
$now = time();
UpdateQueue($now);
$aktplanet = GetPlanet($GlobalUser['aktplanet']);
$aktplanet = ProdResources($aktplanet, $aktplanet['lastpeek'], $now);
UpdatePlanetActivity($aktplanet['planet_id']);
UpdateLastClick($GlobalUser['player_id']);
$session = $_GET['session'];
$fleetmap = array(215, 214, 213, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202);
// ***************************************************************************************
$unitab = LoadUniverse();
$speed = $unitab['speed'];
$drepair = $unitab['defrepair'];
function rgnum($num)
{
    if ($num < 0) {
        return "<font color=\"#FF0000\">" . nicenum($num) . "</font>";
    } else {
        if ($num > 0) {
            return "<font color=\"#00FF00\">" . nicenum($num) . "</font>";
        } else {
            return nicenum($num);
        }
    }
}
function rapidIn($gid, $n)
开发者ID:Ansty93,项目名称:ogame-opensource,代码行数:31,代码来源:infos.php

示例6: Login

function Login($login, $pass, $passmd = "", $from_validate = 0)
{
    global $db_prefix, $db_secret;
    $unitab = LoadUniverse();
    $uni = $unitab['num'];
    if ($player_id = CheckPassword($login, $pass, $passmd)) {
        // Пользователь заблокирован?
        $user = LoadUser($player_id);
        if ($user['banned']) {
            UpdateLastClick($player_id);
            // Обновить активность пользователя, чтобы можно было продлять удаление.
            echo "<html><head><meta http-equiv='refresh' content='0;url=" . hostname() . "game/reg/errorpage.php?errorcode=3&arg1={$uni}&arg2={$login}&arg3=" . $user['banned_until'] . "' /></head><body></body>";
            ob_end_flush();
            exit;
        }
        $lastlogin = time();
        // Создать приватную сессию.
        $prsess = md5($login . $lastlogin . $db_secret);
        // Создать публичную сессию
        $sess = substr(md5($prsess . sha1($pass) . $db_secret . $lastlogin), 0, 12);
        // Записать приватную сессию в кукисы и обновить БД.
        setcookie("prsess_" . $player_id . "_" . $uni, $prsess, time() + 24 * 60 * 60, "/");
        $query = "UPDATE " . $db_prefix . "users SET lastlogin = {$lastlogin}, session = '" . $sess . "', private_session = '" . $prsess . "' WHERE player_id = {$player_id}";
        dbquery($query);
        // Записать IP-адрес.
        $ip = $_SERVER['REMOTE_ADDR'];
        $query = "UPDATE " . $db_prefix . "users SET ip_addr = '" . $ip . "' WHERE player_id = {$player_id}";
        dbquery($query);
        //echo "ID пользователя: $player_id<br>Приватная сессия: $prsess<br>Публичная сессия: $sess<br>IP-адрес: $ip";
        // Выбрать Главную планету текущей.
        $query = "SELECT * FROM " . $db_prefix . "users WHERE session = '" . $sess . "'";
        $result = dbquery($query);
        $user = dbarray($result);
        SelectPlanet($player_id, $user['hplanetid']);
        // Задание глобальной отгрузки игроков, чистки виртуальных ПО, чистки уничтоженных планет, пересчёт статистики альянсов и прочие глобальные события
        AddReloginEvent();
        AddCleanDebrisEvent();
        AddCleanPlanetsEvent();
        AddCleanPlayersEvent();
        AddRecalcAllyPointsEvent();
        // Задание пересчёта очков игрока.
        AddUpdateStatsEvent();
        AddRecalcPointsEvent($player_id);
        setcookie('ogamelang', $user['lang'], time() + 60 * 60 * 24 * 9999, "/");
        // Редирект на Обзор Главной планеты.
        header("Location: " . hostname() . "game/index.php?page=overview&session=" . $sess . "&lgn=1");
        echo "<html><head><meta http-equiv='refresh' content='0;url=" . hostname() . "game/index.php?page=overview&session=" . $sess . "&lgn=1' /></head><body></body>";
        LogIPAddress($ip, $player_id);
    } else {
        header("Location: " . hostname() . "game/reg/errorpage.php?errorcode=2&arg1={$uni}&arg2={$login}");
        echo "<html><head><meta http-equiv='refresh' content='0;url=" . hostname() . "game/reg/errorpage.php?errorcode=2&arg1={$uni}&arg2={$login}' /></head><body></body>";
    }
    ob_end_flush();
    exit;
}
开发者ID:Ansty93,项目名称:ogame-opensource,代码行数:55,代码来源:user.php

示例7: Admin_Users

function Admin_Users()
{
    global $session;
    global $db_prefix;
    global $GlobalUser;
    global $FleetMissionList;
    $now = time();
    $resmap = array(106, 108, 109, 110, 111, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 199);
    $unitab = LoadUniverse();
    $speed = $unitab['speed'];
    // Обработка POST-запроса.
    if (method() === "POST" && $GlobalUser['admin'] >= 2) {
        if (key_exists('player_id', $_GET)) {
            $player_id = intval($_GET['player_id']);
        } else {
            $player_id = 0;
        }
        if (key_exists('action', $_GET) && $player_id) {
            $action = $_GET['action'];
        } else {
            $action = "";
        }
        if ($action === "update") {
            $query = "UPDATE " . $db_prefix . "users SET ";
            foreach ($resmap as $i => $gid) {
                $query .= "r{$gid} = " . intval($_POST["r{$gid}"]) . ", ";
            }
            if ($_POST['deaktjava'] === "on") {
                $query .= "disable = 1, disable_until = " . ($now + 7 * 24 * 60 * 60) . ", ";
            } else {
                $query .= "disable = 0, ";
            }
            if ($_POST['vacation'] === "on") {
                $query .= "vacation = 1, vacation_until = " . ($now + 2 * 24 * 60 * 60 / $speed) . ", ";
            } else {
                $query .= "vacation = 0, ";
            }
            if ($_POST['banned'] !== "on") {
                $query .= "banned = 0, ";
            }
            if ($_POST['noattack'] !== "on") {
                $query .= "noattack = 0, ";
            }
            $query .= "pemail = '" . $_POST['pemail'] . "', ";
            $query .= "email = '" . $_POST['email'] . "', ";
            $query .= "admin = '" . $_POST['admin'] . "', ";
            $query .= "validated = " . ($_POST['validated'] === "on" ? 1 : 0) . ", ";
            $query .= "sniff = " . ($_POST['sniff'] === "on" ? 1 : 0) . ", ";
            $query .= "debug = " . ($_POST['debug'] === "on" ? 1 : 0) . ", ";
            $query .= "dm = '" . intval($_POST['dm']) . "', ";
            $query .= "dmfree = '" . intval($_POST['dmfree']) . "', ";
            $query .= "sortby = '" . intval($_POST['settings_sort']) . "', ";
            $query .= "sortorder = '" . intval($_POST['settings_order']) . "', ";
            $query .= "skin = '" . $_POST['dpath'] . "', ";
            $query .= "useskin = " . ($_POST['design'] === "on" ? 1 : 0) . ", ";
            $query .= "deact_ip = " . ($_POST['deact_ip'] === "on" ? 1 : 0) . ", ";
            $query .= "maxspy = '" . intval($_POST['spio_anz']) . "', ";
            $query .= "maxfleetmsg = '" . intval($_POST['settings_fleetactions']) . "' ";
            $query .= " WHERE player_id={$player_id};";
            dbquery($query);
            $qname = array('CommanderOff', 'AdmiralOff', 'EngineerOff', 'GeologeOff', 'TechnocrateOff');
            foreach ($qname as $i => $qcmd) {
                $days = intval($_POST[$qcmd]);
                if ($days > 0) {
                    RecruitOfficer($player_id, $qcmd, $days * 24 * 60 * 60);
                }
            }
        }
        if ($action === "create_planet") {
            $g = $_POST['g'];
            if ($g === "") {
                $g = 1;
            }
            $s = $_POST['s'];
            if ($s === "") {
                $s = 1;
            }
            $p = $_POST['p'];
            if ($p === "") {
                $p = 1;
            }
            if (!HasPlanet($g, $s, $p)) {
                $planet_id = CreatePlanet($g, $s, $p, $_GET['player_id']);
                $query = "UPDATE " . $db_prefix . "planets SET mprod = 0, kprod = 0, dprod = 0 WHERE planet_id = " . $planet_id;
                dbquery($query);
            }
        }
    }
    // Обработка GET-запроса.
    if (method() === "GET" && $GlobalUser['admin'] >= 2) {
        if (key_exists('player_id', $_GET)) {
            $player_id = intval($_GET['player_id']);
        } else {
            $player_id = 0;
        }
        if (key_exists('action', $_GET) && $player_id) {
            $action = $_GET['action'];
        } else {
            $action = "";
        }
//.........这里部分代码省略.........
开发者ID:vksavochkin,项目名称:ogame-opensource,代码行数:101,代码来源:admin_users.php

示例8: GetHoldingFleets

function GetHoldingFleets($planet_id)
{
    global $db_prefix;
    $uni = LoadUniverse();
    // ограничить количество флотов настройками вселенной
    $max = max(0, $uni['acs'] * $uni['acs'] - 1);
    $query = "SELECT * FROM " . $db_prefix . "fleet WHERE mission = 205 AND target_planet = {$planet_id} LIMIT {$max}";
    $result = dbquery($query);
    return $result;
}
开发者ID:Ansty93,项目名称:ogame-opensource,代码行数:10,代码来源:fleet.php

示例9: Admin_Uni

function Admin_Uni()
{
    global $db_prefix;
    global $GlobalUser;
    global $session;
    $now = time();
    if (method() === "POST" && $GlobalUser['admin'] >= 2) {
        if (key_exists('news_upd', $_POST)) {
            if ($_POST['news_upd'] > 0) {
                UpdateNews($_POST['news1'], $_POST['news2'], $_POST['news_upd']);
            }
        }
        if ($_POST['news_off'] === "on") {
            DisableNews();
        }
        $rapid = $_POST['rapid'] === "on" ? 1 : 0;
        $moons = $_POST['moons'] === "on" ? 1 : 0;
        $freeze = $_POST['freeze'] === "on" ? 1 : 0;
        SetUniParam($_POST['speed'], $_POST['fspeed'], $_POST['acs'], $_POST['fid'], $_POST['did'], $_POST['defrepair'], $_POST['defrepair_delta'], $_POST['galaxies'], $_POST['systems'], $rapid, $moons, $freeze);
        // Включить принудительное РО активным игрокам, если вселенная ставится на паузу.
        if ($freeze) {
            $days7 = $now - 7 * 24 * 60 * 60;
            $query = "UPDATE " . $db_prefix . "users SET vacation = 1, vacation_until = " . $now . " WHERE lastclick >= {$days7}";
            dbquery($query);
        }
        //print_r ( $_POST );
    }
    $unitab = LoadUniverse();
    ?>

<?php 
    echo AdminPanel();
    ?>

<table >
<form action="index.php?page=admin&session=<?php 
    echo $session;
    ?>
&mode=Uni" method="POST" >
<tr><td class=c colspan=2>Настройки Вселенной <?php 
    echo $unitab['num'];
    ?>
</td></tr>
<tr><th>Дата открытия</th><th><?php 
    echo date("Y-m-d H:i:s", $unitab['startdate']);
    ?>
</th></tr>
<tr><th>Количество игроков</th><th><?php 
    echo $unitab['usercount'];
    ?>
</th></tr>
<tr><th>Максимальное количество игроков</th><th><input type="text" name="maxusers" maxlength="10" size="10" value="<?php 
    echo $unitab['maxusers'];
    ?>
" /></th></tr>
<tr><th>Количество галактик</th><th><input type="text" name="galaxies" maxlength="3" size="3" value="<?php 
    echo $unitab['galaxies'];
    ?>
" /></th></tr>
<tr><th>Количество систем в галактике</th><th><input type="text" name="systems" maxlength="3" size="3" value="<?php 
    echo $unitab['systems'];
    ?>
" /></th></tr>

  <tr>
   <th>Ускорение игры</th>
   <th>
   <select name="speed">
     <option value="1" <?php 
    echo UniIsSelected($unitab['speed'], 1);
    ?>
>1x</option>
     <option value="2" <?php 
    echo UniIsSelected($unitab['speed'], 2);
    ?>
>2x</option>
     <option value="3" <?php 
    echo UniIsSelected($unitab['speed'], 3);
    ?>
>3x</option>
     <option value="4" <?php 
    echo UniIsSelected($unitab['speed'], 4);
    ?>
>4x</option>
     <option value="5" <?php 
    echo UniIsSelected($unitab['speed'], 5);
    ?>
>5x</option>
     <option value="6" <?php 
    echo UniIsSelected($unitab['speed'], 6);
    ?>
>6x</option>
     <option value="7" <?php 
    echo UniIsSelected($unitab['speed'], 7);
    ?>
>7x</option>
     <option value="8" <?php 
    echo UniIsSelected($unitab['speed'], 8);
    ?>
>8x</option>
//.........这里部分代码省略.........
开发者ID:Ansty93,项目名称:ogame-opensource,代码行数:101,代码来源:admin_uni.php

示例10: CreateHomePlanet

function CreateHomePlanet($player_id)
{
    global $db_prefix;
    $ss = 15;
    $uni = LoadUniverse();
    $ppg = $ss * $uni['systems'];
    // количество планет в галактике
    $sg = 1;
    // стартовая галактика для регистрации
    $planet = array();
    for ($i = 0; $i < ($sg - 1) * $ppg; $i++) {
        $planet[$i] = 1;
    }
    for ($i; $i < $uni['galaxies'] * $ppg; $i++) {
        $planet[$i] = 0;
    }
    $query = "SELECT * FROM " . $db_prefix . "planets WHERE g >= {$sg} AND p <= {$ss} AND type <> 10002 ORDER BY g, s, p";
    $result = dbquery($query);
    $rows = dbrows($result);
    while ($rows--) {
        $destination = dbarray($result);
        $d = ($destination['g'] - 1) * $ppg + ($destination['s'] - 1) * $ss + $destination['p'] - 1;
        $planet[$d] = 1;
    }
    $d = ($sg - 1) * $ppg;
    while ($d < $ppg * 9) {
        $g = floor($d / $ppg) + 1;
        $dd = $d - ($g - 1) * $ppg;
        $s = floor($dd / $ss) + 1;
        $p = $dd % $ss + 1;
        if (!$planet[floor($d)] && $g >= 1 && $p > 3 && $p < 13) {
            return CreatePlanet($g, $s, $p, $player_id, 0);
        }
        $d += 1.3;
    }
    Error("No more planets!!!");
}
开发者ID:Ansty93,项目名称:ogame-opensource,代码行数:37,代码来源:planet.php

示例11: ExpeditionBattle

function ExpeditionBattle($fleet_id, $pirates, $level, $when)
{
    global $db_prefix;
    global $GlobalUni;
    $fleetmap = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215);
    $defmap = array(401, 402, 403, 404, 405, 406, 407, 408);
    $a_result = array(0 => "combatreport_ididattack_iwon", 1 => "combatreport_ididattack_ilost", 2 => "combatreport_ididattack_draw");
    global $db_host, $db_user, $db_pass, $db_name, $db_prefix;
    $a = array();
    $d = array();
    $unitab = LoadUniverse();
    $fid = $unitab['fid'];
    $did = $unitab['did'];
    $rf = $unitab['rapid'];
    // *** Союзные атаки не должны вступать битву. Игнорировать их.
    $f = LoadFleet($fleet_id);
    // *** Сгенерировать исходные данные
    // Список атакующих
    $anum = 0;
    $a[0] = LoadUser($f['owner_id']);
    $a[0]['fleet'] = array();
    foreach ($fleetmap as $i => $gid) {
        $a[0]['fleet'][$gid] = abs($f["ship{$gid}"]);
    }
    $start_planet = GetPlanet($f['start_planet']);
    $a[0]['g'] = $start_planet['g'];
    $a[0]['s'] = $start_planet['s'];
    $a[0]['p'] = $start_planet['p'];
    $a[0]['id'] = $fleet_id;
    $a[0]['points'] = $a[0]['fpoints'] = 0;
    $anum++;
    // Список обороняющихся
    $dnum = 0;
    $d[0] = LoadUser(99999);
    if ($pirates) {
        $d[0]['oname'] = "Piraten";
        $d[0]['r109'] = max(0, $a[0]['r109'] - 3);
        $d[0]['r110'] = max(0, $a[0]['r110'] - 3);
        $d[0]['r111'] = max(0, $a[0]['r111'] - 3);
    } else {
        $d[0]['oname'] = "Aliens";
        $d[0]['r109'] = $a[0]['r109'] + 3;
        $d[0]['r110'] = $a[0]['r110'] + 3;
        $d[0]['r111'] = $a[0]['r111'] + 3;
    }
    $d[0]['fleet'] = array();
    $d[0]['defense'] = array();
    foreach ($fleetmap as $i => $gid) {
        // Определить состав флота пиратов / чужих
        if ($pirates) {
            // Пиратский флот, Округление состава флота вниз.
            // Нормальный - 30% +/- 3% от количества кораблей вашего флота + 5 ЛИ
            // Сильный - 50% +/- 5% от количества кораблей вашего флота + 3 Крейсера
            // Оч. Сильный - 80% +/- 8% от количества кораблей вашего флота + 2 Линка
            if ($a[0]['fleet'][$gid] > 0) {
                if ($level == 0) {
                    $ratio = mt_rand(27, 33) / 100;
                } else {
                    if ($level == 1) {
                        $ratio = mt_rand(45, 55) / 100;
                    } else {
                        if ($level == 2) {
                            $ratio = mt_rand(72, 88) / 100;
                        }
                    }
                }
                $d[0]['fleet'][$gid] = floor($a[0]['fleet'][$gid] * $ratio);
            } else {
                $d[0]['fleet'][$gid] = 0;
            }
        } else {
            // Флот Чужих, Округление состава флота вверх.
            // Нормальный - 40% +/- 4% от количества кораблей вашего флота + 5 ТИ
            // Сильный - 60% +/- 6% от количества кораблей вашего флота + 3 Линейки
            // Оч. Сильный - 90% +/- 9% от количества кораблей вашего флота + 2 Уника
            if ($a[0]['fleet'][$gid] > 0) {
                if ($level == 0) {
                    $ratio = mt_rand(36, 44) / 100;
                } else {
                    if ($level == 1) {
                        $ratio = mt_rand(54, 66) / 100;
                    } else {
                        if ($level == 2) {
                            $ratio = mt_rand(81, 99) / 100;
                        }
                    }
                }
                $d[0]['fleet'][$gid] = ceil($a[0]['fleet'][$gid] * $ratio);
            } else {
                $d[0]['fleet'][$gid] = 0;
            }
        }
    }
    if ($pirates) {
        if ($level == 0) {
            $d[0]['fleet'][204] += 5;
        } else {
            if ($level == 1) {
                $d[0]['fleet'][206] += 3;
            } else {
//.........这里部分代码省略.........
开发者ID:vksavochkin,项目名称:ogame-opensource,代码行数:101,代码来源:battle.php

示例12: Admin_BattleSim

function Admin_BattleSim()
{
    global $session;
    global $db_prefix;
    global $GlobalUser;
    $fleetmap = array(202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215);
    $defmap = array(401, 402, 403, 404, 405, 406, 407, 408);
    $unitab = LoadUniverse();
    $rf = $unitab['rapid'];
    $fid = $unitab['fid'];
    $did = $unitab['did'];
    $debug = false;
    $maxslot = $unitab['acs'] * $unitab['acs'];
    $BattleReport = "";
    $aloss = $dloss = 0;
    // --------------------------------------------------------------------------------------------------------------------------
    // Обработка POST-запроса.
    if (method() === "POST" && $GlobalUser['admin'] >= 2) {
        //print_r ( $_POST );
        //echo "<hr>";
        // Сформировать список атакующих и обороняющихся
        $a = array();
        $d = array();
        $anum = intval($_POST['anum']);
        $dnum = intval($_POST['dnum']);
        // Атакующие
        for ($i = 0; $i < $anum; $i++) {
            if ($_POST["a" . $i . "_weap"] === "") {
                $_POST["a" . $i . "_weap"] = 0;
            }
            if ($_POST["a" . $i . "_shld"] === "") {
                $_POST["a" . $i . "_shld"] = 0;
            }
            if ($_POST["a" . $i . "_armor"] === "") {
                $_POST["a" . $i . "_armor"] = 0;
            }
            $a[$i]['r109'] = intval($_POST["a" . $i . "_weap"]);
            $a[$i]['r110'] = intval($_POST["a" . $i . "_shld"]);
            $a[$i]['r111'] = intval($_POST["a" . $i . "_armor"]);
            $a[$i]['oname'] = "Attacker{$i}";
            $a[$i]['g'] = mt_rand(1, 9);
            $a[$i]['s'] = mt_rand(1, 499);
            $a[$i]['p'] = mt_rand(1, 15);
            $a[$i]['fleet'] = array();
            foreach ($fleetmap as $n => $gid) {
                if ($_POST["a" . $i . "_{$gid}"] === "") {
                    $_POST["a" . $i . "_{$gid}"] = 0;
                }
                $a[$i]['fleet'][$gid] = intval($_POST["a" . $i . "_{$gid}"]);
            }
        }
        // Обороняющиеся
        for ($i = 0; $i < $dnum; $i++) {
            if ($_POST["d" . $i . "_weap"] === "") {
                $_POST["d" . $i . "_weap"] = 0;
            }
            if ($_POST["d" . $i . "_shld"] === "") {
                $_POST["d" . $i . "_shld"] = 0;
            }
            if ($_POST["d" . $i . "_armor"] === "") {
                $_POST["d" . $i . "_armor"] = 0;
            }
            $d[$i]['r109'] = intval($_POST["d" . $i . "_weap"]);
            $d[$i]['r110'] = intval($_POST["d" . $i . "_shld"]);
            $d[$i]['r111'] = intval($_POST["d" . $i . "_armor"]);
            $d[$i]['oname'] = "Defender{$i}";
            $d[$i]['g'] = mt_rand(1, 9);
            $d[$i]['s'] = mt_rand(1, 499);
            $d[$i]['p'] = mt_rand(1, 15);
            $d[$i]['fleet'] = array();
            foreach ($fleetmap as $n => $gid) {
                if ($_POST["d" . $i . "_{$gid}"] === "") {
                    $_POST["d" . $i . "_{$gid}"] = 0;
                }
                $d[$i]['fleet'][$gid] = intval($_POST["d" . $i . "_{$gid}"]);
            }
            $d[$i]['defense'] = array();
            foreach ($defmap as $n => $gid) {
                if ($_POST["d" . $i . "_{$gid}"] === "") {
                    $_POST["d" . $i . "_{$gid}"] = 0;
                }
                $d[$i]['defense'][$gid] = intval($_POST["d" . $i . "_{$gid}"]);
            }
        }
        // Симулировать битву
        $battle_result = 0;
        if ($_POST['debug'] === "on") {
            $debug = true;
        } else {
            $debug = false;
        }
        if ($_POST['rapid'] === "on") {
            $rf = true;
        } else {
            $rf = 0;
        }
        if ($_POST['fid'] === "") {
            $fid = 0;
        } else {
            $fid = intval($_POST['fid']);
//.........这里部分代码省略.........
开发者ID:vksavochkin,项目名称:ogame-opensource,代码行数:101,代码来源:admin_sim.php

示例13: InvalidSessionPage

function InvalidSessionPage()
{
    global $GlobalUser;
    $unitab = LoadUniverse();
    $uni = $unitab['num'];
    $error = array(null, $GlobalUser['player_id'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['REQUEST_URI'], 'Сессия недействительна.', time());
    $id = AddDBRow($error, 'errors');
    echo "<html> <head>\n";
    echo "  <link rel='stylesheet' type='text/css' href='css/default.css' />\n";
    echo "  <link rel='stylesheet' type='text/css' href='css/formate.css' />\n";
    echo "  <meta http-equiv='content-type' content='text/html; charset=UTF-8' />\n";
    echo "  <title>Вселенная {$uni} ОГейм</title>\n";
    echo " </head>\n";
    echo " <body>\n";
    echo "  <center><font size='3'><b>    <br /><br />\n";
    echo "    <font color='#FF0000'>Произошла ошибка</font>\n";
    echo "    <br /><br />\n";
    echo "    Сессия недействительна.<br/><br/>Это может быть вызвано несколькими причинами: \n";
    echo "<br>- Вы несколько раз зашли в один и тот же аккаунт; \n";
    echo "<br>- Ваш ай-пи адрес изменился с момента последнего входа; \n";
    echo "<br>- Вы пользуетесь интернетом через AOL или прокси. Отключите проверку ай-пи в меню \"Настройки\" в Вашем аккаунте.    \n";
    echo "    <br /><br />\n";
    echo "    Error-ID: " . $id . "  </b></font></center> </body></html>\n";
}
开发者ID:Ansty93,项目名称:ogame-opensource,代码行数:24,代码来源:page.php


注:本文中的LoadUniverse函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。