
Danter14 Professional
- Male
- 39
- Member since Jan 11th 2017
- Last Activity
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
-
-
Danter14 -
answer given in your post
-
-
sven -
thank you vor your great support!! you the best ! Maybe you can help me by the Trader:-)
-
Danter14 -
Yes I am currently looking at the code for the trader
-
sven -
thank you but the code from you is not work the Trader works without DM:-(
-
sven -
<?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 ShowTraderPage extends AbstractGamePage
{
public static $requireModule = MODULE_TRADER;
function __construct()
{
parent::__construct();
}
public static $Charge = array(
901 => array(901 => 1, 902 => 2, 903 => 4),
902 => array(901 => 0.5, 902 => 1, 903 => 2),
903 => array(901 => 0.25, 902 => 0.5, 903 => 1),
);
public function show()
{
global $LNG, $USER, $resource;
$darkmatter_cost_trader = Config::get()->darkmatter_cost_trader;
$this->assign(array(
'tr_cost_dm_trader' => sprintf($LNG['tr_cost_dm_trader'], pretty_number($darkmatter_cost_trader), $LNG['tech'][921]),
'charge' => self::$Charge,
'resource' => $resource,
'requiredDarkMatter' => $USER['darkmatter'] < $darkmatter_cost_trader ? sprintf($LNG['tr_not_enought'], $LNG['tech'][921]) : false,
));
$this->display("page.trader.default.tpl");
}
if ($tradeSum > 0)
{
$USER[$resource[921]] -= Config::get()->darkmatter_cost_trader;
}
function trade()
{
global $USER, $LNG;
if ($USER['darkmatter'] < Config::get()->darkmatter_cost_trader) {
$this->redirectTo('game.php?page=trader');
}
$resourceID = HTTP::_GP('resource', 0);
if(!in_array($resourceID, array_keys(self::$Charge))) {
$this->printMessage($LNG['invalid_action'], array(array(
'label' => $LNG['sys_back'],
'url' => 'game.php?page=trader'
)));
}
$tradeResources = array_values(array_diff(array_keys(self::$Charge[$resourceID]), array($resourceID)));
$this->tplObj->loadscript("trader.js");
$this->assign(array(
'tradeResourceID' => $resourceID,
'tradeResources' => $tradeResources,
'charge' => self::$Charge[$resourceID],
));
$this->display('page.trader.trade.tpl');
}
function send()
{
global $USER, $PLANET, $LNG, $resource;
if ($USER['darkmatter'] < Config::get()->darkmatter_cost_trader) {
$this->redirectTo('game.php?page=trader');
}
$resourceID = HTTP::_GP('resource', 0);
if(!in_array($resourceID, array_keys(self::$Charge))) {
$this->printMessage($LNG['invalid_action'], array(array(
'label' => $LNG['sys_back'],
'url' => 'game.php?page=trader'
)));
}
$getTradeResources = HTTP::_GP('trade', array());
$tradeResources = array_values(array_diff(array_keys(self::$Charge[$resourceID]), array($resourceID)));
$tradeSum = 0;
$sum=0;
foreach($tradeResources as $tradeRessID)
{
$tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
$sum+= $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
}
if($sum>$PLANET[$resource[$resourceID]])
{
$this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
'label' => $LNG['sys_back'],
'url' => 'game.php?page=trader'
)));
}
$sum=0;
foreach($tradeResources as $tradeRessID)
{
$tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
$sum+= $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
}
if($sum>$PLANET[$resource[$resourceID]])
{
$this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
'label' => $LNG['sys_back'],
'url' => 'game.php?page=trader'
)));
}
foreach($tradeResources as $tradeRessID)
{
$tradeAmount = max(0, round((float) $getTradeResources[$tradeRessID]));
if(empty($tradeAmount)!isset(self::$Charge[$resourceID][$tradeRessID]))
{
continue;
}
if(isset($PLANET[$resource[$resourceID]]))
{
$usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
if($usedResources > $PLANET[$resource[$resourceID]])
{
$this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
'label' => $LNG['sys_back'],
'url' => 'game.php?page=trader'
)));
}
else
{
$tradeSum += $tradeAmount;
$PLANET[$resource[$resourceID]] -= $usedResources;
}
}
elseif(isset($USER[$resource[$resourceID]]))
{
if($resourceID == 921)
{
$USER[$resource[$resourceID]] -= Config::get()->darkmatter_cost_trader;
}
$usedResources = $tradeAmount * self::$Charge[$resourceID][$tradeRessID];
if($usedResources > $USER[$resource[$resourceID]])
{
$this->printMessage(sprintf($LNG['tr_not_enought'], $LNG['tech'][$resourceID]), array(array(
'label' => $LNG['sys_back'],
'url' => 'game.php?page=trader'
)));
}
else
{
$tradeSum += $tradeAmount;
$USER[$resource[$resourceID]] -= $usedResources;
}
if($resourceID == 921)
{
$USER[$resource[$resourceID]] += Config::get()->darkmatter_cost_trader;
}
}
else
{
throw new Exception('Unknown resource ID #'.$resourceID);
}
if(isset($PLANET[$resource[$tradeRessID]]))
{
$PLANET[$resource[$tradeRessID]] += $tradeAmount;
}
elseif(isset($USER[$resource[$tradeRessID]]))
{
$USER[$resource[$tradeRessID]] += $tradeAmount;
}
else
{
throw new Exception('Unknown resource ID #'.$tradeRessID);
}
} -
sven -
who is the mistake?
-
-
sven -
hi i have a question in 2 moons 2.0 in the Admin Panel when i will klick i have this error can you help me???
[05-Apr-2023 20:32:48] USER ERROR: "Permission error!"
File: /www/htdocs/w01d6aeb/mkmatz.eno-intern.de/U700/includes/pages/adm/ShowConfigModsPage.php | Line: 13
URL: mkmatz.eno-intern.de/U700/admin.php?page=configmods | Version: 2.0.git
Stack trace:
#0 /admin.php(70): include_once()
#1 {main}-
Danter14 -
Hello, you don't have the right to execute this file, you can delete this line if you don't want to bother with this error because it can come from a lot of problems.
if (!allowedTo(str_replace(array(dirname(__FILE__), '\\', '/', '.php'), '', __FILE__))) throw new Exception("Permission error!");
-
-
sven -
<a href-"game.php?page-moonBuy"><i class-"far fa-moon"></i> {$LNG.ov_create_moon}</a> can you help what is here wrong?
-
Danter14 -
<a href="game.php?page-moonBuy"><i class="far fa-moon"></i> {$LNG.ov_create_moon}</a>
You had it in my file if yes tell me that I correct it -
sven -
yes can you give me yours? now i have this mistake
Message: SQLSTATE[HY000]: General error: 1034 Index for table 'uni1_planets' is corrupt; try to repair it
Query-Code:SELECT * FROM uni1_planets WHERE id = ;
File: /includes/classes/Database.class.php
Line: 126
URL: localhost/game/2Moons/2moons/game.php
PHP-Version: 7.3.33
PHP-API: apache2handler
2Moons Version: 2.0.git
Debug Backtrace:
#0 /includes/classes/Database.class.php(202): Database->_query('SELECT * FROM u...', Array, 'select')
#1 /includes/common.php(174): Database->selectSingle('SELECT * FROM %...', Array)
#2 /game.php(24): require('D://xamp//htdocs//...') -
Danter14 -
2moons.de/index.php?thread/135…0/&postID=10178#post10178
You have it right here -
sven -
can you tell me what the mistake is?
-
Danter14 -
The error you have is that it can't find your planet ID
-
-
yamilrh -
hola, conoces alguna herramienta o algo que me pueda permitir bloquear el acceso a mi xnova, para aquellos usuarios que usan proxy anónimos o vpn
-
sven -
hi warum kann man oben 2 moons nicht mehr spielen? ich würde es gerne weiter verwalten wen es die möglichkeit gibt
-
yamilrh -
Hola, hace mucho que ya no se muestra activo como antes, por fin 2moons 3.0
-
Danter14 -
Hello, in view of the number of votes the project is on hold because 9 votes for 689 members currently on the forum. I don't want to waste time on developing a new web and mobile version if it's not tracked and without feedback.
-
yamilrh -
si entiendo perfectamente.
-
Yaro2709 -
Извините, что вмешиваюсь в разговор, но я считаю, что если совершенно ничего не делать, то 2Moons умрет. Хоть активность и желает лучшего, но следует понять, что она упала именно из-за консервативности общества и его "ленивости" (конечно "жадность" и "корысть" людей тоже сыграла свою роль в развитие 2Moons). Если все же вы захотите вернуться к разработке, то я был бы рад вас видеть в проекте New-Star. Совершенно недавно я подключил к нему мульти-дизайность, поэтому вы с лёгкостью сможете разрабатывать свой дизайн поверх движка.
-
Danter14 -
Regarding 2moons in itself I understand that if nothing is done it will fall into oblivion I agree with you above.
2moons is an open source code I understand that certain is not for the disclosure of the improvements which it brings because it also puts a time of design, for the beginner developer what saddens me is that it does not make any more learning of development at the slightest problem it directly requires a resolution by another person.
In terms of multi-design, I also developed it.
For the new 2moons, I had thought of doing it directly on a cell phone via an application because we are not going to lie to each other all through cellphones now -
yamilrh -
Pienso que una nueva versión de 2moon requiere de nueva tecnología, depurar el código que por muchos años se lleva arrastrando curre de tantas mano que paso al ser open source. Pero se necesita 2moons 3.0
now
-
-
SAAS -
Hello! which files to edit here to add new raw material, so that it would be ok
thx -
Jekill -
Buenas, le hice un par de correciones al 2Moons 2.0 para PHP 7.4.5 y no se a donde podria subirla. Saludos!
-
WARNING
Message: session_start(): Unable to clear session lock record
File: /includes/classes/Session.class.php
Line: 137
URL: xnova.nat.cu/game.php?page=alliance
PHP-Version: 7.2.24
PHP-API: fpm-fcgi
2Moons Version: 2.2.git
Debug Backtrace:
#0 [internal function]: errorHandler(2, 'session_start()...', 'FILEPATH ...', 137, Array)
#1 /includes/classes/Session.class.php(137): session_start()
#2 /includes/common.php(114): Session::load()
#3 /game.php(24): require_once('FILEPATH ...')
#4 {main} -
Fatal error: Cannot redeclare class FlyingFleetHandler in /srv/www/www.xnova.nat.cu/htdocs/includes/classes/class.FlyingFleetHandler.php on line 18
entonces como pasa eso si solo lo realizo una vez no hay como solucionar ese error-
Skylon -
Lo arregle al quitar las llamadas (require y require_once) de la clase ShowAlliancePage.class.php.
El tema es que hace dos llamadas a la clase class.FlyingFleetHandler.php y crea este conflicto.
Debes poner una sola llamada que sirva para ambas funciones de la clase ShowAlliancePage
-
-
Skylon -
How can I put temporary ships.
For example, ships that are available only on specific dates or for a defined period of time.
I was studying the function isElementBuyable but I would like some advice from you before entering to modify code unnecessarily.-
Danter14 -
You have more possibility to do that, be you made an addition for example of a column in the database is to change the display code is of construction or to do it in raw code.
-
-
yamilrh -
amigo me sucede lo siguiente, cuando espio un enemigo veo la flota que le mantienen en posicion en dicho planeta pero esta flota aun no se a estacionado en este planeta, como corrijo eso?
-
Danter14 -
Hello, thank you to look in your error.log the error message that is produced when the probe arrives on a planet
-
yamilrh -
oka, ya miro y le digo. Slaudos y gracias
-
Skylon -
El problema esta en la consulta SQL a la base de datos.
Linea 59 a la 64 de MissionCaseSpy -
yamilrh -
tienes la solucion sería bueno que la compartieras
-
-
Saludos tu podrías ayudarme tengo montado la versión 1.9 pero después de un tiempo las al crear una alianza no me deja cambiarle el rango como se puede resolver eso me podrías ayudar
-
Danter14 -
Version 1.9 is too much trouble because many people work on it.
I advise you to be done by Thisishowwedoit or version 2.0 which is more stable but has no mod associate.
You can, however, include mods from version 1.8 and 1.9 on version 2.0 -
es que me gusta mas estas versiones no podrías ayudarme a solucionar el problema de esta que la tengo como dije montada j ya y todo xnova.nat.cu y la he corregido vasta aunque me quedan algunas detalles mas por arreglar
-
Danter14 -
What exactly do you have problem with version 1.9
-
-
Skylon -
You know the differences between XTERIUM TYPE_GAME_ONE and TYPE_GAME_TWO?
sven -
The fees are calculated. That works, thanks for that, but no 1500 DM are calculated as set in the admin panel. Do I have to set this separately in the file? Thank you for your trouble