#include <properties.h>#include <exploration.h>#include <wizlevels.h>
gehe zum Quellcode dieser Datei
Funktionen | |
| create () | |
| static string | strArr (string *s) |
| static int | getType (string s) |
| static object | getOb (string str) |
| static string * | getKeys (string str) |
| static string | errMsg (int code) |
| static int | add (string str) |
| static int | change (string str) |
| static int | del (string str) |
| static int | info (string str) |
| static object | find_playerob (string name) |
| static int | epcount (string str) |
| static int | epscan (string str) |
| static | eppldel (string str) |
| static | eppladd (string str) |
| static | epplset (string str) |
| static | epplclr (string str) |
Variablen | |
| inherit std | secure_thing |
| static int add | ( | string | str | ) | [static] |
Definiert in Zeile 142 der Datei explorer.c.
Benutzt _unparsed_args(), ARCH_SECURITY, bonus, EPMASTER, errMsg(), getKeys(), getOb(), getType(), keys, notify_fail() und ob().
00143 { 00144 string was, t, k, *keys, b; 00145 int type, bonus; 00146 object ob; 00147 00148 if( !ARCH_SECURITY ) { 00149 notify_fail("Du bist kein Erzmagier!\n"); 00150 return 0; 00151 } 00152 notify_fail("Syntax: epadd <was>: <typ>\n"); 00153 if (!(str = this_player()->_unparsed_args())) 00154 return 0; 00155 00156 if (sscanf(str, "%s: %s %s %s", was, b, t, k) !=4) 00157 return 0; 00158 00159 if (!(ob = getOb(was))) { 00160 printf("Kann '%s' nicht finden!\n", was); 00161 return 1; 00162 } 00163 if ((type = getType(t)) < 0) { 00164 write("Ungueltiger Typ!\n"); 00165 return 1; 00166 } 00167 if (b=="n") bonus=0; else if (b=="b") bonus=1; 00168 else { 00169 write("Ungueltige Bonusart!\n"); 00170 return 1; 00171 } 00172 keys = getKeys(k); 00173 00174 type = EPMASTER->AddEPObject(ob, keys, type, bonus); 00175 if (type < 0) 00176 printf("Fehler: %s\n", errMsg(type)); 00177 return 1; 00178 }

| static int change | ( | string | str | ) | [static] |
Definiert in Zeile 180 der Datei explorer.c.
Benutzt _unparsed_args(), ARCH_SECURITY, CHANGE_BONUS, CHANGE_KEY, CHANGE_OB, CHANGE_TYPE, EPMASTER, errMsg(), getKeys(), getOb(), getType(), neu, notify_fail() und ob().
Wird benutzt von NotifyHpChange().
00181 { 00182 string was, wie, neu; 00183 object ob; 00184 int type; 00185 mixed new; 00186 00187 if( !ARCH_SECURITY ) { 00188 notify_fail("Du bist kein Erzmagier!\n"); 00189 return 0; 00190 } 00191 00192 notify_fail("Syntax: epchange <was>: <wie> <neu>\n"); 00193 if (!(str = this_player()->_unparsed_args())) 00194 return 0; 00195 00196 if (sscanf(str, "%s: %s %s", was, wie, neu) != 3) 00197 return 0; 00198 00199 if (!(ob = getOb(was))) { 00200 printf( "Kann '%s' nicht finden!\n", was); 00201 return 1; 00202 } 00203 switch(wie[0..2]) { 00204 case "obj": 00205 type = CHANGE_OB; 00206 new = getOb(neu); 00207 if (!new) { 00208 printf( "Kann '%s' nicht finden!\n", neu); 00209 return 1; 00210 } 00211 break; 00212 case "key": 00213 type = CHANGE_KEY; 00214 new = getKeys(neu); 00215 break; 00216 case "typ": 00217 type = CHANGE_TYPE; 00218 if ((new = getType(neu)) < 0) { 00219 write("Ungueltiger Typ!\n"); 00220 return 1; 00221 } 00222 break; 00223 case "bon": 00224 type = CHANGE_BONUS; 00225 if (neu=="n") new=0; else if (neu=="b") new=1; 00226 else { 00227 write("Ungueltige Bonusart!\n"); 00228 return 1; 00229 } 00230 break; 00231 default: 00232 write("Das laesst sich nicht aendern...\n"); 00233 return 1; 00234 break; 00235 } 00236 type = EPMASTER->ChangeEPObject( ob, type, new ); 00237 if (type < 0) 00238 printf("Fehler: %s\n",errMsg(type)); 00239 00240 return 1; 00241 }


