本文整理汇总了PHP中CreateOneMoonRecord函数的典型用法代码示例。如果您正苦于以下问题:PHP CreateOneMoonRecord函数的具体用法?PHP CreateOneMoonRecord怎么用?PHP CreateOneMoonRecord使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateOneMoonRecord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowMoonOptAdmin
function ShowMoonOptAdmin($user)
{
global $lang, $db, $displays;
if ($user['authlevel'] < 2) {
die($displays->message($lang['not_enough_permissions']));
}
if ($_POST && $_POST['add_moon']) {
$PlanetID = $_POST['add_moon'];
$MoonName = $_POST['name'];
$QrySelectPlanet = "SELECT * FROM {{table}} ";
$QrySelectPlanet .= "WHERE ";
$QrySelectPlanet .= "`id` = '" . $PlanetID . "';";
$PlanetSelected = $db->query($QrySelectPlanet, 'planets', true);
$Galaxy = $PlanetSelected['galaxy'];
$System = $PlanetSelected['system'];
$Planet = $PlanetSelected['planet'];
$Owner = $PlanetSelected['id_owner'];
CreateOneMoonRecord($Galaxy, $System, $Planet, $Owner, $MoonName, 20);
$displays->message($lang['mo_moon_added'], "admin.php?page=moonopt", 2);
} elseif ($_POST && $_POST['del_moon']) {
$MoonID = $_POST['del_moon'];
$QrySelectMoon = "SELECT * FROM {{table}} ";
$QrySelectMoon .= "WHERE ";
$QrySelectMoon .= "`id` = '" . $MoonID . "';";
$MoonSelected = $db->query($QrySelectMoon, 'planets', true);
$Galaxy = $MoonSelected['galaxy'];
$System = $MoonSelected['system'];
$Planet = $MoonSelected['planet'];
$Owner = $MoonSelected['id_owner'];
$DeleteMoonQry1 = "DELETE FROM {{table}} WHERE `id` = '" . $MoonID . "';";
$db->query($DeleteMoonQry1, 'planets');
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`id_luna` = '0' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $Galaxy . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $System . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $Planet . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
$db->query($QryUpdateGalaxy, 'galaxy');
$displays->message($lang['mo_moon_deleted'], "admin.php?page=moonopt", 2);
} else {
$displays->assignContent('adm/moonoptions');
$displays->display();
}
}
示例2: dm
function dm()
{
global $USER, $PLANET, $LNG, $UNI;
if ($PLANET['der_metal'] + $PLANET['der_crystal'] <= 50000000) {
$this->printMessage("you dont have enough debris on the planet", array('game.php?page=createMoon', 3));
die;
} elseif ($USER['darkmatter'] < 2000000) {
$this->printMessage($LNG['create_4'], array('game.php?page=createMoon', 3));
die;
} else {
if ($PLANET['planet_type'] == 1 && $PLANET['id_luna'] == 0) {
require_once ROOT_PATH . 'includes/functions/CreateOneMoonRecord.php';
$a = mt_rand(8000, 9000);
// how big ?
$u_have_moon = CreateOneMoonRecord($PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $PLANET['universe'], $USER['id'], '', 'Moon', '', $a);
$USER['darkmatter'] -= 2000000;
$this->printMessage($LNG['create_2'], array('game.php?page=overview', 3));
} else {
$this->printMessage($LNG['create_3'], true, array('game.php?page=overview', 2));
die;
}
$this->tplObj->assign_vars(array());
}
}
示例3: MissionCaseDestruction
//.........这里部分代码省略.........
$QryUpdateTarget .= "WHERE ";
$QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
$QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' ";
$QryUpdateTarget .= "LIMIT 1;";
doquery($QryUpdateTarget, 'planets');
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery($QryUpdateGalaxy, 'galaxy');
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $zlom["wrog"]);
$StrRuins = sprintf($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 and $UserChance <= $MoonChance and $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
$title = sprintf($lang['sys_destruc_title'], $AttackDate);
$raport = "<center><table><tr><td>" . $title . "<br />";
$zniszczony = false;
$a_zestrzelona = 0;
$AttackTechon['A'] = $CurrentUser["military_tech"] * 10;
$AttackTechon['B'] = $CurrentUser["defence_tech"] * 10;
$AttackTechon['C'] = $CurrentUser["shield_tech"] * 10;
$AttackerData = sprintf($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
$AttackerTech = sprintf($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
$DefendTechon['A'] = $TargetUser["military_tech"] * 10;
$DefendTechon['B'] = $TargetUser["defence_tech"] * 10;
$DefendTechon['C'] = $TargetUser["shield_tech"] * 10;
$DefenderData = sprintf($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$DefenderTech = sprintf($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
foreach ($dane_do_rw as $a => $b) {
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>";
if ($b["atakujacy"]['count'] > 0) {
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
foreach ($b["atakujacy"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
$raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>";
$raport2 .= "<th>" . $Data['count'] . "</th>";
示例4: MissionCaseDestruction
//.........这里部分代码省略.........
$QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
$QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' ";
$QryUpdateTarget .= "LIMIT 1;";
doquery($QryUpdateTarget, 'planets');
// Mise a jour du champ de ruine devant la planete attaquée
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery($QryUpdateGalaxy, 'galaxy');
// Là on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $zlom["wrog"]);
$StrRuins = sprintf($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
}
if ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = "";
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 and $UserChance <= $MoonChance and $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
$title = sprintf($lang['sys_destruc_title'], $AttackDate);
$raport = "<center><table><tr><td>" . $title . "<br />";
$zniszczony = false;
$a_zestrzelona = 0;
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
$AttackerData = sprintf($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
$AttackerTech = sprintf($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
$DefenderData = sprintf($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$DefenderTech = sprintf($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
foreach ($dane_do_rw as $a => $b) {
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>";
if ($b["atakujacy"]['count'] > 0) {
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
foreach ($b["atakujacy"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
$raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>";
$raport2 .= "<th>" . $Data['count'] . "</th>";
示例5: TargetEvent
//.........这里部分代码省略.........
foreach ($defender['def'] as $element => $amount) {
if ($amount) {
$fleetArray .= $element . ',' . floattostring($amount) . ';';
}
$totalCount += $amount;
}
$SQL .= $totalCount <= 0 ? "DELETE FROM " . FLEETS . " WHERE `fleet_id`= '" . $fleetID . "';" : "UPDATE " . FLEETS . " SET `fleet_array` = '" . substr($fleetArray, 0, -1) . "', `fleet_amount` = '" . $totalCount . "' WHERE `fleet_id` = '" . $fleetID . "';";
} else {
$fleetArray = '';
foreach ($defender['def'] as $element => $amount) {
$fleetArray .= "`" . $resource[$element] . "` = '" . floattostring($amount) . "', ";
}
$SQL .= "UPDATE " . PLANETS . " SET ";
$SQL .= $fleetArray;
$SQL .= "`metal` = `metal` - '" . $steal['metal'] . "', ";
$SQL .= "`crystal` = `crystal` - '" . $steal['crystal'] . "', ";
$SQL .= "`deuterium` = `deuterium` - '" . $steal['deuterium'] . "' ";
$SQL .= "WHERE ";
$SQL .= "`id` = '" . $this->_fleet['fleet_end_id'] . "';";
}
}
$db->multi_query($SQL);
if ($this->_fleet['fleet_end_type'] == 3) {
$targetPlanet = array_merge($targetPlanet, $db->uniquequery("SELECT `der_metal`, `der_crystal` FROM " . PLANETS . " WHERE `id_luna` = '" . $this->_fleet['fleet_end_id'] . "';"));
}
$ShootMetal = $result['debree']['att'][0] + $result['debree']['def'][0];
$ShootCrystal = $result['debree']['att'][1] + $result['debree']['def'][1];
$FleetDebris = $ShootMetal + $ShootCrystal;
$DerbisMetal = $targetPlanet['der_metal'] + $ShootMetal;
$DerbisCrystal = $targetPlanet['der_crystal'] + $ShootCrystal;
$MoonChance = min(round($FleetDebris / 100000 * MOON_CHANCE_FACTOR, 0), MAX_MOON_CHANCE);
$UserChance = mt_rand(1, 100);
if ($targetPlanet['planet_type'] == 1 && $targetPlanet['id_luna'] == 0 && $MoonChance > 0 && $UserChance <= $MoonChance) {
require_once ROOT_PATH . 'includes/functions/CreateOneMoonRecord.php';
$INFO['moon']['name'] = CreateOneMoonRecord($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_universe'], $TargetUserID, $this->_fleet['fleet_start_time'], '', $MoonChance);
$INFO['end_galaxy'] = $this->_fleet['fleet_end_galaxy'];
$INFO['end_system'] = $this->_fleet['fleet_end_system'];
$INFO['end_planet'] = $this->_fleet['fleet_end_planet'];
if (DESTROY_DERBIS_MOON_CREATE) {
$DerbisMetal = 0;
$DerbisCrystal = 0;
}
}
$INFO['steal'] = $steal;
$INFO['fleet_start_time'] = $this->_fleet['fleet_start_time'];
$INFO['moon']['des'] = 0;
$INFO['moon']['chance'] = $MoonChance;
$INFO['attvsdef'] = implode(' & ', $Attacker['name']) . ' vs ' . implode(' & ', $Defender['name']);
require_once 'GenerateReport.php';
$raport = GenerateReport($result, $INFO);
$rid = md5(microtime(true) . mt_rand(1, 100));
file_put_contents(ROOT_PATH . 'raports/raport_' . $rid . '.php', '<?php' . "\n" . '$raport = ' . $raport . ';' . "\n" . '?>');
file_put_contents(ROOT_PATH . 'raports/topkb_' . $rid . '.php', '<?php' . "\n" . '$raport = ' . preg_replace("/\\[\\d+\\:\\d+\\:\\d+\\]/i", "[X:X:X]", $raport) . ';' . "\n" . '?>');
if (DEBUG_EXTRA) {
file_put_contents(ROOT_PATH . 'includes/attack.log', date('[d-M-Y H:i:s]', $this->_fleet['fleet_start_time']) . '(FleetID: ' . $this->_fleet['fleet_id'] . ') Attacker: ' . $this->_fleet['fleet_owner'] . '/ Defender: ' . $this->_fleet['fleet_target_owner'] . ' | TF: ' . floattostring($DerbisMetal) . '/' . floattostring($DerbisCrystal));
}
$WhereAtt = "";
$WhereDef = "";
foreach ($Attacker['id'] as $id) {
$WhereAtt .= "`id` = '" . $id . "' OR ";
}
foreach ($Defender['id'] as $id) {
$WhereDef .= "`id` = '" . $id . "' OR ";
}
$Won = 0;
$Lose = 0;
示例6: formaterw
function formaterw()
{
//global $att,$def,$rondaArrayinfo;
global $lang;
$html = "<center>";
foreach ($this->rondaArray as $num_ronda => $array) {
$html .= "<table border=1 width=100%>\n <tr>\n <th colspan=10>Ronda {$num_ronda}</th>\n </tr>";
foreach ($array as $Type_person => $arrays) {
$num_div = count($this->rondaArray[$num_ronda][$Type_person]);
$name = "";
$flee = "";
for ($i = 1; $i <= $num_div; $i++) {
$div = 10 / $num_div;
$name .= "<th colspan={$div}>";
if ($Type_person == "att") {
$name .= "Atacante ";
} else {
$name .= "Defensor ";
}
$person = $this->{$Type_person};
$name .= "{$person[$i]["user"]["username"]}<br />Armas: " . $person[$i]["user"]["military_tech"] * 10 . "% Escudo: " . $person[$i]["user"]["shield_tech"] * 10 . "% Blindaje: " . $person[$i]["user"]["defence_tech"] * 10 . "%";
$name .= "</th>";
$flee .= "<th colspan={$div}>\n<center><table border=1 >";
if (!empty($this->rondaArray[$num_ronda][$Type_person][$i])) {
$echo_tipo = "<tr><th>Tipo</th>";
$echo_count = "<tr><th>Cantidad</th>";
$echo_attack = "<tr><th>Armas</th>";
$echo_shield = "<tr><th>Escudos</th>";
$echo_defense = "<tr><th>Casco</th>";
foreach ($this->rondaArray[$num_ronda][$Type_person][$i] as $type => $array_fleet) {
$echo_tipo .= "<th>[ship[" . $type . "]]</th>\n";
$echo_count .= "<th>" . number_format($array_fleet["count"], 0, "", ".") . "</th>\n";
$echo_attack .= "<th>" . number_format($array_fleet["ataque"], 0, "", ".") . "</th>\n";
$echo_shield .= "<th>" . number_format($array_fleet["escudos"], 0, "", ".") . "</th>\n";
$echo_defense .= "<th>" . number_format($array_fleet["casco"], 0, "", ".") . "</th>\n";
}
$flee .= $echo_tipo . "</tr>";
$flee .= $echo_count . "</tr>";
$flee .= $echo_attack . "</tr>";
$flee .= $echo_shield . "</tr>";
$flee .= $echo_defense . "</tr>";
} else {
$flee .= "<tr><th colspan={$div}>DESTRUIDO</th></tr>";
}
$flee .= "</table></center></th>";
}
$html .= "<tr>";
$html .= $name;
$html .= "</tr><tr>";
$html .= $flee;
$html .= "</tr>";
}
$html .= "</table>";
//if()
if (is_array($this->rondaArrayinfo[$num_ronda + 1])) {
$html .= "La flota atacante dispara con una fuerza total de ";
$html .= number_format($this->rondaArrayinfo[$num_ronda + 1]["att"]["ataquetotal"], 0, "", ".");
$html .= " sobre el defensor. Los escudos del defensor absorven ";
if ($this->rondaArrayinfo[$num_ronda + 1]["att"]["ataquetotal"] > $this->rondaArrayinfo[$num_ronda + 1]["att"]["escudototal"]) {
$html .= number_format($this->rondaArrayinfo[$num_ronda + 1]["att"]["escudototal"], 0, "", ".");
} else {
$html .= number_format($this->rondaArrayinfo[$num_ronda + 1]["att"]["ataquetotal"], 0, "", ".");
}
$html .= " puntos de daño.<br> La flota defensora dispara con una fuerza total de ";
$html .= number_format($this->rondaArrayinfo[$num_ronda + 1]["def"]["ataquetotal"], 0, "", ".");
$html .= " sobre el atacante. Los escudos del atacante absorven ";
if ($this->rondaArrayinfo[$num_ronda + 1]["def"]["ataquetotal"] > $this->rondaArrayinfo[$num_ronda + 1]["def"]["escudototal"]) {
$html .= number_format($this->rondaArrayinfo[$num_ronda + 1]["def"]["escudototal"], 0, "", ".");
} else {
$html .= number_format($this->rondaArrayinfo[$num_ronda + 1]["def"]["ataquetotal"], 0, "", ".");
}
$html .= " puntos de daño.";
}
}
$FleetDebris = $this->escombro["metal"] + $this->escombro["crystal"];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], pretty_number($this->escombro[att]["metal"] + $this->escombro[att]["crystal"]));
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], pretty_number($this->escombro[def]["metal"] + $this->escombro[def]["crystal"]));
$StrRuins = sprintf($lang['sys_gcdrunits'], pretty_number($this->escombro["metal"]), $lang['metal'], pretty_number($this->escombro["crystal"]), $lang['crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
//LUNAA CREACION DE LUNA
if ($MoonChance > 20) {
$MoonChance = 20;
} elseif ($MoonChance < 1) {
$MoonChance = 0;
}
$UserChance = mt_rand(1, 100);
//mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
//if (($UserChance > 0) && ($UserChance >= $MoonChance)){
if ($MoonChance > 0 && $UserChance < $MoonChance && $this->dateFleet['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($this->dateFleet['galaxy'], $this->dateFleet['system'], $this->dateFleet['planet'], $this->def["user"]["id"], '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $this->dateFleet['galaxy'], $this->dateFleet['system'], $this->dateFleet['planet']);
} else {
//if ($UserChance = 0 or $UserChance > $MoonChance){
$GottenMoon = "";
}
//FIN LUNAA CREACION DE LUNA
switch ($this->win) {
case "1":
//.........这里部分代码省略.........
示例7: MissionCaseAttack
//.........这里部分代码省略.........
}
$QryUpdateTarget = "UPDATE {{table}} SET ";
$QryUpdateTarget .= $fleetArray;
$QryUpdateTarget .= "`metal` = `metal` - '" . $steal['metal'] . "', ";
$QryUpdateTarget .= "`crystal` = `crystal` - '" . $steal['crystal'] . "', ";
$QryUpdateTarget .= "`deuterium` = `deuterium` - '" . $steal['deuterium'] . "' ";
$QryUpdateTarget .= "WHERE ";
$QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
$QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' ";
$QryUpdateTarget .= "LIMIT 1;";
doquery($QryUpdateTarget, 'planets');
}
}
$FleetDebris = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $result['lost']['att']);
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $result['lost']['def']);
$StrRuins = sprintf($lang['sys_gcdrunits'], $result['debree']['def'][0] + $result['debree']['att'][0], $lang['Metal'], $result['debree']['def'][1] + $result['debree']['att'][1], $lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br>" . $StrDefenderUnits . "<br>" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 && $UserChance <= $MoonChance && $targetGalaxy['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$GottenMoon .= "<br>";
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$formatted_cr = formatCR($result, $steal, $MoonChance, $GottenMoon, $totaltime);
$raport = $formatted_cr['html'];
$rid = md5($raport);
$QryInsertRapport = 'INSERT INTO {{table}} SET ';
$QryInsertRapport .= '`time` = UNIX_TIMESTAMP(), ';
foreach ($attackFleets as $fleetID => $attacker) {
$users2[$attacker['user']['id']] = $attacker['user']['id'];
}
foreach ($defense as $fleetID => $defender) {
$users2[$defender['user']['id']] = $defender['user']['id'];
}
// mod TOP KB
$angreifer = $attackFleets;
$defender = $defense;
$QryInsertRapport .= '`owners` = "' . implode(',', $users2) . '", ';
$QryInsertRapport .= '`rid` = "' . $rid . '", ';
$QryInsertRapport .= '`raport` = "' . mysql_real_escape_string($raport) . '"';
doquery($QryInsertRapport, 'rw') or die("Error inserting CR to database" . mysql_error() . "<br><br>Trying to execute:" . mysql_query());
$dpath = !$user["dpath"] ? DEFAULT_SKINPATH : $user["dpath"];
$rid = md5($raport);
$QryInserttopkb = "INSERT INTO {{table}} SET ";
$QryInserttopkb .= "`time` = UNIX_TIMESTAMP(), ";
$QryInserttopkb .= "`id_owner1` = '" . $FleetRow['fleet_owner'] . "', ";
$QryInserttopkb .= "`angreifer` = '" . $attacker['user']['username'] . "', ";
$QryInserttopkb .= "`id_owner2` = '" . $targetUser['id'] . "', ";
$QryInserttopkb .= "`defender` = '" . $targetUser['username'] . "', ";
$QryInserttopkb .= "`gesamtunits` = '" . $strunitsgesamt . "', ";
示例8: MissionCaseAttack
//.........这里部分代码省略.........
$QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
$QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' ";
$QryUpdateTarget .= "LIMIT 1;";
doquery($QryUpdateTarget, 'planets');
// Mise a jour du champ de ruine devant la planete attaquée
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery($QryUpdateGalaxy, 'galaxy');
// Là on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $zlom["wrog"]);
$StrRuins = sprintf($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000000;
if ($FleetDebris > 2000000000) {
$MoonChance = 20;
}
if ($FleetDebris < 100000000) {
$UserChance = 0;
$ChanceMoon = "";
} elseif ($FleetDebris >= 100000000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 and $UserChance <= $MoonChance and $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
$title = sprintf($lang['sys_attack_title'], $AttackDate);
$raport = "<center><table><tr><td>" . $title . "<br />";
$zniszczony = false;
$a_zestrzelona = 0;
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
$AttackerData = sprintf($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
$AttackerTech = sprintf($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
$DefenderData = sprintf($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$DefenderTech = sprintf($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
foreach ($dane_do_rw as $a => $b) {
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>";
if ($b["atakujacy"]['count'] > 0) {
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
foreach ($b["atakujacy"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
$raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>";
$raport2 .= "<th>" . $Data['count'] . "</th>";
示例9: MissionCaseDestruction
//.........这里部分代码省略.........
break;
default:
break;
}
//Ende Mondzerstörung
$strunitsgesamt = $result['lost']['att'] + $result['lost']['def'];
$user1lostunits = $result['lost']['att'];
$user1shotunits = $result['lost']['def'];
$user2lostunits = $result['lost']['def'];
$user2shotunits = $result['lost']['att'];
$strtruemmerfeld = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1] + $result['debree']['att'][2] + $result['debree']['def'][2];
$strtruemmermetal = $result['debree']['att'][0] + $result['debree']['def'][0];
$strtruemmercrystal = $result['debree']['att'][1] + $result['debree']['def'][1];
$strtruemmerappolonium = $result['debree']['att'][2] + $result['debree']['def'][2];
$FleetDebris = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1] + $result['debree']['att'][2] + $result['debree']['def'][2];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $result['lost']['att']);
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $result['lost']['def']);
$StrRuins = sprintf($lang['sys_gcdrunits'], $result['debree']['def'][0] + $result['debree']['att'][0], $lang['Metal'], $result['debree']['def'][1] + $result['debree']['att'][1], $lang['Crystal'], $result['debree']['def'][2] + $result['debree']['att'][2], $lang['Appolonium']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
// Monderstellung
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
}
if ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = "";
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
// Mond ja
if ($UserChance > 0 && $UserChance <= $MoonChance && $targetGalaxy['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$GottenMoon .= "<br />";
//Warum gibt es ein Trümmerfeld wenn der Mond doch daraus ensteht???
//Abfrage der Größe des Trümmerfeldes?
$QrySelectGalaxy = "SELECT * FROM {{table}} ";
$QrySelectGalaxy .= "WHERE ";
$QrySelectGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QrySelectGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QrySelectGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QrySelectGalaxy .= "LIMIT 1;";
$TargetGalaxy = doquery($QrySelectGalaxy, 'galaxy', true);
// Trümmerfeld wird gelöscht da der Mond aus den Trümmern entstanden ist!.
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` - '" . $TargetGalaxy["metal"] . "', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` - '" . $TargetGalaxy["crystal"] . "', ";
$QryUpdateGalaxy .= "`appolonium` = `appolonium` - '" . $TargetGalaxy["appolonium"] . "' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery($QryUpdateGalaxy, 'galaxy');
// Mond nein
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$OwnedUser = doquery('SELECT * FROM {{table}} WHERE id=' . $FleetRow['fleet_owner'], 'users', true);
$formatted_cr = formatCRM($result, $steal, $MoonChance, $GottenMoon, $totaltime, $destext);
$raport = $formatted_cr['html'];
$rid = md5($raport);
$QryInsertRapport = 'INSERT INTO {{table}} SET ';
$QryInsertRapport .= '`time` = UNIX_TIMESTAMP(), ';
示例10: includeLang
includeLang('admin/addmoon');
$PageTpl = gettemplate("admin/add_moon");
if ($_POST) {
$moonName = isset($_POST['moonName']) ? mysql_real_escape_string($_POST['moonName']) : $lang['AddMoon_DefaultName'];
if (isset($_POST['planetId']) && $_POST['planetId'] != '') {
$planetId = (int) $_POST['planetId'];
$queryCondition = " `id` = '{$planetId}'";
} else {
$planetGalaxy = isset($_POST['galaxy']) ? (int) $_POST['galaxy'] : false;
$planetSystem = isset($_POST['system']) ? (int) $_POST['system'] : false;
$planetPosition = isset($_POST['planet']) ? (int) $_POST['planet'] : false;
$queryCondition = " galaxy = '{$planetGalaxy}' AND system = '{$planetSystem}' AND planet = '{$planetPosition}'";
}
$qrySelectPlanet = "SELECT id_owner, galaxy, system, planet FROM {{table}} WHERE {$queryCondition} LIMIT 1;";
$PlanetSelected = doquery($qrySelectPlanet, 'planets', true);
if ($PlanetSelected) {
$Galaxy = $PlanetSelected['galaxy'];
$System = $PlanetSelected['system'];
$Planet = $PlanetSelected['planet'];
$Owner = $PlanetSelected['id_owner'];
CreateOneMoonRecord($Galaxy, $System, $Planet, $Owner, time(), $moonName, 20);
AdminMessage($lang['AddMoon_Done'], $lang['AddMoon_Title']);
} else {
AdminMessage($lang['AddMoon_Fail'], $lang['AddMoon_Title']);
}
}
$Page = parsetemplate($PageTpl, $lang);
display($Page, $lang['AddMoon_Title'], false, '', true);
} else {
AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']);
}
示例11: doquery
$Galaxy = $CurrentPlanet['galaxy'];
$System = $CurrentPlanet['system'];
$Planet = $CurrentPlanet['planet'];
$QryGetMoonGalaxyData = "SELECT * FROM {{table}} ";
$QryGetMoonGalaxyData .= "WHERE ";
$QryGetMoonGalaxyData .= "`galaxy` = '" . $Galaxy . "' AND ";
$QryGetMoonGalaxyData .= "`system` = '" . $System . "' AND ";
$QryGetMoonGalaxyData .= "`planet` = '" . $Planet . "';";
$MoonGalaxy = doquery($QryGetMoonGalaxyData, 'galaxy', true);
if ($MoonGalaxy['id_luna'] != 0) {
message($lang['moon_exist']);
break;
}
// Abfrage ende
if ($CurrentPlanet['mondtransformer'] == 1) {
$Chance = 20;
$MoonName = $_POST['name'];
if (!ctype_alnum($MoonName)) {
message($lang['do_word_and_digit']);
break;
}
$Galaxy = $CurrentPlanet['galaxy'];
$System = $CurrentPlanet['system'];
$Planet = $CurrentPlanet['planet'];
$Owner = $CurrentPlanet['id_owner'];
$MoonID = time();
$NewOwnerMoon = CreateOneMoonRecord($Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, $Chance);
message($title = '', $lang['done']);
}
$Page = parsetemplate($TransTPL, $parse);
return $Page;
示例12: ShowCreatorPage
//.........这里部分代码省略.........
$SQL .= "`id_planet` = '0', ";
$SQL .= "`onlinetime` = '" . TIMESTAMP . "', ";
$SQL .= "`register_time` = '" . TIMESTAMP . "', ";
$SQL .= "`password` = '" . md5($UserPass) . "', ";
$SQL .= "`dpath` = '" . DEFAULT_SKINPATH . "', ";
$SQL .= "`uctime`= '0';";
$db->query($SQL);
$db->query("UPDATE " . CONFIG . " SET `config_value` = config_value + '1' WHERE `config_name` = 'users_amount';");
$ID_USER = $db->uniquequery("SELECT `id` FROM " . USERS . " WHERE `username` = '" . $db->sql_escape($UserName) . "';");
require_once ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.' . PHP_EXT;
CreateOnePlanetRecord($Galaxy, $System, $Planet, $ID_USER['id'], $UserPlanet, true, $UserAuth);
$ID_PLANET = $db->uniquequery("SELECT `id` FROM " . PLANETS . " WHERE `id_owner` = '" . $ID_USER['id'] . "';");
$SQL = "UPDATE " . USERS . " SET ";
$SQL .= "`id_planet` = '" . $ID_PLANET['id'] . "', ";
$SQL .= "`galaxy` = '" . $Galaxy . "', ";
$SQL .= "`system` = '" . $System . "', ";
$SQL .= "`planet` = '" . $Planet . "' ";
$SQL .= "WHERE ";
$SQL .= "`id` = '" . $ID_USER['id'] . "' ";
$SQL .= "LIMIT 1;";
$db->query($SQL);
$template->message($LNG['new_user_success'], '?page=create&mode=user', 3, true);
exit;
}
$AUTH[0] = $LNG['user_level'][0];
if ($USER['authlevel'] >= AUTH_OPS) {
$AUTH[AUTH_OPS] = $LNG['user_level'][AUTH_OPS];
}
if ($USER['authlevel'] >= AUTH_MOD) {
$AUTH[AUTH_MOD] = $LNG['user_level'][AUTH_MOD];
}
if ($USER['authlevel'] >= AUTH_ADM) {
$AUTH[AUTH_ADM] = $LNG['user_level'][AUTH_ADM];
}
$template->assign_vars(array('new_add_user' => $LNG['new_add_user'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back'], 'user_reg' => $LNG['user_reg'], 'pass_reg' => $LNG['pass_reg'], 'pass2_reg' => $LNG['pass2_reg'], 'email_reg' => $LNG['email_reg'], 'email2_reg' => $LNG['email2_reg'], 'new_coord' => $LNG['new_coord'], 'new_range' => $LNG['new_range'], 'new_title' => $LNG['new_title'], 'Selector' => $AUTH));
$template->show('adm/CreatePageUser.tpl');
break;
case 'moon':
if ($_POST) {
$PlanetID = request_var('add_moon', 0);
$MoonName = request_var('name', '', UTF8_SUPPORT);
$Diameter = request_var('diameter', 0);
$FieldMax = request_var('field_max', 0);
$MoonPlanet = $db->uniquequery("SELECT `temp_max`, `temp_min`, `id_luna`, `galaxy`, `system`, `planet`, `planet_type`, `destruyed`, `id_level`, `id_owner` FROM " . PLANETS . " WHERE `id` = '" . $PlanetID . "' AND `planet_type` = '1' AND `destruyed` = '0';");
if (!isset($MoonPlanet)) {
$template->message($LNG['mo_planet_doesnt_exist'], '?page=create&mode=moon', 3, true);
exit;
}
require_once ROOT_PATH . 'includes/functions/CreateOneMoonRecord.' . PHP_EXT;
if (CreateOneMoonRecord($MoonPlanet['galaxy'], $MoonPlanet['system'], $MoonPlanet['planet'], $MoonPlanet['id_owner'], 0, $MoonName, 20, $_POST['diameter_check'] == 'on' ? 0 : $Diameter) !== false) {
$template->message($LNG['mo_moon_added'], '?page=create&mode=moon', 3, true);
} else {
$template->message($LNG['mo_moon_unavaible'], '?page=create&mode=moon', 3, true);
}
exit;
}
$template->assign_vars(array('po_add_moon' => $LNG['po_add_moon'], 'input_id_planet' => $LNG['input_id_planet'], 'mo_moon_name' => $LNG['mo_moon_name'], 'mo_diameter' => $LNG['mo_diameter'], 'mo_temperature' => $LNG['mo_temperature'], 'mo_fields_avaibles' => $LNG['mo_fields_avaibles'], 'button_add' => $LNG['button_add'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'mo_moon' => $LNG['fcm_moon'], 'new_creator_go_back' => $LNG['new_creator_go_back']));
$template->show('adm/CreatePageMoon.tpl');
break;
case 'planet':
if ($_POST) {
$id = request_var('id', 0);
$Galaxy = request_var('galaxy', 0);
$System = request_var('system', 0);
$Planet = request_var('planet', 0);
$name = request_var('name', '', UTF8_SUPPORT);
$field_max = request_var('field_max', 0);
$ISUser = $db->uniquequery("SELECT id, authlevel FROM " . USERS . " WHERE `id` = '" . $id . "';");
if (CheckPlanetIfExist($Galaxy, $System, $Planet) || !isset($ISUser)) {
$template->message($LNG['po_complete_all'], '?page=create&mode=planet', 3, true);
exit;
}
require_once ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.' . PHP_EXT;
CreateOnePlanetRecord($Galaxy, $System, $Planet, $id, '', '', false);
$SQL = "UPDATE " . PLANETS . " SET ";
if ($_POST['diameter_check'] != 'on' || $field_max > 0) {
$SQL .= "`field_max` = '" . $field_max . "', ";
}
if (!empty($name)) {
$SQL .= "`name` = '" . $db->sql_escape($name) . "', ";
}
$SQL .= "`id_level` = '" . $ISUser['authlevel'] . "' ";
$SQL .= "WHERE ";
$SQL .= "`galaxy` = '" . $Galaxy . "' AND ";
$SQL .= "`system` = '" . $System . "' AND ";
$SQL .= "`planet` = '" . $Planet . "' AND ";
$SQL .= "`planet_type` = '1'";
$db->query($SQL);
$template->message($LNG['po_complete_succes'], '?page=create&mode=planet', 3, true);
exit;
}
$template->assign_vars(array('po_add_planet' => $LNG['po_add_planet'], 'po_galaxy' => $LNG['po_galaxy'], 'po_system' => $LNG['po_system'], 'po_planet' => $LNG['po_planet'], 'input_id_user' => $LNG['input_id_user'], 'new_creator_coor' => $LNG['new_creator_coor'], 'po_name_planet' => $LNG['po_name_planet'], 'po_fields_max' => $LNG['po_fields_max'], 'button_add' => $LNG['button_add'], 'po_colony' => $LNG['fcp_colony'], 'new_creator_refresh' => $LNG['new_creator_refresh'], 'new_creator_go_back' => $LNG['new_creator_go_back']));
$template->show('adm/CreatePagePlanet.tpl');
break;
default:
$template->assign_vars(array('new_creator_title_u' => $LNG['new_creator_title_u'], 'new_creator_title_p' => $LNG['new_creator_title_p'], 'new_creator_title_l' => $LNG['new_creator_title_l'], 'new_creator_title' => $LNG['new_creator_title']));
$template->show('adm/CreatePage.tpl');
break;
}
}
示例13: MissionCaseAttack
//.........这里部分代码省略.........
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
doquery($QryUpdateGalaxy, 'galaxy');
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $zlom["wrog"]);
$StrRuins = sprintf($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
// mod TOP KB
$strunitsgesamt = $zlom["atakujacy"] + $zlom["wrog"];
$user1lostunits = $zlom["atakujacy"];
$user1shotunits = $zlom["wrog"];
$user2lostunits = $zlom["wrog"];
$user2shotunits = $zlom["atakujacy"];
$strtruemmerfeld = $zlom["metal"] + $zlom["crystal"];
$strtruemmermetal = $zlom["metal"];
$strtruemmercrystal = $zlom["crystal"];
// mod TOP KB
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
}
if ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = "";
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 and $UserChance <= $MoonChance and $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
$title = sprintf($lang['sys_attack_title'], $AttackDate);
$raport = "<center><table><tr><td>" . $title . "<br />";
$zniszczony = false;
$a_zestrzelona = 0;
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
$AttackerData = sprintf($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
$AttackerTech = sprintf($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
$DefenderData = sprintf($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$DefenderTech = sprintf($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
// mod TOP KB
$angreifer = $CurrentUser["username"];
$defender = $TargetUser["username"];
// mod TOP KB
foreach ($dane_do_rw as $a => $b) {
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>";
if ($b["atakujacy"]['count'] > 0) {
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
foreach ($b["atakujacy"] as $Ship => $Data) {
示例14: MissionCaseAttack
//.........这里部分代码省略.........
$QryUpdateTarget .= "WHERE ";
$QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
$QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' ";
$QryUpdateTarget .= "LIMIT 1;";
$db->query($QryUpdateTarget, 'planets');
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
$QryUpdateGalaxy .= "LIMIT 1;";
$db->query($QryUpdateGalaxy, 'galaxy');
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], pretty_number($zlom["atakujacy"]));
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], pretty_number($zlom["wrog"]));
$StrRuins = sprintf($lang['sys_gcdrunits'], pretty_number($zlom["metal"]), $lang['Metal'], pretty_number($zlom['crystal']), $lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 && $UserChance <= $MoonChance && $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
$title = sprintf($lang['sys_attack_title'], $AttackDate);
$raport = "<center><table><tr><td>" . $title . "<br />";
$zniszczony = false;
$a_zestrzelona = 0;
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
$AttackerData = sprintf($lang['sys_attack_attacker_pos'], $queryss["usernameCurrent"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
$AttackerTech = sprintf($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
$DefenderData = sprintf($lang['sys_attack_defender_pos'], $queryss["usernameTarget"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$DefenderTech = sprintf($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
$ronda = 0;
foreach ($dane_do_rw as $a => $b) {
$ronda++;
$raport .= "<table border=1 width=100%><tr><th><br />Ronda" . $ronda . "<center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>";
if ($b["atakujacy"]['count'] > 0) {
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
foreach ($b["atakujacy"] as $Ship => $Data) {
if (is_numeric($Ship)) {
if ($Data['count'] > 0) {
示例15: MissionCaseAttack
/**
* This file is under the GPL liscence, which must be included with the file under distrobution (license.txt)
* this file was made by Xnova, edited to support Toms combat engine by Anthony (MadnessReD) [http://madnessred.co.cc/]
* Do not edit this comment block
*/
function MissionCaseAttack($FleetRow)
{
global $phpEx, $xnova_root_path, $pricelist, $lang, $resource, $CombatCaps, $game_config;
//IPMORTANT!!! XNOVA 0.8? or SP1?
/*
If you are using X-Nova 0.8 you must change "$xnova_root_path" to "$ugamela_root_path".
/* Below is the origional global, may need to pull some stuff across */
//global $user, $phpEx, $ugamela_root_path, $pricelist, $lang, $resource, $CombatCaps;
includelang('tech');
includelang('system');
doquery("UPDATE {{table}} SET `small_protection_shield` =1 WHERE `small_protection_shield` >1;", 'planets') or die("Sorting Dome Cheaters:<br />" . mysql_error());
doquery("UPDATE {{table}} SET `big_protection_shield` =1 WHERE `big_protection_shield` >1;", 'planets') or die("Sorting Dome Cheaters:<br />" . mysql_error());
/*
doquery ("UPDATE {{table}} SET `sm_grav_dome` =1 WHERE `sm_grav_dome` >1;", 'planets')
or die("Sorting Dome Cheaters:<br />".mysql_error());
doquery ("UPDATE {{table}} SET `xl_grav_dome` =1 WHERE `xl_grav_dome` >1;", 'planets')
or die("Sorting Dome Cheaters:<br />".mysql_error());
*/
if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] <= time()) {
if (!isset($CombatCaps[202]['sd'])) {
message('<font color=red>' . $lang['sys_no_vars'] . '</font><br />(Error: <font color=red>(!isset($pricelist[202][\'sd\']))</font>. Please report this to an admin.)', $lang['sys_error'], 'fleet.php', 15);
}
//include toms stuff
include $xnova_root_path . "includes/functions/MissionCaseEvoAttack.php";
// FROM HERE THE SCRIPT WAS IMPORTED (not TvdW code anymore)
$FleetDebris = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1];
$StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $result['lost']['att']);
$StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $result['lost']['def']);
$StrRuins = sprintf($lang['sys_gcdrunits'], $result['debree']['def'][0] + $result['debree']['att'][0], $lang['Metal'], $result['debree']['def'][1] + $result['debree']['att'][1], $lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 10000000;
if ($FleetDebris > 35000000) {
$MoonChance = 35;
}
if ($FleetDebris < 10000000) {
$UserChance = 0;
$ChanceMoon = "";
} elseif ($FleetDebris >= 10000000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 && $UserChance <= $MoonChance && $galenemyrow['id_luna'] == 0) {
$TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$GottenMoon .= "<br />";
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
//Start of Raid Points ((Anthony))
/*
$att_id = $CurrentUserID;
$def_id = $TargetUserID;
$att_dam = $zlom["atakujacy"];
$def_dam = $zlom["wrog"];
if($def_dam > $att_dam){
$att_pts = round(sqrt($def_dam / (pow($att_dam, 2) + 1)));
if ($att_pts > 10){
$att_pts == 10;
}
$def_pts = 0;
$raid_pts_mess = "The Attacker won ".$att_pts." points";
}elseif($def_dam < $att_dam){
$att_pts = 0;
$def_pts = round(sqrt($att_dam / (pow($def_dam, 2) + 1)));
if ($def_pts > 10){
$def_pts == 10;
}
$raid_pts_mess = "The Defender won ".$def_pts." points";
}else{
$att_pts = 0;
$def_pts = 0;
}
doquery("UPDATE {{table}} SET `lvl_raid` = `lvl_raid` + '".$att_pts."' WHERE `id` = '".$att_id."' ;", 'users');
doquery("UPDATE {{table}} SET `lvl_raid` = `lvl_raid` + '".$def_pts."' WHERE `id` = '".$def_id."' ;", 'users');
doquery("UPDATE {{table}} SET `xpraid` = `xpraid` + '".$def_dam."' WHERE `id` = '".$att_id."' ;", 'users');
doquery("UPDATE {{table}} SET `xpraid` = `xpraid` + '".$att_dam."' WHERE `id` = '".$def_id."' ;", 'users');
doquery("UPDATE {{table}} SET `xploss` = `xploss` + '".$att_dam."' WHERE `id` = '".$att_id."' ;", 'users');
doquery("UPDATE {{table}} SET `xploss` = `xploss` + '".$def_dam."' WHERE `id` = '".$def_id."' ;", 'users');
*/
//End of Raid Points
//MadnessRed CR Creation.
$formatted_cr = formatCR($result, $steal, $MoonChance, $GottenMoon, $totaltime);
$raport = $formatted_cr['html'];
$rid = md5($raport);
$QryInsertRapport = 'INSERT INTO {{table}} SET ';
$QryInsertRapport .= '`time` = UNIX_TIMESTAMP(), ';
foreach ($attackFleets as $fleetID => $attacker) {
$users2[$attacker['user']['id']] = $attacker['user']['id'];
}
foreach ($defense as $fleetID => $defender) {
$users2[$defender['user']['id']] = $defender['user']['id'];
//.........这里部分代码省略.........