1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by Gorlum 29.10.2016 10:16 |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* |
9
|
|
|
* This class is used to handle server configuration |
10
|
|
|
* |
11
|
|
|
* @package supernova |
12
|
|
|
* |
13
|
|
|
* @property string $db_prefix - REMOVE! Just for compatibility! |
14
|
|
|
* |
15
|
|
|
* @property int $debug |
16
|
|
|
* |
17
|
|
|
* @property string $db_version |
18
|
|
|
* |
19
|
|
|
* @property string $ali_bonus_members => 10, // Minimum alliance size to start using bonus |
20
|
|
|
* |
21
|
|
|
* @property string $auth_vkontakte_app_id |
22
|
|
|
* @property string $auth_vkontakte_app_key |
23
|
|
|
* @property string $auth_vkontakte_token |
24
|
|
|
* @property int $auth_vkontakte_token_expire |
25
|
|
|
* |
26
|
|
|
* @property int $BuildLabWhileRun => 0, // Allow to build lab/Nanolab while tech researching AND allowing research tech while lab/Nanolab |
27
|
|
|
* |
28
|
|
|
* @property string $COOKIE_NAME => 'SuperNova' |
29
|
|
|
* |
30
|
|
|
* @property int $empire_mercenary_base_period => PERIOD_MONTH, // Base hire period for price calculations |
31
|
|
|
* @property int $empire_mercenary_temporary => 0, // Temporary empire-wide mercenaries |
32
|
|
|
* |
33
|
|
|
* @property int $fleet_update_max_run_time => 30, // Maximum length in seconds for single fleet dispatch run. Should be 1 second or more |
34
|
|
|
* @property int $fleet_update_interval => 4 second // how often fleets should be updated |
35
|
|
|
* @property int $fleet_update_last => SN_TIME_NOW // unixtime - when fleet was updated last |
36
|
|
|
* @property int $fleet_update_lock => '' // SQL time when lock was acquired |
37
|
|
|
* |
38
|
|
|
* @property string $game_adminEmail => 'root@localhost', // Admin's email to show to users |
39
|
|
|
* |
40
|
|
|
* @property string $game_default_language => 'ru' |
41
|
|
|
* @property string $game_default_skin => 'skins/EpicBlue/' |
42
|
|
|
* @property string $game_default_template => 'OpenGame' |
43
|
|
|
* |
44
|
|
|
* @property int $game_disable => GAME_DISABLE_INSTALL - Current game status - see GAME_DISABLE_xxx |
45
|
|
|
* @property string $game_disable_reason => 'SuperNova is in maintenance mode! Please return later!' - Status for custom disable reason |
46
|
|
|
* |
47
|
|
|
* @property int $game_maxGalaxy => 5 |
48
|
|
|
* @property int $game_maxSystem => 199 |
49
|
|
|
* @property int $game_maxPlanet => 15 |
50
|
|
|
* |
51
|
|
|
* @property string $game_name Server name as it would be seen through game |
52
|
|
|
* |
53
|
|
|
* @property string $game_watchlist |
54
|
|
|
* |
55
|
|
|
* @property int $metal_basic_income => 40, |
56
|
|
|
* @property int $crystal_basic_income => 20, |
57
|
|
|
* @property int $deuterium_basic_income => 0, |
58
|
|
|
* @property int $energy_basic_income => 0, |
59
|
|
|
* |
60
|
|
|
* @property int $game_news_actual How long announcement would be marked as "New". In seconds. Default - 3 days PERIOD_DAY_3 |
61
|
|
|
* @property int $game_news_overview How much last news to show in Overview page. Default - 3 |
62
|
|
|
* @property int $game_news_overview_show How long news will be shown in Overview page in seconds. Default - 2 weeks. 0 - show all |
63
|
|
|
* |
64
|
|
|
* @property int $game_noob_factor => 5 // Multiplier to divide "stronger" and "weaker" users |
65
|
|
|
* @property int $game_noob_points => 5000 // Below this point user treated as noob. 0 to disable |
66
|
|
|
* |
67
|
|
|
* @property string $int_format_date => 'd.m.Y' // Date default format |
68
|
|
|
* @property string $int_format_time => 'H:i:s' // Time default format |
69
|
|
|
* |
70
|
|
|
* @property int $menu_server_name_disabled => 0 |
71
|
|
|
* @property int $menu_launch_date_disabled => 0 |
72
|
|
|
* @property int $menu_server_logo => MENU_SERVER_LOGO_DEFAULT |
73
|
|
|
* @property int $menu_server_logo_disabled => 0 |
74
|
|
|
* |
75
|
|
|
* @property string $payment_currency_default => 'USD', |
76
|
|
|
* @property float $payment_currency_exchange_dm_ => 20000, |
77
|
|
|
* @property float $payment_currency_exchange_mm_ => 20000, |
78
|
|
|
* @property float $payment_currency_exchange_eur => 0.90, |
79
|
|
|
* @property float $payment_currency_exchange_rub => 60, |
80
|
|
|
* @property float $payment_currency_exchange_uah => 30, |
81
|
|
|
* @property float $payment_currency_exchange_usd => 1, |
82
|
|
|
* @property float $payment_currency_exchange_wmb => 18000, |
83
|
|
|
* @property float $payment_currency_exchange_wme => 0.9, |
84
|
|
|
* @property float $payment_currency_exchange_wmr => 60, |
85
|
|
|
* @property float $payment_currency_exchange_wmu => 30, |
86
|
|
|
* @property float $payment_currency_exchange_wmz => 1, |
87
|
|
|
* |
88
|
|
|
* @property int $tutorial_first_item ID of first item of tutorial |
89
|
|
|
* |
90
|
|
|
* @property int $url_faq URL of FAQ root |
91
|
|
|
* |
92
|
|
|
* @property int $users_amount => 1, // Total users count |
93
|
|
|
* @property int $game_users_online_timeout => PERIOD_MINUTE_15, // How long user should considered ONLINE for online counter (seconds) |
94
|
|
|
* @property int $game_users_update_online => 30, // How often user online should be refreshed (seconds) |
95
|
|
|
* @property int $var_online_user_time => 0, // When last time user online was refreshed (Unix timestamp) |
96
|
|
|
* @property int $var_online_user_count => 0, // Last calculated online user count |
97
|
|
|
* @property int $server_log_online => 0, // Log online user count |
98
|
|
|
* |
99
|
|
|
* @property int $quest_total => 0, // Total number of quests |
100
|
|
|
* |
101
|
|
|
* @property float $resource_multiplier => 1, // aka Mining speed |
102
|
|
|
* @property float $game_speed => 1, // Game speed aka Building/Research speed |
103
|
|
|
* @property float $fleet_speed => 1, // Fleet speed |
104
|
|
|
* @property float $game_speed_expedition => 1, // Game expedition speed |
105
|
|
|
* |
106
|
|
|
* @property int $tpl_minifier => 0, // Template minifier |
107
|
|
|
* @property int $tpl_allow_php => 0, // PTL allow INCLUDEPHP and PHP tags |
108
|
|
|
* |
109
|
|
|
* @property int $uni_galaxy_distance => 20000, // Distance between galaxies |
110
|
|
|
* |
111
|
|
|
* ----- Player settings |
112
|
|
|
* @property int|float $player_metamatter_immortal => 200000, // MM amount to reward account with Immortal status |
113
|
|
|
* |
114
|
|
|
* @property int $game_user_changename => 2, // Is user allowed to change name after registration? |
115
|
|
|
* @property int $game_user_changename_cost => 100000, // Change name cost for paid changename |
116
|
|
|
* |
117
|
|
|
* @property int $user_vacation_disable => 0, // Disable vacation mode for players |
118
|
|
|
* @property int $player_vacation_time => PERIOD_WEEK, // Minimal vacation length in seconds |
119
|
|
|
* @property int $player_vacation_timeout => PERIOD_WEEK, // Timeout after leaving vacation to start new one in seconds |
120
|
|
|
* |
121
|
|
|
* @property string $player_levels => '', // JSON-encoded array of [(int)level => (float)maxPointsForLevel] |
122
|
|
|
* @property string $player_levels_calculated => '2000-01-01 00:00:00', // Date and time where player level was calculated last |
123
|
|
|
* |
124
|
|
|
* @property int $player_delete_time => 3888000, // |
125
|
|
|
* |
126
|
|
|
* |
127
|
|
|
* |
128
|
|
|
* ----- Planet settings |
129
|
|
|
* @property int $LastSettedGalaxyPos => 1, |
130
|
|
|
* @property int $LastSettedPlanetPos => 1, |
131
|
|
|
* @property int $LastSettedSystemPos => 1, |
132
|
|
|
* |
133
|
|
|
* @property int $eco_planet_starting_crystal => 500, |
134
|
|
|
* @property int $eco_planet_starting_deuterium => 0, |
135
|
|
|
* @property int $eco_planet_starting_metal => 500, |
136
|
|
|
* @property int $eco_planet_storage_crystal => 500000, |
137
|
|
|
* @property int $eco_planet_storage_deuterium => 500000, |
138
|
|
|
* @property int $eco_planet_storage_metal => 500000, |
139
|
|
|
* |
140
|
|
|
* @property int $planet_capital_cost => 25000, // Cost in DM to move Capital to current planet |
141
|
|
|
* @property float $planet_capital_mining_rate => 2.0, // Capital Mining rates |
142
|
|
|
* @property float $planet_capital_building_rate => 2.0, // Capital Building rates |
143
|
|
|
* @property int $planet_teleport_cost => 50000, // Cost of planet teleportation |
144
|
|
|
* @property int $planet_teleport_timeout => 86400, // Timeout for next teleportation |
145
|
|
|
* |
146
|
|
|
* @property string $server_updater_check_auto => 0, // Server autocheck version |
147
|
|
|
* @property int $server_updater_check_last => 0, // Server last check time |
148
|
|
|
* @property int $server_updater_check_period => PERIOD_DAY, // Server autocheck period |
149
|
|
|
* @property int $server_updater_check_result => SNC_VER_NEVER, // Server last check result |
150
|
|
|
* @property int|string $server_updater_id => 0, // Server ID on update server |
151
|
|
|
* @property string $server_updater_key => '', // Server key on update server |
152
|
|
|
* |
153
|
|
|
* @property int $stats_hide_admins => 1, // Hide admins accounts from stat and stat of admins |
154
|
|
|
* @property string $stats_hide_player_list => '', // Comma separated list of player IDs which stat to hide. Used for bots, for example |
155
|
|
|
* @property int $stats_hide_pm_link => 0, // Hide PM link from stat screen |
156
|
|
|
* @property int $stats_history_days => 14, // За сколько дней хранить статистику в базе |
157
|
|
|
* @property string $stats_minimal_interval => STATS_RUN_INTERVAL_MINIMUM - Minimal interval between stat runs in seconds. Default - 600s aka 10 minutes |
158
|
|
|
* @property string $stats_schedule => '04:00:00' - Schedule for running stat updates - see readme.txt |
159
|
|
|
* @property string $stats_php_memory => ??????????????? |
160
|
|
|
* |
161
|
|
|
* @property int $upd_lock_time => Update lock time |
162
|
|
|
* |
163
|
|
|
* @property string $server_cypher => Internally generated cypher for in-server communications |
164
|
|
|
* |
165
|
|
|
* @property string $url_purchase_metamatter => URL to purchase MM for servers w/o payment modules |
166
|
|
|
* |
167
|
|
|
* @property string $var_db_update => '0' - SQL_DATE_TIME |
168
|
|
|
* @property string $var_db_update_end => '0' - SQL_DATE_TIME |
169
|
|
|
* |
170
|
|
|
* @property string $var_stat_update => '0' - SQL_DATE_TIME - when stat update was started |
171
|
|
|
* @property string $var_stat_update_end => '0' - SQL_DATE_TIME - ????????? |
172
|
|
|
* @property string $var_stat_update_admin_forced => '0' - SQL_DATE_TIME - Last time when update was triggered from admin console |
173
|
|
|
* @property string $var_stat_update_next => '' - SQL_DATE_TIME - Next time where stat update scheduled to run |
174
|
|
|
* @property string $var_stat_update_msg => 'Update never started' - Last stat update message |
175
|
|
|
* |
176
|
|
|
*/ |
177
|
|
|
class classConfig extends classPersistent { |
178
|
|
|
const DATE_TYPE_UNIX = 0; |
179
|
|
|
const DATE_TYPE_SQL_STRING = 1; |
180
|
|
|
|
181
|
|
|
const FLEET_UPDATE_RUN_LOCK = 'fleet_update_run_lock'; |
182
|
|
|
const FLEET_UPDATE_MAX_RUN_TIME = 'fleet_update_max_run_time'; |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Internal cypher string for server/server communication |
186
|
|
|
* |
187
|
|
|
* @var string $cypher |
188
|
|
|
*/ |
189
|
|
|
protected $cypher = ''; |
190
|
|
|
|
191
|
|
|
protected $defaults = array( |
192
|
|
|
// SEO meta |
193
|
|
|
'adv_conversion_code_payment' => '', |
194
|
|
|
'adv_conversion_code_register' => '', |
195
|
|
|
'adv_seo_meta_description' => '', |
196
|
|
|
'adv_seo_meta_keywords' => '', |
197
|
|
|
'adv_seo_javascript' => '', |
198
|
|
|
|
199
|
|
|
// Advert banner |
200
|
|
|
'advGoogleLeftMenuIsOn' => 0, |
201
|
|
|
'advGoogleLeftMenuCode' => '(Place here code for banner)', |
202
|
|
|
|
203
|
|
|
// Alliance bonus calculations |
204
|
|
|
'ali_bonus_algorithm' => 0, // Bonus calculation algorithm |
205
|
|
|
'ali_bonus_brackets' => 10, // Brackets count for ALI_BONUS_BY_RANK |
206
|
|
|
'ali_bonus_brackets_divisor' => 10,// Bonus divisor for ALI_BONUS_BY_RANK |
207
|
|
|
'ali_bonus_divisor' => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS |
208
|
|
|
'ali_bonus_members' => 10, // Minimum alliance size to start using bonus |
209
|
|
|
|
210
|
|
|
'allow_buffing' => 0, // Disable buffing check for TRANSPORT missions |
211
|
|
|
'ally_help_weak' => 0, // Allow strong players to HOLD on weak co-ally planets |
212
|
|
|
|
213
|
|
|
'auth_vkontakte_app_id' => '', |
214
|
|
|
'auth_vkontakte_app_key' => '', |
215
|
|
|
'auth_vkontakte_token' => '', |
216
|
|
|
'auth_vkontakte_token_expire' => '2000-01-01', |
217
|
|
|
|
218
|
|
|
// User avatar and alliance logo |
219
|
|
|
'avatar_max_height' => 128, // Maximum height |
220
|
|
|
'avatar_max_width' => 128, // Maximum width |
221
|
|
|
|
222
|
|
|
'BuildLabWhileRun' => 0, // Allow to build lab/Nanolab while tech researching AND allowing research tech while lab/Nanolab |
223
|
|
|
|
224
|
|
|
// Chat settings |
225
|
|
|
// Nick highlighting |
226
|
|
|
'chat_highlight_developer' => '<span class=\"nick_developer\">$1</span>', // Developer nick |
227
|
|
|
'chat_highlight_admin' => '<span class=\"nick_admin\">$1</span>', // Admin nick |
228
|
|
|
'chat_highlight_moderator' => '<span class=\"nick_moderator\">$1</span>', // Moderator nick |
229
|
|
|
'chat_highlight_operator' => '<span class=\"nick_operator\">$1</span>', // Operator nick |
230
|
|
|
'chat_highlight_premium' => '<span class=\"nick_premium\">$1</span>', // Premium nick |
231
|
|
|
// Other chat settings |
232
|
|
|
'chat_refresh_rate' => 5, // in seconds. Chat AJAX refresh rate |
233
|
|
|
'chat_timeout' => 900, // in seconds. Default = 15 min |
234
|
|
|
|
235
|
|
|
'COOKIE_NAME' => 'SuperNova', |
236
|
|
|
'debug' => 0, |
237
|
|
|
'Defs_Cdr' => 30, |
238
|
|
|
|
239
|
|
|
'eco_planet_starting_crystal' => 500, |
240
|
|
|
'eco_planet_starting_deuterium' => 0, |
241
|
|
|
'eco_planet_starting_metal' => 500, |
242
|
|
|
'eco_planet_storage_crystal' => 500000, |
243
|
|
|
'eco_planet_storage_deuterium' => 500000, |
244
|
|
|
'eco_planet_storage_metal' => 500000, |
245
|
|
|
|
246
|
|
|
'eco_scale_storage' => 1, |
247
|
|
|
'eco_stockman_fleet' => '', // Black Market - Starting amount of s/h ship merchant to sell |
248
|
|
|
'eco_stockman_fleet_populate' => 1, // Populate empty Stockman fleet with ships or not |
249
|
|
|
'empire_mercenary_base_period' => PERIOD_MONTH, // Base |
250
|
|
|
'empire_mercenary_temporary' => 0, // Temporary empire-wide mercenaries |
251
|
|
|
|
252
|
|
|
// Planet basic income |
253
|
|
|
'metal_basic_income' => 40, |
254
|
|
|
'crystal_basic_income' => 20, |
255
|
|
|
'deuterium_basic_income' => 0, |
256
|
|
|
'energy_basic_income' => 0, |
257
|
|
|
|
258
|
|
|
// Bashing protection settings |
259
|
|
|
'fleet_bashing_attacks' => 3, // Max amount of attack per wave - 3 by default |
260
|
|
|
'fleet_bashing_interval' => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default |
261
|
|
|
'fleet_bashing_scope' => 86400, // Interval on which bashing waves counts - 24h by default |
262
|
|
|
'fleet_bashing_war_delay' => 43200, // Delay before start bashing after declaring war to alliance - 12h by default |
263
|
|
|
'fleet_bashing_waves' => 3, // Max amount of waves per day - 3 by default |
264
|
|
|
|
265
|
|
|
'Fleet_Cdr' => 30, |
266
|
|
|
'fleet_speed' => 1, |
267
|
|
|
|
268
|
|
|
self::FLEET_UPDATE_MAX_RUN_TIME => 30, // Maximum length in seconds for single fleet dispatch run |
269
|
|
|
'fleet_update_interval' => 4, |
270
|
|
|
'fleet_update_lock' => '', // SQL time when lock was acquired |
271
|
|
|
|
272
|
|
|
'game_adminEmail' => 'root@localhost', // Admin's email to show to users |
273
|
|
|
'game_counter' => 0, // Does built-in page hit counter is on? |
274
|
|
|
// Defaults |
275
|
|
|
'game_default_language' => 'ru', |
276
|
|
|
'game_default_skin' => 'skins/EpicBlue/', |
277
|
|
|
'game_default_template' => 'OpenGame', |
278
|
|
|
|
279
|
|
|
'game_disable' => GAME_DISABLE_INSTALL, |
280
|
|
|
'game_disable_reason' => 'SuperNova is in maintenance mode! Please return later!', |
281
|
|
|
'game_email_pm' => 0, // Is allowed forwarding messages from PM to e-mail? |
282
|
|
|
// Universe size |
283
|
|
|
'game_maxGalaxy' => 5, |
284
|
|
|
'game_maxSystem' => 199, |
285
|
|
|
'game_maxPlanet' => 15, |
286
|
|
|
// Game global settings |
287
|
|
|
'game_mode' => 0, // 0 - SuperNova, 1 - oGame |
288
|
|
|
'game_name' => 'SuperNova', // Server name (would be on banners and on top of left menu) |
289
|
|
|
|
290
|
|
|
'game_news_actual' => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days |
291
|
|
|
'game_news_overview' => 3, // How much last news to show in Overview page |
292
|
|
|
'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks |
293
|
|
|
// Noob protection |
294
|
|
|
'game_noob_factor' => 5, // Multiplier to divide "stronger" and "weaker" users |
295
|
|
|
'game_noob_points' => 5000, // Below this point user treated as noob. 0 to disable |
296
|
|
|
|
297
|
|
|
'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts) |
298
|
|
|
|
299
|
|
|
'game_speed' => 1, // Game speed |
300
|
|
|
'game_speed_expedition' => 1, // Game expedition speed |
301
|
|
|
|
302
|
|
|
'game_user_changename' => 2, // Is user allowed to change name after registration? |
303
|
|
|
'game_user_changename_cost' => 100000, // Change name cost for paid changename |
304
|
|
|
|
305
|
|
|
'initial_fields' => 163, |
306
|
|
|
|
307
|
|
|
// Interface - UserBanner |
308
|
|
|
'int_banner_background' => 'design/images/banner.png', |
309
|
|
|
'int_banner_fontInfo' => 'terminator.ttf', |
310
|
|
|
'int_banner_fontRaids' => 'klmnfp2005.ttf', |
311
|
|
|
'int_banner_fontUniverse' => 'cristal.ttf', |
312
|
|
|
'int_banner_showInOverview' => 1, |
313
|
|
|
'int_banner_URL' => '/banner.php?type=banner', |
314
|
|
|
|
315
|
|
|
'int_format_date' => 'd.m.Y', // Date default format |
316
|
|
|
'int_format_time' => 'H:i:s', // Time default format |
317
|
|
|
|
318
|
|
|
// Interface - UserBar |
319
|
|
|
'int_userbar_background' => 'design/images/userbar.png', |
320
|
|
|
'int_userbar_font' => 'arialbd.ttf', |
321
|
|
|
'int_userbar_showInOverview' => 1, |
322
|
|
|
'int_userbar_URL' => '/banner.php?type=userbar', |
323
|
|
|
|
324
|
|
|
'LastSettedGalaxyPos' => 1, |
325
|
|
|
'LastSettedPlanetPos' => 1, |
326
|
|
|
'LastSettedSystemPos' => 1, |
327
|
|
|
|
328
|
|
|
'locale_cache_disable' => 0, // Disable locale caching |
329
|
|
|
|
330
|
|
|
'menu_server_name_disabled' => 0, |
331
|
|
|
'menu_launch_date_disabled' => 0, |
332
|
|
|
'menu_server_logo' => MENU_SERVER_LOGO_DEFAULT, |
333
|
|
|
'menu_server_logo_disabled' => 0, |
334
|
|
|
|
335
|
|
|
'payment_currency_default' => 'USD', |
336
|
|
|
'payment_currency_exchange_dm_' => 20000, |
337
|
|
|
'payment_currency_exchange_mm_' => 20000, |
338
|
|
|
'payment_currency_exchange_eur' => 0.90, |
339
|
|
|
'payment_currency_exchange_rub' => 60, |
340
|
|
|
'payment_currency_exchange_uah' => 30, |
341
|
|
|
'payment_currency_exchange_usd' => 1, |
342
|
|
|
'payment_currency_exchange_wmb' => 18000, |
343
|
|
|
'payment_currency_exchange_wme' => 0.9, |
344
|
|
|
'payment_currency_exchange_wmr' => 60, |
345
|
|
|
'payment_currency_exchange_wmu' => 30, |
346
|
|
|
'payment_currency_exchange_wmz' => 1, |
347
|
|
|
'payment_currency_exchange_pln' => 3.86, |
348
|
|
|
|
349
|
|
|
'payment_lot_price' => 1, // Lot price in default currency |
350
|
|
|
'payment_lot_size' => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction |
351
|
|
|
|
352
|
|
|
'planet_capital_cost' => 25000, // Cost in DM to move Capital to current planet |
353
|
|
|
'planet_capital_mining_rate' => 2.0, // Capital Mining rates |
354
|
|
|
'planet_capital_building_rate' => 2.0, // Capital Building rates |
355
|
|
|
'planet_teleport_cost' => 50000, // Cost of planet teleportation |
356
|
|
|
'planet_teleport_timeout' => 86400, // Timeout for next teleportation |
357
|
|
|
|
358
|
|
|
'player_delete_time' => 3888000, // |
359
|
|
|
'player_max_colonies' => -1, // Max player planet count (NOT including main planet) |
360
|
|
|
|
361
|
|
|
'user_vacation_disable' => 0, // Disable vacation mode for players |
362
|
|
|
'player_vacation_time' => PERIOD_WEEK, // |
363
|
|
|
'player_vacation_timeout' => PERIOD_WEEK, // |
364
|
|
|
|
365
|
|
|
'player_metamatter_immortal' => 200000, // MM amount to reward account with Immortal status |
366
|
|
|
|
367
|
|
|
'player_levels' => '', // JSON-encoded array of [(int)level => (float)maxPointsForLevel] |
368
|
|
|
'player_levels_calculated' => '2000-01-01 00:00:00', // Date and time where player level was calculated last |
369
|
|
|
|
370
|
|
|
// Quests |
371
|
|
|
'quest_total' => 0, // Total number of quests |
372
|
|
|
|
373
|
|
|
'resource_multiplier' => 1, |
374
|
|
|
|
375
|
|
|
//Roleplay system |
376
|
|
|
'rpg_bonus_divisor' => 10, // Amount of DM referral shoud get for partner have 1 DM bonus |
377
|
|
|
'rpg_bonus_minimum' => 10000, // Minimum DM ammount for starting paying bonuses to affiliate |
378
|
|
|
|
379
|
|
|
// Black Market - General |
380
|
|
|
'rpg_cost_banker' => 1000, // Banker can hold some resources |
381
|
|
|
'rpg_cost_exchange' => 1000, // Exchange allows resource trade between players |
382
|
|
|
'rpg_cost_info' => 10000, // Infotrader sells valuable information about users, alliances and universe |
383
|
|
|
'rpg_cost_pawnshop' => 1000, // You can get loan in pawnshop |
384
|
|
|
'rpg_cost_scraper' => 1000, // Scrapper buys ship for fraction of cost |
385
|
|
|
'rpg_cost_stockman' => 1000, // Stockman resells ship that was scrapped |
386
|
|
|
'rpg_cost_trader' => 1000, // Trader trades between resources |
387
|
|
|
|
388
|
|
|
// Black Market - Resource exachange rates |
389
|
|
|
'rpg_exchange_metal' => 1, |
390
|
|
|
'rpg_exchange_crystal' => 2, |
391
|
|
|
'rpg_exchange_deuterium' => 4, |
392
|
|
|
'rpg_exchange_darkMatter' => 400, |
393
|
|
|
|
394
|
|
|
'rpg_flt_explore' => 1000, // DM reward for finding Supernova in expedition |
395
|
|
|
|
396
|
|
|
// Black Market - Scraper rates for ship pre resource |
397
|
|
|
'rpg_scrape_crystal' => 0.50, |
398
|
|
|
'rpg_scrape_deuterium' => 0.25, |
399
|
|
|
'rpg_scrape_metal' => 0.75, |
400
|
|
|
|
401
|
|
|
'security_ban_extra' => '', |
402
|
|
|
'security_write_full_url_disabled' => 1, // Disables writing full URLs to counter table |
403
|
|
|
|
404
|
|
|
'server_que_length_hangar' => '5', // |
405
|
|
|
'server_que_length_research' => '1', // |
406
|
|
|
'server_que_length_structures' => '5', // |
407
|
|
|
|
408
|
|
|
'server_start_date' => '', // |
409
|
|
|
|
410
|
|
|
'server_updater_check_auto' => 0, // Server autocheck version |
411
|
|
|
'server_updater_check_last' => 0, // Server last check time |
412
|
|
|
'server_updater_check_period' => PERIOD_DAY, // Server autocheck period |
413
|
|
|
'server_updater_check_result' => SNC_VER_NEVER, // Server last check result |
414
|
|
|
'server_updater_id' => 0, // Server ID on update server |
415
|
|
|
'server_updater_key' => '', // Server key on update server |
416
|
|
|
|
417
|
|
|
'stats_history_days' => 14, // За сколько дней хранить статистику в базе |
418
|
|
|
'stats_hide_admins' => 1, |
419
|
|
|
'stats_hide_player_list' => '', |
420
|
|
|
'stats_hide_pm_link' => 0, |
421
|
|
|
'stats_minimal_interval' => STATS_RUN_INTERVAL_MINIMUM, // Minimal stats interval |
422
|
|
|
'stats_schedule' => '04:00:00', |
423
|
|
|
'stats_php_memory' => '1G', |
424
|
|
|
|
425
|
|
|
'tpl_minifier' => 0, // Template minifier |
426
|
|
|
'tpl_allow_php' => 0, // PTL allow INCLUDEPHP and PHP tags |
427
|
|
|
|
428
|
|
|
'tutorial_first_item' => 1, |
429
|
|
|
|
430
|
|
|
'uni_galaxy_distance' => UNIVERSE_GALAXY_DISTANCE, // 20000 by default |
431
|
|
|
'uni_price_galaxy' => 10000, |
432
|
|
|
'uni_price_system' => 1000, |
433
|
|
|
|
434
|
|
|
'upd_lock_time' => 300, // How long update will lock table. Also update increment time when it requires |
435
|
|
|
|
436
|
|
|
'url_faq' => '', |
437
|
|
|
'url_forum' => '', |
438
|
|
|
'url_purchase_metamatter' => '', |
439
|
|
|
'url_rules' => '', |
440
|
|
|
|
441
|
|
|
'users_amount' => 1, // Total users count |
442
|
|
|
'game_users_online_timeout' => PERIOD_MINUTE_15, // Seconds, How long user should considered ONLINE for online counter |
443
|
|
|
'game_users_update_online' => 30, // How often user online should be refreshed (seconds) |
444
|
|
|
'var_online_user_time' => 0, // When last time user online was refreshed |
445
|
|
|
'var_online_user_count' => 0, // Last calculated online user count |
446
|
|
|
'server_log_online' => 0, // Log online user count |
447
|
|
|
|
448
|
|
|
'user_birthday_celebrate' => 0, // When last time celebrations (i.e. giftgiving) was made |
449
|
|
|
'user_birthday_gift' => 0, // User birthday gift |
450
|
|
|
'user_birthday_range' => PERIOD_MONTH, // How far in past can be user birthday for giving him gift |
451
|
|
|
|
452
|
|
|
|
453
|
|
|
'var_db_update' => 0, // Time of last DB update |
454
|
|
|
'var_db_update_end' => 0, // Time when last DB update should end. Need to prevent duplicate update |
455
|
|
|
|
456
|
|
|
'var_news_last' => 0, // Last news post time |
457
|
|
|
|
458
|
|
|
// Statistic |
459
|
|
|
'var_stat_update' => 0, |
460
|
|
|
'var_stat_update_end' => 0, |
461
|
|
|
'var_stat_update_msg' => 'Update never started', |
462
|
|
|
|
463
|
|
|
); |
464
|
|
|
|
465
|
|
|
protected $notEmptyFields = [ |
466
|
|
|
'upd_lock_time' => 'upd_lock_time', |
467
|
|
|
]; |
468
|
|
|
|
469
|
|
|
public function __construct($gamePrefix = 'sn_') { |
470
|
|
|
parent::__construct($gamePrefix, 'config'); |
471
|
|
|
} |
472
|
|
|
|
473
|
|
|
public static function getInstance($gamePrefix = 'sn_', $table_name = 'config') { |
474
|
|
|
if (!isset(self::$cacheObject)) { |
475
|
|
|
$className = get_class(); |
476
|
|
|
self::$cacheObject = new $className($gamePrefix, $table_name); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
return self::$cacheObject; |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
/** |
483
|
|
|
* @param int|string $date Date ether as Unix timestamp or mySQL timestamp |
484
|
|
|
* @param int $as Output format WATCHDOG_TIME_UNIX | WATCHDOG_TIME_SQL |
485
|
|
|
* |
486
|
|
|
* @return false|int|string Will return 0 on invalid string with WATCHDOG_TIME_UNIX and FALSE on invalid value with WATCHDOG_TIME_UNIX |
487
|
|
|
* @see FMT_DATE_TIME_SQL |
488
|
|
|
*/ |
489
|
|
|
public function dateConvert($date, $as) { |
490
|
|
|
if ($as === self::DATE_TYPE_UNIX && !is_numeric($date)) { |
491
|
|
|
// It is not a TIMESTAMP - may be it's SQL timestamp or other date-related string? Trying to convert to UNIX |
492
|
|
|
$date = intval(strtotime($date, SN_TIME_NOW)); |
493
|
|
|
} elseif ($as === self::DATE_TYPE_SQL_STRING && (!is_string($date) || is_numeric($date))) { |
494
|
|
|
$date = date(FMT_DATE_TIME_SQL, $date); |
|
|
|
|
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
return $date; |
498
|
|
|
} |
499
|
|
|
|
500
|
|
|
/** |
501
|
|
|
* Will write to DB date as specified format |
502
|
|
|
* |
503
|
|
|
* @param string $name Config field name |
504
|
|
|
* @param int|string $date Date ether as Unix timestamp or mySQL timestamp |
505
|
|
|
* @param int $as Format of field in config table WATCHDOG_TIME_UNIX | WATCHDOG_TIME_SQL |
506
|
|
|
* |
507
|
|
|
* @return classConfig |
508
|
|
|
* @see dateConvert() |
509
|
|
|
*/ |
510
|
|
|
public function dateWrite($name, $date, $as = self::DATE_TYPE_SQL_STRING) { |
511
|
|
|
$this->pass()[$name] = $this->dateConvert($date, $as); |
512
|
|
|
|
513
|
|
|
return $this; |
514
|
|
|
} |
515
|
|
|
|
516
|
|
|
/** |
517
|
|
|
* Will read from DB date and convert it to specified format |
518
|
|
|
* |
519
|
|
|
* @param string $name Config field name |
520
|
|
|
* @param int $as Output format WATCHDOG_TIME_UNIX | WATCHDOG_TIME_SQL |
521
|
|
|
* |
522
|
|
|
* @return false|int|string |
523
|
|
|
* @see dateConvert() |
524
|
|
|
*/ |
525
|
|
|
public function dateRead($name, $as) { |
526
|
|
|
return $this->dateConvert($date = $this->pass()[$name], $as); |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
public function getCypher() { |
530
|
|
|
$db = SN::$gc->db; |
531
|
|
|
|
532
|
|
|
if (empty($this->cypher)) { |
533
|
|
|
$db->transactionStart(); |
534
|
|
|
$cypher = $this->pass()->server_cypher; |
535
|
|
|
if (empty($cypher)) { |
536
|
|
|
$cypher = md5(sys_random_string(32)); |
537
|
|
|
|
538
|
|
|
$this->pass()->server_cypher = $cypher; |
539
|
|
|
|
540
|
|
|
$db->transactionCommit(); |
541
|
|
|
} else { |
542
|
|
|
$db->transactionRollback(); |
543
|
|
|
} |
544
|
|
|
$this->cypher = $cypher; |
545
|
|
|
} |
546
|
|
|
|
547
|
|
|
return $this->cypher; |
548
|
|
|
} |
549
|
|
|
|
550
|
|
|
} |
551
|
|
|
|