public static function set(Neuron_GameServer_Player $player, $key, $value)
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tn_players_registry\n\t\t\tWHERE\n\t\t\t\tplid = {$player->getId()} AND \n\t\t\t\tpr_name = '{$db->escape($key)}'\n\t\t");
     if (count($data) == 0) {
         $db->query("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tn_players_registry\n\t\t\t\tSET\n\t\t\t\t\tplid = {$player->getId()},\n\t\t\t\t\tpr_name = '{$db->escape($key)}',\n\t\t\t\t\tpr_value = '{$db->escape($value)}'\n\t\t\t");
     } else {
         $db->query("\n\t\t\t\tUPDATE\n\t\t\t\t\tn_players_registry\n\t\t\t\tSET\n\t\t\t\t\tpr_value = '{$db->escape($value)}'\n\t\t\t\tWHERE\n\t\t\t\t\tplid = {$player->getId()} AND\n\t\t\t\t\tpr_name = '{$db->escape($key)}'\n\t\t\t\t\t\n\t\t\t");
     }
 }
예제 #2
0
 public function __construct($sTable)
 {
     $this->sTable = $sTable;
     $db = Neuron_DB_Database::getInstance();
     $this->dbObj = $db->getConnection();
     //$this->dbObj = new Mysqli (DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     $this->objMemcache = Neuron_Core_Memcache::getInstance();
     $server = Neuron_GameServer::getServer();
     $this->iServer = $server->getServerId();
 }
예제 #3
0
 public static function getTimeSinceLastCheckpointSide(Dolumar_Underworld_Models_Mission $mission, Neuron_GameServer_Map_Location $location)
 {
     $db = Neuron_DB_Database::getInstance();
     $time = $db->query("\n\t\t\tSELECT\n\t\t\t\tUNIX_TIMESTAMP(uc_date) AS datum\n\t\t\tFROM\n\t\t\t\tunderworld_checkpoints\n\t\t\tWHERE\n\t\t\t\tum_id = {$mission->getId()} AND\n\t\t\t\tuc_x = {$location->x()} AND\n\t\t\t\tuc_y = {$location->y()}\n\t\t");
     if (count($time) > 0) {
         return NOW - $time[0]['datum'];
     } else {
         return 0;
     }
 }
예제 #4
0
 private function getAllImages()
 {
     $page = new Neuron_Core_Template();
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tplayers_tiles\n\t\t\tORDER BY\n\t\t\t\tt_id DESC\n\t\t");
     foreach ($data as $v) {
         $page->addListValue('tiles', array('src' => PUBLIC_URL . $v['t_imagename']));
     }
     return $page->parse('pages/customsign/list.phpt');
 }
예제 #5
0
 private static function getAllQuests()
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tn_quests\n\t\t");
     $out = array();
     foreach ($data as $v) {
         $out[$v['q_id']] = $v['q_class'];
     }
     return $out;
 }
예제 #6
0
 public function addModeratorAction($sAction, $mParams, $reason, Neuron_GameServer_Player $player, $isDone = false)
 {
     $db = Neuron_DB_Database::getInstance();
     $login = Neuron_Core_Login::getInstance();
     $userid = intval($login->getUserId());
     $isDone = $isDone ? true : false;
     $processed = $isDone ? 1 : 0;
     $executed = $isDone ? 1 : 0;
     $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tn_mod_actions\n\t\t\tSET\n\t\t\t\tma_action = '" . $db->escape($sAction) . "',\n\t\t\t\tma_data = '" . $db->escape(json_encode($mParams)) . "',\n\t\t\t\tma_plid = {$userid},\n\t\t\t\tma_date = NOW(),\n\t\t\t\tma_reason = '" . $db->escape($reason) . "',\n\t\t\t\tma_target = '{$player->getId()}',\n\t\t\t\tma_processed = {$processed},\n\t\t\t\tma_executed = {$executed}\n\t\t");
 }
