ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/town_portal.ext
(Generate patch)

Comparing deliantra/server/ext/town_portal.ext (file contents):
Revision 1.4 by root, Wed Apr 30 13:46:40 2008 UTC vs.
Revision 1.7 by root, Sun Apr 25 11:23:31 2010 UTC

12 my ($spell, $who, $caster, $dir, $arg) = @_; 12 my ($spell, $who, $caster, $dir, $arg) = @_;
13 13
14 my $region = $who->region 14 my $region = $who->region
15 or return cf::override 0; 15 or return cf::override 0;
16 16
17 my ($map, $x, $y); 17 my $map;
18 while () { 18 while () {
19 ($map, $x, $y) = ($region->portalmap, $region->portalx, $region->portaly); 19 $map = $region->portalmap;
20 20
21 last if $map; 21 last if $map;
22 22
23 $region = $region->parent 23 $region = $region->parent
24 or return cf::override 0; 24 or return cf::override 0;
25 } 25 }
26 26
27 my $portal = $spell->other_arch->instantiate; 27 my $portal = $spell->other_arch->instance;
28 28
29 $portal->name ("Magic Portal to nearest Town"); 29 $portal->name ("Magic Portal to nearest Town");
30 $portal->slaying ($map); 30 $portal->slaying ($map);
31 $portal->stats->hp ($x);
32 $portal->stats->sp ($y);
33 31
34 #$portal->stats->food (40); # handy for debugging 32 #$portal->stats->food (40); # handy for debugging
35 33
36 $portal->insert_at ($who, $who, cf::INS_ABOVE_FLOOR_ONLY); 34 $portal->insert_at ($who, $who, cf::INS_ABOVE_FLOOR_ONLY);
37 35
57 my ($map, $x, $y, $uuid) = @{ $who->{town_portal} }; 55 my ($map, $x, $y, $uuid) = @{ $who->{town_portal} };
58 56
59 $who->goto ($map, $x, $y, sub { 57 $who->goto ($map, $x, $y, sub {
60 my ($map) = @_; 58 my ($map) = @_;
61 59
60 $map->load; # make sure the map is loaded
61
62 if (grep $_->uuid eq $uuid, $map->at ($x, $y)) { 62 if (grep $_->uuid eq $uuid, $map->at ($x, $y)) {
63 $who->reply (undef, "The town portal weaves its magic... and after a short moment, you return to the magic portal.", cf::NDI_NAVY); 63 $who->reply (undef, "The town portal weaves its magic... and after a short moment, you return to the magic portal.", cf::NDI_NAVY);
64 64
65 delete $who->{town_portal}; 65 delete $who->{town_portal};
66 66

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines