Ejemplo n.º 1
0
 /**
  * Index action.
  *
  * @return Bengine_Game_Controller_Friends
  */
 protected function indexAction()
 {
     Core::getLanguage()->load(array("Statistics", "Buddylist"));
     if ($this->isPost()) {
         if ($this->getParam("delete")) {
             $this->remove($this->getParam("remove", array()));
         }
         if ($this->getParam("accept")) {
             $this->acceptRequest($this->getParam("relid"));
         }
     }
     $bl = array();
     $select = array("b.relid", "b.friend1", "b.friend2", "b.accepted", "u1.username as user1", "u1.points as points1", "u1.last as lastlogin1", "u2.points as points2", "u2.username as user2", "u2.last as lastlogin2", "a1.tag as ally1", "a1.aid as allyid1", "a2.tag as ally2", "a2.aid as allyid2", "g1.galaxy as gala1", "g1.system as sys1", "g1.position as pos1", "g2.galaxy as gala2", "g2.system as sys2", "g2.position as pos2");
     $joins = "LEFT JOIN " . PREFIX . "user u1 ON (u1.userid = b.friend1)";
     $joins .= "LEFT JOIN " . PREFIX . "user u2 ON (u2.userid = b.friend2)";
     $joins .= "LEFT JOIN " . PREFIX . "galaxy g1 ON (g1.planetid = u1.hp)";
     $joins .= "LEFT JOIN " . PREFIX . "galaxy g2 ON (g2.planetid = u2.hp)";
     $joins .= "LEFT JOIN " . PREFIX . "user2ally u2a1 ON (u2a1.userid = b.friend1)";
     $joins .= "LEFT JOIN " . PREFIX . "user2ally u2a2 ON (u2a2.userid = b.friend2)";
     $joins .= "LEFT JOIN " . PREFIX . "alliance a1 ON (a1.aid = u2a1.aid)";
     $joins .= "LEFT JOIN " . PREFIX . "alliance a2 ON (a2.aid = u2a2.aid)";
     $result = Core::getQuery()->select("buddylist b", $select, $joins, Core::getDB()->quoteInto("b.friend1 = ? OR b.friend2 = ?", Core::getUser()->get("userid")), "u1.points DESC, u2.points DESC, u1.username ASC, u2.username ASC");
     foreach ($result->fetchAll() as $row) {
         Hook::event("ShowBuddyFirst", array(&$row));
         if ($row["friend1"] == Core::getUser()->get("userid")) {
             if ($row["lastlogin2"] > TIME - 900) {
                 $status = Image::getImage("on.gif", getTimeTerm(TIME - $row["lastlogin2"]));
             } else {
                 $status = Image::getImage("off.gif", getTimeTerm(TIME - $row["lastlogin2"]));
             }
             $username = Link::get("game/" . SID . "/MSG/Write/" . rawurlencode($row["user2"]), Image::getImage("pm.gif", Core::getLanguage()->getItem("WRITE_MESSAGE"))) . " " . Link::get("game/" . SID . "/Profile/Page/" . $row["friend2"], $row["user2"]);
             $points = $row["points2"];
             $position = getCoordLink($row["gala2"], $row["sys2"], $row["pos2"]);
             $ally = Link::get("game/" . SID . "/Alliance/Page/" . $row["allyid2"], $row["ally2"]);
         } else {
             if ($row["lastlogin1"] > TIME - 900) {
                 $status = Image::getImage("on.gif", getTimeTerm(TIME - $row["lastlogin1"]));
             } else {
                 $status = Image::getImage("off.gif", getTimeTerm(TIME - $row["lastlogin1"]));
             }
             $username = Link::get("game/" . SID . "/MSG/Write/" . rawurlencode($row["user1"]), Image::getImage("pm.gif", Core::getLanguage()->getItem("WRITE_MESSAGE"))) . " " . Link::get("game/" . SID . "/Profile/Page/" . $row["friend1"], $row["user1"]);
             $points = $row["points1"];
             $position = getCoordLink($row["gala1"], $row["sys1"], $row["pos1"]);
             $ally = Link::get("game/" . SID . "/Alliance/Page/" . $row["allyid1"], $row["ally1"]);
         }
         $bl[$row["relid"]]["f1"] = $row["friend1"];
         $bl[$row["relid"]]["f2"] = $row["friend2"];
         $bl[$row["relid"]]["relid"] = $row["relid"];
         $bl[$row["relid"]]["username"] = $username;
         $bl[$row["relid"]]["accepted"] = $row["accepted"];
         $bl[$row["relid"]]["points"] = fNumber($points);
         $bl[$row["relid"]]["status"] = $status;
         $bl[$row["relid"]]["position"] = $position;
         $bl[$row["relid"]]["ally"] = $ally;
         Hook::event("ShowBuddyLast", array($row, &$bl));
     }
     $result->closeCursor();
     Core::getTPL()->addLoop("buddylist", $bl);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Coordinates of the planet.
  *
  * @param boolean $link			Link or simple string
  * @param boolean $sidWildcard	Replace session with wildcard
  *
  * @return string	Coordinates
  */
 public function getCoords($link = true, $sidWildcard = false)
 {
     if ($link) {
         return getCoordLink($this->get("galaxy"), $this->get("system"), $this->get("position"), $sidWildcard);
     }
     return $this->get("galaxy") . ":" . $this->get("system") . ":" . $this->get("position");
 }
Ejemplo n.º 3
0
 /**
  * Coordinates of this planet.
  *
  * @param boolean $link			Link or simple string
  * @param boolean $sidWildcard	Replace session with wildcard
  *
  * @return string
  */
 public function getCoords($link = true, $sidWildcard = false)
 {
     if ($link) {
         return getCoordLink($this->getGalaxy(), $this->getSystem(), $this->getPosition(), $sidWildcard);
     }
     return $this->getGalaxy() . ":" . $this->getSystem() . ":" . $this->getPosition();
 }
Ejemplo n.º 4
0
 /**
  * Formats the message.
  *
  * @param Bengine_Game_Model_Message $message
  *
  * @return Bengine_Game_MessageFolder_User
  */
 protected function _format(Bengine_Game_Model_Message $message)
 {
     $sender = $message->get("sender");
     if (!empty($sender)) {
         $url = "game/" . SID . "/MSG/Write/" . rawurlencode($message->get("username")) . "/" . Link::urlEncode("RE: " . $message->get("subject"));
         $reply = Link::get($url, Image::getImage("pm.gif", Core::getLanguage()->getItem("REPLY")));
         $message->set("reply_link", $reply);
         $sender = $message->get("username") . " " . getCoordLink($message->get("galaxy"), $message->get("system"), $message->get("position"));
     } else {
         $sender = "System";
     }
     $message->set("sender", $sender);
     $this->replaceForeignSessionId($message);
     return $this;
 }
Ejemplo n.º 5
0
 /**
  * Formats the message.
  *
  * @param Bengine_Game_Model_Message $message
  *
  * @return Bengine_Game_MessageFolder_Combat
  */
 protected function _format(Bengine_Game_Model_Message $message)
 {
     if (!$message->get("sender")) {
         $message->set("sender", Core::getLanguage()->getItem("FLEET_COMMAND"));
     }
     $assault = Application::getModel("game/assault")->load((int) $message->get("message"));
     if ($assault->get("assaultid")) {
         if (!$assault->get("galaxy")) {
             $statement = Core::getQuery()->select("assaultparticipant ap", array("data"), "", Core::getDB()->quoteInto("ap.assaultid = ? && mode = 0", $assault->get("assaultid")));
             $data = $statement->fetchColumn();
             $tokens = explode(",", $data);
             foreach ($tokens as $token) {
                 $valuePairs = explode(":", $token);
                 if (trim($valuePairs[0]) == "galaxy") {
                     $assault->set("galaxy", (int) $valuePairs[1]);
                 } else {
                     if (trim($valuePairs[0]) == "system") {
                         $assault->set("system", (int) $valuePairs[1]);
                     } else {
                         if (trim($valuePairs[0]) == "position") {
                             $assault->set("position", (int) $valuePairs[1]);
                         } else {
                             if (trim($valuePairs[0]) == "username") {
                                 $assault->set("planetname", Core::getLang()->get(substr($valuePairs[1], 6, -7)));
                             }
                         }
                     }
                 }
             }
         }
         $subject = getCoordLink($assault->get("galaxy"), $assault->get("system"), $assault->get("position"));
         $subject .= " " . $assault->get("planetname");
         $message->set("subject", $subject);
         $url = BASE_URL . Core::getLang()->getOpt("langcode") . "/combat/report/" . $assault->get("assaultid") . "/" . $assault->get("key");
         $gentime = $assault->get("gentime") / 1000;
         $label = Core::getLanguage()->getItem("ASSAULT_REPORT") . " (A: " . fNumber($assault->get("lostunits_attacker")) . ", D: " . fNumber($assault->get("lostunits_defender")) . ") " . $gentime . "s";
         $message->set("message", "<div class=\"assault-report\" onclick=\"openWindow('" . $url . "');\">" . $label . "</div>");
     }
     return $this;
 }
Ejemplo n.º 6
0
 /**
  * Shows the candidates and their application.
  *
  * @return Bengine_Game_Controller_Alliance
  */
 protected function showCandidatesAction()
 {
     if ($this->isPost()) {
         $this->manageCadidates($this->getParam("receipt"), $this->getParam("refuse"), $this->getParam("users"));
     }
     if ($this->getRights(array("CAN_SEE_APPLICATIONS"))) {
         $apps = array();
         $result = Core::getQuery()->select("allyapplication a", array("a.userid", "a.date", "a.application ", "u.username", "u.points", "g.galaxy", "g.system", "g.position"), "LEFT JOIN " . PREFIX . "user u ON (u.userid = a.userid) LEFT JOIN " . PREFIX . "galaxy g ON (g.planetid = u.hp)", Core::getDB()->quoteInto("a.aid = ?", $this->aid), "u.username ASC, a.date ASC");
         foreach ($result->fetchAll() as $row) {
             $apps[$row["userid"]]["date"] = Date::timeToString(1, $row["date"]);
             $apps[$row["userid"]]["message"] = Link::get("game/" . SID . "/MSG/Write/" . $row["username"], Image::getImage("pm.gif", Core::getLanguage()->getItem("WRITE_MESSAGE")));
             $apps[$row["userid"]]["apptext"] = nl2br($row["application"]);
             $apps[$row["userid"]]["userid"] = $row["userid"];
             $apps[$row["userid"]]["username"] = $row["username"];
             $apps[$row["userid"]]["points"] = fNumber(floor($row["points"]));
             $apps[$row["userid"]]["position"] = getCoordLink($row["galaxy"], $row["system"], $row["position"]);
         }
         Core::getTPL()->assign("candidates", sprintf(Core::getLanguage()->getItem("CANDIDATES"), $result->rowCount()));
         $result->closeCursor();
         Hook::event("ShowAllianceCandidates", array(&$apps));
         Core::getTPL()->addLoop("applications", $apps);
     }
     return $this;
 }
Ejemplo n.º 7
0
 /**
  * Coordinates of this planet.
  *
  * @param boolean	Link or simple string
  *
  * @return string	Coordinates
  */
 public function getCoords($link = true)
 {
     if ($link) {
         return getCoordLink($this->data["galaxy"], $this->data["system"], $this->data["position"]);
     }
     return $this->data["galaxy"] . ":" . $this->data["system"] . ":" . $this->data["position"];
 }
Ejemplo n.º 8
0
 /**
  * Returns the destination's coordinates.
  *
  * @param boolean	As link [optional]
  * @param boolean	Session id wildcard [optional]
  *
  * @return string
  */
 public function getDestinationCoords($link = true, $sidWc = false)
 {
     $galaxy = $this->getGalaxy2();
     $system = $this->getSystem2();
     $position = $this->getPosition2();
     if (!$galaxy || !$system || !$position) {
         $galaxy = $this->getData("galaxy");
         $system = $this->getData("system");
         $position = $this->getData("position");
     }
     if ($link) {
         return getCoordLink($galaxy, $system, $position, $sidWc);
     }
     return $galaxy . ":" . $system . ":" . $position;
 }
Ejemplo n.º 9
0
 /**
  * Formats an user record.
  *
  * @param array $row	User data
  *
  * @return array		Formatted user data
  */
 protected function formatRow(array $row)
 {
     Hook::event("FormatUserListRowFirst", array(&$row, $this));
     if (empty($row["userid"])) {
         return $row;
     }
     // Quick buttons
     $row["message"] = Link::get("game/" . SID . "/MSG/Write/" . $row["username"], $this->pmPic);
     $row["buddyrequest"] = Link::get("game/" . SID . "/Friends/Add/" . $row["userid"], $this->buddyPic);
     $row["moderator"] = Link::get("game/" . SID . "/Moderator/Index/" . $row["userid"], $this->modPic);
     $row["level_link"] = Link::get("game/" . SID . "/Achievements/User/" . $row["userid"], $row["level"]);
     $userClass = "";
     $inactive = "";
     $ban = "";
     $umode = "";
     $status = "";
     // Newbie protection
     if ($this->newbieProtection && Core::getUser()->userid != $row["userid"]) {
         $isProtected = isNewbieProtected($this->points, $row["points"]);
         if ($isProtected == 1) {
             $status = " <span class=\"weak-player\">n</span> ";
             $userClass = "weak-player";
         } else {
             if ($isProtected == 2) {
                 $status = " <span style=\"strong-player\">s</span> ";
                 $userClass = "strong-player";
             }
         }
     }
     // User activity
     if ($row["useractivity"] <= TIME - Core::getConfig()->get("INACTIVE_USER_TIME_1")) {
         $inactive = " i ";
     }
     if ($row["useractivity"] <= TIME - Core::getConfig()->get("INACTIVE_USER_TIME_2")) {
         $inactive = " i I ";
     }
     // User banned?
     if ($row["to"] >= TIME) {
         $ban = " <span class=\"banned\">b</span> ";
         $userClass = "banned";
     }
     // Vacation mode
     if ($row["umode"]) {
         $umode = " <span class=\"vacation-mode\">v</span> ";
         $userClass = "vacation-mode";
     }
     $row["user_status"] = sprintf("%s%s%s", $inactive, $ban, $umode);
     $row["user_status_long"] = sprintf("%s%s%s%s", $inactive, $ban, $umode, $status);
     $title = !empty($row["usertitle"]) ? $row["usertitle"] : Core::getLang()->get("GO_TO_PROFILE");
     $row["alliance"] = "";
     if (!empty($row["aid"]) && !empty($row["tag"])) {
         $row["alliance"] = $this->formatAllyTag($row["tag"], $row["name"], $row["aid"]);
         if ($this->fetchRankByQuery) {
             $row["alliance_rank"] = $this->getAllianceRank($row["aid"], $this->pointType);
         }
     }
     if (isset($row["ismoon"]) && $row["ismoon"] && !empty($row["moongala"]) && !empty($row["moonsys"]) && !empty($row["moonpos"])) {
         $row["position"] = getCoordLink($row["moongala"], $row["moonsys"], $row["moonpos"]);
     } else {
         if (!empty($row["galaxy"]) && !empty($row["system"]) && !empty($row["position"])) {
             $row["position"] = getCoordLink($row["galaxy"], $row["system"], $row["position"]);
         }
     }
     // Points
     if ($this->fetchRankByQuery) {
         $row["rank"] = $this->getUserRank($row[$this->pointType], $row["username"], $this->pointType);
     } else {
         if (isset($row["rank"])) {
             $row["rank"] = fNumber($row["rank"]);
         }
     }
     if (isset($row["points"])) {
         $row["points"] = fNumber(floor($row[$this->pointType]));
     }
     if (isset($row["fpoints"])) {
         $row["fpoints"] = fNumber(floor($row["fpoints"]));
     }
     if (isset($row["dpoints"])) {
         $row["dpoints"] = fNumber(floor($row["dpoints"]));
     }
     if (isset($row["rpoints"])) {
         $row["rpoints"] = fNumber(floor($row["rpoints"]));
     }
     $row["username"] = Link::get("game/" . SID . "/Profile/Page/" . $row["userid"], $this->formatUsername($row["username"], $row["userid"], $row["aid"], $userClass), $title);
     Hook::event("FormatUserListRowLast", array(&$row, $this));
     return $row;
 }
Ejemplo n.º 10
0
 /**
  * Generates message if user was target of espionage.
  *
  * @return Bengine_Game_AutoMsg
  */
 protected function espionageBengine_Game_Committed()
 {
     $msg = Core::getLanguage()->getItem("ESPIOANGE_COMMITTED");
     /* @var Bengine_Game_Model_Event $event */
     $event = $this->data["event"];
     $coordss = getCoordLink($event->get("galaxy"), $event->get("system"), $event->get("position"), true);
     $coordinates = getCoordLink($event->get("galaxy2"), $event->get("system2"), $event->get("position2"), true);
     $espLost = $this->data["probes_lost"] ? Core::getLanguage()->getItem("ESP_PROBES_DESTROYED_1") : "";
     $msg = sprintf($msg, $this->data["suser"], $this->data["planetname"], $coordss, $this->data["destinationplanet"], $coordinates, $this->data["defending_chance"] . "&#37;", $espLost);
     Hook::event("AutoMsgEspionage", array($this, &$msg));
     $this->sendMsg(Core::getLanguage()->getItem("ESPIOANGE_COMMITTED_SUBJECT"), $msg);
     return $this;
 }
Ejemplo n.º 11
0
 /**
  * (non-PHPdoc)
  * @see app/code/Bengine/EventHandler/Handler/Bengine_Game_EventHandler_Handler_Abstract#_execute($event, $data)
  */
 protected function _execute(Bengine_Game_Model_Event $event, array $data)
 {
     Core::getLanguage()->load(array("info", "AutoMessages"));
     Hook::event("EhMissileAttackStart", array($event, &$data, $this));
     $attackingRockets = $data["rockets"];
     $primaryTarget = $data["primary_target"];
     $attack = $data["attack"];
     $def = array();
     $destroyed = array();
     // Load shelltech for defender
     $_result = Core::getQuery()->select("research2user", "level", "", Core::getDB()->quoteInto("userid = ? AND buildingid = '17'", $event["destination_user_id"]));
     $_row = $_result->fetchRow();
     $_result->closeCursor();
     $shell = (int) $_row["level"];
     // Load defending units
     $where = Core::getDB()->quoteInto("b.mode = '4' AND u2s.planetid = ?", $event["destination"]);
     $_result = Core::getQuery()->select("unit2shipyard u2s", array("u2s.unitid", "u2s.quantity", "b.name", "basic_metal", "basic_silicon", "basic_hydrogen"), "LEFT JOIN " . PREFIX . "construction b ON (b.buildingid = u2s.unitid)", $where, "b.display_order ASC, b.buildingid ASC");
     foreach ($_result->fetchAll() as $_row) {
         $def[$_row["unitid"]] = $_row;
         $def[$_row["unitid"]]["name"] = Core::getLanguage()->getItem($_row["name"]);
         $def[$_row["unitid"]]["shell"] = ($_row["basic_metal"] + $_row["basic_silicon"]) / 10;
         $def[$_row["unitid"]]["shell"] = floor($def[$_row["unitid"]]["shell"] * (1 + $shell / 10));
     }
     $_result->closeCursor();
     // Load guntech for attacker
     $_result = Core::getQuery()->select("research2user", "level", "", Core::getDB()->quoteInto("userid = ? AND buildingid = '15'", $event["userid"]));
     $_row = $_result->fetchRow();
     $_result->closeCursor();
     $gun = (int) $_row["level"];
     Hook::event("EhMissileAttackLoaded", array($event, &$_row, &$data, &$def, &$attack, &$shell, &$gun, &$primaryTarget));
     if (!array_key_exists($primaryTarget, $def)) {
         $primaryTarget = 0;
     }
     // Start attack
     $pointsLost = 0;
     if (count($def) > 0) {
         if (isset($def[51])) {
             $attackingRockets -= $def[51]["quantity"];
             $destroyed[51] = $attackingRockets > 0 ? $def[51]["quantity"] : $data["rockets"];
             $pointsLost += $destroyed[51] * $def[51]["basic_metal"];
             $pointsLost += $destroyed[51] * $def[51]["basic_silicon"];
             $pointsLost += $destroyed[51] * $def[51]["basic_hydrogen"];
             if ($def[51]["quantity"] - $destroyed[51] <= 0) {
                 Core::getQuery()->delete("unit2shipyard", "unitid = ? AND planetid = ?", null, null, array(51, $event["destination"]));
             } else {
                 Core::getDB()->query("UPDATE " . PREFIX . "unit2shipyard SET quantity = quantity - ? WHERE unitid = ? AND planetid = ?", array($destroyed[51], 51, $event["destination"]));
             }
         }
         if ($attackingRockets > 0) {
             $damage = floor($attackingRockets * ($attack * (1 + $gun / 10)));
             if ($primaryTarget > 0) {
                 if (!isset($destroyed[$primaryTarget])) {
                     $destroyed[$primaryTarget] = 0;
                 }
                 if ($damage > $def[$primaryTarget]["shell"] * $def[$primaryTarget]["quantity"]) {
                     $destroyed[$primaryTarget] += $def[$primaryTarget]["quantity"];
                     $damage -= $def[$primaryTarget]["shell"] * $destroyed[$primaryTarget];
                 } else {
                     $destroyed[$primaryTarget] += floor($damage / $def[$primaryTarget]["shell"]);
                     $damage -= $destroyed[$primaryTarget] * $def[$primaryTarget]["shell"];
                 }
                 if ($def[$primaryTarget]["quantity"] - $destroyed[$primaryTarget] <= 0) {
                     Core::getQuery()->delete("unit2shipyard", "unitid = ? AND planetid = ?", null, null, array($primaryTarget, $event["destination"]));
                 } else {
                     Core::getDB()->query("UPDATE " . PREFIX . "unit2shipyard SET quantity = quantity - ? WHERE unitid = ? AND planetid = ?", array($destroyed[$primaryTarget], $primaryTarget, $event["destination"]));
                 }
                 $pointsLost += $destroyed[$primaryTarget] * $def[$primaryTarget]["basic_metal"];
                 $pointsLost += $destroyed[$primaryTarget] * $def[$primaryTarget]["basic_silicon"];
                 $pointsLost += $destroyed[$primaryTarget] * $def[$primaryTarget]["basic_hydrogen"];
             }
             foreach ($def as $key => $value) {
                 if (!isset($destroyed[$key])) {
                     $destroyed[$key] = 0;
                 }
                 if ($key == 51 || $key == $primaryTarget || $key == 52) {
                     continue;
                 }
                 if ($damage > $value["shell"] * $value["quantity"]) {
                     $destroyed[$key] += $value["quantity"];
                     $damage -= $value["shell"] * $destroyed[$key];
                 } else {
                     $destroyed[$key] += floor($damage / $value["shell"]);
                     $damage -= $destroyed[$key] * $value["shell"];
                 }
                 if ($value["quantity"] - $destroyed[$key] <= 0) {
                     Core::getQuery()->delete("unit2shipyard", "unitid = ? AND planetid = ?", null, null, array($key, $event["destination"]));
                 } else {
                     Core::getDB()->query("UPDATE " . PREFIX . "unit2shipyard SET quantity = quantity - ? WHERE unitid = ? AND planetid = ?", array($destroyed[$key], $key, $event["destination"]));
                 }
                 $pointsLost += $destroyed[$key] * $value["basic_metal"];
                 $pointsLost += $destroyed[$key] * $value["basic_silicon"];
                 $pointsLost += $destroyed[$key] * $value["basic_hydrogen"];
             }
         }
     }
     // Generate report
     Hook::event("EhMissileAttackGenerateReport", array($event, &$_row, &$data, &$pointsLost, &$destroyed, &$def));
     Core::getLanguage()->assign("planet", $data["planetname"]);
     Core::getLanguage()->assign("coords", getCoordLink($data["galaxy"], $data["system"], $data["position"], true));
     $report = "<table class=\"ntable\" style=\"width: 400px;\">";
     $report .= "<tr><th colspan=\"4\">" . Core::getLanguage()->getItem("ROCKET_ATTACK_REPORT_HEADLINE") . "</th></tr>";
     $i = 0;
     foreach ($def as $key => $_def) {
         if ($i % 2 == 0) {
             $report .= "<tr>";
         }
         if (!isset($destroyed[$key])) {
             $destroyed[$key] = 0;
         }
         $quantity = $_def["quantity"] - $destroyed[$key];
         $dest = $destroyed[$key] > 0 ? " (-" . $destroyed[$key] . ")" : "";
         $report .= "<td>" . $_def["name"] . "</td><td>" . $quantity . $dest . "</td>";
         if (count($_def) == $i + 1 && $i % 2 == 0) {
             $report .= "<td></td><td></td></tr>";
         }
         if ($i % 2 == 1) {
             $report .= "</tr>";
         }
         $i++;
     }
     $report .= "</table>";
     Core::getLanguage()->assign("rockets", $data["rockets"]);
     Core::getLanguage()->assign("attacker", $event["username"]);
     Core::getLanguage()->assign("defender", $event["destination_username"]);
     Core::getLanguage()->assign("lostunits", fNumber($pointsLost));
     // Send report
     $message = Core::getLanguage()->getItem("ROCKET_ATTACK_MSG_ATTACKER") . $report;
     Hook::event("EhMissileAttackReportGeneratedAttacker", array($event, &$_row, &$data, &$message));
     Core::getQuery()->insert("message", array("mode" => 3, "time" => TIME, "sender" => null, "receiver" => $event["userid"], "message" => $message, "subject" => Core::getLanguage()->getItem("ROCKET_ATTACK_SUBJECT"), "read" => 0));
     $message = Core::getLanguage()->getItem("ROCKET_ATTACK_MSG_DEFENDER") . $report;
     Hook::event("EhMissileAttactReportGeneratedDefender", array($event, &$_row, &$data, &$message));
     Core::getQuery()->insert("message", array("mode" => 3, "time" => TIME, "sender" => null, "receiver" => $event["destination_user_id"], "message" => $message, "subject" => Core::getLanguage()->getItem("ROCKET_ATTACK_SUBJECT"), "read" => 0));
     // Update points for defender
     $pointsLost /= 1000;
     Core::getDB()->query("UPDATE " . PREFIX . "user SET points = points - ? WHERE userid = ?", array($pointsLost, $event["destination_user_id"]));
     // Update points for attacker
     $points = $data["rockets"] * $data["basic_metal"] + $data["rockets"] * $data["basic_silicon"] + $data["rockets"] * $data["basic_hydrogen"];
     $points /= 1000;
     Core::getDB()->query("UPDATE " . PREFIX . "user SET points = points - ?, dpoints = dpoints - ? WHERE userid = ?", array($points, array_sum($destroyed), $event["userid"]));
     return $this;
 }