… | |
… | |
17 | use Carp (); |
17 | use Carp (); |
18 | |
18 | |
19 | our $VERSION; |
19 | our $VERSION; |
20 | |
20 | |
21 | BEGIN { |
21 | BEGIN { |
22 | $VERSION = '2.11'; |
22 | $VERSION = '3.0'; |
23 | |
23 | |
24 | use XSLoader; |
24 | use XSLoader; |
25 | XSLoader::load "Deliantra::Client", $VERSION; |
25 | XSLoader::load "Deliantra::Client", $VERSION; |
26 | } |
26 | } |
27 | |
27 | |
… | |
… | |
35 | use File::Path (); |
35 | use File::Path (); |
36 | use Storable (); # finally |
36 | use Storable (); # finally |
37 | use Fcntl (); |
37 | use Fcntl (); |
38 | use JSON::XS qw(encode_json decode_json); |
38 | use JSON::XS qw(encode_json decode_json); |
39 | use Guard qw(guard); |
39 | use Guard qw(guard); |
|
|
40 | |
|
|
41 | # modules to support other DC::* packages |
|
|
42 | use List::Util (); |
|
|
43 | use IO::AIO (); |
|
|
44 | use Coro::AIO (); |
|
|
45 | use AnyEvent::AIO (); |
|
|
46 | |
|
|
47 | use Deliantra::Protocol::Constants (); |
40 | |
48 | |
41 | =item shorten $string[, $maxlength] |
49 | =item shorten $string[, $maxlength] |
42 | |
50 | |
43 | =cut |
51 | =cut |
44 | |
52 | |
… | |
… | |
200 | |
208 | |
201 | rename $file, "$file.bak"; |
209 | rename $file, "$file.bak"; |
202 | rename "$file~", $file; |
210 | rename "$file~", $file; |
203 | } |
211 | } |
204 | |
212 | |
|
|
213 | sub upgrade_cfg() { |
|
|
214 | my %DEF_CFG = ( |
|
|
215 | config_autosave => 1, |
|
|
216 | sdl_mode => undef, |
|
|
217 | fullscreen => 1, |
|
|
218 | fast => 0, |
|
|
219 | force_opengl11 => undef, |
|
|
220 | disable_alpha => 0, |
|
|
221 | smooth_movement => 1, |
|
|
222 | smooth_transitions => 1, |
|
|
223 | texture_compression => 1, |
|
|
224 | map_scale => 1, |
|
|
225 | fow_enable => 1, |
|
|
226 | fow_intensity => 0, |
|
|
227 | fow_texture => 0, |
|
|
228 | map_smoothing => 1, |
|
|
229 | gui_fontsize => 1, |
|
|
230 | log_fontsize => 0.7, |
|
|
231 | gauge_fontsize => 1, |
|
|
232 | gauge_size => 0.35, |
|
|
233 | stat_fontsize => 0.7, |
|
|
234 | mapsize => 100, |
|
|
235 | audio_enable => 1, |
|
|
236 | audio_hw_channels => 0, |
|
|
237 | audio_hw_frequency => 0, |
|
|
238 | audio_hw_chunksize => 0, |
|
|
239 | audio_mix_channels => 8, |
|
|
240 | effects_enable => 1, |
|
|
241 | effects_volume => 1, |
|
|
242 | bgm_enable => 1, |
|
|
243 | bgm_volume => 0.5, |
|
|
244 | output_rate => "", |
|
|
245 | pickup => Deliantra::Protocol::Constants::PICKUP_SPELLBOOK |
|
|
246 | | Deliantra::Protocol::Constants::PICKUP_SKILLSCROLL |
|
|
247 | | Deliantra::Protocol::Constants::PICKUP_VALUABLES, |
|
|
248 | inv_sort => "mtime", |
|
|
249 | default => "profile", # default profile |
|
|
250 | show_tips => 1, |
|
|
251 | logview_max_par => 1000, |
|
|
252 | shift_fire_stop => 0, |
|
|
253 | uitheme => "wood", |
|
|
254 | map_shift_x => -24, # arbitrary |
|
|
255 | map_shift_y => +24, # arbitrary |
|
|
256 | #db_schema => 0, |
|
|
257 | ); |
|
|
258 | |
|
|
259 | while (my ($k, $v) = each %DEF_CFG) { |
|
|
260 | $::CFG->{$k} = $v unless exists $::CFG->{$k}; |
|
|
261 | } |
|
|
262 | } |
|
|
263 | |
205 | sub http_proxy { |
264 | sub http_proxy { |
206 | my @proxy = win32_proxy_info; |
265 | my @proxy = win32_proxy_info; |
207 | |
266 | |
208 | if (@proxy) { |
267 | if (@proxy) { |
209 | "http://" . (@proxy < 2 ? "" : @proxy < 3 ? "$proxy[1]\@" : "$proxy[1]:$proxy[2]\@") . $proxy[0] |
268 | "http://" . (@proxy < 2 ? "" : @proxy < 3 ? "$proxy[1]\@" : "$proxy[1]:$proxy[2]\@") . $proxy[0] |