Beispiel #1
0
 public static function create(Dolumar_Underworld_Models_Mission $mission, Dolumar_Underworld_Models_Army $army)
 {
     $loc = $army->getLocation();
     $x = $loc->x();
     $y = $loc->y();
     $db = Neuron_DB_Database::getInstance();
     $id = $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tunderworld_armies\n\t\t\tSET\n\t\t\t\tua_x = {$x},\n\t\t\t\tua_y = {$y},\n\t\t\t\tua_movepoints = {$army->getMovepoints(false)},\n\t\t\t\tua_lastrefresh = FROM_UNIXTIME({$army->getLastRefresh()}),\n\t\t\t\tua_side = {$army->getSide()->getId()},\n\t\t\t\tum_id = {$mission->getId()}\n\t\t");
     $army->setId($id);
     return $army;
 }
Beispiel #2
0
 public function getHistoricalArmyData(Dolumar_Underworld_Models_Army $army)
 {
     $report = $this->getReport();
     $units = $report->getUnits();
     if ($this->getAttackerSide()->equals($army->getSide())) {
         // Attacker
         return $units['attacking'];
     } else {
         if ($this->getDefenderSide()->equals($army->getSide())) {
             // Defender
             return $units['defending'];
         }
     }
     return null;
 }
Beispiel #3
0
 public function onMove(Dolumar_Underworld_Models_Army $army, Neuron_GameServer_Map_Location $old, Neuron_GameServer_Map_Location $new)
 {
     if ($new instanceof Dolumar_Underworld_Map_Locations_Checkpoint) {
         $this->setCheckpointSide($new, $army->getSide());
     }
 }
Beispiel #4
0
 /**
  *	Check if another army is an ally
  */
 public function isAlly(Dolumar_Underworld_Models_Army $ally)
 {
     return $this->getSide()->equals($ally->getSide());
 }
Beispiel #5
0
 public static function addSpawnLog(Dolumar_Underworld_Models_Mission $mission, Neuron_GameServer_Player $player, Dolumar_Underworld_Models_Army $army, Neuron_GameServer_Map_Location $location, Dolumar_Players_Clan $clan)
 {
     $db = Neuron_DB_Database::getInstance();
     self::addClan($mission, $clan, $army->getSide());
     $missionId = self::getMissionId($mission);
     $armyId = self::getArmyId($mission, $army);
     $sql = "\n\t\t\tINSERT INTO\n\t\t\t\tunderworld_log_event\n\t\t\tSET\n\t\t\t\tul_m_id = '{$missionId}',\n\t\t\t\tplid = '{$player->getId()}',\n\t\t\t\tul_a_vid = '{$armyId}',\n\t\t\t\tul_e_action = 'SPAWN',\n\t\t\t\tul_e_x = '{$location->x()}',\n\t\t\t\tul_e_y = '{$location->y()}',\n\t\t\t\tul_e_date = NOW()\n\t\t";
     $db->query($sql);
 }