コード例 #1
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     $login = Neuron_Core_Login::__getInstance();
     if ($login->isLogin()) {
         $player = Neuron_GameServer::getPlayer();
         $pos = $player->getPreferences();
         $pos = $pos['minimapPosition'];
     } else {
         $pos = Neuron_Core_Tools::getInput('_COOKIE', COOKIE_PREFIX . 'prefMP', 'int', 0);
     }
     if ($pos == 4) {
         $this->setPosition('auto', 'auto', '0px', '0px');
     } elseif ($pos == 2) {
         $this->setPosition('0px', '32px', 'auto', 'auto');
     } elseif ($pos == 3) {
         $this->setPosition('auto', '32px', '0px', 'auto');
     } else {
         $this->setPosition('0px', 'auto', 'auto', '0px');
     }
     if ($pos != 5) {
         $this->setType('panel');
     } else {
         // Movable ;-)
         $this->setPosition('0px', 'auto', 'auto', '0px');
         //$this->setOnResize ('onResizeMiniMap');
     }
     // Window settings
     $this->setSize('200px', '150px');
     $this->setTitle('Mini Map');
     $this->setClass('minimap');
     $this->setType('panel');
     $this->setAllowOnlyOnce();
     $this->setPool('minimap');
 }
コード例 #2
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>';
     }
     // Check for input
     $record = Neuron_Core_Tools::getInput('_GET', 'id', 'int');
     $action = Neuron_Core_Tools::getInput('_GET', 'action', 'varchar');
     if ($record && $action) {
         $this->processAction($record, $action == 'accept');
     }
     $page = new Neuron_Core_Template();
     $db = Neuron_DB_Database::getInstance();
     $list = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tn_mod_actions\n\t\t\tWHERE\n\t\t\t\tma_processed = 0\n\t\t\tORDER BY\n\t\t\t\tma_date ASC\n\t\t");
     foreach ($list as $v) {
         $params = json_decode($v['ma_data'], true);
         $target = false;
         if (isset($params['plid'])) {
             $target = Neuron_GameServer::getPlayer($params['plid']);
         }
         $actor = Neuron_GameServer::getPlayer($v['ma_plid']);
         $page->addListValue('actions', array('date' => $v['ma_date'], 'action' => $v['ma_action'], 'target' => $target ? $target->getDisplayName() : null, 'actor' => $actor ? $actor->getDisplayName() : null, 'reason' => !empty($v['ma_reason']) ? Neuron_Core_Tools::output_text($v['ma_reason']) : null, 'accept_url' => self::getUrl('execute', array('id' => $v['ma_id'], 'action' => 'accept')), 'deny_url' => self::getUrl('execute', array('id' => $v['ma_id'], 'action' => 'deny'))));
     }
     return $page->parse('pages/admin/execute/list.phpt');
 }
コード例 #3
0
 private function register()
 {
     $player = Neuron_GameServer::getPlayer();
     if (!$player) {
         echo '<p>Please login.</p>';
         return;
     }
     $name = Neuron_Core_Tools::getInput('_POST', 'name', 'varchar');
     $developer = Neuron_Core_Tools::getInput('_POST', 'developer', 'varchar');
     $email = Neuron_Core_Tools::getInput('_POST', 'email', 'email');
     $user_id = $player->getId();
     $page = new Neuron_Core_Template();
     if ($name && $developer) {
         $consumer = array('requester_name' => $developer, 'requester_email' => $email);
         // Register the consumer
         $store = Neuron_Auth_OAuthStore::getStore();
         $key = $store->updateConsumer($consumer, $user_id);
         // Get the complete consumer from the store
         $consumer = $store->getConsumer($key, $user_id);
         // Some interesting fields, the user will need the key and secret
         $page->set('app_data', array('Consumer ID' => $consumer['id'], 'Consumer Key' => $consumer['consumer_key'], 'Consumer secret' => $consumer['consumer_secret']));
         return $page->parse('oauth/information.phpt');
     } else {
         return $page->parse('oauth/register.phpt');
     }
 }
