yamilrh Professional
- Male
- 29
- from Cuba
- Member since Nov 14th 2017
- Last Activity
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
-
Bro algun motor de batalla que me recomiendes para el 2moons 2.0 con php 7.2. Estuve probando el opbe 1.7 pero tiene errores x lo que vi. No me regresa la misma flota que supuestamente quedo luego de la batalla. Revise el tema que hay en el foro sobre eso pero me sigur ese error. Y no estoy ducho en PHP yo para poner a hacer algo de envergadura. Saludos y gracias de antemano.
-
Lechi -
Hola, estoy creando un nuevo elemento en 2Moons 1.8.git (php 8.1).
El problema es que no me actualiza el aumento en recursos.
-> Realice una copia del elemento Deuterio.
------------
En la tablas:
- Añadir en "planets"
- Añadir en "config"
- Añadir en "vars"
- Añadir en "users"
En los ficheros:
- Añadir en "vars.php"
- Añadir en "class.PlanetRessUpdate.php"
- Añadir en "TECH.php"
- Añadir en "class.PlanetRessUpdate.php"
- Añadir en "ShowBuildingsPage.class.php"
- Añadir en "PlayerUtil.class.php"
- Añadir en "ShowShowResourcesPage.class.php"
- Añadir en "page.resources.default.tpl"
- Añadir en "ADMIN/ShowConfigUniPage.php"
- Añadir en "ConfigBodyUni.tpl"
------------
Me podrías dar alguna indicación?
Gracias.-
yamilrh -
class.PlanetRessUpdate.php el problema debe estar ahi. me paso algo parecido cuando puse la mina que da materia oscura en la luna
-
Lechi -
Pues no veo el fallo...
<?php
/**
* 2Moons
* by Jan-Otto Kröpke 2009-2016
*
* For the full copyright and license information, please view the LICENSE
*
* @package 2Moons
* @author Jan-Otto Kröpke <slaver7@gmail.com>
* @copyright 2009 Lucky
* @copyright 2016 Jan-Otto Kröpke <slaver7@gmail.com>
* @licence MIT
* @version 1.8.0
* @link github.com/jkroepke/2Moons
*/
class ResourceUpdate
{
/**
* reference of the config object
* @var Config
*/
private $config = NULL;
private $isGlobalMode = NULL;
private $TIME = NULL;
private $HASH = NULL;
private $ProductionTime = NULL;
private $PLANET = array();
private $USER = array();
private $Builded = array();
function __construct($Build = true, $Tech = true)
{
$this->Build = $Build;
$this->Tech = $Tech;
}
public function setData($USER, $PLANET)
{
$this->USER = $USER;
$this->PLANET = $PLANET;
}
public function getData()
{
return array($this->USER, $this->PLANET);
}
public function ReturnVars() {
if($this->isGlobalMode)
{
$GLOBALS['USER'] = $this->USER;
$GLOBALS['PLANET'] = $this->PLANET;
return true;
} else {
return array($this->USER, $this->PLANET);
}
}
public function CreateHash() {
global $reslist, $resource;
$Hash = array();
foreach($reslist['prod'] as $ID) {
$Hash[] = $this->PLANET[$resource[$ID]];
$Hash[] = $this->PLANET[$resource[$ID].'_porcent'];
}
$ressource = array_merge(array(), $reslist['resstype'][1], $reslist['resstype'][2]);
foreach($ressource as $ID) {
$Hash[] = $this->config->{$resource[$ID].'_basic_income'};
}
$Hash[] = $this->config->resource_multiplier;
$Hash[] = $this->config->storage_multiplier;
$Hash[] = $this->config->energySpeed;
$Hash[] = $this->USER['factor']['Resource'];
$Hash[] = $this->USER['factor']['Energy'];
$Hash[] = $this->PLANET[$resource[22]];
$Hash[] = $this->PLANET[$resource[23]];
$Hash[] = $this->PLANET[$resource[24]];
$Hash[] = $this->USER[$resource[131]];
$Hash[] = $this->USER[$resource[132]];
$Hash[] = $this->USER[$resource[133]];
return md5(implode("::", $Hash));
}
public function CalcResource($USER = NULL, $PLANET = NULL, $SAVE = false, $TIME = NULL, $HASH = true)
{
$this->isGlobalMode = !isset($USER, $PLANET) ? true : false;
$this->USER = $this->isGlobalMode ? $GLOBALS['USER'] : $USER;
$this->PLANET = $this->isGlobalMode ? $GLOBALS['PLANET'] : $PLANET;
$this->TIME = is_null($TIME) ? TIMESTAMP : $TIME;
$this->config = Config::get($this->USER['universe']);
if($this->USER['urlaubs_modus'] == 1)
return $this->ReturnVars();
if($this->Build)
{
$this->ShipyardQueue();
if($this->Tech == true && $this->USER['b_tech'] != 0 && $this->USER['b_tech'] < $this->TIME)
$this->ResearchQueue();
if($this->PLANET['b_building'] != 0)
$this->BuildingQueue();
}
$this->UpdateResource($this->TIME, $HASH);
if($SAVE === true)
$this->SavePlanetToDB($this->USER, $this->PLANET);
return $this->ReturnVars();
}
public function UpdateResource($TIME, $HASH = false)
{
$this->ProductionTime = ($TIME - $this->PLANET['last_update']);
if($this->ProductionTime > 0)
{
$this->PLANET['last_update'] = $TIME;
if($HASH === false) {
$this->ReBuildCache();
} else {
$this->HASH = $this->CreateHash();
if($this->PLANET['eco_hash'] !== $this->HASH) {
$this->PLANET['eco_hash'] = $this->HASH;
$this->ReBuildCache();
}
}
$this->ExecCalc();
}
}
private function ExecCalc()
{
if($this->PLANET['planet_type'] == 3)
return;
$MaxMetalStorage = $this->PLANET['metal_max'] * $this->config->max_overflow;
$MaxCristalStorage = $this->PLANET['crystal_max'] * $this->config->max_overflow;
$MaxDeuteriumStorage = $this->PLANET['deuterium_max'] * $this->config->max_overflow;
$MaxVidaStorage = $this->PLANET['vida_max'] * $this->config->max_overflow;
$MetalTheoretical = $this->ProductionTime * (($this->config->metal_basic_income * $this->config->resource_multiplier) + $this->PLANET['metal_perhour']) / 3600;
if($MetalTheoretical < 0)
{
$this->PLANET['metal'] = max($this->PLANET['metal'] + $MetalTheoretical, 0);
}
elseif ($this->PLANET['metal'] <= $MaxMetalStorage)
{
$this->PLANET['metal'] = min($this->PLANET['metal'] + $MetalTheoretical, $MaxMetalStorage);
}
$CristalTheoretical = $this->ProductionTime * (($this->config->crystal_basic_income * $this->config->resource_multiplier) + $this->PLANET['crystal_perhour']) / 3600;
if ($CristalTheoretical < 0)
{
$this->PLANET['crystal'] = max($this->PLANET['crystal'] + $CristalTheoretical, 0);
}
elseif ($this->PLANET['crystal'] <= $MaxCristalStorage )
{
$this->PLANET['crystal'] = min($this->PLANET['crystal'] + $CristalTheoretical, $MaxCristalStorage);
}
$DeuteriumTheoretical = $this->ProductionTime * (($this->config->deuterium_basic_income * $this->config->resource_multiplier) + $this->PLANET['deuterium_perhour']) / 3600;
if ($DeuteriumTheoretical < 0)
{
$this->PLANET['deuterium'] = max($this->PLANET['deuterium'] + $DeuteriumTheoretical, 0);
}
elseif($this->PLANET['deuterium'] <= $MaxDeuteriumStorage)
{
$this->PLANET['deuterium'] = min($this->PLANET['deuterium'] + $DeuteriumTheoretical, $MaxDeuteriumStorage);
}
$VidaTheoretical = $this->ProductionTime * (($this->config->vida_basic_income * $this->config->resource_multiplier) + $this->PLANET['vida_perhour']) / 3600;
if ($VidaTheoretical < 0)
{
$this->PLANET['vida'] = max($this->PLANET['vida'] + $VidaTheoretical, 0);
}
elseif($this->PLANET['vida'] <= $MaxVidaStorage)
{
$this->PLANET['vida'] = min($this->PLANET['vida'] + $VidaTheoretical, $MaxVidaStorage);
}
$this->PLANET['metal'] = max($this->PLANET['metal'], 0);
$this->PLANET['crystal'] = max($this->PLANET['crystal'], 0);
$this->PLANET['deuterium'] = max($this->PLANET['deuterium'], 0);
$this->PLANET['vida'] = max($this->PLANET['vida'], 0);
}
public static function getProd($Calculation)
{
return 'return '.$Calculation.';';
}
public static function getNetworkLevel($USER, $PLANET)
{
global $resource;
$researchLevelList = array($PLANET[$resource[31]]);
if($USER[$resource[123]] > 0)
{
$sql = 'SELECT '.$resource[31].' FROM %%PLANETS%% WHERE id != :planetId AND id_owner = :userId AND destruyed = 0 ORDER BY '.$resource[31].' DESC LIMIT :limit;';
$researchResult = Database::get()->select($sql, array(
':limit' => (int) $USER[$resource[123]],
':planetId' => $PLANET['id'],
':userId' => $USER['id']
));
foreach($researchResult as $researchRow)
{
$researchLevelList[] = $researchRow[$resource[31]];
}
}
return $researchLevelList;
}
public function ReBuildCache()
{
global $ProdGrid, $resource, $reslist;
if ($this->PLANET['planet_type'] == 3)
{
$this->config->metal_basic_income = 0;
$this->config->crystal_basic_income = 0;
$this->config->deuterium_basic_income = 0;
$this->config->vida_basic_income = 0;
}
$temp = array(
901 => array(
'max' => 0,
'plus' => 0,
'minus' => 0,
),
902 => array(
'max' => 0,
'plus' => 0,
'minus' => 0,
),
903 => array(
'max' => 0,
'plus' => 0,
'minus' => 0,
),
904 => array(
'max' => 0,
'plus' => 0,
'minus' => 0,
),
911 => array(
'plus' => 0,
'minus' => 0,
)
);
$BuildTemp = $this->PLANET['temp_max'];
$BuildEnergy = $this->USER[$resource[113]];
foreach($reslist['storage'] as $ProdID)
{
foreach($reslist['resstype'][1] as $ID)
{
if(!isset($ProdGrid[$ProdID]['storage'][$ID]))
continue;
$BuildLevel = $this->PLANET[$resource[$ProdID]];
$temp[$ID]['max'] += round(eval(self::getProd($ProdGrid[$ProdID]['storage'][$ID])));
}
}
$ressIDs = array_merge(array(), $reslist['resstype'][1], $reslist['resstype'][2]);
foreach($reslist['prod'] as $ProdID)
{
$BuildLevelFactor = $this->PLANET[$resource[$ProdID].'_porcent'];
$BuildLevel = $this->PLANET[$resource[$ProdID]];
foreach($ressIDs as $ID)
{
if(!isset($ProdGrid[$ProdID]['production'][$ID]))
continue;
$Production = eval(self::getProd($ProdGrid[$ProdID]['production'][$ID]));
if($Production > 0) {
$temp[$ID]['plus'] += $Production;
} else {
if(in_array($ID, $reslist['resstype'][1]) && $this->PLANET[$resource[$ID]] == 0) {
continue;
}
$temp[$ID]['minus'] += $Production;
}
}
}
$this->PLANET['metal_max'] = $temp[901]['max'] * $this->config->storage_multiplier * (1 + $this->USER['factor']['ResourceStorage']);
$this->PLANET['crystal_max'] = $temp[902]['max'] * $this->config->storage_multiplier * (1 + $this->USER['factor']['ResourceStorage']);
$this->PLANET['deuterium_max'] = $temp[903]['max'] * $this->config->storage_multiplier * (1 + $this->USER['factor']['ResourceStorage']);
$this->PLANET['vida_max'] = $temp[904]['max'] * $this->config->storage_multiplier * (1 + $this->USER['factor']['ResourceStorage']);
$this->PLANET['energy'] = round($temp[911]['plus'] * $this->config->energySpeed * (1 + $this->USER['factor']['Energy']));
$this->PLANET['energy_used'] = $temp[911]['minus'] * $this->config->energySpeed;
if($this->PLANET['energy_used'] == 0) {
$this->PLANET['metal_perhour'] = 0;
$this->PLANET['crystal_perhour'] = 0;
$this->PLANET['deuterium_perhour'] = 0;
$this->PLANET['vida_perhour'] = 0;
} else {
$prodLevel = min(1, $this->PLANET['energy'] / abs($this->PLANET['energy_used']));
$this->PLANET['metal_perhour'] = ($temp[901]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[901]['minus']) * $this->config->resource_multiplier;
$this->PLANET['crystal_perhour'] = ($temp[902]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[132]]) * $prodLevel + $temp[902]['minus']) * $this->config->resource_multiplier;
$this->PLANET['deuterium_perhour'] = ($temp[903]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[133]]) * $prodLevel + $temp[903]['minus']) * $this->config->resource_multiplier;
$this->PLANET['vida_perhour'] = ($temp[904]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[904]['minus']) * $this->config->resource_multiplier;
}
}
private function ShipyardQueue()
{
global $resource;
$BuildQueue = unserialize(empty($this->PLANET['b_hangar_id']) ? '' : $this->PLANET['b_hangar_id']);
if (!$BuildQueue) {
$this->PLANET['b_hangar'] = 0;
$this->PLANET['b_hangar_id'] = '';
return false;
}
$this->PLANET['b_hangar'] += ($this->TIME - $this->PLANET['last_update']);
$BuildArray = array();
foreach($BuildQueue as $Item)
{
$AcumTime = BuildFunctions::getBuildingTime($this->USER, $this->PLANET, $Item[0]);
$BuildArray[] = array($Item[0], $Item[1], $AcumTime);
}
$NewQueue = array();
$Done = false;
foreach($BuildArray as $Item)
{
$Element = $Item[0];
$Count = $Item[1];
if($Done == false) {
$BuildTime = $Item[2];
$Element = (int)$Element;
if($BuildTime == 0) {
if(!isset($this->Builded[$Element]))
$this->Builded[$Element] = 0;
$this->Builded[$Element] += $Count;
$this->PLANET[$resource[$Element]] += $Count;
continue;
}
$Build = max(min(floor($this->PLANET['b_hangar'] / $BuildTime), $Count), 0);
if($Build == 0) {
$NewQueue[] = array($Element, $Count);
$Done = true;
continue;
}
if(!isset($this->Builded[$Element]))
$this->Builded[$Element] = 0;
$this->Builded[$Element] += $Build;
$this->PLANET['b_hangar'] -= $Build * $BuildTime;
$this->PLANET[$resource[$Element]] += $Build;
$Count -= $Build;
if ($Count == 0)
continue;
else
$Done = true;
}
$NewQueue[] = array($Element, $Count);
}
$this->PLANET['b_hangar_id'] = !empty($NewQueue) ? serialize($NewQueue) : '';
return true;
}
private function BuildingQueue()
{
while($this->CheckPlanetBuildingQueue())
$this->SetNextQueueElementOnTop();
}
private function CheckPlanetBuildingQueue()
{
global $resource, $reslist;
if (empty($this->PLANET['b_building_id']) $this->PLANET['b_building'] > $this->TIME)
return false;
$CurrentQueue = unserialize($this->PLANET['b_building_id']);
$Element = $CurrentQueue[0][0];
$BuildEndTime = $CurrentQueue[0][3];
$BuildMode = $CurrentQueue[0][4];
if(!isset($this->Builded[$Element]))
$this->Builded[$Element] = 0;
if ($BuildMode == 'build')
{
$this->PLANET['field_current'] += 1;
$this->PLANET[$resource[$Element]] += 1;
$this->Builded[$Element] += 1;
}
else
{
$this->PLANET['field_current'] -= 1;
$this->PLANET[$resource[$Element]] -= 1;
$this->Builded[$Element] -= 1;
}
array_shift($CurrentQueue);
$OnHash = in_array($Element, $reslist['prod']);
$this->UpdateResource($BuildEndTime, !$OnHash);
if (count($CurrentQueue) == 0) {
$this->PLANET['b_building'] = 0;
$this->PLANET['b_building_id'] = '';
return false;
} else {
$this->PLANET['b_building_id'] = serialize($CurrentQueue);
return true;
}
}
public function SetNextQueueElementOnTop()
{
global $resource, $LNG;
if (empty($this->PLANET['b_building_id'])) {
$this->PLANET['b_building'] = 0;
$this->PLANET['b_building_id'] = '';
return false;
}
$CurrentQueue = unserialize($this->PLANET['b_building_id']);
$Loop = true;
$BuildEndTime = 0;
$NewQueue = '';
while ($Loop === true)
{
$ListIDArray = $CurrentQueue[0];
$Element = $ListIDArray[0];
$Level = $ListIDArray[1];
$BuildMode = $ListIDArray[4];
$ForDestroy = ($BuildMode == 'destroy') ? true : false;
$costResources = BuildFunctions::getElementPrice($this->USER, $this->PLANET, $Element, $ForDestroy, $Level);
$BuildTime = BuildFunctions::getBuildingTime($this->USER, $this->PLANET, $Element, $costResources);
$HaveResources = BuildFunctions::isElementBuyable($this->USER, $this->PLANET, $Element, $costResources);
$BuildEndTime = $this->PLANET['b_building'] + $BuildTime;
$CurrentQueue[0] = array($Element, $Level, $BuildTime, $BuildEndTime, $BuildMode);
$HaveNoMoreLevel = false;
if($ForDestroy && $this->PLANET[$resource[$Element]] == 0) {
$HaveResources = false;
$HaveNoMoreLevel = true;
}
if($HaveResources === true) {
if(isset($costResources[901])) { $this->PLANET[$resource[901]] -= $costResources[901]; }
if(isset($costResources[902])) { $this->PLANET[$resource[902]] -= $costResources[902]; }
if(isset($costResources[903])) { $this->PLANET[$resource[903]] -= $costResources[903]; }
if(isset($costResources[904])) { $this->PLANET[$resource[904]] -= $costResources[904]; }
if(isset($costResources[921])) { $this->USER[$resource[921]] -= $costResources[921]; }
$NewQueue = serialize($CurrentQueue);
$Loop = false;
} else {
if($this->USER['hof'] == 1){
if ($HaveNoMoreLevel) {
$Message = sprintf($LNG['sys_nomore_level'], $LNG['tech'][$Element]);
} else {
if(!isset($costResources[901])) { $costResources[901] = 0; }
if(!isset($costResources[902])) { $costResources[902] = 0; }
if(!isset($costResources[903])) { $costResources[903] = 0; }
if(!isset($costResources[904])) { $costResources[904] = 0; }
$Message = sprintf($LNG['sys_notenough_money'], $this->PLANET['name'], $this->PLANET['id'], $this->PLANET['galaxy'], $this->PLANET['system'], $this->PLANET['planet'], $LNG['tech'][$Element], pretty_number ($this->PLANET['metal']), $LNG['tech'][901], pretty_number($this->PLANET['crystal']), $LNG['tech'][902], pretty_number ($this->PLANET['deuterium']), $LNG['tech'][903], pretty_number ($this->PLANET['vida']), $LNG['tech'][904], pretty_number($costResources[901] ?? 0), $LNG['tech'][901], pretty_number ($costResources[902] ?? 0), $LNG['tech'][902], pretty_number ($costResources[903] ?? 0), $LNG['tech'][903], pretty_number ($costResources[904] ?? 0), $LNG['tech'][904]);
}
PlayerUtil::sendMessage($this->USER['id'], 0,$LNG['sys_buildlist'], 99,
$LNG['sys_buildlist_fail'], $Message, $this->TIME);
}
array_shift($CurrentQueue);
if (count($CurrentQueue) == 0) {
$BuildEndTime = 0;
$NewQueue = '';
$Loop = false;
} else {
$BaseTime = $BuildEndTime - $BuildTime;
$NewQueue = array();
foreach($CurrentQueue as $ListIDArray)
{
$ListIDArray[2] = BuildFunctions::getBuildingTime($this->USER, $this->PLANET, $ListIDArray[0], NULL, $ListIDArray[4] == 'destroy');
$BaseTime += $ListIDArray[2];
$ListIDArray[3] = $BaseTime;
$NewQueue[] = $ListIDArray;
}
$CurrentQueue = $NewQueue;
}
}
}
$this->PLANET['b_building'] = $BuildEndTime;
$this->PLANET['b_building_id'] = $NewQueue;
return true;
}
private function ResearchQueue()
{
while($this->CheckUserTechQueue())
$this->SetNextQueueTechOnTop();
}
private function CheckUserTechQueue()
{
global $resource;
if (empty($this->USER['b_tech_id']) $this->USER['b_tech'] > $this->TIME)
return false;
if(!isset($this->Builded[$this->USER['b_tech_id']]))
$this->Builded[$this->USER['b_tech_id']] = 0;
$this->Builded[$this->USER['b_tech_id']] += 1;
$this->USER[$resource[$this->USER['b_tech_id']]] += 1;
$CurrentQueue = unserialize($this->USER['b_tech_queue']);
array_shift($CurrentQueue);
$this->USER['b_tech_id'] = 0;
if (count($CurrentQueue) == 0) {
$this->USER['b_tech'] = 0;
$this->USER['b_tech_id'] = 0;
$this->USER['b_tech_planet'] = 0;
$this->USER['b_tech_queue'] = '';
return false;
} else {
$this->USER['b_tech_queue'] = serialize(array_values($CurrentQueue));
return true;
}
}
public function SetNextQueueTechOnTop()
{
global $resource, $LNG;
if (empty($this->USER['b_tech_queue'])) {
$this->USER['b_tech'] = 0;
$this->USER['b_tech_id'] = 0;
$this->USER['b_tech_planet'] = 0;
$this->USER['b_tech_queue'] = '';
return false;
}
$CurrentQueue = unserialize($this->USER['b_tech_queue']);
$Loop = true;
while ($Loop == true)
{
$ListIDArray = $CurrentQueue[0];
$isAnotherPlanet = $ListIDArray[4] != $this->PLANET['id'];
if($isAnotherPlanet)
{
$sql = 'SELECT * FROM %%PLANETS%% WHERE id = :planetId;';
$PLANET = Database::get()->selectSingle($sql, array(
':planetId' => $ListIDArray[4],
));
$RPLANET = new ResourceUpdate(true, false);
list(, $PLANET) = $RPLANET->CalcResource($this->USER, $PLANET, false, $this->USER['b_tech']);
}
else
{
$PLANET = $this->PLANET;
}
$PLANET[$resource[31].'_inter'] = self::getNetworkLevel($this->USER, $PLANET);
$Element = $ListIDArray[0];
$Level = $ListIDArray[1];
$costResources = BuildFunctions::getElementPrice($this->USER, $PLANET, $Element, false, $Level);
$BuildTime = BuildFunctions::getBuildingTime($this->USER, $PLANET, $Element, $costResources);
$HaveResources = BuildFunctions::isElementBuyable($this->USER, $PLANET, $Element, $costResources);
$BuildEndTime = $this->USER['b_tech'] + $BuildTime;
$CurrentQueue[0] = array($Element, $Level, $BuildTime, $BuildEndTime, $PLANET['id']);
if($HaveResources == true) {
if(isset($costResources[901])) { $PLANET[$resource[901]] -= $costResources[901]; }
if(isset($costResources[902])) { $PLANET[$resource[902]] -= $costResources[902]; }
if(isset($costResources[903])) { $PLANET[$resource[903]] -= $costResources[903]; }
if(isset($costResources[904])) { $PLANET[$resource[904]] -= $costResources[904]; }
if(isset($costResources[921])) { $this->USER[$resource[921]] -= $costResources[921]; }
$this->USER['b_tech_id'] = $Element;
$this->USER['b_tech'] = $BuildEndTime;
$this->USER['b_tech_planet'] = $PLANET['id'];
$this->USER['b_tech_queue'] = serialize($CurrentQueue);
$Loop = false;
} else {
if($this->USER['hof'] == 1){
if(!isset($costResources[901])) { $costResources[901] = 0; }
if(!isset($costResources[902])) { $costResources[902] = 0; }
if(!isset($costResources[903])) { $costResources[903] = 0; }
if(!isset($costResources[904])) { $costResources[904] = 0; }
$Message = sprintf($LNG['sys_notenough_money'], $PLANET['name'], $PLANET['id'], $PLANET['galaxy'], $PLANET['system'], $PLANET['planet'], $LNG['tech'][$Element], pretty_number ($PLANET['metal']), $LNG['tech'][901], pretty_number($PLANET['crystal']), $LNG['tech'][902], pretty_number ($PLANET['deuterium']), $LNG['tech'][903], pretty_number ($PLANET['vida']), $LNG['tech'][904], pretty_number($costResources[901]), $LNG['tech'][901], pretty_number ($costResources[902]), $LNG['tech'][902], pretty_number ($costResources[903]), $LNG['tech'][903], pretty_number ($costResources[904]), $LNG['tech'][904]);
PlayerUtil::sendMessage($this->USER['id'], 0,$LNG['sys_techlist'], 99, $LNG['sys_buildlist_fail'], $Message, $this->TIME);
}
array_shift($CurrentQueue);
if (count($CurrentQueue) == 0) {
$this->USER['b_tech'] = 0;
$this->USER['b_tech_id'] = 0;
$this->USER['b_tech_planet'] = 0;
$this->USER['b_tech_queue'] = '';
$Loop = false;
} else {
$BaseTime = $BuildEndTime - $BuildTime;
$NewQueue = array();
foreach($CurrentQueue as $ListIDArray)
{
$ListIDArray[2] = BuildFunctions::getBuildingTime($this->USER, $PLANET, $ListIDArray[0]);
$BaseTime += $ListIDArray[2];
$ListIDArray[3] = $BaseTime;
$NewQueue[] = $ListIDArray;
}
$CurrentQueue = $NewQueue;
}
}
if($isAnotherPlanet)
{
$RPLANET->SavePlanetToDB($this->USER, $PLANET);
$RPLANET = NULL;
unset($RPLANET);
}
else
{
$this->PLANET = $PLANET;
}
}
return true;
}
public function SavePlanetToDB($USER = NULL, $PLANET = NULL)
{
global $resource, $reslist;
if(is_null($USER))
global $USER;
if(is_null($PLANET))
global $PLANET;
$buildQueries = array();
$params = array(
':userId' => $USER['id'],
':planetId' => $PLANET['id'],
':metal' => $PLANET['metal'],
':crystal' => $PLANET['crystal'],
':deuterium' => $PLANET['deuterium'],
':vida' => $PLANET['vida'],
':ecoHash' => $PLANET['eco_hash'],
':lastUpdateTime' => $PLANET['last_update'],
':b_building' => $PLANET['b_building'],
':b_building_id' => $PLANET['b_building_id'],
':field_current' => $PLANET['field_current'],
':b_hangar_id' => $PLANET['b_hangar_id'],
':metal_perhour' => $PLANET['metal_perhour'],
':crystal_perhour' => $PLANET['crystal_perhour'],
':deuterium_perhour' => $PLANET['deuterium_perhour'],
':vida_perhour' => $PLANET['vida_perhour'],
':metal_max' => $PLANET['metal_max'],
':crystal_max' => $PLANET['crystal_max'],
':deuterium_max' => $PLANET['deuterium_max'],
':vida_max' => $PLANET['vida_max'],
':energy_used' => $PLANET['energy_used'],
':energy' => $PLANET['energy'],
':b_hangar' => $PLANET['b_hangar'],
':darkmatter' => $USER['darkmatter'],
':b_tech' => $USER['b_tech'],
':b_tech_id' => $USER['b_tech_id'],
':b_tech_planet' => $USER['b_tech_planet'],
':b_tech_queue' => $USER['b_tech_queue']
);
if (!empty($this->Builded))
{
foreach($this->Builded as $Element => $Count)
{
$Element = (int) $Element;
if(empty($resource[$Element]) empty($Count)) {
continue;
}
if(in_array($Element, $reslist['one']))
{
$buildQueries[] = ', p.'.$resource[$Element].' = :'.$resource[$Element];
$params[':'.$resource[$Element]] = '1';
}
elseif(isset($PLANET[$resource[$Element]]))
{
$buildQueries[] = ', p.'.$resource[$Element].' = p.'.$resource[$Element].' + :'.$resource[$Element];
$params[':'.$resource[$Element]] = floatToString($Count);
}
elseif(isset($USER[$resource[$Element]]))
{
$buildQueries[] = ', u.'.$resource[$Element].' = u.'.$resource[$Element].' + :'.$resource[$Element];
$params[':'.$resource[$Element]] = floatToString($Count);
}
}
}
$sql = 'UPDATE %%PLANETS%% as p,%%USERS%% as u SET
p.metal = :metal,
p.crystal = :crystal,
p.deuterium = :deuterium,
p.vida = :vida,
p.eco_hash = :ecoHash,
p.last_update = :lastUpdateTime,
p.b_building = :b_building,
p.b_building_id = :b_building_id,
p.field_current = :field_current,
p.b_hangar_id = :b_hangar_id,
p.metal_perhour = :metal_perhour,
p.crystal_perhour = :crystal_perhour,
p.deuterium_perhour = :deuterium_perhour,
p.vida_perhour = :vida_perhour,
p.metal_max = :metal_max,
p.crystal_max = :crystal_max,
p.deuterium_max = :deuterium_max,
p.vida_max = :vida_max,
p.energy_used = :energy_used,
p.energy = :energy,
p.b_hangar = :b_hangar,
u.darkmatter = :darkmatter,
u.b_tech = :b_tech,
u.b_tech_id = :b_tech_id,
u.b_tech_planet = :b_tech_planet,
u.b_tech_queue = :b_tech_queue
'.implode("\n", $buildQueries).'
WHERE p.id = :planetId AND u.id = :userId;';
Database::get()->update($sql, $params);
$this->Builded = array();
return array($USER, $PLANET);
}
} -
yamilrh -
viste que cuando tu subes el nivel de la mina en la bd modifica el campo
-
Lechi -
cierto, no se modifica, pero en la linea 324, esta indicado...
-
Lechi -
$this->PLANET['vida_perhour'] = ($temp[904]['plus'] * (1 + $this->USER['factor']['Resource'] + 0.02 * $this->USER[$resource[131]]) * $prodLevel + $temp[904]['minus']) * $this->config->resource_multiplier;
-
-
Neo -
Yamil bro quiero montar un proyecto, un xnova y necesito tu ayuda...dime x donde te puedo contactar x telegram o whatsapp? Pasame tu contacto para contactar y explicarte lo q tengo en mente, muchas gracias
-
yamilrh -
t.me/xnova_official telegram
-
-
sven -
can you help?with the newspage?
-
ok le he escrito pero nada como puedo poner que se limite el transporte entre jugador fuerte y débil
-
yamilrh -
pero que es lo que no funciona en esa faccion y cual es la que estas usando... Lo del transporte que es lo que no quieres que no se envien o que X cantidad
-
Danter14 -
Look in the database if you have the associated bonuses, or you can add the reductions directly in the formula associated with the desired reduction
-
-
tengo problemas con la fracción minero que no me esta pinchando como seria el tema para la ayuda yo tengo montado el serve del luna negra pero esa parte no me esta pichando
-
yamilrh -
@linkin, creo que el que mas te puede ayudar es el. crea un tema por ahí por el foro.
-
-
layon940 -
Me gustaria saber si pudiste arreglar el [MOD] [v1.8] Bank Corrected, y si lo ves viable para el miisla.... pq lo descargue y lo estoy probando y de veras te quedo muy bien esa version y como a todo aunque no se de programacion es darle unos retoques y añadirle par de cositas y estaria muy interesante... y competitivo con el de linkin
-
yamilrh -
Gracias por los comentarios. pero que error tiene ese mod, seguro en su momento lo corregí
-
-
Kokosolo -
yamil puedes ayudarme con esto?
WARNING
Message: file_put_contents(/cache/cache.themes.php): failed to open stream: No such file or directory
File: /includes/classes/class.theme.php
Line: 114
URL: cyberisla.nat.cu/game.php?page=settings
PHP-Version: 7.4.29
PHP-API: fpm-fcgi
MySQL-Cleint-Version: mysqlnd 7.4.29
2Moons Version: 2.1.beta
Debug Backtrace:
#0 [internal function]: errorHandler()
#1 /includes/classes/class.theme.php(114): file_put_contents()
#2 /includes/pages/game/ShowSettingsPage.class.php(101): Theme::getAvalibleSkins()
#3 /game.php(89): ShowSettingsPage->show()
#4 {main} -
Kadaj -
Ya encontramos el problema, todo tan sencillo como un 0 donde no iba. Muchas gracias por la ayuda.
-
Kokosolo -
yamil, puedes ayudarme con este error... al instalar me esta dando esto...
Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'system = '64' AND planet = '4' AND planet_type = '1'' at line 5
Query-Code:SELECT COUNT(*) as record FROM uni1_planets WHERE universe = 1 AND galaxy = 4 AND system = 64 AND planet = 4 AND planet_type = 1;
File: /includes/classes/Database.class.php
Line: 109
URL: xnova.comunidadxnet.nat.cu/install/index.php?step=7
PHP-Version: 7.4.3
PHP-API: apache2handler
MySQL-Cleint-Version: mysqlnd 7.4.3
2Moons Version: UNKNOWN
Debug Backtrace:
#0 /includes/classes/Database.class.php(185): Database->_query()
#1 /includes/classes/PlayerUtil.class.php(85): Database->selectSingle()
#2 /includes/classes/PlayerUtil.class.php(164): PlayerUtil::isPositionFree()
#3 /install/step07.php(52): PlayerUtil::createPlayer()
#4 /install/index.php(70): include('/...')
#5 {main}
Pudiera ser la version del PHP?-
yamilrh -
xterium, 2moons, corren hasta 7.3.24. bájale la version del php 7.3 y prueba ver, si no avisame yo tengo una instalación limpia de ese
-
-
Russoll -
hey i installedthe tourney mod but i get error i added into Database.class.php but just this error?
Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%%TOURNEYPARTICI%% WHERE tourneyJoin = '1' AND playerId = '1'' at line 1
Query-Code:SELECT * FROM %%TOURNEYPARTICI%% WHERE tourneyJoin = 1 AND playerId = 1;
File: /includes/classes/Database.class.php -
Kokosolo -
Yamil puedes ayudarme con algun MOD para que los jugadores puedan liberar las flotas sin que tenga que hacerlo un administrador? Se como se hace la sentencia en SQL pero no doy con hacer el mod y que funcione.
Gracias....-
yamilrh -
Bro no lo hagas como tal un mod, sino algo simple, valida si una flota coincide con el id del usuario que apresca un boton o algo, y darle, desbloque sus flotas o la flota que tenga bloqueada
-
-
SAAS -
ok
-
Holaaaaa, me puede decir como pudo arreglar el bug del mercader ? que no consumía MO..
-
referente a este hilo 2moons.de/index.php?thread/966…-not-consume-dark-matter/
-
-
Zeus -
help me sir dm pls
-
Mano me puedes ayudar con la implementación del banco en mi xnova, la versión 2.0.1. gracias
-
yamilrh -
claro, dime que necesitas
-
-
Eduard92 -
Hola amigo soy de cuba, al registrarme en esta direccion xnova.nat.cu e intentar completar el registro con el link q me llega al correo me sale un cartel negro de error :
Las primeras lineas dicen:
USER ERROR
MESSAGE:SQLSTATE[HY000]: General error: 1364 Field 'rpg_dora' doesn't have a default value
Query-Code: INSERT INTO UNI1_USERS SET USERNAME=SICARIO, EMAIL=9204@NAUTA.CU,AUTHLEVEL=0,universe=1,lang=es etc...-
yamilrh -
le dites actualizar y no completo el registro?
-
-
Hola no se si seas de Cuba pero queria ver si me podias ayudar ocn la plantilla 2.0.1 y algunas cosas que queria gregarle,saludos
-
yamilrh -
oka soy cubano, ireadigos@gmail.com
-
skynet -
Me uno a la petición. Pudieras enviarme la versión más actualizada del 2moons. Dime y te escribo al correo que has publicado más arriba.
-
yamilrh -
ok
-
-
Skylon -
dame un email para enviarte el 2.0.1
-
Danter14 -
you will find it in the constants.php
venus00 -
hola @Yamilrh me mandaron contigo porque dicen que saves sobre el 2moons 2.0 version php8....Me podrias dar tu whatsapp para hablar y explicarte mejor..no tengo Telegram...Muchas gracias de ante mano