Skip to content
Permalink
Browse files

Mods Expedition Limit

Added resource limitation mods during an expedition by admin panel
  • Loading branch information
HikeGame committed Jan 18, 2019
1 parent c5843b9 commit bb5b67c4319cb891c9c3426e70e747153002ace9
@@ -66,6 +66,10 @@
include_once('includes/pages/adm/ShowConfigUniPage.php');
ShowConfigUniPage();
break;
case 'configmods':
include_once('includes/pages/adm/ShowConfigModsPage.php');
ShowConfigModsPage();
break;
case 'chat':
include_once('includes/pages/adm/ShowChatConfigPage.php');
ShowChatConfigPage();
@@ -122,7 +122,11 @@ function EndStayEvent()
$maxFactor = 2400;
}

$founded = round(min($fleetCapacity,min($maxFactor, max(200, $factor)) * $fleetPoints));
if ($config->expedition_limit_res_active == 1) {
$founded = round(min($config->expedition_limit_res, $fleetCapacity));
} else {
$founded = round(min($fleetCapacity,min($maxFactor, max(200, $factor)) * $fleetPoints));
}

$fleetColName = 'fleet_resource_'.$resource[$resourceId];
$this->UpdateFleet($fleetColName, $this->_fleet[$fleetColName] + $founded);
@@ -0,0 +1,57 @@
<?php
/**
* 2moons-2.0
* The project is reserved for its owner for any bug or question you can contact him
* Created by 2moons-2.0.
* User: Danter14 (danter14000@gmail.com)
* Copyright: 2019 - Danter14
* GitHub: https://github.com/HikeGame/Spaccon-1.0
* Date: 17/01/2019
* File: ShowConfigModsPage.php
* Version: 1.0.0
*/
if (!allowedTo(str_replace(array(dirname(__FILE__), '\\', '/', '.php'), '', __FILE__))) throw new Exception("Permission error!");

function ShowConfigModsPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());

if (!empty($_POST))
{
$config_before = array(
'expedition_limit_res' => $config->expedition_limit_res,
'expedition_limit_res_active' => $config->expedition_limit_res_active,
);

$expedition_limit_res_active = isset($_POST['expedition_limit_res_active']) && $_POST['expedition_limit_res_active'] == 'on' ? 1 : 0;

$expedition_limit_res = HTTP::_GP('expedition_limit_res', 0);

$config_after = array(
'expedition_limit_res' => $expedition_limit_res,
'expedition_limit_res_active' => $expedition_limit_res_active,
);

foreach($config_after as $key => $value)
{
$config->$key = $value;
}
$config->save();

$LOG = new Log(3);
$LOG->target = 0;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}

$template = new template();

$template->assign_vars(array(
'expedition_limit_res' => $config->expedition_limit_res,
'expedition_limit_res_active' => $config->expedition_limit_res_active,
));

