#include <food.h>#include <defines.h>#include <properties.h>
gehe zum Quellcode dieser Datei
Funktionen | |
| void | create () |
| int | eat_this (string str) |
| int | drink_this (string str) |
| void | MakeDrink () |
Variablen | |
| inherit std | thing |
| nosave int | alc |
| nosave int | alc_pp |
| nosave int | food |
| nosave int | food_pp |
| nosave int | heal |
| nosave int | p |
| nosave int | soft |
| nosave int | soft_pp |
| nosave int | c = 0 |
| void create | ( | ) |
Definiert in Zeile 60 der Datei food.c.
Benutzt AddCmd(), AddId(), create(), F_ALC, F_BAD, F_EMPTY_CONTAINER, F_EMPTY_GENDER, F_FOOD_SIZE, F_HEAL_HP, F_HEAL_SP, F_IS_DRINK, F_IS_FOOD, F_IS_FULL, F_LIQUID, F_NO_CONTAINER, F_POISON, F_POTION, NEUTER, P_GENDER, P_LONG, P_MATERIAL, P_NAME, P_SHORT, P_VALUE, P_WEIGHT und SetProp().
00061 { 00062 ::create(); 00063 00064 SetProp(P_SHORT,"Was zu essen"); 00065 SetProp(P_LONG,"Was zu essen.\n"); 00066 SetProp(P_NAME,"Was zu essen"); 00067 SetProp(P_GENDER,NEUTER); 00068 SetProp(P_WEIGHT,50); 00069 SetProp(P_VALUE,10); 00070 SetProp(P_MATERIAL,([MAT_MISC_FOOD:100])); 00071 // Das F_MESSAGE,"isst etwas auf."); 00072 SetProp(F_IS_FOOD,1); 00073 SetProp(F_IS_DRINK,0); 00074 SetProp(F_IS_FULL,1); 00075 SetProp(F_ALC,0); 00076 SetProp(F_LIQUID,0); 00077 SetProp(F_FOOD_SIZE,5); 00078 SetProp(F_HEAL_SP,0); 00079 SetProp(F_HEAL_HP,0); 00080 SetProp(F_EMPTY_CONTAINER,"Leerer Teller"); 00081 SetProp(F_EMPTY_GENDER,1); 00082 SetProp(F_NO_CONTAINER,1); 00083 SetProp(F_BAD,0); 00084 SetProp(F_POISON,0); 00085 SetProp(F_POTION,1); 00086 00087 AddId("essen"); 00088 00089 AddCmd(({"iss"}),"eat_this"); 00090 }

| int drink_this | ( | string | str | ) |
Definiert in Zeile 242 der Datei food.c.
Benutzt AddId(), alc, alc_pp, break_string(), BS_LEAVE_MY_LFS, c, F_ALC, F_BAD, F_EATER, F_EMPTY_CONTAINER, F_EMPTY_GENDER, F_EMPTY_ID, F_EMPTY_LONG, F_HEAL_HP, F_HEAL_SP, F_IS_DRINK, F_IS_FULL, F_LIQUID, F_MESSAGE, F_NO_CONTAINER, F_POISON, F_POTION, heal, notify_fail(), p, P_GENDER, P_LONG, P_NAME, P_POISON, P_SHORT, PL, QueryProp(), SetProp(), soft und soft_pp.
00243 { 00244 notify_fail("WAS moechtest Du trinken?\n"); 00245 if ( !str || !id(str) ) 00246 return 0; 00247 00248 if ( !QueryProp(F_IS_DRINK) ) 00249 { write(break_string("Das kann man nicht trinken.",78)); return 1; } 00250 00251 if ( !QueryProp(F_IS_FULL) || !QueryProp(F_POTION) ) 00252 { write(break_string("Da ist nichts mehr drin.",78)); return 1; } 00253 00254 if ( QueryProp(F_POTION) > QueryProp(F_LIQUID)/50 ) 00255 SetProp(F_POTION,QueryProp(F_LIQUID)/50); 00256 00257 alc=QueryProp(F_ALC); 00258 soft=QueryProp(F_LIQUID); 00259 00260 if ( alc < 0 ) 00261 alc=0; 00262 00263 if ( alc > 100 ) 00264 alc=100; 00265 00266 if ( soft < 1 ) 00267 soft=1; 00268 00269 alc_pp=alc/(QueryProp(F_POTION)+c); 00270 // P_DRINK,100 == 1000 ml == 1 l 00271 soft_pp=soft/((QueryProp(F_POTION)+c)*10); 00272 00273 // Falls die Portionen nicht Integer-glatt sind, wird in der letzten Runde 00274 // die Differenz aufaddiert. *hick* ! 00275 if ( QueryProp(F_POTION) == 1 ) 00276 { 00277 if ( alc_pp*(c+1) != alc ) 00278 alc_pp+=alc-alc_pp*(c+1); 00279 00280 if ( soft_pp*(c+1)*10 != soft ) 00281 soft_pp+=soft-soft_pp*(c+1)*10; 00282 } 00283 00284 // write(BS("Alc_pp: "+alc_pp)); 00285 // write(BS("Soft_pp: "+soft_pp+"\n\n")); 00286 00287 if ( soft_pp < 1 ) 00288 soft_pp=1; 00289 00290 if ( !this_player()->drink_soft(soft_pp) ) 00291 return 1; 00292 00293 if ( alc > 0 && alc_pp < 1 ) 00294 alc_pp=1; 00295 00296 if ( alc_pp > 0 ) 00297 if ( !this_player()->drink_alcohol(alc_pp) ) 00298 return 1; 00299 00300 // --- Erfolg --- 00301 00302 c++; 00303 00304 p=QueryProp(F_POISON); 00305 00306 if ( p < 0 ) 00307 p=0; 00308 00309 if ( p > 10 ) 00310 p=10; 00311 00312 if ( this_player()->SetProp(P_POISON,this_player()->QueryProp(P_POISON)+p) > 10 ); 00313 00314 if ( QueryProp(F_EATER) ) { 00315 tell_object(PL,break_string("Du "+QueryProp(F_EATER),78,0, 00316 BS_LEAVE_MY_LFS)); 00317 } 00318 else { 00319 tell_object(PL, break_string("Du trinkst "+QueryProp(P_SHORT)+".",78)); 00320 } 00321 00322 if ( QueryProp(F_MESSAGE) ) { 00323 tell_room(environment(PL), 00324 break_string(PL->name()+" "+QueryProp(F_MESSAGE),78,0, 00325 BS_LEAVE_MY_LFS)); 00326 } 00327 else { 00328 tell_room(environment(PL), 00329 break_string(PL->name()+" trinkt " + QueryProp(P_SHORT)+".",78)); 00330 } 00331 00332 SetProp(F_POTION,QueryProp(F_POTION)-1); 00333 00334 switch ( QueryProp(F_BAD) ) 00335 { 00336 case 0: // Heilung 00337 if ( QueryProp(F_HEAL_SP) > 0 ) 00338 { 00339 heal=QueryProp(F_HEAL_SP)/5; 00340 if ( heal < 1 ) heal=1; 00341 this_player()->buffer_sp(QueryProp(F_HEAL_SP),heal); 00342 } 00343 if ( QueryProp(F_HEAL_HP) > 0 ) 00344 { 00345 heal=QueryProp(F_HEAL_HP)/5; 00346 if ( heal < 1 ) heal=1; 00347 this_player()->buffer_hp(QueryProp(F_HEAL_HP),heal); 00348 } 00349 break; 00350 00351 default: // Verdorbenes Trinken 00352 if ( QueryProp(F_BAD) > 11 ) SetProp(F_BAD,11); 00353 if ( this_player()->SetProp(P_POISON,this_player()->QueryProp(P_POISON)+QueryProp(F_BAD)) > 11 ); 00354 write(break_string("Das war wohl nicht so gut. Dir wird ganz uebel!",78)); 00355 break; 00356 } 00357 00358 if ( !QueryProp(F_POTION) ) 00359 { 00360 if ( QueryProp(F_NO_CONTAINER) ) 00361 remove(1); 00362 else 00363 { 00364 SetProp(P_SHORT,QueryProp(F_EMPTY_CONTAINER)); 00365 SetProp(P_GENDER,QueryProp(F_EMPTY_GENDER)); 00366 SetProp(P_LONG,QueryProp(F_EMPTY_LONG)); 00367 SetProp(P_NAME,QueryProp(F_EMPTY_CONTAINER)); 00368 SetProp(F_IS_FULL,0); 00369 00370 AddId(lower_case(QueryProp(F_EMPTY_CONTAINER))); 00371 AddId(lower_case(QueryProp(F_EMPTY_ID))); 00372 } 00373 } 00374 return 1; 00375 }

| int eat_this | ( | string | str | ) |
Definiert in Zeile 99 der Datei food.c.
Benutzt AddId(), alc, alc_pp, break_string(), BS_LEAVE_MY_LFS, c, F_ALC, F_BAD, F_EATER, F_EMPTY_CONTAINER, F_EMPTY_GENDER, F_EMPTY_ID, F_EMPTY_LONG, F_FOOD_SIZE, F_HEAL_HP, F_HEAL_SP, F_IS_FOOD, F_IS_FULL, F_MESSAGE, F_NO_CONTAINER, F_POISON, F_POTION, food, food_pp, heal, name, notify_fail(), p, P_GENDER, P_LONG, P_NAME, P_POISON, P_SHORT, PL, QueryProp() und SetProp().
00100 { 00101 notify_fail("WAS moechtest Du essen?\n"); 00102 if ( !str || !id(str) ) 00103 return 0; 00104 00105 if ( !QueryProp(F_IS_FOOD) ) 00106 { write(("Das kann man nicht essen.\n")); return 1; } 00107 00108 if ( !QueryProp(F_IS_FULL) || !QueryProp(F_POTION) ) 00109 { write(("Da ist nichts mehr drin.\n")); return 1; } 00110 00111 if ( QueryProp(F_POTION) > QueryProp(F_FOOD_SIZE) ) 00112 SetProp(F_POTION,QueryProp(F_FOOD_SIZE)); 00113 00114 // Auch Essen kann Alkohol enthalten, huhu Rochus :) 00115 alc=QueryProp(F_ALC); 00116 food=QueryProp(F_FOOD_SIZE); 00117 00118 if ( alc < 0 ) 00119 alc=0; 00120 00121 if ( alc > 100 ) 00122 alc=100; 00123 00124 if ( food < 1 ) 00125 food=1; 00126 00127 alc_pp=alc/(QueryProp(F_POTION)+c); 00128 food_pp=food/(QueryProp(F_POTION)+c); 00129 00130 // Falls die Portionen nicht integer-glatt sind, wird in der letzten Runde 00131 // die Differenz aufaddiert. *hick* ! 00132 if ( QueryProp(F_POTION) == 1 ) 00133 { 00134 if ( alc_pp*(c+1) != alc ) 00135 alc_pp+=alc-alc_pp*(c+1); 00136 00137 if ( food_pp*(c+1) != food ) 00138 food_pp+=food-food_pp*(c+1); 00139 } 00140 00141 // write(BS("Alc_pp: "+alc_pp)); 00142 // write(BS("Food_pp: "+food_pp+"\n\n")); 00143 00144 if ( food_pp < 1 ) 00145 food_pp=1; 00146 00147 if ( !this_player()->eat_food(food_pp) ) 00148 return 1; 00149 00150 if ( alc > 0 && alc_pp < 1 ) 00151 alc_pp=1; 00152 00153 if ( alc > 0 ) 00154 if ( !this_player()->drink_alcohol(alc_pp) ) 00155 return 1; 00156 00157 // --- Erfolg --- 00158 00159 c++; 00160 00161 p=QueryProp(F_POISON); 00162 00163 if ( p < 0 ) 00164 p=0; 00165 00166 if ( p > 10 ) 00167 p=10; 00168 00169 if ( this_player()->SetProp(P_POISON,this_player()->QueryProp(P_POISON)+p) > 10 ); 00170 00171 if ( QueryProp(F_EATER) ) { 00172 tell_object(PL,break_string("Du "+QueryProp(F_EATER),78,0, 00173 BS_LEAVE_MY_LFS)); 00174 } 00175 else { 00176 tell_object(PL, break_string("Du isst "+QueryProp(P_SHORT)+".",78)); 00177 } 00178 00179 if ( QueryProp(F_MESSAGE) ) { 00180 tell_room(environment(PL), 00181 break_string(this_player()->name()+" "+QueryProp(F_MESSAGE),78,0, 00182 BS_LEAVE_MY_LFS),({PL})); 00183 } 00184 else { 00185 tell_room(environment(PL), 00186 break_string(this_player()->name()+" isst " 00187 + QueryProp(P_SHORT)+".",78),({PL})); 00188 } 00189 00190 SetProp(F_POTION,QueryProp(F_POTION)-1); 00191 00192 switch ( QueryProp(F_BAD) ) 00193 { 00194 case 0: // Heilung 00195 if ( QueryProp(F_HEAL_SP) > 0 ) 00196 { 00197 heal=QueryProp(F_HEAL_SP)/5; 00198 if ( heal < 1 ) heal=1; 00199 this_player()->buffer_sp(QueryProp(F_HEAL_SP),heal); 00200 } 00201 if ( QueryProp(F_HEAL_HP) > 0 ) 00202 { 00203 heal=QueryProp(F_HEAL_HP)/5; 00204 if ( heal < 1 ) heal=1; 00205 this_player()->buffer_hp(QueryProp(F_HEAL_HP),heal); 00206 } 00207 break; 00208 00209 default: // Verdorbenes Essen 00210 if ( QueryProp(F_BAD) > 11 ) SetProp(F_BAD,11); 00211 if ( this_player()->SetProp(P_POISON,this_player()->QueryProp(P_POISON)+QueryProp(F_BAD)) > 11 ); 00212 write(break_string("Das war wohl nicht so gut. Dir wird ganz uebel!",78)); 00213 break; 00214 } 00215 00216 if ( !QueryProp(F_POTION) ) 00217 { 00218 if ( QueryProp(F_NO_CONTAINER) ) 00219 remove(1); 00220 else 00221 { 00222 SetProp(P_SHORT,QueryProp(F_EMPTY_CONTAINER)); 00223 SetProp(P_GENDER,QueryProp(F_EMPTY_GENDER)); 00224 SetProp(P_LONG,QueryProp(F_EMPTY_LONG)); 00225 SetProp(P_NAME,QueryProp(F_EMPTY_CONTAINER)); 00226 SetProp(F_IS_FULL,0); 00227 00228 AddId(lower_case(QueryProp(F_EMPTY_CONTAINER))); 00229 AddId(lower_case(QueryProp(F_EMPTY_ID))); 00230 } 00231 } 00232 return 1; 00233 }

| void MakeDrink | ( | ) |
Definiert in Zeile 378 der Datei food.c.
Benutzt AddCmd(), AddId(), F_FOOD_SIZE, F_IS_DRINK, RemoveCmd(), RemoveId() und SetProp().
00379 { 00380 SetProp(F_IS_DRINK,1); 00381 SetProp(F_FOOD_SIZE,0); 00382 AddCmd(({"trink","trinke"}),"drink_this"); 00383 AddId("trinken"); 00384 RemoveId("essen"); 00385 RemoveCmd(({"iss"})); 00386 }

| nosave int alc |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von catch_up_hbs(), defuel_drink(), drink_alcohol(), drink_this(), eat_this() und heart_beat().
| nosave int alc_pp |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von drink_this() und eat_this().
| nosave int food |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von defuel_food() und eat_this().
| nosave int food_pp |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von eat_this().
| nosave int heal |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von CalcMax(), drink_this(), eat_this(), mampf_heilung() und RegisterItem().
| nosave int p |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von break_string_hard(), check_player(), clean(), cleanof(), drink_this(), eat_this(), full_path_array(), get_carbon_copy(), get_edit_line(), getFreeEKsForPlayer(), listinv(), lv(), makeTiplistFromBitString(), pl(), remove_alist(), save_msg(), sel(), ShowWritten(), to_filename() und transform_into_pile().
| nosave int soft |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von drink_this().
| nosave int soft_pp |
Definiert in Zeile 54 der Datei food.c.
Wird benutzt von drink_this().
1.6.3