ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cf.schmorp.de/server/lib/cf.pm
(Generate patch)

Comparing cf.schmorp.de/server/lib/cf.pm (file contents):
Revision 1.326 by root, Tue Jul 31 17:33:15 2007 UTC vs.
Revision 1.331 by root, Mon Aug 13 13:10:01 2007 UTC

1370 $self->{deny_save} = 1; 1370 $self->{deny_save} = 1;
1371 1371
1372 $cf::PLAYER{$login} = $self; 1372 $cf::PLAYER{$login} = $self;
1373 1373
1374 $self 1374 $self
1375}
1376
1377=item $player->send_msg ($channel, $msg, $color, [extra...])
1378
1379=cut
1380
1381sub send_msg {
1382 my $ns = shift->ns
1383 or return;
1384 $ns->send_msg (@_);
1375} 1385}
1376 1386
1377=item $pl->quit_character 1387=item $pl->quit_character
1378 1388
1379Nukes the player without looking back. If logged in, the connection will 1389Nukes the player without looking back. If logged in, the connection will
2243 $self->message ($msg, $flags); 2253 $self->message ($msg, $flags);
2244 } 2254 }
2245 } 2255 }
2246} 2256}
2247 2257
2258=item $object->send_msg ($channel, $msg, $color, [extra...])
2259
2260=cut
2261
2262sub cf::object::send_msg {
2263 my $pl = shift->contr
2264 or return;
2265 $pl->send_msg (@_);
2266}
2267
2248=item $player_object->may ("access") 2268=item $player_object->may ("access")
2249 2269
2250Returns wether the given player is authorized to access resource "access" 2270Returns wether the given player is authorized to access resource "access"
2251(e.g. "command_wizcast"). 2271(e.g. "command_wizcast").
2252 2272
2550 || s/<fg name=\"([^"]+)\">([^<]*)<\/fg>/[color=$1]${2}[\/color]/; 2570 || s/<fg name=\"([^"]+)\">([^<]*)<\/fg>/[color=$1]${2}[\/color]/;
2551 } 2571 }
2552 2572
2553 $color &= cf::NDI_COLOR_MASK; 2573 $color &= cf::NDI_COLOR_MASK;
2554 2574
2575 utf8::encode $msg;
2576
2555 if (0 && $msg =~ /\[/) { 2577 if (0 && $msg =~ /\[/) {
2578 # COMMAND/INFO
2556 $self->send_packet ("drawextinfo $color 4 0 $msg") 2579 $self->send_packet ("drawextinfo $color 10 8 $msg")
2557 } else { 2580 } else {
2558 $msg =~ s/\[\/?(?:b|i|u|fixed|color)[^\]]*\]//g; 2581 $msg =~ s/\[\/?(?:b|i|u|fixed|color)[^\]]*\]//g;
2559 $self->send_packet ("drawinfo $color $msg") 2582 $self->send_packet ("drawinfo $color $msg")
2560 } 2583 }
2561 } 2584 }
2708our $safe = new Safe "safe"; 2731our $safe = new Safe "safe";
2709our $safe_hole = new Safe::Hole; 2732our $safe_hole = new Safe::Hole;
2710 2733
2711$SIG{FPE} = 'IGNORE'; 2734$SIG{FPE} = 'IGNORE';
2712 2735
2713$safe->permit_only (Opcode::opset qw(:base_core :base_mem :base_orig :base_math sort time)); 2736$safe->permit_only (Opcode::opset qw(
2737 :base_core :base_mem :base_orig :base_math
2738 grepstart grepwhile mapstart mapwhile
2739 sort time
2740));
2714 2741
2715# here we export the classes and methods available to script code 2742# here we export the classes and methods available to script code
2716 2743
2717=pod 2744=pod
2718 2745
2719The following functions and methods are available within a safe environment: 2746The following functions and methods are available within a safe environment:
2720 2747
2721 cf::object 2748 cf::object
2722 contr pay_amount pay_player map x y force_find force_add 2749 contr pay_amount pay_player map x y force_find force_add
2723 insert remove 2750 insert remove name archname title slaying race
2724 2751
2725 cf::object::player 2752 cf::object::player
2726 player 2753 player
2727 2754
2728 cf::player 2755 cf::player
2733 2760
2734=cut 2761=cut
2735 2762
2736for ( 2763for (
2737 ["cf::object" => qw(contr pay_amount pay_player map force_find force_add x y 2764 ["cf::object" => qw(contr pay_amount pay_player map force_find force_add x y
2738 insert remove)], 2765 insert remove inv name archname title slaying race)],
2739 ["cf::object::player" => qw(player)], 2766 ["cf::object::player" => qw(player)],
2740 ["cf::player" => qw(peaceful)], 2767 ["cf::player" => qw(peaceful)],
2741 ["cf::map" => qw(trigger)], 2768 ["cf::map" => qw(trigger)],
2742) { 2769) {
2743 no strict 'refs'; 2770 no strict 'refs';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines