1 | #! perl |
1 | #! perl |
|
|
2 | #CONVERSION: PARTIAL |
2 | |
3 | |
3 | my $price_fact = 50; |
4 | my $price_fact = 50; |
4 | |
5 | |
5 | sub set_package { |
6 | sub set_package { |
6 | my ($pkg, $from, $to, $bagname, $weight) = @_; |
7 | my ($pkg, $from, $to, $bagname, $weight) = @_; |
… | |
… | |
72 | $map->insert_object ($o, $x, $y); |
73 | $map->insert_object ($o, $x, $y); |
73 | $r |
74 | $r |
74 | } |
75 | } |
75 | |
76 | |
76 | # this handler handles to notice the player that he has got mail |
77 | # this handler handles to notice the player that he has got mail |
77 | sub on_login { |
78 | cf::attach_to_players |
|
|
79 | on_login => sub { |
78 | my ($pl) = @_; |
80 | my ($pl) = @_; |
79 | |
81 | |
80 | my $mails = CFMail::get_mail ($pl->ob->name); |
82 | my $mails = CFMail::get_mail ($pl->ob->name); |
81 | |
83 | |
82 | my $cnt = @{$mails || []}; |
84 | my $cnt = @{$mails || []}; |
83 | |
85 | |
84 | if ($cnt == 1) { |
86 | if ($cnt == 1) { |
85 | $pl->ob->message ("You got one mail."); |
87 | $pl->ob->message ("You got one mail."); |
86 | } elsif ($cnt > 1) { |
88 | } elsif ($cnt > 1) { |
87 | $pl->ob->message ("You got $cnt mails."); |
89 | $pl->ob->message ("You got $cnt mails."); |
88 | } else { |
90 | } else { |
89 | $pl->ob->message ("You haven't got any mail."); |
91 | $pl->ob->message ("You haven't got any mail."); |
|
|
92 | } |
90 | } |
93 | }, |
91 | |
94 | ; |
92 | 0 |
|
|
93 | } |
|
|
94 | |
95 | |
95 | # this event handler handles receiving of mails |
96 | # this event handler handles receiving of mails |
96 | sub on_apply { |
97 | sub on_apply { |
97 | my ($ev, $box, $pl) = @_; |
98 | my ($ev, $box, $pl) = @_; |
98 | |
99 | |