… | |
… | |
72 | my $r = $cb->($o, @a); |
72 | my $r = $cb->($o, @a); |
73 | $map->insert_object ($o, $x, $y); |
73 | $map->insert_object ($o, $x, $y); |
74 | $r |
74 | $r |
75 | } |
75 | } |
76 | |
76 | |
77 | # this handler handles to notice the player that he has got mail |
77 | # this handler notifies the player of new mail |
78 | cf::attach_to_players |
78 | cf::player->attach ( |
79 | on_login => sub { |
79 | on_login => sub { |
80 | my ($pl) = @_; |
80 | my ($pl) = @_; |
81 | |
81 | |
82 | my $mails = CFMail::get_mail ($pl->ob->name); |
82 | my $mails = CFMail::get_mail ($pl->ob->name); |
83 | |
83 | |
… | |
… | |
89 | $pl->ob->message ("You got $cnt mails."); |
89 | $pl->ob->message ("You got $cnt mails."); |
90 | } else { |
90 | } else { |
91 | $pl->ob->message ("You haven't got any mail."); |
91 | $pl->ob->message ("You haven't got any mail."); |
92 | } |
92 | } |
93 | }, |
93 | }, |
94 | ; |
94 | ); |
95 | |
95 | |
96 | # this event handler handles receiving of mails |
96 | # this event handler handles receiving of mails |
97 | cf::register_attachment ipo_mailbox => |
97 | cf::object::attachment ipo_mailbox => |
98 | on_apply => sub { |
98 | on_apply => sub { |
99 | my ($box, $pl) = @_; |
99 | my ($box, $pl) = @_; |
100 | |
100 | |
101 | my $cnt; |
101 | my $cnt; |
102 | my $mails = CFMail::get_mail ($pl->name) || []; |
102 | my $mails = CFMail::get_mail ($pl->name) || []; |