| create | ( | ) |
Definiert in Zeile 13 der Datei explorer.c.
Benutzt AddCmd(), AddId(), create(), MALE, P_AUTOLOADOBJ, P_GENDER, P_LONG, P_NAME, P_NEVERDROP, P_NODROP, P_SHORT und SetProp().
00014 { 00015 if (!clonep(this_object())) return; 00016 ::create(); 00017 SetProp(P_SHORT, "Der Erforscher"); 00018 SetProp(P_NAME, "Erforscher"); 00019 SetProp(P_GENDER, MALE); 00020 SetProp(P_LONG, "Dies ist der beruehmte Erforscher des MorgenGrauens. Er\n" 00021 +"stellt folgende Befehle zur Verfuegung:\n" 00022 +" epadd <was>: <bonus> <typ> <keys>\n" 00023 +" epchange <was>: <wie> <neu>\n" 00024 +" epdel <was>\n" 00025 +" epinfo <was>\n" 00026 +" epcount <spielername> - Anzahl der EPs des Spielers\n" 00027 +" epscan <spielername> [filenamenpattern] - Zeige dessen EPs gefiltert an\n" 00028 +" eppladd <spielername> <ep-anzahl> - Gib ihm ep-anzahl EPs (zufaellig)\n" 00029 +" eppldel <spielername> <ep-anzahl> - Loesche ihm ep-anzahl EPs (zufael.)\n" 00030 +" epplset <spielername> <ep-nummer> - Setze ihm EP ep-nummer\n" 00031 +" epplclr <spielername> <ep-nummer> - Loesche ihm EP ep-nummer\n" 00032 +"Dabei bedeutet:\n" 00033 +"<was> - Das Objekt (eine ID bei Objekten in der Naehe, hier oder\n" 00034 +" here fuer den aktuellen Raum, oder ein Dateiname)\n" 00035 +"<bonus> - n fuer normale EPs, b fuer Bonus-EPs (z.B. Para-EPs)\n" 00036 +"<typ> - detail, rdetail, exit/ausgang, cmd/befehl/kommando, info, pub, misc,\n" 00037 +" smell/geruch, sound/noise\n" 00038 +"<key> - Liste der Schluesselwoerter, mit Kommata getrennt\n" 00039 +"<wie> - obj, key, bonus oder typ 1\n" 00040 +"<neu> - Je nach <wie>; siehe <was>, <key>, <typ>\n" 00041 ); 00042 SetProp(P_NODROP, 1); 00043 SetProp(P_NEVERDROP, 1); 00044 SetProp(P_AUTOLOADOBJ,1); 00045 AddId(({"explorer","erforscher"})); 00046 00047 AddCmd(({"epadd"}), "add"); 00048 AddCmd(({"epchange"}), "change"); 00049 AddCmd(({"epdel"}), "del"); 00050 AddCmd(({"epinfo"}), "info"); 00051 AddCmd(({"epcount"}), "epcount"); 00052 AddCmd(({"epscan"}), "epscan"); 00053 AddCmd(({"eppladd"}), "eppladd"); 00054 AddCmd(({"eppldel"}), "eppldel"); 00055 AddCmd(({"epplset"}), "epplset"); 00056 AddCmd(({"epplclr"}), "epplclr"); 00057 }

