コード例 #1
0
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         message('Einloggen!');
     }
     if (in_array($this->production, $this->possibleProductions)) {
         $sql = "UPDATE ugml_planets\n\t\t\t\t\tSET refineryProduction = '" . escapeString($this->production) . "',\n\t\t\t\t\t\trefineryProductionChange = " . time() . "\n\t\t\t\t\tWHERE id = " . LWCore::getPlanet()->id;
         WCF::getDB()->sendQuery($sql);
     }
     header('Location: ../buildings.php');
     exit;
 }
コード例 #2
0
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     global $resource;
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         message('Einloggen!');
     }
     $this->interceptorMissiles = min(max(0, $this->interceptorMissiles), LWCore::getPlanet()->interceptor_misil);
     $sql = "UPDATE ugml_planets\r\n\t\t\t\tSET interceptor_misil = interceptor_misil - " . $this->interceptorMissiles . ",\r\n\t\t\t\t\tsiloSlots = siloSlots - " . $this->interceptorMissiles . "\r\n\t\t\t\tWHERE id = " . LWCore::getPlanet()->planetID;
     WCF::getDB()->registerShutdownUpdate($sql);
     $this->executed();
     header('Location: ../infos.php?gid=502');
     exit;
 }
コード例 #3
0
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     global $resource;
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         message('Einloggen!');
     }
     if (isset($resource[$this->buildingID]) && $this->buildingID < 100 && LWCore::getPlanet()->{$resource[$this->buildingID]} >= 1 && $this->buildingID != 33 && $this->buildingID != 41) {
         $sql = "UPDATE ugml_planets\r\n\t\t\t\t\tSET " . $resource[$this->buildingID] . " = " . $resource[$this->buildingID] . " - 1\r\n\t\t\t\t\tWHERE id = " . LWCore::getPlanet()->planetID;
         WCF::getDB()->registerShutdownUpdate($sql);
         $this->executed();
     }
     header('Location: ../buildings.php');
     exit;
 }
コード例 #4
0
 /**
  * @see Mission::check()
  */
 public static function check(FleetQueue $fleetQueue)
 {
     $alliance = Alliance::getByUserID($fleetQueue->getTargetPlanet()->id_owner);
     $foreignPlanet = $fleetQueue->getTargetPlanet()->id_owner != WCF::getUser()->userID;
     $isBuddy = WCF::getUser()->hasBuddy($fleetQueue->getTargetPlanet()->id_owner);
     $isInAlliance = $alliance !== null && LWCore::getAlliance() !== null && $alliance->allianceID == LWCore::getAlliance()->allianceID;
     if ($fleetQueue->pageNo == 2) {
         WCF::getTPL()->assign('availableTimes', self::$availableTimes);
     }
     if ($fleetQueue->pageNo == 3) {
         $selectedTime = intval(@$_REQUEST['standByTime']);
         if (!in_array($selectedTime, self::$availableTimes)) {
             return false;
         }
     }
     if ($foreignPlanet && ($isBuddy || $isInAlliance)) {
         return true;
     }
     return false;
 }
コード例 #5
0
 /**
  * @see Action::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['mission'])) {
         $this->missionID = LWUtil::checkInt($_REQUEST['mission']);
     }
     if (isset($_REQUEST['metal'])) {
         $this->metal = LWUtil::checkInt($_REQUEST['metal'], 0, LWCore::getPlanet()->metal);
     }
     if (isset($_REQUEST['crystal'])) {
         $this->crystal = LWUtil::checkInt($_REQUEST['crystal'], 0, LWCore::getPlanet()->crystal);
     }
     if (isset($_REQUEST['deuterium'])) {
         $this->deuterium = LWUtil::checkInt($_REQUEST['deuterium'], 0, LWCore::getPlanet()->deuterium);
     }
     //TODO: integrate this in wcf eventlistener readParameters@FleetStartFireAction
     if (isset($_REQUEST['formation'])) {
         $this->formationID = LWUtil::checkInt($_REQUEST['formation']);
     }
 }
コード例 #6
0
 /**
  * @see Page::show
  */
 public function show()
 {
     // check user
     if (!WCF::getUser()->userID) {
         message('Zutritt nicht erlaubt!');
     }
     if (LWCore::getPlanet()->quantic_jump < 1) {
         message('Kein Sprungtor vorhanden!');
     }
     parent::show();
     echo_foot();
 }
コード例 #7
0
ファイル: System.class.php プロジェクト: sonicmaster/RPG
 /**
  * Returns the deuterium that is needed to phalanx this system.
  *
  * @return	int		needed deuterium
  */
 public function getPhalanxCosts()
 {
     $costs = 500 * (abs(LWCore::getPlanet()->system - $this->system) + 2) * pow(0.9, LWCore::getPlanet()->sensor_phalanx) * pow(1 + 0.001 * pow(0.9, LWCore::getPlanet()->sensor_phalanx + 3), LWCore::getPlanet()->phalanx_views + 1);
     return $costs;
 }
