… | |
… | |
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}); |
… | |
… | |
668 | [0.74, 0.65, 0.41], |
666 | [0.74, 0.65, 0.41], |
669 | ); |
667 | ); |
670 | |
668 | |
671 | sub msg { |
669 | sub msg { |
672 | my ($self, $color, $type, $text, @extra) = @_; |
670 | my ($self, $color, $type, $text, @extra) = @_; |
|
|
671 | |
|
|
672 | # we now weed out all tags we do not support |
|
|
673 | $text =~ s%<(?!/?i>|/?u>|/?b>|fg |/fg>)%<%g; |
|
|
674 | # now all entities |
|
|
675 | $text =~ s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&/g; |
|
|
676 | |
|
|
677 | # handle some elements |
|
|
678 | $text =~ s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs; |
|
|
679 | $text =~ s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs; |
673 | |
680 | |
674 | if (my $cb = $self->{cb_msg}{$type}) { |
681 | if (my $cb = $self->{cb_msg}{$type}) { |
675 | $_->($self, $color, $type, $text, @extra) for values %$cb; |
682 | $_->($self, $color, $type, $text, @extra) for values %$cb; |
676 | } elsif ($type =~ /^(?:chargen-race-title|chargen-race-description)$/) { |
683 | } elsif ($type =~ /^(?:chargen-race-title|chargen-race-description)$/) { |
677 | $type =~ s/-/_/g; |
684 | $type =~ s/-/_/g; |