MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | // MorgenGrauen MUDlib |
| 2 | // |
| 3 | // death_room_vc.c -- Das Standardobjekt fuer den VC-Todesraum |
| 4 | // |
| 5 | // $Id: death_room_vc.c 8988 2014-12-31 13:10:19Z Zesstra $ |
| 6 | |
| 7 | |
| 8 | #pragma strict_types |
| 9 | |
| 10 | #include <defines.h> |
| 11 | #include <properties.h> |
| 12 | #include <moving.h> |
| 13 | #include <language.h> |
| 14 | #include <wizlevels.h> |
| 15 | #include <daemon.h> |
| 16 | #include <new_skills.h> |
| 17 | |
| 18 | inherit "/std/room"; |
| 19 | |
| 20 | public int no_attack(); |
| 21 | public int no_poison(int val); |
| 22 | |
| 23 | public void create() |
| 24 | { |
| 25 | if (IS_BLUE(this_object())) return; |
| 26 | ::create(); |
| 27 | |
| 28 | SetProp( P_GENDER, MALE ); |
| 29 | SetProp( P_ARTICLE, 0 ); |
| 30 | SetProp( P_LIGHT,1 ); |
| 31 | SetProp( P_NO_TPORT, NO_TPORT_OUT ); |
| 32 | SetProp( P_LOG_FILE, "TOD/Todesraum" ); |
| 33 | SetProp( P_INT_SHORT, "Arbeitszimmer des Todes" ); |
| 34 | SetProp( P_INT_LONG, break_string( |
| 35 | "Ein dunkler Raum, erleuchtet von dunklem Licht, das sich der " |
| 36 | "Dunkelheit nicht so sehr zu widersetzen scheint, indem es " |
| 37 | "leuchtet, als dass es der dunkelste Punkt in einer weniger " |
| 38 | "dunklen Umgebung ist. Im seltsamen Licht erkennst Du einen "+ |
| 39 | "zentral aufgestellten Schreibtisch, der mit Diagrammen und " |
| 40 | "Buechern bedeckt ist. Die Waende verschwinden hinter Regalen, " |
| 41 | "die gefuellt sind mit in Leder gebundenen, dunklen Waelzern, " |
| 42 | "von denen geheimnisvolle Runen leuchten.\nTod.", 78, 0, 1 ) ); |
| 43 | previous_object()->CustomizeObject(); |
| 44 | call_other("/room/death/death_room","???"); |
| 45 | } |
| 46 | |
| 47 | void test_remove() |
| 48 | { |
| 49 | if (!sizeof(all_inventory(this_object())&users())) |
| 50 | if (!this_object()->remove()) destruct(this_object()); |
| 51 | } |
| 52 | |
| 53 | public void reset() |
| 54 | { |
| 55 | ::reset(); |
| 56 | test_remove(); |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | public void exit(object liv) |
| 61 | { |
| 62 | call_out("test_remove",2); |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | |
| 67 | static void deep_destruct( object ob ) |
| 68 | { |
| 69 | if ( objectp(ob) && environment(ob) == this_object() ) |
| 70 | filter( deep_inventory(ob) + ({ ob }), |
| 71 | lambda( ({'x/*'*/}), ({#'destruct, 'x}) ) ); |
| 72 | } |
| 73 | |
| 74 | public void init() |
| 75 | { |
| 76 | string prayroom; |
| 77 | int res; |
| 78 | |
| 79 | ::init(); |
| 80 | if ( !query_once_interactive(this_player()) ){ |
| 81 | call_out( "deep_destruct", 0, this_player() ); |
| 82 | return; |
| 83 | } |
| 84 | |
| 85 | if ( !(prayroom = (string) this_player()->QueryPrayRoom()) ) |
| 86 | prayroom = "/room/pray_room"; |
| 87 | |
| 88 | if ( !this_player()->QueryProp(P_GHOST) ) |
| 89 | { |
| 90 | if ( IS_WIZARD(this_player()) && |
| 91 | this_player()->QueryProp(P_WANTS_TO_LEARN) ) |
| 92 | { |
| 93 | if ( !this_player()->QueryProp(P_INVIS) ) |
| 94 | tell_room( this_object(), |
| 95 | "Der Tod sagt: WAS WILLST DU HIER, "+ |
| 96 | upperstring((string) this_player()->name())+"?\n"+ |
| 97 | "Der Tod sagt: DU BIST UNSTERBLICH, DU HAST HIER " |
| 98 | "NICHTS ZU SUCHEN!\n\n" ); |
| 99 | } |
| 100 | else |
| 101 | { |
| 102 | write("Der Tod sagt: WAS TUST DU HIER? DEINE ZEIT IST NOCH " |
| 103 | "NICHT REIF!\n\n"); |
| 104 | |
| 105 | if ( catch(res = (int) this_player()->move( prayroom,M_GO|M_SILENT|M_NOCHECK )) |
| 106 | || res < 1 && environment(this_player()) == this_object() ) |
| 107 | this_player()->move( "/room/pray_room", M_GO|M_SILENT|M_NOCHECK ); |
| 108 | } |
| 109 | return; |
| 110 | } |
| 111 | |
| 112 | if ( !IS_DEPUTY(this_player()) ){ |
| 113 | add_action( "filter_ldfied", "", 1 ); |
| 114 | this_player()->Set( P_TMP_MOVE_HOOK, |
| 115 | ({ time()+31536000, |
| 116 | find_object("/room/death/death_room"), |
| 117 | "hier_geblieben" }) ); |
| 118 | } |
| 119 | |
| 120 | this_player()->Set( P_NO_ATTACK, #'no_attack, F_QUERY_METHOD ); |
| 121 | this_player()->Set( P_POISON, #'no_poison, F_SET_METHOD ); |
| 122 | |
| 123 | "/room/death/death_room"->add_player(this_player()); |
| 124 | } |
| 125 | |
| 126 | // public, da command_me() sonst buggt (Wurzels Speedy o.ae.) |
| 127 | public int filter_ldfied( string str ) |
| 128 | { |
| 129 | // Description: Filter out relevant commands. |
| 130 | string verb; |
| 131 | |
| 132 | verb=query_verb(); |
| 133 | |
| 134 | if ( (verb == "schlafe" || verb == "schlaf") && str == "ein" ){ |
| 135 | write("DU KANNST DEM TOD NICHT ENTRINNEN!\n"); |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | if ( verb == "typo" || verb == "fehler" || verb == "bug" || verb == "idee" ) |
| 140 | return 0; |
| 141 | |
| 142 | write( "Dein Koerper gehorcht Dir nicht !\n" ); |
| 143 | return 1; |
| 144 | } |
| 145 | |
| 146 | public int no_attack() |
| 147 | { |
| 148 | int i; |
| 149 | |
| 150 | // Spieler haengt noch in der Todessequenz |
| 151 | if( present(previous_object()) ) |
| 152 | return 1; |
| 153 | else |
| 154 | previous_object()->Set( P_NO_ATTACK, 0, F_QUERY_METHOD ); |
| 155 | |
| 156 | return 0; |
| 157 | } |
| 158 | |
| 159 | public int no_poison(int val) |
| 160 | { |
| 161 | if ( val != 0 ) |
| 162 | { |
| 163 | catch( raise_error("Poisoning dead players is illegal. Calling object " |
| 164 | "was "+object_name(previous_object(1))+"\n");publish ); |
| 165 | } |
| 166 | return 0; |
| 167 | } |
| 168 | |