コード例 #8
0
 /**
  * @see	Page::readData()
  */
 public function readData()
 {
     $this->getFleetQueue()->startPlanetID = LWCore::getPlanet()->planetID;
     $system = new System($this->galaxy, $this->system);
     $this->planetObj = $system->getPlanet($this->planet, $this->planetKind);
     $this->getFleetQueue()->storePlanet($this->planetObj);
     $this->getFleetQueue()->metal = $this->metal;
     $this->getFleetQueue()->crystal = $this->crystal;
     $this->getFleetQueue()->deuterium = $this->deuterium;
     $this->getFleetQueue()->ships = $this->spec;
     $this->getFleetQueue()->missionID = $this->missionID;
     $this->getFleetQueue()->speedPercent = $this->speedPercent;
     /*var_dump($this);
     		var_dump($this->getFleetQueue()->getConsumption());
     		exit;*/
     for ($speedPercent = 0.9; $speedPercent >= 0.1 && $this->getFleetQueue()->getConsumption() > $this->getFleetQueue()->getCapacity(); $speedPercent -= 0.1) {
         $this->speedPercent = $this->getFleetQueue()->speedPercent = $speedPercent;
     }
 }
コード例 #9
0
ファイル: functions.php プロジェクト: sonicmaster/RPG
function get_building_time($user, $planet, $i)
{
    //solo funciona con los edificios y talvez con las investigaciones
    global $pricelist, $resource, $reslist, $game_config;
    /*
        Formula sencilla para mostrar los costos de construccion.
    
      Mina de Metal: 60*1,5^(nivel-1) Metal y 15*1,5^(nivel-1) Cristal
        Mina de Cristal: 48*1,6^(nivel-1) Metal y 24*1,6^(nivel-1) Cristal
        Sintetizador de Deuterio: 225*1,5^(nivel-1) Metal y 75*1,5^(Nivel-1) Cristal
        Planta energ} Solar: 75*1,5^(nivel-1) Metal y 30*1,5^(Nivel-1) cristal
        Planta Fusion: 900*1,8^(nivel-1) Metal y 360*1,8^(Nivel-1) cristal y 180*1,8^(Nivel-1) Deuterio
        tecnolog} Gravit�: *3 por Nivel.
      Todas las dem� investigaciones y edificios *2^Nivel
    */
    $level = $planet[$resource[$i]] ? $planet[$resource[$i]] : $user[$resource[$i]];
    if (in_array($i, $reslist['build'])) {
        $cost_metal = floor($pricelist[$i]['metal'] * pow($pricelist[$i]['factor'], $level));
        $cost_crystal = floor($pricelist[$i]['crystal'] * pow($pricelist[$i]['factor'], $level));
        $time = ($cost_crystal + $cost_metal) / $game_config['game_speed'] * (1 / ($planet[$resource['14']] + 1)) * pow(0.5, $planet[$resource['15']]);
        $time = floor($time * 60 * 60);
        return $time;
    } elseif (in_array($i, $reslist['tech'])) {
        $cost_metal = floor($pricelist[$i]['metal'] * pow($pricelist[$i]['factor'], $level));
        $cost_crystal = floor($pricelist[$i]['crystal'] * pow($pricelist[$i]['factor'], $level));
        $msbnlvl = $user['intergalactic_tech'];
        if ($msbnlvl < "1") {
            $laborka = $planet[$resource['31']];
        } elseif ($msbnlvl >= "1") {
            $laborka = $planet['laboratory'];
            $sql = "SELECT laboratory\n\t\t\t\t\tFROM ugml_planets\n\t\t\t\t\tWHERE id_owner = '" . WCF::getUser()->userID . "'\n\t\t\t\t\t\tAND id != '" . LWCore::getPlanet()->planetID . "'\n\t\t\t\t\tORDER BY laboratory DESC\n\t\t\t\t\tLIMIT " . WCF::getUser()->intergalactic_tech;
            $laboratories = WCF::getDB()->getResultList($sql);
            foreach ($laboratories as $laboratory) {
                $laborka += $laboratory['laboratory'];
            }
            /*$msbnzapytanie = doquery("SELECT * FROM {{table}} WHERE id_owner='{$user[id]}'", "planets");
            		$i = 0;
            		$laborka_wyn = 0;
            		while ($msbnrow = mysql_fetch_array($msbnzapytanie)){
            			$laborka[$i] = $msbnrow['laboratory'];
            			$tescik[$i] = $msbnrow['name'];
            			$i++;
            		}
            		if ($msbnlvl >= "1"){
            			$laborka_temp =0;
            			for ($j = 1; $j<=$msbnlvl;$j++){
            				asort($laborka);
            				$laborka_temp = $laborka_temp + $laborka[$j-1];
            			}
            		}
            		$laborka = $laborka_temp;*/
            //		foreach ($laborka as $key => $val) {
            //		    echo "; lab[" . $key . "] = " . $val . "<BR>";
            //		    }
            //		echo "$laborka_wyn";
            //		$laborka = $laborka_temp + $laborka_temp1 + $laborka_temp2 + $laborka_temp3 + $laborka_temp4 + $laborka_temp5 + $laborka_temp6 + $laborka_temp7 + $laborka_temp8;
            //		echo"$laborka";
        }
        $time = ($cost_metal + $cost_crystal) / $game_config['game_speed'] / (($laborka + 1) * 2);
        //metodo temporal para mostrar el formato tiempo...
        $time = floor($time * 60 * 60);
        return $time;
        //return 30;
    } elseif (in_array($i, $reslist['defense']) || in_array($i, $reslist['fleet'])) {
        //flota y defensa
        $time = ($pricelist[$i]['metal'] + $pricelist[$i]['crystal']) / $game_config['game_speed'] * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
        //metodo temporal para mostrar el formato tiempo...
        $time = $time * 60 * 60;
        return $time;
    }
}
コード例 #10
0
ファイル: infos.php プロジェクト: sonicmaster/RPG
    $parse['knockDown'] = '<span><a href="game/index.php?action=BuildingKnockDown&buildingID=' . $gid . '">Abrei&szlig;en</a></span>';
} else {
    if ($gid == 502 && LWCore::getPlanet()->interceptor_misil > 1) {
        $parse['knockDown'] = '<form name="interceptormissileknockdown" action="game/index.php?action=InterceptorMissileKnockDown" method="post">
			<input name="interceptorMissiles" type="text" size="2" /><input type="submit" value="Abfangraketen abrei&szlig;en" />
			</form>';
    } else {
        $parse['knockDown'] = '';
    }
}
// refinery
if ($gid == 13) {
    $page .= '<fieldset>
		<legend>
			Produktion
		</legend><form name="refineryProductionForm" action="game/index.php?action=SetRefineryProduction" method="post">';
    if (LWCore::getPlanet()->refineryProductionChange > time() - 60 * 60 * 48) {
        $page .= '<p class="error">Wechsel erst am ' . DateUtil::formatTime(null, LWCore::getPlanet()->refineryProductionChange + 60 * 60 * 48) . ' möglich!</p>';
    } else {
        $select = '<select name="production" onchange="if(confirm(\'Willst du wirklich die Raffinerie-Produktion festsetzen? Sie lässt sich danach für 48 Stunden nicht mehr verändern!\')) document.forms.refineryProductionForm.submit()">';
        $select .= '<option value="metal"' . (LWCore::getPlanet()->refineryProduction == 'metal' ? ' selected = "selected"' : '') . '>Metall</option>';
        $select .= '<option value="crystal"' . (LWCore::getPlanet()->refineryProduction == 'crystal' ? ' selected = "selected"' : '') . '>Kristall</option>';
        $select .= '<option value="deuterium"' . (LWCore::getPlanet()->refineryProduction == 'deuterium' ? ' selected = "selected"' : '') . '>Deuterium</option>';
        $select .= '</select>';
        $page .= 'Ich möchte mit Hilfe der Raffinerie die ' . $select . '-Produktion steigern.';
    }
    $page .= '</form></fieldset>';
}
$parse['datas'] = $page;
$page = parsetemplate(gettemplate('infos_body'), $parse);
display($page, $lang['Information']);
コード例 #11
0
 /**
  * Loads the planet data
  */
 protected function loadPlanetData()
 {
     global $resource;
     $fileName = $this->getReport();
     if ($fileName == '') {
         return;
     }
     $xmlObj = new XML($fileName);
     // fleet
     for ($i = 200; $i < 500; ++$i) {
         if (!isset($resource[$i])) {
             continue;
         }
         $array = $xmlObj->xpath('//*[@id="' . $i . '"]');
         if (!isset($array[0][0])) {
             continue;
         }
         $this->defenderFleets[1]['fleet'][$i] = intval(str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $array[0][0]));
     }
     // tech
     for ($i = 109; $i <= 111; ++$i) {
         if (!isset($resource[$i])) {
             continue;
         }
         $array = $xmlObj->xpath('//*[@id="' . $i . '"]');
         if (!isset($array[0][0])) {
             continue;
         }
         $this->defenderFleets[1]['tech'][$i] = intval(str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $array[0][0]));
     }
     // own techs
     $this->attackerFleets[1]['tech'][109] = LWCore::getUser()->military_tech;
     $this->attackerFleets[1]['tech'][110] = LWCore::getUser()->defence_tech;
     $this->attackerFleets[1]['tech'][111] = LWCore::getUser()->shield_tech;
 }
コード例 #12
0
ファイル: PhalanxPage.class.php プロジェクト: sonicmaster/RPG
 /**
  * @see Page::readData
  */
 public function readData()
 {
     parent::readData();
     // get system
     require_once LW_DIR . 'lib/data/system/System.class.php';
     $this->systemObj = new System($this->galaxy, $this->system);
     // get planet
     $this->planetObj = $this->systemObj->getPlanet($this->planet);
     // get fleets
     $sql = "SELECT ugml_fleet.*,\r\n\t\t\t\t\tugml_naval_formation.formationID,\r\n\t\t\t\t\t\t\t\tGROUP_CONCAT(\r\n\t\t\t\t\t\t\t\t\tCONCAT(specID, ',', shipCount) \r\n\t\t\t\t\t\t\t\t\tSEPARATOR ';')\r\n\t\t\t\t\t\t\t\tAS fleet\r\n\t\t\t\tFROM ugml_fleet\r\n\t\t\t\tLEFT JOIN ugml_naval_formation\r\n\t\t\t\t\tON ugml_fleet.formationID = ugml_naval_formation.formationID\r\n\t\t    \tLEFT JOIN ugml_fleet_spec\r\n\t\t    \t\tON ugml_fleet.fleetID = ugml_fleet_spec.fleetID\r\n\t\t\t\tWHERE targetPlanetID = " . $this->planetObj->planetID . "\r\n\t\t\t\t\tOR startPlanetID = " . $this->planetObj->planetID . "\r\n\t\t\t\tGROUP BY ugml_fleet.fleetID\r\n\t\t\t\tORDER BY ugml_fleet.impactTime,\r\n\t\t\t\t\tugml_fleet.returnTime";
     $fleets = WCF::getDB()->sendQuery($sql);
     $fleetArray = array();
     require_once LW_DIR . 'lib/data/fleet/Fleet.class.php';
     while ($row = WCF::getDB()->fetchArray($fleets)) {
         $fleet = Fleet::getInstance(null, $row);
         $fleetArray += $fleet->getFleetSet($this->planetObj->planetID);
     }
     ksort($fleetArray);
     $this->fleetObjs = $fleetArray;
     // calculate needed deuterium
     // 500 * (ENTFERNUNG + 2) * 0,9 ^ STUFE * (1 + 0,001 * 0,9 ^ (STUFE + 3)) ^ (ANZEIGEN + 1)
     // check phalanx
     if ($this->galaxy != LWCore::getPlanet()->galaxy) {
         message('Unerreichbare Koordinaten!');
     }
     $range = pow(LWCore::getPlanet()->sensor_phalanx, 2) - 1;
     if ($this->system < LWCore::getPlanet()->system - $range) {
         message('Unerreichbare Koordinaten!');
     }
     if ($this->system > LWCore::getPlanet()->system + $range) {
         message('Unerreichbare Koordinaten!');
     }
     if (LWCore::getPlanet()->deuterium < $this->systemObj->getPhalanxCosts()) {
         message('Zu wenig Deuterium vorhanden!');
     }
     if ($this->planetObj->id_owner == WCF::getUser()->userID && WCF::getUser()->userID != 143) {
         message('Du kannst dich nicht selbst phalanxen!');
     }
     if (LWCore::getPlanet()->sensor_phalanx <= 0) {
         message('Unerreichbare Koordinaten!');
     }
     $this->costs = $this->systemObj->getPhalanxCosts();
     $sql = "UPDATE ugml_planets\r\n\t\t\t\tSET deuterium = deuterium - " . $this->costs . ",\r\n\t\t\t\t\tphalanx_views = phalanx_views + 1\r\n\t\t\t\tWHERE id = " . LWCore::getPlanet()->planetID;
     WCF::getDB()->registerShutdownUpdate($sql);
     LWCore::getPlanet()->deuterium -= $this->costs;
     LWCore::getPlanet()->phalanx_views++;
 }
