當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Game::attackingStoppageEnabled方法代碼示例

本文整理匯總了PHP中Game::attackingStoppageEnabled方法的典型用法代碼示例。如果您正苦於以下問題:PHP Game::attackingStoppageEnabled方法的具體用法?PHP Game::attackingStoppageEnabled怎麽用?PHP Game::attackingStoppageEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Game的用法示例。


在下文中一共展示了Game::attackingStoppageEnabled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _isValid

 /**
  * Checks the event for validation.
  *
  * @return boolean
  */
 protected function _isValid()
 {
     if (!empty($this->_target["planetid"]) && !$this->isNewbieProtected() && $this->_target["userid"] != Core::getUser()->get("userid") && $this->_targetType != "tf" && $this->_checkProbes() && !$this->_target["umode"] && !Game::attackingStoppageEnabled()) {
         return true;
     }
     return false;
 }
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:12,代碼來源:Espionage.php

示例2: _isValid

 /**
  * Checks the event for validation.
  *
  * @return boolean
  */
 protected function _isValid()
 {
     $formations = $this->getSpecialData();
     if (!empty($this->_target["userid"]) && $this->_target["userid"] != Core::getUser()->get("userid") && $this->_targetType != "tf" && !$this->_target["umode"] && !$this->isNewbieProtected() && !Game::attackingStoppageEnabled() && is_array($formations)) {
         return true;
     }
     return false;
 }
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:13,代碼來源:AlliedFleet.php

示例3: espionageAction

 /**
  * Sends espionage probes.
  *
  * @param int $target
  * @return Bengine_Game_Controller_Ajax_Fleet
  */
 protected function espionageAction($target)
 {
     if (Game::attackingStoppageEnabled()) {
         $this->display($this->format(Core::getLang()->get("ATTACKING_STOPPAGE_ENABLED")));
     }
     $select = array("p.planetid", "g.galaxy", "g.system", "g.position", "u2s.quantity", "sd.capicity", "sd.speed", "sd.consume", "b.name AS shipname");
     $joins = "LEFT JOIN " . PREFIX . "galaxy g ON (g.planetid = p.planetid)";
     $joins .= "LEFT JOIN " . PREFIX . "unit2shipyard u2s ON (u2s.planetid = p.planetid)";
     $joins .= "LEFT JOIN " . PREFIX . "ship_datasheet sd ON (sd.unitid = u2s.unitid)";
     $joins .= "LEFT JOIN " . PREFIX . "construction b ON (b.buildingid = u2s.unitid)";
     $result = Core::getQuery()->select("planet p", $select, $joins, Core::getDB()->quoteInto("p.planetid = ? AND u2s.unitid = '38'", Core::getUser()->get("curplanet")));
     if ($row = $result->fetchRow()) {
         $result->closeCursor();
         $joins = "LEFT JOIN " . PREFIX . "planet p ON (g.planetid = p.planetid)";
         $joins .= "LEFT JOIN " . PREFIX . "user u ON (u.userid = p.userid)";
         $joins .= "LEFT JOIN " . PREFIX . "ban_u b ON (u.userid = b.userid)";
         $where = Core::getDB()->quoteInto("g.planetid = ? OR g.moonid = ?", $target);
         $result = Core::getQuery()->select("galaxy g", array("g.galaxy", "g.system", "g.position", "u.points", "u.last", "u.umode", "b.to"), $joins, $where);
         if ($tar = $result->fetchRow()) {
             $result->closeCursor();
             Hook::event("AjaxSendFleetEspionage", array($this, &$row, &$tar));
             $ignoreNP = false;
             if ($tar["last"] <= TIME - 604800) {
                 $ignoreNP = true;
             } else {
                 if ($tar["to"] >= TIME) {
                     $ignoreNP = true;
                 }
             }
             $data = array();
             // Check for newbie protection
             if ($ignoreNP === false) {
                 $isProtected = isNewbieProtected(Core::getUser()->get("points"), $tar["points"]);
                 if ($isProtected == 1) {
                     $this->display($this->format(Core::getLanguage()->getItem("TARGET_TOO_WEAK")));
                 } else {
                     if ($isProtected == 2) {
                         $this->display($this->format(Core::getLanguage()->getItem("TARGET_TOO_STRONG")));
                     }
                 }
             }
             // Check for vacation mode
             if ($tar["umode"] || Core::getUser()->get("umode")) {
                 $this->display($this->format(Core::getLanguage()->getItem("TARGET_IN_UMODE")));
             }
             // Get quantity
             if ($row["quantity"] >= Core::getUser()->get("esps")) {
                 $data["ships"][38]["quantity"] = Core::getUser()->get("esps") > 0 ? Core::getUser()->get("esps") : 1;
             } else {
                 $data["ships"][38]["quantity"] = $row["quantity"];
             }
             $data["ships"][38]["id"] = 38;
             $data["ships"][38]["name"] = $row["shipname"];
             $data["maxspeed"] = Game::getSpeed(38, $row["speed"]);
             $distance = Game::getDistance($tar["galaxy"], $tar["system"], $tar["position"]);
             $time = Game::getFlyTime($distance, $data["maxspeed"]);
             $data["consumption"] = Game::getFlyConsumption($data["ships"][38]["quantity"] * $row["consume"], $distance);
             if (Game::getPlanet()->getData("hydrogen") < $data["consumption"]) {
                 $this->display($this->format(Core::getLanguage()->getItem("DEFICIENT_CONSUMPTION")));
             }
             if ($row["capicity"] * $data["ships"][38]["quantity"] - $data["consumption"] < 0) {
                 $this->display($this->format(Core::getLanguage()->getItem("DEFICIENT_CAPACITY")));
             }
             Game::getPlanet()->setData("hydrogen", Game::getPlanet()->getData("hydrogen") - $data["consumption"]);
             $data["time"] = $time;
             $data["galaxy"] = $tar["galaxy"];
             $data["system"] = $tar["system"];
             $data["position"] = $tar["position"];
             $data["sgalaxy"] = $row["galaxy"];
             $data["ssystem"] = $row["system"];
             $data["sposition"] = $row["position"];
             $data["metal"] = 0;
             $data["silicon"] = 0;
             $data["hydrogen"] = 0;
             Hook::event("AjaxSendFleetEspionageStartEvent", array($row, $tar, &$data));
             Game::getEH()->addEvent(11, $time + TIME, Core::getUser()->get("curplanet"), Core::getUser()->get("userid"), $target, $data);
             $this->display($this->format(sprintf(Core::getLanguage()->getItem("ESPS_SENT"), $data["ships"][38]["quantity"], $data["galaxy"], $data["system"], $data["position"]), 1));
         } else {
             $result->closeCursor();
             $this->display($this->format("Unkown destination"));
         }
     } else {
         $result->closeCursor();
         $this->display($this->format(Core::getLanguage()->getItem("DEFICIENT_ESPS")));
     }
     return $this;
 }
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:93,代碼來源:Fleet.php

