コード例 #1
0
 public static function newPlanet($StarsystemID, $Name, $RX, $RY, $CourseRotation, $CourseDuration)
 {
     $P = new Planet(-1);
     $A = $P->newAttributes();
     $A->PlanetStarsystemID = $StarsystemID;
     $A->PlanetName = $Name;
     $A->PlanetRX = $RX;
     $A->PlanetRY = $RY;
     $A->PlanetCourseRotation = $CourseRotation;
     $A->PlanetCourseDuration = $CourseDuration;
     $P->setA($A);
     $P->newMe();
 }
コード例 #2
0
ファイル: FleetEditor.class.php プロジェクト: sonicmaster/RPG
 /**
  * Creates a new fleet.
  *
  * @param	int		start planet id
  * @param	int		end planet id
  * @param	array	ships
  * @param	int		galaxy
  * @param	int		system
  * @param	int		planet
  * @param	float	metal
  * @param	float	crystal
  * @param	float	deuterium
  * @param	float	duration
  * @param	int		mission id
  * @param	float	time
  * @param	int		package id
  * @return	FleetEditor
  */
 public static function create($startPlanetID, $endPlanetID, $ships, $galaxy, $system, $planet, $metal, $crystal, $deuterium, $duration, $missionID, $time = null, $packageID = PACKAGE_ID)
 {
     if ($time === null) {
         $time = round(microtime(true), 2);
     }
     $startPlanet = Planet::getInstance($startPlanetID);
     $targetPlanet = Planet::getInstance($endPlanetID);
     // init vars
     FleetQueue::readCache();
     $classPath = FleetQueue::$cache[$missionID]['classPath'];
     $ownerID = Planet::getInstance($startPlanetID)->id_owner;
     $ofiaraID = Planet::getInstance($endPlanetID)->id_owner;
     $impactTime = $time + $duration;
     $returnTime = $time + $duration * 2;
     // insert fleet
     $fleetID = self::insert($startPlanetID, $endPlanetID, $ownerID, $ofiaraID, $galaxy, $system, $planet, $metal, $crystal, $deuterium, $time, $impactTime, $returnTime, $missionID, $packageID);
     // create events
     $impactEvent = WOTEventEditor::create(1, $fleetID, array('state' => 0), $impactTime);
     $returnEvent = WOTEventEditor::create(1, $fleetID, array('state' => 1), $returnTime);
     // register events
     $fleetEditor = new FleetEditor($fleetID);
     $fleetEditor->update(array('impactEventID' => $impactEvent->eventID, 'returnEventID' => $returnEvent->eventID));
     // inserts ships
     $fleetEditor->updateShips($ships);
     // add to log
     $fleet = Fleet::getInstance($fleetID);
     FleetLog::create($fleet);
     return $fleetEditor;
 }
コード例 #3
0
ファイル: Hex.php プロジェクト: bizley/imperium
 /**
  * Creates new hex based on params.
  * @param array|string $data
  * @param boolean $hidden
  * @param string $owner player
  * @return Hex
  */
 public static function create($data, $hidden = false, $owner = null)
 {
     $hex = new Hex();
     if (is_array($data)) {
         $hex->setType(self::TYPE_SPACE);
         if (!empty($data['planets'])) {
             foreach ($data['planets'] as $name) {
                 $hex->getPlanets()->add(Planet::create($name, $owner));
             }
         }
         if (!empty($data['wormhole'])) {
             $hex->setWormhole($data['wormhole']);
         }
     } else {
         switch ($data) {
             case self::WORMHOLE_ALPHA:
             case self::WORMHOLE_BETA:
                 $hex->setType(self::TYPE_SPACE);
                 $hex->setWormhole($data);
                 break;
             case self::TYPE_SPACE:
             case self::TYPE_NEBULA:
             case self::TYPE_ASTEROID:
             case self::TYPE_NOVA:
                 $hex->setType($data);
         }
     }
     if ($hidden) {
         $hex->setHidden($hidden);
     }
     return $hex;
 }
コード例 #4
0
ファイル: ConstructorsTest.php プロジェクト: websublime/enum
 public function testVenus()
 {
     // Now that VENUS has data attached we can use her public properties
     $venus = Planet::VENUS();
     $this->assertInstanceOf('Planet', $venus);
     print sprintf('Venus is also a %s.', $venus->related) . PHP_EOL;
 }
コード例 #5
0
 /**
  * Returns the planet object of the end planet
  *
  * @return	Planet	instance of Planet
  */
 public function getEndPlanet()
 {
     if ($this->endPlanet === null) {
         $planet = Planet::getInstance($this->endPlanetID);
     } else {
         $planet = $this->endPlanet;
     }
     return $planet;
 }
コード例 #6
0
ファイル: Constructors.php プロジェクト: websublime/enum
 public static function __()
 {
     // Within this static initializer, we can attach data by doing a 'constructor' call (without the new keyword)
     // Let's attach the inhabitant's name and a related object/service that is identical to the planet's name
     Planet::MERCURY('Mercurian', 'Chemical element');
     Planet::VENUS('Venusian', 'Roman goddess of love');
     Planet::EARTH('Terrestrial', 'Soil we walk on');
     // Note how static and/or self can also be used as they point to Planet. This ensures a robust enum definition withstanding any future name changes
     static::MARS('Martian', 'Well-known candy bar');
     self::PLUTO('Plutonian', 'Fictional Disney character');
 }