コード例 #4
0
 public function getBody()
 {
     $timeframe = Neuron_Core_Tools::getInput('_GET', 'timeframe', 'int', 60 * 60 * 48);
     $db = Neuron_DB_Database::__getInstance();
     $page = new Neuron_Core_Template();
     $page->set('timeframe', $timeframe);
     // Fetch all doubles
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\tn_login_log.l_ip,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(DISTINCT n_login_log.l_plid) AS plids,\n\t\t\t\tGROUP_CONCAT(DISTINCT n_players.nickname) AS nicknames,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(c.pac_plid1) AS cleared_1,\n\t\t\t\tGROUP_CONCAT(c.pac_plid2) AS cleared_2,\n\t\t\t\tGROUP_CONCAT(c.pac_reason) AS cleared_reason,\n\t\t\t\t\n\t\t\t\tCOUNT(DISTINCT l_plid) AS aantal\n\t\t\tFROM\n\t\t\t\tn_login_log\n\t\t\tLEFT JOIN\n\t\t\t\tn_players ON n_login_log.l_plid = n_players.plid\n\t\t\tLEFT JOIN\n\t\t\t\tn_players_admin_cleared c ON (c.pac_plid1 = n_login_log.l_plid OR c.pac_plid2 = n_login_log.l_plid)\n\t\t\tWHERE\n\t\t\t\tn_login_log.l_datetime > FROM_UNIXTIME(" . (NOW - $timeframe) . ") AND\n\t\t\t\tn_players.isPlaying = 1\n\t\t\tGROUP BY\n\t\t\t\tl_ip\n\t\t\tHAVING\n\t\t\t\taantal > 1\n\t\t");
     foreach ($data as $row) {
         $plids = explode(',', $row['plids']);
         $nicknames = explode(',', $row['nicknames']);
         // Check clearances.
         $clearances = $this->getClearancesFromRow($row);
         $players = array();
         $combinedlogs = "";
         foreach ($plids as $k => $v) {
             $players[] = array('id' => $plids[$k], 'name' => isset($nicknames[$k]) ? $nicknames[$k] : 'no-nickname-set', 'url' => $this->getUrl('user', array('id' => $plids[$k])), 'logs_url' => $this->getUrl('gamelogs', array('players' => $plids[$k])));
             $combinedlogs .= $plids[$k] . "|";
         }
         // Check for cleared accounts
         $allcleared = true;
         foreach ($players as $k => $v) {
             $players[$k]['cleared'] = $this->isCleared($clearances, $v, $players);
             if ($allcleared && !$players[$k]['cleared']) {
                 $allcleared = false;
             }
         }
         $combinedlogs = substr($combinedlogs, 0, -1);
         $page->addListValue('players', array('ip' => $row['l_ip'], 'players' => $players, 'combined_logs_url' => $this->getUrl('gamelogs', array('players' => $combinedlogs)), 'clearmultis' => $this->getUrl('clearmultis', array('players' => $combinedlogs)), 'cleared' => $allcleared, 'amount' => $row['aantal']));
     }
     $page->usortList('players', array($this, 'sortcompare'));
     return $page->parse('pages/admin/multis.phpt');
 }
コード例 #5
0
 public function getBody()
 {
     $player = Neuron_GameServer::getPlayer(Neuron_Core_Tools::getInput('_GET', 'id', 'int'));
     $statistics = $player->getStatistics();
     $out = $this->linearArray($statistics);
     $page = new Neuron_Core_Template();
     $page->set('statistics', $out);
     return $page->parse('gameserver/pages/statistics.phpt');
 }
コード例 #6
0
ファイル: Villageprofile.php プロジェクト: Toxicat/dolumar
 public function getBody()
 {
     $village = Neuron_Core_Tools::getInput('_GET', 'village', 'int');
     $village = Dolumar_Players_Village::getVillage($village);
     $body = '<h2>' . $village->getName() . '</h2>';
     $location = $village->buildings->getTownCenterLocation();
     //$url = ABSOLUTE_URL . '#' . $location[0] . ',' . $location[1];
     $url = $this->getUrl('Playerprofile', array('plid' => $village->getOwner()->getId()));
     header('Location: ' . $url);
     return $body;
 }
コード例 #7
0
function sendNotification($id, $sender, $public)
{
    echo '<h1>';
    echo $sender ? 'With sender' : 'Without sender';
    echo ' and ';
    echo $public ? 'public' : 'private';
    echo '</h1>';
    $player = Dolumar_Players_Player::getFromId($id);
    $other = Dolumar_Players_Player::getFromId(Neuron_Core_Tools::getInput('_GET', 'from', 'int', 1));
    if ($sender) {
        echo '<p>Message was sent from ' . $other->getNickname() . '.</p>';
    }
    $player->sendNotification('test', 'system', array('target' => $other, 'defender' => $other->getMainVillage(), 'pl_defender' => $other, 'village' => $player->getMainVillage(), 'player' => $player), $sender ? $other : null, $public);
    echo '<p style="color: green;">A notification has been sent to user ' . $player->getName() . '.</p>';
}
コード例 #8
0
 public function getOuterBody()
 {
     $username = Neuron_Core_Tools::getInput('_POST', 'username', 'varchar');
     $password = Neuron_Core_Tools::getInput('_POST', 'password', 'varchar');
     $page = new Neuron_Core_Template();
     if ($username && $password) {
         $chk = $this->login->login($username, $password, false);
         if ($chk) {
             $url = $this->getUrl('index');
             header('Location: ' . $url);
             return '<p>Welcome! Click <a href="' . $url . '">here</a> to continue.</p>';
         } else {
             $page->set('error', $this->login->getError());
         }
     }
     $page->set('action', '');
     return $page->parse('pages/login.phpt');
 }
コード例 #9
0
ファイル: Report.php プロジェクト: Toxicat/dolumar
 public function getBody()
 {
     $unit = $this->getParameter(2);
     switch ($unit) {
         case 'units':
             return $this->getUnitStats();
             break;
         case 'equipment':
             return $this->getEquipmentStats();
             break;
         case 'effects':
             return $this->getEffectStats();
             break;
     }
     $module = Neuron_Core_Tools::getInput('_REQUEST', 'module', 'varchar');
     $data = explode('/', $module);
     var_dump($data);
     return '<p>Report not found: ' . $unit . '</p>';
 }
コード例 #10
0
ファイル: Gamelogs.php プロジェクト: Toxicat/dolumar
 public function getBody()
 {
     $player = Neuron_GameServer::getPlayer();
     if (!$player->isModerator()) {
         return '<p>You don\'t have the rights to access the player logs.</p>';
     }
     $page = new Neuron_Core_Template();
     // Let's find the players
     $input = Neuron_Core_Tools::getInput('_GET', 'players', 'varchar');
     $playerids = explode('|', $input);
     $players = array();
     $villages = array();
     $ids = array();
     $i = 0;
     foreach ($playerids as $v) {
         $player = Neuron_GameServer::getPlayer($v);
         if ($player) {
             $players[] = $player;
             $villages = array_merge($villages, $player->getVillages());
             $ids[$player->getId()] = $i;
             $page->addListValue('players', array('key' => $i, 'id' => $player->getId(), 'name' => $player->getName(), 'url' => $this->getUrl('user', array('id' => $player->getId()))));
             $i++;
         }
     }
     $pageid = max(0, intval(Neuron_Core_Tools::getInput('_GET', 'page', 'int', 1)) - 1);
     $objLogs = Dolumar_Players_Logs::getInstance();
     $logs = $objLogs->getLogs($villages, $pageid * 250, 250, 'DESC');
     foreach ($logs as $v) {
         $player = Dolumar_Players_Village::getFromId($v['village'])->getOwner();
         // Check if this is an important log.
         $bImportant = $this->isImportantLog($players, $v);
         $page->addListValue('logs', array('action' => $objLogs->getLogText($v, false), 'date' => date(DATETIME, $v['timestamp']), 'player' => $player->getName(), 'url' => $this->getUrl('user', array('id' => $player->getId())), 'key' => $ids[$player->getId()], 'important' => $bImportant ? 'important' : null));
     }
     $page->set('page', $pageid + 1);
     if (count($logs) == 250) {
         $page->set('nextpage', $this->getUrl('gamelogs', array('players' => $input, 'page' => $pageid + 2)));
     }
     if ($pageid > 0) {
         $page->set('previouspage', $this->getUrl('gamelogs', array('players' => $input, 'page' => $pageid)));
     }
     return $page->parse('pages/admin/gamelogs.phpt');
 }
コード例 #11
0
ファイル: Multis.php プロジェクト: Toxicat/dolumar
 public function getBody()
 {
     $timeframe = Neuron_Core_Tools::getInput('_GET', 'timeframe', 'int', 60 * 60 * 48);
     $page = new Neuron_Core_Template();
     $page->set('timeframe', $timeframe);
     $objLogs = Dolumar_Players_Logs::getInstance();
     $objLogs->setTimeInterval(NOW - $timeframe, NOW);
     $pageid = Neuron_Core_Tools::getInput('_GET', 'page', 'int', 1);
     $limit = Neuron_Core_Tools::splitInPages($page, $objLogs->getSuspiciousLogsCounter(), $pageid, self::SUSPICIOUS_TRANSACTIONS_PERPAGE, 7, array('timeframe' => $timeframe), 'multis');
     //print_r ($limit);
     //$logs = $objLogs->getSuspiciousLogs ();
     $logs = $objLogs->getSuspiciousLogs($limit['start'], $limit['perpage'], 'DESC');
     foreach ($logs as $v) {
         $player = Dolumar_Players_Village::getFromId($v['village'])->getOwner();
         $page->addListValue('logs', array('action' => $objLogs->getLogText($v, false), 'date' => date(DATETIME, $v['timestamp']), 'player' => $player->getDisplayName()));
     }
     // Output the shizzle
     $html = $page->parse('dolumar/pages/admin/multis/dangeroustransactions.phpt');
     $html .= parent::getBody();
     return $html;
 }
