Beispiel #1
0
error_reporting(E_ALL);
session_start();
set_time_limit(0);
require_once './../../constants.php';
// Konstanten
require_once FUNC_PATH . 'autoload.php';
// Autoloader für Klassen
require_once FUNC_PATH . 'buildSiteUrl.php';
// Autoloader für Klassen
require_once WORLD . 'config.php';
// Konfiguration
World_Base::$DB = new DatabaseInterface($config['mySql']['host'], $config['mySql']['user'], $config['mySql']['pass'], $config['mySql']['db']);
$mapList = World_Map::getMapList();
// Formularverarbeitung
foreach ($mapList as $mapData) {
    $map = new World_Map($mapData['id']);
    if ($map->getId() !== 0) {
        echo $map->getDisplayName() . ' ';
        $editor = new World_Map_Editor($mapData['id']);
        // LayerCode parsen
        $editor->parseLayerCode();
        // PkmnCode parsen
        $editor->parsePkmnCode();
        if ($editor->saveData()) {
            echo "OK<br />";
        } else {
            echo "Fehler<br />";
        }
        ob_flush();
    }
}
error_reporting(E_ALL);
session_start();
set_time_limit(0);
require_once './../../constants.php';
// Konstanten
require_once FUNC_PATH . 'autoload.php';
// Autoloader für Klassen
require_once FUNC_PATH . 'buildSiteUrl.php';
// Autoloader für Klassen
require_once WORLD . 'config.php';
// Konfiguration
World_Base::$DB = new DatabaseInterface($config['mySql']['host'], $config['mySql']['user'], $config['mySql']['pass'], $config['mySql']['db']);
// Maps auslesen
$mapList = World_Map::getMapList();
foreach ($mapList as $mapData) {
    $map = new World_Map($mapData['id']);
    if ($map->getId() !== 0) {
        $mapId = $map->getId();
        echo $map->getDisplayName() . ' ';
        $fields = array('attr_indoor', 'attr_storage_pc', 'attr_trade', 'attr_trainer_fight', 'attr_heal');
        $where = 'map_id=' . $mapId;
        if (World_Base::$DB->selectByWhere(TABLE_CONST_MAP_ATTRIBUTE, $fields, $where)) {
            $row = World_Base::$DB->getRow();
            $flags = 0;
            if ($row['attr_indoor'] == 1) {
                $flags = $flags | World_Map::FLAG_INDOOR;
            }
            if ($row['attr_storage_pc'] == 1) {
                $flags = $flags | World_Map::FLAG_STORAGE_PC;
            }
            if ($row['attr_trade'] == 1) {
Beispiel #3
0
 function __construct($mapId)
 {
     parent::__construct($mapId);
     $this->_parser = new World_Map_Parser();
 }
Beispiel #4
0
 /**
  * konvertiert Code in ein LayerObjekt
  * @param $codeLine string
  * @return string
  */
 function compileLine($codeLine)
 {
     $layerObject = false;
     // feststellen, ob Zeile ein Tag enthält
     // '<', '>' und sonstige Zeichen ausserhalb des Tags entfernen
     $lineRegex = '@.*<([a-z]+) .*>.*@i';
     if (preg_match($lineRegex, $codeLine, $lineMatch)) {
         $tagName = $lineMatch[1];
         $attributes = $this->readAttributesFromLine($codeLine);
         // Attribute überprüfen
         if ($this->hasAllAttributes(array_keys($attributes), $tagName)) {
             switch ($tagName) {
                 case 'pfeil':
                     $graphic = GAME_GRAPHICS_ABSOLUTE_PATH . 'pfeil_' . $attributes['richtung'] . '.png';
                     if (file_exists($graphic)) {
                         $dimensions = getimagesize($graphic);
                         $layerObject = new World_Map_LayerObject('pfeil_' . $attributes['richtung'], $attributes['left'], $attributes['top'], $dimensions[0], $dimensions[1], $attributes['hover'], buildSiteUrl('map', 'changemap', 'map=' . World_Map::getIdFromName($attributes['to'])));
                         $this->drawOnImage($graphic, $attributes['left'], $attributes['top']);
                     }
                     break;
                 case 'olink':
                     $layerObject = new World_Map_LayerObject('olink', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('map', 'changemap', 'map=' . World_Map::getIdFromName($attributes['to'])));
                     break;
                 case 'umove':
                     // $layerObject = new World_Map_LayerObject('umove', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], '?site=attack&id=' . urlencode($attributes['move']));
                     // break;
                 // $layerObject = new World_Map_LayerObject('umove', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], '?site=attack&id=' . urlencode($attributes['move']));
                 // break;
                 case 'hover':
                     $layerObject = new World_Map_LayerObject('hover', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover']);
                     break;
                 case 'plink':
                     $layerObject = new World_Map_LayerObject('plink', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], '...', buildSiteUrl('fight', '', 'field=' . $attributes['field']));
                     break;
                 case 'plinka':
                     $layerObject = new World_Map_LayerObject('plinka', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], '...', buildSiteUrl('fight', '', 'field=' . $attributes['field']));
                     break;
                 case 'pokebox':
                     $layerObject = new World_Map_LayerObject('pokebox', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('storagePc'));
                     break;
                 case 'heal':
                     $layerObject = new World_Map_LayerObject('heal', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('map', 'heal'));
                     break;
                 case 'shop':
                     $layerObject = new World_Map_LayerObject('shop', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('shop', '', 'id=' . $attributes['shopid']));
                     break;
                 case 'pokeshop':
                     $layerObject = new World_Map_LayerObject('pokeshop', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('pokeshop', '', 'id=' . $attributes['shopid']));
                     break;
                 case 'tkampf':
                     $layerObject = new World_Map_LayerObject('tkampf', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('trainerFight'));
                     break;
                 case 'tausch':
                     $layerObject = new World_Map_LayerObject('trade', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('trade'));
                     break;
                 case 'giveitem':
                     $layerObject = new World_Map_LayerObject('giveitem', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('map', 'giveItem', 'id=' . $attributes['itemid']), $attributes['itemdid']);
                     break;
                 case 'img':
                     $graphic = GAME_GRAPHICS_ABSOLUTE_PATH . $attributes['src'];
                     if (file_exists($attributes['src'])) {
                         $dimensions = getimagesize($attributes['src']);
                         $layerObject = new World_Map_LayerObject('img', $attributes['left'], $attributes['top'], $dimensions[0], $dimensions[1], $attributes['hover']);
                         $this->drawOnImage($attributes['src'], $attributes['left'], $attributes['top']);
                     }
                     break;
                 case 'npc':
                     $layerObject = new World_Map_LayerObject('npc', $attributes['left'], $attributes['top'], $attributes['width'], $attributes['height'], $attributes['hover'], buildSiteUrl('npc', 'id=' . $attributes['id']));
                     break;
                 default:
                     $layerObject = false;
             }
             if ($layerObject !== false) {
                 // optionale Attribute verarbeiten
                 $optionalAttributes = $this->_tags[$tagName]->getOptionalAttributes();
                 foreach ($optionalAttributes as $optAttr) {
                     if (isset($attributes[$optAttr])) {
                         $attributeValue = $attributes[$optAttr];
                         switch ($optAttr) {
                             case 'condition_attack':
                                 $layerObject->addCondition('attack', $attributeValue);
                                 break;
                             case 'condition_item':
                                 $layerObject->addCondition('item', $attributeValue);
                                 break;
                         }
                     }
                 }
             }
         }
     }
     return $layerObject;
 }
Beispiel #5
0
$user = World_Base::$USER;
/** Map darstellen **/
$map = $user->getMap();
if (!$map instanceof World_Map) {
    $user->error('Konnte Map nicht laden.', __FILE__, Error::CRIT);
    $map = new World_Map(1);
}
// Layerobjekte mit Bedingungen prüfen
$layerObjects = $map->getLayerObjects();
// Template aufbauen
$template->templateFile = 'map.html';
$template->templateMacro = 'map';
$template->contentTitle = $map->getAreaName();
$template->mapName = $map->getDisplayName();
$template->mapAreaName = $map->getAreaName();
$template->mapImagePath = $map->getImagePath();
$template->mapId = $map->getId();
$template->mapWidth = $map->getWidth();
$template->mapHeight = $map->getHeight();
$template->layerObjects = $layerObjects;
// Anschlussbilder vorladen
$accessList = $map->getAccessList();
$javascriptContent[] = 'var preloadMaps = new Array(';
foreach ($accessList as $mapId) {
    $preloadMap = new World_Map($mapId);
    $javascriptContent[] = '"' . $preloadMap->getImagePath() . '",';
}
$javascriptContent[] = 'false); preloadImages(preloadMaps, false);
changeContentTitle("worldContentTitle", "' . $map->getAreaName() . '");';
// Tooltips anzeigen
$javascriptContent[] = '$$("#mapLayer area").each(function(input) { new Tooltip(input); });';
Beispiel #6
0
        }
        $editor->setFlags($flags);
        // LayerCode parsen
        $editor->parseLayerCode();
        // PkmnCode parsen
        $editor->parsePkmnCode();
        if ($editor->saveData()) {
            $template->successMessage = 'Karte erfolgreich gespeichert.';
        } else {
            $template->failedMessage = 'Es trat ein Fehler beim Speichern der Karte auf; überprüfe die Logdateien für mehr Informationen.';
        }
    }
}
// Map laden
if ($mapId !== false) {
    $map = new World_Map($mapId);
    if ($map->getId() !== 0) {
        $mapData = array();
        $mapData['id'] = $map->getId();
        $mapData['name'] = $map->getDisplayName();
        $mapData['areaName'] = $map->getAreaName();
        $mapData['imageName'] = basename($map->getImagePath());
        $mapData['layerCode'] = $map->getLayerCode();
        $mapData['pkmnCode'] = $map->getPkmnCode();
        // Flags setzen
        $flags = $map->getFlags();
        $mapData['attributes'] = array();
        $mapData['attributes']['indoor'] = $flags & World_Map::FLAG_INDOOR ? true : false;
        $mapData['attributes']['storagePc'] = $flags & World_Map::FLAG_STORAGE_PC ? true : false;
        $mapData['attributes']['trade'] = $flags & World_Map::FLAG_TRADE ? true : false;
        $mapData['attributes']['trainerFight'] = $flags & World_Map::FLAG_TRAINER_FIGHT ? true : false;
Beispiel #7
0
<?php

$user = World_Base::$USER;
$template->templateFile = 'teleport.html';
$template->templateMacro = 'teleport';
$template->contentTitle = 'Teleport';
$template->mapList = World_Map::getMapList();
/** Benutzer teleportieren **/
if (isset($_POST['changeMap'])) {
    $targetMapId = $_POST['changeMap'];
    if ($targetMapId !== false) {
        $user->changeMap($targetMapId, true);
        $template->successMessage = 'Benutzer erfolgreich auf Karte # ' . $targetMapId . ' teleportiert';
    } else {
        $template->failedMessage = 'Karte # ' . $targetMapId . ' wurde nicht gefunden. Teleport fehlgeschlagen.';
    }
}