| static int del | ( | string | str | ) | [static] |
Definiert in Zeile 243 der Datei explorer.c.
Benutzt ARCH_SECURITY, EPMASTER, errMsg(), getOb(), notify_fail() und ob().
Wird benutzt von substitute().
00244 { 00245 object ob; 00246 int ret; 00247 00248 if( !ARCH_SECURITY ) { 00249 notify_fail("Du bist kein Erzmagier!\n"); 00250 return 0; 00251 } 00252 if (!str) { 00253 notify_fail("Syntax: epdel <was>\n"); 00254 return 0; 00255 } 00256 if (!(ob = getOb(str))) { 00257 write("Kann das Objekt nicht finden!\n"); 00258 return 1; 00259 } 00260 ret = EPMASTER->RemoveEPObject(ob); 00261 if (ret < 0) 00262 printf("Fehler: %s\n", errMsg(ret)); 00263 00264 return 1; 00265 }


| static int epcount | ( | string | str | ) | [static] |
Definiert in Zeile 302 der Datei explorer.c.
Benutzt ARCH_SECURITY, EPMASTER, notify_fail() und pl.
00302 { 00303 object pl,epm; 00304 00305 if( !ARCH_SECURITY ) { 00306 notify_fail("Du bist kein Erzmagier!\n"); 00307 return 0; 00308 } 00309 00310 if (!str || str=="") { 00311 notify_fail("Syntax: epcount <spielername>\n"); 00312 return 0; 00313 } 00314 00315 printf( "%s hat %d von %d FPs. (Durchschnitt = %d)\n", 00316 capitalize(str), 00317 EPMASTER->QueryExplorationPoints(str), 00318 EPMASTER->QueryMaxEP(), 00319 EPMASTER->QueryAverage() 00320 ); 00321 return 1; 00322 }

| static eppladd | ( | string | str | ) | [static] |
Definiert in Zeile 380 der Datei explorer.c.
Benutzt ARCH_SECURITY, epnum, notify_fail(), pl und player.
00380 { 00381 string player, rest; 00382 int epnum; 00383 object pl,tmp; 00384 00385 if( !ARCH_SECURITY ) { 00386 notify_fail("Du bist kein Erzmagier!\n"); 00387 return 0; 00388 } 00389 00390 notify_fail( "eppladd <spieler> <anzahl_eps>\n" ); 00391 if( !str || sscanf( str, "%s %d", player, epnum )<2 ) 00392 return 0; 00393 00394 if( epnum <= 0 ) { 00395 write( "Anzahl der FPs <= 0 ?\n" ); 00396 return 1; 00397 } 00398 00399 epnum = "/secure/explorationmaster"->AddFP( epnum, player ); 00400 printf( "Ergebnis (hinzugefuegte FPs) = %O\n", epnum ); 00401 return 1; 00402 00403 }

| static epplclr | ( | string | str | ) | [static] |
Definiert in Zeile 424 der Datei explorer.c.
Benutzt ARCH_SECURITY, epnum, notify_fail(), pl und player.
00424 { 00425 string player, rest; 00426 int epnum; 00427 object pl,tmp; 00428 00429 if( !ARCH_SECURITY ) { 00430 notify_fail("Du bist kein Erzmagier!\n"); 00431 return 0; 00432 } 00433 00434 notify_fail( "epplclr <spieler> <ep-nummer>\n" ); 00435 if( !str || sscanf( str, "%s %d", player, epnum )<2 ) 00436 return 0; 00437 00438 epnum = "/secure/explorationmaster"->ClearFP( epnum, player ); 00439 printf( "Ergebnis (geloeschter FP) = %O\n", epnum ); 00440 return 1; 00441 }

