MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | inherit "/std/thing"; |
| 2 | |
| 3 | #include <properties.h> |
| 4 | #include <language.h> |
| 5 | |
| 6 | int tm; |
| 7 | int gestopft = 0; |
| 8 | int rauchen = 0; |
| 9 | |
| 10 | string des; |
| 11 | |
| 12 | string _query_long(){ |
| 13 | string s; |
| 14 | s="Ein einfaches Holzpfeifchen: Ohne Verzierungen oder besondere " |
| 15 | "Extras, sondern schlicht und stabil genug fuer ein Abenteurerleben. " |
| 16 | "Es eignet sich hervorragend dazu, einmal zu entspannen und guten " |
| 17 | "Tabak zu geniessen"; |
| 18 | if(gestopft) s+=". Das Pfeifchen ist gestopft"; |
| 19 | if(rauchen) s+=" und angezuendet."; |
| 20 | else s+="."; |
| 21 | return(break_string(s,78)); |
| 22 | } |
| 23 | |
| 24 | string _query_short(){ |
| 25 | if(rauchen) return "Ein Pfeifchen (angezuendet)"; |
| 26 | if(gestopft) return "Ein Pfeifchen (gestopft)"; |
| 27 | else return "Ein Pfeifchen"; |
| 28 | } |
| 29 | |
| 30 | protected void create(){ |
| 31 | if(!clonep(this_object()))return ; |
| 32 | thing::create(); |
| 33 | tm=0; |
| 34 | SetProp(P_GENDER,NEUTER); |
| 35 | SetProp(P_NAME,"Pfeifchen"); |
| 36 | SetProp(P_WEIGHT,10); |
| 37 | SetProp(P_VALUE,0); |
| 38 | AddId(({"pfeifchen","holzpfeifchen"})); |
| 39 | SetProp(P_NODROP,1); |
| 40 | SetProp(P_NEVERDROP,1); |
| 41 | SetProp(P_MATERIAL,MAT_IRON_WOOD); |
| 42 | AddCmd(({"rauch","rauche"}),"cm_smoke"); |
| 43 | AddCmd(({"stopf","stopfe"}),"cm_stopf"); |
| 44 | } |
| 45 | |
| 46 | static int cm_stopf(string str){ |
| 47 | string s1,s2; |
| 48 | object ob; |
| 49 | _notify_fail("Syntax: stopfe pfeifchen mit <was>\n"); |
| 50 | if(!str) return 0; |
| 51 | if(sscanf(str,"%s mit %s",s1,s2)==2){ |
| 52 | if(id(s1)){ |
| 53 | if(!ob=present(s2,this_player())){ |
| 54 | write("So etwas hast Du doch gar nicht bei Dir.\n"); |
| 55 | return 1; |
| 56 | } |
| 57 | if((ob->id("tabak")) || (ob->QueryMaterial(MAT_CANNABIS)>50)){ |
| 58 | if(rauchen){ |
| 59 | write(break_string("Du rauchst Dein Pfeifchen doch gerade. Damit " |
| 60 | "musst Du schon warten, bis Du fertig bist.",78)); |
| 61 | return 1; |
| 62 | } |
| 63 | if(gestopft){ |
| 64 | write(break_string("Du hast Dein Pfeifchen bereits gestopft. Es " |
| 65 | "liesse sich nun vortrefflich rauchen.",78)); |
| 66 | return 1; |
| 67 | } |
| 68 | else{ |
| 69 | write(break_string("Du stopfst Dein Pfeifchen mit "+ |
| 70 | ob->name(WEM,1)+ |
| 71 | " und freust Dich schon darauf, es zu rauchen.",78)); |
| 72 | tell_room(environment(this_player()),this_player()->Name()+ |
| 73 | " stopft ein Pfeifchen.\n",({this_player()})); |
| 74 | if(!ob->GetSmokeDescription()) des="Es scheint sich um keinen " |
| 75 | "besonders guten Tabak zu handeln. Nun, ja. Besser als nichts " |
| 76 | "immerhin."; |
| 77 | else des=ob->GetSmokeDescription(); |
| 78 | if(!ob->QueryProp(P_AMOUNT)) |
| 79 | ob->remove(); |
| 80 | else |
| 81 | ob->AddAmount(-1); |
| 82 | gestopft = 1; |
| 83 | return 1; |
| 84 | } |
| 85 | } |
| 86 | write(break_string("Das laesst sich aber schlecht rauchen, such " |
| 87 | "Dir lieber einen ordentlichen Tabak.",78)); |
| 88 | return 1; |
| 89 | } |
| 90 | } |
| 91 | return(0); //non-void Funktion, Zesstra |
| 92 | } |
| 93 | |
| 94 | static int cm_smoke(string str){ |
| 95 | object ob; |
| 96 | |
| 97 | _notify_fail("Was moechtest Du rauchen?\n"); |
| 98 | if(!str) return 0; |
| 99 | if(!id(str)) return 0; |
| 100 | if(rauchen){ |
| 101 | write("Das machst Du doch bereits, nicht so hektisch.\n"); |
| 102 | return 1; |
| 103 | } |
| 104 | if(!gestopft){ |
| 105 | write("Vielleicht solltest Du Dein Pfeifchen erst mal stopfen?\n"); |
| 106 | return 1; |
| 107 | } |
| 108 | if(tm > time()){ |
| 109 | write("Nana, ein Pfeifchen geniesst man. Sei mal nicht so hektisch.\n"); |
| 110 | return 1; |
| 111 | } |
| 112 | tm = time()+20; |
| 113 | rauchen = 1; |
| 114 | tell_room(environment(this_player()),this_player()->Name()+" raucht in " |
| 115 | +"Ruhe ein Pfeifchen.\n",({this_player()})); |
| 116 | write("Du rauchst in Ruhe Dein Pfeifchen.\n"); |
| 117 | write(break_string(des,78)); |
| 118 | if(find_call_out("smoke2")==-1) |
| 119 | call_out("smoke2",20,getuid(this_player())); |
| 120 | return 1; |
| 121 | } |
| 122 | |
| 123 | int smoke2(object pl){ |
| 124 | object ob; |
| 125 | if(!rauchen) return 0; |
| 126 | if(!ob=find_player(pl)) return 0; |
| 127 | if(environment()!=ob) return 0; |
| 128 | tell_object(ob,"Genuesslich pustest Du ein paar Rauchkringel in die Luft.\n"); |
| 129 | tell_room(environment(ob),ob->Name()+" pustet genuesslich ein paar " |
| 130 | +"Rauchkringel in die Luft.\n",({ob})); |
| 131 | if(find_call_out("smoke3")==-1) |
| 132 | call_out("smoke3",20,getuid(environment())); |
| 133 | return 1; |
| 134 | } |
| 135 | |
| 136 | int smoke3(object pl){ |
| 137 | object ob; |
| 138 | if(!rauchen) return 0; |
| 139 | if(!ob=find_player(pl)) return 0; |
| 140 | if(environment()!=ob) return 0; |
| 141 | tell_object(ob,break_string("Genuesslich pustest Du ein paar Rauchkringel " |
| 142 | "in die Luft, rauchst Dein Pfeifchen auf und klopfst es aus.",78)); |
| 143 | tell_room(environment(ob),break_string(ob->Name()+" pustet genuesslich ein " |
| 144 | "paar Rauchkringel in die Luft, beendet das Rauchpaeuschen und klopft " |
| 145 | +(ob->QueryProp(P_GENDER)==1?"sein":"ihr")+" Pfeifchen aus.",78),({ob})); |
| 146 | rauchen = 0; |
| 147 | gestopft = 0; |
| 148 | return 1; |
| 149 | } |