forked from thekabal/tki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
121 lines (103 loc) · 6.28 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php declare(strict_types = 1);
/**
* settings.php from The Kabal Invasion.
* The Kabal Invasion is a Free & Opensource (FOSS), web-based 4X space/strategy game.
*
* @copyright 2020 The Kabal Invasion development team, Ron Harwood, and the BNT development team
*
* @license GNU AGPL version 3.0 or (at your option) any later version.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
$index_page = true;
require_once './common.php';
$link = null;
// Database driven language entries
$langvars = Tki\Translate::load($pdo_db, $lang, array('common', 'footer',
'index', 'insignias', 'login', 'logout',
'main', 'regional', 'settings', 'universal'));
$variables = null;
$variables['lang'] = $lang;
$variables['link'] = $link;
$variables['title'] = $langvars['l_set_settings'];
$variables['link_forums'] = $tkireg->link_forums;
$variables['admin_mail'] = $tkireg->admin_mail;
$variables['body_class'] = 'settings';
$variables['release_version'] = $tkireg->release_version;
$variables['game_name'] = $tkireg->game_name;
$variables['mine_hullsize'] = $tkireg->mine_hullsize;
$variables['max_ewdhullsize'] = $tkireg->max_ewdhullsize;
$variables['max_sectors'] = number_format($tkireg->max_sectors, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
$variables['max_links'] = $tkireg->max_links;
$variables['max_fed_hull'] = $tkireg->max_fed_hull;
$variables['allow_ibank'] = (bool) $tkireg->allow_ibank;
$variables['ibank_interest'] = $tkireg->ibank_interest * 100;
$variables['ibank_loaninterest'] = $tkireg->ibank_loaninterest * 100;
$variables['base_defense'] = $tkireg->base_defense;
$variables['colonist_limit'] = number_format($tkireg->colonist_limit, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
$variables['max_turns'] = number_format($tkireg->max_turns, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
$variables['max_planets_sector'] = $tkireg->max_planets_sector;
$variables['max_traderoutes_player'] = $tkireg->max_traderoutes_player;
$variables['colonist_production_rate'] = $tkireg->colonist_production_rate;
$variables['energy_per_fighter'] = $tkireg->energy_per_fighter;
$variables['defense_degrade_rate'] = $tkireg->defense_degrade_rate * 100;
$variables['min_bases_to_own'] = $tkireg->min_bases_to_own;
$variables['interest_rate'] = number_format(($tkireg->interest_rate - 1) * 100, 3, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
$variables['sched_ticks'] = $tkireg->sched_ticks;
$variables['sched_turns'] = $tkireg->sched_turns;
$variables['sched_ibank'] = $tkireg->sched_ibank;
$variables['sched_news'] = $tkireg->sched_news;
$variables['sched_planets'] = $tkireg->sched_planets;
$variables['max_credits_without_base'] = $tkireg->max_credits_without_base;
$variables['sched_ports'] = $tkireg->sched_ports;
$variables['sched_ranking'] = $tkireg->sched_ranking;
$variables['sched_degrade'] = $tkireg->sched_degrade;
$variables['sched_apocalypse'] = $tkireg->sched_apocalypse;
$variables['port_regenrate'] = $tkireg->port_regenrate;
// Colonists needed to produce 1 Fighter each turn
$variables['cols_needed_fit'] = number_format((1 / $tkireg->colonist_production_rate) / $tkireg->fighter_prate, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
// Colonists needed to produce 1 Torpedo each turn
$variables['cols_needed_torp'] = number_format((1 / $tkireg->colonist_production_rate) / $tkireg->torpedo_prate, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
// Colonists needed to produce 1 Ore each turn
$variables['cols_needed_ore'] = number_format((1 / $tkireg->colonist_production_rate) / $tkireg->ore_prate, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
// Colonists needed to produce 1 Organics each turn
$variables['cols_needed_org'] = number_format((1 / $tkireg->colonist_production_rate) / $tkireg->organics_prate, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
// Colonists needed to produce 1 Goods each turn
$variables['cols_needed_goods'] = number_format((1 / $tkireg->colonist_production_rate) / $tkireg->goods_prate, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
// Colonists needed to produce 1 Energy each turn
$variables['cols_needed_ene'] = number_format((1 / $tkireg->colonist_production_rate) / $tkireg->energy_prate, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
// Colonists needed to produce 1 Credits each turn
$variables['cols_needed_cred'] = number_format((1 / $tkireg->colonist_production_rate) / $tkireg->credits_prate, 0, $langvars['local_number_dec_point'], $langvars['local_number_thousands_sep']);
// Get list of available languages
$variables['list_of_langs'] = Tki\Languages::listAvailable($pdo_db, $lang);
// Temporarily set the template to the default template until we have a user option
$variables['template'] = $tkireg->default_template;
if (empty($_SESSION['username']))
{
$variables['loggedin'] = true;
$variables['linkback'] = array('caption' => $langvars['l_universal_main_login'], 'link' => 'index.php');
}
else
{
$variables['loggedin'] = false;
$variables['linkback'] = array('caption' => $langvars['l_universal_main_menu'], 'link' => 'main.php');
}
$header = new Tki\Header();
$header->display($pdo_db, $lang, $template, $variables['title'], $variables['body_class']);
$template->addVariables('langvars', $langvars);
$template->addVariables('variables', $variables);
$template->display('settings.tpl');
$footer = new Tki\Footer();
$footer->display($pdo_db, $lang, $tkireg, $tkitimer, $template);