--- deliantra/server/lib/cf.pm 2007/07/24 15:56:45 1.319 +++ deliantra/server/lib/cf.pm 2007/08/01 17:22:51 1.327 @@ -1923,6 +1923,9 @@ $self->activate; } + $self->{last_save} = $cf::RUNTIME; + $self->last_access ($cf::RUNTIME); + $self->in_memory (cf::MAP_IN_MEMORY); } @@ -2514,7 +2517,7 @@ $msg = $self->pl->expand_cfpod ($msg); - $color &= ~cf::NDI_UNIQUE; # just in case... + $color &= cf::NDI_CLIENT_MASK; # just in case... if (ref $channel) { # send meta info to client, if not yet sent @@ -2529,19 +2532,28 @@ return unless @extra || length $msg; if ($self->can_msg) { - $self->send_packet ("msg " . $self->{json_coder}->encode ([$color, $channel, $msg, @extra])); - } else { - # replace some tags by gcfclient-compatible ones - for ($msg) { - 1 while - s/([^<]*)<\/b>/[b]${1}[\/b]/ - || s/([^<]*)<\/i>/[i]${1}[\/i]/ - || s/([^<]*)<\/u>/[ul]${1}[\/ul]/ - || s/([^<]*)<\/tt>/[fixed]${1}[\/fixed]/ - || s/([^<]*)<\/fg>/[color=$1]${2}[\/color]/; - } + # default colour, mask it out + $color &= ~(cf::NDI_COLOR_MASK | cf::NDI_DEF) + if $color & cf::NDI_DEF; + $self->send_packet ("msg " . $self->{json_coder}->encode ( + [$color & cf::NDI_CLIENT_MASK, $channel, $msg, @extra])); + } else { if ($color >= 0) { + # replace some tags by gcfclient-compatible ones + for ($msg) { + 1 while + s/([^<]*)<\/b>/[b]${1}[\/b]/ + || s/([^<]*)<\/i>/[i]${1}[\/i]/ + || s/([^<]*)<\/u>/[ul]${1}[\/ul]/ + || s/([^<]*)<\/tt>/[fixed]${1}[\/fixed]/ + || s/([^<]*)<\/fg>/[color=$1]${2}[\/color]/; + } + + $color &= cf::NDI_COLOR_MASK; + + utf8::encode $msg; + if (0 && $msg =~ /\[/) { $self->send_packet ("drawextinfo $color 4 0 $msg") } else { @@ -2867,10 +2879,12 @@ my $res = $facedata->{resource}; my $enc = JSON::XS->new->utf8->canonical; + my $soundconf = delete $res->{"res/sound.conf"}; + while (my ($name, $info) = each %$res) { my $meta = $enc->encode ({ - name => $name, - copyright => $info->{copyright}, #TODO# + name => $name, + %{ $info->{meta} || {} }, }); my $idx = (cf::face::find $name) || cf::face::alloc $name; @@ -2890,6 +2904,24 @@ cf::cede_to_tick; } + + if ($soundconf) { + $soundconf = $enc->decode (delete $soundconf->{data}); + + for (0 .. SOUND_CAST_SPELL_0 - 1) { + my $sound = $soundconf->{compat}[$_] + or next; + + my $face = cf::face::find "sound/$sound->[1]"; + cf::sound::set $sound->[0] => $face; + cf::sound::old_sound_index $_, $face; # gcfclient-compat + } + + while (my ($k, $v) = each %{$soundconf->{event}}) { + my $face = cf::face::find "sound/$v"; + cf::sound::set $k => $face; + } + } } 1