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.104 by root, Mon Apr 23 19:22:24 2007 UTC vs.
Revision 1.106 by root, Sun Apr 29 20:03:08 2007 UTC

249 $::GAUGES->{mana} ->set_value ($sp, $sp_m); 249 $::GAUGES->{mana} ->set_value ($sp, $sp_m);
250 $::GAUGES->{food} ->set_value ($fo, $fo_m); 250 $::GAUGES->{food} ->set_value ($fo, $fo_m);
251 $::GAUGES->{grace} ->set_value ($gr, $gr_m); 251 $::GAUGES->{grace} ->set_value ($gr, $gr_m);
252 $::GAUGES->{exp} ->set_text ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64})) 252 $::GAUGES->{exp} ->set_text ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64}))
253 . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")"); 253 . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")");
254 my $rng = $stats->{+CS_STAT_RANGE}; 254 $::GAUGES->{range} ->set_text ($stats->{+CS_STAT_RANGE});
255 $rng =~ s/^Range: //; # thank you so much dear server
256 $::GAUGES->{range} ->set_text ("Rng: " . $rng);
257 my $title = $stats->{+CS_STAT_TITLE}; 255 my $title = $stats->{+CS_STAT_TITLE};
258 $title =~ s/^Player: //; 256 $title =~ s/^Player: //;
259 $::STATWIDS->{title} ->set_text ("Title: " . $title); 257 $::STATWIDS->{title} ->set_text ("Title: " . $title);
260 258
261 $::STATWIDS->{st_str} ->set_text (sprintf "%d" , $stats->{+CS_STAT_STR}); 259 $::STATWIDS->{st_str} ->set_text (sprintf "%d" , $stats->{+CS_STAT_STR});
634 $LAST_QUERY = $prompt; 632 $LAST_QUERY = $prompt;
635 633
636 $self->{query}-> ($self, $flags, $prompt); 634 $self->{query}-> ($self, $flags, $prompt);
637} 635}
638 636
637our %NAME_TO_COLOR = (
638 black => 0,
639 white => 1,
640 darkblue => 2,
641 red => 3,
642 orange => 4,
643 lightblue => 5,
644 darkorange => 6,
645 green => 7,
646 darkgreen => 8,
647 grey => 9,
648 brown => 10,
649 yellow => 11,
650 tan => 12,
651);
652
639our @CF_COLOR = ( 653our @CF_COLOR = (
640 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00], 654 [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00],
641 [1.00, 1.00, 1.00], 655 [1.00, 1.00, 1.00],
642 [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55] 656 [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55]
643 [1.00, 0.00, 0.00], 657 [1.00, 0.00, 0.00],
650 [0.75, 0.61, 0.20], 664 [0.75, 0.61, 0.20],
651 [0.99, 0.77, 0.26], 665 [0.99, 0.77, 0.26],
652 [0.74, 0.65, 0.41], 666 [0.74, 0.65, 0.41],
653); 667);
654 668
655sub drawinfo { 669sub msg {
656 my ($self, $color, $text) = @_; 670 my ($self, $color, $type, $text, @extra) = @_;
657 671
672 if (my $cb = $self->{cb_msg}{$type}) {
673 $_->($self, $color, $type, $text, @extra) for values %$cb;
674 } elsif ($type =~ /^(?:chargen-race-title|chargen-race-description)$/) {
675 $type =~ s/-/_/g;
676 $self->{$type} = $text;
677 } else {
678 $self->logprint ("msg: ", $text);
679 return if $color < 0; # negative color == ignore if not understood
680
658 my $fg = $CF_COLOR[$color % @CF_COLOR]; 681 my $fg = $CF_COLOR[$color % @CF_COLOR];
659 682
660 $self->logprint ("info: ", $text);
661
662 ## try to create single paragraphs of multiple lines sent by the server 683 ## try to create single paragraphs of multiple lines sent by the server
663 # no longer neecssary with TRT servers 684 # no longer neecssary with TRT servers
664 #$text =~ s/(?<=\S)\n(?=\w)/ /g; 685 #$text =~ s/(?<=\S)\n(?=\w)/ /g;
665 686
666 $text = CFPlus::asxml $text;
667 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g;
668 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g;
669
670 ::message ({ fg => $fg, markup => $_ }) 687 ::message ({ fg => $fg, markup => $_ })
671 for split /\n/, $text; 688 for split /\n/, $text;
672 689
673 $self->{statusbox}->add ($text, 690 $self->{statusbox}->add ($text,
674 group => $text, 691 group => $text,
675 fg => $fg, 692 fg => $fg,
676 timeout => $color >= 2 ? 180 : 10, 693 timeout => $color >= 2 ? 180 : 10,
677 tooltip_font => $::FONT_FIXED, 694 tooltip_font => $::FONT_FIXED,
678 ); 695 );
679} 696 }
680
681sub drawextinfo {
682 my ($self, $color, $type, $subtype, $message) = @_;
683
684 $self->drawinfo ($color, $message);
685} 697}
686 698
687sub spell_add { 699sub spell_add {
688 my ($self, $spell) = @_; 700 my ($self, $spell) = @_;
689 701

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines