… | |
… | |
42 | use List::Util (); |
42 | use List::Util (); |
43 | use IO::AIO (); |
43 | use IO::AIO (); |
44 | use Coro::AIO (); |
44 | use Coro::AIO (); |
45 | use AnyEvent::AIO (); |
45 | use AnyEvent::AIO (); |
46 | |
46 | |
|
|
47 | use Deliantra::Util (); |
47 | use Deliantra::Protocol::Constants (); |
48 | use Deliantra::Protocol::Constants (); |
48 | |
49 | |
49 | =item shorten $string[, $maxlength] |
50 | =item shorten $string[, $maxlength] |
50 | |
51 | |
51 | =cut |
52 | =cut |
… | |
… | |
212 | |
213 | |
213 | sub load_cfg() { |
214 | sub load_cfg() { |
214 | if (-e "$Deliantra::VARDIR/client.cf") { |
215 | if (-e "$Deliantra::VARDIR/client.cf") { |
215 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
216 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
216 | } else { |
217 | } else { |
217 | $::CFG = {}; |
218 | $::CFG = { cfg_schema => 1, db_schema => 1 }; |
218 | } |
219 | } |
219 | } |
220 | } |
220 | |
221 | |
221 | sub save_cfg() { |
222 | sub save_cfg() { |
222 | write_cfg "$Deliantra::VARDIR/client.cf"; |
223 | write_cfg "$Deliantra::VARDIR/client.cf"; |
… | |
… | |
263 | logview_max_par => 1000, |
264 | logview_max_par => 1000, |
264 | shift_fire_stop => 0, |
265 | shift_fire_stop => 0, |
265 | uitheme => "wood", |
266 | uitheme => "wood", |
266 | map_shift_x => -24, # arbitrary |
267 | map_shift_x => -24, # arbitrary |
267 | map_shift_y => +24, # arbitrary |
268 | map_shift_y => +24, # arbitrary |
268 | #db_schema => 0, |
|
|
269 | ); |
269 | ); |
270 | |
270 | |
271 | while (my ($k, $v) = each %DEF_CFG) { |
271 | while (my ($k, $v) = each %DEF_CFG) { |
272 | $::CFG->{$k} = $v unless exists $::CFG->{$k}; |
272 | $::CFG->{$k} = $v unless exists $::CFG->{$k}; |
|
|
273 | } |
|
|
274 | |
|
|
275 | if ($::CFG->{cfg_schema} < 1) { |
|
|
276 | for my $profile (values %{ $::CFG->{profile} }) { |
|
|
277 | $profile->{password} = unpack "H*", Deliantra::Util::hash_pw $profile->{password}; |
|
|
278 | } |
|
|
279 | $::CFG->{cfg_schema} = 1; |
273 | } |
280 | } |
274 | } |
281 | } |
275 | |
282 | |
276 | sub http_proxy { |
283 | sub http_proxy { |
277 | my @proxy = win32_proxy_info; |
284 | my @proxy = win32_proxy_info; |