1 | #! perl |
1 | #! perl |
2 | #CONVERSION: PARTIAL |
|
|
3 | |
2 | |
4 | # handle the nimbus map and other stuff |
3 | # handle the nimbus map and other stuff |
5 | |
4 | |
6 | my @STATS = qw( |
5 | my @STATS = qw( |
7 | Str Dex Con Wis Cha Int Pow |
6 | Str Dex Con Wis Cha Int Pow |
… | |
… | |
108 | $portal->apply ($pl->ob); |
107 | $portal->apply ($pl->ob); |
109 | |
108 | |
110 | $portal->free; |
109 | $portal->free; |
111 | } |
110 | } |
112 | |
111 | |
113 | sub on_trigger { |
112 | cf::register_attachment nimbus_exit => |
114 | my ($event, $porter, $ob) = @_; |
113 | on_trigger => sub { |
|
|
114 | my ($self, $ob) = @_; |
115 | |
115 | |
116 | my $options = $event->options; |
|
|
117 | my $pl = $ob->contr; |
116 | my $pl = $ob->contr; |
118 | my @savebed; |
117 | my @savebed; |
119 | |
118 | |
120 | if (my $save = delete $ob->{in_nimbus}) { |
119 | if (my $save = delete $ob->{in_nimbus}) { |
121 | @savebed = @{$save->{savebed}}; |
120 | @savebed = @{$save->{savebed}}; |
122 | |
121 | |
123 | if ($options eq "restore") { |
122 | if ($self->{nimbus_exit}{restore}) { |
124 | $ob->message ("The gods acknowledge your success.\n"); |
123 | $ob->message ("The gods acknowledge your success.\n"); |
125 | stats_set $ob->stats, $save->{stats}; |
124 | stats_set $ob->stats, $save->{stats}; |
126 | stats_set $pl->orig_stats, $save->{orig_stats}; |
125 | stats_set $pl->orig_stats, $save->{orig_stats}; |
127 | $ob->player_lvl_adj; # update overall level |
126 | $ob->player_lvl_adj; # update overall level |
128 | skills_set $ob, $save->{skill_exp}; |
127 | skills_set $ob, $save->{skill_exp}; |
|
|
128 | } else { |
|
|
129 | $ob->message ("The gods are disappointed with you.\n"); |
|
|
130 | } |
|
|
131 | |
129 | } else { |
132 | } else { |
130 | $ob->message ("The gods are disappointed with you.\n"); |
133 | @savebed = ("/scorn/taverns/inn", 10, 5); |
131 | } |
134 | } |
132 | |
135 | |
133 | } else { |
136 | $pl->set_savebed (@savebed); |
134 | @savebed = ("/scorn/taverns/inn", 10, 5); |
|
|
135 | } |
|
|
136 | |
137 | |
137 | $pl->set_savebed (@savebed); |
138 | my $map = $ob->map; |
138 | |
139 | |
139 | my $map = $ob->map; |
140 | teleport $pl, @savebed; |
140 | |
141 | |
141 | teleport $pl, @savebed; |
142 | # should make this a temporary map and let cf deal with it |
|
|
143 | unlink $map->path; |
|
|
144 | unlink $map->path . ".pst"; |
|
|
145 | unlink $map->path . ".cfperl"; |
142 | |
146 | |
143 | # should make this a temporary map and let cf deal with it |
|
|
144 | unlink $map->path; |
|
|
145 | unlink $map->path . ".cfperl"; |
|
|
146 | $map->delete_map; |
147 | $map->delete_map; |
147 | |
148 | |
148 | $pl->play_sound_player_only (cf::SOUND_PLAYER_DIES); |
149 | $pl->play_sound_player_only (cf::SOUND_PLAYER_DIES); |
149 | |
150 | |
150 | $ob->message ("You feel as if you woke up from a dream.\n"); |
151 | $ob->message ("You feel as if you woke up from a dream.\n"); |
151 | $ob->message ("You have a headache.\n"); |
152 | $ob->message ("You have a headache.\n"); |
152 | $ob->message ("Maybe you should have a drink.\n"); |
153 | $ob->message ("Maybe you should have a drink.\n"); |
153 | |
154 | |
154 | 1 |
155 | cf::override; |
155 | } |
156 | }, |
|
|
157 | ; |
156 | |
158 | |