示例4: _isValid

 /**
  * Checks the event for validation.
  *
  * @return boolean
  */
 protected function _isValid()
 {
     if (!empty($this->_target["userid"]) && $this->_target["userid"] != Core::getUser()->get("userid") && $this->_targetType == "moon" && !$this->_target["umode"] && !empty($this->_ships[self::DEATH_STAR_CONSTRUCTION_ID]) && !$this->isNewbieProtected() && !Game::attackingStoppageEnabled()) {
         return true;
     }
     return false;
 }
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:12,代碼來源:MoonDestruction.php

示例5: _add

 /**
  * (non-PHPdoc)
  * @see app/code/Bengine/EventHandler/Handler/Bengine_Game_EventHandler_Handler_Abstract#_add($event, $data)
  */
 protected function _add(Bengine_Game_Model_Event $event, array $data)
 {
     if (Game::attackingStoppageEnabled()) {
         throw new Recipe_Exception_Generic("Attacking stoppage enabled.");
     }
     Core::getDB()->query("UPDATE " . PREFIX . "unit2shipyard SET quantity = quantity - ? WHERE unitid = ? AND planetid = ?", array($data["rockets"], 52, $event->getPlanetid()));
     Core::getQuery()->delete("unit2shipyard", "quantity = '0'");
     return $this;
 }
開發者ID:enriquesomolinos,項目名稱:Bengine,代碼行數:13,代碼來源:MissileAttack.php


注:本文中的Game::attackingStoppageEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。