本文整理汇总了PHP中UpdatePlanetActivity函数的典型用法代码示例。如果您正苦于以下问题:PHP UpdatePlanetActivity函数的具体用法?PHP UpdatePlanetActivity怎么用?PHP UpdatePlanetActivity使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdatePlanetActivity函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loca_add
<?php
// Сообщения (пока вариант без Командира).
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") {
示例2: RocketAttack
function RocketAttack($fleet_id, $planet_id)
{
global $UnitParam;
$fleet = LoadFleet($fleet_id);
$amount = $fleet['ipm_amount'];
$primary = $fleet['ipm_target'];
$origin = GetPlanet($fleet['start_planet']);
$target = GetPlanet($planet_id);
$origin_user = LoadUser($origin['owner_id']);
$target_user = LoadUser($target['owner_id']);
// Отбить атаку МПР перехватчиками
$ipm = $amount;
$abm = $target['d502'];
$ipm = max(0, $ipm - $abm);
$ipm_destroyed = $amount - $ipm;
$target['d502'] -= $ipm_destroyed;
$maxdamage = $ipm * 12000 * (1 + $origin_user['r109'] / 10);
// Произвести атаку первичной цели
if ($primary > 0 && $ipm > 0) {
$armor = $UnitParam[$primary][0] * (1 + 0.1 * $target_user['r111']) / 10;
$count = $target["d{$primary}"];
$destroyed = min(floor($maxdamage / $armor), $count);
$target["d{$primary}"] -= $destroyed;
$maxdamage -= $destroyed * $armor;
$maxdamage -= $destroyed;
}
// Расчитать потери обороны, если еще остались МПР
if ($maxdamage > 0) {
$defmap = array(401, 402, 403, 404, 405, 406, 407, 408, 502, 503);
foreach ($defmap as $i => $id) {
if ($id == $primary) {
continue;
}
$armor = $UnitParam[$id][0] * (1 + 0.1 * $target_user['r111']) / 10;
$count = $target["d{$id}"];
if ($count == 0) {
continue;
}
$destroyed = min(floor($maxdamage / $armor), $count);
$target["d{$id}"] -= $destroyed;
$maxdamage -= $destroyed * $armor;
$maxdamage -= $destroyed;
if ($maxdamage <= 0) {
break;
}
}
}
// Записать назад потери обороны.
SetPlanetDefense($planet_id, $target);
// Изменить статистику игроков
RecalcRanks();
$text = "{$amount} ракетам из общего числа выпущенных ракет с планеты " . $origin['name'] . " <a href=# onclick=showGalaxy(" . $origin['g'] . "," . $origin['s'] . "," . $origin['p'] . "); >[" . $origin['g'] . ":" . $origin['s'] . ":" . $origin['p'] . "]</a> ";
$text .= "удалось попасть на Вашу планету " . $target['name'] . " <a href=# onclick=showGalaxy(" . $target['g'] . "," . $target['s'] . "," . $target['p'] . "); >[" . $target['g'] . ":" . $target['s'] . ":" . $target['p'] . "]</a> !<br>";
if ($ipm_destroyed) {
$text .= "{$ipm_destroyed} ракет(-ы) было уничтожено Вашими ракетами-перехватчиками<br>:<br>";
}
$defmap = array(503, 502, 408, 407, 406, 405, 404, 403, 402, 401);
$text .= "<table width=400><tr><td class=c colspan=4>Поражённая оборона</td></tr>";
$n = 0;
foreach ($defmap as $i => $gid) {
if ($n % 2 == 0) {
$text .= "</tr>";
}
if ($target["d{$gid}"]) {
$text .= "<td>" . loca("NAME_{$gid}") . "</td><td>" . nicenum($target["d{$gid}"]) . "</td>";
$n++;
}
}
$text .= "</table><br>\n";
// Обновить активность на планете.
$queue = GetFleetQueue($fleet_id);
UpdatePlanetActivity($planet_id, $queue['end']);
SendMessage($target_user['player_id'], "Командование флотом", "Ракетная атака", $text, 2);
}
示例3: ColonizationReturn
function ColonizationReturn($queue, $fleet_obj, $fleet, $origin, $target)
{
AdjustResources($fleet_obj['m'], $fleet_obj['k'], $fleet_obj['d'], $fleet_obj['start_planet'], '+');
AdjustShips($fleet, $fleet_obj['start_planet'], '+');
UpdatePlanetActivity($fleet_obj['start_planet'], $queue['end']);
$origin_user = LoadUser($origin['owner_id']);
loca_add("technames", $origin_user['lang']);
$text = "Один из Ваших флотов ( " . FleetList($fleet) . " ), отправленных с <a href=# onclick=showGalaxy(" . $target['g'] . "," . $target['s'] . "," . $target['p'] . "); >[" . $target['g'] . ":" . $target['s'] . ":" . $target['p'] . "]</a>, " . "достигает " . $origin['name'] . " <a href=# onclick=showGalaxy(" . $origin['g'] . "," . $origin['s'] . "," . $origin['p'] . "); >[" . $origin['g'] . ":" . $origin['s'] . ":" . $origin['p'] . "]</a> . ";
if ($fleet_obj['m'] + $fleet_obj['k'] + $fleet_obj['d'] != 0) {
$text .= "Флот доставляет " . nicenum($fleet_obj['m']) . " металла, " . nicenum($fleet_obj['k']) . " кристалла и " . nicenum($fleet_obj['d']) . " дейтерия<br>";
}
SendMessage($fleet_obj['owner_id'], "Командование флотом", "Возвращение флота", $text, 5, $queue['end']);
// Удалить фантом колонизации.
if ($target['type'] == 10002) {
DestroyPlanet($target['planet_id']);
}
}
示例4: BotResearch
function BotResearch($obj_id)
{
global $BotID, $BotNow, $GlobalUni;
$user = LoadUser($BotID);
$aktplanet = GetPlanet($user['aktplanet']);
$level = $aktplanet['r' . $obj_id] + 1;
$text = StartResearch($user[player_id], $user[aktplanet], $obj_id, 0);
if ($text === '') {
$speed = $uni['speed'];
if ($now == 0) {
$now = time();
}
$reslab = ResearchNetwork($user['planet_id'], $obj_id);
$prem = PremiumStatus($user);
if ($prem['technocrat']) {
$r_factor = 1.1;
} else {
$r_factor = 1.0;
}
$seconds = ResearchDuration($obj_id, $level, $reslab, $speed * $r_factor);
UpdatePlanetActivity($user['aktplanet'], $BotNow);
return $seconds;
} else {
return 0;
}
}