#include "/secure/config.h"#include "/secure/wizlevels.h"
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | RoomsPerList 10 |
| #define | POTIONDUMP "/secure/ARCH/TRAENKE.dump" |
| #define | DUMP(str) write_file(POTIONDUMP,str) |
| #define | TIPS(x) "/secure/ARCH/ZT/"+x |
Funktionen | |
| void | save_info () |
| static private int | secure () |
| void | create () |
| int | AddPotionroom (string roomname) |
| int | ChangeRoomPath (string oldpath, string newpath) |
| int | SetListNr (string roomname, int listno) |
| int | ActivateRoom (string roomname) |
| int | DeactivateRoom (string roomname) |
| mixed | _create_list (int listno, int anz) |
| mixed | InitialList () |
| mixed | HasPotion (mixed room) |
| int | GetListByNumber (int nr) |
| int | GetInactListByNumber (int nr) |
| mixed | GetFilenameByNumber (int nr) |
| int | InList (mixed room, mixed potionlist, mixed knownlist) |
| void | RemoveList (mixed room, mixed list, mixed klist) |
| int | DumpList () |
| mixed | TipLesen (int nr) |
Variablen | |
| mapping | tipmap |
| mixed * | all_rooms |
| mixed * | active_rooms |
| mixed * | inactive_rooms |
| int | nextroom |
| #define DUMP | ( | str | ) | write_file(POTIONDUMP,str) |
Definiert in Zeile 28 der Datei potionmaster.c.
Wird benutzt von DumpList().
| #define POTIONDUMP "/secure/ARCH/TRAENKE.dump" |
Definiert in Zeile 27 der Datei potionmaster.c.
Wird benutzt von DumpList().
| #define RoomsPerList 10 |
Definiert in Zeile 25 der Datei potionmaster.c.
Wird benutzt von InitialList().
| #define TIPS | ( | x | ) | "/secure/ARCH/ZT/"+x |
Definiert in Zeile 30 der Datei potionmaster.c.
| mixed _create_list | ( | int | listno, | |
| int | anz | |||
| ) |
Definiert in Zeile 161 der Datei potionmaster.c.
Benutzt active_rooms und list.
Wird benutzt von InitialList().
00162 { 00163 mixed *list, tmp; 00164 int i, j; 00165 00166 list=({}); 00167 tmp=active_rooms[listno][0..<1]; 00168 while (anz>0) 00169 { 00170 anz--; 00171 if (sizeof(tmp)==0) 00172 { 00173 // write("Fehler ! Liste konnte nicht erzeugt werden ! PANIC !\n"); 00174 return list; 00175 } 00176 if (sizeof(tmp)==1) 00177 { 00178 list+=tmp; 00179 tmp=({}); 00180 } 00181 else 00182 { 00183 j=random(sizeof(tmp)); 00184 list+=({tmp[j]}); 00185 tmp=tmp[0..j-1]+tmp[j+1..<1]; 00186 } 00187 } 00188 return list; 00189 }

| int ActivateRoom | ( | string | roomname | ) |
Definiert in Zeile 121 der Datei potionmaster.c.
Benutzt active_rooms, all_rooms, inactive_rooms, save_info() und secure().
00122 { 00123 int nummer,listno; 00124 int i; 00125 00126 if (!secure()) return -1; 00127 nummer=assoc(roomname, all_rooms, -1); 00128 if (nummer==-1) return -2; 00129 for (i=0;i<8;i++) 00130 if (member(active_rooms[i], nummer)!=-1) return -3; 00131 listno=-1; 00132 for (i=0;i<8;i++) 00133 if (member(inactive_rooms[i], nummer)!=-1) listno=i; 00134 if (listno==-1) return -4; 00135 inactive_rooms[listno]-=({nummer}); 00136 active_rooms[listno]+=({nummer}); 00137 save_info(); 00138 return listno; 00139 }

| int AddPotionroom | ( | string | roomname | ) |
Definiert in Zeile 68 der Datei potionmaster.c.
Benutzt _get_path(), all_rooms, nextroom, save_info() und secure().
00069 { 00070 if (!secure()) return 0; 00071 if (!stringp(roomname) || roomname=="") return -1; 00072 roomname=(string)"/secure/master"->_get_path(roomname,0); 00073 if (catch(load_object(roomname); publish)) return -2; 00074 //if (roomname[0..12]!="/room/potion/") return -4; 00075 if (assoc(roomname, all_rooms, -1)!=-1) return -3; 00076 all_rooms=insert_alist(roomname, nextroom, all_rooms); 00077 nextroom++; 00078 save_info(); 00079 return nextroom; 00080 }

| int ChangeRoomPath | ( | string | oldpath, | |
| string | newpath | |||
| ) |
Definiert in Zeile 82 der Datei potionmaster.c.
Benutzt _get_path(), all_rooms, remove_alist(), save_info() und secure().
00083 { 00084 int num; 00085 00086 if (!secure()) return 0; 00087 if (!stringp(oldpath) || oldpath=="") return -1; 00088 if (!stringp(newpath) || newpath=="") return -2; 00089 oldpath=(string)"/secure/master"->_get_path(oldpath,0); 00090 newpath=(string)"/secure/master"->_get_path(newpath,0); 00091 if (assoc(oldpath,all_rooms,-1)==-1) return -3; 00092 if (assoc(newpath,all_rooms,-1)!=-1) return -4; 00093 if (catch(load_object(newpath);publish)) return -5; 00094 num=assoc(oldpath, all_rooms); 00095 all_rooms=remove_alist(oldpath,all_rooms); 00096 all_rooms=insert_alist(newpath, num, all_rooms); 00097 save_info(); 00098 return num; 00099 }

| void create | ( | ) |
Definiert in Zeile 51 der Datei potionmaster.c.
Benutzt active_rooms, all_rooms, i, inactive_rooms, restore_object() und tipmap.
00052 { 00053 int i; 00054 00055 seteuid(getuid(this_object())); 00056 if (!restore_object("/secure/ARCH/potions")) 00057 { 00058 all_rooms=({({}),({})}); 00059 active_rooms=allocate(8); 00060 for (i=0;i<8;i++) active_rooms[i]=({}); 00061 inactive_rooms=allocate(8); 00062 for (i=0;i<8;i++) inactive_rooms[i]=({}); 00063 } 00064 all_rooms=order_alist(all_rooms); 00065 tipmap=([]); 00066 }

| int DeactivateRoom | ( | string | roomname | ) |
Definiert in Zeile 141 der Datei potionmaster.c.
Benutzt active_rooms, all_rooms, inactive_rooms, save_info() und secure().
00142 { 00143 int nummer,listno; 00144 int i; 00145 00146 if (!secure()) return -1; 00147 nummer=assoc(roomname, all_rooms, -1); 00148 if (nummer==-1) return -2; 00149 for (i=0;i<8;i++) 00150 if (member(inactive_rooms[i], nummer)!=-1) return -3; 00151 listno=-1; 00152 for (i=0;i<8;i++) 00153 if (member(active_rooms[i], nummer)!=-1) listno=i; 00154 if (listno==-1) return -4; 00155 active_rooms[listno]-=({nummer}); 00156 inactive_rooms[listno]+=({nummer}); 00157 save_info(); 00158 return listno; 00159 }

| int DumpList | ( | ) |
Definiert in Zeile 269 der Datei potionmaster.c.
Benutzt active_rooms, all_rooms, DUMP, inactive_rooms und POTIONDUMP.
00270 { 00271 int i,j,k,s; 00272 int *LIST; 00273 00274 rm(POTIONDUMP); 00275 LIST=all_rooms[1]; 00276 for (i=0;i<8;i++) 00277 { 00278 LIST-=active_rooms[i]; 00279 s = sizeof(active_rooms[i]); 00280 DUMP(sprintf("################## Liste %d ################## (%d)\n\n", 00281 i,s)); 00282 for (j=0;j<s;j++) 00283 { 00284 DUMP(sprintf("%3d. ",active_rooms[i][j])); 00285 k=member(all_rooms[1], active_rooms[i][j]); 00286 if (k==-1) 00287 DUMP("KEIN ZUGEORDNETER RAUM !!\n"); 00288 else 00289 DUMP(all_rooms[0][k]+"\n"); 00290 } 00291 DUMP("\n\n"); 00292 } 00293 DUMP(sprintf("################## Inaktiv ##################\n\n")); 00294 for (i=0;i<8;i++) 00295 { 00296 LIST-=inactive_rooms[i]; 00297 s = sizeof(inactive_rooms[i]); 00298 00299 for (j=0;j<s;j++) 00300 { 00301 DUMP(sprintf("%3d. (Liste %d) ",inactive_rooms[i][j],i)); 00302 k=member(all_rooms[1], inactive_rooms[i][j]); 00303 if (k==-1) 00304 DUMP("KEIN ZUGEORDNETER RAUM !!\n"); 00305 else 00306 DUMP(all_rooms[0][k]+"\n"); 00307 } 00308 } 00309 DUMP("\n"); 00310 s=sizeof(LIST); 00311 for (j=0;j<s;j++) 00312 { 00313 DUMP(sprintf("%3d. ",LIST[j])); 00314 k=member(all_rooms[1], LIST[j]); 00315 if (k==-1) 00316 DUMP("KEIN ZUGEORDNETER RAUM !!\n"); 00317 else 00318 DUMP(all_rooms[0][k]+"\n"); 00319 } 00320 DUMP("\n\n"); 00321 return 1; 00322 }
| mixed GetFilenameByNumber | ( | int | nr | ) |
Definiert in Zeile 232 der Datei potionmaster.c.
Benutzt all_rooms.
| int GetInactListByNumber | ( | int | nr | ) |
Definiert in Zeile 223 der Datei potionmaster.c.
Benutzt inactive_rooms.
00224 { 00225 int i; 00226 for (i=0; i<8; i++) 00227 if (member(inactive_rooms[i], nr)!=-1) 00228 return i; 00229 return -1; 00230 }
| int GetListByNumber | ( | int | nr | ) |
Definiert in Zeile 214 der Datei potionmaster.c.
Benutzt active_rooms.
00215 { 00216 int i; 00217 for (i=0; i<8; i++) 00218 if (member(active_rooms[i], nr)!=-1) 00219 return i; 00220 return -1; 00221 }
| mixed HasPotion | ( | mixed | room | ) |
Definiert in Zeile 209 der Datei potionmaster.c.
Benutzt all_rooms.
| mixed InitialList | ( | ) |
Definiert in Zeile 191 der Datei potionmaster.c.
Benutzt _create_list(), list und RoomsPerList.
00192 { 00193 mixed *list; 00194 00195 list=({}); 00196 00197 list+=_create_list(0, RoomsPerList); 00198 list+=_create_list(1, RoomsPerList); 00199 list+=_create_list(2, RoomsPerList); 00200 list+=_create_list(3, RoomsPerList); 00201 list+=_create_list(4, RoomsPerList); 00202 list+=_create_list(5, RoomsPerList); 00203 list+=_create_list(6, RoomsPerList); 00204 list+=_create_list(7, RoomsPerList); 00205 00206 return list; 00207 }

| int InList | ( | mixed | room, | |
| mixed | potionlist, | |||
| mixed | knownlist | |||
| ) |
Definiert in Zeile 240 der Datei potionmaster.c.
Benutzt all_rooms.
00241 { 00242 room=assoc(explode(object_name(room),"#")[0], all_rooms, -1); 00243 if (room==-1) // Gibt's hier ueberhaupt einen ZT? 00244 return 0; 00245 if (member(potionlist, room)==-1) // Hat der Spieler den ZT? 00246 return 0; 00247 if (member(knownlist, room)==-1) // Kennt der Spieler den ZT? 00248 return 0; 00249 return 1; 00250 }
| void RemoveList | ( | mixed | room, | |
| mixed | list, | |||
| mixed | klist | |||
| ) |
Definiert in Zeile 252 der Datei potionmaster.c.
Benutzt all_rooms.
00253 { 00254 int tmp; 00255 00256 room=assoc(explode(object_name(room),"#")[0], all_rooms, -1); 00257 00258 if (room==-1) 00259 return; 00260 // Nummern durch -1 ersetzen 00261 tmp = member(list, room); 00262 if (tmp!=-1) 00263 list[tmp] = -1; 00264 tmp = member(klist, room); 00265 if (tmp!=-1) 00266 klist[tmp] = -1; 00267 }
| void save_info | ( | ) |
Definiert in Zeile 39 der Datei potionmaster.c.
Benutzt save_object().
Wird benutzt von ActivateRoom(), AddMiniQuest(), AddPotionroom(), AddQuest(), ChangeMiniQuest(), ChangeRoomPath(), create(), DeactivateRoom(), RemoveMiniQuest(), RemoveQuest(), SetActive(), SetListNr() und SetMiniActive().
00040 { 00041 save_object("/secure/ARCH/potions"); 00042 }


| static private int secure | ( | ) | [static] |
Definiert in Zeile 44 der Datei potionmaster.c.
Benutzt ARCH_SECURITY und process_call().
00045 { 00046 if (!process_call() && previous_object() && this_interactive() && ARCH_SECURITY) 00047 return 1; 00048 return 0; 00049 }

| int SetListNr | ( | string | roomname, | |
| int | listno | |||
| ) |
Definiert in Zeile 101 der Datei potionmaster.c.
Benutzt active_rooms, all_rooms, inactive_rooms, save_info() und secure().
00102 { 00103 int nummer; 00104 int i; 00105 00106 if (!secure()) return -1; 00107 nummer=assoc(roomname, all_rooms, -1); 00108 if (nummer==-1) return -2; 00109 if (listno<0 || listno>7) return -3; 00110 for (i=0;i<8;i++) 00111 if (member(active_rooms[i], nummer)!=-1) 00112 active_rooms[i]-=({nummer}); 00113 for (i=0;i<8;i++) 00114 if (member(inactive_rooms[i], nummer)!=-1) 00115 inactive_rooms[i]-=({nummer}); 00116 active_rooms[listno]+=({nummer}); 00117 save_info(); 00118 return listno; 00119 }

| mixed TipLesen | ( | int | nr | ) |
Definiert in Zeile 344 der Datei potionmaster.c.
00345 { 00346 string tmpstr; 00347 int start; 00348 string fn; 00349 string tip; 00350 string* tips; 00351 string ret; 00352 00353 if (previous_object() != find_object("/room/orakel")) 00354 return 0; 00355 00356 // write_file("/log/ARCH/zt.log", 00357 // sprintf("%s: ZT-Tip gelesen: %d von TP: %O, PO: %O, TI: %O\n", 00358 // dtime(time()), nr, this_player(), 00359 // previous_object(), this_interactive())); 00360 00361 if (ret=tipmap[nr]) // Schon bekannt 00362 return ret; 00363 00364 fn = TIPS(nr+".zt"); 00365 if (file_size(fn) == -1) 00366 return -1; // Datei existiert nicht, Fehler 00367 00368 tmpstr = ""; 00369 start = 1; 00370 tips = ({ }); 00371 tip = ""; 00372 00373 while (tmpstr[0..4]!="%%%%%") 00374 { 00375 tmpstr = read_file(fn, start++, 1); 00376 if (tmpstr[0..4] == "XXXXX" || tmpstr[0..4] == "%%%%%") 00377 { 00378 tips += ({ tip }); 00379 tip = ""; 00380 } 00381 else 00382 tip += tmpstr; 00383 } 00384 if (sizeof(tips)) 00385 { 00386 tipmap[nr] = tips; 00387 return tips; 00388 } 00389 else // Datei ist leer oder es ist sonstwas schlimmes passiert, Fehler 00390 return -2; 00391 }
| mixed* active_rooms |
Definiert in Zeile 35 der Datei potionmaster.c.
Wird benutzt von _create_list(), ActivateRoom(), create(), DeactivateRoom(), DumpList(), GetListByNumber() und SetListNr().
| mixed* all_rooms |
Definiert in Zeile 34 der Datei potionmaster.c.
Wird benutzt von ActivateRoom(), AddPotionroom(), ChangeRoomPath(), create(), DeactivateRoom(), DumpList(), GetFilenameByNumber(), HasPotion(), InList(), RemoveList() und SetListNr().
| mixed* inactive_rooms |
Definiert in Zeile 36 der Datei potionmaster.c.
Wird benutzt von ActivateRoom(), create(), DeactivateRoom(), DumpList(), GetInactListByNumber() und SetListNr().
| int nextroom |
Definiert in Zeile 37 der Datei potionmaster.c.
Wird benutzt von AddPotionroom().
| mapping tipmap |
Definiert in Zeile 32 der Datei potionmaster.c.
Wird benutzt von create() und TipLesen().
1.6.3