예제 #1
0
파일: Gifts.php 프로젝트: Toxicat/dolumar
 private function getSend()
 {
     $text = Neuron_Core_Text::getInstance();
     $page = new Neuron_Core_Template();
     $player = Neuron_GameServer::getPlayer();
     $results = $player->invitePeople('runesender', 'gifts', 'runereceiver', 'gifts');
     if ($results['success']) {
         if (!empty($results['iframe'])) {
             $width = isset($results['width']) ? $results['width'] : 500;
             $height = isset($results['height']) ? $results['height'] : 400;
             $this->closeWindow();
             Neuron_GameServer::getInstance()->openWindow('Iframe', array('title' => $text->get('gifts', 'menu', 'main'), 'url' => $results['iframe'], 'width' => $width, 'height' => $height));
         } else {
             return $page->parse('dolumar/gifts/done.phpt');
         }
     } else {
         return '<p class="false">' . $results['error'] . '</p>';
     }
 }
예제 #2
0
function openNewWindow($sWindow, $aParams = array())
{
    $server = Neuron_GameServer::getInstance();
    $server->openWindow($sWindow, $aParams);
}
예제 #3
0
// 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 {
            //$this->alert ('reloading ' . $v['mu_x'] . ',' . $v['mu_y']);
            $object = Neuron_GameServer::getInstance()->getMap()->getMapObjectManager()->getFromUOID($v['mu_uoid']);
            $out['objects'][] = $object->getExportData();
        }
    }
    $attributes['last'] = $last;
}
echo Neuron_Core_Tools::output_xml($out, '1', 'updates', $attributes);
예제 #4
0
 *  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();
예제 #5
0
 public function invitePeople($txtMsgKeySender, $txtMsgSectionSender, $txtMsgKeyReceiver, $txtMsgSectionReceiver, $maxPerInterval = 1, $maxReceiverPerInterval = 0, $interval = 604800, $inputData = array())
 {
     // First: load this users OpenID notification urls
     $openid_rows = Neuron_GameServer_Mappers_PlayerMapper::getOpenIDs($this);
     $text = $this->getRightLanguage();
     if (count($openid_rows) > 0) {
         $server = Neuron_GameServer::getInstance()->getServer();
         $servername = new Neuron_GameServer_Logable_String($server->getServerName());
         $inputData = array_merge(array('sender' => $this, 'server' => $servername), $inputData);
         $keyvalues = array();
         foreach ($inputData as $k => $v) {
             $keyvalues[$k] = $v->getName();
         }
         $senderMessage = Neuron_Core_Tools::putIntoText($text->get($txtMsgKeySender, $txtMsgSectionSender, 'notifications'), $keyvalues);
         $receiverMessage = Neuron_Core_Tools::putIntoText($text->get($txtMsgKeyReceiver, $txtMsgSectionReceiver, 'notifications'), $keyvalues);
         // Load OpenID accounts and send Browser Games Hub notifications
         $objNot = new BrowserGamesHub_Invitation($senderMessage, $receiverMessage, $maxPerInterval, $maxReceiverPerInterval, $interval, $text->getCurrentLanguage());
         $objNot->setIcon(STATIC_URL . 'icon.png');
         $objNot->setId($txtMsgKeySender, $txtMsgSectionSender);
         $objNot->setSenderData($this->getBrowserBasedGamesData());
         // Keep in mind that the notification does not like actual names,
         // so we will replace all key names with their numeric value.
         $keys = array_keys($inputData);
         $replace_keys = array();
         foreach ($keys as $k => $v) {
             if ($v != 'actor') {
                 $replace_keys[$v] = '{' . $k . '}';
             } else {
                 $replace_keys[$v] = '{actor}';
             }
         }
         $objNot->setSkeletonSender(Neuron_Core_Tools::putIntoText($text->get($txtMsgKeySender, $txtMsgSectionSender, 'notifications'), $replace_keys));
         $objNot->setSkeletonReceiver(Neuron_Core_Tools::putIntoText($text->get($txtMsgKeyReceiver, $txtMsgSectionReceiver, 'notifications'), $replace_keys));
         $callback = API_FULL_URL . 'invitation/?id=' . $this->getId();
         $objNot->setCallback($callback);
         // Take all the value strings and put them in there aswell
         foreach ($inputData as $v) {
             if ($v instanceof Dolumar_Players_Player) {
                 $objNot->addArgument($v->getName(), 'user', $v->getBrowserBasedGamesData());
             } elseif ($v instanceof Neuron_GameServer_Interfaces_Logable) {
                 $objNot->addArgument($v->getName(), 'text');
             } else {
                 $objNot->addArgument($v, 'text');
             }
         }
         // Send the notification
         foreach ($openid_rows as $v) {
             return $objNot->send($v['notify_url']);
         }
     }
     return array('success' => false, 'error' => 'No OpenID providers set.');
 }