本文整理汇总了PHP中msg_send_simple_message函数的典型用法代码示例。如果您正苦于以下问题:PHP msg_send_simple_message函数的具体用法?PHP msg_send_simple_message怎么用?PHP msg_send_simple_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了msg_send_simple_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flt_mission_colonize
function flt_mission_colonize(&$mission_data)
{
$fleet_row =& $mission_data['fleet'];
$src_user_row =& $mission_data['src_user'];
global $lang;
$TargetAdress = sprintf($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
$fleet_array = sys_unit_str2arr($fleet_row['fleet_array']);
$TheMessage = $lang['sys_colo_no_colonizer'];
if ($fleet_array[SHIP_COLONIZER] >= 1) {
$TheMessage = $lang['sys_colo_notfree'];
if (!$mission_data['dst_planet'] || empty($mission_data['dst_planet'])) {
$iPlanetCount = get_player_current_colonies($src_user_row);
// Can we colonize more planets?
$TheMessage = $lang['sys_colo_maxcolo'];
if ($iPlanetCount < get_player_max_colonies($src_user_row)) {
// Yes, we can colonize
$TheMessage = $lang['sys_colo_badpos'];
$NewOwnerPlanet = uni_create_planet($fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet'], $fleet_row['fleet_owner'], "{$lang['sys_colo_defaultname']} {$iPlanetCount}", false, array('user_row' => $src_user_row));
if ($NewOwnerPlanet) {
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok'];
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
$fleet_array[SHIP_COLONIZER]--;
$fleet_row['fleet_amount']--;
$fleet_row['fleet_array'] = sys_unit_arr2str($fleet_array);
return RestoreFleetToPlanet($fleet_row, false);
}
}
}
}
doquery("UPDATE `{{fleets}}` SET `fleet_mess` = '1' WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;");
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], "{$lang['sys_colo_arrival']}{$TargetAdress}{$TheMessage}");
return CACHE_FLEET;
}
示例2: flt_mission_relocate
function flt_mission_relocate($mission_data)
{
$fleet_row = $mission_data['fleet'];
$destination_planet = $mission_data['dst_planet'];
if (!$destination_planet || !is_array($destination_planet)) {
doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
return CACHE_FLEET;
}
/*
// flt_mission_relocate
$TargetAdress = sprintf ($lang['sys_adress_planet'], $fleet_row['fleet_start_galaxy'], $fleet_row['fleet_start_system'], $fleet_row['fleet_start_planet']);
$TargetAddedGoods = sprintf ($lang['sys_stay_mess_goods'],
$lang['Metal'], pretty_number($fleet_row['fleet_resource_metal']),
$lang['Crystal'], pretty_number($fleet_row['fleet_resource_crystal']),
$lang['Deuterium'], pretty_number($fleet_row['fleet_resource_deuterium']));
$TargetMessage = $lang['sys_stay_mess_back'] ."<a href=\"galaxy.php?mode=3&galaxy=". $fleet_row['fleet_start_galaxy'] ."&system=". $fleet_row['fleet_start_system'] ."\">";
$TargetMessage .= $TargetAdress. "</a>". $lang['sys_stay_mess_bend'] ."<br />". $TargetAddedGoods;
SendSimpleMessage ( $fleet_row['fleet_owner'], '', $fleet_row['fleet_end_time'], 5, $lang['sys_mess_qg'], $lang['sys_mess_fleetback'], $TargetMessage);
*/
global $lang;
$TargetUserID = $destination_planet['id_owner'];
$TargetAdress = sprintf($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
$TargetAddedGoods = sprintf($lang['sys_stay_mess_goods'], $lang['Metal'], pretty_number($fleet_row['fleet_resource_metal']), $lang['Crystal'], pretty_number($fleet_row['fleet_resource_crystal']), $lang['Deuterium'], pretty_number($fleet_row['fleet_resource_deuterium']));
$TargetMessage = $lang['sys_stay_mess_start'] . "<a href=\"galaxy.php?mode=3&galaxy=" . $fleet_row['fleet_end_galaxy'] . "&system=" . $fleet_row['fleet_end_system'] . "\">";
$TargetMessage .= $TargetAdress . "</a>" . $lang['sys_stay_mess_end'] . "<br />" . $TargetAddedGoods;
msg_send_simple_message($TargetUserID, '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_qg'], $lang['sys_stay_mess_stay'], $TargetMessage);
return RestoreFleetToPlanet($fleet_row, false);
}
示例3: flt_mission_transport
/**
* flt_mission_transport.php
*
* @version 2.0 return cacher result
* @version 1
* @copyright 2008 By Chlorel for XNova
*/
function flt_mission_transport(&$mission_data)
{
$fleet_row =& $mission_data['fleet'];
$source_planet =& $mission_data['src_planet'];
$destination_planet =& $mission_data['dst_planet'];
if (!isset($destination_planet['id']) || !$destination_planet['id_owner']) {
// doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
flt_send_back($fleet_row);
return CACHE_FLEET;
}
global $lang;
$Message = sprintf($lang['sys_tran_mess_user'], $source_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']);
msg_send_simple_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
if ($fleet_row['fleet_target_owner'] != $fleet_row['fleet_owner']) {
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
}
/*
$Message = sprintf( $lang['sys_tran_mess_owner'],
$TargetName, uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''),
$fleet_row['fleet_resource_metal'], $lang['Metal'],
$fleet_row['fleet_resource_crystal'], $lang['Crystal'],
$fleet_row['fleet_resource_deuterium'], $lang['Deuterium'] );
msg_send_simple_message ( $StartOwner, '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
*/
return RestoreFleetToPlanet($fleet_row, false, true);
}
示例4: flt_mission_transport
/**
* flt_mission_transport.php
*
* @version 2.0 return cacher result
* @version 1
* @copyright 2008 By Chlorel for XNova
*/
function flt_mission_transport($mission_data)
{
$fleet_row = $mission_data['fleet'];
$source_planet = $mission_data['src_planet'];
$destination_planet = $mission_data['dst_planet'];
if (!$destination_planet || !is_array($destination_planet) || !$destination_planet['id_owner']) {
doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
return CACHE_FLEET;
}
/*
// flt_mission_transport
$Message = sprintf($lang['sys_tran_mess_back'], $StartName, GetStartAdressLink($fleet_row, ''));
SendSimpleMessage($StartOwner, '', $fleet_row['fleet_end_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $Message);
*/
global $lang;
$StartName = $source_planet['name'];
$StartOwner = $fleet_row['fleet_owner'];
$TargetName = $destination_planet['name'];
$TargetOwner = $fleet_row['fleet_target_owner'];
$Message = sprintf($lang['sys_tran_mess_owner'], $TargetName, uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']);
msg_send_simple_message($StartOwner, '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
if ($TargetOwner != $StartOwner) {
$Message = sprintf($lang['sys_tran_mess_user'], $StartName, uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $TargetName, uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']);
msg_send_simple_message($TargetOwner, '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
}
return RestoreFleetToPlanet($fleet_row, false, true);
}
示例5: msg_ali_send
function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0)
{
global $time_now, $user;
$ally_id = $ally_id ? $ally_id : $user['ally_id'];
$query = doquery("SELECT id, username FROM {{users}} WHERE ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''));
$list = '';
while ($u = mysql_fetch_assoc($query)) {
$sendList[] = $u['id'];
$list .= "<br>{$u['username']} ";
}
msg_send_simple_message($sendList, $user['id'], $time_now, MSG_TYPE_ALLIANCE, $user['username'], $subject, sys_bbcodeParse($message, true));
return $list;
}
示例6: flt_mission_destroy
function flt_mission_destroy($mission_data)
{
$result = flt_mission_attack($mission_data);
if (empty($result) || $result['won'] != 1) {
return $result;
}
$fleet_row = $mission_data['fleet'];
$destination_planet = $mission_data['dst_planet'];
if (!$destination_planet || !is_array($destination_planet)) {
doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
return;
}
global $lang;
$MoonSize = $destination_planet['diameter'];
$MoonName = $destination_planet['name'];
$RipsKilled = 0;
$MoonDestroyed = 0;
foreach ($result['rw'][count($result['rw']) - 1]['attackers'] as $fleet) {
foreach ($fleet['detail'] as $shipID => $shipNum) {
$Rips += $shipID == SHIP_DEATH_STAR ? $shipNum : 0;
}
}
if ($Rips > 0) {
$MoonDestChance = min(99, round((100 - sqrt($MoonSize)) * sqrt($Rips)));
$RipDestChance = round(sqrt($MoonSize) / 2);
$UserChance = mt_rand(1, 100);
if ($UserChance > 0 and $UserChance <= $MoonDestChance) {
$RipsKilled = 0;
$MoonDestroyed = 1;
} elseif ($UserChance > 0 and $UserChance <= $RipDestChance) {
$RipsKilled = 1;
$MoonDestroyed = 0;
}
}
if ($MoonDestroyed == 1) {
doquery("DELETE FROM {{planets}} WHERE `id` ='{$destination_planet['id']}';");
$message = $lang['sys_moon_destroyed'];
} elseif ($RipsKilled == 1) {
//TODO: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! А нужно удалять все флоты !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
doquery("DELETE FROM {{fleets}} WHERE `fleet_id` = '{$fleet_row["fleet_id"]}';");
$message = $lang['sys_rips_destroyed'];
} else {
$message = $lang['sys_rips_come_back'];
}
$message .= "<br><br>";
$message .= $lang['sys_chance_moon_destroy'] . intval($MoonDestChance) . "%. <br>" . $lang['sys_chance_rips_destroy'] . intval($RipDestChance) . "%";
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_COMBAT, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message);
msg_send_simple_message($destination_planet['id_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_COMBAT, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message);
return $result;
}
示例7: release
/**
* SendSimpleMessage.php
*
* @version 1.3
* @copyright 2008 by Chlorel for XNova
Revision history :
1.0 - Initial release (mise en fonction generique)
1.1 - Ajout gestion des messages par type pour le module de messages
1.2 - Correction bug (addslashes pour les zone texte pouvant contenir une apostrophe)
1.3 - Correction bug (integration de la variable $Time pour afficher l'heure exacte de l'evenement pour les flottes)
1.4 - copyright (c) 2010 by Gorlum for http://supernova.ws
[+] Ability to mass-send emails. Mass-sending done via two queries - one for messages table, one for users table
1.5 - copyright (c) 2010-2011 by Gorlum for http://supernova.ws
[+] SuperMassMailing - authlevel=3 player can send messages to whole server ('*' as $owners)
*/
function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0)
{
global $user;
$ally_id = $ally_id ? $ally_id : $user['ally_id'];
$list = '';
$query = db_user_list("ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), false, 'id, username');
// while ($u = db_fetch($query))
foreach ($query as $u) {
$sendList[] = $u['id'];
$list .= "<br>{$u['username']} ";
}
msg_send_simple_message($sendList, $user['id'], SN_TIME_NOW, MSG_TYPE_ALLIANCE, $user['username'], $subject, $message, true);
return $list;
}
示例8: sn_user_birthday_celebrate
function sn_user_birthday_celebrate()
{
global $config, $lang;
sn_db_transaction_start();
$query = db_user_list_to_celebrate($config->user_birthday_range);
while ($row = db_fetch($query)) {
$row['username'] = db_escape($row['username']);
rpg_points_change($row['id'], RPG_BIRTHDAY, $config->user_birthday_gift, "Birthday gift for user {$row['username']} ID {$row['id']} on his birthday on {$row['user_birthday']}. Gift last gaved at {$row['user_birthday_celebrated']}");
db_user_set_by_id($row['id'], "`user_birthday_celebrated` = '{$row['current_birthday']}'");
msg_send_simple_message($row['id'], 0, SN_TIME_NOW, MSG_TYPE_ADMIN, $lang['sys_administration'], $lang['sys_birthday'], sprintf($lang['sys_birthday_message'], $row['username'], $row['current_birthday'], $config->user_birthday_gift, $lang['sys_dark_matter_sh']), true, true);
}
$config->db_saveItem('user_birthday_celebrate', SN_TIME_NOW);
sn_db_transaction_commit();
}
示例9: flt_mission_relocate
/**
* MissionCaseStay.php
*
* version 2.0 returns results for new fleet handler
* @version 1.1
* @copyright 2008 by Chlorel for XNova
*/
function flt_mission_relocate($mission_data)
{
$fleet_row =& $mission_data['fleet'];
$destination_planet =& $mission_data['dst_planet'];
if (!$destination_planet || !is_array($destination_planet)) {
// doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
flt_send_back($mission_data['fleet']);
return CACHE_FLEET;
}
global $lang;
$Message = sprintf($lang['sys_tran_mess_user'], $mission_data['src_planet']['name'], uni_render_coordinates_href($fleet_row, 'fleet_start_', 3, ''), $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), $fleet_row['fleet_resource_metal'], $lang['Metal'], $fleet_row['fleet_resource_crystal'], $lang['Crystal'], $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']) . '<br />' . $lang['sys_relocate_mess_user'];
foreach (sys_unit_str2arr($fleet_row['fleet_array']) as $ship_id => $ship_count) {
$Message .= $lang['tech'][$ship_id] . ' - ' . $ship_count . '<br />';
}
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_qg'], $lang['sys_stay_mess_stay'], $Message);
return RestoreFleetToPlanet($fleet_row, false);
}
示例10: flt_mission_colonize
function flt_mission_colonize($mission_data)
{
$fleet_row = $mission_data['fleet'];
$src_user_row = $mission_data['src_user'];
$destination_planet = $mission_data['dst_planet'];
global $lang;
$TargetAdress = sprintf($lang['sys_adress_planet'], $fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet']);
$fleet_array = sys_unit_str2arr($fleet_row['fleet_array']);
$TheMessage = $lang['sys_colo_no_colonizer'];
if ($fleet_array[SHIP_COLONIZER] >= 1) {
$TheMessage = $lang['sys_colo_notfree'];
if (!$destination_planet) {
$iMaxColo = $src_user_row['colonisation_tech'] + 1;
$iPlanetCount = doquery("SELECT count(*) as `planet_count` FROM `{{planets}}` WHERE `id_owner` = '{$fleet_row['fleet_owner']}' AND `planet_type` = '1';", '', true);
$iPlanetCount = $iPlanetCount['planet_count'];
// Can we colonize more planets?
$TheMessage = $lang['sys_colo_maxcolo'];
if ($iPlanetCount < $iMaxColo && $iPlanetCount < $GLOBALS['config']->player_max_colonies + 1) {
// Yes, we can colonize
$TheMessage = $lang['sys_colo_badpos'];
$NewOwnerPlanet = uni_create_planet($fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet'], $fleet_row['fleet_owner'], "{$lang['sys_colo_defaultname']} ¹{$iPlanetCount}");
if ($NewOwnerPlanet) {
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok'];
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
$fleet_array[SHIP_COLONIZER]--;
$fleet_row['fleet_amount']--;
$fleet_row['fleet_array'] = sys_unit_arr2str($fleet_array);
if ($fleet_row['fleet_array']) {
$GLOBALS['debug']->warning("Sending several type of ships with colonizer leads to resource duplication. Resource duplicate X time where X - number of ship type<br>Fleet: {$fleet_row['fleet_array']}", 'Colonization With Fleet', 304);
}
return RestoreFleetToPlanet($fleet_row, false);
}
}
}
}
doquery("UPDATE `{{fleets}}` SET `fleet_mess` = '1' WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;");
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], "{$lang['sys_colo_arrival']}{$TargetAdress}{$TheMessage}");
return CACHE_FLEET;
}
示例11: HandleTechnologieBuild
function HandleTechnologieBuild(&$user, &$planetrow)
{
global $sn_data, $time_now, $lang;
if ($user['b_tech_planet']) {
if ($user['b_tech_planet'] != $planetrow['id']) {
$planet = doquery("SELECT * FROM `{{planets}}` WHERE `id` = '{$user['b_tech_planet']}' LIMIT 1;", '', true);
} else {
$planet = $planetrow;
}
if ($planet['b_tech'] && $planet['b_tech_id'] && $planet['b_tech'] <= $time_now) {
$unit_id = $planet['b_tech_id'];
$unit_db_name = $sn_data[$unit_id]['name'];
$user[$unit_db_name]++;
msg_send_simple_message($user['id'], 0, $time_now, MSG_TYPE_QUE, $lang['msg_que_research_from'], $lang['msg_que_research_subject'], sprintf($lang['msg_que_research_message'], $lang['tech'][$planet['b_tech_id']], $user[$unit_db_name]));
$quest_list = qst_get_quests($user['id']);
$quest_triggers = qst_active_triggers($quest_list);
$quest_rewards = array();
// TODO: Check mutiply condition quests
$quest_trigger_list = array_keys($quest_triggers, $unit_id);
foreach ($quest_trigger_list as $quest_id) {
if ($quest_list[$quest_id]['quest_unit_amount'] <= $user[$unit_db_name] && $quest_list[$quest_id]['quest_status_status'] != QUEST_STATUS_COMPLETE) {
$quest_rewards[$quest_id] = $quest_list[$quest_id]['quest_rewards'];
$quest_list[$quest_id]['quest_status_status'] = QUEST_STATUS_COMPLETE;
}
}
qst_reward($user, $planet, $quest_rewards, $quest_list);
doquery("UPDATE `{{planets}}` SET `b_tech` = '0', `b_tech_id` = '0' WHERE `id` = '{$planet['id']}' LIMIT 1;");
doquery("UPDATE `{{users}}` SET `{$unit_db_name}` = `{$unit_db_name}` + 1, `b_tech_planet` = '0' WHERE `id` = '{$user['id']}' LIMIT 1;");
$planet["b_tech_id"] = 0;
} elseif ($planet["b_tech_id"] == 0) {
// Il n'y a rien a l'ouest ...
// Pas de Technologie en cours devait y avoir un bug lors de la derniere connexion
// On met l'enregistrement informant d'une techno en cours de recherche a jours
doquery("UPDATE `{{users}}` SET `b_tech_planet` = '0' WHERE `id` = '{$user['id']}' LIMIT 1;");
}
}
}
示例12: flt_mission_spy
function flt_mission_spy(&$mission_data)
{
global $lang;
$fleet_row =& $mission_data['fleet'];
$target_user_row =& $mission_data['dst_user'];
$target_planet_row =& $mission_data['dst_planet'];
$spying_user_row =& $mission_data['src_user'];
$spying_planet_row =& $mission_data['src_planet'];
if (!isset($target_user_row['id']) || !isset($target_planet_row['id']) || !isset($spying_user_row['id'])) {
doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
return;
}
$fleet_array = sys_unit_str2arr($fleet_row['fleet_array']);
if ($fleet_array[SHIP_SPY] > 0) {
$TargetSpyLvl = GetSpyLevel($target_user_row);
$CurrentSpyLvl = GetSpyLevel($spying_user_row);
$spy_diff_empire = $CurrentSpyLvl - $TargetSpyLvl;
$spy_probes = $fleet_array[SHIP_SPY];
$spy_diff = $spy_diff_empire + sqrt($spy_probes) - 1;
$combat_pack[0] = array(RES_METAL => $target_planet_row['metal'], RES_CRYSTAL => $target_planet_row['crystal'], RES_DEUTERIUM => $target_planet_row['deuterium']);
$spy_message = "<table width=\"440\" cellspacing = \"1\"><tr><td class=\"c\" colspan=\"4\">{$lang['sys_spy_maretials']} {$target_planet_row['name']} ";
$spy_message .= uni_render_coordinates_href($target_planet_row, '', 3);
$spy_message .= " ({$lang['Player_']} '{$target_user_row['username']}') {$lang['On_']} ";
$spy_message .= date(FMT_DATE_TIME, $fleet_row['fleet_end_time']);
$spy_message .= "</td></tr><tr>";
$spy_message .= "<td width=220>{$lang['sys_metal']}</td><td width=220 align=right>" . pretty_number($target_planet_row['metal']) . "</td>";
$spy_message .= "<td width=220>{$lang['sys_crystal']}</td></td><td width=220 align=right>" . pretty_number($target_planet_row['crystal']) . "</td>";
$spy_message .= "</tr><tr>";
$spy_message .= "<td width=220>{$lang['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>";
$spy_message .= "<td width=220>{$lang['sys_energy']}</td><td width=220 align=right>" . pretty_number($target_planet_row['energy_max']) . "</td>";
$spy_message .= "</tr>";
if ($spy_diff >= 2) {
$spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'fleet', $lang['tech'][UNIT_SHIPS], $target_user_row) . "</div>";
coe_compress_add_units(sn_get_groups('fleet'), $target_planet_row, $combat_pack[0]);
}
if ($spy_diff >= 3) {
$spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'defense', $lang['tech'][UNIT_DEFENCE], $target_user_row) . "</div>";
coe_compress_add_units(sn_get_groups('defense_active'), $target_planet_row, $combat_pack[0]);
}
if ($spy_diff >= 5) {
$spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'structures', $lang['tech'][UNIT_STRUCTURES], $target_user_row) . "</div>";
}
if ($spy_diff_empire >= 0) {
$spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'tech', $lang['tech'][UNIT_TECHNOLOGIES], $target_user_row) . "</div>";
coe_compress_add_units(array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR), $target_planet_row, $combat_pack[0], $target_user_row);
}
// TODO: Наемники, губернаторы, артефакты и прочее имперское
$simulator_link = sn_ube_simulator_encode_replay($combat_pack, 'D');
$target_unit_list = 0;
foreach (sn_get_groups('fleet') as $unit_id) {
$target_unit_list += max(0, mrc_get_level($target_user_row, $target_planet_row, $unit_id, false, true));
}
$spy_detected = $spy_probes * $target_unit_list / 4 * pow(2, $TargetSpyLvl - $CurrentSpyLvl);
if (mt_rand(0, 99) > $spy_detected) {
$spy_outcome_str = sprintf($lang['sys_mess_spy_detect_chance'], $spy_detected);
$spy_detected = false;
} else {
$spy_outcome_str = $lang['sys_mess_spy_destroyed'];
$spy_detected = true;
}
$spy_message .= "<tr><th class=\"c_c\" colspan=4>";
$spy_message .= "{$spy_outcome_str}<br />";
$spy_message .= "<a href=\"fleet.php?target_mission=1&planet_type={$fleet_row['fleet_end_type']}&galaxy={$fleet_row['fleet_end_galaxy']}&system={$fleet_row['fleet_end_system']}&planet={$fleet_row['fleet_end_planet']} \">{$lang['type_mission'][1]}</a><br />";
$spy_message .= "<a href=\"simulator.php?replay={$simulator_link}\">{$lang['COE_combatSimulator']}</a><br />";
$spy_message .= "</th></tr></table>";
// End of link generation
msg_send_simple_message($spying_user_row['id'], '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_mess_qg'], $lang['sys_mess_spy_report'], $spy_message);
$target_message = "{$lang['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} " . uni_render_coordinates_href($spying_planet_row, '', 3);
$target_message .= " {$lang['sys_mess_spy_seen_at']} {$target_planet_row['name']} " . uni_render_coordinates($target_planet_row);
$target_user_id = $fleet_row['fleet_target_owner'];
if ($spy_detected) {
doquery("DELETE FROM {{fleets}} WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;");
$debris_planet_id = $target_planet_row['planet_type'] == PT_PLANET ? $target_planet_row['id'] : $target_planet_row['parent_planet'];
$spy_cost = get_unit_param(SHIP_SPY, P_COST);
db_planet_set_by_id($debris_planet_id, "`debris_metal` = `debris_metal` + " . floor($spy_probes * $spy_cost[RES_METAL] * 0.3) . ", `debris_crystal` = `debris_crystal` + " . floor($spy_probes * $spy_cost[RES_CRYSTAL] * 0.3));
$target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}";
$result = CACHE_FLEET | CACHE_PLANET_DST;
} else {
$result = CACHE_FLEET;
}
msg_send_simple_message($target_user_id, '', $fleet_row['fleet_start_time'], MSG_TYPE_SPY, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $target_message);
}
if (!$spy_detected) {
doquery("UPDATE {{fleets}} SET `fleet_mess` = '1' WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;");
}
return $result;
}
示例13: sys_o_get_updated
/**
* PlanetResourceUpdate.php
*
* 2.1 - copyright (c) 2010 by Gorlum for http://supernova.ws
* [+] Bit more optimization
* 2.0 - copyright (c) 2009-2010 by Gorlum for http://supernova.ws
* [+] Full rewrote and optimization
* 1.1 - @copyright 2008 By Chlorel for XNova
* [*] Mise a jour automatique mines / silos / energie ...
* 1.0 - @copyright 2008 By Chlorel for XNova
* [*] Mise en module initiale
*/
function sys_o_get_updated($user, $planet, $UpdateTime, $simulation = false)
{
global $time_now, $sn_data, $lang;
$no_data = array('user' => false, 'planet' => false, 'que' => false);
if (!$planet) {
return $no_data;
}
$suffix = $simulation ? '' : 'FOR UPDATE';
if (is_array($planet)) {
if (!(isset($planet['id']) && $planet['id']) || !$simulation) {
$planet = doquery("SELECT * FROM `{{planets}}` WHERE `galaxy` = '{$planet['galaxy']}' AND `system` = '{$planet['system']}' AND `planet` = '{$planet['planet']}' and `planet_type` = '{$planet['planet_type']}' LIMIT 1 {$suffix};", '', true);
}
} else {
$planet = doquery("SELECT * FROM `{{planets}}` WHERE `id` = '{$planet}' LIMIT 1 {$suffix};", '', true);
}
if (!($planet && isset($planet['id']) && $planet['id'])) {
return $no_data;
}
if (!$user || !is_array($user) || !isset($user['id'])) {
$user = doquery("SELECT * FROM `{{users}}` WHERE `id` = {$planet['id_owner']} LIMIT 1 {$suffix};", '', true);
if (!$user) {
return $no_data;
}
}
$ProductionTime = max(0, $UpdateTime - $planet['last_update']);
$planet['last_update'] += $ProductionTime;
$Caps = ECO_getPlanetCaps($user, $planet);
$incRes = array('metal' => 0, 'crystal' => 0, 'deuterium' => 0);
switch ($planet['planet_type']) {
case PT_PLANET:
foreach ($incRes as $resName => &$incCount) {
// $Caps['planet'][$resName] = max(0, $Caps['planet'][$resName]);
$incCount = ($Caps[$resName . '_perhour'][0] + $Caps['planet'][$resName . '_perhour'] * $Caps['production']) * $ProductionTime / 3600;
$store_free = $Caps['planet'][$resName . '_max'] - $Caps['planet'][$resName];
// $incCount = max(0, min($incCount, max(0, $store_free)));
$incCount = min($incCount, max(0, $store_free));
if ($planet[$resName] + $incCount < 0) {
$GLOBALS['debug']->warning("Player ID {$user['id']} have negative resources on ID {$planet['id']}.{$planet['planet_type']} [{$planet['galaxy']}:{$planet['system']}:{$planet['planet']}]. Difference {$planet[$resName]} of {$resName}", 'Negative Resources', 501);
}
$Caps['planet'][$resName] += $incCount;
$Caps['planet'][$resName . '_perhour'] = $Caps['real'][$resName . '_perhour'];
}
break;
case PT_MOON:
default:
$planet['metal_perhour'] = 0;
$planet['crystal_perhour'] = 0;
$planet['deuterium_perhour'] = 0;
$planet['energy_used'] = 0;
$planet['energy_max'] = 0;
break;
}
$planet = array_merge($planet, $Caps['planet']);
$que = eco_que_process($user, $planet, $ProductionTime);
if ($simulation) {
return array('user' => $user, 'planet' => $planet, 'que' => $que);
}
$QryUpdatePlanet = "UPDATE {{planets}} SET `last_update` = '{$planet['last_update']}', ";
$QryUpdatePlanet .= "`metal` = `metal` + '{$incRes['metal']}', `crystal` = `crystal` + '{$incRes['crystal']}', `deuterium` = `deuterium` + '{$incRes['deuterium']}', ";
$QryUpdatePlanet .= "`metal_perhour` = '{$planet['metal_perhour']}', `crystal_perhour` = '{$planet['crystal_perhour']}', `deuterium_perhour` = '{$planet['deuterium_perhour']}', ";
$QryUpdatePlanet .= "`energy_used` = '{$planet['energy_used']}', `energy_max` = '{$planet['energy_max']}', ";
$built = eco_bld_handle_que($user, $planet, $ProductionTime);
if ($built['built']) {
foreach ($built['built'] as $Element => $Count) {
$Element = intval($Element);
$Count = intval($Count);
if ($Element) {
$QryUpdatePlanet .= "`{$sn_data[$Element]['name']}` = `{$sn_data[$Element]['name']}` + '{$Count}', ";
}
}
if (!$planet['b_hangar']) {
msg_send_simple_message($user['id'], 0, $time_now, MSG_TYPE_QUE, $lang['msg_que_planet_from'], $lang['msg_que_hangar_subject'], sprintf($lang['msg_que_hangar_message'], uni_render_planet($planet)));
}
}
$QryUpdatePlanet .= "`b_hangar_id` = '{$planet['b_hangar_id']}', ";
$QryUpdatePlanet .= "`b_hangar` = '{$planet['b_hangar']}' ";
$QryUpdatePlanet .= $que['query'] != $planet['que'] ? ",{$que['query']} " : '';
if (!empty($que['built'])) {
$message = array();
foreach ($que['built'] as $unit_id => $built_count) {
if ($built_count > 0) {
$message[] = sprintf($lang['msg_que_built_message'], uni_render_planet($planet), $lang['tech'][$unit_id], $built_count);
} else {
$message[] = sprintf($lang['msg_que_destroy_message'], uni_render_planet($planet), $lang['tech'][$unit_id], -$built_count);
}
}
msg_send_simple_message($user['id'], 0, $time_now, MSG_TYPE_QUE, $lang['msg_que_planet_from'], $lang['msg_que_built_subject'], implode('<br />', $message));
}
//.........这里部分代码省略.........
示例14: flt_mission_recycle
/**
* MissionCaseRecycling.php
*
* @version 1.0
* @copyright 2008 By Chlorel for XNova
*/
function flt_mission_recycle(&$mission_data)
{
$fleet_row =& $mission_data['fleet'];
$destination_planet =& $mission_data['dst_planet'];
if (!$fleet_row) {
return CACHE_NOTHING;
}
if (!isset($destination_planet['id'])) {
// doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
flt_send_back($mission_data['fleet']);
return CACHE_FLEET;
}
global $lang;
$RecyclerCapacity = 0;
$OtherFleetCapacity = 0;
$fleet_array = sys_unit_str2arr($fleet_row['fleet_array']);
foreach ($fleet_array as $unit_id => $unit_count) {
if (in_array($unit_id, sn_get_groups('fleet'))) {
$capacity = get_unit_param($unit_id, P_CAPACITY) * $unit_count;
if (in_array($unit_id, sn_get_groups('flt_recyclers'))) {
$RecyclerCapacity += $capacity;
} else {
$OtherFleetCapacity += $capacity;
}
}
}
$IncomingFleetGoods = $fleet_row["fleet_resource_metal"] + $fleet_row["fleet_resource_crystal"] + $fleet_row["fleet_resource_deuterium"];
if ($IncomingFleetGoods > $OtherFleetCapacity) {
$RecyclerCapacity -= $IncomingFleetGoods - $OtherFleetCapacity;
}
if ($destination_planet["debris_metal"] + $destination_planet["debris_crystal"] <= $RecyclerCapacity) {
$RecycledGoods["metal"] = $destination_planet["debris_metal"];
$RecycledGoods["crystal"] = $destination_planet["debris_crystal"];
} else {
if ($destination_planet["debris_metal"] > $RecyclerCapacity / 2 and $destination_planet["debris_crystal"] > $RecyclerCapacity / 2) {
$RecycledGoods["metal"] = $RecyclerCapacity / 2;
$RecycledGoods["crystal"] = $RecyclerCapacity / 2;
} else {
if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) {
$RecycledGoods["crystal"] = $destination_planet["debris_crystal"];
if ($destination_planet["debris_metal"] > $RecyclerCapacity - $RecycledGoods["crystal"]) {
$RecycledGoods["metal"] = $RecyclerCapacity - $RecycledGoods["crystal"];
} else {
$RecycledGoods["metal"] = $destination_planet["debris_metal"];
}
} else {
$RecycledGoods["metal"] = $destination_planet["debris_metal"];
if ($destination_planet["debris_crystal"] > $RecyclerCapacity - $RecycledGoods["metal"]) {
$RecycledGoods["crystal"] = $RecyclerCapacity - $RecycledGoods["metal"];
} else {
$RecycledGoods["crystal"] = $destination_planet["debris_crystal"];
}
}
}
}
$NewCargo['Metal'] = $fleet_row["fleet_resource_metal"] + $RecycledGoods["metal"];
$NewCargo['Crystal'] = $fleet_row["fleet_resource_crystal"] + $RecycledGoods["crystal"];
$NewCargo['Deuterium'] = $fleet_row["fleet_resource_deuterium"];
db_planet_set_by_gspt($fleet_row['fleet_end_galaxy'], $fleet_row['fleet_end_system'], $fleet_row['fleet_end_planet'], PT_PLANET, "`debris_metal` = `debris_metal` - '{$RecycledGoods['metal']}', `debris_crystal` = `debris_crystal` - '{$RecycledGoods['crystal']}'");
$Message = sprintf($lang['sys_recy_gotten'], pretty_number($RecycledGoods["metal"]), $lang['Metal'], pretty_number($RecycledGoods["crystal"]), $lang['Crystal']);
msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_RECYCLE, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message);
$QryUpdateFleet = "UPDATE {{fleets}} SET `fleet_mess` = 1,`fleet_resource_metal` = '{$NewCargo['Metal']}',`fleet_resource_crystal` = '{$NewCargo['Crystal']}',`fleet_resource_deuterium` = '{$NewCargo['Deuterium']}' ";
$QryUpdateFleet .= "WHERE `fleet_id` = '{$fleet_row['fleet_id']}' LIMIT 1;";
doquery($QryUpdateFleet);
return CACHE_FLEET | CACHE_PLANET_DST;
}
示例15: array
}
$re ? $subject = $lang['msg_answer_prefix'] . $subject : false;
if (sys_get_param_str('msg_send')) {
$subject = $subject ? $subject : $lang['msg_subject_default'];
if (!$recipient_id) {
$error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
}
$text = sys_get_param_str('text');
if (!$text) {
$error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
}
if (empty($error_list)) {
$error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
$user_safe_name = db_escape($user['username']);
$recipient_name = db_escape($recipient_name);
msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true);
//$recipient_id = 0;
//$recipient_name = '';
//$subject = '';
$text = '';
$msg_sent = true;
} else {
$subject = sys_get_param_str_unsafe('subject');
$text = sys_get_param_str_unsafe('text');
}
$recipient_name = sys_get_param_str_unsafe('recipient_name');
}
$subject = $subject ? $subject : $lang['msg_subject_default'];
$template->assign_vars(array('RECIPIENT_ID' => $recipient_id, 'RECIPIENT_NAME' => htmlspecialchars($recipient_name), 'SUBJECT' => htmlspecialchars($subject), 'TEXT' => htmlspecialchars($text)));
foreach ($error_list as $error_message) {
$template->assign_block_vars('result', $error_message);