コード例 #13
0
ファイル: buildings.php プロジェクト: sonicmaster/RPG
 $parse['rest_price'] = rest_price($user, $planetrow, $i);
 //Comprobacion si es posible comprarlo
 $is_buyeable = is_buyeable($user, $planetrow, $i);
 $parse['click'] = '';
 if (!$planetrow["b_building_id"] || $features['buildList'] < time()) {
     if (!$building) {
         if ($user["b_tech_planet"] != 0 && $i == 31 && $game_config['allow_invetigate_while_lab_is_update'] != 1) {
             //en caso de que sea el laboratorio y se este investigando algo.
             $parse['click'] = "<font color=#FF0000>{$lang['Teching']}</font>";
             //Muestra la opcion a elegir para construir o ampliar un edificio
         } elseif ($planetrow[$resource[$i]] == 0 && LWCore::getPlanet()->checkFields() && $is_buyeable && $user['urlaubs_modus'] == 0) {
             $parse['click'] = "<a href=\"?bau={$i}\"><font color=#00FF00>{$lang['Build']}</font></a>";
         } elseif (LWCore::getPlanet()->checkFields() && $is_buyeable && $user['urlaubs_modus'] == 0) {
             $nplus = $planetrow[$resource[$i]] + 1;
             $parse['click'] = "<a href=\"?bau={$i}\"><font color=#00FF00>" . str_replace('%n', $nplus, $lang['Update_to_n']) . "</font></a>";
         } elseif (LWCore::getPlanet()->checkFields() && !$is_buyeable || $user['urlaubs_modus'] != 0) {
             if ($planetrow[$resource[$i]] == 0) {
                 $parse['click'] = "<font color=#FF0000>{$lang['Build']}</font>";
             } else {
                 $nplus = $planetrow[$resource[$i]] + 1;
                 $parse['click'] = '<font color=#FF0000>' . str_replace('%n', $nplus, $lang['Update_to_n']) . '</font>';
             }
         } else {
             $parse['click'] = "<font color=#FF0000>{$lang['Planet_full']}</font>";
         }
     } elseif ($planetrow["b_building_id"] == $i) {
         /*
           no lo puedo creer, esta funcionando T_T
         */
         $time = $planetrow["b_building"] - time();
         $t = array();
コード例 #14
0
ファイル: LWCore.class.php プロジェクト: sonicmaster/RPG
 /**
  * Return the actual alliance.
  * 
  * @param	bool	Editor
  * @return	Alliance
  */
 public static function getAlliance($editor = false)
 {
     if ($editor) {
         if (self::$allianceEditor === null) {
             require_once LW_DIR . 'lib/data/user/alliance/AllianceEditor.class.php';
             self::$allianceEditor = Alliance::getByUserID(self::getUser()->userID, true);
         }
         return self::$allianceEditor;
     } else {
         if (self::$alliance === null) {
             require_once LW_DIR . 'lib/data/user/alliance/Alliance.class.php';
             self::$alliance = Alliance::getByUserID(self::getUser()->userID, false);
         }
         return self::$alliance;
     }
 }
コード例 #15
0
 /**
  * Saves a given target to the fleet queue.
  */
 protected function readTarget()
 {
     if (isset($_REQUEST['targetPlanetID'])) {
         $this->targetPlanetID = LWUtil::checkInt($_REQUEST['targetPlanetID']);
     } else {
         if (isset($_REQUEST['galaxy'])) {
             $this->galaxy = LWUtil::checkInt($_REQUEST['galaxy'], 1, 9);
         }
         if (isset($_REQUEST['system'])) {
             $this->system = LWUtil::checkInt($_REQUEST['system'], 1, 499);
         }
         if (isset($_REQUEST['planet'])) {
             $this->planet = LWUtil::checkInt($_REQUEST['planet'], 1, 15);
         }
         if (isset($_REQUEST['planetType'])) {
             $this->planetType = LWUtil::checkInt($_REQUEST['planetType'], 1, 3);
         }
         if (isset($_REQUEST['missionID'])) {
             $this->fleetQueue->missionID = LWUtil::checkInt($_REQUEST['missionID']);
         }
     }
     // planet
     $this->fleetQueue->startPlanetID = LWCore::getPlanet()->planetID;
     $this->planetObj = Planet::getInstance($this->targetPlanetID);
     if ($this->planetObj->planetID) {
         $this->fleetQueue->storePlanet($this->planetObj);
         return;
     }
     $this->systemObj = new System($this->galaxy, $this->system);
     $this->planetObj = $this->systemObj->getPlanet($this->planet, $this->planetType);
     if ($this->planetObj !== null) {
         $this->fleetQueue->storePlanet($this->planetObj);
     }
 }
コード例 #16
0
ファイル: resources.php プロジェクト: sonicmaster/RPG
    $parse['metal_max'] = '<font color="#ff0000">';
} else {
    $parse['metal_max'] = '<font color="#00ff00">';
}
$parse['metal_max'] .= pretty_number($limit / 1000) . " {$lang['k']}</font>";
$limits = LWCore::getPlanet()->getProductionHandler()->getProductorObject('resource')->getLimits('crystal');
$limit = $limits[1];
$planetrow["crystal_max"] = $limit;
//Cristal maximo
if ($limit < $planetrow["crystal"]) {
    $parse['crystal_max'] = '<font color="#ff0000">';
} else {
    $parse['crystal_max'] = '<font color="#00ff00">';
}
$parse['crystal_max'] .= pretty_number($limit / 1000) . " {$lang['k']}";
$limits = LWCore::getPlanet()->getProductionHandler()->getProductorObject('resource')->getLimits('deuterium');
$limit = $limits[1];
$planetrow["deuterium_max"] = $limit;
//Deuterio maximo
if ($limit < $planetrow["deuterium"]) {
    $parse['deuterium_max'] = '<font color="#ff0000">';
} else {
    $parse['deuterium_max'] = '<font color="#00ff00">';
}
$parse['deuterium_max'] .= pretty_number($limit / 1000) . " {$lang['k']}";
//Total de los recursos
$parse['metal_total'] = colorNumber(floor($planetrow['metal_perhour'] * 0.01 * $parse['production_level'] + $parse['metal_basic_income']));
$parse['crystal_total'] = colorNumber(floor($planetrow['crystal_perhour'] * 0.01 * $parse['production_level'] + $parse['crystal_basic_income']));
$parse['deuterium_total'] = colorNumber(floor($planetrow['deuterium_perhour'] * 0.01 * $parse['production_level'] + $parse['deuterium_basic_income']));
$parse['energy_total'] = colorNumber(floor($planetrow['energy_max'] - $planetrow["energy_used"]) + $parse['energy_basic_income']);
//tabla de valores extendidos
コード例 #17
0
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     global $resource;
     parent::execute();
     // check permission
     if (!WCF::getUser()->userID) {
         message('Einloggen!');
     }
     if ($this->metal + $this->crystal + $this->deuterium > $this->storage) {
         message('Zu viele Ressourcen ausgew&auml;hlt!');
     }
     if ($this->metal > LWCore::getPlanet()->metal) {
         message('Zu wenig Metall vorhanden!');
     }
     if ($this->crystal > LWCore::getPlanet()->crystal) {
         message('Zu wenig Kristall vorhanden!');
     }
     if ($this->deuterium + $this->neededDeuterium > LWCore::getPlanet()->deuterium) {
         message('Zu wenig Deuterium vorhanden!');
     }
     // target planet
     $shipStr = "";
     foreach ($this->fleet as $shipTypeID => $count) {
         $shipStr .= $resource[$shipTypeID] . " = " . $resource[$shipTypeID] . " + " . intval($count) . ", ";
     }
     $sql = "UPDATE ugml_planets\n\t\t\t\tSET " . $shipStr . "\n\t\t\t\t\tmetal = metal + " . $this->metal . ",\n\t\t\t\t\tcrystal = crystal + " . $this->crystal . ",\n\t\t\t\t\tdeuterium = deuterium + " . $this->deuterium . ",\n\t\t\t\t\tgalactic_jump_time = " . $this->finishCoolDownTime . "\n\t\t\t\tWHERE id = " . $this->moonObj->planetID;
     WCF::getDB()->sendQuery($sql);
     // start planet
     $shipStr = "";
     foreach ($this->fleet as $shipTypeID => $count) {
         $shipStr .= $resource[$shipTypeID] . " = " . $resource[$shipTypeID] . " - " . intval($count) . ", ";
     }
     $sql = "UPDATE ugml_planets\n\t\t\t\tSET " . $shipStr . "\n\t\t\t\t\tmetal = metal - " . $this->metal . ",\n\t\t\t\t\tcrystal = crystal - " . $this->crystal . ",\n\t\t\t\t\tdeuterium = deuterium - " . ($this->neededDeuterium + $this->deuterium) . ",\n\t\t\t\t\tgalactic_jump_time = " . $this->finishCoolDownTime . "\n\t\t\t\tWHERE id = " . LWCore::getPlanet()->planetID;
     WCF::getDB()->sendQuery($sql);
     WCF::getUser()->changePlanet($this->moonObj->planetID, 'UserMoon');
     $this->executed();
     header('Location: game/index.php?page=FleetStartShips');
     exit;
 }
コード例 #18
0
ファイル: common.php プロジェクト: sonicmaster/RPG
header("Cache-Control: no-cache");
header("Pragma: no-cache");
header("Powered-By: Biggerskimo, Blob, R3NT5CH3R");
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// include basic ugamela files
include $ugamela_root_path . 'includes/debug.class.' . $phpEx;
$debug = new debug();
include $ugamela_root_path . 'includes/constants.' . $phpEx;
include $ugamela_root_path . 'includes/functions.' . $phpEx;
include $ugamela_root_path . 'includes/vars.' . $phpEx;
include $ugamela_root_path . 'includes/db.' . $phpEx;
if (!defined('NO_PLANET_MAKER')) {
    include $ugamela_root_path . 'includes/planet_maker.' . $phpEx;
}
include $ugamela_root_path . 'includes/rank_maker.' . $phpEx;
include $ugamela_root_path . 'includes/strings.' . $phpEx;
include $ugamela_root_path . "language/" . DEFAULT_LANG . "/lang_info.cfg";
// load config
$query = doquery("SELECT * FROM {{table}}", 'config');
while ($row = mysql_fetch_assoc($query)) {
    $game_config[$row['config_name']] = $row['config_value'];
}
// calc resources/check hangar production
if (WCF::getUser()->userID) {
    LWCore::getPlanet()->calculateResources();
    //auto logout if ip differs or last onlinetime 12 hours past
    /*if(WCF::getUser()->onlinetime+60*60*12 <= TIME_NOW) {
    		LWCore::logout();
    		die('<meta http-equiv="Refresh" content="1; URL=index.htm"><script>javascript:top.location.href="index.htm"</script>');
    	}*/
}
コード例 #19
0
ファイル: overview.php プロジェクト: sonicmaster/RPG
                if ($c <= 1) {
                    $c++;
                } else {
                    $ap .= "</tr><tr>";
                    $c = 1;
                }
            }
        }
        $parse['FLOTA_TEST'] = $user['authlevel'] == 1 || $user['authlevel'] == 3 ? '<tr><td><div align="center"><font color="#FFFFFF"><a href="buildings.php?mode=fleet" accesskey="u" target="{mf}">KLIKNIJ TUTAJ NA TEST FLOTY</a></font></div></td></tr>
