当前位置: 首页>>代码示例>>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;未经允许,请勿转载。