예제 #7
0
 public function ban($sChannel = 'chat', $duration = 3600, $ban = true)
 {
     $db = Neuron_DB_Database::getInstance();
     $db->query("\n\t\t\tDELETE FROM\n\t\t\t\tn_players_banned\n\t\t\tWHERE\n\t\t\t\tplid = {$this->objProfile->getId()} AND\n\t\t\t\tbp_channel = '{$db->escape($sChannel)}'\n\t\t");
     $this->bans = null;
     // First unban
     if ($ban) {
         $db->query("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tn_players_banned\n\t\t\t\tSET\n\t\t\t\t\tplid = {$this->objProfile->getId()},\n\t\t\t\t\tbp_channel = '{$db->escape($sChannel)}',\n\t\t\t\t\tbp_end = FROM_UNIXTIME(" . (time() + $duration) . ")\n\t\t\t");
     }
 }
예제 #8
0
 public function evaluate()
 {
     $db = Neuron_DB_Database::getInstance();
     foreach ($this->getPendingQuests() as $v) {
         if ($v->isFinished($this->objProfile)) {
             $v->onComplete($this->objProfile);
             $db->query("\n\t\t\t\t\tUPDATE\n\t\t\t\t\t\tn_players_quests\n\t\t\t\t\tSET\n\t\t\t\t\t\tq_finished = '1'\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tq_id = {$v->getId()} AND\n\t\t\t\t\t\tplid = {$this->objProfile->getId()}\n\t\t\t\t");
         }
     }
 }
 public function setPreference($sKey, $sValue)
 {
     $db = Neuron_DB_Database::getInstance();
     // Check if exist
     $check = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tn_players_preferences\n\t\t\tWHERE\n\t\t\t\tp_key = '{$db->escape($sKey)}'\n\t\t\t\tAND p_plid = {$this->objProfile->getId()}\n\t\t");
     if (count($check) == 0) {
         $db->query("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tn_players_preferences\n\t\t\t\tSET\n\t\t\t\t\tp_key = '{$db->escape($sKey)}',\n\t\t\t\t\tp_value = '{$db->escape($sValue)}',\n\t\t\t\t\tp_plid = {$this->objProfile->getId()}\n\t\t\t");
     } else {
         $db->query("\n\t\t\t\tUPDATE\n\t\t\t\t\tn_players_preferences\n\t\t\t\tSET\n\t\t\t\t\tp_value = '{$db->escape($sValue)}'\n\t\t\t\tWHERE\n\t\t\t\t\tp_key = '{$db->escape($sKey)}' AND\n\t\t\t\t\tp_plid = {$this->objProfile->getId()}\n\t\t\t");
     }
 }
예제 #10
0
파일: Visits.php 프로젝트: Toxicat/dolumar
 public function registerVisit($village)
 {
     $db = Neuron_DB_Database::getInstance();
     // Check if exists
     $chk = $db->query("\n\t\t\tSELECT\n\t\t\t\tvi_id\n\t\t\tFROM\n\t\t\t\tvillages_visits\n\t\t\tWHERE\n\t\t\t\tv_id = {$this->objProfile->getId()} AND \n\t\t\t\tvi_v_id = {$village->getId()} \n\t\t");
     if (count($chk) > 0) {
         $db->query("\n\t\t\t\tUPDATE\n\t\t\t\t\tvillages_visits\n\t\t\t\tSET\n\t\t\t\t\tvi_date = NOW()\n\t\t\t\tWHERE\n\t\t\t\t\tv_id = {$this->objProfile->getId()} AND \n\t\t\t\t\tvi_v_id = {$village->getId()} \n\t\t\t");
     } else {
         $db->query("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tvillages_visits\n\t\t\t\tSET\n\t\t\t\t\tvi_date = NOW(),\n\t\t\t\t\tv_id = {$this->objProfile->getId()},\n\t\t\t\t\tvi_v_id = {$village->getId()}\n\t\t\t");
     }
 }
예제 #11
0
 public static function getObject($id)
 {
     $db = Neuron_DB_Database::getInstance();
     $id = intval($id);
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\tai_class,\n\t\t\t\tai_identifier\n\t\t\tFROM\n\t\t\t\tn_id\n\t\t\tWHERE\n\t\t\t\tai_id = {$id}\n\t\t");
     if (count($data) > 0) {
         $class = Andromeda_Mappers_ClassMapper::getClass($data[0]['ai_class']);
         return $class::getFromIdentifiableString($data[0]['ai_identifier']);
     } else {
         throw new Exception("Object not found in IDMapper.");
     }
 }