$template->show('ConfigModsBody.tpl');
}
@@ -288,6 +288,8 @@ CREATE TABLE `%PREFIX%config` (
`disclamerMail` text NOT NULL,
`disclamerNotice` text NOT NULL,
`alliance_create_min_points` BIGINT UNSIGNED NOT NULL DEFAULT 0,
`expedition_limit_res_active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`expedition_limit_res` double(255,0) unsigned NOT NULL DEFAULT '1000000',
PRIMARY KEY (`uni`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

@@ -31,4 +31,16 @@
$LNG['ov_create_moon'] = "Create moon";
$LNG['ov_list_title_build'] = "Building";
$LNG['ov_list_title_tech'] = "Research";
$LNG['ov_list_title_fleet'] = "Fleet/Defense";
$LNG['ov_list_title_fleet'] = "Fleet/Defense";

/**
* Admin
*/
// ShowMenuPage.tpl
$LNG['mu_mods_settings'] = "Configure Mods";
// ConfigModsBody.tpl
$LNG['msg_expedition'] = "Shipping Configuration";
$LNG['msg_expedition_active'] = "Limit system";
$LNG['msg_expedition_active_desc'] = "When activating this system you can put a limit on the resources to find during an expedition by the players";
$LNG['msg_expedition_active_price'] = "Maximum amount of resources";
$LNG['msg_expedition_active_price_desc'] = "Maximum amount the player can find on an expedition even if the capacity is higher";
@@ -44,3 +44,15 @@
$LNG['ov_list_title_build'] = "Bâtiment";
$LNG['ov_list_title_tech'] = "Recherche";
$LNG['ov_list_title_fleet'] = "Flotte/Défense";

/**
* Admin
*/
// ShowMenuPage.tpl
$LNG['mu_mods_settings'] = "Configurer les Mods";
// ConfigModsBody.tpl
$LNG['msg_expedition'] = "Configuration Expédition";
$LNG['msg_expedition_active'] = "Système de limite";
$LNG['msg_expedition_active_desc'] = "Lors de l'activation de ce système vous pouvez mettre une limite sur les ressource trouver lors d'une expédition par les joueurs";
$LNG['msg_expedition_active_price'] = "Montant des ressources maximum";
$LNG['msg_expedition_active_price_desc'] = "Montant maximum que le joueur peut trouver lors d'une expédition même si la capacité est supérieur";
@@ -0,0 +1,25 @@
{include file="overall_header.tpl"}
<center>
<form action="" method="post">
<input type="hidden" name="opt_save" value="1">
<table width="70%" cellpadding="2" cellspacing="2">
<tr>
<th colspan="2">{$LNG.msg_expedition}</th><th>&nbsp;</th>
</tr
<tr>
<td>{$LNG.msg_expedition_active}<br></td>
<td><input name="expedition_limit_res_active"{if $expedition_limit_res_active} checked="checked"{/if} type="checkbox"></td>
<td><img src="./styles/resource/images/admin/i.gif" width="16" height="16" alt="" class="tooltip" data-tooltip-content="{$LNG.msg_expedition_active_desc}"></td>
</tr>
<tr>
<td>{$LNG.msg_expedition_active_price}</td>
<td><input name="expedition_limit_res" maxlength="40" size="60" value="{$expedition_limit_res}" type="text"></td>
<td><img src="./styles/resource/images/admin/i.gif" width="16" height="16" alt="" class="tooltip" data-tooltip-content="{$LNG.msg_expedition_active_price_desc}"></td>
</tr>
<tr>
<td colspan="3"><input value="{$LNG.se_save_parameters}" type="submit"></td>
</tr>
</table>
</form>
</center>
{include file="overall_footer.tpl"}
@@ -6,6 +6,7 @@
{if allowedTo('ShowInformationPage')}<li><a href="?page=infos" target="Hauptframe">{$LNG.mu_game_info}</a></li>{/if}
{if allowedTo('ShowConfigBasicPage')}<li><a href="?page=config" target="Hauptframe">{$LNG.mu_settings}</a></li>{/if}
{if allowedTo('ShowConfigUniPage')}<li><a href="?page=configuni" target="Hauptframe">{$LNG.mu_unisettings}</a></li>{/if}
{if allowedTo('ShowConfigModsPage')}<li><a href="?page=configmods" target="Hauptframe">{$LNG.mu_mods_settings}</a></li>{/if}
{if allowedTo('ShowChatConfigPage')}<li><a href="?page=chat" target="Hauptframe">{$LNG.mu_chat}</a></li>{/if}
{if allowedTo('ShowTeamspeakPage')}<li><a href="?page=teamspeak" target="Hauptframe">{$LNG.mu_ts_options}</a></li>{/if}
{if allowedTo('ShowFacebookPage')}<li><a href="?page=facebook" target="Hauptframe">{$LNG.mu_fb_options}</a></li>{/if}

0 comments on commit bb5b67c

Please sign in to comment.
You can’t perform that action at this time.