#include <thing/commands.h>#include <thing/properties.h>#include <defines.h>#include <rooms.h>#include <routingd.h>#include <bank.h>#include <exploration.h>#include <wizlevels.h>#include <pub.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
| #define | LEGACY |
| #define | PM_RATE_PUBMASTER "rate" |
| #define | PM_DELAY_PUBMASTER "delay" |
Funktionen | |
| protected void | create () |
| protected void | create_super () |
| varargs string | AddToMenu (string menuetext, mixed ids, mapping minfo, mixed rate, mixed msg, mixed refresh, mixed delay, mixed d_msg) |
| void | AddFood (string nameOfFood, mixed ids, int price, int heal, mixed myFunction) |
| void | AddDrink (string nameOfDrink, mixed ids, int price, int heal, int strength, int soak, mixed myFunction) |
| int | RemoveFromMenu (mixed ids) |
| int | eval_anything (mixed what, object pl) |
| string | CheckAvailability (string ident, object zahler) |
| void | DecreaseAvailability (string ident, string uid) |
| static void | UpdateAvailability () |
| mixed | DBG (mixed o) |
| string | menue_text (string str) |
| int | menue (string str) |
| mapping | adjust_info (string ident, mapping minfo, object zahler, object empfaenger) |
| string | mess (string str, object pl) |
| protected void | _copy_menulist_values (mapping entryinfo, string ident) |
| int | do_deliver (string ident, object zahler, object empfaenger, mapping entryinfo) |
| int | consume_something (string ident, object zahler, object empfaenger) |
| int | search_what (string str, object zahler, object empfaenger) |
| int | spendiere (string str) |
| int | bestelle (string str) |
| int | pubinit () |
| void | reset () |
| void | add_gluehwein () |
| void | add_std_drinks () |
| mapping | query_menulist () |
| mixed | query_drinks () |
| mixed | query_food () |
Variablen | |
| private nosave int | max_list |
| private nosave int | refresh_count |
| private nosave int | sum |
| private nosave mapping | refresh_list |
| nosave mapping | id_list |
| nosave mapping | menu_list |
| nosave object * | waiting |
| nosave string * | dr |
| nosave string * | fo |
| #define PM_RATE_PUBMASTER "rate" |
Definiert in Zeile 40 der Datei pub.c.
Wird benutzt von _copy_menulist_values() und do_deliver().
| protected void _copy_menulist_values | ( | mapping | entryinfo, | |
| string | ident | |||
| ) |
Definiert in Zeile 547 der Datei pub.c.
Benutzt menu_list, PM_DELAY_MSG, PM_IDS, PM_RATE, PM_RATE_PUBMASTER, PM_REFRESH, PM_SERVE_MSG und PM_TEXT.
Wird benutzt von do_deliver().
00547 { 00548 /* Kopieren aller Werte ins minfo-Mapping, um Problemen bei Loeschung 00549 aus dem Weg zu gehen. Slow and dirty */ 00550 entryinfo[PM_TEXT] = deep_copy(menu_list[ident, PM_TEXT]); 00551 // PM_INFO is already flat in entryinfo 00552 entryinfo[PM_RATE_PUBMASTER] 00553 = deep_copy(menu_list[ident, PM_RATE]); 00554 entryinfo[PM_SERVE_MSG] = deep_copy(menu_list[ident, PM_SERVE_MSG]); 00555 entryinfo[PM_REFRESH] = deep_copy(menu_list[ident, PM_REFRESH]); 00556 // PM_DELAY is already evaluated in entryinfo 00557 entryinfo[PM_DELAY_MSG] = deep_copy(menu_list[ident, PM_DELAY_MSG]); 00558 entryinfo[PM_IDS] = deep_copy(menu_list[ident, PM_IDS]); 00559 }

| void add_gluehwein | ( | ) |
Definiert in Zeile 985 der Datei pub.c.
Benutzt AddToMenu(), ctime(), P_ALCOHOL, P_DRINK, P_HP, P_SP und P_VALUE.
Wird benutzt von add_std_drinks().
00986 { 00987 if ( ctime(time())[4..6]=="Dec" ) 00988 AddToMenu( "Gluehwein",({"gluehwein"}),([ 00989 P_VALUE : 80, 00990 P_DRINK : 5, 00991 P_ALCOHOL : 20, 00992 P_HP : 15, 00993 P_SP : 15 ]),2,({ 00994 ("Du trinkst ein Glas Gluehwein, an dem Du Dir beinahe die Zunge "+ 00995 "verbrennst.\n"), 00996 ("&& bestellt ein Glas Gluehwein und verbrennt sich beim\n"+ 00997 "Trinken beinahe die Zunge.\n") }), 0, 0, 0); 00998 }


| void add_std_drinks | ( | ) |
Definiert in Zeile 1000 der Datei pub.c.
Benutzt add_gluehwein(), P_NO_STD_DRINK und QueryProp().
01001 { 01002 if ( QueryProp(P_NO_STD_DRINK) ) 01003 return ; 01004 add_gluehwein(); 01005 }

| void AddDrink | ( | string | nameOfDrink, | |
| mixed | ids, | |||
| int | price, | |||
| int | heal, | |||
| int | strength, | |||
| int | soak, | |||
| mixed | myFunction | |||
| ) |
Definiert in Zeile 172 der Datei pub.c.
Benutzt AddToMenu(), P_ALCOHOL, P_DRINK, P_HP, P_SP und P_VALUE.
Wird benutzt von create().
00174 { 00175 if ( !nameOfDrink || !ids || !price ) 00176 return; 00177 00178 heal=heal/2; 00179 /* Kleine Korrektur, damit man in alten Pubs ueberhaupt trinken kann */ 00180 AddToMenu(nameOfDrink,ids, 00181 ([ P_VALUE : price, P_DRINK : soak, P_ALCOHOL : strength, 00182 P_HP : heal, P_SP : heal ]), 00183 ((heal>5)?5:heal), myFunction,0,0,0); 00184 }


| void AddFood | ( | string | nameOfFood, | |
| mixed | ids, | |||
| int | price, | |||
| int | heal, | |||
| mixed | myFunction | |||
| ) |
Definiert in Zeile 161 der Datei pub.c.
Benutzt AddToMenu(), P_FOOD, P_HP, P_SP und P_VALUE.
00163 { 00164 if ( !nameOfFood || !ids || !price) 00165 return; /* Food not healing is ok ! */ 00166 00167 AddToMenu( nameOfFood,ids, 00168 ([ P_VALUE : price, P_FOOD : heal, P_HP : heal, P_SP : heal ]), 00169 ((heal>5)?5:heal), myFunction, 0,0,0); 00170 }

| varargs string AddToMenu | ( | string | menuetext, | |
| mixed | ids, | |||
| mapping | minfo, | |||
| mixed | rate, | |||
| mixed | msg, | |||
| mixed | refresh, | |||
| mixed | delay, | |||
| mixed | d_msg | |||
| ) |
Definiert in Zeile 124 der Datei pub.c.
Benutzt dr, fo, i, id_list, max_list, menu_list, P_FOOD und PR_ALL.
Wird benutzt von add_gluehwein(), AddDrink() und AddFood().
00127 { string ident; 00128 int i; 00129 00130 if ( !stringp(menuetext) || !ids || !mappingp(minfo) ) 00131 return 0; 00132 00133 if ( stringp(ids) ) 00134 ids = ({ ids }); 00135 else if ( !pointerp(ids) ) 00136 return 0; 00137 00138 ident = sprintf("menuentry%d",max_list); 00139 max_list++; 00140 00141 /* Fuers Menue entscheiden ob Drink oder Food */ 00142 if (minfo[P_FOOD]) 00143 fo+=({ ident }); 00144 else 00145 dr+=({ ident }); 00146 00147 /* Fuer schnelles Nachschlagen ein eigenes Mapping fuer Ids */ 00148 for( i=sizeof(ids)-1;i>=0;i-- ) 00149 id_list += ([ ids[i] : ident ]); 00150 00151 if ( intp(refresh) && (refresh>0) ) 00152 refresh = ([ PR_ALL : refresh; 1 ]); 00153 else if ( !mappingp(refresh) ) 00154 refresh = 0; 00155 00156 menu_list += ([ ident : menuetext; minfo; rate; msg; refresh; 00157 delay; d_msg; ids ]); 00158 return ident; 00159 }

| mapping adjust_info | ( | string | ident, | |
| mapping | minfo, | |||
| object | zahler, | |||
| object | empfaenger | |||
| ) |
| int bestelle | ( | string | str | ) |
Definiert in Zeile 917 der Datei pub.c.
00918 { 00919 notify_fail((string)QueryProp(P_PUB_NOT_ON_MENU)); 00920 00921 if ( !stringp(str) ) 00922 return 0; 00923 00924 return search_what(str,PL,PL); 00925 }
| string CheckAvailability | ( | string | ident, | |
| object | zahler | |||
| ) |
Definiert in Zeile 277 der Datei pub.c.
Benutzt eval_anything(), menu_list, PM_REFRESH, PR_ALL, PR_DEFAULT, PR_NONE, PR_USER, PRV_AMOUNT, refresh_count und refresh_list.
00278 { string uid; 00279 00280 if ( !stringp(ident) || !member(menu_list,ident) || !objectp(zahler) ) 00281 return 0; 00282 if ( !mappingp(menu_list[ident,PM_REFRESH]) ) 00283 return PR_NONE; 00284 00285 if ( !member(refresh_list,ident) ) 00286 refresh_list += ([ ident : ([ ]) ]); 00287 00288 if ( query_once_interactive(zahler) ) 00289 uid=getuid(zahler); 00290 else 00291 uid=object_name(zahler); 00292 00293 if ( member(menu_list[ident,PM_REFRESH],PR_USER) ) 00294 { 00295 if ( !member(refresh_list[ident],uid) ) 00296 { 00297 refresh_list[ident] += ([ uid : 0 ; refresh_count ]); 00298 } 00299 00300 /* Kontingent des Zahlenden pruefen */ 00301 if ( refresh_list[ident][uid,PRV_AMOUNT] < 00302 eval_anything(menu_list[ident,PM_REFRESH][PR_USER,PRV_AMOUNT], 00303 zahler) ) 00304 return uid; 00305 } 00306 00307 if ( member(menu_list[ident,PM_REFRESH],PR_ALL) ) 00308 { 00309 if ( !member(refresh_list[ident],PR_DEFAULT) ) 00310 { 00311 refresh_list[ident] += ([ PR_DEFAULT : 0 ; refresh_count ]); 00312 } 00313 00314 /* Kontingent der Allgemeinheit pruefen */ 00315 if ( refresh_list[ident][PR_DEFAULT,PRV_AMOUNT] < 00316 eval_anything(menu_list[ident,PM_REFRESH][PR_ALL,PRV_AMOUNT], 00317 zahler) ) 00318 return PR_DEFAULT; 00319 } 00320 00321 return 0; 00322 }

| int consume_something | ( | string | ident, | |
| object | zahler, | |||
| object | empfaenger | |||
| ) |
Definiert in Zeile 663 der Datei pub.c.
00663 { 00664 if ( !objectp(zahler) ) 00665 zahler=PL; 00666 00667 if ( !objectp(empfaenger) ) 00668 empfaenger=PL; 00669 00670 /* Die Abfrage auf anwesenden Wirt erfolgt NUR an dieser Stelle, damit */ 00671 /* kein Spieler darunter leiden muss, wenn jemand anderes zwischen */ 00672 /* Bestellung und Lieferung den Wirt meuchelt. */ 00673 if ( stringp(QueryProp(P_KEEPER)) && !present(QueryProp(P_KEEPER), ME)) 00674 { 00675 tell_object(zahler, 00676 "Es ist niemand anwesend, der Dich bedienen koennte.\n"); 00677 return -5; 00678 } 00679 00680 /* Spendiert und ignoriert? */ 00681 if ( zahler!=empfaenger ) 00682 { 00683 mixed res = ({"spendiere"}); 00684 if ( menu_list[ident,PM_INFO][P_DRINK] ) 00685 res += ({"spendiere.getraenke"}); 00686 if ( menu_list[ident,PM_INFO][P_FOOD] ) 00687 res += ({"spendiere.essen"}); 00688 if ( menu_list[ident,PM_INFO][P_ALCOHOL] ) 00689 res += ({"spendiere.alkohol"}); 00690 if ( empfaenger->TestIgnore(res) ) 00691 { 00692 tell_object(zahler, 00693 empfaenger->Name(WER)+" will das nicht.\n"); 00694 return -1; 00695 } 00696 } 00697 00698 /* Hier kann das Info-Mapping erst mal als ganzes angepasst werden. */ 00699 mapping xinfo; 00700 mapping entryinfo = deep_copy(menu_list[ident, PM_INFO]); 00701 if ( (xinfo=adjust_info(ident,entryinfo,zahler,empfaenger)) && 00702 mappingp(xinfo) ) 00703 entryinfo += xinfo; 00704 00705 /* Genug Geld vorhanden? */ 00706 entryinfo[P_VALUE] = eval_anything(entryinfo[P_VALUE], zahler); 00707 00708 if ( (zahler->QueryMoney())<entryinfo[P_VALUE] ) 00709 { 00710 string res; 00711 if ( !stringp(res=QueryProp(P_PUB_NO_MONEY)) ) 00712 res = "Das kostet %d Goldstuecke, und Du hast nicht so viel!\n"; 00713 tell_object(zahler,sprintf(res, entryinfo[P_VALUE])); 00714 return -2; 00715 } 00716 00717 string avb; 00718 if ( !stringp(avb=CheckAvailability(ident, zahler)) ) 00719 { 00720 string res; 00721 if ( !stringp(res=QueryProp(P_PUB_UNAVAILABLE)) ) 00722 res = "Davon ist leider nichts mehr da.\n"; 00723 tell_object(zahler,res); 00724 return -6; 00725 } 00726 00727 /* Textausgabe beim spendieren */ 00728 if ( empfaenger!=zahler) 00729 { 00730 tell_room(environment(empfaenger)||ME, 00731 zahler->Name(WER)+" spendiert "+empfaenger->name(WEM)+" etwas.\n", 00732 ({zahler, empfaenger}) ); 00733 tell_object(empfaenger, 00734 zahler->Name(WER)+" spendiert Dir etwas.\n"); 00735 tell_object(zahler, 00736 "Du spendierst "+empfaenger->name(WEM)+" etwas.\n"); 00737 } 00738 00739 /* Testen, ob mans noch essen / trinken kann */ 00740 /* Die int-Werte werden in minfo uebernommen fuer die Auswertung */ 00741 /* im Pubmaster. */ 00742 entryinfo[P_FOOD] = eval_anything(entryinfo[P_FOOD], empfaenger); 00743 entryinfo[P_ALCOHOL] = eval_anything(entryinfo[P_ALCOHOL],empfaenger); 00744 entryinfo[P_DRINK] = eval_anything(entryinfo[P_DRINK], empfaenger); 00745 00746 #ifdef LEGACY 00747 /* Dieser Umweg ist leider noetig, da der Genuss an drei verschiedenen */ 00748 /* Abfragen scheitern kann. */ 00749 if (entryinfo[P_FOOD] && !empfaenger->eat_food(entryinfo[P_FOOD], 1)) { 00750 tell_object(empfaenger, 00751 "Du bist zu satt, das schaffst Du nicht mehr.\n"); 00752 return -3; 00753 } 00754 00755 if (entryinfo[P_DRINK] && !empfaenger->drink_soft(entryinfo[P_DRINK], 1)) { 00756 tell_object(empfaenger, 00757 "So viel kannst Du im Moment nicht trinken.\n"); 00758 return -3; 00759 } 00760 /* Auch bei Delay wird sofort getrunken/gegessen */ 00761 if (entryinfo[P_ALCOHOL] && 00762 !empfaenger->drink_alcohol(entryinfo[P_ALCOHOL]) ) 00763 return -3; 00764 #else 00765 int result = empfaenger->consume(entryinfo, 1); 00766 if (result < 0) { 00767 if (result & HC_MAX_FOOD_REACHED) 00768 tell_object(empfaenger, 00769 "Du bist zu satt, das schaffst Du nicht mehr.\n"); 00770 else if (result & HC_MAX_DRINK_REACHED) 00771 tell_object(empfaenger, 00772 "So viel kannst Du im Moment nicht trinken.\n"); 00773 else if (result & HC_MAX_ALCOHOL_REACHED) 00774 tell_object(empfaenger, 00775 "Soviel Alkohol vertraegst Du nicht mehr.\n"); 00776 return -3; 00777 } 00778 #endif 00779 00780 #ifdef LEGACY 00781 if (entryinfo[P_FOOD]) 00782 empfaenger->eat_food(entryinfo[P_FOOD]); 00783 if (entryinfo[P_DRINK]) 00784 empfaenger->drink_soft(entryinfo[P_DRINK]); 00785 #endif 00786 00787 /* Gezahlt wird auch sofort */ 00788 zahler->AddMoney(-entryinfo[P_VALUE]); 00789 sum+=entryinfo[P_VALUE]; 00790 00791 /* FPs gibts auch sofort */ 00792 if (zahler == empfaenger) 00793 GiveEP(EP_PUB,menu_list[ident,PM_IDS][0]); 00794 00795 /* Falls die Anzahl des Bestellten beschraenkt ist, muss diese natuerlich 00796 * angepasst werden. 00797 */ 00798 if ( avb!=PR_NONE ) 00799 DecreaseAvailability(ident,avb); 00800 00801 /* Gibt es eine Zeitverzoegerung zwischen Bestellen und Servieren? */ 00802 entryinfo[PM_DELAY_PUBMASTER] = eval_anything(menu_list[ident, PM_DELAY], zahler); 00803 00804 // alle fuer einen Drink notwendigen Werte kopieren 00805 _copy_menulist_values(entryinfo, ident); 00806 00807 if (entryinfo[PM_DELAY_PUBMASTER]<=0) 00808 return do_deliver(ident,zahler,empfaenger,entryinfo); 00809 00810 /* Bestell-Meldung ausgeben */ 00811 if (closurep(entryinfo[PM_DELAY_MSG])) 00812 funcall(entryinfo[PM_DELAY_MSG], zahler, empfaenger,ident, entryinfo); 00813 else if (stringp(entryinfo[PM_DELAY_MSG]) && 00814 function_exists(entryinfo[PM_DELAY_MSG],ME)) 00815 call_other(ME, entryinfo[PM_DELAY_MSG], zahler, empfaenger, ident, 00816 entryinfo); 00817 else if (pointerp(entryinfo[PM_DELAY_MSG]) && 00818 sizeof(entryinfo[PM_DELAY_MSG])>=2) { 00819 if (stringp(entryinfo[PM_DELAY_MSG][0]) && 00820 strlen(entryinfo[PM_DELAY_MSG][0])) 00821 tell_object(empfaenger, 00822 mess(entryinfo[PM_DELAY_MSG][0]+"\n",empfaenger)); 00823 if (stringp(entryinfo[PM_DELAY_MSG][1]) && 00824 strlen(entryinfo[PM_DELAY_MSG][1])) 00825 tell_room(environment(empfaenger)||ME, 00826 mess(entryinfo[PM_DELAY_MSG][1]+"\n",empfaenger), 00827 ({empfaenger}) ); 00828 } 00829 00830 waiting += ({ empfaenger }); 00831 call_out("do_deliver", entryinfo[PM_DELAY_PUBMASTER], 00832 ident, zahler, empfaenger, entryinfo); 00833 00834 return 1; 00835 }
| protected void create | ( | ) |
Definiert in Zeile 43 der Datei pub.c.
Benutzt AddCmd(), call_out(), dr, fo, id_list, max_list, ME, menu_list, P_PUB_NO_MONEY, P_PUB_NOT_ON_MENU, P_PUB_UNAVAILABLE, P_ROOM_TYPE, QueryProp(), refresh_count, refresh_list, ROUTER, RT_PUB, SetProp(), TARGET_PUB und waiting.
00044 { object router; 00045 00046 SetProp( P_ROOM_TYPE, QueryProp(P_ROOM_TYPE) | RT_PUB ); 00047 00048 SetProp( P_PUB_NOT_ON_MENU, 00049 "Tut mir leid, das fuehren wir nicht! Wir sind ein anstaendiges "+ 00050 "Lokal!\n" ); 00051 SetProp( P_PUB_UNAVAILABLE, 00052 "Davon ist leider nichts mehr da.\n" ); 00053 SetProp(P_PUB_NO_MONEY, 00054 "Das kostet %d Goldstuecke, und Du hast nicht so viel!\n" ); 00055 00056 AddCmd( "menue","menue" ); 00057 AddCmd( ({"kauf","kaufe","bestell","bestelle"}),"bestelle" ); 00058 AddCmd( ({"spendier","spendiere"}),"spendiere" ); 00059 AddCmd( "pubinit","pubinit" ); 00060 00061 max_list=0; 00062 refresh_count=0; 00063 fo=({ }); 00064 dr=({ }); 00065 waiting = ({ }); 00066 id_list=([]); 00067 menu_list=([]); 00068 refresh_list=([]); 00069 00070 if ( !clonep(ME) && objectp(router=find_object(ROUTER)) ) 00071 router->RegisterTarget(TARGET_PUB,object_name(ME)); 00072 00073 call_out("add_std_drinks",1); 00074 }

| protected void create_super | ( | ) |
Definiert in Zeile 76 der Datei pub.c.
Benutzt set_next_reset().
00076 { 00077 set_next_reset(-1); 00078 }

| mixed DBG | ( | mixed | o | ) |
Definiert in Zeile 376 der Datei pub.c.
Benutzt find_player().
00376 { 00377 if(find_player("rumata")) 00378 tell_object( 00379 find_player("rumata"), 00380 sprintf("DBG: %O\n", o) 00381 ); 00382 return 0; 00383 }

| void DecreaseAvailability | ( | string | ident, | |
| string | uid | |||
| ) |
Definiert in Zeile 327 der Datei pub.c.
Benutzt PRV_AMOUNT und refresh_list.
00328 { 00329 if ( !stringp(ident) || !stringp(uid) ) 00330 return; 00331 refresh_list[ident][uid,PRV_AMOUNT]++; 00332 }
| int do_deliver | ( | string | ident, | |
| object | zahler, | |||
| object | empfaenger, | |||
| mapping | entryinfo | |||
| ) |
Definiert in Zeile 561 der Datei pub.c.
Benutzt _copy_menulist_values(), call_out(), menu_list, PM_RATE_PUBMASTER und waiting.
00562 { 00563 waiting -= ({ empfaenger,0 }); 00564 00565 /* Empfaenger muss natuerlich noch da sein */ 00566 if ( !objectp(empfaenger) || !present(empfaenger) ) 00567 return 0; 00568 00569 /* Zahler wird nur wegen der Abwaertskompatibilitaet gebraucht */ 00570 if ( !objectp(zahler) ) 00571 zahler = empfaenger; 00572 00573 // alte Pubs, die do_deliver irgendwie selbst aufrufen, sollten 00574 // mit der Zeit korrigiert werden 00575 if(!mappingp(entryinfo)) 00576 raise_error("Pub ruft do_deliver() ohne sinnvolle Argumente auf.\n"); 00577 if(!member(entryinfo, PM_RATE_PUBMASTER)) { 00578 if(!member(menu_list, ident)) 00579 raise_error("Pub ruft do_deliver() mit geloeschtem Getraenk und " 00580 "teilweisen Argumenten auf!\n"); 00581 00582 _copy_menulist_values(entryinfo, ident); 00583 call_out(#'raise_error, 1, 00584 "Pub ruft do_deliver() nur mit teilweisen Argumenten auf.\n"); 00585 } 00586 00587 entryinfo[PM_RATE_PUBMASTER] = eval_anything(entryinfo[PM_RATE_PUBMASTER], 00588 empfaenger); 00589 entryinfo[P_HP] = eval_anything(entryinfo[P_HP], empfaenger); 00590 entryinfo[P_SP] = eval_anything(entryinfo[P_SP], empfaenger); 00591 00592 /* Ueberpruefen, ob Heilmoeglichkeit legal */ 00593 if ( query_once_interactive(empfaenger) 00594 && ((PUBMASTER->RegisterItem(entryinfo[PM_TEXT], entryinfo))<1) ) { 00595 tell_object(empfaenger, 00596 "Mit diesem Getraenk/Gericht scheint etwas nicht in Ordnung "+ 00597 "zu sein.\nVerstaendige bitte den Magier, der fuer diesen "+ 00598 "Raum verantwortlich ist.\n"); 00599 return -4; 00600 } 00601 00602 #ifdef LEGACY 00603 if ( QueryProp(P_NPC_FASTHEAL) && !query_once_interactive(empfaenger) ) 00604 { 00605 /* Direkte Heilung fuer NPCs, wenn P_NPC_FASTHEAL gesetzt */ 00606 empfaenger->reduce_hit_points(-entryinfo[P_HP]); 00607 empfaenger->restore_spell_points(entryinfo[P_SP]); 00608 } 00609 else 00610 { 00611 /* Heilung in Buffer eintragen */ 00612 empfaenger->buffer_hp(entryinfo[P_HP], entryinfo[PM_RATE_PUBMASTER]); 00613 empfaenger->buffer_sp(entryinfo[P_SP], entryinfo[PM_RATE_PUBMASTER]); 00614 } 00615 #else 00616 if ( QueryProp(P_NPC_FASTHEAL) && !query_once_interactive(empfaenger) ) { 00617 entryinfo[H_DISTRIBUTION] = HD_INSTANT; 00618 } 00619 else { 00620 entryinfo[H_DISTRIBUTION] = entryinfo[PM_RATE_PUBMASTER]; 00621 } 00622 empfaenger->consume(entryinfo); 00623 #endif 00624 00625 /* Meldung ausgeben */ 00626 /* Hinweis: Da die ausfuehrenden Funktionen auch ident und minfo 00627 * uebergeben bekommen, kann man hier auch ueber adjust_info oder 00628 * an anderer Stelle zusaetzliche Informationen uebergeben... 00629 */ 00630 if (closurep(entryinfo[PM_SERVE_MSG]) ) 00631 funcall(entryinfo[PM_SERVE_MSG], zahler, empfaenger, ident, entryinfo); 00632 else if (stringp(entryinfo[PM_SERVE_MSG]) && 00633 function_exists(entryinfo[PM_SERVE_MSG],ME)) 00634 call_other(ME, entryinfo[PM_SERVE_MSG], zahler, empfaenger, ident, 00635 entryinfo); 00636 else if (pointerp(entryinfo[PM_SERVE_MSG]) && 00637 sizeof(entryinfo[PM_SERVE_MSG])>=2) { 00638 if (stringp(entryinfo[PM_SERVE_MSG][0]) && 00639 strlen(entryinfo[PM_SERVE_MSG][0])) 00640 tell_object(empfaenger, 00641 mess(entryinfo[PM_SERVE_MSG][0]+"\n", empfaenger)); 00642 if (stringp(entryinfo[PM_SERVE_MSG][1]) && 00643 strlen(entryinfo[PM_SERVE_MSG][1])) 00644 tell_room(environment(empfaenger)||ME, 00645 mess(entryinfo[PM_SERVE_MSG][1]+"\n",empfaenger), 00646 ({empfaenger}) ); 00647 } 00648 00649 return 1; 00650 }

| int eval_anything | ( | mixed | what, | |
| object | pl | |||
| ) |
Definiert in Zeile 243 der Datei pub.c.
Wird benutzt von CheckAvailability() und menue_text().
00244 { mixed re; 00245 00246 if (intp(what)) 00247 return what; 00248 00249 if (mappingp(what) && pl) 00250 { 00251 re = what[pl->QueryProp(P_RACE)]||what[0]; 00252 } 00253 00254 if (re) 00255 what=re; 00256 00257 if ( pointerp(what) && (sizeof(what)>=2) 00258 && ( objectp(what[0]) || stringp(what[0]) ) 00259 && stringp(what[1]) ) 00260 what = call_other(what[0],what[1],pl); 00261 00262 if ( stringp(what) && function_exists(what,ME) ) 00263 what = call_other(ME,what,pl); 00264 00265 if ( closurep(what) ) 00266 what = funcall(what,pl); 00267 00268 if ( intp(what) ) 00269 return what; 00270 00271 return 0; 00272 }

| int menue | ( | string | str | ) |
Definiert in Zeile 494 der Datei pub.c.
Benutzt _notify_fail() und menue_text().
00495 { string txt; 00496 00497 _notify_fail("Welchen Teil des Menues moechtest Du sehen?\n"); 00498 if ( !stringp(txt=menue_text(str)) || strlen(txt)<1 ) 00499 return 0; 00500 write(txt); 00501 return 1; 00502 }

| string menue_text | ( | string | str | ) |
Definiert in Zeile 386 der Datei pub.c.
Benutzt dr, eval_anything(), fo, i, max_list, menu_list, P_ALCOHOL, P_FOOD, P_VALUE, PL, PM_INFO und PM_TEXT.
Wird benutzt von menue().
00387 { int i,sdr,sfo; 00388 string ident,res; 00389 00390 if ( !max_list ) 00391 return "Hier scheint es derzeit nichts zu geben.\n"; 00392 00393 if ( !stringp(str) || str=="" ) 00394 str="alles"; 00395 00396 sdr = sizeof(dr); 00397 sfo = sizeof(fo); 00398 00399 if ( member(({"alle","alles"}),str)!=-1) 00400 { 00401 if ( !sfo ) 00402 str="drinks"; 00403 else if ( !sdr ) 00404 str="speise"; 00405 else 00406 { 00407 /* Gemischte Karte */ 00408 res = "Getraenke Preis alc | "+ 00409 "Speisen Preis\n"+ 00410 "---------------------------------------+-"+ 00411 "--------------------------------------\n"; 00412 00413 for ( i=0 ; ( i<sdr || i<sfo ) ; i++ ) 00414 { 00415 if ( i<sdr ) 00416 res += sprintf("%-29.29s%5.5d %c | ", 00417 menu_list[dr[i],PM_TEXT], 00418 eval_anything(menu_list[dr[i],PM_INFO][P_VALUE],PL), 00419 (eval_anything(menu_list[dr[i],PM_INFO][P_ALCOHOL],PL)>0) ? 'J' : 'N'); 00420 else 00421 res += " | "; 00422 00423 if ( i<sfo ) 00424 res += sprintf("%-33.33s%5.5d", 00425 menu_list[fo[i],PM_TEXT], 00426 eval_anything(menu_list[fo[i],PM_INFO][P_VALUE],PL)); 00427 00428 res += "\n"; 00429 } 00430 00431 return res; 00432 } 00433 } 00434 00435 /* Reine Getraenkekarte */ 00436 if ( member(({"getraenke","drinks","getraenk","trinken"}),str)!=-1 ) 00437 { 00438 if ( !sdr ) 00439 return "Hier gibt es leider nichts zu trinken.\n"; 00440 00441 res = "Getraenke Preis alc | "+ 00442 "Getraenke Preis alc\n"+ 00443 "---------------------------------------+-"+ 00444 "--------------------------------------\n"; 00445 00446 for ( i=0 ; i<sdr ; i++ ) 00447 { 00448 ident = dr[i]; 00449 00450 if ( !menu_list[ident,PM_INFO][P_FOOD] ) 00451 res += sprintf("%-29.29s%5.5d %c%s", 00452 menu_list[ident,PM_TEXT], 00453 eval_anything(menu_list[ident,PM_INFO][P_VALUE],PL), 00454 (eval_anything(menu_list[ident,PM_INFO][P_ALCOHOL],PL)>0) ? 'J' : 'N', 00455 ((i%2)?"\n":" | ")); 00456 } 00457 00458 if ( res[<1..<1]!="\n" ) 00459 res += "\n"; 00460 00461 return res; 00462 } 00463 00464 /* Reine Speisekarte */ 00465 if ( member(({"speise","speisen","essen"}),str)!=-1 ) 00466 { 00467 if ( !sfo ) 00468 return "Hier gibt es leider nichts zu essen.\n"; 00469 00470 res = "Speisen Preis | "+ 00471 "Speisen Preis\n"+ 00472 "---------------------------------------+-"+ 00473 "--------------------------------------\n"; 00474 00475 for ( i=0 ; i<sfo ; i++ ) 00476 { 00477 ident = fo[i]; 00478 if (menu_list[ident,PM_INFO][P_FOOD] ) 00479 res += sprintf("%-33.33s%5.5d%s", 00480 menu_list[ident,PM_TEXT], 00481 eval_anything(menu_list[ident,PM_INFO][P_VALUE],PL), 00482 ((i%2)?"\n":" | ")); 00483 } 00484 00485 if ( res[<1..<1]!="\n" ) 00486 res += "\n"; 00487 00488 return res; 00489 } 00490 00491 return 0; 00492 }


| string mess | ( | string | str, | |
| object | pl | |||
| ) |
Definiert in Zeile 515 der Datei pub.c.
Benutzt break_string(), BS_LEAVE_MY_LFS, PL, WEM, WEN, WER und WESSEN.
00516 { 00517 string dummy1, dummy2; 00518 00519 if ( !pl ) 00520 pl=PL; 00521 00522 if ( !stringp(str) || str=="" ) 00523 return str; 00524 00525 str=implode(explode(str,"&&"),pl->name(WER,2)); 00526 str=implode(explode(str,"&1&"),pl->name(WER,2)); 00527 str=implode(explode(str,"&2&"),pl->name(WESSEN,2)); 00528 str=implode(explode(str,"&3&"),pl->name(WEM,2)); 00529 str=implode(explode(str,"&4&"),pl->name(WEN,2)); 00530 str=implode(explode(str,"&1#"),capitalize(pl->name(WER,2))); 00531 str=implode(explode(str,"&2#"),capitalize(pl->name(WESSEN,2))); 00532 str=implode(explode(str,"&3#"),capitalize(pl->name(WEM,2))); 00533 str=implode(explode(str,"&4#"),capitalize(pl->name(WEN,2))); 00534 str=implode(explode(str,"&!"),pl->QueryPronoun(WER)); 00535 str=implode(explode(str,"&5&"),pl->QueryPronoun(WER)); 00536 str=implode(explode(str,"&6&"),pl->QueryPronoun(WESSEN)); 00537 str=implode(explode(str,"&7&"),pl->QueryPronoun(WEM)); 00538 str=implode(explode(str,"&8&"),pl->QueryPronoun(WEN)); 00539 str=implode(explode(str,"&5#"),capitalize(pl->QueryPronoun(WER))); 00540 str=implode(explode(str,"&6#"),capitalize(pl->QueryPronoun(WESSEN))); 00541 str=implode(explode(str,"&7#"),capitalize(pl->QueryPronoun(WEM))); 00542 str=implode(explode(str,"&8#"),capitalize(pl->QueryPronoun(WEN))); 00543 00544 return break_string(capitalize(str),78,"", BS_LEAVE_MY_LFS); 00545 }

| int pubinit | ( | ) |
Definiert in Zeile 927 der Datei pub.c.
00928 { string *liste,ident,fn; 00929 int si,erg,max; 00930 mapping minfo,xinfo; 00931 00932 if ( !PL || !IS_WIZARD(PL) ) 00933 return 0; 00934 00935 si=sizeof(liste=sort_array(m_indices(menu_list),#'<)); 00936 if ( si<1 ) 00937 return notify_fail("Keine Gerichte/Getraenke vorhanden.\n"),0; 00938 00939 fn=old_explode(object_name(ME),"#")[0]; 00940 printf("\n%'_'|30s %3s %3s %3s %5s %2s %2s %3s %3s %4s %3s\n", 00941 "ITEM","ALC","DRI","FOO","VALUE","RT","DL","_HP","_SP","TEST","MAX"); 00942 for ( --si ; si>=0 ; si-- ) 00943 { 00944 ident=liste[si]; 00945 minfo=deep_copy(menu_list[ident,PM_INFO]); 00946 00947 if ( (xinfo=adjust_info(ident,minfo,PL,PL)) && mappingp(xinfo) ) 00948 minfo+=xinfo; 00949 00950 minfo[P_VALUE] = eval_anything(minfo[P_VALUE], PL); 00951 minfo[P_FOOD] = eval_anything(minfo[P_FOOD], PL); 00952 minfo[P_ALCOHOL] = eval_anything(minfo[P_ALCOHOL], PL); 00953 minfo[P_DRINK] = eval_anything(minfo[P_DRINK], PL); 00954 minfo[PM_DELAY_PUBMASTER] 00955 = eval_anything(menu_list[ident,PM_DELAY], PL); 00956 minfo[PM_RATE_PUBMASTER] 00957 = eval_anything(menu_list[ident,PM_RATE], PL); 00958 minfo[P_HP] = eval_anything(minfo[P_HP], PL); 00959 minfo[P_SP] = eval_anything(minfo[P_SP], PL); 00960 erg=PUBMASTER->RegisterItem(menu_list[ident,0],minfo); 00961 max=PUBMASTER->CalcMax(minfo,fn); 00962 00963 printf("%-'..'30.30s %3d %3d %3d %5d %2d %2d %3d %3d %|4s %3d\n", 00964 menu_list[ident,PM_TEXT], 00965 minfo[P_ALCOHOL], minfo[P_DRINK], minfo[P_FOOD], 00966 minfo[P_VALUE], 00967 minfo[PM_RATE_PUBMASTER], 00968 minfo[PM_DELAY_PUBMASTER], 00969 minfo[P_HP], minfo[P_SP], 00970 ( erg ? "OK" : "FAIL" ),max); 00971 } 00972 write("Done.\n"); 00973 return 1; 00974 }
| mixed query_drinks | ( | ) |
| mixed query_food | ( | ) |
| mapping query_menulist | ( | ) |
| int RemoveFromMenu | ( | mixed | ids | ) |
Definiert in Zeile 186 der Datei pub.c.
Benutzt dr, fo, id(), id_list, m_delete(), max_list und menu_list.
00186 { 00187 int ret; 00188 00189 if (stringp(ids)) 00190 ids = ({ids}); 00191 00192 if (pointerp(ids)) { 00193 foreach (string id: ids) { 00194 // look if the id has a matching ident 00195 string ident = id_list[id]; 00196 if (stringp(ident)) { 00197 // just remove the ident, it is not important where it is defined 00198 fo -= ({ident}); 00199 dr -= ({ident}); 00200 00201 // remove this ident-entry from the id-list ... 00202 efun::m_delete(id_list, id); 00203 // ... and remove all others now too (so it won't bug later, if 00204 // the wizard calling this method forgot an id) 00205 foreach (string listid: m_indices(id_list)) 00206 if (id_list[listid] == ident) 00207 efun::m_delete(id_list, listid); 00208 00209 // now remove the ident from the menu_list 00210 if (member(menu_list, ident)) { 00211 ret++; 00212 efun::m_delete(menu_list, ident); 00213 00214 // decrease the ident-counter, if this entry was the last one 00215 int oldnum; 00216 if (sscanf(ident, "menuentry%d", oldnum) == 1 && 00217 oldnum == (max_list-1)) 00218 max_list--; 00219 } 00220 } 00221 } 00222 } 00223 // return removed entries 00224 return ret; 00225 }

| void reset | ( | void | ) |
Definiert in Zeile 976 der Datei pub.c.
Benutzt refresh_count, sum, UpdateAvailability() und ZENTRALBANK.
00977 { 00978 if ( sum>0 ) 00979 ZENTRALBANK->PayIn(sum); 00980 sum=0; 00981 refresh_count++; 00982 UpdateAvailability(); 00983 }

| int search_what | ( | string | str, | |
| object | zahler, | |||
| object | empfaenger | |||
| ) |
Definiert in Zeile 838 der Datei pub.c.
00839 { string ident; 00840 00841 if ( member(waiting,empfaenger)!=-1 ) 00842 { 00843 if ( PL==empfaenger ) 00844 write("Du wartest doch noch auf etwas!\n"); 00845 else 00846 write(empfaenger->Name(WER,2)+" wartet noch auf etwas.\n"); 00847 return 1; 00848 } 00849 00850 str = lower_case(str); 00851 if ( ident=id_list[str] ) 00852 { 00853 consume_something(ident,zahler,empfaenger); 00854 return 1; 00855 } 00856 00857 return 0; 00858 }
| int spendiere | ( | string | str | ) |
Definiert in Zeile 891 der Datei pub.c.
00892 { 00893 _notify_fail("spendiere <spieler> <drink>\n"); 00894 00895 if ( !stringp(str) || str=="" ) 00896 return 0; 00897 00898 string who,what; 00899 int whoidx; 00900 00901 if (sscanf(str,"%s %d %s",who,whoidx,what)!=3 00902 && sscanf(str,"%s %s",who,what)!=2) 00903 return 0; 00904 object target; 00905 if ( ( !(target=present(who,whoidx,ME)) 00906 && !(target=present(who,whoidx,PL)) ) || !living(target)) 00907 { 00908 write("Das Lebewesen ist nicht hier...\n"); 00909 return 1; 00910 } 00911 00912 notify_fail((string)QueryProp(P_PUB_NOT_ON_MENU)||"So etwas gibt es hier nicht!\n"); 00913 00914 return search_what(what,PL,target); 00915 }
| static void UpdateAvailability | ( | ) | [static] |
Definiert in Zeile 337 der Datei pub.c.
Benutzt menu_list, PM_REFRESH, PR_ALL, PR_DEFAULT, PR_USER, PRV_AMOUNT, PRV_REFRESH, refresh_count und refresh_list.
Wird benutzt von reset().
00338 { int i1,i2; 00339 string *ind1,*ind2,chk; 00340 00341 /* Keine Refresh-Eintraege, kein Update */ 00342 if ( !mappingp(refresh_list) 00343 || (i1=sizeof(ind1=m_indices(refresh_list)))<1 ) 00344 return; 00345 00346 /* Es muss jeder Menueeintrag, der in der refresh_list steht, 00347 * durchgegangen werden. 00348 */ 00349 for ( --i1 ; i1>=0 ; i1-- ) 00350 { 00351 if ( !mappingp(refresh_list[ind1[i1]]) 00352 || (i2=sizeof(ind2=m_indices(refresh_list[ind1[i1]])))<1 ) 00353 continue; 00354 00355 /* Fuer jeden Menueeintrag muss jeder Spielereintrag durchgegangen 00356 * werden, der in dem entspr. mapping steht. 00357 */ 00358 for ( --i2 ; i2>=0 ; i2-- ) // Alle Spieler 00359 { 00360 if ( ind2[i2]==PR_DEFAULT ) 00361 chk = PR_ALL; 00362 else 00363 chk = PR_USER; 00364 00365 if ( ( refresh_list[ind1[i1]][ind2[i2],PRV_REFRESH] 00366 + menu_list[ind1[i1],PM_REFRESH][chk,PRV_REFRESH] ) 00367 <= refresh_count ) 00368 { 00369 refresh_list[ind1[i1]][ind2[i2],PRV_AMOUNT]=0; 00370 refresh_list[ind1[i1]][ind2[i2],PRV_REFRESH]=refresh_count; 00371 } 00372 } 00373 } 00374 }

| nosave string* dr |
Definiert in Zeile 38 der Datei pub.c.
Wird benutzt von AddToMenu(), create(), menue_text(), query_drinks() und RemoveFromMenu().
| nosave string * fo |
Definiert in Zeile 38 der Datei pub.c.
Wird benutzt von AddToMenu(), create(), menue_text(), query_food() und RemoveFromMenu().
| nosave mapping id_list |
Definiert in Zeile 35 der Datei pub.c.
Wird benutzt von AddToMenu(), create() und RemoveFromMenu().
| private nosave int max_list |
Definiert in Zeile 31 der Datei pub.c.
Wird benutzt von AddToMenu(), create(), menue_text() und RemoveFromMenu().
| nosave mapping menu_list |
Definiert in Zeile 36 der Datei pub.c.
Wird benutzt von _copy_menulist_values(), AddToMenu(), CheckAvailability(), create(), do_deliver(), menue_text(), query_menulist(), RemoveFromMenu() und UpdateAvailability().
| private nosave int refresh_count |
Definiert in Zeile 32 der Datei pub.c.
Wird benutzt von CheckAvailability(), create(), reset() und UpdateAvailability().
| private nosave mapping refresh_list |
Definiert in Zeile 34 der Datei pub.c.
Wird benutzt von CheckAvailability(), create(), DecreaseAvailability() und UpdateAvailability().
| nosave object* waiting |
Definiert in Zeile 37 der Datei pub.c.
Wird benutzt von create() und do_deliver().
1.6.3