예제 #12
0
 public function setSocialStatus(Neuron_GameServer_Player $player, $status)
 {
     $db = Neuron_DB_Database::getInstance();
     $status = intval($status);
     // Check if already in here.
     $chk = $db->query("\n\t\t\tSELECT\n\t\t\t\tps_status\n\t\t\tFROM\n\t\t\t\tn_players_social\n\t\t\tWHERE\n\t\t\t\tps_plid = {$this->getId()} \n\t\t\t\tAND ps_targetid = {$player->getId()}\n\t\t");
     if (count($chk) == 0) {
         $db->query("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tn_players_social\n\t\t\t\tSET\n\t\t\t\t\tps_plid = {$this->getId()},\n\t\t\t\t\tps_targetid = {$player->getId()},\n\t\t\t\t\tps_status = '{$status}'\n\t\t\t");
     } else {
         $db->query("\n\t\t\t\tUPDATE\n\t\t\t\t\tn_players_social\n\t\t\t\tSET\n\t\t\t\t\tps_status = '{$status}'\n\t\t\t\tWHERE\n\t\t\t\t\tps_targetid = {$player->getId()} AND\n\t\t\t\t\tps_plid = {$this->getId()}\n\t\t\t");
     }
 }
예제 #13
0
 private function processAction($id, $bExecute)
 {
     $id = intval($id);
     $bExecute = $bExecute ? true : false;
     $db = Neuron_DB_Database::getInstance();
     if ($bExecute) {
         $input = $db->query("\n\t\t\t\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\tn_mod_actions\n\t\t\t\tWHERE\n\t\t\t\t\tma_id = {$id}\n\t\t\t");
         if (count($input) == 1) {
             $this->executeAction($input[0]);
         }
     }
     $db->query("\n\t\t\tUPDATE\n\t\t\t\tn_mod_actions\n\t\t\tSET\n\t\t\t\tma_processed = 1,\n\t\t\t\tma_executed = " . ($bExecute ? '1' : '0') . "\n\t\t\tWHERE\n\t\t\t\tma_id = {$id}\n\t\t");
 }
예제 #14
0
파일: Effect.php 프로젝트: Toxicat/dolumar
 public static function getEffects()
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\teffects\n\t\t");
     $out = array();
     foreach ($data as $v) {
         $tmp = self::getFromId($v['e_id']);
         if ($tmp) {
             $out[] = $tmp;
         }
     }
     return $out;
 }
예제 #15
0
 private function getPublicBuildings()
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*,\n\t\t\t\tUNIX_TIMESTAMP(t_startDate) AS startdatum,\n\t\t\t\tUNIX_TIMESTAMP(t_endDate) AS einddatum\n\t\t\tFROM\n\t\t\t\tplayers_tiles\n\t\t\tWHERE\n\t\t\t\tt_isPublic = 1 AND\n\t\t\t\t(t_startDate IS NULL OR t_startDate < FROM_UNIXTIME(" . NOW . ")) AND\n\t\t\t\t(t_endDate IS NULL OR t_endDate > FROM_UNIXTIME(" . NOW . "))\n\t\t");
     $out = array();
     foreach ($data as $v) {
         if (file_exists(PUBLIC_PATH . $v['t_imagename'])) {
             $building = Dolumar_Buildings_Building::getBuilding(100, $this->village->getRace(), 0, 0);
             $building->setBonusBuildingId($v['t_id']);
             $out[] = array('id' => $v['t_id'], 'image_url' => PUBLIC_URL . $v['t_imagename'], 'start_date' => $v['startdatum'], 'end_date' => $v['einddatum'], 'name' => $building->getName(), 'description' => $building->getCustomContent(), 'credits' => self::CREDIT_COST);
         }
     }
     return $out;
 }
예제 #16
0
파일: Portals.php 프로젝트: Toxicat/dolumar
 public function openPortal($village)
 {
     if ($village->equals($this->village)) {
         throw new Neuron_Core_Error('Can\'t open portal to own village.');
     }
     $race = $village->getRace();
     $building = Dolumar_Buildings_Portal::getBuilding(60, $race);
     $date = NOW + self::PORTAL_LIFESPAN_HOURES * 60 * 60 / GAME_SPEED_EFFECTS;
     $loc1 = $this->openPortalNearVillage($this->village, $building, $date);
     $loc2 = $this->openPortalNearVillage($village, $building, $date);
     $db = Neuron_DB_Database::getInstance();
     $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tmap_portals\n\t\t\tSET\n\t\t\t\tp_caster_v_id = {$this->village->getId()},\n\t\t\t\tp_target_v_id = {$village->getId()},\n\t\t\t\tp_caster_x = {$loc1[0]},\n\t\t\t\tp_caster_y = {$loc1[1]},\n\t\t\t\tp_target_x = {$loc2[0]},\n\t\t\t\tp_target_y = {$loc2[1]},\n\t\t\t\tp_caster_b_id = {$loc1[2]},\n\t\t\t\tp_target_b_id = {$loc2[2]},\n\t\t\t\tp_endDate = FROM_UNIXTIME({$date})\n\t\t");
     $logs = Dolumar_Players_Logs::getInstance();
     $logs->addOpenPortalLog($this->village, $village, $date);
 }
예제 #17
0
 public static function insert(Dolumar_Underworld_Models_Mission $mission, Dolumar_Underworld_Models_Battle $battle)
 {
     $data = $battle->getData();
     $db = Neuron_DB_Database::getInstance();
     $f = $battle->getAttacker()->getLocation();
     $t = $battle->getDefender()->getLocation();
     $fx = $f->x();
     $fy = $f->y();
     $tx = $t->x();
     $ty = $t->y();
     $as = $battle->getAttacker()->getSide()->getId();
     $ds = $battle->getDefender()->getSide()->getId();
     $id = $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tunderworld_log_battles\n\t\t\tSET\n\t\t\t\tuat_attacker = {$data['uat_attacker']},\n\t\t\t\tuat_defender = {$data['uat_defender']},\n\t\t\t\tuat_startdate = FROM_UNIXTIME({$data['startdate']}),\n\t\t\t\tuat_enddate = FROM_UNIXTIME({$data['enddate']}),\n\t\t\t\tuat_fightlog = '{$db->escape($data['uat_fightlog'])}',\n\t\t\t\tuat_from_x = {$fx},\n\t\t\t\tuat_from_y = {$fy},\n\t\t\t\tuat_to_x = {$tx},\n\t\t\t\tuat_to_y = {$ty},\n\t\t\t\tum_id = {$mission->getId()},\n\t\t\t\tuat_attacker_side = {$as},\n\t\t\t\tuat_defender_side = {$ds}\n\t\t");
     $battle->setId($id);
 }
 public static function getId(Andromeda_Interfaces_Identifiable $object)
 {
     static $classnames;
     if (!isset($classnames)) {
         $classes = self::getClasses();
         $classnames = $classes['names'];
     }
     $class = get_class($object);
     if (!isset($classnames[$class])) {
         $db = Neuron_DB_Database::getInstance();
         $db->query("\n\t\t\t\tINSERT INTO\n\t\t\t\t\tn_classes\n\t\t\t\tSET\n\t\t\t\t\tac_name = '{$db->escape($class)}'\n\t\t\t");
         $classes = self::getClasses(true);
         $classnames = $classes['names'];
     }
     return $classnames[$class];
 }
예제 #19
0
 public static function getFromId($id)
 {
     $db = Neuron_DB_Database::getInstance();
     $data = explode(':', $id);
     $id = intval($data[0]);
     $level = isset($data[1]) ? intval($data[1]) : 1;
     $amount = isset($data[2]) ? intval($data[2]) : 0;
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tequipment\n\t\t\tWHERE\n\t\t\t\te_id = {$id}\n\t\t");
     if (count($data) == 1) {
         $equipment = new self($data[0]['e_name'], $level);
         $equipment->addAmount($amount);
         return $equipment;
     } else {
         return false;
     }
 }
