ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.112 by root, Tue Jul 10 16:25:16 2007 UTC vs.
Revision 1.113 by root, Thu Jul 12 17:56:51 2007 UTC

47 map ["$cmd$_", $text], 47 map ["$cmd$_", $text],
48 sort { (length $a) <=> (length $b) } 48 sort { (length $a) <=> (length $b) }
49 @args 49 @args
50 } sort { $a->{par} <=> $b->{par} } 50 } sort { $a->{par} <=> $b->{par} }
51 CFPlus::Pod::find command => "*"; 51 CFPlus::Pod::find command => "*";
52
53 $self->connect_ext (event_music => sub {
54 my ($ev) = @_;
55
56 return unless $::CFG->{bgm_enable};
57
58 my $faces = $ev->{faces};
59 my @songs;
60
61 # request music from server if appropriate
62 my $pri = -100;
63 for my $face (@$faces) {
64 if (defined (my $chksum = $ev->{chksum}{$face})) {
65 utf8::downgrade $chksum;
66
67 $chksum = unpack "H*", $chksum;
68 $self->{music_map}{$face} = $chksum;
69
70 ::message ({ markup => "starting to download song #$face, check your output-rate setting if your connection gets laggy." });
71 $self->ask_face ($face, $pri, undef, sub {
72 my $num = $_[0];
73 my $len = length $_[1];
74 my ($meta, $data) = unpack "(w/a*)*", $_[1];
75
76 CFPlus::DB::write_file $chksum, $data, sub { };
77 CFPlus::DB::put resmap => $chksum => $meta, sub { };
78
79 $self->{music_meta}{$chksum} = $self->{json_coder}->decode ($meta);
80 ::message ({ markup => "downloaded song #$face, size $len octets" });
81
82 &::audio_music_set ($self->{songs});
83 });
84 }
85
86 push @songs, $self->{music_map}{$face};
87 --$pri;
88 }
89
90 &::audio_music_set ($self->{songs} = \@songs);
91 });
52 92
53 $self->connect_ext (event_capabilities => sub { 93 $self->connect_ext (event_capabilities => sub {
54 my ($cap) = @_; 94 my ($cap) = @_;
55 95
56 if (my $ts = $cap->{tileset}) { 96 if (my $ts = $cap->{tileset}) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines