本文整理汇总了PHP中PlayerUtil::maxPlanetCount方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerUtil::maxPlanetCount方法的具体用法?PHP PlayerUtil::maxPlanetCount怎么用?PHP PlayerUtil::maxPlanetCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerUtil
的用法示例。
在下文中一共展示了PlayerUtil::maxPlanetCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TargetEvent
function TargetEvent()
{
global $resource;
$iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $this->_fleet['fleet_owner'] . "' AND `planet_type` = '1' AND `destruyed` = '0';");
$iGalaxyPlace = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_end_id'] . "';");
$senderUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE `id` = '" . $this->_fleet['fleet_owner'] . "';");
$senderPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_start_id'] . "';");
$senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']);
$LNG = $this->getLanguage($senderUser['lang']);
$MaxPlanets = PlayerUtil::maxPlanetCount($senderUser);
if ($iGalaxyPlace != 0) {
$TheMessage = sprintf($LNG['sys_colo_notfree'], GetTargetAdressLink($this->_fleet, ''));
$this->setState(FLEET_RETURN);
} elseif ($iPlanetCount >= $MaxPlanets) {
$TheMessage = sprintf($LNG['sys_colo_maxcolo'], GetTargetAdressLink($this->_fleet, ''), $MaxPlanets);
$this->setState(FLEET_RETURN);
} elseif (PlayerUtil::allowPlanetPosition($this->_fleet['fleet_end_planet'], $senderUser) == false) {
$TheMessage = sprintf($LNG['sys_colo_notech'], GetTargetAdressLink($this->_fleet, ''), $MaxPlanets);
$this->setState(FLEET_RETURN);
} else {
require_once 'includes/functions/CreateOnePlanetRecord.php';
$NewOwnerPlanet = CreateOnePlanetRecord($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_universe'], $this->_fleet['fleet_owner'], $LNG['fcp_colony'], false, $senderUser['authlevel']);
if ($NewOwnerPlanet === false) {
$TheMessage = sprintf($LNG['sys_colo_badpos'], GetTargetAdressLink($this->_fleet, ''));
$this->setState(FLEET_RETURN);
} else {
$this->_fleet['fleet_end_id'] = $NewOwnerPlanet;
$TheMessage = sprintf($LNG['sys_colo_allisok'], GetTargetAdressLink($this->_fleet, ''));
$this->StoreGoodsToPlanet();
if ($this->_fleet['fleet_amount'] == 1) {
$this->KillFleet();
} else {
$CurrentFleet = explode(";", $this->_fleet['fleet_array']);
$NewFleet = '';
foreach ($CurrentFleet as $Item => $Group) {
if (empty($Group)) {
continue;
}
$Class = explode(",", $Group);
if ($Class[0] == 208 && $Class[1] > 1) {
$NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";";
} elseif ($Class[0] != 208 && $Class[1] > 0) {
$NewFleet .= $Class[0] . "," . $Class[1] . ";";
}
}
$this->UpdateFleet('fleet_array', $NewFleet);
$this->UpdateFleet('fleet_amount', $this->_fleet['fleet_amount'] - 1);
$this->UpdateFleet('fleet_resource_metal', 0);
$this->UpdateFleet('fleet_resource_crystal', 0);
$this->UpdateFleet('fleet_resource_deuterium', 0);
$this->setState(FLEET_RETURN);
}
}
}
SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 4, $LNG['sys_colo_mess_from'], $LNG['sys_colo_mess_report'], $TheMessage);
$this->SaveFleet();
}
示例2: lotinfo
function lotinfo()
{
global $USER, $PLANET, $LNG, $UNI, $CONF, $resource, $pricelist;
$lotID = HTTP::_GP('lotID', 0);
$info = $GLOBALS['DATABASE']->query("SELECT DISTINCT ps.*, p.field_current, p.field_max, p.id_luna FROM uni1_planetauction as ps \n\tINNER JOIN " . PLANETS . " as p ON p.id = ps.planetID WHERE auctionID = " . $lotID . ";");
$info = $GLOBALS['DATABASE']->fetch_array($info);
$iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $USER['id'] . "' AND `planet_type` = '1' AND `destruyed` = '0' AND universe = " . $UNI . ";");
$MaxPlanets = PlayerUtil::maxPlanetCount($USER);
if ($iPlanetCount >= $MaxPlanets) {
$this->printMessage("you can not buy additional planets as you have reached the max allowed planets / user!", true, array('game.php?page=Planeta', 2));
die;
} elseif ($USER['id'] == $info['selledID']) {
$this->printMessage("you can not rebuy your old planets!", true, array('game.php?page=Planeta', 2));
die;
} else {
$this->tplObj->loadscript("jquery.countdown.js");
$this->tplObj->assign_vars(array('lotID' => $lotID, 'type' => $info['type'], 'field_max' => $info['field_max'], 'id_luna' => $info['id_luna'], 'planetID' => $info['planetID'], 'time' => !empty($info['time']) && $info['time'] > TIMESTAMP ? $info['time'] - TIMESTAMP : 0, 'current_price' => round($info['price'] + $info['price'] / 100 * 1)));
$this->display("page.planetauctions.lot.tpl");
}
}
示例3: show
public function show()
{
global $USER, $PLANET, $resource, $LNG, $CONF, $pricelist;
$UserDeuterium = $PLANET['elyrium'];
$planetID = HTTP::_GP('planetID', 0);
$targetMission = HTTP::_GP('mission', 0);
$galaxyC = HTTP::_GP('galaxyC', 0);
$systemC = HTTP::_GP('systemC', 0);
$planetC = HTTP::_GP('planetC', 0);
if (IsVacationMode($USER)) {
$this->sendData(620, $LNG['fa_vacation_mode_current']);
}
$fleetArray = array();
switch ($targetMission) {
case 14:
if (!isModulAvalible(MODULE_MISSION_SPY)) {
$this->sendData('rouge', $LNG['sys_module_inactive']);
}
if ($PLANET['teleport_portal'] == 0) {
$this->sendData('rouge', $LNG['fleet_ajax_11']);
}
$ships = min($USER['spio_anz'], $PLANET[$resource[210]]);
if (empty($ships)) {
$this->sendData('rouge', $LNG['fleet_ajax_22']);
}
$fleetArray = array(210 => $ships);
$this->returnData['ships'][210] = $PLANET[$resource[210]] - $ships;
break;
case 7:
if (!isModulAvalible(MODULE_MISSION_COLONY)) {
$this->sendData('rouge', $LNG['sys_module_inactive']);
}
if ($PLANET['teleport_portal'] == 0) {
$this->sendData('rouge', $LNG['fleet_ajax_11']);
}
if ($PLANET[$resource[303]] < 10 || $PLANET[$resource[306]] < 100) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_12'], $PLANET[$resource[303]], $PLANET[$resource[306]]));
}
$fleetArray = array(303 => 10, 306 => 100);
break;
default:
$this->sendData('rouge', $LNG['fleet_ajax_22']);
break;
}
$fleetArray = array_filter($fleetArray);
if (empty($fleetArray)) {
$this->sendData('rouge', $LNG['fleet_ajax_22']);
}
$iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $USER['id'] . "' AND `planet_type` = '1' AND `destruyed` = '0';");
$MaxPlanets = PlayerUtil::maxPlanetCount($USER);
if ($iPlanetCount >= $MaxPlanets && $targetMission == 7) {
$this->sendData('rouge', $LNG['fleet_ajax_14']);
}
$targetData = $GLOBALS['DATABASE']->getFirstRow("SELECT planet.id_owner as id_owner, \n\t\t\t\t\t\t\t\t\t\tplanet.id as id, \n\t\t\t\t\t\t\t\t\t\tplanet.name as name, \n\t\t\t\t\t\t\t\t\t\tplanet.galaxy as galaxy, \n\t\t\t\t\t\t\t\t\t\tplanet.system as system, \n\t\t\t\t\t\t\t\t\t\tplanet.planet as planet,\n\t\t\t\t\t\t\t\t\t\tplanet.planet_type as planet_type, \n\t\t\t\t\t\t\t\t\t\tplanet.force_field_timer as force_field_timer, \n\t\t\t\t\t\t\t\t\t\tplanet.teleport_portal as teleport_portal, \n\t\t\t\t\t\t\t\t\t\ttotal_points, onlinetime, forcefield_tech, urlaubs_modus, banaday, authattack, user_deleted, username\n\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " planet\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . USERS . " user ON planet.id_owner = user.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . STATPOINTS . " as stat ON stat.id_owner = user.id AND stat.stat_type = '1' \n\t\t\t\t\t\t\t\t\t\tWHERE planet.galaxy = " . $galaxyC . " AND planet.system = " . $systemC . " AND planet.planet = " . $planetC . ";");
$BuddyCheck = $GLOBALS['DATABASE']->query("SELECT * FROM uni1_buddy WHERE (sender = '" . $USER['id'] . "' AND owner = '" . $targetData['id_owner'] . "' AND state = '1') OR (owner = '" . $USER['id'] . "' AND sender = '" . $targetData['id_owner'] . "' AND state = '1');");
if ($targetMission == 1 || $targetMission == 6 || $targetMission == 3 || $targetMission == 14 || $targetMission == 13) {
$ipCheck = $GLOBALS['DATABASE']->query("SELECT userID, secondID FROM uni1_ipblock WHERE userID = " . $USER['id'] . " OR secondID = '" . $USER['id'] . "';");
if ($GLOBALS['DATABASE']->numRows($ipCheck) > 0) {
while ($xb = $GLOBALS['DATABASE']->fetch_array($ipCheck)) {
if ($targetData['id_owner'] == $xb['userID'] || $targetData['id_owner'] == $xb['secondID']) {
$this->sendData('rouge', '<span class=rouge>' . sprintf($LNG['fleet_multi_block'], $this->getUsername($targetData['id_owner'])) . '</span>');
}
}
}
if ($GLOBALS['DATABASE']->numRows($BuddyCheck) >= 1) {
$this->sendData('rouge', sprintf($LNG['fleet_pact'], $this->getUsername($targetData['id_owner'])));
}
}
if ($targetMission == 14) {
if ($targetData['id_owner'] == $USER['id']) {
$this->sendData('rouge', $LNG['fleet_ajax_19']);
}
if ($targetData['force_field_timer'] > TIMESTAMP && $USER['virus_tech'] < $targetData['forcefield_tech']) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_21'], $this->getUsername($targetData['id_owner'])));
}
if ($targetData['teleport_portal'] == 0) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_18'], $targetData['name'], $targetData['system'], $targetData['planet']));
}
if ($targetData['user_deleted'] == 1) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_3'], $targetData['username']));
}
if ($targetData['banaday'] > TIMESTAMP) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_4'], $targetData['username']));
}
if (Config::get('adm_attack') == 1 && $targetData['authattack'] > $USER['authlevel']) {
$this->sendData('rouge', $LNG['fa_action_not_allowed']);
}
if (IsVacationMode($targetData)) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_5'], $targetData['username']));
}
$IsNoobProtec = CheckNoobProtec($USER, $targetData, $targetData);
if ($IsNoobProtec['NoobPlayer']) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_6'], $targetData['username']));
}
if ($IsNoobProtec['StrongPlayer']) {
$this->sendData('rouge', sprintf($LNG['fleet_ajax_7'], $targetData['username']));
}
if ($USER['id'] == $targetData['id_owner']) {
$this->sendData('rouge', $LNG['fleet_ajax_8']);
}
//.........这里部分代码省略.........
示例4: TargetEvent
function TargetEvent()
{
$db = Database::get();
$sql = 'SELECT * FROM %%USERS%% WHERE `id` = :userId;';
$senderUser = $db->selectSingle($sql, array(':userId' => $this->_fleet['fleet_owner']));
$senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']);
$LNG = $this->getLanguage($senderUser['lang']);
$checkPosition = PlayerUtil::checkPosition($this->_fleet['fleet_universe'], $this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']);
$isPositionFree = PlayerUtil::isPositionFree($this->_fleet['fleet_universe'], $this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']);
if (!$isPositionFree || !$checkPosition) {
$message = sprintf($LNG['sys_colo_notfree'], GetTargetAddressLink($this->_fleet, ''));
} else {
$allowPlanetPosition = PlayerUtil::allowPlanetPosition($this->_fleet['fleet_end_planet'], $senderUser);
if (!$allowPlanetPosition) {
$message = sprintf($LNG['sys_colo_notech'], GetTargetAddressLink($this->_fleet, ''));
} else {
$sql = 'SELECT COUNT(*) as state
FROM %%PLANETS%%
WHERE `id_owner` = :userId
AND `planet_type` = :type
AND `destruyed` = :destroyed;';
$currentPlanetCount = $db->selectSingle($sql, array(':userId' => $this->_fleet['fleet_owner'], ':type' => 1, ':destroyed' => 0), 'state');
$maxPlanetCount = PlayerUtil::maxPlanetCount($senderUser);
if ($currentPlanetCount >= $maxPlanetCount) {
$message = sprintf($LNG['sys_colo_maxcolo'], GetTargetAddressLink($this->_fleet, ''), $maxPlanetCount);
} else {
$NewOwnerPlanet = PlayerUtil::createPlanet($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_universe'], $this->_fleet['fleet_owner'], $LNG['fcp_colony'], false, $senderUser['authlevel']);
if ($NewOwnerPlanet === false) {
$message = sprintf($LNG['sys_colo_badpos'], GetTargetAddressLink($this->_fleet, ''));
$this->setState(FLEET_RETURN);
} else {
$this->_fleet['fleet_end_id'] = $NewOwnerPlanet;
$message = sprintf($LNG['sys_colo_allisok'], GetTargetAddressLink($this->_fleet, ''));
$this->StoreGoodsToPlanet();
if ($this->_fleet['fleet_amount'] == 1) {
$this->KillFleet();
} else {
$CurrentFleet = explode(";", $this->_fleet['fleet_array']);
$NewFleet = '';
foreach ($CurrentFleet as $Group) {
if (empty($Group)) {
continue;
}
$Class = explode(",", $Group);
if ($Class[0] == 208 && $Class[1] > 1) {
$NewFleet .= $Class[0] . "," . ($Class[1] - 1) . ";";
} elseif ($Class[0] != 208 && $Class[1] > 0) {
$NewFleet .= $Class[0] . "," . $Class[1] . ";";
}
}
$this->UpdateFleet('fleet_array', $NewFleet);
$this->UpdateFleet('fleet_amount', $this->_fleet['fleet_amount'] - 1);
$this->UpdateFleet('fleet_resource_metal', 0);
$this->UpdateFleet('fleet_resource_crystal', 0);
$this->UpdateFleet('fleet_resource_deuterium', 0);
}
}
}
}
}
PlayerUtil::sendMessage($this->_fleet['fleet_owner'], 0, $LNG['sys_colo_mess_from'], 4, $LNG['sys_colo_mess_report'], $message, $this->_fleet['fleet_start_time'], NULL, 1, $this->_fleet['fleet_universe']);
$this->setState(FLEET_RETURN);
$this->SaveFleet();
}
示例5: TargetEvent
function TargetEvent()
{
global $resource;
$iPlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id_owner` = '" . $this->_fleet['fleet_owner'] . "' AND `planet_type` = '1' AND `destruyed` = '0';");
$iGalaxyPlace = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_end_id'] . "';");
$senderUser = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . USERS . " WHERE `id` = '" . $this->_fleet['fleet_owner'] . "';");
$senderPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT * FROM " . PLANETS . " WHERE `id` = '" . $this->_fleet['fleet_start_id'] . "';");
$senderUser['factor'] = getFactors($senderUser, 'basic', $this->_fleet['fleet_start_time']);
$LNG = $this->getLanguage($senderUser['lang']);
$MaxPlanets = PlayerUtil::maxPlanetCount($senderUser);
if ($iGalaxyPlace != 0) {
$TheMessage = '<div style="text-align : justify;">
' . sprintf($LNG['ls_fts_colo_1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $LNG['type_missionbis'][$this->_fleet['fleet_mission']]) . '
</div>
<div class="citation">
<div class="guillemet ouvrir">«</div>
<div class="guillemet fermer">»</div>
' . $LNG['ls_fts_colo_2'] . ' :
<ul style="text-align : left;">
<li>' . $LNG['ls_fts_colo_3'] . '</li>
<li>' . $LNG['ls_fts_colo_4'] . '</li>
<li>' . $LNG['ls_fts_colo_5'] . '</li>
<li>' . $LNG['ls_fts_colo_6'] . '</li>
<li>' . $LNG['ls_fts_colo_7'] . '</li>
<li>' . $LNG['ls_fts_colo_8'] . '</li>
</ul>
</div>
<div class="explication_utilisateur">
' . $LNG['ls_fts_colo_9'] . '
</div>';
SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 7, $LNG['sys_colo_mess_from_text1'], sprintf($LNG['sys_colo_mess_report1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']), $TheMessage);
$this->setState(FLEET_RETURN);
} elseif ($iPlanetCount >= $MaxPlanets) {
$TheMessage = '<div style="text-align : justify;">
' . sprintf($LNG['ls_fts_colo_1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $LNG['type_missionbis'][$this->_fleet['fleet_mission']]) . '
</div>
<div class="citation">
<div class="guillemet ouvrir">«</div>
<div class="guillemet fermer">»</div>
' . $LNG['ls_fts_colo_2'] . ' :
<ul style="text-align : left;">
<li>' . $LNG['ls_fts_colo_3'] . '</li>
<li>' . $LNG['ls_fts_colo_4'] . '</li>
<li>' . $LNG['ls_fts_colo_5'] . '</li>
<li>' . $LNG['ls_fts_colo_6'] . '</li>
<li>' . $LNG['ls_fts_colo_7'] . '</li>
<li>' . $LNG['ls_fts_colo_8'] . '</li>
</ul>
</div>
<div class="explication_utilisateur">
' . $LNG['ls_fts_colo_9'] . '
</div>';
SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 7, $LNG['sys_colo_mess_from_text1'], sprintf($LNG['sys_colo_mess_report1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet']), $TheMessage);
$this->setState(FLEET_RETURN);
} else {
$bonus_iron = mt_rand(1, 40);
$bonus_gold = mt_rand(1, 40);
$bonus_crys = mt_rand(1, 40);
$bonus_elyr = mt_rand(1, 40);
$Color = 'vert';
$Color1 = 'vert';
$Color2 = 'vert';
$Color3 = 'vert';
$bonus_iron_perc = rand(1, 55);
$bonus_gold_perc = rand(1, 55);
$bonus_crys_perc = rand(1, 55);
$bonus_elyr_perc = rand(1, 55);
if ($bonus_iron_perc >= $bonus_iron) {
$bonus_iron *= -1;
$Color = 'rouge';
}
if ($bonus_gold_perc >= $bonus_gold) {
$bonus_gold *= -1;
$Color1 = 'rouge';
}
if ($bonus_crys_perc >= $bonus_crys) {
$bonus_crys *= -1;
$Color2 = 'rouge';
}
if ($bonus_elyr_perc >= $bonus_elyr) {
$bonus_elyr *= -1;
$Color3 = 'rouge';
}
require_once 'includes/functions/CreateOnePlanetRecord.php';
$NewOwnerPlanet = CreateOnePlanetRecord($this->_fleet['fleet_end_galaxy'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $this->_fleet['fleet_universe'], $this->_fleet['fleet_owner'], $LNG['fcp_colony'], false, $senderUser['authlevel'], $bonus_iron, $bonus_gold, $bonus_crys, $bonus_elyr, $iPlanetCount);
if ($NewOwnerPlanet === false) {
$TheMessage = '<div style="text-align : justify;">
' . sprintf($LNG['ls_fts_colo_1'], $this->_fleet['fleet_end_system'], $this->_fleet['fleet_end_planet'], $LNG['type_missionbis'][$this->_fleet['fleet_mission']]) . '
</div>
<div class="citation">
<div class="guillemet ouvrir">«</div>
<div class="guillemet fermer">»</div>
//.........这里部分代码省略.........