예제 #20
0
파일: Units.php 프로젝트: Toxicat/dolumar
 /**
  * Return all data from one given order ID
  */
 public function speedupBuild($id, $amount)
 {
     $db = Neuron_DB_Database::getInstance();
     $profiler = Neuron_Profiler_Profiler::__getInstance();
     $profiler->start('Speeding up training of ' . $id . ' with ' . $amount . ' seconds.');
     $data = $this->getTrainingStatus($id);
     if ($data) {
         $timeLeft = $data['timeLeft'];
         if ($amount > $timeLeft) {
             $amount = $timeLeft;
         }
     }
     $db->query("\n\t\t\tUPDATE\n\t\t\t\tvillages_units\n\t\t\tSET\n\t\t\t\tendTraining = endTraining - {$amount}\n\t\t\tWHERE\n\t\t\t\tuid = {$id}\n\t\t");
     $profiler->stop();
     return;
 }
예제 #21
0
 public function addMapUpdate(Neuron_GameServer_Map_Location $location, $action)
 {
     $x = $location->x();
     $y = $location->y();
     switch ($action) {
         case 'BUILD':
         case 'DESTROY':
             break;
         default:
             $action = 'BUILD';
             break;
     }
     $db = Neuron_DB_Database::getInstance();
     $x = intval($x);
     $y = intval($y);
     $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tn_map_updates\n\t\t\tSET\n\t\t\t\tmu_action = '{$action}',\n\t\t\t\tmu_x = {$x},\n\t\t\t\tmu_y = {$y},\n\t\t\t\tmu_date = FROM_UNIXTIME(" . NOW . ")\n\t\t");
 }
 public function getRefresh()
 {
     $data = $this->getRequestData();
     if (!isset($data['lastlog'])) {
         $data['lastlog'] = $this->getInitialLogID();
     } else {
         // Update all map areas that have been changed
         $db = Neuron_DB_Database::getInstance();
         $ll = intval($data['lastlog']);
         $q = $db->query("\n\t\t\t\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\tn_map_updates\n\t\t\t\tWHERE\n\t\t\t\t\tmu_id > {$ll}\n\t\t\t");
         foreach ($q as $v) {
             //$this->alert ('reloading ' . $v['mu_x'] . ',' . $v['mu_y']);
             $this->reloadLocation($v['mu_x'], $v['mu_y']);
             if ($v['mu_id'] > $data['lastlog']) {
                 $data['lastlog'] = $v['mu_id'];
             }
         }
     }
     $this->updateRequestData($data);
     //$this->updateContent ();
 }
예제 #23
0
 public function prepare()
 {
     // Fetch a random target
     $networth = $this->getVillage()->getScore();
     $minscore = floor($networth * 0.75);
     $maxscore = ceil($networth * 1.25);
     $db = Neuron_DB_Database::getInstance();
     $myclanlist = "";
     foreach ($this->getVillage()->getOwner()->getClans() as $v) {
         $myclanlist .= $v->getId() . ",";
     }
     $myclanlist = substr($myclanlist, 0, -1);
     $chk = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tvillages v\n\t\t\tLEFT JOIN\n\t\t\t\tn_players p USING(plid)\n\t\t\tLEFT JOIN\n\t\t\t\tclan_members cm ON cm.plid = p.plid AND cm.c_id IN ({$myclanlist})\n\t\t\tWHERE\n\t\t\t\tv.networth > {$minscore} AND\n\t\t\t\tv.networth < {$maxscore} AND\n\t\t\t\tv.plid != {$this->getVillage()->getOwner()->getId()} AND\n\t\t\t\tv.isActive = 1 AND\n\t\t\t\tp.startVacation IS NULL AND\n\t\t\t\tcm.c_id IS NULL\n\t\t\tORDER BY\n\t\t\t\tRAND()\n\t\t\tLIMIT\n\t\t\t\t1\n\t\t");
     //die ($db->getLastQuery ());
     if (count($chk) > 0) {
         $village = Dolumar_Players_Village::getVillage($chk[0]['vid']);
         $this->setTarget($village);
     } else {
         $this->setCastable(false);
         $this->setError(Dolumar_Effects_Effect::ERROR_NO_TARGET_FOUND);
     }
 }