' : '';
        $parse = $lang;
        $parse['moon_img'] = "";
        $parse['moon'] = "";
        //}
        $moon = WCF::getDB()->getFirstRow("SELECT * FROM ugml" . LW_N . "_planets WHERE galaxy = '" . $planetrow['galaxy'] . "' AND system = '" . $planetrow['system'] . "' AND planet = '" . $planetrow['planet'] . "' AND planet_type = '3'");
        if (intval($moon['galaxy']) && WCF::getUser()->planetClassName == 'UserPlanet') {
            $parse['moon'] = $moon['name'] . '<br /><a href="overview.php?cp=' . $moon['id'] . '&re=0"><img src="' . $dpath . 'planeten/small/s_' . $moon['image'] . '.jpg" height="50" width="50" /></a>';
        }
        $parse['planet_name'] = $planetrow['name'];
        $parse['planet_diameter'] = $planetrow['diameter'];
        $parse['planet_field_current'] = LWCore::getPlanet()->getUsedFields();
        $parse['planet_field_max'] = LWCore::getPlanet()->getMaxFields();
        //$parse['planet_field_max'] = 10;
        $parse['planet_temp_min'] = $planetrow['temp_min'];
        $parse['planet_temp_max'] = $planetrow['temp_max'];
        $parse['galaxy_galaxy'] = $planetrow['galaxy'];
        $parse['galaxy_planet'] = $planetrow['planet'];
        $parse['galaxy_system'] = $planetrow['system'];
        $parse['user_points'] = StringUtil::formatInteger(intval(WCF::getUser()->wotPoints));
        //$parse['user_fleet'] = pretty_number($user['points_fleet_old']/1000); + pretty_number($user['points_builds2']/1000);
        //$parse['user_buili'] = pretty_number($user['points_builds']/1000);
