--- deliantra/server/ext/login.ext 2007/02/17 23:54:35 1.31 +++ deliantra/server/ext/login.ext 2007/04/02 18:04:45 1.32 @@ -4,6 +4,7 @@ use Fcntl; use Coro::AIO; +use List::Util qw(min max); my $PLAYERDIR = sprintf "%s/%s", cf::localdir, cf::playerdir; @@ -82,7 +83,39 @@ sub addme { my ($ns) = @_; - $ns->destroy if $ns->pl; + if (!$ns->facecache) + { + $ns->send_drawinfo (<Configure=>Map & Image=>Cache Images. +*** jcrossclient: your client is broken, use CFPlus or gcfclient. +*** +*** +EOF + if ($ns->version =~ /jcrossclient/) { + # let them, for now + } else { + $ns->flush; + return $ns->destroy; + } + + # $ns->facecache = true; + } + + $ns->pl and return $ns->destroy; $ns->async (sub { my ($user, $pass); @@ -340,8 +373,99 @@ }, ); +sub setup { + my ($ns, $args) = @_; + + # run through the cmds of setup + # syntax is setup ... + # + # we send the status of the cmd back, or a FALSE is the cmd is the server unknown + # The client then must sort this out + + my %setup = split / +/, $args; + while (my ($k, $v) = each %setup) { + + if ($k eq "sound") { + $ns->sound ($v); + + } elsif ($k eq "exp64") { + $setup{$k} = 1; + + } elsif ($k eq "spellmon") { + $ns->monitor_spells ($v); + + } elsif ($k eq "darkness") { + $ns->darkness ($v); + + } elsif ($k eq "map1cmd") { + $ns->mapmode (cf::Map1Cmd) if $v > 0; + + } elsif ($k eq "map1acmd") { + $ns->mapmode (cf::Map1aCmd) if $v > 0; + + } elsif ($k eq "newmapcmd") { + $ns->newmapcmd ($v); + + } elsif ($k eq "mapinfocmd") { + $ns->mapinfocmd ($v); + + } elsif ($k eq "extcmd") { + $ns->extcmd ($v > 0); + + } elsif ($k eq "extmap") { + $ns->extmap ($v); + + } elsif ($k eq "facecache") { + $ns->facecache ($v); + + } elsif ($k eq "faceset") { + $ns->faceset (0); + $setup{$k} = 0; + # $ns->image2 (1) + + } elsif ($k eq "itemcmd") { + # Version of the item protocol command to use. Currently, + # only supported versions are 1 and 2. Using a numeric + # value will make it very easy to extend this in the future. + $ns->itemcmd ($v) if $v >= 1 && $v <= 2; + + $setup{$k} = $ns->itemcmd; + + } elsif ($k eq "mapsize") { + my ($x, $y) = split /x/, $v; + + $ns->mapx ($x = max 9, min cf::MAP_CLIENT_X, $x); + $ns->mapy ($y = max 9, min cf::MAP_CLIENT_Y, $y); + + $setup{$k} = "${x}x${y}"; + + } elsif ($k eq "extendedMapInfos") { + $ns->ext_mapinfos ($v); + + } elsif ($k eq "extendedTextInfos") { + $ns->has_readable_type ($v); + + } else { + # other commands: + # sexp: no idea, probably for oudated servers + # tick: more stupidity, server should sned a tick per tick + + $setup{$k} = "FALSE"; + } + } + + $ns->send_packet (join " ", setup => %setup); + + cf::datalog setup => + request => $args, + reply => \%setup, + client => $ns->version, + ; +} + cf::client->attach ( on_addme => \&addme, + on_setup => \&setup, ); #############################################################################