예제 #24
0
 public function getBody()
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tn_players\n\t\t\tWHERE\n\t\t\t\tpremiumEndDate > FROM_UNIXTIME('" . NOW . "')\n\t\t");
     $refund = Neuron_Core_Tools::getInput('_GET', 'refund', 'int');
     $refund = $refund == 1;
     $page = new Neuron_Core_Template();
     foreach ($data as $v) {
         $player = Neuron_GameServer::getPlayer($v['plid'], $v);
         $date = $player->getPremiumEndDate();
         $diff = $date - NOW;
         $amounts = ceil($diff / (60 * 60 * 24 * 15));
         $credits = $amounts * PREMIUM_COST_CREDITS;
         if ($refund) {
             $amref = $player->refundCredits($credits, 'premium account refund');
         } else {
             $amref = false;
         }
         $page->addListValue('players', array('name' => $player->getDisplayName(), 'enddate' => date('d m Y H:i:s', $date), 'credits' => $credits, 'refunded' => $amref));
     }
     return $page->parse('pages/admin/premium/premium.phpt');
 }
예제 #25
0
 public function checkBuildLocation($village, $x, $y, $bradius = MAXBUILDINGRADIUS)
 {
     $db = Neuron_DB_Database::getInstance();
     $x = floor($x);
     $y = floor($y);
     $distance = MAXBUILDINGRADIUS * MAXBUILDINGRADIUS;
     /*
     $l = $db->query
     ("
     	SELECT
     		1
     	FROM 
     		(SELECT 1) t
     	WHERE EXISTS
     	(
     		SELECT
     			*
     		FROM
     			map_buildings
     		WHERE
     			((xas - $x) * (xas - $x)) + ((yas - $y) * (yas - $y)) < ($distance)
     			AND buildingType = 1 
     			AND destroyDate = 0
     	)
     ");
     */
     $query = "\n\t\t\tSELECT\n\t\t\t\t1\n\t\t\tFROM \n\t\t\t\t(SELECT 1) t\n\t\t\tWHERE EXISTS\n\t\t\t(\n\t\t\t\tSELECT\n\t\t\t\t\txas\n\t\t\t\tFROM\n\t\t\t\t\tmap_buildings\n\t\t\t\tWHERE\n\t\t\t\t\txas BETWEEN " . ($x - $bradius) . " AND " . ($x + $bradius) . "\n\t\t\t\t\tAND yas BETWEEN " . ($y - $bradius) . " AND " . ($y + $bradius) . "\n\t\t\t\t\tAND (buildingType = 1 OR buildingType = 3) \n\t\t\t\t\tAND destroyDate = 0\n\t\t\t)\n\t\t";
     $l = $db->query($query);
     if (count($l) > 0) {
         return array(false, 'minimalRange');
     }
     $location = Dolumar_Map_Location::getLocation($x, $y);
     if ($location->canBuildBuilding()) {
         return array(true, array($x, $y));
     } else {
         return array(false, 'minimalRange');
     }
 }
예제 #26
0
 public function getAdditionalContent($page)
 {
     $page = new Neuron_Core_Template();
     $modes = Neuron_GameServer_Player::getAdminModes();
     $out = array();
     $db = Neuron_DB_Database::getInstance();
     $i = 0;
     foreach ($modes as $k => $v) {
         if ($k > 0 && $k < 8) {
             $out[$v] = array();
             $k = intval($k);
             $sql = $db->query("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tplid\n\t\t\t\t\tFROM\n\t\t\t\t\t\tn_players\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tp_admin = {$k}\n\t\t\t\t");
             foreach ($sql as $vv) {
                 $player = Neuron_GameServer::getPlayer($vv['plid']);
                 $out[$v][] = $player->getDisplayName();
                 $i++;
             }
         }
     }
     $page->set('moderators', $out);
     $page->set('hasmods', $i > 0);
     return $page->parse('neuron/imprint/imprint.phpt');
 }
