ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/setup.ext
(Generate patch)

Comparing deliantra/server/ext/setup.ext (file contents):
Revision 1.12 by root, Sat Dec 27 01:25:00 2008 UTC vs.
Revision 1.21 by root, Fri Feb 25 07:23:40 2011 UTC

9 9
10 return unless $ns->extcmd; 10 return unless $ns->extcmd;
11 11
12 $ns->ext_msg (capabilities => 12 $ns->ext_msg (capabilities =>
13 # id, name, flags (1 == 2d), edge length 13 # id, name, flags (1 == 2d), edge length
14 tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32]], 14 tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32], [2, "default text faceset", 2, 1]],
15 ); 15 );
16} 16}
17 17
18cf::client->attach (on_setup => sub { 18cf::client->attach (on_setup => sub {
19 my ($ns, $args) = @_; 19 my ($ns, $args) = @_;
20 20
21 # run through the cmds of setup 21 # run through the cmds of setup
22 # syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ... 22 # syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ...
23 # 23 #
24 # we send the status of the cmd back, or a FALSE is the cmd is the server unknown 24 # we send the status of the cmd back, or a FALSE is the cmd if the server unknown
25 # The client then must sort this out 25 # the client then must sort this out
26 26
27 my %setup = split / +/, $args; 27 my %setup = split / +/, $args;
28 while (my ($k, $v) = each %setup) { 28 while (my ($k, $v) = each %setup) {
29 if ($k eq "sound") { 29 if ($k eq "sound") {
30 $ns->sound ($v); 30 $ns->sound ($v);
31 31
32 } elsif ($k eq "exp64") {
33 $setup{$k} = 1;
34
35 } elsif ($k eq "spellmon") { 32 } elsif ($k eq "spellmon") {
36 $ns->monitor_spells ($v); 33 $ns->monitor_spells ($v);
37
38 } elsif ($k eq "darkness") {
39 $setup{$k} = 1;
40
41 } elsif ($k eq "map1cmd") {
42 $ns->mapmode (cf::Map1Cmd) if $v > 0;
43
44 } elsif ($k eq "map1acmd") {
45 $ns->mapmode (cf::Map1aCmd) if $v > 0;
46
47 } elsif ($k eq "newmapcmd") {
48 $ns->newmapcmd ($v);
49 34
50 } elsif ($k eq "mapinfocmd") { 35 } elsif ($k eq "mapinfocmd") {
51 $ns->mapinfocmd ($v); 36 $ns->mapinfocmd ($v);
52 37
53 } elsif ($k eq "extcmd") { 38 } elsif ($k eq "extcmd") {
54 $ns->extcmd (min 2, $v); 39 $ns->extcmd (min 2, $v);
55 send_capabilities $ns; 40 send_capabilities $ns;
56 41
57 } elsif ($k eq "extmap") {
58 $ns->extmap ($v);
59
60 } elsif ($k eq "facecache") {
61 $setup{$k} = 1;
62
63 } elsif ($k eq "faceset") { 42 } elsif ($k eq "faceset") {
64 $ns->faceset (0); 43 $ns->faceset (0);
65 $setup{$k} = 0; 44 $setup{$k} = 0;
66 # $ns->image2 (1) 45 # $ns->image2 (1)
67 46
68 } elsif ($k eq "tileset") { 47 } elsif ($k eq "tileset") {
69 $setup{$k} = $ns->faceset ($v & 1); 48 $setup{$k} = $ns->faceset (int cf::clamp $v, 0, 2);
70 49
71 } elsif ($k eq "itemcmd") { 50 } elsif ($k eq "itemcmd") {
72 # Version of the item protocol command to use. Currently, 51 # Version of the item protocol command to use. Currently,
73 # only supported versions are 1 and 2. Using a numeric 52 # only supported versions are 1 and 2. Using a numeric
74 # value will make it very easy to extend this in the future. 53 # value will make it very easy to extend this in the future.
89 } elsif ($k eq "extendedTextInfos") { 68 } elsif ($k eq "extendedTextInfos") {
90 $ns->has_readable_type ($v); 69 $ns->has_readable_type ($v);
91 70
92 } elsif ($k eq "smoothing") { # cfplus-style smoothing 71 } elsif ($k eq "smoothing") { # cfplus-style smoothing
93 $ns->smoothing ($v); 72 $ns->smoothing ($v);
94
95 } elsif ($k eq "fxix") {
96 $setup{$k} = 3;
97
98 } elsif ($k eq "msg") {
99 $ns->can_msg ($setup{$k} = min 2, $v);
100 73
101 } elsif ($k eq "widget") { 74 } elsif ($k eq "widget") {
102 # server-side widgets 75 # server-side widgets
103 $v = $v > 1; 76 $v = $v > 1;
104 $ns->{can_widget} = $v; 77 $ns->{can_widget} = $v;
122 # sexp: no idea, probably for oudated servers 95 # sexp: no idea, probably for oudated servers
123 # tick: more stupidity, server should send a tick per tick 96 # tick: more stupidity, server should send a tick per tick
124 97
125 $setup{$k} = "FALSE"; 98 $setup{$k} = "FALSE";
126 } 99 }
127 } 100 }
128 101
102 # force some mandatory protocol options, most of these
103 # are for obsolete clients only
104 $setup{darkness} = 1;
105 $setup{exp64} = 1;
106 $setup{extmap} = 1;
107 $setup{facecache} = 1;
108 $setup{fxix} = 3;
109 $setup{map1acmd} = 1;
110 $setup{map1cmd} = 0;
111 $setup{msg} = 1;
112 $setup{newmapcmd} = 1;
113
129 $ns->send_packet (join " ", setup => %setup); 114 $ns->send_packet (join " ", setup => %setup);
130 115
131 cf::datalog setup => 116 cf::datalog setup =>
132 request => $args, 117 request => $args,
133 reply => \%setup, 118 reply => \%setup,
134 client => $ns->version,
135 ; 119 ;
136}); 120});
137 121
138

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines