--- deliantra/maps/perl/ipo.ext 2006/08/09 11:54:02 1.4 +++ deliantra/maps/perl/ipo.ext 2006/08/09 13:40:02 1.5 @@ -48,6 +48,23 @@ 3 => ['diploma', 'mailwarning'], ); +sub notify_players { + my (%sent_targets) = @_; + + # lets message player ingame: this is a NEW feature from the perl IPO :-) + for (keys %sent_targets) { + if (my $player = cf::player::find $_) { + my $cnt = $sent_targets{$_}; + + if ($cnt == 1) { + $player->ob->message ("You've got new mail."); + } else { + $player->ob->message ("You've got $cnt new mails."); + } + } + } +} + sub create_object { my ($name, $map, $x, $y, $cb, @a) = @_; my $o = cf::object::new $name; @@ -143,18 +160,7 @@ $_->remove for @mails; - # lets message player ingame: this is a NEW feature from the perl IPO :-) - for (keys %sent_targets) { - if (my $player = cf::player::find $_) { - my $cnt = $sent_targets{$_}; - - if ($cnt == 1) { - $player->ob->message ("You've got new mail."); - } else { - $player->ob->message ("You've got $cnt new mails."); - } - } - } + notify_players (%sent_targets); 0; } @@ -226,6 +232,8 @@ if ($cnt) { $who->reply ($npc, $cnt == 1 ? "Package sent to $arguments." : "Sent $cnt packages to $arguments\n"); + CFMail::send_mail (1, $arguments, $who->name, "You got $cnt packages from " . $who->name); + notify_players ($arguments => 1); } else { $who->reply ($npc, "Sorry, found no package to send to $arguments."); } @@ -240,6 +248,8 @@ ."- bag (%s platinum)\n" ."- package (%s platinum)\n" ."- carton (%s platinum)\n" + ."- send (send bags/packages/cartons)\n" + ."- receive (to receive packages for you)\n" .($who->flag (cf::FLAG_WIZ) ? "- mailwarning " : ""), 40, 1000, 1, 1, 5, 10 );