コード例 #7
0
 public function getView($planetId)
 {
     $planet = Planet::find($planetId);
     // Если такой планеты нет, то вернем пользователю ошибку 404 - Не найдено
     if (!$planet) {
         App::abort(404);
     }
     // Увеличим счетчик просмотров планеты
     $planet->views++;
     $planet->save();
     return View::make('planets/view', array('planet' => $planet));
 }
コード例 #8
0
ファイル: Planet.php プロジェクト: j30206868/OGame-Robot
 public static function getPlanets()
 {
     $Config = ConfigManager::declareConfigValue();
     //get overview page html
     $overview = GlobalFunc::httpGet($Config['OVERVIEW_URL'], $Config['COOKIE_FILE']);
     $ov_dom = GlobalFunc::loadHtml($overview);
     $planet_list_dom = $ov_dom->getElementById("planetList");
     $pList = $planet_list_dom;
     if (!is_object($pList)) {
         echo "Error occur, Planet List not found, return empty planet list.\n";
         return array();
     }
     //list 下 每個div都是一個星球
     //每個div下都有兩個span
     //<span class="planet-name  ">jones4</span>
     //<span class="planet-koords  ">[1:83:6]</span>
     $planets_dom = $pList->getElementsByTagName('div');
     //echo "There ". $planets_dom->length . " Planet(s).";
     //存放月亮的起始編號(最後一顆星球之後就是月亮)
     $moon_num = $planets_dom->length + 1;
     //create planets
     $planets = array();
     for ($i = 0; $i < $planets_dom->length; $i++) {
         //get planet link
         $a_list = $planets_dom->item($i)->getElementsByTagName('a');
         $a_dom = $a_list->item(0);
         //產生星球
         $planet = Planet::createPlanetObj($a_dom, $planets_dom, $i);
         //將星球obj 加入list
         $planets[$i] = $planet;
         //確認是否有月球
         $has_moon = false;
         $moon_href = "";
         $moon_coord = array();
         $a_count = $a_list->length;
         $moon_obj = array();
         Planet::updateMoonInfo($a_list, $a_count, $planet, $has_moon, $moon_href, $moon_coord);
         if ($has_moon == true) {
             //有月亮則加到清單最後面
             $moon_obj = new Planet("月亮", $moon_coord, null, $moon_href, $moon_num);
             //將月亮obj 加入list
             //idx為編號-1
             $planets[$moon_num - 1] = $moon_obj;
             $moon_num++;
             //月亮編號+1
         }
     }
     return $planets;
 }
コード例 #9
0
 public function createPlanets()
 {
     $numberOfPlanets = mt_rand(5, 8);
     for ($i = 0; $i < $numberOfPlanets; $i++) {
         $CourseRadius = pow($i + 1, 1.5) * 50;
         $CourseDist = mt_rand(2, 8) / 10;
         $rx = $CourseRadius * $CourseDist;
         $ry = $CourseRadius - $rx;
         $rd = ($rx + $ry) / 2;
         #1209600
         $CourseDuration = $CourseRadius * 12096;
         #echo $CourseDist."\n";
         Planet::newPlanet($this->ID, "Planet " . ($i + 1), $rx, $ry, round(mt_rand(0, 360)), $CourseDuration);
     }
 }
コード例 #10
0
 /**
  * @see Page::readData
  */
 public function readData()
 {
     global $user;
     parent::readData();
     $features = unserialize(WCF::getUser()->diliziumFeatures);
     if (!isset($features['galaxyScans']) || $features['galaxyScans'] <= TIME_NOW) {
         message('Dir steht diese Funktion nicht zur Verf&uuml;gung!');
     }
     // get planet
     $this->planetObj = Planet::getInstance($this->planetID);
     $subject = 'Spionagebericht von ' . $this->planetObj;
     $this->reports = EspionageFleet::searchReports(WCF::getUser()->userID, $this->planetID);
     if (!count($this->reports)) {
         message('Kein Spionagebericht gefunden!');
     }
 }
コード例 #11
0
ファイル: Planet.php プロジェクト: bizley/imperium
 /**
  * Creates new planet based on params.
  * @param string $name
  * @param string $owner player
  * @return Planet
  */
 public static function create($name, $owner = null)
 {
     if (empty(Planets::$data[$name])) {
         return null;
     }
     $data = Planets::$data[$name];
     $planet = new Planet();
     $planet->setName($data['name']);
     $planet->setResources($data['resources']);
     $planet->setInfluence($data['influence']);
     if (!empty($data['specialty'])) {
         $planet->setSpecialty($data['specialty']);
     }
     if (!empty($owner)) {
         $planet->setOwner($owner);
     }
     return $planet;
 }
