本文整理汇总了PHP中Functions_Lib::send_message方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions_Lib::send_message方法的具体用法?PHP Functions_Lib::send_message怎么用?PHP Functions_Lib::send_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions_Lib
的用法示例。
在下文中一共展示了Functions_Lib::send_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: missile_mission
/**
* method missile_mission
* param $fleet_row
* return the missile result
*/
public function missile_mission($fleet_row)
{
if ($fleet_row['fleet_start_time'] <= time()) {
if ($fleet_row['fleet_mess'] == 0) {
$attacker_data = parent::$db->query_fetch("SELECT p.`planet_name`, r.`research_weapons_technology`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = " . $fleet_row['fleet_start_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = " . $fleet_row['fleet_start_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = " . $fleet_row['fleet_start_planet'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = " . $fleet_row['fleet_start_type'] . ";");
$target_data = parent::$db->query_fetch("SELECT p.`planet_id`, p.`planet_name`, p.`planet_user_id`, d.*, r.`research_shielding_technology`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = " . $fleet_row['fleet_end_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = " . $fleet_row['fleet_end_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = " . $fleet_row['fleet_end_planet'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = " . $fleet_row['fleet_end_type'] . ";");
if ($target_data['defense_anti-ballistic_missile'] >= $fleet_row['fleet_amount']) {
$message = $this->_lang['ma_all_destroyed'] . '<br>';
$amount = $fleet_row['fleet_amount'];
} else {
$amount = 0;
if ($target_data['defense_anti-ballistic_missile'] > 0) {
$message = $target_data['defense_anti-ballistic_missile'] . $this->_lang['ma_some_destroyed'] . " <br>";
}
$attack = floor(($fleet_row['fleet_amount'] - $target_data['defense_anti-ballistic_missile']) * ($this->_combat_caps[503]['attack'] * (1 + $attacker_data['research_weapons_technology'] / 10)));
$attack_order = $this->set_attack_order($fleet_row['fleet_target_obj']);
$destroyed_query = '';
// PROCESS THE MISSILE ATTACK
for ($t = 0; $t < count($attack_order); $t++) {
$n = $attack_order[$t];
if ($target_data[$this->_resource[$n]]) {
$defense = ($this->_pricelist[$n]['metal'] + parent::$_pricelist[$n]['crystal']) / 10 * (1 + $target_data['research_shielding_technology'] / 10);
if ($attack >= $defense * $target_data[$this->_resource[$n]]) {
$destroyed = $target_data[$this->_resource[$n]];
} else {
$destroyed = floor($attack / $defense);
}
$attack -= $destroyed * $defense;
if ($destroyed != 0) {
$message .= $this->_lang['tech'][$n] . " (-" . $destroyed . ")<br>";
$destroyed_query .= "`" . $this->_resource[$n] . "` = `" . $this->_resource[$n] . "` - " . $destroyed . ",";
}
}
}
if ($destroyed_query != '') {
parent::$db->query("UPDATE " . DEFENSES . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t{$destroyed_query}\n\t\t\t\t\t\t\t\t\t\t\t\t`defense_anti-ballistic_missile` = '" . $amount . "'\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE defense_planet_id = " . $target_data['id']);
}
}
$search = array('%1%', '%2%', '%3%');
$replace = array($fleet_row['fleet_amount'], $attacker_data['planet_name'] . ' [' . $fleet_row['fleet_start_galaxy'] . ':' . $fleet_row['fleet_start_system'] . ':' . $fleet_row['fleet_start_planet'] . '] ', $target_data['name'] . ' [' . $fleet_row['fleet_end_galaxy'] . ':' . $fleet_row['fleet_end_system'] . ':' . $fleet_row['fleet_end_planet'] . '] ');
$message_vorlage = str_replace($search, $replace, $this->_lang['ma_missile_string']);
if (empty($message) or $message == '') {
$message = $this->_lang['ma_planet_without_defens'];
}
Functions_Lib::send_message($target_data['planet_user_id'], '', $fleet_row['fleet_end_time'], 5, $this->_lang['sys_mess_tower'], $this->_lang['gl_missile_attack'], $message_vorlage . $message);
parent::remove_fleet($fleet_row['fleet_id']);
}
}
}
示例2: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$parse = $this->_lang;
$parse['js_path'] = XGP_ROOT . JS_PATH;
if (isset($_POST) && $_POST && $_GET['mode'] == "change") {
$info = array(1 => array('color' => 'yellow'), 2 => array('color' => 'skyblue'), 3 => array('color' => 'red'));
$color = $info[$this->_current_user['user_authlevel']]['color'];
$level = $this->_lang['user_level'][$this->_current_user['user_authlevel']];
if (isset($_POST['tresc']) && $_POST['tresc'] != '' && (isset($_POST['temat']) && $_POST['temat'] != '') && (isset($_POST['message']) or isset($_POST['mail']))) {
$sq = parent::$db->query("SELECT `user_id` , `user_name`, `user_email`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "");
if (isset($_POST['message'])) {
$time = time();
$from = '<font color="' . $color . '">' . $level . ' ' . $this->_current_user['user_name'] . '</font>';
$subject = '<font color="' . $color . '">' . $_POST['temat'] . '</font>';
$message = '<font color="' . $color . '"><b>' . Functions_Lib::format_text($_POST['tresc']) . '</b></font>';
while ($u = parent::$db->fetch_array($sq)) {
Functions_Lib::send_message($u['user_id'], $this->_current_user['user_id'], $time, 5, $from, $subject, $message);
$_POST['tresc'] = str_replace(":name:", $u['user_name'], $_POST['tresc']);
}
}
if (isset($_POST['mail'])) {
$i = 0;
while ($u = parent::$db->fetch_array($sq)) {
mail($u['user_email'], $_POST['temat'], $_POST['tresc']);
// 20 per row
if ($i % 20 == 0) {
sleep(1);
// wait, prevent flooding
}
$i++;
}
}
$parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['ma_message_sended']);
} else {
$parse['alert'] = Administration_Lib::save_message('warning', $this->_lang['ma_subject_needed']);
}
}
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/global_message_view'), $parse));
}
示例3: deploy_mission
/**
* method deploy_mission
* param $fleet_row
* return the deploy result
*/
public function deploy_mission($fleet_row)
{
if ($fleet_row['fleet_mess'] == 0) {
if ($fleet_row['fleet_start_time'] <= time()) {
$target_coords = sprintf($this->_lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
$target_resources = sprintf($this->_lang['sys_stay_mess_goods'], $this->_lang['Metal'], Format_Lib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Crystal'], Format_Lib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Deuterium'], Format_Lib::pretty_number($fleet_row['fleet_resource_deuterium']));
$target_message = $this->_lang['sys_stay_mess_start'] . "<a href=\"game.php?page=galaxy&mode=3&galaxy=" . $fleet_row['fleet_end_galaxy'] . "&system=" . $fleet_row['fleet_end_system'] . "\">";
$target_message .= $target_coords . "</a>" . $this->_lang['sys_stay_mess_end'] . "<br />" . $target_resources;
Functions_Lib::send_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], 5, $this->_lang['sys_mess_qg'], $this->_lang['sys_stay_mess_stay'], $target_message);
parent::restore_fleet($fleet_row, FALSE);
parent::remove_fleet($fleet_row['fleet_id']);
}
} else {
if ($fleet_row['fleet_end_time'] <= time()) {
$target_coords = sprintf($this->_lang['sys_adress_planet'], $fleet_row['fleet_start_galaxy'], $fleet_row['fleet_start_system'], $fleet_row['fleet_start_planet']);
$target_resources = sprintf($this->_lang['sys_stay_mess_goods'], $this->_lang['Metal'], Format_Lib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Crystal'], Format_Lib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Deuterium'], Format_Lib::pretty_number($fleet_row['fleet_resource_deuterium']));
$target_message = $this->_lang['sys_stay_mess_back'] . "<a href=\"game.php?page=galaxy&mode=3&galaxy=" . $fleet_row['fleet_start_galaxy'] . "&system=" . $fleet_row['fleet_start_system'] . "\">";
$target_message .= $target_coords . "</a>" . $this->_lang['sys_stay_mess_bend'] . "<br />" . $target_resources;
Functions_Lib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_time'], 5, $this->_lang['sys_mess_qg'], $this->_lang['sys_mess_fleetback'], $target_message);
parent::restore_fleet($fleet_row, TRUE);
parent::remove_fleet($fleet_row['fleet_id']);
}
}
}
示例4: attack_mission
//.........这里部分代码省略.........
fleet_amount=' . $totalCount . ',
fleet_mess=1
WHERE fleet_id=' . intval($fleetID));
}
}
foreach ($defense as $fleetID => $defender) {
if ($fleetID != 0) {
$fleetArray = '';
$totalCount = 0;
foreach ($defender['def'] as $element => $amount) {
if ($amount) {
$fleetArray .= $element . ',' . $amount . ';';
}
$totalCount += $amount;
}
if ($totalCount <= 0) {
parent::remove_fleet($fleetID);
} else {
parent::$db->query("UPDATE " . FLEETS . " SET\r\n\t\t\t\t\t\t\t\t\t\t\t\tfleet_array='{$fleetArray}',\r\n\t\t\t\t\t\t\t\t\t\t\t\tfleet_amount='{$totalCount}'\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE fleet_id='{$fleetID}'");
}
} else {
$fleetArray = '';
$totalCount = 0;
foreach ($defender['def'] as $element => $amount) {
$fleetArray .= '`' . $this->_resource[$element] . '`=' . $amount . ', ';
}
parent::$db->query("UPDATE " . PLANETS . " AS p\r\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id` SET\r\n\t\t\t\t\t\t\t\t\t\t\t{$fleetArray}\r\n\t\t\t\t\t\t\t\t\t\t\t`planet_metal` = `planet_metal` - '" . $steal['metal'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t`planet_crystal` = `planet_crystal` - '" . $steal['crystal'] . "',\r\n\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium` = `planet_deuterium` - '" . $steal['deuterium'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $fleet_row['fleet_end_galaxy'] . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $fleet_row['fleet_end_system'] . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $fleet_row['fleet_end_planet'] . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = '" . $fleet_row['fleet_end_type'] . "';");
}
}
$FleetDebris = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1];
$StrAttackerUnits = sprintf($this->_lang['sys_attacker_lostunits'], $result['lost']['att']);
$StrDefenderUnits = sprintf($this->_lang['sys_defender_lostunits'], $result['lost']['def']);
$StrRuins = sprintf($this->_lang['sys_gcdrunits'], $result['debree']['def'][0] + $result['debree']['att'][0], $this->_lang['Metal'], $result['debree']['def'][1] + $result['debree']['att'][1], $this->_lang['Crystal']);
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
$MoonChance = $FleetDebris / 100000;
if ($FleetDebris > 2000000) {
$MoonChance = 20;
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($this->_lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris < 100000) {
$UserChance = 0;
$ChanceMoon = sprintf($this->_lang['sys_moonproba'], $MoonChance);
} elseif ($FleetDebris >= 100000) {
$UserChance = mt_rand(1, 100);
$ChanceMoon = sprintf($this->_lang['sys_moonproba'], $MoonChance);
}
if ($UserChance > 0 && $UserChance <= $MoonChance && $targetGalaxy['id'] == 0) {
include_once XGP_ROOT . 'application/libraries/Creator_Lib.php';
$creator = new Creator_Lib();
$TargetPlanetName = $creator->create_moon($fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet'], $TargetUserID, $fleet_row['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf($this->_lang['sys_moonbuilt'], $TargetPlanetName, $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
$GottenMoon .= "<br />";
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
$GottenMoon = "";
}
$formatted_cr = $this->build_report($result, $steal, $MoonChance, $GottenMoon, $totaltime);
$raport = $formatted_cr['html'];
$rid = md5($raport);
$QryInsertRapport = 'INSERT INTO ' . REPORTS . ' SET ';
$QryInsertRapport .= '`report_time` = UNIX_TIMESTAMP(), ';
foreach ($attackFleets as $fleetID => $attacker) {
$users2[$attacker['user']['user_id']] = $attacker['user']['user_id'];
}
foreach ($defense as $fleetID => $defender) {
$users2[$defender['user']['user_id']] = $defender['user']['user_id'];
}
$QryInsertRapport .= '`report_owners` = "' . implode(',', $users2) . '", ';
$QryInsertRapport .= '`report_rid` = "' . $rid . '", ';
$QryInsertRapport .= '`report_destroyed` = "' . $formatted_cr['destroyed'] . '", ';
$QryInsertRapport .= '`report_content` = "' . parent::$db->escape_value($raport) . '"';
parent::$db->query($QryInsertRapport);
if ($result['won'] == "a") {
$style = "green";
} elseif ($result['won'] == "w") {
$style = "orange";
} elseif ($result['won'] == "r") {
$style = "red";
}
$raport = "<a href=\"#\" style=\"color:" . $style . ";\" OnClick=\\'f(\"game.php?page=CombatReport&report=" . $rid . "\", \"\");\\' >" . $this->_lang['sys_mess_attack_report'] . " [" . $fleet_row['fleet_end_galaxy'] . ":" . $fleet_row['fleet_end_system'] . ":" . $fleet_row['fleet_end_planet'] . "]</a>";
Functions_Lib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], 1, $this->_lang['sys_mess_tower'], $raport, '');
if ($result['won'] == "a") {
$style = "red";
} elseif ($result['won'] == "w") {
$style = "orange";
} elseif ($result['won'] == "r") {
$style = "lime";
}
$raport2 = "<a href=\"#\" style=\"color:" . $style . ";\" OnClick=\\'f(\"game.php?page=CombatReport&report=" . $rid . "\", \"\");\\' >" . $this->_lang['sys_mess_attack_report'] . " [" . $fleet_row['fleet_end_galaxy'] . ":" . $fleet_row['fleet_end_system'] . ":" . $fleet_row['fleet_end_planet'] . "]</a>";
foreach ($users2 as $id) {
if ($id != $fleet_row['fleet_owner'] && $id != 0) {
Functions_Lib::send_message($id, '', $fleet_row['fleet_start_time'], 1, $this->_lang['sys_mess_tower'], $raport2, '');
}
}
} elseif ($fleet_row['fleet_end_time'] <= time()) {
$Message = sprintf($this->_lang['sys_fleet_won'], $targetPlanet['planet_name'], Fleets_Lib::target_link($fleet_row, ''), Format_Lib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Metal'], Format_Lib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Crystal'], Format_Lib::pretty_number($fleet_row['fleet_resource_deuterium']), $this->_lang['Deuterium']);
Functions_Lib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_time'], 1, $this->_lang['sys_mess_tower'], $this->_lang['sys_mess_fleetback'], $Message);
parent::restore_fleet($fleet_row);
parent::remove_fleet($fleet_row['fleet_id']);
}
}
示例5: stay_message
/**
* method stay_message
* param $owner
* param $message
* param $time
* param $status_message
* return send a message with the stay details
*/
private function stay_message($owner, $message, $time, $status_message)
{
Functions_Lib::send_message($owner, '', $time, 5, $this->_lang['sys_mess_tower'], $status_message, $message);
}
示例6: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
$mode = isset($_GET['mode']) ? intval($_GET['mode']) : NULL;
$bid = isset($_GET['bid']) ? intval($_GET['bid']) : NULL;
$sm = isset($_GET['sm']) ? intval($_GET['sm']) : NULL;
$user = isset($_GET['u']) ? intval($_GET['u']) : NULL;
$this->_lang['js_path'] = XGP_ROOT . JS_PATH;
$parse = $this->_lang;
$requestsSended = '';
$requestsReceived = '';
$budys = '';
switch ($mode) {
case 1:
switch ($sm) {
// REJECT / CANCEL
case 1:
$senderID = parent::$db->query_fetch("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id`='" . intval($bid) . "'");
if ($senderID['buddy_status'] == 0) {
if ($senderID['buddy_sender'] != $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_sender'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_rejected_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_rejected_text']));
} elseif ($senderID['buddy_sender'] == $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_receiver'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_rejected_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_rejected_title']));
}
} else {
if ($senderID['buddy_sender'] != $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_sender'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_deleted_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_deleted_text']));
} elseif ($senderID['buddy_sender'] == $this->_current_user['user_id']) {
Functions_Lib::send_message($senderID['buddy_receiver'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_deleted_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_deleted_text']));
}
}
parent::$db->query("DELETE FROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id`='" . intval($bid) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t(`buddy_receiver`='" . $this->_current_user['user_id'] . "' OR `buddy_sender`='" . $this->_current_user['user_id'] . "') ");
Functions_Lib::redirect('game.php?page=buddy');
break;
// ACCEPT
// ACCEPT
case 2:
$senderID = parent::$db->query_fetch("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id`='" . intval($bid) . "'");
Functions_Lib::send_message($senderID['buddy_sender'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_accepted_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_accepted_text']));
parent::$db->query("UPDATE " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\tSET `buddy_status` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_id` ='" . intval($bid) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_receiver`='" . $this->_current_user['user_id'] . "'");
Functions_Lib::redirect('game.php?page=buddy');
break;
// SEND REQUEST
// SEND REQUEST
case 3:
$query = parent::$db->query_fetch("SELECT `buddy_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE (`buddy_receiver`='" . intval($this->_current_user['user_id']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_sender`='" . intval($_POST['user']) . "') OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(`buddy_receiver`='" . intval($_POST['user']) . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_sender`='" . intval($this->_current_user['user_id']) . "')");
if (!$query) {
$text = parent::$db->escape_value(strip_tags($_POST['text']));
Functions_Lib::send_message(intval($_POST['user']), $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['bu_to_accept_title'], str_replace('%u', $this->_current_user['user_name'], $this->_lang['bu_to_accept_text']));
parent::$db->query("INSERT INTO " . BUDDY . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_sender`='" . intval($this->_current_user['user_id']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_receiver`='" . intval($_POST['user']) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_status`='0',\n\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_request_text`='" . $text . "'");
Functions_Lib::redirect('game.php?page=buddy');
} else {
Functions_Lib::message($this->_lang['bu_request_exists'], 'game.php?page=buddy', 2, FALSE, FALSE, FALSE);
}
break;
// ANY OTHER OPTION EXIT
// ANY OTHER OPTION EXIT
default:
Functions_Lib::redirect('game.php?page=buddy');
break;
}
break;
// FRIENDSHIP REQUEST
// FRIENDSHIP REQUEST
case 2:
// IF USER = REQUESTED USER, SHOW ERROR.
if ($user == $this->_current_user['user_id']) {
Functions_Lib::message($this->_lang['bu_cannot_request_yourself'], 'game.php?page=buddy', 2, FALSE, FALSE, FALSE);
} else {
// SEARCH THE PLAYER
$player = parent::$db->query_fetch("SELECT `user_name`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id`='" . intval($user) . "'");
// IF PLAYER EXISTS, PROCEED
if ($player) {
$parse['user'] = $user;
$parse['player'] = $player['user_name'];
parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buddy/buddy_request'), $parse), FALSE, '', FALSE);
} else {
Functions_Lib::redirect('game.php?page=buddy');
}
}
break;
// NOTHING SELECTED
// NOTHING SELECTED
default:
$getBuddys = parent::$db->query("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . BUDDY . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `buddy_sender`='" . intval($this->_current_user['user_id']) . "' OR\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`buddy_receiver`='" . intval($this->_current_user['user_id']) . "'");
$subTemplate = parent::$page->get_template('buddy/buddy_row');
while ($buddy = parent::$db->fetch_assoc($getBuddys)) {
if ($buddy['buddy_status'] == 0) {
if ($buddy['buddy_sender'] == $this->_current_user['user_id']) {
$buddy_receiver = parent::$db->query_fetch("SELECT u.`user_id`, u.`user_name`, u.`user_galaxy`, u.`user_system`, u.`user_planet`, u.`user_ally_id`, a.`alliance_name`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . " AS u\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . ALLIANCE . "` AS a ON a.`alliance_id` = u.`user_ally_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE u.`user_id`='" . intval($buddy['buddy_receiver']) . "'");
$parse['id'] = $buddy_receiver['user_id'];
$parse['username'] = $buddy_receiver['user_name'];
$parse['ally_id'] = $buddy_receiver['user_ally_id'];
$parse['alliance_name'] = $buddy_receiver['alliance_name'];
$parse['galaxy'] = $buddy_receiver['user_galaxy'];
$parse['system'] = $buddy_receiver['user_system'];
//.........这里部分代码省略.........
示例7: send_message
/**
* method send_message
* param $fleet_row
* param $report
* return the attack result
*/
private function send_message($fleet_row, $report)
{
$idAtts = $report->getAttackersId();
$idDefs = $report->getDefendersId();
$idAll = array_merge($idAtts, $idDefs);
$owners = implode(',', $idAll);
$rid = md5($report) . time();
parent::$db->query("INSERT INTO `" . REPORTS . "` SET\n\t\t\t\t\t\t\t\t`report_owners` = '" . ($fleet_row['fleet_owner'] . ',' . $fleet_row['fleet_target_owner']) . "',\n\t\t\t\t\t\t\t\t`report_rid` = '" . $rid . "',\n\t\t\t\t\t\t\t\t`report_content` = '" . addslashes($report) . "',\n\t\t\t\t\t\t\t\t`report_destroyed` = '0',\n\t\t\t\t\t\t\t\t`report_destroyed` = '" . time() . "'");
foreach ($idAtts as $id) {
if ($report->attackerHasWin()) {
$style = 'green';
} elseif ($report->isAdraw()) {
$style = 'orange';
} else {
$style = 'red';
}
$raport = "<a href=\"#\" style=\"color:" . $style . ";\" OnClick=\\'f(\"game.php?page=CombatReport&report=" . $rid . "\", \"\");\\' >" . $this->_lang['sys_mess_attack_report'] . " [" . $fleet_row['fleet_end_galaxy'] . ":" . $fleet_row['fleet_end_system'] . ":" . $fleet_row['fleet_end_planet'] . "]</a>";
Functions_Lib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], 1, $this->_lang['sys_mess_tower'], $raport, '');
}
foreach ($idDefs as $id) {
if ($report->attackerHasWin()) {
$style = 'red';
} elseif ($report->isAdraw()) {
$style = 'orange';
} else {
$style = 'green';
}
$raport = "<a href=\"#\" style=\"color:" . $style . ";\" OnClick=\\'f(\"game.php?page=CombatReport&report=" . $rid . "\", \"\");\\' >" . $this->_lang['sys_mess_attack_report'] . " [" . $fleet_row['fleet_end_galaxy'] . ":" . $fleet_row['fleet_end_system'] . ":" . $fleet_row['fleet_end_planet'] . "]</a>";
Functions_Lib::send_message($id, '', $fleet_row['fleet_start_time'], 1, $this->_lang['sys_mess_tower'], $raport, '');
}
}
示例8: remove_user
/**
* method add_user
* param
* return search and add the user
*/
private function remove_user($member_name = '')
{
$remove_user_id = 0;
$member_qry = parent::$db->query_fetch("SELECT `user_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_name` ='" . parent::$db->escape_value($member_name) . "';");
if ($member_qry['user_id'] != NULL && $this->members_count($_POST['federation_invited']) >= 1 && $member_qry['user_id'] != $this->_current_user['user_id']) {
$members = explode(',', $_POST['federation_invited']);
foreach ($members as $member_id) {
if ($member_qry['user_id'] != $member_id) {
$new_member_string .= $member_id . ',';
}
}
$new_member_string = substr_replace($new_member_string, '', -1);
parent::$db->query("UPDATE " . ACS_FLEETS . " SET\n\t\t\t\t\t\t\t\t\t`acs_fleet_invited` = '" . $new_member_string . "'\n\t\t\t\t\t\t\t\t\tWHERE `acs_fleet_fleets` = '" . $this->_fleet_id . "';");
$invite_message = $this->_lang['fl_player'] . $this->_current_user['user_name'] . $this->_lang['fl_acs_invitation_message'];
Functions_Lib::send_message($member_qry['user_id'], $this->_current_user['user_id'], '', 5, $this->_current_user['user_name'], $this->_lang['fl_acs_invitation_title'], $invite_message);
return TRUE;
} else {
return FALSE;
}
}
示例9: colonize_message
/**
* method colonize_message
* param $owner
* param $message
* param $time
* return send a message with the colonization details
*/
private function colonize_message($owner, $message, $time)
{
Functions_Lib::send_message($owner, '', $time, 5, $this->_lang['sys_colo_mess_from'], $this->_lang['sys_colo_mess_report'], $message);
}
示例10: build_page
/**
* method build_page
* param
* return main method, loads everything
*/
private function build_page()
{
if ($_POST) {
if (!$this->run_validations()) {
Functions_Lib::redirect('index.php');
} else {
$user_password = $_POST['password'];
$user_name = $_POST['character'];
$user_email = $_POST['email'];
$hashed_password = sha1($user_password);
parent::$db->query("INSERT INTO " . USERS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`user_name` = '" . parent::$db->escape_value(strip_tags($user_name)) . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_email` = '" . parent::$db->escape_value($user_email) . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_email_permanent` = '" . parent::$db->escape_value($user_email) . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_ip_at_reg` = '" . $_SERVER['REMOTE_ADDR'] . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_agent` = '" . $_SERVER['HTTP_USER_AGENT'] . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = '0',\r\n\t\t\t\t\t\t\t\t\t\t`user_register_time` = '" . time() . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_password`='" . $hashed_password . "';");
$user_id = parent::$db->insert_id();
parent::$db->query("INSERT INTO " . RESEARCH . " SET\r\n\t\t\t\t\t\t\t\t\t\t`research_user_id` = '" . $user_id . "';");
parent::$db->query("INSERT INTO " . USERS_STATISTICS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`user_statistic_user_id` = '" . $user_id . "';");
parent::$db->query("INSERT INTO " . PREMIUM . " SET\r\n\t\t\t\t\t\t\t\t\t\t`premium_user_id` = '" . $user_id . "';");
parent::$db->query("INSERT INTO " . SETTINGS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`setting_user_id` = '" . $user_id . "';");
$last_galaxy = Functions_Lib::read_config('lastsettedgalaxypos');
$last_system = Functions_Lib::read_config('lastsettedsystempos');
$last_planet = Functions_Lib::read_config('lastsettedplanetpos');
while (!isset($newpos_checked)) {
for ($galaxy = $last_galaxy; $galaxy <= MAX_GALAXY_IN_WORLD; $galaxy++) {
for ($system = $last_system; $system <= MAX_SYSTEM_IN_GALAXY; $system++) {
for ($pos = $last_planet; $pos <= 4; $pos++) {
$planet = round(mt_rand(4, 12));
switch ($last_planet) {
case 1:
$last_planet += 1;
break;
case 2:
$last_planet += 1;
break;
case 3:
if ($last_system == MAX_SYSTEM_IN_GALAXY) {
$last_galaxy += 1;
$last_system = 1;
$last_planet = 1;
break;
} else {
$last_planet = 1;
}
$last_system += 1;
break;
}
break;
}
break;
}
break;
}
$planet_row = parent::$db->query_fetch("SELECT *\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $galaxy . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $system . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $planet . "' LIMIT 1;");
if ($planet_row['id'] == '0') {
$newpos_checked = TRUE;
}
if (!$planet_row) {
$this->_creator->create_planet($galaxy, $system, $planet, $user_id, '', TRUE);
$newpos_checked = TRUE;
}
if ($newpos_checked) {
Functions_Lib::update_config('lastsettedgalaxypos', $last_galaxy);
Functions_Lib::update_config('lastsettedsystempos', $last_system);
Functions_Lib::update_config('lastsettedplanetpos', $last_planet);
}
}
parent::$db->query("UPDATE " . USERS . " SET\r\n\t\t\t\t\t\t\t\t\t\t`user_home_planet_id` = (SELECT `planet_id` FROM " . PLANETS . " WHERE `planet_user_id` = '" . $user_id . "' LIMIT 1),\r\n\t\t\t\t\t\t\t\t\t\t`user_current_planet` = (SELECT `planet_id` FROM " . PLANETS . " WHERE `planet_user_id` = '" . $user_id . "' LIMIT 1),\r\n\t\t\t\t\t\t\t\t\t\t`user_galaxy` = '" . $galaxy . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_system` = '" . $system . "',\r\n\t\t\t\t\t\t\t\t\t\t`user_planet` = '" . $planet . "'\r\n\t\t\t\t\t\t\t\t\t\t WHERE `user_id` = '" . $user_id . "' LIMIT 1;");
$from = $this->_lang['re_welcome_message_from'];
$subject = $this->_lang['re_welcome_message_subject'];
$message = str_replace('%s', $user_name, $this->_lang['re_welcome_message_content']);
// Send Welcome Message to the user if the feature is enabled
if (Functions_Lib::read_config('reg_welcome_message')) {
Functions_Lib::send_message($user_id, 0, '', 5, $from, $subject, $message);
}
// Send Welcome Email to the user if the feature is enabled
if (Functions_Lib::read_config('reg_welcome_email')) {
$this->send_pass_email($user_email, $user_name, $user_password);
}
// User login
if (parent::$users->user_login($user_id, $user_name, $hashed_password)) {
// Redirect to game
Functions_Lib::redirect('game.php?page=overview');
}
}
}
// If login fails
Functions_Lib::redirect('index.php');
}
示例11: set_first_element
/**
* method set_first_element
* param $current_planet
* param $current_user
* return set the next element in the buildings queue to the top
*/
public static function set_first_element(&$current_planet, $current_user)
{
$lang = parent::$lang;
$resource = parent::$objects->get_objects();
if ($current_planet['planet_b_building'] == 0) {
$current_queue = $current_planet['planet_b_building_id'];
if ($current_queue != 0) {
$queue_array = explode(";", $current_queue);
$loop = TRUE;
while ($loop == TRUE) {
$list_id_array = explode(",", $queue_array[0]);
$element = $list_id_array[0];
$level = $list_id_array[1];
$build_time = $list_id_array[2];
$build_end_time = $list_id_array[3];
$build_mode = $list_id_array[4];
$no_more_level = FALSE;
if ($build_mode == 'destroy') {
$for_destroy = TRUE;
} else {
$for_destroy = FALSE;
}
$is_payable = self::is_development_payable($current_user, $current_planet, $element, TRUE, $for_destroy);
if ($for_destroy) {
if ($current_planet[$resource[$element]] == 0) {
$is_payable = FALSE;
$no_more_level = TRUE;
}
}
if ($is_payable == TRUE) {
$price = self::development_price($current_user, $current_planet, $element, TRUE, $for_destroy);
$current_planet['planet_metal'] -= $price['metal'];
$current_planet['planet_crystal'] -= $price['crystal'];
$current_planet['planet_deuterium'] -= $price['deuterium'];
$current_time = time();
$build_end_time = $build_end_time;
$new_queue = implode(";", $queue_array);
if ($new_queue == '') {
$new_queue = '0';
}
$loop = FALSE;
} else {
$element_name = $lang['tech'][$element];
if ($no_more_level == TRUE) {
$message = sprintf($lang['sys_nomore_level'], $element_name);
} else {
$price = self::development_price($current_user, $current_planet, $element, TRUE, $for_destroy);
$message = sprintf($lang['sys_notenough_money'], $element_name, Format_Lib::pretty_number($current_planet['planet_metal']), $lang['Metal'], Format_Lib::pretty_number($current_planet['planet_crystal']), $lang['Crystal'], Format_Lib::pretty_number($current_planet['planet_deuterium']), $lang['Deuterium'], Format_Lib::pretty_number($price['metal']), $lang['Metal'], Format_Lib::pretty_number($price['crystal']), $lang['Crystal'], Format_Lib::pretty_number($price['deuterium']), $lang['Deuterium']);
}
Functions_Lib::send_message($current_user['user_id'], '', '', 5, $lang['sys_buildlist'], $lang['sys_buildlist_fail'], $message);
array_shift($queue_array);
foreach ($queue_array as $num => $info) {
$fix_ele = explode(",", $info);
$fix_ele[3] = $fix_ele[3] - $build_time;
$queue_array[$num] = implode(",", $fix_ele);
}
$actual_count = count($queue_array);
if ($actual_count == 0) {
$build_end_time = '0';
$new_queue = '0';
$loop = FALSE;
}
}
}
} else {
$build_end_time = '0';
$new_queue = '0';
}
$current_planet['planet_b_building'] = $build_end_time;
$current_planet['planet_b_building_id'] = $new_queue;
parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t`planet_metal` = '" . $current_planet['planet_metal'] . "',\n\t\t\t\t\t\t\t\t\t`planet_crystal` = '" . $current_planet['planet_crystal'] . "',\n\t\t\t\t\t\t\t\t\t`planet_deuterium` = '" . $current_planet['planet_deuterium'] . "',\n\t\t\t\t\t\t\t\t\t`planet_b_building` = '" . $current_planet['planet_b_building'] . "',\n\t\t\t\t\t\t\t\t\t`planet_b_building_id` = '" . $current_planet['planet_b_building_id'] . "'\n\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $current_planet['planet_id'] . "';");
}
return;
}
示例12: ally_admin
//.........这里部分代码省略.........
if ($u['user_ally_rank_id'] - 1 == $a) {
$r['options'] .= ' selected=selected';
}
$r['options'] .= ">{$b['name']}</option>";
}
}
$r['id'] = $u['user_id'];
$editar_miembros = parent::$page->parse_template(parent::$page->get_template('alliance/alliance_admin_members_row_edit'), $r);
}
if ($rank != $u['user_id']) {
$u['ally_range'] = $ally_range;
} else {
$u['ally_range'] = $editar_miembros;
}
$page_list .= parent::$page->parse_template(parent::$page->get_template('alliance/alliance_admin_members_row'), $u);
}
if ($sort2 == 1) {
$s = 2;
} elseif ($sort2 == 2) {
$s = 1;
} else {
$s = 1;
}
$this->_lang['memberslist'] = $page_list;
$this->_lang['s'] = $s;
return parent::$page->parse_template(parent::$page->get_template('alliance/alliance_admin_members_table'), $this->_lang);
break;
case $edit == 'requests' && $this->have_access($this->_ally['alliance_owner'], $this->permissions['check_requests']) === TRUE:
$show = isset($_GET['show']) ? (int) $_GET['show'] : NULL;
if (isset($_POST['action']) && $_POST['action'] == $this->_lang['al_acept_request']) {
$_POST['text'] = trim(nl2br(strip_tags($_POST['text'], '<br>')));
$_POST['text'] = str_replace('rn', '\\r\\n', $_POST['text']);
parent::$db->query("UPDATE " . USERS . " SET\r\n\t\t\t\t\t\t\t\t\t\t\t\tuser_ally_request_text = '',\r\n\t\t\t\t\t\t\t\t\t\t\t\tuser_ally_request = '0',\r\n\t\t\t\t\t\t\t\t\t\t\t\tuser_ally_id = '" . $this->_ally['alliance_id'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE user_id = '" . $show . "'");
Functions_Lib::send_message($show, $this->_current_user['user_id'], '', 3, $this->_ally['alliance_tag'], $this->_lang['al_you_was_acceted'] . $this->_ally['alliance_name'], $this->_lang['al_hi_the_alliance'] . $this->_ally['alliance_name'] . $this->_lang['al_has_accepted'] . $_POST['text']);
Functions_Lib::redirect('game.php?page=alliance&mode=admin&edit=ally');
} elseif (isset($_POST['action']) && $_POST['action'] == $this->_lang['al_decline_request'] && $_POST['action'] != '') {
$_POST['text'] = trim(nl2br(strip_tags($_POST['text'], '<br>')));
$_POST['text'] = str_replace('rn', '\\r\\n', $_POST['text']);
parent::$db->query("UPDATE " . USERS . " SET\r\n\t\t\t\t\t\t\t\t\t\t\t\tuser_ally_request_text='',\r\n\t\t\t\t\t\t\t\t\t\t\t\tuser_ally_request='0',\r\n\t\t\t\t\t\t\t\t\t\t\t\tuser_ally_id='0'\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE user_id = '" . (int) $show . "'");
Functions_Lib::send_message($show, $this->_current_user['user_id'], '', 3, $this->_ally['alliance_tag'], $this->_lang['al_you_was_declined'] . $this->_ally['alliance_name'], $this->_lang['al_hi_the_alliance'] . $this->_ally['alliance_name'] . $this->_lang['al_has_declined'] . $_POST['text']);
Functions_Lib::redirect('game.php?page=alliance&mode=admin&edit=ally');
}
$i = 0;
$query = parent::$db->query("SELECT user_id, user_name, user_ally_request_text, user_ally_register_time\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE user_ally_request = '" . $this->_ally['alliance_id'] . "'");
/***start fix by jstar***/
$s = array();
$parse['list'] = '';
while ($r = parent::$db->fetch_array($query)) {
if (isset($show) && $r['user_id'] == $show) {
$s[$show]['username'] = $r['user_name'];
$s[$show]['ally_request_text'] = nl2br($r['user_ally_request_text']);
$s[$show]['id'] = $r['user_id'];
}
$r['time'] = date(Functions_Lib::read_config('date_format_extended'), $r['alliance_register_time']);
$parse['list'] .= parent::$page->parse_template(parent::$page->get_template('alliance/alliance_admin_request_row'), $r);
$i++;
}
if ($parse['list'] == '') {
$parse['list'] = "<tr><th colspan=2>" . $this->_lang['al_no_requests'] . "</th></tr>";
}
if (isset($show) && $show != 0 && $parse['list'] != '') {
$s[$show]['Request_from'] = str_replace('%s', $s[$show]['username'], $this->_lang['al_request_from']);
$parse['request'] = parent::$page->parse_template(parent::$page->get_template('alliance/alliance_admin_request_form'), array_merge($s[$show], $this->_lang));
} else {
$parse['request'] = '';
}
示例13: sendMessage
/**
* sendMessage
*
* @param array $fleet_row Fleet Row
* @param Report $report Report
*
* @return void
*/
private function sendMessage($fleet_row, $report)
{
$idAtts = $report->getAttackersId();
$idDefs = $report->getDefendersId();
$idAll = array_merge($idAtts, $idDefs);
$owners = implode(',', $idAll);
$rid = md5($report) . time();
parent::$db->query("INSERT INTO `" . REPORTS . "` SET\n `report_owners` = '" . $owners . "',\n `report_rid` = '" . $rid . "',\n `report_content` = '" . addslashes($report) . "',\n `report_destroyed` = '" . time() . "'");
foreach ($idAtts as $id) {
if ($report->attackerHasWin()) {
$style = 'green';
} elseif ($report->isAdraw()) {
$style = 'orange';
} else {
$style = 'red';
}
$raport = $this->buildReportLink($style, $rid, $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
Functions_Lib::send_message($id, '', $fleet_row['fleet_start_time'], 1, $this->_lang['sys_mess_tower'], $raport, '');
}
foreach ($idDefs as $id) {
if ($report->attackerHasWin()) {
$style = 'red';
} elseif ($report->isAdraw()) {
$style = 'orange';
} else {
$style = 'green';
}
$raport = $this->buildReportLink($style, $rid, $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
Functions_Lib::send_message($id, '', $fleet_row['fleet_start_time'], 1, $this->_lang['sys_mess_tower'], $raport, '');
}
}
示例14: spy_mission
/**
* method spy_mission
* param $fleet_row
* return the spy result
*/
public function spy_mission($fleet_row)
{
if ($fleet_row['fleet_mess'] == 0 && $fleet_row['fleet_start_time'] <= time()) {
$current_data = parent::$db->query_fetch("SELECT p.planet_name, p.planet_galaxy, p.planet_system, p.planet_planet, u.user_name, r.research_espionage_technology, pr.premium_officier_technocrat\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . USERS . " AS u ON u.user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . PREMIUM . " AS pr ON pr.premium_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_galaxy` = " . $fleet_row['fleet_start_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tp.`planet_system` = " . $fleet_row['fleet_start_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tp.`planet_planet` = " . $fleet_row['fleet_start_planet'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tp.`planet_type` = " . $fleet_row['fleet_start_type'] . ";");
$target_data = parent::$db->query_fetch("SELECT p.`planet_id`, p.planet_user_id, p.planet_name, p.planet_galaxy, p.planet_system, p.planet_planet, p.planet_metal, p.planet_crystal, p.planet_deuterium, p.planet_energy_max, s.*, d.*, b.*, r.*, pr.premium_officier_technocrat\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . USERS . " AS u ON u.user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . PREMIUM . " AS pr ON pr.premium_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE p.`planet_galaxy` = '" . $fleet_row['fleet_end_galaxy'] . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tp.`planet_system` = '" . $fleet_row['fleet_end_system'] . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tp.`planet_planet` = '" . $fleet_row['fleet_end_planet'] . "' AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tp.`planet_type` = '" . $fleet_row['fleet_end_type'] . "';");
$CurrentSpyLvl = Officiers_Lib::get_max_espionage($current_data['research_espionage_technology'], $current_data['premium_officier_technocrat']);
$TargetSpyLvl = Officiers_Lib::get_max_espionage($target_data['research_espionage_technology'], $target_data['premium_officier_technocrat']);
$fleet = explode(';', $fleet_row['fleet_array']);
$fquery = '';
parent::make_update($fleet_row, $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet'], $fleet_row['fleet_end_type']);
foreach ($fleet as $a => $b) {
if ($b != '') {
$a = explode(",", $b);
if ($a[0] == "210") {
$LS = $a[1];
$SpyToolDebris = $LS * 300;
$MaterialsInfo = $this->spy_target($target_data, 0, $this->_lang['sys_spy_maretials']);
$Materials = $MaterialsInfo['String'];
$PlanetFleetInfo = $this->spy_target($target_data, 1, $this->_lang['sys_spy_fleet']);
$PlanetFleet = $Materials;
$PlanetFleet .= $PlanetFleetInfo['String'];
$PlanetDefenInfo = $this->spy_target($target_data, 2, $this->_lang['sys_spy_defenses']);
$PlanetDefense = $PlanetFleet;
$PlanetDefense .= $PlanetDefenInfo['String'];
$PlanetBuildInfo = $this->spy_target($target_data, 3, $this->_lang['tech'][0]);
$PlanetBuildings = $PlanetDefense;
$PlanetBuildings .= $PlanetBuildInfo['String'];
$TargetTechnInfo = $this->spy_target($target_data, 4, $this->_lang['tech'][100]);
$TargetTechnos = $PlanetBuildings;
$TargetTechnos .= $TargetTechnInfo['String'];
$TargetForce = $PlanetFleetInfo['Count'] * $LS / 4;
if ($TargetForce > 100) {
$TargetForce = 100;
}
$TargetChances = mt_rand(0, $TargetForce);
$SpyerChances = mt_rand(0, 100);
if ($TargetChances >= $SpyerChances) {
$DestProba = "<font color=\"red\">" . $this->_lang['sys_mess_spy_destroyed'] . "</font>";
} elseif ($TargetChances < $SpyerChances) {
$DestProba = sprintf($this->_lang['sys_mess_spy_lostproba'], $TargetChances);
}
$AttackLink = "<center>";
$AttackLink .= "<a href=\"game.php?page=fleet1&galaxy=" . $fleet_row['fleet_end_galaxy'] . "&system=" . $fleet_row['fleet_end_system'] . "";
$AttackLink .= "&planet=" . $fleet_row['fleet_end_planet'] . "&planettype=" . $fleet_row['fleet_end_type'] . "";
$AttackLink .= "&target_mission=1";
$AttackLink .= " \">" . $this->_lang['type_mission'][1] . "";
$AttackLink .= "</a></center>";
$MessageEnd = "<center>" . $DestProba . "</center>";
$spionage_difference = abs($CurrentSpyLvl - $TargetSpyLvl);
if ($TargetSpyLvl >= $CurrentSpyLvl) {
$ST = pow($spionage_difference, 2);
$resources = 1;
$fleet = $ST + 2;
$defense = $ST + 3;
$buildings = $ST + 5;
$tech = $ST + 7;
}
if ($CurrentSpyLvl > $TargetSpyLvl) {
$ST = pow($spionage_difference, 2) * -1;
$resources = 1;
$fleet = $ST + 2;
$defense = $ST + 3;
$buildings = $ST + 5;
$tech = $ST + 7;
}
if ($resources <= $LS) {
$SpyMessage = $Materials . "<br />" . $AttackLink . $MessageEnd;
}
if ($fleet <= $LS) {
$SpyMessage = $PlanetFleet . "<br />" . $AttackLink . $MessageEnd;
}
if ($defense <= $LS) {
$SpyMessage = $PlanetDefense . "<br />" . $AttackLink . $MessageEnd;
}
if ($buildings <= $LS) {
$SpyMessage = $PlanetBuildings . "<br />" . $AttackLink . $MessageEnd;
}
if ($tech <= $LS) {
$SpyMessage = $TargetTechnos . "<br />" . $AttackLink . $MessageEnd;
}
Functions_Lib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], 0, $this->_lang['sys_mess_qg'], $this->_lang['sys_mess_spy_report'], $SpyMessage);
$TargetMessage = $this->_lang['sys_mess_spy_ennemyfleet'] . " " . $current_data['planet_name'];
$TargetMessage .= " <a href=\"game.php?page=galaxy&mode=3&galaxy=" . $current_data['planet_galaxy'] . "&system=" . $current_data['planet_system'] . "\">";
$TargetMessage .= "[" . $current_data['planet_galaxy'] . ":" . $current_data['planet_system'] . ":" . $current_data['planet_planet'] . "]</a> (" . $current_data['user_name'] . ") ";
$TargetMessage .= $this->_lang['sys_mess_spy_seen_at'] . " " . $target_data['planet_name'];
$TargetMessage .= " <a href=\"game.php?page=galaxy&mode=3&galaxy=" . $target_data['planet_galaxy'] . "&system=" . $target_data['planet_system'] . "\">";
$TargetMessage .= "[" . $target_data['planet_galaxy'] . ":" . $target_data['planet_system'] . ":" . $target_data['planet_planet'] . "]</a>.";
Functions_Lib::send_message($target_data['planet_user_id'], '', $fleet_row['fleet_start_time'], 0, $this->_lang['sys_mess_spy_control'], $this->_lang['sys_mess_spy_activity'], $TargetMessage . ' ' . sprintf($this->_lang['sys_mess_spy_lostproba'], $TargetChances));
if ($TargetChances >= $SpyerChances) {
parent::$db->query("UPDATE " . PLANETS . " SET\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_invisible_start_time` = '" . time() . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_debris_crystal` = `planet_debris_crystal` + '" . (0 + $SpyToolDebris) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $target_data['id'] . "';");
parent::remove_fleet($fleet_row['fleet_id']);
} else {
parent::return_fleet($fleet_row['fleet_id']);
}
}
//.........这里部分代码省略.........
示例15: expedition_message
/**
* method expedition_message
* param $owner
* param $message
* param $time
* return send a message with the expedition details
*/
private function expedition_message($owner, $message, $time)
{
Functions_Lib::send_message($owner, '', $time, 5, $this->_lang['sys_mess_qg'], $this->_lang['sys_expe_report'], $message);
}