コード例 #12
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');
 }
コード例 #13
0
 private function checkIfLoggedIn()
 {
     if ($this->isChecked) {
         return;
     }
     $this->isChecked = true;
     /* Check for login */
     $uid = Neuron_Core_Tools::getInput('_SESSION', 'plid', 'int', false);
     $logout = Neuron_Core_Tools::getInput('_GET', 'logout', 'bool', false);
     //$uid = 1;
     /* Check for logout */
     if ($logout) {
         $this->logout();
     } elseif ($uid) {
         $this->uid = $uid;
     } else {
         // setcookie ('dolumar_plid'.$this->level, $this->uid, time () + COOKIE_LIFETIME, '/');
         // setcookie ('dolumar_pass'.$this->level, $user->getPasswordHash (), time () + COOKIE_LIFETIME, '/');
         // Check for cookies
         $user = Neuron_Core_Tools::getInput('_COOKIE', 'dolumar_plid' . $this->level, 'int', false);
         $pass = Neuron_Core_Tools::getInput('_COOKIE', 'dolumar_pass' . $this->level, 'md5', false);
         if ($user && $pass) {
             // Check details
             $objUser = Neuron_GameServer::getPlayer($user);
             // Check password
             if ($objUser->getPasswordHash() == $pass) {
                 $this->doLogin($objUser, true);
             } else {
                 // Remove the cookies
                 $this->removeCookies();
             }
         }
     }
     if ($this->registerRefresh) {
         $this->processLastRefresh();
     }
 }
コード例 #14
0
ファイル: Bonusbuilding.php プロジェクト: Toxicat/dolumar
 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');
 }
コード例 #15
0
 public function getBody()
 {
     $page = new Neuron_Core_Template();
     // Let's find the players
     $input = Neuron_Core_Tools::getInput('_GET', 'players', 'varchar');
     $playerids = explode('|', $input);
     $page->set('action_url', $this->getUrl('clearmultis', array('players' => $input)));
     $players = array();
     $ids = array();
     $i = 0;
     foreach ($playerids as $v) {
         $player = $this->getPlayer($v);
         if ($player) {
             $players[] = $player;
             $page->addListValue('players', array('id' => $player->getId(), 'name' => $player->getDisplayName()));
         }
     }
     $this->process($players);
     $clearances = $this->getClearances($players);
     foreach ($clearances as $v) {
         $page->addListValue('clearances', array('player1' => $this->getPlayerName($v['player1']), 'player2' => $this->getPlayerName($v['player2']), 'remove_url' => $this->getUrl('clearmultis', array('players' => $input, 'remove' => $v['id'])), 'reason' => $v['reason']));
     }
     return $page->parse('pages/admin/clearmultis/clearmultis.phpt');
 }
コード例 #16
0
<?php

