本文整理汇总了PHP中PlayerUtil::deletePlanet方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerUtil::deletePlanet方法的具体用法?PHP PlayerUtil::deletePlanet怎么用?PHP PlayerUtil::deletePlanet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerUtil
的用法示例。
在下文中一共展示了PlayerUtil::deletePlanet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TargetEvent
//.........这里部分代码省略.........
$sql = "SELECT der_metal, der_crystal FROM %%PLANETS%% WHERE id_luna = :moonId;";
$targetDebris = $db->selectSingle($sql, array(':moonId' => $this->_fleet['fleet_end_id']));
$targetPlanet += $targetDebris;
}
foreach ($debrisResource as $elementID) {
$debris[$elementID] = $combatResult['debris']['attacker'][$elementID] + $combatResult['debris']['defender'][$elementID];
$planetDebris[$elementID] = $targetPlanet['der_' . $resource[$elementID]] + $debris[$elementID];
}
$reportInfo = array('thisFleet' => $this->_fleet, 'debris' => $debris, 'stealResource' => $stealResource, 'moonChance' => NULL, 'moonDestroy' => true, 'moonName' => NULL, 'moonDestroyChance' => NULL, 'moonDestroySuccess' => NULL, 'fleetDestroyChance' => NULL, 'fleetDestroySuccess' => false);
switch ($combatResult['won']) {
case "a":
$moonDestroyChance = round((100 - sqrt($targetPlanet['diameter'])) * sqrt($fleetAttack[$this->_fleet['fleet_id']]['unit'][214]), 1);
// Max 100% | Min 0%
$moonDestroyChance = min($moonDestroyChance, 100);
$moonDestroyChance = max($moonDestroyChance, 0);
$randChance = mt_rand(1, 100);
if ($randChance <= $moonDestroyChance) {
$sql = 'SELECT id FROM %%PLANETS%% WHERE id_luna = :moonId;';
$planetID = $db->selectSingle($sql, array(':moonId' => $targetPlanet['id']), 'id');
$sql = 'UPDATE %%FLEETS%% SET
fleet_start_type = 1,
fleet_start_id = :planetId
WHERE fleet_start_id = :moonId;';
$db->update($sql, array(':planetId' => $planetID, ':moonId' => $targetPlanet['id']));
$sql = 'UPDATE %%FLEETS%% SET
fleet_end_type = 1,
fleet_end_id = :moonId,
fleet_mission = IF(fleet_mission = 9, 1, fleet_mission)
WHERE fleet_end_id = :planetId
AND fleet_id != :fleetId;';
$db->update($sql, array(':planetId' => $planetID, ':moonId' => $targetPlanet['id'], ':fleetId' => $this->_fleet['fleet_id']));
$sql = "UPDATE %%AKS%% SET target = :planetId WHERE target = :moonId;";
$db->update($sql, array(':planetId' => $planetID, ':moonId' => $targetPlanet['id']));
PlayerUtil::deletePlanet($targetPlanet['id']);
$reportInfo['moonDestroySuccess'] = 1;
} else {
$reportInfo['moonDestroySuccess'] = 0;
}
$fleetDestroyChance = round(sqrt($targetPlanet['diameter']) / 2);
$randChance = mt_rand(1, 100);
if ($randChance <= $fleetDestroyChance) {
$this->KillFleet();
$reportInfo['fleetDestroySuccess'] = true;
} else {
$reportInfo['fleetDestroySuccess'] = false;
}
$reportInfo['moonDestroyChance'] = $moonDestroyChance;
$reportInfo['fleetDestroyChance'] = $fleetDestroyChance;
// Win
$attackStatus = 'wons';
$defendStatus = 'loos';
$class = array('raportWin', 'raportLose');
break;
case "r":
// Lose
$attackStatus = 'loos';
$defendStatus = 'wons';
$class = array('raportLose', 'raportWin');
$reportInfo['moonDestroySuccess'] = -1;
break;
default:
// Draw
$attackStatus = 'draws';
$defendStatus = 'draws';
$class = array('raportDraw', 'raportDraw');
$reportInfo['moonDestroySuccess'] = -1;
示例2: ShowSearchPage
function ShowSearchPage()
{
global $LNG, $USER;
if ($_GET['delete'] == 'user') {
PlayerUtil::deletePlayer((int) $_GET['user']);
message($LNG['se_delete_succes_p'], '?page=search&search=users&minimize=on', 2);
} elseif ($_GET['delete'] == 'planet') {
PlayerUtil::deletePlanet((int) $_GET['planet']);
message($LNG['se_delete_succes_p'], '?page=search&search=planet&minimize=on', 2);
}
$SearchFile = HTTP::_GP('search', '');
$SearchFor = HTTP::_GP('search_in', '');
$SearchMethod = HTTP::_GP('fuki', '');
$SearchKey = HTTP::_GP('key_user', '', UTF8_SUPPORT);
$Page = HTTP::_GP('side', 0);
$Order = HTTP::_GP('key_order', '');
$OrderBY = HTTP::_GP('key_acc', '');
$limit = HTTP::_GP('limit', 25);
$Selector = array('list' => array('users' => $LNG['se_users'], 'planet' => $LNG['se_planets'], 'moon' => $LNG['se_moons'], 'alliance' => $LNG['se_allys'], 'vacation' => $LNG['se_vacations'], 'banned' => $LNG['se_suspended'], 'admin' => $LNG['se_authlevels'], 'inactives' => $LNG['se_inactives'], 'online' => $LNG['online_users'], 'p_connect' => $LNG['se_planets_act']), 'search' => array('name' => $LNG['se_input_name'], 'id' => $LNG['input_id']), 'filter' => array('normal' => $LNG['se_type_all'], 'exacto' => $LNG['se_type_exact'], 'last' => $LNG['se_type_last'], 'first' => $LNG['se_type_first']), 'order' => array('ASC' => $LNG['se_input_asc'], 'DESC' => $LNG['se_input_desc']), 'limit' => array('1' => '1', '5' => '5', '10' => '10', '15' => '15', '20' => '20', '25' => '25', '50' => '50', '100' => '100', '200' => '200', '500' => '500'));
$template = new template();
if (HTTP::_GP('minimize', '') == 'on') {
$Minimize = "&minimize=on";
$template->assign_vars(array('minimize' => 'checked = "checked"', 'diisplaay' => 'style="display:none;"'));
}
switch ($SearchMethod) {
case 'exacto':
$SpecifyWhere = "= '" . $GLOBALS['DATABASE']->sql_escape($SearchKey) . "'";
break;
case 'last':
$SpecifyWhere = "LIKE '" . $GLOBALS['DATABASE']->sql_escape($SearchKey, true) . "%'";
break;
case 'first':
$SpecifyWhere = "LIKE '%" . $GLOBALS['DATABASE']->sql_escape($SearchKey, true) . "'";
break;
default:
$SpecifyWhere = "LIKE '%" . $GLOBALS['DATABASE']->sql_escape($SearchKey, true) . "%'";
break;
}
if (!empty($SearchFile)) {
$ArrayUsers = array("users", "vacation", "admin", "inactives", "online");
$ArrayPlanets = array("planet", "moon", "p_connect");
$ArrayBanned = array("banned");
$ArrayAlliance = array("alliance");
if (in_array($SearchFile, $ArrayUsers)) {
$Table = "users";
$NameLang = $LNG['se_search_users'];
$SpecifyItems = "id,username,email_2,onlinetime,register_time,user_lastip,authlevel,bana,urlaubs_modus";
$SName = $LNG['se_input_userss'];
$SpecialSpecify = "";
if ($SearchFile == "vacation") {
$SpecialSpecify = "AND urlaubs_modus = '1'";
$SName = $LNG['se_input_vacatii'];
}
if ($SearchFile == "online") {
$SpecialSpecify = "AND onlinetime >= '" . (TIMESTAMP - 15 * 60) . "'";
$SName = $LNG['se_input_connect'];
}
if ($SearchFile == "inactives") {
$SpecialSpecify = "AND onlinetime < '" . (TIMESTAMP - 60 * 60 * 24 * 7) . "'";
$SName = $LNG['se_input_inact'];
}
if ($SearchFile == "admin") {
$SpecialSpecify = "AND authlevel <= '" . $USER['authlevel'] . "' AND authlevel > '0'";
$SName = $LNG['se_input_admm'];
}
$SpecialSpecify .= " AND universe = '" . Universe::getEmulated() . "'";
$SearchFor == "name" ? $WhereItem = "WHERE username" : ($WhereItem = "WHERE id");
$ArrayOSec = array("id", "username", "email_2", "onlinetime", "register_time", "user_lastip", "authlevel", "bana", "urlaubs_modus");
$Array0SecCount = count($ArrayOSec);
for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) {
$OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_users'][$OrderNum];
}
} elseif (in_array($SearchFile, $ArrayPlanets)) {
$Table = "planets p";
$TableUsers = "2";
$NameLang = $LNG['se_search_planets'];
$SpecifyItems = "p.id,p.name,CONCAT(u.username, ' (ID: ', p.id_owner, ')'),p.last_update,p.galaxy,p.system,p.planet,p.id_luna";
if ($SearchFile == "planet") {
$SpecialSpecify = "AND planet_type = '1'";
$SName = $LNG['se_input_planett'];
} elseif ($SearchFile == "moon") {
$SpecialSpecify = "AND planet_type = '3'";
$SName = $LNG['se_input_moonn'];
} elseif ($SearchFile == "p_connect") {
$SpecialSpecify = "AND last_update >= " . (TIMESTAMP - 60 * 60) . "";
$SName = $LNG['se_input_act_pla'];
}
$SpecialSpecify .= " AND p.universe = " . Universe::getEmulated();
$WhereItem = "LEFT JOIN " . USERS . " u ON u.id = p.id_owner ";
if ($SearchFor == "name") {
$WhereItem .= "WHERE p.name";
} else {
$WhereItem .= "WHERE p.id";
}
$ArrayOSec = array("id", "name", "id_owner", "id_luna", "last_update", "galaxy", "system", "planet");
$Array0SecCount = count($ArrayOSec);
for ($OrderNum = 0; $OrderNum < $Array0SecCount; $OrderNum++) {
$OrderBYParse[$ArrayOSec[$OrderNum]] = $LNG['se_search_planets'][$OrderNum];
}
} elseif (in_array($SearchFile, $ArrayBanned)) {
//.........这里部分代码省略.........