コード例 #12
0
 /**
  * Buguser protection
  */
 protected function checkQueue()
 {
     global $resource, $user;
     check_user();
     // check
     $sql = "SELECT * FROM ugml_galactic_jump_queue\n\t\t\t\tWHERE userID = " . WCF::getUser()->userID;
     $result = WCF::getDB()->getResultList($sql);
     if (count($result) != 1 || $result[0]['time'] != $user['onlinetime'] || $result[0]['state'] != 3) {
         message('Bug-User-Schutz, bitte erneut losschicken!');
     }
     $this->fleet = unserialize($result[0]['ships']);
     foreach ($this->fleet as $shipTypeID => $count) {
         if (LWCore::getPlanet()->{$resource[$shipTypeID]} < $count) {
             message('Zu viele Schiffe ausgew&auml;hlt!');
         }
     }
     $this->moonObj = Planet::getInstance($result[0]['endPlanetID']);
     // save
     $sql = "DELETE FROM ugml_galactic_jump_queue\n\t\t\t\tWHERE queueID = " . $result[0]['queueID'];
     WCF::getDB()->registerShutdownUpdate($sql);
 }
コード例 #13
0
ファイル: overviewController.php プロジェクト: Nykus/xnova
 private function __construct()
 {
     require 'core/models/class.User.php';
     require 'core/models/implement.Menu.php';
     require 'core/models/class.Planet.php';
     require 'core/models/implement.Topnav.php';
     global $id_user, $id_planet;
     $lng = new Lang();
     $menu = new Menu($id_user);
     $topnav = new Topnav($id_planet, $id_user);
     $user = new User($id_user);
     $planet = new Planet($id_planet);
     require 'core/functions/class.UpdateStats.php';
     $update = new UpdateStats();
     $db = new Connect();
     $sql = $db->query("SELECT COUNT(*) id FROM usuarios;");
     $total_rank = $db->recorrer($sql);
     $db->liberar($sql);
     $db->close();
     $template = new Smarty();
     $template->assign(array('usuario_email' => $user->UserEmail(), 'usuario_faccion' => $user->UserFaction(), 'usuario_puntos' => $user->UserPoints(), 'usuario_top' => $user->TopUser(), 'total_rank' => number_format($total_rank[0], '0', ',', '.'), 'campos' => $planet->PlanetFields(), 'diametro' => $planet->PlanetDiameter(), 'temperatura' => $planet->PlanetTemperature(), 'p' => $planet->PlanetOrbit(), 's' => $planet->PlanetSystem(), 'nombre_planeta' => $planet->PlanetName(), 'imagen_planeta' => $planet->PlanetImage()));
     $template->display('overview/overview.xnv');
 }
コード例 #14
0
 /**
  * Updates the building ovent for a planet.
  *
  * @param	int		planet id
  */
 public static function check($planetID)
 {
     $ovents = Ovent::getByConditions(array('planetID' => $planetID, 'oventTypeID' => self::OVENT_TYPE_ID));
     $planet = Planet::getInstance($planetID);
     // event needed
     if ($planet->b_building > time()) {
         if (isset($ovents[0])) {
             if ($ovents[0]->time == $planet->b_building) {
                 // no changes needed
                 return;
             }
             // delete old ovent
             $ovents[0]->getEditor()->delete();
         }
         // create new
         $data = self::getData($planet);
         $fields = array('userID' => $planet->id_owner, 'planetID' => $planetID);
         OventEditor::create(self::OVENT_TYPE_ID, $planet->b_building, null, $planetID, $fields, 0, $data);
     } else {
         foreach ($ovents as $ovent) {
             $ovent->getEditor()->delete();
         }
     }
 }
