Ejemplo n.º 1
0
 /**
  * @param Neuron_GameServer_Player $objUser
  */
 public function __construct(Neuron_GameServer_Player $objUser)
 {
     $this->objUser = $objUser;
     $this->objCredits = self::getPureCreditsObject();
     if (!$this->objCredits) {
         return;
     }
     if ($this->objUser->isEmailCertified()) {
         $this->objCredits->setEmail($this->getEmail());
     }
     $this->objCredits->setReferal($objUser->getReferal());
     foreach ($objUser->getOpenIDs() as $v) {
         $this->objCredits->addOpenID($v);
     }
     $container = isset($_SESSION['opensocial_container']) ? $_SESSION['opensocial_container'] : null;
     if (isset($container)) {
         $this->objCredits->setContainer($container);
     }
     $fullscreen = isset($_SESSION['fullscreen']) && $_SESSION['fullscreen'] ? 1 : 0;
     $this->objCredits->setFullscreen($fullscreen);
     $this->objCredits->setLanguage(Neuron_Core_Text::getInstance()->getCurrentLanguage());
     $this->objCredits->setUserId($objUser->getId());
     if (isset($_SESSION['birthday'])) {
         $this->objCredits->setBirthday($_SESSION['birthday']);
     }
     if (isset($_SESSION['gender'])) {
         $this->objCredits->setGender(strtolower($_SESSION['gender']) == 'm' ? 'male' : 'female');
     }
 }
 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");
     }
 }
Ejemplo n.º 3
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");
     }
 }
Ejemplo n.º 4
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");
 }
Ejemplo n.º 5
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');
 }
 public function getContent()
 {
     $text = Neuron_Core_Text::getInstance();
     $player = Neuron_GameServer::getPlayer();
     if (!$player) {
         return $this->throwError($text->get('login', 'login', 'account'));
     }
     $page = new Neuron_Core_Template();
     $page->set('nickname', '');
     // Ignore a player.
     $input = $this->getInputData();
     $nickname = isset($input['nickname']) ? $input['nickname'] : null;
     if (!empty($nickname)) {
         $target = Neuron_GameServer_Player::getFromName($nickname);
         if ($target && $target->getId() == $player->getId()) {
             $page->set('error', 'ignore_yourself');
         } else {
             if ($target) {
                 $player->setIgnoring($target);
             } else {
                 $page->set('nickname', $nickname);
                 $page->set('error', 'player_not_found');
             }
         }
     }
     // Unignore a player
     if (isset($input['unignore'])) {
         $target = Neuron_GameServer::getPlayer($input['unignore']);
         if ($target) {
             $player->setIgnoring($target, false);
         }
     }
     foreach ($player->getIgnoredPlayers() as $v) {
         $page->addListValue('players', array('id' => $v->getId(), 'name' => Neuron_Core_Tools::output_varchar($v->getName())));
     }
     return $page->parse('gameserver/account/ignorelist.phpt');
 }