| static eppldel | ( | string | str | ) | [static] |
Definiert in Zeile 350 der Datei explorer.c.
Benutzt ARCH_SECURITY, epnum, notify_fail(), player und secure_level().
00350 { 00351 string player, rest; 00352 int epnum; 00353 object tmp; 00354 00355 if( !ARCH_SECURITY ) { 00356 notify_fail("Du bist kein Erzmagier!\n"); 00357 return 0; 00358 } 00359 00360 notify_fail( "eppldel <spieler> <anzahl_eps> <grund>\n" ); 00361 if( !str || sscanf( str, "%s %d %s", player, epnum, rest )<2 ) 00362 return 0; 00363 00364 if( epnum <= 0 ) { 00365 write( "Anzahl der FPs <= 0 ?\n" ); 00366 return 1; 00367 } 00368 if( !rest || rest=="" ) { 00369 write( "Bitte Grund angeben!\n" ); 00370 return 1; 00371 } 00372 00373 printf( "%O %O %O\n", epnum, player, secure_level() ); 00374 epnum = "/secure/explorationmaster"->RemoveFP( epnum, player, rest ); 00375 printf( "Ergebnis (abgezogene EPs) = %O\n", epnum ); 00376 return 1; 00377 00378 }

| static epplset | ( | string | str | ) | [static] |
Definiert in Zeile 405 der Datei explorer.c.
Benutzt ARCH_SECURITY, epnum, notify_fail(), pl und player.
00405 { 00406 string player, rest; 00407 int epnum; 00408 object pl,tmp; 00409 00410 if( !ARCH_SECURITY ) { 00411 notify_fail("Du bist kein Erzmagier!\n"); 00412 return 0; 00413 } 00414 00415 notify_fail( "epplset <spieler> <ep-nummer>\n" ); 00416 if( !str || sscanf( str, "%s %d", player, epnum )<2 ) 00417 return 0; 00418 00419 epnum = "/secure/explorationmaster"->SetFP( epnum, player ); 00420 printf( "Ergebnis (gesetzter FP) = %O\n", epnum ); 00421 return 1; 00422 }

| static int epscan | ( | string | str | ) | [static] |
Definiert in Zeile 324 der Datei explorer.c.
Benutzt _unparsed_args(), ARCH_SECURITY, EPMASTER, errMsg(), notify_fail(), old_explode() und pl.
00324 { 00325 object pl; 00326 int erg; 00327 string *astr; 00328 00329 if( !ARCH_SECURITY ) { 00330 notify_fail("Du bist kein Erzmagier!\n"); 00331 return 0; 00332 } 00333 00334 if (!str || str=="") { 00335 notify_fail("Syntax: epscan <spielername> [Teil des Filenamens]\n"); 00336 return 0; 00337 } 00338 00339 astr=old_explode(this_player()->_unparsed_args()," "); 00340 00341 if (sizeof(astr)<2) 00342 erg = EPMASTER->ShowPlayerEPs(astr[0]); 00343 else 00344 erg = EPMASTER->ShowPlayerEPs(astr[0],astr[1]); 00345 if (erg < 0) 00346 printf("Fehler: %s\n",errMsg(erg)); 00347 return 1; 00348 }

| static string errMsg | ( | int | code | ) | [static] |
Definiert in Zeile 132 der Datei explorer.c.
Benutzt EPERR_INVALID_ARG.
Wird benutzt von add(), change(), del() und epscan().
00133 { 00134 if (code >= 0 || code < EPERR_INVALID_ARG) 00135 return "Unbekannter Fehler"; 00136 00137 code = -(code+1); 00138 return ({ "Du bist kein Erzmagier", "Ungueltiges Objekt", 00139 "Objekt steht nicht in der Liste", "Ungueltiges Argument"})[code]; 00140 }

| static object find_playerob | ( | string | name | ) | [static] |
Definiert in Zeile 298 der Datei explorer.c.
Benutzt find_netdead() und find_player().
00298 { 00299 return find_player(name)||find_netdead(name); 00300 }

