#include "/sys/thing/properties.h"#include "/sys/player/potion.h"#include <attributes.h>#include <defines.h>#include <wizlevels.h>#include <player/base.h>#include <living/life.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | NEED_PROTOTYPES |
| #define | POTIONMASTER "secure/potionmaster" |
Funktionen | |
| static mixed | _query_potionrooms () |
| static mixed | _query_known_potionrooms () |
| void | create () |
| static int | ReportPotion (string s, object po) |
| static int | SelectWhich (object po) |
| static int | ask_question (object po) |
| static int | get_answer (string erg, object po) |
| static int | raise (string what, object po) |
| int | AddKnownPotion (int nr) |
| int | RemoveKnownPotion (int nr) |
| varargs int | FindPotion (string s) |
Variablen | |
| static mixed * | list |
| mixed * | potionrooms |
| mixed * | known_potionrooms |
| static mixed _query_known_potionrooms | ( | ) | [static] |
Definiert in Zeile 222 der Datei potion.c.
Benutzt known_potionrooms, P_KNOWN_POTIONROOMS und Set().
00223 { 00224 return Set(P_KNOWN_POTIONROOMS, known_potionrooms); 00225 }

| static mixed _query_potionrooms | ( | ) | [static] |
Definiert in Zeile 217 der Datei potion.c.
Benutzt P_POTIONROOMS, potionrooms und Set().
00218 { 00219 return Set(P_POTIONROOMS, potionrooms); 00220 }

| int AddKnownPotion | ( | int | nr | ) |
Definiert in Zeile 227 der Datei potion.c.
Benutzt known_potionrooms und member_array().
00228 { 00229 if (!previous_object() || 00230 object_name(previous_object()) != "/room/orakel") 00231 return -1; // Keine Berechtigung 00232 00233 if (member_array(nr, known_potionrooms) != -1) 00234 return -2; // Nummer bereits eingetragen 00235 else 00236 { 00237 known_potionrooms += ({ nr }); 00238 return 1; 00239 } 00240 }

| static int ask_question | ( | object | po | ) | [static] |
Definiert in Zeile 141 der Datei potion.c.
Benutzt A_CON, A_DEX, A_INT, A_STR, i, input_to(), list, ME, QueryAttributeOffset() und QueryRealAttribute().
Wird benutzt von get_answer() und SelectWhich().
00142 { 00143 int i; 00144 00145 tell_object(ME, "Deine Attribute sehen so aus:\n\n" 00146 +sprintf("Intelligenz : %2d (%+d)\n", 00147 QueryRealAttribute(A_INT),QueryAttributeOffset(A_INT)) 00148 +sprintf("Kraft : %2d (%+d)\n", 00149 QueryRealAttribute(A_STR),QueryAttributeOffset(A_STR)) 00150 +sprintf("Geschicklichkeit: %2d (%+d)\n", 00151 QueryRealAttribute(A_DEX),QueryAttributeOffset(A_DEX)) 00152 +sprintf("Ausdauer : %2d (%+d)\n", 00153 QueryRealAttribute(A_CON),QueryAttributeOffset(A_CON)) 00154 ); 00155 00156 tell_object(ME, 00157 "\nWas moechtest Du erhoehen ? Du hast folgende Moeglichkeiten:\n"); 00158 for (i=0;i<sizeof(list);i++) 00159 tell_object(ME, sprintf("%d) %s\n", i+1,list[i])); 00160 00161 tell_object(ME, sprintf("\nBitte gib jetzt eine Zahl (1-%d) an: ", i)); 00162 input_to("get_answer", 0, po); 00163 00164 return 1; 00165 }


| void create | ( | ) |
Definiert in Zeile 32 der Datei potion.c.
Benutzt F_MODE_AS, F_SET_METHOD, known_potionrooms, NOSETMETHOD, P_BONUS_POTIONS, P_KNOWN_POTIONROOMS, P_POTIONROOMS, P_VISITED_POTIONROOMS, POTIONMASTER, potionrooms, PROTECTED, Query(), SAVE, SECURED und Set().
00033 { 00034 if (!potionrooms) potionrooms=POTIONMASTER->InitialList(); 00035 Set(P_POTIONROOMS, NOSETMETHOD, F_SET_METHOD); // no tampering by methods 00036 Set(P_POTIONROOMS, SECURED, F_MODE_AS); // no tampering with list 00037 00038 if (!known_potionrooms) known_potionrooms = ({}); 00039 Set(P_KNOWN_POTIONROOMS, NOSETMETHOD, F_SET_METHOD); 00040 Set(P_KNOWN_POTIONROOMS, SECURED, F_MODE_AS); 00041 00042 if (!stringp(Query(P_VISITED_POTIONROOMS))) 00043 Set(P_VISITED_POTIONROOMS, " "); 00044 Set(P_VISITED_POTIONROOMS, SAVE|PROTECTED, F_MODE_AS); 00045 Set(P_BONUS_POTIONS, SAVE|PROTECTED, F_MODE_AS); 00046 }

| varargs int FindPotion | ( | string | s | ) |
Definiert in Zeile 56 der Datei potion.c.
Benutzt dtime(), env(), flag, IS_WIZARD, known_potionrooms, log_file, ME, old_explode(), P_GHOST, P_KILLS, P_TRANK_FINDEN, POTIONMASTER, potionrooms, QueryProp() und ReportPotion().
00057 { 00058 int flag, pnum; 00059 string str, fn; 00060 mixed rl; 00061 object env,po; 00062 00063 po=previous_object(); 00064 00065 flag=1; 00066 if (QueryProp(P_TRANK_FINDEN) && IS_WIZARD(this_object())) 00067 return ReportPotion(s,po); 00068 if (QueryProp(P_KILLS)) return 0; 00069 00070 if (!potionrooms || potionrooms==({}) || 00071 !(POTIONMASTER->InList(previous_object(), potionrooms, 00072 known_potionrooms))) 00073 flag=0; 00074 if ((pnum=POTIONMASTER->HasPotion(previous_object()))<0) 00075 return 0; 00076 00077 if (!flag) return 0; 00078 if (query_input_pending(this_object()) || query_editing(this_object())) { 00079 tell_object(ME, 00080 "Jetzt haettest Du fast einen Zaubertrank gefunden. Du solltest den\n" 00081 "Editor/das More verlassen und es dann noch einmal versuchen!\n"); 00082 return 1; 00083 } 00084 00085 // Hier der Ausbau der ZTs fuer Geister, wobei das natuerlich in der 00086 // Geisterschlossquest immer noch gehen sollte. 00087 00088 env=environment(this_object()); 00089 fn=old_explode(object_name(env), "#")[0]; 00090 if(QueryProp(P_GHOST) && 00091 !(fn[0..24]=="/d/wald/bertram/gschloss/")) { 00092 tell_object(ME,"Als Geist einen Zaubertrank? Hier nicht!\n"); 00093 return 1; 00094 } 00095 log_file("ARCH/POTIONS", dtime(time()) + " " +capitalize(getuid()) + " in " + 00096 object_name(previous_object()) + "\n"); 00097 00098 return ReportPotion(s,po); 00099 }

| static int get_answer | ( | string | erg, | |
| object | po | |||
| ) | [static] |
Definiert in Zeile 167 der Datei potion.c.
Benutzt ask_question(), list und ME.
00168 { 00169 int num; 00170 00171 if (erg && stringp(erg)) 00172 { 00173 if (sscanf(erg,"%d",num)<1) num=0; 00174 if (num>0 && num<=sizeof(list)) 00175 return raise(list[num-1], po); 00176 } 00177 tell_object(ME, "Deine Wahl war ungueltig. Bitte versuchs nochmal !\n\n"); 00178 return ask_question(po); 00179 }

| static int raise | ( | string | what, | |
| object | po | |||
| ) | [static] |
Definiert in Zeile 181 der Datei potion.c.
Benutzt A_CON, A_DEX, A_INT, A_STR, known_potionrooms, log_file, ME, POTIONMASTER, potionrooms, QueryRealAttribute(), save_me() und SetRealAttribute().
00181 { 00182 string attr; 00183 int yet; 00184 00185 switch (what) { 00186 case "Geschicklichkeit": 00187 attr=A_DEX; break; 00188 case "Intelligenz": 00189 attr=A_INT; break; 00190 case "Kraft": 00191 attr=A_STR; break; 00192 case "Ausdauer": 00193 attr=A_CON; break; 00194 default: return 0; 00195 } 00196 00197 yet=QueryRealAttribute(attr); 00198 SetRealAttribute(attr,yet+1); 00199 tell_object(ME, 00200 sprintf("Deine %s hat sich von %d auf %d erhoeht.\n", what, yet, yet+1)); 00201 log_file("ARCH/POTIONS", 00202 sprintf(" %s: %s %d->%d (noch %d)\n", 00203 capitalize(getuid()),capitalize(attr), 00204 yet,yet+1,sizeof(potionrooms))); 00205 00206 // RemoveList ersetzt den gefundenen Trank durch -1, das wird dann entfernt. 00207 // Dies ist ein Hack um einen Reboot zu vermeiden. 00208 00209 POTIONMASTER->RemoveList(po, potionrooms, known_potionrooms); 00210 potionrooms -= ({ -1 }); 00211 known_potionrooms -= ({ -1 }); 00212 save_me(1); 00213 00214 return 1; 00215 }

| int RemoveKnownPotion | ( | int | nr | ) |
Definiert in Zeile 242 der Datei potion.c.
Benutzt known_potionrooms und member_array().
00243 { 00244 if (!previous_object() || 00245 object_name(previous_object()) != "/room/orakel") 00246 return -1; // Keine Berechtigung 00247 00248 if (member_array(nr, known_potionrooms) == -1) 00249 return -2; // Nummer nicht eingetragen 00250 else 00251 { 00252 known_potionrooms -= ({ nr }); 00253 return 1; 00254 } 00255 }

| static int ReportPotion | ( | string | s, | |
| object | po | |||
| ) | [static] |
Definiert in Zeile 101 der Datei potion.c.
Benutzt ME und SelectWhich().
Wird benutzt von FindPotion().
00102 { 00103 if (stringp(s) && strlen(s)) 00104 tell_object(ME, s); 00105 else 00106 tell_object(ME, "Du findest einen Zaubertrank, den Du sofort trinkst.\n"); 00107 00108 SelectWhich(po); 00109 00110 return 1; 00111 }


| static int SelectWhich | ( | object | po | ) | [static] |
Definiert in Zeile 113 der Datei potion.c.
Benutzt A_CON, A_DEX, A_INT, A_STR, ask_question(), heal_self(), known_potionrooms, list, log_file, ME, POTIONMASTER, potionrooms, QueryRealAttribute() und save_me().
Wird benutzt von ReportPotion().
00114 { 00115 list=({"Intelligenz","Kraft","Geschicklichkeit","Ausdauer"}); 00116 if (QueryRealAttribute(A_INT)>=20) list-=({"Intelligenz"}); 00117 if (QueryRealAttribute(A_STR)>=20) list-=({"Kraft"}); 00118 if (QueryRealAttribute(A_DEX)>=20) list-=({"Geschicklichkeit"}); 00119 if (QueryRealAttribute(A_CON)>=20) list-=({"Ausdauer"}); 00120 if (!sizeof(list)) { 00121 heal_self(10000000); 00122 tell_object(ME, "Der Trank hat Dich geheilt.\n"); 00123 log_file("ARCH/POTIONS", 00124 sprintf(" %s: Heiltrank (noch %d)\n", 00125 capitalize(getuid()),sizeof(potionrooms))); 00126 00127 // RemoveList ersetzt den gefundenen Trank durch -1, das wird dann entfernt. 00128 // Dies ist ein Hack um einen Reboot zu vermeiden. 00129 00130 POTIONMASTER->RemoveList(po, potionrooms, known_potionrooms); 00131 potionrooms -= ({ -1 }); 00132 known_potionrooms -= ({ -1 }); 00133 save_me(1); 00134 return 1; 00135 } 00136 if (sizeof(list)==1) return raise(list[0],po); 00137 ask_question(po); 00138 return 1; 00139 }


| mixed* known_potionrooms |
Definiert in Zeile 27 der Datei potion.c.
Wird benutzt von _query_known_potionrooms(), AddKnownPotion(), create(), FindPotion(), raise(), RemoveKnownPotion() und SelectWhich().
mixed* list [static] |
Definiert in Zeile 24 der Datei potion.c.
Wird benutzt von _create_list(), _showprops(), ArticleList(), ask_question(), ChannelParser(), dumplists(), expandSystemRecursive(), file_list(), FindInStore(), get_answer(), GroupList(), InitialList(), ListAwaited(), make(), maybe_replace_program(), mbanish(), notify_player_change(), Request(), RestartBeats(), scan_obj(), SelectWhich(), Show_WaitFor_Reason(), SimpleInv(), stat(), udp_channel() und Xdupdate().
| mixed* potionrooms |
Definiert in Zeile 26 der Datei potion.c.
Wird benutzt von _query_potionrooms(), create(), FindPotion(), raise() und SelectWhich().
1.6.3