コード例 #15
0
require_once "FleetCommander.php";
date_default_timezone_set('Asia/Taipei');
//error_reporting(E_DEPRECATED); 連error都沒有
//error_reporting(E_ERROR);
//error_reporting(-1);
$Config = ConfigManager::declareConfigValue();
//結束時會取得一次overview page
$loginManager = new LoginManager();
echo "\nThreaten Count: " . $Config['ThreatenCount'] . "\n";
//會取得一次overview page
$PLANETS = Planet::getPlanets();
if ($PLANETS) {
    $loginManager->start();
    $ResourceManager = new RecourseManager($PLANETS);
    $ResourceManager->start();
    if (isset($PLANETS)) {
        echo "AttackDetector is Constructed, " . sizeof($PLANETS) . " planet(s) is protected.\n";
    } else {
        echo "Failed to get planet list, login and get planet list again.\n";
        $loginManager->newSessionGetOverview();
        $PLANETS = Planet::getPlanets();
    }
    for ($i = 0; $i < sizeof($PLANETS); $i++) {
        echo iconv("UTF-8", "big5", "Planet(" . $PLANETS[$i]->num . "): " . $PLANETS[$i]->name . "[" . $PLANETS[$i]->coord[0] . ":" . $PLANETS[$i]->coord[1] . ":" . $PLANETS[$i]->coord[2] . "](" . $PLANETS[$i]->coord[3] . ") is detected.\n");
        $_defender = new Defender($PLANETS[$i]->coord, $Config['SHIELD'], $PLANETS[$i]->href, $PLANETS[$i]);
        $PLANETS[$i]->defender = $_defender;
        $PLANETS[$i]->defender->start();
    }
} else {
    die;
}
コード例 #16
0
ファイル: options.php プロジェクト: sonicmaster/RPG
     }
     // check buildings
     $sql = "SELECT *\r\n\t\t\t\tFROM ugml_planets\r\n\t\t\t\tWHERE (b_building_id != 0\r\n\t\t\t\t\tOR b_tech_id != 0\r\n\t\t\t\t\tOR b_hangar_id != '')\r\n\t\t\t\t\tAND id_owner = " . WCF::getUser()->userID;
     $planet = WCF::getDB()->getFirstRow($sql);
     if ($planet) {
         message('Du hast auf dem ' . Planet::getInstance(null, $planet) . ' noch etwas in Bau!');
     }
     if (!$fleet && !$planet && !$user['urlaubs_modus']) {
         $urlaubs_modus = time() + 60 * 60 * 24 * 2;
     } else {
         $urlaubs_modus = $user['urlaubs_modus'];
     }
 } else {
     if ($user['urlaubs_modus']) {
         // umode bug workaround
         $planets = Planet::getByUserID(WCF::getUser()->userID);
         foreach ($planets as $planet) {
             $planet->calculateResources();
         }
     }
     if (TIME_NOW > $user['urlaubs_modus']) {
         $urlaubs_modus = 0;
     } else {
         $urlaubs_modus = $user['urlaubs_modus'];
     }
 }
 //Borrar cuenta
 if (isset($_POST["db_deaktjava"]) && $_POST["db_deaktjava"] == 'on') {
     $db_deaktjava = "1";
 } else {
     $db_deaktjava = "0";
コード例 #17
0
 /**
  * Checks if the user requests a planet change.
  */
 protected function checkPlanetChange()
 {
     if (!(isset($_GET['cp']) || isset($_POST['cp'])) || !(isset($_REQUEST['page']) || isset($_REQUEST['form']) || isset($_REQUEST['action']))) {
         return;
     }
     $planetID = isset($_GET['cp']) ? intval(@$_GET['cp']) : intval(@$_POST['cp']);
     $planets = Planet::getByUserID($this->userID);
     if (isset($planets[$planetID])) {
         $this->changePlanet($planetID, $planets[$planetID]->className);
         // now create new request without planet change (forwarding)
         unset($_REQUEST['cp']);
         if (isset($_REQUEST['re'])) {
             unset($_REQUEST['re']);
         }
         $location = LWUtil::getFileName() . '.php' . LWUtil::getArgsStr();
         WCF::getDB()->deleteShutdownUpdates();
         header('Location: ' . $location);
         exit;
     }
 }
コード例 #18
0
<?php

$fullData = false;
$username = trim($_POST["identifiant"]);
$password = trim($_POST["motdepasse"]);
$email = trim($_POST["email"]);
$nameMainPlanet = trim($_POST["PM"]);
$id_language = (int) $_POST['Lang'];
if (isset($username) && respectsLengthWord($username, ">=", 3) && isset($password) && respectsLengthWord($password, ">=", 3) && isset($email) && respectsLengthWord($email, ">=", 3) && isset($nameMainPlanet) && respectsLengthWord($nameMainPlanet, ">=", 3) && isset($id_language)) {
    $fullData = true;
}
//Toutes les informations sont complètes...
if ($fullData) {
    if (!UtilisateurDAO::userExistByUsernameAndEmail($username, $email)) {
        //Création planète
        $p = new Planet();
        $p->assignValueDefault();
        //Création utilisateur
        $u = new User();
        $u->id_language = $id_language;
        $u->username = $username;
        $u->hash_password = encodePassword($password);
        $u->email = $email;
        UtilisateurDAO::add($u);
        $message = $lang['sign_finish'] . "" . $username . "" . $lang['return_mail'];
        MessageSIWE::showAjaxMessage($message, $lang['title_sign'] . $lang['title_game'], null, MessageSIWE::MESSAGE_SUCCESS);
    } else {
        MessageSIWE::showAjaxMessage($lang['error_isset_user'], $lang['title_sign'], null, MessageSIWE::MESSAGE_ERROR);
    }
} else {
    MessageSIWE::showAjaxMessage($lang['error_champs_empty'], $lang['title_sign'] . $lang['title_game'], null, MessageSIWE::MESSAGE_ERROR);
コード例 #19
0
ファイル: index.php プロジェクト: KasaiDot/Fansubs.cat
if ($debug) {
    error_reporting(E_ALL);
} else {
    error_reporting(0);
}
include_once dirname(__FILE__) . '/app/classes/Planet.class.php';
include_once dirname(__FILE__) . '/app/lib/Cache.php';
//Load configuration
if (is_file(dirname(__FILE__) . '/custom/config.yml')) {
    $conf = Spyc::YAMLLoad(dirname(__FILE__) . '/custom/config.yml');
    $PlanetConfig = new PlanetConfig($conf);
} else {
    die('Config file (custom/config.yml) is missing.');
}
//Instantiate app
$Planet = new Planet($PlanetConfig);
$bench['codeloaded'] = microtime(true);
//Load from cache
$items = array();
if (0 < $Planet->loadOpml(dirname(__FILE__) . '/custom/people.opml')) {
    $Planet->loadFeeds();
    $items = $Planet->getItems();
}
$bench['contentloaded'] = microtime(true);
//Prepare output cache
Cache::$enabled = false;
$cache_key = count($items) ? $items[0]->get_id() : '';
$last_modified = count($items) ? $items[0]->get_date() : '';
$cache_duration = $PlanetConfig->getOutputTimeout() * 60;
Cache::setStore(dirname(__FILE__) . '/' . $conf['cachedir']);
//Go display
コード例 #20
0
ファイル: ataki.php プロジェクト: sonicmaster/RPG
function saveData(&$fleetData, $combatData, $report)
{
    global $resource, $lang;
    /**
     * Apply defender ships and booty
     */
    $ships = "";
    foreach ($combatData['lastRoundData']['defenderData'] as $shipTypeID => $shipData) {
        $count = $shipData['count'];
        if (isset($combatData['recreatedDefense'][$shipTypeID])) {
            $count += $combatData['recreatedDefense'][$shipTypeID];
        }
        if (isset($count)) {
            $ships .= $resource[$shipTypeID] . " = '" . $count . "', ";
        }
    }
    doquery("UPDATE {{table}} SET\n\t\t" . $ships . "\n\t\tmetal = metal - '" . $combatData['booty']['metal'] . "',\n\t\tcrystal = crystal - '" . $combatData['booty']['crystal'] . "',\n\t\tdeuterium = deuterium - '" . $combatData['booty']['deuterium'] . "'\n\t\tWHERE id = '" . $fleetData['endPlanetID'] . "' LIMIT 1", 'planets');
    $ships = "";
    $attackerShipsCount = 0;
    foreach ($combatData['lastRoundData']['attackerData'] as $shipTypeID => $shipData) {
        $ships .= $shipTypeID . "," . $shipData['count'] . ";";
        $attackerShipsCount += $shipData['count'];
    }
    /**
     * Update fleet of the attacker
     */
    doquery("UPDATE {{table}} SET\n\t\tfleet_amount = '" . $shipData['count'] . "',\n\t\tfleet_array = '" . $ships . "',\n\t\tfleet_resource_metal = fleet_resource_metal + '" . $combatData['booty']['metal'] . "',\n\t\tfleet_resource_crystal = fleet_resource_crystal + '" . $combatData['booty']['crystal'] . "',\n\t\tfleet_resource_deuterium = fleet_resource_deuterium + '" . $combatData['booty']['deuterium'] . "',\n\t\tfleet_mess = '1'\n\t\tWHERE fleet_id = '" . $fleetData['fleet_id'] . "' LIMIT 1", 'fleets');
    $fleetData['fleet_amount'] = $combatData['count'];
    $fleetData['fleet_array'] = $ships;
    $fleetData['fleet_resource_metal'] = $combatData['booty']['metal'];
    $fleetData['fleet_resource_crystal'] = $combatData['booty']['crystal'];
    $fleetData['fleet_resource_deuterium'] = $combatData['booty']['deuterium'];
    $fleetData['fleet_mess'] = 1;
    /**
     * Apply debris
     */
    /*if(WCF::getUser()->userID != 143) {
    		doquery("UPDATE {{table}} SET
    			metal = metal + '".$combatData['debris']['metal']."',
    			crystal = crystal + '".$combatData['debris']['crystal']."'
    			WHERE galaxy = '".$fleetData['fleet_end_galaxy']."'
    			AND system = '".$fleetData['fleet_end_system']."'
    			AND planet = '".$fleetData['fleet_end_planet']."' LIMIT 1", 'galaxy');
    	} else {*/
    require_once LW_DIR . 'lib/data/planet/Debris.class.php';
    $debrisID = Debris::exists($fleetData['fleet_end_galaxy'], $fleetData['fleet_end_system'], $fleetData['fleet_end_planet']);
    if ($debrisID) {
        Planet::getInstance($debrisID)->addRessources($combatData['debris']['metal'], $combatData['debris']['crystal']);
    } else {
        Debris::create($fleetData['fleet_end_galaxy'], $fleetData['fleet_end_system'], $fleetData['fleet_end_planet'], $combatData['debris']['metal'], $combatData['debris']['crystal']);
    }
    //}
    /**
     * Delete fleet of the attacker if it have been destroyed
     */
    if ($combatData['winner'] == 'defender') {
        doquery("DELETE FROM {{table}} WHERE fleet_id=" . $fleetData["fleet_id"], 'fleets');
    }
    /**
     * Insert moon
     */
    if ($combatData['moon']['size'] !== null) {
        $fields = floor(pow($combatData['moon']['size'] / 1000, 2));
        $sql = "INSERT INTO ugml" . LW_N . "_planets\n\t\t\t\tSET name = 'Mond',\n\t\t\t\t\tid_owner = '" . $combatData['defender'] . "',\n\t\t\t\t\tgalaxy = '" . $fleetData['fleet_end_galaxy'] . "',\n\t\t\t\t\tsystem = '" . $fleetData['fleet_end_system'] . "',\n\t\t\t\t\tplanet = '" . $fleetData['fleet_end_planet'] . "',\n\t\t\t\t\tlast_update = '" . $fleetData['fleet_start_time'] . "',\n\t\t\t\t\timage = 'mond',\n\t\t\t\t\tdiameter = '" . $combatData['moon']['size'] . "',\n\t\t\t\t\tfield_max = '" . $fields . "',\n\t\t\t\t\ttemp_min = '" . ($combatData['moon']['temp'] - 40) . "',\n\t\t\t\t\ttemp_max = '" . $combatData['moon']['temp'] . "',\n\t\t\t\t\tclassName = 'UserMoon',\n\t\t\t\t\tplanet_type = '3'";
        WCF::getDB()->registerShutdownUpdate($sql);
        $sql = "UPDATE ugml" . LW_N . "_planets\n\t\t\t\tSET moon = '1'\n\t\t\t\tWHERE id = '" . $fleetData['endPlanetID'] . "'";
        WCF::getDB()->registerShutdownUpdate($sql);
    }
    /**
     * Save report
     */
    $rid = md5($report);
    if ($combatData['winner'] == 'defender' && $combatData['rounds'] == 1) {
        $firstRoundDestroyedAttacker = true;
    } else {
        $firstRoundDestroyedAttacker = false;
    }
    doquery("INSERT INTO {{table}} SET\n\t\ttime = '" . $fleetData['fleet_start_time'] . "',\n\t\tid_owner1 = '" . $fleetData['fleet_owner'] . "',\n\t\tid_owner2 = '" . $combatData['defender'] . "',\n\t\trid = '" . $rid . "',\n\t\ta_zestrzelona  = '" . $firstRoundDestroyedAttacker . "',\n\t\traport = '" . mysql_escape_string($report) . "'", 'rw');
    $message = "<a class=\"thickbox\" href=\"rw.php?raport=" . $rid . "&keepThis=true&TB_iframe=true&height=400&width=500\"><font color=\"red\">" . $lang['combat_report'] . " [" . $fleetData['fleet_end_galaxy'] . ":" . $fleetData['fleet_end_system'] . ":" . $fleetData['fleet_end_planet'] . "] (V:" . $combatData['units']['defender'] . "), A:(" . $combatData['units']['attacker'] . ")</font></a>";
    doquery("INSERT INTO {{table}} SET\n\t\tmessage_owner = '" . $fleetData['fleet_owner'] . "',\n\t\tmessage_sender = '',\n\t\tmessage_time = '" . $fleetData['fleet_start_time'] . "',\n\t\tmessage_type = '3',\n\t\tmessage_from = '" . $lang['combat_report_sender'] . "',\n\t\tmessage_subject = '" . $lang['combat_report_subject'] . "',\n\t\tmessage_text = '" . $message . "'", 'messages');
    doquery("UPDATE {{table}} SET new_message = new_message + 1 WHERE id = '" . $fleetData['fleet_owner'] . "'", 'users');
    doquery("INSERT INTO {{table}} SET\n\t\tmessage_owner = '" . $combatData['defender'] . "',\n\t\tmessage_sender = '',\n\t\tmessage_time = '" . $fleetData['fleet_start_time'] . "',\n\t\tmessage_type = '3',\n\t\tmessage_from = '" . $lang['combat_report_sender'] . "',\n\t\tmessage_subject = '" . $lang['combat_report_subject'] . "',\n\t\tmessage_text = '" . $message . "'", 'messages');
    doquery("UPDATE {{table}} SET new_message = new_message + 1 WHERE id = '" . $combatData['defender'] . "'", 'users');
}
コード例 #21
0
ファイル: Debris.class.php プロジェクト: sonicmaster/RPG
 /**
  * Creates a new debris
  *
  * @param	int		galaxy
  * @param	int		system
  * @param	int		planet
  * @param	float	metal
  * @param	float	crystal
  *
  * @return	Debris	created Object
  */
 public static function create($galaxy, $system, $planet, $metal = 0.0, $crystal = 0.0)
 {
     $time = self::getDeletionTime();
     $sql = "INSERT INTO ugml" . LW_N . "_planets\r\n\t\t\t\tSET name = 'Trümmerfeld',\r\n\t\t\t\t\tid_owner = '0',\r\n\t\t\t\t\tgalaxy = '" . $galaxy . "',\r\n\t\t\t\t\tsystem = '" . $system . "',\r\n\t\t\t\t\tplanet = '" . $planet . "',\r\n\t\t\t\t\tlast_update = '" . $time . "',\r\n\t\t\t\t\timage = 'debris',\r\n\t\t\t\t\tdiameter = '0',\r\n\t\t\t\t\tfield_max = '0',\r\n\t\t\t\t\ttemp_min = '-140',\r\n\t\t\t\t\ttemp_max = '-100',\r\n\t\t\t\t\tclassName = 'Debris',\r\n\t\t\t\t\tplanet_type = '2',\r\n\t\t\t\t\tmetal = metal + '" . $metal . "',\r\n\t\t\t\t\tcrystal = crystal + '" . $crystal . "'";
     WCF::getDB()->sendQuery($sql);
     $row = array('id' => WCF::getDB()->getInsertID(), 'name' => 'Trümmerfeld', 'id_owner' => 0, 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'last_update' => $time, 'image' => 'debris', 'diameter' => 0, 'field_max' => 0, 'temp_min' => -140, 'temp_max' => -100, 'className' => 'Debris', 'planet_type' => 2, 'metal' => $metal, 'crystal' => $crystal);
     $planet = Planet::getInstance(null, $row);
     // register
     self::$createdDebris[$galaxy][$system][$planet->planet] = $planet->planetID;
     return $planet;
 }
コード例 #22
0
ファイル: UserPlanet.class.php プロジェクト: sonicmaster/RPG
 /**
  * Returns the attached moon.
  */
 public function getMoon()
 {
     if ($this->moonID == 0) {
         $sql = "SELECT *\r\n\t    \t\t\tFROM ugml_planets\r\n\t    \t\t\tWHERE galaxy = " . $this->galaxy . " AND system = " . $this->system . " AND planet = " . $this->planet . " AND planetKind = 3";
         $row = WCF::getDB()->getFirstRow($sql);
         if (!$row) {
             $this->moonID = -1;
             return null;
         }
         $moon = Planet::getInstance(null, $row);
         $this->moonID = $moon->planetID;
         return $moon;
     } else {
         if ($this->moonID == -1) {
             return null;
         }
     }
     return Planet::getInstance($this->moonID);
 }
コード例 #23
0
while ($testtmp = mysql_fetch_array($tmp)) {
    if ($_SESSION["Id"] != $testtmp["besitzer"]) {
        $betray = true;
    }
}
if ($betray && $testid > 0) {
    echo 'Du bist nicht eingeloggt oder du versucht auf fremde Accounts zuzugreifen...';
} else {
    //CHEATSCHUTZ ENDE
    $besitzer = $_SESSION["Id"];
    $pid = $_GET["pid"];
    $modul = "orbit";
    $modul .= $_GET["modul"];
    $modulid = $_GET["modul"];
    $sub = $_POST["sub"];
    $aktPlanet = new Planet();
    $aktPlanet->getData($pid);
    if ($sub == 1) {
        //ausbauen
        $abfrage = mysql_query("SELECT * FROM `{$modul}` WHERE pid='{$pid}'");
        while ($tmp = mysql_fetch_array($abfrage)) {
            $getmodul = $tmp["modultyp"];
            $aktbau = $tmp["bauzeit"];
        }
        //if(bezahlbar('rohA',$pid,$stufe))
        if ($getmodul == "") {
            $stufe = 1;
        } else {
            if ($getmodul[6] == '') {
                $stufe = $getmodul[5] + 1;
            } else {
コード例 #24
0
ファイル: Planet.bla.class.php プロジェクト: sonicmaster/RPG
 /**
  * Cleans the cache
  */
 public static function clean()
 {
     self::$planets = array();
 }
コード例 #25
0
 /**
  * Returns the target planet.
  * 
  * @return	Planet
  */
 public function getTargetPlanet()
 {
     return Planet::getInstance($this->endPlanetID);
 }
コード例 #26
0
ファイル: Planet.class.php プロジェクト: sonicmaster/RPG
 /**
  * Returns all planets of a user.
  * 
  * @param	int		user id
  * @param	int		planet kind (optional)
  * @param	boolean	ordered
  * @return	array	Planets
  */
 public static function getByUserID($userID, $planetKind = null, $ordered = false)
 {
     $planets = array();
     $sql = "SELECT *\r\n\t\t\t\tFROM ugml_planets\r\n\t\t\t\tWHERE id_owner = " . $userID . ($planetKind !== null ? " AND planetKind = " . $planetKind : "") . ($ordered ? " ORDER BY sortID" : "");
     $result = WCF::getDB()->sendQuery($sql);
     while ($row = WCF::getDB()->fetchArray($result)) {
         $planets[$row['id']] = Planet::getInstance(null, $row);
     }
     return $planets;
 }
コード例 #27
0
ファイル: implement.Topnav.php プロジェクト: Nykus/xnova
 public function __construct($id_planet, $id_user)
 {
     $planet = new Planet($id_planet, $id_user);
     $lng = new Lang();
     $metal = $planet->ProdResources()['metal'] == 0 ? '<span style=\'color: red;\'>' . number_format($planet->PlanetMetal(), '0', ',', '.') . '</span>' : number_format($planet->PlanetMetal(), '0', ',', '.');
     $cristal = $planet->ProdResources()['cristal'] == 0 ? '<span style=\'color: red;\'>' . number_format($planet->PlanetCristal(), '0', ',', '.') . '</span>' : number_format($planet->PlanetCristal(), '0', ',', '.');
     $tritio = $planet->ProdResources()['tritio'] == 0 ? '<span style=\'color: red;\'>' . number_format($planet->PlanetTritio(), '0', ',', '.') . '</span>' : number_format($planet->PlanetTritio(), '0', ',', '.');
     $energia_sobrante = $planet->EnergiaSobrante() < 0 ? '<span style=\'color: red;\'>' . number_format($planet->EnergiaSobrante(), '0', ',', '.') . '</span>' : number_format($planet->EnergiaSobrante(), '0', ',', '.');
     $template = new Smarty();
     $template->assign(array('m_general' => $lng->m_general, 'm_abastecimiento' => $lng->m_abastecimiento, 'm_infraestructura' => $lng->m_infraestructura, 'm_comerciante' => $lng->m_comerciante, 'm_tecnologia' => $lng->m_tecnologia, 'm_hangar' => $lng->m_hangar, 'm_defensas' => $lng->m_defensas, 'x_metal' => $lng->x_metal, 'metal' => $metal, 'x_cristal' => $lng->x_cristal, 'cristal' => $cristal, 'x_tritio' => $lng->x_tritio, 'tritio' => $tritio, 'x_energia' => $lng->x_energia, 'energia_total' => number_format($planet->EnergiaTotal(), '0', ',', '.'), 'energia_consumo' => number_format($planet->EnergiaConsumo(), '0', ',', '.'), 'energia_sobrante' => $energia_sobrante, 'x_materia' => $lng->x_materia, 'x_mo' => $lng->x_mo, 'materia' => number_format($planet->PlanetDarkMatter(), '0', ',', '.'), 'p' => $planet->PlanetOrbit(), 's' => $planet->PlanetSystem(), 'nombre_planeta' => $planet->PlanetName(), 'imagen_planeta' => $planet->PlanetImage(), 'x_actual' => $lng->x_actual, 'x_capacidad' => $lng->x_capacidad, 'x_produccion' => $lng->x_produccion, 'x_consumo' => $lng->x_consumo, 'almacen_cristal' => number_format($planet->AlmacenCristal(), 0, ',', '.'), 'almacen_metal' => number_format($planet->AlmacenMetal(), 0, ',', '.'), 'almacen_tritio' => number_format($planet->AlmacenTritio(), 0, ',', '.'), 'almacen_materia' => $lng->x_infinito));
     $template->display('overall/topnav.xnv');
 }
コード例 #28
0
ファイル: index.php プロジェクト: AwsomeMedia/moonmoon
<?php

require_once __DIR__ . '/../app/app.php';
require_once __DIR__ . '/inc/auth.inc.php';
//Load configuration
$config_file = __DIR__ . '/../custom/config.yml';
if (is_file($config_file)) {
    $conf = Spyc::YAMLLoad($config_file);
    $PlanetConfig = new PlanetConfig($conf);
} else {
    die('Config file (custom/config.yml) is missing.');
}
//Instantiate app
$Planet = new Planet($PlanetConfig);
//Load
if (0 < $Planet->loadOpml(__DIR__ . '/../custom/people.opml')) {
    $Planet->loadFeeds();
    $items = $Planet->getItems();
}
$everyone = $Planet->getPeople();
$count_feeds = count($everyone);
$page_id = 'admin-feed';
$footer_extra = <<<FRAGMENT
    <script>
    var allCheckboxes = function(status){
        var form = document.getElementById('feedmanage');
        var selectboxes = form.getElementsByTagName('input');
        for (var i=0; i<selectboxes.length; i++){
            if ('checkbox' == selectboxes[i].type){
                selectboxes[i].checked = status;
            }
コード例 #29
0
ファイル: users.php プロジェクト: HackerDom/ructfe-2015
<?php

require_once 'inc/shortcuts.php';
require_once 'models/User.php';
require_once 'models/Planet.php';
require_once 'models/SessionManager.php';
if (array_key_exists('id', $_GET)) {
    $user_id = (int) $_GET['id'];
    $user = User::find_one(['__pk__' => $user_id]);
    if ($user) {
        $self = $user->id === SessionManager::current_user()->id;
        $planets = Planet::find(['added_by' => $user]);
        render('user', ['user' => $user, 'planets' => $planets, 'self' => $self]);
        exit;
    }
}
$last_users = User::find(['__order_by__' => '-id'], 20);
render('users', ['last_users' => $last_users]);
コード例 #30
0
 /**
  * Creates a new planet.
  */
 protected function createPlanet()
 {
     list($galaxy, $system, $planet) = $this->findCoordinates();
     $planetObj = Planet::create($galaxy, $system, $planet, 'Heimatplanet', $this->data['userid']);
     $sql = "UPDATE ugml_users\r\n\t\t\t\tSET current_planet = " . $planetObj->planetID . ",\r\n\t\t\t\t\tid_planet = " . $planetObj->planetID . ",\r\n\t\t\t\t\tgalaxy = " . $galaxy . ",\r\n\t\t\t\t\tsystem = " . $system . ",\r\n\t\t\t\t\tplanet = " . $planet . "\r\n\t\t\t\tWHERE id = " . $this->data['userid'];
     WCF::getDB()->sendQuery($sql);
 }