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