| static string* getKeys | ( | string | str | ) | [static] |
Definiert in Zeile 121 der Datei explorer.c.
Benutzt i.
Wird benutzt von add() und change().
00122 { 00123 int i; 00124 string *t1, *t2; 00125 00126 t1 = regexplode(str, ", *"); 00127 for (t2 = ({}), i=sizeof(t1)-1; i>=0; i-=2) 00128 t2 = ({ t1[i] }) + t2; 00129 return t2; 00130 }

| static object getOb | ( | string | str | ) | [static] |
Definiert in Zeile 102 der Datei explorer.c.
Benutzt ob().
Wird benutzt von add(), change(), del() und info().
00103 { 00104 object ob; 00105 00106 if (str == "hier" || str == "here" ) 00107 return environment(this_player()); 00108 00109 ob = present(str, environment(this_player())); 00110 if (!ob) 00111 ob = present(str, this_player()); 00112 00113 if (!ob) { 00114 str = "/secure/master"->_get_path(str, getuid(this_player())); 00115 catch(call_other(str, "???")); 00116 ob = find_object(str); 00117 } 00118 return ob; 00119 }


| static int getType | ( | string | s | ) | [static] |
Definiert in Zeile 71 der Datei explorer.c.
Benutzt EP_CMD, EP_DETAIL, EP_EXIT, EP_INFO, EP_MISC, EP_PUB, EP_RDET, EP_SMELL und EP_SOUND.
Wird benutzt von add() und change().
00072 { 00073 switch(s[0..2]) { 00074 case "det": 00075 return EP_DETAIL; 00076 case "rde": 00077 return EP_RDET; 00078 case "aus": 00079 case "exi": 00080 return EP_EXIT; 00081 case "cmd": 00082 case "bef": 00083 case "kom": 00084 return EP_CMD; 00085 case "inf": 00086 return EP_INFO; 00087 case "pub": 00088 return EP_PUB; 00089 case "mis": 00090 case "ver": 00091 return EP_MISC; 00092 case "sme": 00093 case "ger": 00094 return EP_SMELL; 00095 case "sou": 00096 case "noi": 00097 return EP_SOUND; 00098 } 00099 return -1; 00100 }

| static int info | ( | string | str | ) | [static] |
Definiert in Zeile 267 der Datei explorer.c.
Benutzt ARCH_SECURITY, EPMASTER, getOb(), info, MPOS_KEY, MPOS_NUM, MPOS_TYPE, notify_fail(), ob() und strArr().
00268 { 00269 object ob; 00270 mixed info; 00271 00272 if( !ARCH_SECURITY ) { 00273 notify_fail("Du bist kein Erzmagier!\n"); 00274 return 0; 00275 } 00276 00277 if (!str) { 00278 notify_fail("Syntax: epinfo <was>\n"); 00279 return 0; 00280 } 00281 00282 if (!(ob = getOb(str))) { 00283 write("Das finde ich leider nicht...\n"); 00284 return 1; 00285 } 00286 if (!(info = EPMASTER->QueryEPObject(ob))) 00287 write ("Das Objekt ist nicht eingetragen!\n"); 00288 else 00289 printf("Nummer: %d\nBonus: %d\nTyp: %s\nSchluessel: %s\n", 00290 info[MPOS_NUM], 00291 info[MPOS_TYPE+1], 00292 ({ "Detail", "Ausgang", "Kommando", "Info", "Misc", "ReadDetail", "Kneipe", "Geruch", "Geraeusch" })[info[MPOS_TYPE]], 00293 strArr(info[MPOS_KEY] )); 00294 00295 return 1; 00296 }

| static string strArr | ( | string * | s | ) | [static] |
Definiert in Zeile 59 der Datei explorer.c.
Benutzt i.
Wird benutzt von info().
00060 { 00061 string ret; 00062 int i; 00063 00064 ret = ("\"" + s[<1] + "\""); 00065 for (i=sizeof(s)-2; i>=0; i--) 00066 ret += (", \""+s[i]+"\""); 00067 00068 return ret; 00069 }

| inherit std secure_thing |
Definiert in Zeile 7 der Datei explorer.c.
1.6.3