コード例 #20
0
 /**
  * @see Page::assignVariables
  */
 public function assignVariables()
 {
     parent::assignVariables();
     $this->getTargetPlanet();
     WCF::getTPL()->assign(array('fleetQueue' => $this->fleetQueue, 'missions' => $this->missions, 'capacity' => $this->capacity, 'deuterium' => LWCore::getPlanet()->deuterium - $this->fleetQueue->getConsumption()));
     //TODO: integrate this in wcf eventlistener assignVariables@FleetStartResourcesForm
     WCF::getTPL()->assign('navalFormations', NavalFormation::getByTargetPlanetID($this->fleetQueue->getTargetPlanet()->planetID, WCF::getUser()->userID));
 }
コード例 #21
0
 /**
  * @see BotDetectorInterface::saveDetection()
  */
 public function saveDetection()
 {
     $sql = "INSERT INTO ugml_bot_detection\n\t\t\t\t(detectorID, requestID, userID,\n\t\t\t\t planetID, time, information)\n\t\t\t\tVALUES\n\t\t\t\t(" . $this->detectorID . ", " . LWCore::$requestID . ", " . WCF::getUser()->userID . ",\n\t\t\t\t " . LWCore::getPlanet()->planetID . ", " . TIME_NOW . ", '" . escapeString($this->information) . "')";
     WCF::getDB()->sendQuery($sql);
 }
コード例 #22
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     if ($this->action == 'rename') {
         LWCore::getPlanet()->getEditor()->rename($this->newName);
     } else {
         if ($this->action == 'delete') {
             die('delete');
             if (LWCore::getPlanet()->planetKind == 1 && LWCore::getPlanet()->getMoon() != null) {
                 LWCore::getPlanet()->getMoon()->getEditor()->delete();
             }
             LWCore::getPlanet()->getEditor()->delete();
             $sql = "UPDATE ugml_users\r\n\t\t\t\t\tSET current_planet = id_planet\r\n\t\t\t\t\tWHERE id = " . WCF::getUser()->userID;
             WCF::getDB()->sendQuery($sql);
             Session::resetSessions(WCF::getUser()->userID);
             $this->saved();
             header('Location: index.php?page=Overview&cp=' . WCF::getUser()->id_planet);
             exit;
         }
     }
     $this->saved();
 }
コード例 #23
0
 /**
  * @see Page::assignVariables
  */
 public function assignVariables()
 {
     parent::assignVariables();
     WCF::getTPL()->assign(array('distance' => $this->distance, 'maxDistance' => $this->maxDistance, 'thisGJ' => LWCore::getPlanet()->quantic_jump, 'storage' => $this->storage));
 }