Ejemplo n.º 7
0
 // Start counter
 $pgen = Neuron_Core_PGen::__getInstance();
 $pgen->start();
 // Fetch input
 $output_type = Neuron_Core_Tools::getInput('_REQUEST', 'output', 'varchar', false);
 $output = array();
 $output['request'] = $_GET;
 $output['content'] = array();
 // Requests
 switch ($request) {
     case 'invitation':
         $id = Neuron_Core_Tools::getInput('_REQUEST', 'id', 'int', false);
         $player = Neuron_GameServer::getPlayer($id);
         if ($player->isFound()) {
             $sender = Neuron_GameServer_Player::getFromOpenID(Neuron_Core_Tools::getInput('_REQUEST', 'sender', 'varchar'));
             $receiver = Neuron_GameServer_Player::getFromOpenID(Neuron_Core_Tools::getInput('_REQUEST', 'receiver', 'varchar'));
             if (!$receiver) {
                 // We have to somehow queue it.
             } else {
                 $receiver->invitationGiftReceiver($_REQUEST, $sender);
                 $sender->invitationGiftSender($_REQUEST, $receiver);
             }
         }
         break;
     case 'phpinfo':
         phpinfo();
         exit;
         break;
     case 'getlogs':
         $id = Neuron_Core_Tools::getInput('_GET', 'id', 'int', isset($sInputs[2]) ? $sInputs[2] : 0);
         $start = Neuron_Core_Tools::getInput('_GET', 'start', 'int', 0);
Ejemplo n.º 8
0
 private function chkKickedFromClanRecently(Neuron_GameServer_Player $player)
 {
     $logs = Dolumar_Players_Logs::getInstance();
     $logs->clearFilters();
     $logs->addShowOnly('clan_kicked');
     $logs->setTimeInterval(NOW - 60 * 60 * 24 * self::MIN_DAYS_BETWEEN_KICKJOIN);
     foreach ($logs->getLogs($player->getVillages()) as $v) {
         $objects = $v['data'];
         if ($objects[0]->equals($this)) {
             $this->error = 'err_kicked';
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 9
0
 public function isFinished(Neuron_GameServer_Player $player)
 {
     $village = $player->getMainVillage();
     // Check if we already have a farm
     return $village->buildings->hasBuilding(Dolumar_Buildings_Building::getBuilding(20, $village->getRace()), true);
 }
 public static function countLogins(Neuron_GameServer_Player $player)
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("SELECT COUNT(*) AS aantal FROM n_login_log WHERE l_plid = {$player->getId()}");
     return $data[0]['aantal'];
 }
Ejemplo n.º 11
0
 private function hasPrevious(Neuron_GameServer_Player $player, $page)
 {
     $db = Neuron_DB_Database::getInstance();
     $cnt = $db->query("\n\t\t\tSELECT\n\t\t\t\tCOUNT(pg_id) AS aantal\n\t\t\tFROM\n\t\t\t\tn_players_guide\n\t\t\tWHERE\n\t\t\t\tplid = {$player->getId()}\n\t\t");
     return count($cnt) == 1 && $cnt[0]['aantal'] - 1 > $page;
 }
Ejemplo n.º 12
0
 public function __destruct()
 {
     unset($this->data);
     if (isset($this->villages)) {
         /*
         foreach ($this->villages as $k => $v)
         {
         	$v->__destruct ();
         }
         */
     }
     unset($this->villages);
     parent::__destruct();
 }
Ejemplo n.º 13
0
 private function getModeratorHistory(Neuron_GameServer_Player $objUser)
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\t*,\n\t\t\t\tUNIX_TIMESTAMP(ma_date) AS datum\n\t\t\tFROM\n\t\t\t\tn_mod_actions\n\t\t\tWHERE\n\t\t\t\tma_target = {$objUser->getId()}\n\t\t\tORDER BY\n\t\t\t\tma_date DESC\n\t\t");
     $out = array();
     foreach ($data as $v) {
         $data = json_decode($v['ma_data'], true);
         $out[] = array('date' => $v['datum'], 'data' => $data, 'admin' => Neuron_GameServer::getPlayer($v['ma_plid']), 'reason' => $v['ma_reason'], 'action' => $this->getHistoryText($v['ma_action'], $data), 'isExecuted' => $v['ma_executed'], 'isProcessed' => $v['ma_processed']);
     }
     return $out;
 }
Ejemplo n.º 14
0
 public function countPrivateMessages(Neuron_GameServer_Player $target)
 {
     $db = Neuron_DB_Database::getInstance();
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\tCOUNT(pu_id) AS aantal\n\t\t\tFROM\n\t\t\t\tn_privatechat_updates\n\t\t\tWHERE\n\t\t\t\tpu_to = {$target->getId()}\n\t\t");
     return $data[0]['aantal'];
 }
Ejemplo n.º 15
0
 private function logFailure($username)
 {
     $db = Neuron_DB_Database::getInstance();
     $user = Neuron_GameServer_Player::getFromName($username);
     $userId = 'NULL';
     if ($user) {
         $userId = $user->getId();
     }
     $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tn_login_failures\n\t\t\tSET\n\t\t\t\tl_plid = {$userId},\n\t\t\t\tl_ip = '{$db->escape($this->getIp())}',\n\t\t\t\tl_username = '******',\n\t\t\t\tl_date = FROM_UNIXTIME(" . NOW . ")\n\t\t");
 }
Ejemplo n.º 16
0
 public static function withdraw(Dolumar_Underworld_Models_Mission $mission, Neuron_GameServer_Player $player, Dolumar_Underworld_Models_Army $army, Neuron_GameServer_Map_Location $location)
 {
     $db = Neuron_DB_Database::getInstance();
     $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 = 'WITHDRAW',\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);
 }