예제 #27
0
 public function getBody()
 {
     $myself = Neuron_GameServer::getPlayer();
     if (!$myself->isAdmin()) {
         return '<p>You are not allowed to execute the commands. Only admins are.</p>';
     }
     $page = new Neuron_Core_Template();
     $login = Neuron_Core_Login::getInstance();
     if (!$login->isLogin()) {
         $userid = 0;
     } else {
         $userid = $login->getUserId();
     }
     $text = Neuron_Core_Text::getInstance();
     $content = array();
     foreach ($text->getLanguages() as $v) {
         $page->addListValue('languages', $v);
         $content[$v] = array('title' => Neuron_Core_Tools::getInput('_POST', 'title_' . $v, 'varchar'), 'description' => Neuron_Core_Tools::getInput('_POST', 'description_' . $v, 'varchar'));
     }
     if (isset($_FILES['imagefile'])) {
         $im = $this->getImageFromInput($_FILES['imagefile']);
         if ($im) {
             $new = $this->getGeneratedImage($im);
             if (!is_dir(PUBLIC_PATH . 'signs/')) {
                 mkdir(PUBLIC_PATH . 'signs/');
                 chmod(PUBLIC_PATH . 'signs/', 0755);
             }
             $filename = $userid . '_' . date('dmYHis') . '.png';
             imagepng($new, PUBLIC_PATH . 'signs/' . $filename);
             chmod(PUBLIC_PATH . 'signs/' . $filename, 0755);
             $db = Neuron_DB_Database::getInstance();
             $db->query("\n\t\t\t\t\tINSERT INTO\n\t\t\t\t\t\tplayers_tiles\n\t\t\t\t\tSET\n\t\t\t\t\t\tt_userid = " . intval($userid) . ",\n\t\t\t\t\t\tt_imagename = 'signs/" . $db->escape($filename) . "',\n\t\t\t\t\t\tt_isPublic = 1,\n\t\t\t\t\t\tt_description = '{$db->escape(json_encode($content))}'\n\t\t\t\t");
         }
     }
     return $page->parse('dolumar/pages/admin/bonusbuilding/bonusbuilding.phpt');
 }
예제 #28
0
 public static function removeFromMission(Dolumar_Underworld_Models_Mission $mission)
 {
     $db = Neuron_DB_Database::getInstance();
     $db->query("\n\t\t\tDELETE FROM\n\t\t\t\tunderworld_explored\n\t\t\tWHERE\n\t\t\t\tum_id = {$mission->getId()}\n\t\t");
 }
예제 #29
0
파일: Clan.php 프로젝트: Toxicat/dolumar
 /**
  *	Get all clan portal buildings
  */
 public function getClanportals()
 {
     $db = Neuron_DB_Database::getInstance();
     $villages = array();
     foreach ($this->getMembers() as $player) {
         foreach ($player->getVillages() as $v) {
             $villages[] = $v->getId();
         }
     }
     $list = "(" . implode($villages, ",") . ")";
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tmap_buildings\n\t\t\tWHERE\n\t\t\t\tbuildingType = 61 AND\n\t\t\t\tvillage IN {$list} AND\n\t\t\t\t(destroyDate = 0 OR destroyDate > " . NOW . ")\n\t\t");
     $out = array();
     foreach ($data as $v) {
         $village = Dolumar_Players_Village::getFromId($v['village']);
         $building = Dolumar_Buildings_Building::getFromId($v['bid'], $village->getRace(), $v['xas'], $v['yas']);
         $building->setData($v['bid'], $v);
         $building->setVillage($village);
         $out[] = $building;
     }
     return $out;
 }
예제 #30
0
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
// Update all map areas that have been changed
$db = Neuron_DB_Database::getInstance();
$lastlog = Neuron_Core_Tools::getInput('_REQUEST', 'from', 'int');
$ll = intval($lastlog);
$out = array();
$attributes = array();
if ($ll < 1) {
    $db = Neuron_DB_Database::getInstance();
    $last = $db->query("\n\t\tSELECT\n\t\t\tMAX(mu_id) AS laatste\n\t\tFROM\n\t\t\tn_map_object_updates\n\t");
    $out = array();
    $attributes = array('last' => intval($last[0]['laatste']));
} else {
    $q = $db->query("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tn_map_object_updates\n\t\tWHERE\n\t\t\tmu_id > {$ll}\n\t");
    $last = $ll;
    $out['objects'] = array();
    $out['removes'] = array();
    foreach ($q as $v) {
        if ($last < $v['mu_id']) {
            $last = $v['mu_id'];
        }
        if ($v['mu_action'] == 'REMOVE') {
            $out['removes'][] = array('attributes' => array('id' => $v['mu_uoid']));
        } else {