コード例 #24
0
ファイル: search.php プロジェクト: sonicmaster/RPG
            }
            $s['position'] = $s['rank'] == 0 ? '' : "<a href=\"stat.php?start={$s['rank']}\">{$s['rank']}</a>";
            $s['dpath'] = $dpath;
            $s['coordinated'] = "{$s['galaxy']}:{$s['system']}:{$s['planet']}";
            $s['buddy_request'] = $lang['buddy_request'];
            $s['write_a_messege'] = $lang['write_a_messege'];
            $result_list .= parsetemplate($row, $s);
        } elseif ($_POST['type'] == 'allytag' || $_POST['type'] == 'allyname') {
            $s = $r;
            //$s['ally_tag'] = "<a href=\"alliance.php?mode=ainfo&tag={$s['ally_tag']}\">{$s['ally_tag']}</a>";
            $s['ally_tag'] = "<a href=\"game/index.php?page=Alliance&amp;allianceID=" . $s['id'] . "\">{$s['ally_tag']}</a>";
            if (!WCF::getUser()->ally_id && !WCF::getUser()->ally_request_id) {
                $s['ally_actions'] = '<th><a href="game/index.php?form=AllianceApply&amp;allianceID=' . $r['id'] . '"><img src="' . DPATH . 'pic/key.gif" alt="Diplomatie" /></a></th>';
                // interrelation apply
            } else {
                if (WCF::getUser()->ally_id && LWCore::getAlliance()->getRank(true, 6)) {
                    $s['ally_actions'] = '<th><a href="game/index.php?form=AllianceInterrelationApply&amp;allianceID=' . $r['id'] . '&amp;allianceID2=' . WCF::getUser()->ally_id . '"><img src="' . DPATH . 'pic/key.gif" alt="Diplomatie" /></a></th>';
                    // no actions
                } else {
                    $s['ally_actions'] = '<th></th>';
                }
            }
            $result_list .= parsetemplate($row, $s);
        }
    }
    if ($result_list != '') {
        $lang['result_list'] = $result_list;
        $search_results = parsetemplate($table, $lang);
    }
}
//el resto...
コード例 #25
0
 /**
  * View system
  */
 public function view()
 {
     global $lang, $user;
     includeLang('galaxy');
     for ($i = 0; $i < 15; $i++) {
         $position = $i + 1;
         $lang['echo_galaxy'] .= $this->viewPositionRow($position);
     }
     $lang['dpath'] = !$user["dpath"] ? DEFAULT_SKINPATH : $user["dpath"];
     $lang['galaxy'] = $this->galaxy;
     $lang['system'] = $this->system;
     $lang['tg'] = LWCore::getPlanet()->galaxy;
     $lang['ts'] = LWCore::getPlanet()->system;
     $lang['tp'] = LWCore::getPlanet()->planet;
     $lang['tpt'] = LWCore::getPlanet()->planet_type;
     $lang['planet_count'] = $this->planetCount();
     $lang['iraks'] = LWCore::getPlanet()->interplanetary_misil;
     $lang['max_slots'] = LWCore::getUser()->computer_tech + 1;
     $lang['recycler'] = LWCore::getPlanet()->recycler;
     $lang['probes'] = LWCore::getPlanet()->spy_sonde;
     $lang['spio_anz'] = $user['spio_anz'];
     $lang['phalanx_costs'] = floor($this->getPhalanxCosts());
     $fleets = Fleet::getByUserID(WCF::getUser()->userID);
     $lang['slots'] = count($fleets);
     $lang['Solar_system_at'] = str_replace('%g', $this->galaxy, $lang['Solar_system_at']);
     $lang['Solar_system_at'] = str_replace('%s', $this->system, $lang['Solar_system_at']);
     display(parsetemplate(gettemplate('galaxy_body'), $lang), '', false);
 }
コード例 #26
0
ファイル: logout.php プロジェクト: sonicmaster/RPG
<?php

/*
  This file is part of WOT Game.

    WOT Game is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    WOT Game 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 Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
// logout.php :: Establece el tiempo de expiración de las cookies.
define('INSIDE', true);
$ugamela_root_path = './';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
includeLang('logout');
LWCore::logout();
header('Location: index.htm');
exit;
//setcookie($game_config['COOKIE_NAME'], "", time()-100000, "/", "", 0);//le da el expire
//message($lang['see_you'],$lang['session_closed'],"login.".$phpEx);
// Created by Perberos. All rights reversed (C) 2006
コード例 #27
0
 /**
  * Returns a array with all counts of specs
  * 
  * @param	int		spec type id
  * @param	Planet
  * @param	LWUser	user object; if null actual LWUserSession
  * @return	array
  */
 public static function getBySpecTypeID($specTypeID, Planet &$planet = null, LWUser &$user = null)
 {
     if ($planet === null) {
         $planet =& LWCore::getPlanet();
     }
     if ($user === null) {
         $user =& WCF::getUser();
     }
     $specTypes = WCF::getCache()->get('spec-' . PACKAGE_ID, 'bySpecType');
     $specType = $specTypes[$specTypeID];
     $array = array();
     foreach ($specType as $specID => $spec) {
         $colName = self::getColName($specID);
         // search in planet obj
         if ($planet->{$colName} != '') {
             $level = $planet->{$colName};
             // search in user obj
         } else {
             if ($planet->{$colName} != '') {
                 $level = $planet->{$colName};
                 // not found
             } else {
                 continue;
             }
         }
         if ($level) {
             $array[$specID] = $level;
         }
     }
     return $array;
 }
コード例 #28
0
 /**
  * @see FleetStartDirectFireAction::readParametersSpec()
  */
 public function readParametersSpec()
 {
     $this->spec[self::ESPIONAGE_PROBE] = min(WCF::getUser()->spio_anz, LWCore::getPlanet()->spy_sonde);
 }
コード例 #29
0
ファイル: FleetQueue.class.php プロジェクト: sonicmaster/RPG
 /**
  * Calculates the distance for the flight.
  * 
  * @return	int		distance
  */
 public function getDistance()
 {
     // galaxy
     if ($this->galaxy != LWCore::getPlanet()->galaxy) {
         return abs($this->galaxy - LWCore::getPlanet()->galaxy) * 20000;
     }
     // system
     if ($this->system != LWCore::getPlanet()->system) {
         return abs($this->system - LWCore::getPlanet()->system) * 95 + 2700;
     }
     // planet
     if ($this->planet != LWCore::getPlanet()->planet) {
         return abs($this->planet - LWCore::getPlanet()->planet) * 5 + 1000;
     }
     // planet type
     return 5;
 }