Beispiel #1
0
 /**
  * @return string
  */
 public function NewTradeTokenEvent()
 {
     /* This event causes a random tradegood_token to appear in a mapzone where
        there are currently fewer than three tradegoods. Note that this event will
        fail sometimes because it drew a mapzone with three tokens already present. */
     $mz = $this->map->getRandomPassableMapZone();
     $tradegood = $this->trade->searchZoneForTradegoodTokens($mz);
     if (count($tradegood) <= 2) {
         $tg = $this->trade->getARandomTradegoodPlatonic();
         $this->trade->insertANewTradegoodToken($mz, $tg);
         $this->news->createSomeNews(ucwords($tg->getNamed()) . ' will now be produced in ' . $mz->getX() . ', ' . $mz->getY() . '', $mz->getX(), $mz->getY());
         return ucwords($tg->getNamed()) . ' will now be produced in ' . $mz->getX() . ', ' . $mz->getY();
     }
 }
Beispiel #2
0
 /**
  * INSERT INTO game.clan
  *
  * Must have a valid tribeId to create a clan
  *
  * @param $tribeId
  */
 private function createClan($tribeId)
 {
     $depotId = $this->createDepot();
     $query = "SELECT named FROM tribe WHERE id=" . $tribeId . ";";
     $this->db->setQuery($query);
     $this->db->query();
     $tribeName = $this->db->loadResult();
     $MapService = new MapService();
     $MapService->setDb($this->db);
     $mz = $MapService->getRandomPassableMapZone();
     $x = $mz->getX();
     $y = $mz->getY();
     $query = "INSERT INTO clan(named, tribe, x, y, depot, population, fighters, morale, food, coin, activity) VALUES('" . $tribeName . "', " . $tribeId . ", " . $x . ', ' . $y . ', ' . $depotId . ", 100, 60, 100, 35, 0, 'wandering');";
     $this->db->setQuery($query);
     $this->db->query();
 }