define('NOTIFICATION_DEBUG', true);
//echo '<h1>With sender & private</h1>';
//$player->sendNotification ('test', 'system', array ('user' => $other), $other);
$plid = Neuron_Core_Tools::getInput('_GET', 'id', 'int', 0);
$action = Neuron_Core_Tools::getInput('_GET', 'action', 'varchar', false);
$player = $plid > 0 ? Dolumar_Players_Player::getFromId($plid) : false;
if ($player) {
    $player->updateScore();
} else {
    echo '<p style="color: red;">User not found! Append id=USER_ID to the URL.</p>';
}
コード例 #17
0
     $id = Neuron_Core_Tools::getInput('_GET', 'id', 'int', 0);
     $player = Neuron_GameServer::getPlayer($id);
     if ($player && $player->isFound()) {
         $output['content'] = $player->getAPIData();
     }
     break;
 case 'getonlineplayers':
     $start = Neuron_Core_Tools::getInput('_GET', 'start', 'int', 0);
     $players = Neuron_GameServer::getServer()->getOnlineUser($start * 250, 250);
     $output['content'] = array();
     foreach ($players as $v) {
         $output['content'][] = $v->getAPIData(false);
     }
     break;
 case 'countplayers':
     $extended = Neuron_Core_Tools::getInput('_GET', 'extended', 'varchar');
     // Players
     $output['content']['players'] = array();
     $output['content']['players']['online'] = Neuron_GameServer::getServer()->countOnlineUsers();
     $output['content']['players']['lastFive'] = Neuron_GameServer::getServer()->countOnlineUsers(60 * 5);
     $output['content']['players']['lastHour'] = Neuron_GameServer::getServer()->countOnlineUsers(60 * 60);
     $output['content']['players']['lastDay'] = Neuron_GameServer::getServer()->countOnlineUsers(60 * 60 * 24);
     $output['content']['players']['lastWeek'] = Neuron_GameServer::getServer()->countOnlineUsers(60 * 60 * 24 * 7);
     $output['content']['players']['lastMonth'] = Neuron_GameServer::getServer()->countOnlineUsers(60 * 60 * 24 * 31);
     $output['content']['players']['total'] = Neuron_GameServer::getServer()->countTotalPlayers();
     if ($extended) {
         $output['content']['premium'] = array();
         $output['content']['premium']['online'] = Neuron_GameServer::getServer()->countPremiumPlayers();
         $output['content']['premium']['lastFive'] = Neuron_GameServer::getServer()->countPremiumPlayers(60 * 5);
         $output['content']['premium']['lastHour'] = Neuron_GameServer::getServer()->countPremiumPlayers(60 * 60);
         $output['content']['premium']['lastDay'] = Neuron_GameServer::getServer()->countPremiumPlayers(60 * 60 * 24);
コード例 #18
0
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  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']) {
コード例 #19
0
{
    global $color_cache;
    if (!isset($color_cache[$color[0] . '_' . $color[1] . '_' . $color[2]])) {
        $color_cache[$color[0] . '_' . $color[1] . '_' . $color[2]] = imagecolorallocate($im, $color[0], $color[1], $color[2]);
    }
    return $color_cache[$color[0] . '_' . $color[1] . '_' . $color[2]];
}
Neuron_Profiler_Profiler::getInstance()->setForceActivate(false);
if (isset($_GET['x']) && isset($_GET['y'])) {
    $extension = 'png';
    $cache = Neuron_Core_Cache::__getInstance('worldmap/');
    $width = Neuron_Core_Tools::getInput('_GET', 'width', 'int', 250);
    $height = Neuron_Core_Tools::getInput('_GET', 'height', 'int', 250);
    $zoom = Neuron_Core_Tools::getInput('_GET', 'zoom', 'int', 0);
    $x = Neuron_Core_Tools::getInput('_GET', 'x', 'int', 0);
    $y = Neuron_Core_Tools::getInput('_GET', 'y', 'int', 0);
    // Fetch cache
    $cachename = 'gw4_' . $zoom . '_' . $x . '_' . $y . '_' . $width . 'x' . $height;
    $image = $cache->getCache($cachename, 60 * 60 * 24 * 7);
    //$image = false;
    if ($image) {
        header("Content-type: image/" . $extension);
        header("Expires: " . gmdate("D, d M Y H:i:s", time() + 60 * 60 * 12) . " GMT");
        echo $image;
    } else {
        $im = imagecreate($width, $height);
        $background = imagecolorallocate($im, 0, 0, 0);
        // Allocate black
        //$black = imagecolorallocate ($im, array (0, 0, 0));
        // Prepare all colours
        $colors = array();
コード例 #20
0
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  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.
 */
$sAction = isset($sInputs[1]) ? $sInputs[1] : null;
$sOutput = Neuron_Core_Tools::getInput('_GET', 'output', 'varchar');
switch ($sOutput) {
    case 'print':
        break;
    case 'json':
    default:
        if ($sAction != 'plainmap') {
            header('Content-type: application/json');
        }
        break;
}
switch ($sAction) {
    case 'images':
        include self::SCRIPT_PATH . 'map/images.php';
        break;
    case 'region':
コード例 #21
0
ファイル: underworld.php プロジェクト: Toxicat/dolumar
 *  http://www.catlab.eu/
 *  http://www.dolumar.com/
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  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.
 */
require_once 'bootstrap/bootstrap.php';
if (isset($_GET['debug'])) {
    $_SESSION['debug'] = $_GET['debug'];
}
if (isset($_SESSION['debug'])) {
    define('DEBUG', $_SESSION['debug']);
}
$mission_id = Neuron_Core_Tools::getInput('_GET', 'id', 'int');
$mission = Dolumar_Underworld_Mappers_MissionMapper::getFromId($mission_id);
$game = new Dolumar_Underworld_Game($mission);
$server = Neuron_GameServer::getInstance();
$server->setGame($game);
$server->setDispatchURL(ABSOLUTE_URL . 'underworld.php?id=' . $mission_id . '&module=');
$server->dispatch();
コード例 #22
0
 private function getResetPlayer($objUser)
 {
     $seckey = Neuron_Core_Tools::getInput('_POST', 'seckey', 'varchar');
     $message = Neuron_Core_Tools::getInput('_POST', 'message', 'varchar');
     $title = Neuron_Core_Tools::getInput('_POST', 'title', 'varchar');
     // Fetch my account
     $myAccount = Neuron_GameServer::getPlayer();
     $sKey = 'kick_' . $objUser->getId();
     $page = new Neuron_Core_Template();
     $page->set('username', Neuron_Core_Tools::output_varchar($objUser->getName()));
     if ($sKey == $seckey && $title && $message) {
         // Send a mail to this user
         $this->addModeratorAction('reset', array('plid' => $objUser->getId(), 'title' => $title, 'message' => $message), Neuron_Core_Tools::getInput('_POST', 'reason', 'varchar'), $objUser);
         /*
         customMail ($objUser->getEmail (), $title, $message);
         $objUser->execResetAccount ();
         */
         $page->set('isDone', true);
     } else {
         $page->set('isDone', false);
     }
     $page->set('action', $this->getUrl('user', array('id' => $objUser->getId(), 'action' => 'reset')));
     $page->set('seckey', $sKey);
     $page->set('myname', Neuron_Core_Tools::output_varchar($myAccount->getName()));
     return $page->parse('pages/admin/user/kick.phpt');
 }
コード例 #23
0
<?php

$village1 = Neuron_Core_Tools::getInput('_GET', 'village1', 'int');
$village2 = Neuron_Core_Tools::getInput('_GET', 'village2', 'int');
$v1 = Dolumar_Players_Village::getVillage($village1);
$v2 = Dolumar_Players_Village::getVillage($village2);
echo 'Calculating distance between ' . $v1->getName() . ' to ' . $v2->getName() . '<br />';
$l1 = $v1->buildings->getTownCenterLocation();
$l2 = $v2->buildings->getTownCenterLocation();
$distance = Dolumar_Map_Map::getDistanceBetweenVillages($v1, $v2);
$straight = Dolumar_Map_Map::calculateDistance($l1[0], $l1[1], $l2[0], $l2[1]);
$profiler = Neuron_Profiler_Profiler::getInstance();
echo '<h2>Profiler</h2>';
echo '<pre>';
echo $profiler;
echo '</pre>';
echo '<p>Distance: <strong>' . $distance . '</strong><br />';
echo 'Straight line distance: <strong>' . $straight . '</strong></p>';
コード例 #24
0
<?php

$input = Neuron_Core_Tools::getInput('_POST', 'bbcode', 'varchar');
?>

<h2>Input</h2>
<form method="post">
	<fieldset>
		<ol>
			<li>
				<label>BBCode:</label>
				<textarea name="bbcode" cols="100" rows="20"><?php 
echo $input;
?>
</textarea>
			</li>
			
			<li>
				<button type="submit"><span>Submit</span></button>
			</li>
		</ol>
	</fieldset>
</form>

<h2>Output</h2>
<?php 
echo '<pre>' . htmlentities(Neuron_Core_Tools::output_text($input)) . '</pre>';
コード例 #25
0
ファイル: Player.php プロジェクト: Toxicat/dolumar
 public function getPreferences()
 {
     return array('buildingClick' => Neuron_Core_Tools::getInput('_COOKIE', COOKIE_PREFIX . 'prefBC', 'int', 0), 'minimapPosition' => Neuron_Core_Tools::getInput('_COOKIE', COOKIE_PREFIX . 'prefMP', 'int', 0));
 }
コード例 #26
0
    }
}
// All equipment
/*
$gv->addCluster ("EQUIPMENT", "Equipment");
$eqs = Dolumar_Players_Equipment::getAllEquipment();
foreach ($eqs as $building)
{
	$gv->addNode ($building->getName (), $equip_atts, "EQUIPMENT");
	
	// Required technologies?
	foreach ($building->getRequiredTechnologies () as $tech)
	{
		$label = null;
		$gv->addEdge (array ($tech->getName () => $building->getName ()), array_merge ($arrow_atts, array ('label' => $label)));
	}
}
*/
// All units
$output = Neuron_Core_Tools::getInput('_GET', 'engine', 'varchar');
switch ($output) {
    case "dot":
    case "neato":
        break;
    default:
        $output = "dot";
        break;
}
if (!$gv->image("png", $output)) {
    echo "Error... Is Graphviz installed?";
}
コード例 #27
0
ファイル: Techtree.php プロジェクト: Toxicat/dolumar
 public function getOutput()
 {
     //echo get_include_path ();
     require_once 'Image/GraphViz.php';
     $race = Dolumar_Races_Race::getFromId(Neuron_Core_Tools::getInput('_GET', 'race', 'int', 1));
     $default_settings = array('fontsize' => 8);
     $default_node_settings = $default_settings;
     $default_node_settings['shape'] = 'box';
     $tech_atts = $default_node_settings;
     $tech_atts['bgcolor'] = 'ff0000';
     $tech_atts['color'] = 'blue';
     $equip_atts = $default_node_settings;
     $equip_atts['bgcolor'] = 'ff0000';
     $equip_atts['color'] = 'red';
     $equip_atts['rankdir'] = 'tb';
     $equip_atts['constraint'] = false;
     $unit_atts = $default_node_settings;
     $unit_atts['bgcolor'] = 'ff0000';
     $unit_atts['color'] = 'green';
     $arrow_atts = $default_settings;
     $arrow_atts['arrowType'] = 'normal';
     $arrow_atts['fontsize'] = '6';
     $grayarrow_atts = $arrow_atts;
     $grayarrow_atts['color'] = 'gray';
     define('UNIT_PREFIX', '[U] ');
     define('TECHNOLOGY_PREFIX', '[T] ');
     define('BUILDING_PREFIX', '[B] ');
     define('EQUIPMENT_PREFIX', '[E] ');
     $show_equipment = Neuron_Core_Tools::getInput('_GET', 'equipment', 'int', 0) == 1;
     $show_technology = Neuron_Core_Tools::getInput('_GET', 'technology', 'int', 0) == 1;
     $show_units = Neuron_Core_Tools::getInput('_GET', 'units', 'int', 0) == 1;
     $gv = new Image_GraphViz(true, array('label' => $race->getName(), 'labelloc' => 't'));
     // All buildings
     $gv->addCluster("BUILDINGS", "Buildings");
     if ($show_technology) {
         $gv->addCluster("TECHNOLOGY", "Technology");
     }
     //$gv->addCluster ("EQUIPMENT", "Equipment");
     if ($show_equipment) {
         $gv->addCluster("weapon", "Weapons", array('rotate' => '90'));
         $gv->addCluster("armour", "Armour", array());
     }
     if ($show_units) {
         $gv->addCluster("UNITS", "Units");
     }
     $buildings = Dolumar_Buildings_Building::getBuildingObjects($race);
     foreach ($buildings as $building) {
         $building->setVillage(new Dolumar_Players_DummyVillage($race));
         //$building->setRace ($race);
         // Add building
         $gv->addNode(BUILDING_PREFIX . $building->getName(), $default_node_settings, "BUILDINGS");
         // Add building requirements
         foreach ($building->getRequiredBuildings() as $req) {
             $label = $req['amount'] . '+';
             $gv->addEdge(array(BUILDING_PREFIX . $req['building']->getName() => BUILDING_PREFIX . $building->getName()), array_merge($arrow_atts, array('label' => $label)));
         }
         // Technologies
         if ($show_technology) {
             foreach ($building->getTechnologies() as $tech) {
                 $label = 'Level ' . $tech->getMinLevel();
                 $gv->addNode(TECHNOLOGY_PREFIX . $tech->getName(), $tech_atts, "TECHNOLOGY");
                 $gv->addEdge(array(BUILDING_PREFIX . $building->getName() => TECHNOLOGY_PREFIX . $tech->getName()), array_merge($arrow_atts, array('label' => $label)));
                 // requirements for the technologies?
                 foreach ($tech->getRequiredTechnologies() as $req) {
                     $label = null;
                     $gv->addEdge(array(TECHNOLOGY_PREFIX . $req->getName() => TECHNOLOGY_PREFIX . $tech->getName()), array_merge($arrow_atts, array('label' => $label)));
                 }
             }
         }
         // Equipment
         if ($building instanceof Dolumar_Buildings_Crafting && $show_equipment) {
             foreach ($building->getEquipment() as $equip) {
                 //$gv->addNode (EQUIPMENT_PREFIX . $equip->getName (), $equip_atts, "EQUIPMENT");
                 $gv->addNode(EQUIPMENT_PREFIX . $equip->getName(), $equip_atts, $equip->getItemType());
                 // Arrow to this building
                 $label = $equip->getRequiredLevel() > 0 ? 'Level ' . $equip->getRequiredLevel() : null;
                 //$gv->addEdge (array (BUILDING_PREFIX . $building->getName () => EQUIPMENT_PREFIX . $equip->getName ()), array_merge ($arrow_atts, array ('label' => $label)));
                 $gv->addEdge(array(BUILDING_PREFIX . $building->getName() => EQUIPMENT_PREFIX . $equip->getName()), array_merge($grayarrow_atts, array('label' => $label, 'ltail' => 'EQUIPMENT')));
                 // Required technologies?
                 foreach ($equip->getRequiredTechnologies() as $tech) {
                     $label = null;
                     $gv->addEdge(array(TECHNOLOGY_PREFIX . $tech->getName() => EQUIPMENT_PREFIX . $equip->getName()), array_merge($grayarrow_atts, array('label' => $label)));
                 }
             }
         }
         // Units
         if ($building instanceof Dolumar_Buildings_Training && $show_units) {
             foreach ($building->getUnits() as $unit) {
                 // Units!
                 $gv->addNode(UNIT_PREFIX . $unit->getName(), $unit_atts, "UNITS");
                 // Arrow to this building
                 $label = null;
                 $gv->addEdge(array(BUILDING_PREFIX . $building->getName() => UNIT_PREFIX . $unit->getName()), array_merge($grayarrow_atts, array('label' => $label)));
                 // Required technologies?
                 foreach ($unit->getRequiredTechnologies() as $tech) {
                     $label = null;
                     $gv->addEdge(array(TECHNOLOGY_PREFIX . $tech->getName() => UNIT_PREFIX . $unit->getName()), array_merge($grayarrow_atts, array('label' => $label)));
                 }
             }
         }
     }
     // All equipment
     /*
     $gv->addCluster ("EQUIPMENT", "Equipment");
     $eqs = Dolumar_Players_Equipment::getAllEquipment();
     foreach ($eqs as $building)
     {
     	$gv->addNode ($building->getName (), $equip_atts, "EQUIPMENT");
     	
     	// Required technologies?
     	foreach ($building->getRequiredTechnologies () as $tech)
     	{
     		$label = null;
     		$gv->addEdge (array ($tech->getName () => $building->getName ()), array_merge ($arrow_atts, array ('label' => $label)));
     	}
     }
     */
     // All units
     $output = Neuron_Core_Tools::getInput('_GET', 'engine', 'varchar');
     switch ($output) {
         case "dot":
         case "neato":
             break;
         default:
             $output = "dot";
             break;
     }
     if (!$gv->image("png", $output)) {
         echo "Error... Is Graphviz installed?";
     }
 }
コード例 #28
0
<?php

$village = Dolumar_Players_Village::getVillage(Neuron_Core_Tools::getInput('_GET', 'village', 'int'));
$village->processBattles();
コード例 #29
0
    $width = $fontsize[2] - $fontsize[0];
    $dim = IMG_WIDTH / IMG_HEIGHT;
    if ($dim > 2) {
        // Right bottom
        $dest = array(floor(IMG_WIDTH - $width) - 5, IMG_HEIGHT - 13 + $size / 2);
    } else {
        // Center bottom
        $dest = array(floor(IMG_WIDTH / 2 - $width / 2), IMG_HEIGHT - 18 + $size / 2);
    }
    imagettftext($im, $size, 0, $dest[0], $dest[1], $color, $font, $name);
}
define('IMG_WIDTH', isset($_GET['width']) ? (int) $_GET['width'] : 800);
define('IMG_HEIGHT', isset($_GET['height']) ? (int) $_GET['height'] : 400);
define('IMG_ZOOM', isset($_GET['zoom']) ? (int) $_GET['zoom'] : 100);
// Check for data
if (isset($player_id)) {
    $player = Neuron_GameServer::getPlayerFromOpenID($player_id, true);
    if ($player && $player->isFound()) {
        $village = $player->getMainVillage();
        if ($village) {
            $loc = $village->buildings->getTownCenterLocation();
            define('LOC_X', $loc[0]);
            define('LOC_Y', $loc[1]);
        } else {
            define('LOC_X', isset($_GET['x']) ? (int) $_GET['x'] : 0);
            define('LOC_Y', isset($_GET['x']) ? (int) $_GET['y'] : 0);
        }
    } else {
        define('LOC_X', isset($_GET['x']) ? (int) $_GET['x'] : 0);
        define('LOC_Y', isset($_GET['x']) ? (int) $_GET['y'] : 0);
    }
コード例 #30
0
<?php

define('NOTIFICATION_DEBUG', true);
$player = Dolumar_Players_Player::getFromId(Neuron_Core_Tools::getInput('_GET', 'user', 'int'));
//echo '<h1>With sender & private</h1>';
//$player->sendNotification ('test', 'system', array ('user' => $other), $other);
echo '<h1>Updating profilebox</h1>';
/*
	$pl_attacker->sendNotification 
	(
		'attacking', 
		'battle', 
		array
		(
			'defender' => $oTarget,
			'pl_defender' => $oTarget->getOwner (),
			'village' => $this
		),
		$pl_attacker,
		true // This is a public message
	);
*/
$player->updateScore();
echo '<p style="color: green;">Players ' . $player->getName() . ' profilebox has been updated.</p>';