forked from thekabal/tki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
info_publiclist.php
159 lines (128 loc) · 6.36 KB
/
info_publiclist.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php declare(strict_types = 1);
/**
* info_publiclist.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/>.
*
*/
require_once './common.php';
$info = array();
$info['GAMENAME'] = $tkireg->game_name;
$info['GAMEID'] = md5($tkireg->game_name . $tkireg->tki_ls_key);
$xsql = "SELECT UNIX_TIMESTAMP(time) as x FROM {$old_db->prefix}movement_log WHERE event_id = 1";
$res = $old_db->Execute($xsql);
$row = $res->fields;
$info['START-DATE'] = $row['x'];
$info['G-DURATION'] = -1;
$xsql = "SELECT count(*) as x FROM {$old_db->prefix}ships";
$res = $old_db->Execute($xsql);
$row = $res->fields;
$info['P-ALL'] = $row['x'];
$xsql = "SELECT count(*) as x FROM {$old_db->prefix}ships WHERE ship_destroyed = 'N' ";
$res = $old_db->Execute($xsql);
$row = $res->fields;
$info['P-ACTIVE'] = $row['x'];
$xsql = "SELECT count(*) as x FROM {$old_db->prefix}ships WHERE ship_destroyed = 'N' AND email NOT LIKE '%@kabal'";
$res = $old_db->Execute($xsql);
$row = $res->fields;
$info['P-HUMAN'] = $row['x'];
$xsql = "SELECT COUNT(*) as x FROM {$old_db->prefix}ships WHERE (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(last_login)) / 60 <= 5 and email NOT LIKE '%@kabal'";
$res = $old_db->Execute($xsql);
$row = $res->fields;
$info['P-ONLINE'] = $row['x'];
$res = $old_db->Execute("SELECT AVG(hull) AS a1 , AVG(engines) AS a2 , AVG(power) AS a3 , AVG(computer) AS a4 , AVG(sensors) AS a5 , AVG(beams) AS a6 , AVG(torp_launchers) AS a7 , AVG(shields) AS a8 , AVG(armor) AS a9 , AVG(cloak) AS a10 FROM {$old_db->prefix}ships WHERE ship_destroyed='N' and email LIKE '%@kabal'");
$row = $res->fields;
$dyn_kabal_lvl = $row['a1'] + $row['a2'] + $row['a3'] + $row['a4'] + $row['a5'] + $row['a6'] + $row['a7'] + $row['a8'] + $row['a9'] + $row['a10'];
$dyn_kabal_lvl = $dyn_kabal_lvl / 10;
$info['P-AI-LVL'] = $dyn_kabal_lvl;
$xsql = "SELECT character_name, score FROM {$old_db->prefix}ships WHERE ship_destroyed = 'N' ORDER BY score DESC LIMIT 3 ";
$res = $old_db->Execute($xsql);
while (!$res->EOF)
{
$row = $res->fields;
$tmp = $res->CurrentRow() + 1;
$info['P-TOP{$tmp}-NAME'] = $row['character_name'];
$info['P-TOP{$tmp}-SCORE'] = $row['score'];
$res->MoveNext();
}
$info['G-TURNS-START'] = 1200;
$info['G-TURNS-MAX'] = $tkireg->max_turns;
$info['G-SCHED-TICKS'] = $tkireg->sched_ticks;
$info['G-SCHED-TYPE'] = $tkireg->sched_type;
$info['G-SPEED-TURNS'] = $tkireg->sched_turns;
$info['G-SPEED-PORTS'] = $tkireg->sched_ports;
$info['G-SPEED-PLANETS'] = $tkireg->sched_planets;
$info['G-SPEED-IBANK'] = $tkireg->sched_ibank;
$info['G-SIZE-SECTOR'] = $tkireg->max_sectors;
$info['G-SIZE-UNIVERSE'] = $tkireg->universe_size;
$info['G-SIZE-PLANETS'] = $tkireg->max_planets_sector;
$info['G-SIZE-PLANETS-TO-OWN'] = $tkireg->min_bases_to_own;
$info['G-COLONIST-LIMIT'] = $tkireg->colonist_limit;
$info['G-DOOMSDAY-VALUE'] = $tkireg->doomsday_value;
$info['G-MONEY-IBANK'] = $tkireg->ibank_interest;
$info['G-MONEY-PLANET'] = round($tkireg->interest_rate - 1, 4);
$info['G-PORT-LIMIT-ORE'] = $tkireg->ore_limit;
$info['G-PORT-RATE-ORE'] = $tkireg->ore_delta;
$info['G-PORT-DELTA-ORE'] = $tkireg->ore_delta;
$info['G-PORT-LIMIT-ORGANICS'] = $tkireg->organics_limit;
$info['G-PORT-RATE-ORGANICS'] = $tkireg->organics_rate;
$info['G-PORT-DELTA-ORGANICS'] = $tkireg->organics_delta;
$info['G-PORT-LIMIT-GOODS'] = $tkireg->goods_limit;
$info['G-PORT-RATE-GOODS'] = $tkireg->goods_rate;
$info['G-PORT-DELTA-GOODS'] = $tkireg->goods_delta;
$info['G-PORT-LIMIT-ENERGY'] = $tkireg->energy_limit;
$info['G-PORT-RATE-ENERGY'] = $tkireg->energy_rate;
$info['G-PORT-DELTA-ENERGY'] = $tkireg->energy_delta;
$info['G-SOFA'] = ($tkireg->allow_sofa === true ? "1" : "0");
$info['G-KSM'] = ($tkireg->allow_ksm ? "1" : "0");
$info['S-CLOSED'] = ($tkireg->game_closed ? "1" : "0");
$info['S-CLOSED-ACCOUNTS'] = ($tkireg->account_creation_closed ? "1" : "0");
$info['ALLOW_FULLSCAN'] = ($tkireg->allow_fullscan ? "1" : "0");
$info['ALLOW_NAVCOMP'] = ($tkireg->allow_navcomp ? "1" : "0");
$info['ALLOW_IBANK'] = ($tkireg->allow_ibank ? "1" : "0");
$info['ALLOW_GENESIS_DESTROY'] = ($tkireg->allow_genesis_destroy ? "1" : "0");
$info['INVENTORY_FACTOR'] = $tkireg->inventory_factor;
$info['UPGRADE_COST'] = $tkireg->upgrade_cost;
$info['UPGRADE_FACTOR'] = $tkireg->upgrade_factor;
$info['LEVEL_FACTOR'] = $tkireg->level_factor;
$info['DEV_GENESIS_PRICE'] = $tkireg->dev_genesis_price;
$info['DEV_BEACON_PRICE'] = $tkireg->dev_beacon_price;
$info['DEV_EMERWARP_PRICE'] = $tkireg->dev_emerwarp_price;
$info['DEV_WARPEDIT_PRICE'] = $tkireg->dev_warpedit_price;
$info['DEV_MINEDEFLECTOR_PRICE'] = $tkireg->dev_minedeflector_price;
$info['DEV_ESCAPEPOD_PRICE'] = $tkireg->dev_escapepod_price;
$info['DEV_FUELSCOOP_PRICE'] = $tkireg->dev_fuelscoop_price;
$info['DEV_LSSD_PRICE'] = $tkireg->dev_lssd_price;
$info['FIGHTER_PRICE'] = $tkireg->fighter_price;
$info['TORPEDO_PRICE'] = $tkireg->torpedo_price;
$info['ARMOR_PRICE'] = $tkireg->armor_price;
$info['COLONIST_PRICE'] = $tkireg->colonist_price;
$info['BASE_DEFENSE'] = $tkireg->base_defense;
$info['COLONIST_PRODUCTION_RATE'] = $tkireg->colonist_production_rate;
$info['COLONIST_REPRODUCTION_RATE'] = $tkireg->colonist_reproduction_rate;
$info['ORGANICS_CONSUMPTION'] = $tkireg->organics_consumption;
$info['STARVATION_DEATH_RATE'] = $tkireg->starvation_death_rate;
$info['TEAM_PLANET_TRANSFERS'] = ($tkireg->team_planet_transfers ? "1" : "0");
$info['MAX_TEAM_MEMBERS'] = $tkireg->max_team_members;
$info['ADMIN_MAIL'] = $tkireg->admin_mail;
$info['LINK_FORUMS'] = $tkireg->link_forums;
foreach ($info as $key => $value)
{
echo $key . ":" . $value . "<br>";
}