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

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.34 by root, Tue Apr 3 00:21:37 2007 UTC vs.
Revision 1.41 by root, Tue Apr 17 10:06:33 2007 UTC

15 15
16sub query { 16sub query {
17 my ($ns, $flags, $text) = @_; 17 my ($ns, $flags, $text) = @_;
18 18
19 my $current = $Coro::current; 19 my $current = $Coro::current;
20 $ns->query ($flags, $text, sub { $current->ready; $current = $_[0]; }); 20 $ns->query ($flags, $text, sub { $current->ready; $current = $_[0] });
21 Coro::schedule while ref $current; 21 Coro::schedule while ref $current;
22 22
23 $current 23 $current
24} 24}
25 25
78 system "cd \Q$PLAYERDIR\E " 78 system "cd \Q$PLAYERDIR\E "
79 . "&& mv \Q$user\E ~\Q$Coro::current\E~deleting~ 2>/dev/null " 79 . "&& mv \Q$user\E ~\Q$Coro::current\E~deleting~ 2>/dev/null "
80 . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)"; 80 . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)";
81} 81}
82 82
83sub send_capabilities {
84 my ($ns) = @_;
85
86 return unless $ns->extcmd;
87
88 $ns->ext_event (capabilities =>
89 # id, name, flags (1 == 2d), edge length
90 tileset => [[1, "default 64x64 faceset", 1, 64], [0, "default 32x32 faceset", 1, 32]],
91 );
92}
93
83sub setup { 94sub setup {
84 my ($ns, $args) = @_; 95 my ($ns, $args) = @_;
85 96
86 # run through the cmds of setup 97 # run through the cmds of setup
87 # syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ... 98 # syntax is setup <cmdname1> <parameter> <cmdname2> <parameter> ...
89 # we send the status of the cmd back, or a FALSE is the cmd is the server unknown 100 # we send the status of the cmd back, or a FALSE is the cmd is the server unknown
90 # The client then must sort this out 101 # The client then must sort this out
91 102
92 my %setup = split / +/, $args; 103 my %setup = split / +/, $args;
93 while (my ($k, $v) = each %setup) { 104 while (my ($k, $v) = each %setup) {
94
95 if ($k eq "sound") { 105 if ($k eq "sound") {
96 $ns->sound ($v); 106 $ns->sound ($v);
97 107
98 } elsif ($k eq "exp64") { 108 } elsif ($k eq "exp64") {
99 $setup{$k} = 1; 109 $setup{$k} = 1;
121 } elsif ($k eq "mapinfocmd") { 131 } elsif ($k eq "mapinfocmd") {
122 $ns->mapinfocmd ($v); 132 $ns->mapinfocmd ($v);
123 133
124 } elsif ($k eq "extcmd") { 134 } elsif ($k eq "extcmd") {
125 $ns->extcmd ($v > 0); 135 $ns->extcmd ($v > 0);
136 send_capabilities $ns;
126 137
127 } elsif ($k eq "extmap") { 138 } elsif ($k eq "extmap") {
128 $ns->extmap ($v); 139 $ns->extmap ($v);
129 140
130 } elsif ($k eq "facecache") { 141 } elsif ($k eq "facecache") {
142 if (!$v) {
143 $v = 1;
144 $setup{$k} = $v;
145 $ns->send_drawinfo ("(trying to forcefully enable facecaching)", cf::NDI_RED);
146 }
147
131 $ns->facecache ($v); 148 $ns->facecache ($v);
132 149
133 } elsif ($k eq "faceset") { 150 } elsif ($k eq "faceset") {
134 $ns->faceset (0); 151 $ns->faceset (0);
135 $setup{$k} = 0; 152 $setup{$k} = 0;
136 # $ns->image2 (1) 153 # $ns->image2 (1)
154
155 } elsif ($k eq "tileset") {
156 $setup{$k} = $ns->faceset ($v & 1);
137 157
138 } elsif ($k eq "itemcmd") { 158 } elsif ($k eq "itemcmd") {
139 # Version of the item protocol command to use. Currently, 159 # Version of the item protocol command to use. Currently,
140 # only supported versions are 1 and 2. Using a numeric 160 # only supported versions are 1 and 2. Using a numeric
141 # value will make it very easy to extend this in the future. 161 # value will make it very easy to extend this in the future.
144 $setup{$k} = $ns->itemcmd; 164 $setup{$k} = $ns->itemcmd;
145 165
146 } elsif ($k eq "mapsize") { 166 } elsif ($k eq "mapsize") {
147 my ($x, $y) = split /x/, $v; 167 my ($x, $y) = split /x/, $v;
148 168
149 $ns->mapx ($x = max 9, min cf::MAP_CLIENT_X, $x); 169 $ns->mapx ($x = max 9, min cf::MAP_CLIENT_X, ($x - 1) | 1);
150 $ns->mapy ($y = max 9, min cf::MAP_CLIENT_Y, $y); 170 $ns->mapy ($y = max 9, min cf::MAP_CLIENT_Y, ($y - 1) | 1);
151 171
152 $setup{$k} = "${x}x${y}"; 172 $setup{$k} = "${x}x${y}";
153 173
154 } elsif ($k eq "extendedMapInfos") { 174 } elsif ($k eq "extendedMapInfos") {
155 $ns->ext_mapinfos ($v); 175 $ns->ext_mapinfos ($v);
156 176
157 } elsif ($k eq "extendedTextInfos") { 177 } elsif ($k eq "extendedTextInfos") {
158 $ns->has_readable_type ($v); 178 $ns->has_readable_type ($v);
179
180 } elsif ($k eq "smoothing") { # cfplus-style smoothing
181 $ns->smoothing ($v);
159 182
160 } elsif ($k eq "fxix") { 183 } elsif ($k eq "fxix") {
161 $ns->fxix ($v); 184 $ns->fxix ($v);
162 185
163 } else { 186 } else {
340 . "(check for Numlock and other semi-obvious error sources).", 363 . "(check for Numlock and other semi-obvious error sources).",
341 cf::NDI_RED 364 cf::NDI_RED
342 ); 365 );
343 next; 366 next;
344 } 367 }
368 } else {
369 # unable to load the playerfile:
370 # check wether the player dir exists, which means the file is corrupted or
371 # something very similar.
372 if (!aio_stat cf::player::playerdir $user) {
373 $ns->send_drawinfo (
374 "Unable to retrieve this player. It might be a locked or broken account. "
375 . "If this is your account, ask a dungeon master for assistance. "
376 . "Otherwise choose a different login name.",
377 cf::NDI_RED
378 );
379 next;
380 }
345 } 381 }
346 382
347 # the rest of this function is character creation 383 # the rest of this function is character creation
348 384
349 # just to make sure nothing is left over 385 # just to make sure nothing is left over
509 or next; 545 or next;
510 $pl->valid or next; 546 $pl->valid or next;
511 547
512 eval { 548 eval {
513 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { 549 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) {
514 $cf::WAIT_FOR_TICK_ONE->wait; 550 cf::wait_for_tick_begin;
515 $pl->save; 551 $pl->save;
516 552
517 unless ($pl->active) { 553 unless ($pl->active) {
518 # check refcounts, this is tricky and needs to be adjusted to fit server internals 554 # check refcounts, this is tricky and needs to be adjusted to fit server internals
519 my $ob = $pl->ob; 555 my $ob = $pl->ob;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines