www.walk.c-Dateireferenz

#include <www.h>
#include <properties.h>
Include-Abhängigkeitsdiagramm für www.walk.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define TAB   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789(){}[]-_+:;.,/"
#define PASSWD   "7d.4A37d;Hs[."
#define CRYPT(str, tab, pwd)   _crypt(str, tab, pwd)
#define DECRYPT(str, tab, pwd)   _decrypt(str, tab, pwd)
#define NUMBER(i)

Funktionen

private string CreateLink (object item, string url, string type)
private void StraightExits (string dir, string file, mapping exits)
private int Validate (string file)
private string CRYPT (string str, string tab, string passwd)
private string DECRYPT (string str, string tab, string passwd)
string Request (mapping cmds)

Variablen

inherit UDPPATH www crypt
private mapping StartPoints
private string * Paths
private string * PathsExclude = ({"/d/wald/room/hoehle/",})

Makro-Dokumentation

#define CRYPT ( str,
tab,
pwd   )     _crypt(str, tab, pwd)

Definiert in Zeile 19 der Datei www.walk.c.

Wird benutzt von Request().

#define DECRYPT ( str,
tab,
pwd   )     _decrypt(str, tab, pwd)

Definiert in Zeile 20 der Datei www.walk.c.

Wird benutzt von Request().

#define NUMBER ( i   ) 
Wert:
(([1:"einen",2:"zwei",3:"drei",4:"vier",5:"f&uuml;nf",\
                                                   6:"sechs",7:"sieben",8:"acht",9:"neun"])[i])

Definiert in Zeile 22 der Datei www.walk.c.

Wird benutzt von Request().

#define PASSWD   "7d.4A37d;Hs[."

Definiert in Zeile 18 der Datei www.walk.c.

Wird benutzt von Request().

#define TAB   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789(){}[]-_+:;.,/"

Definiert in Zeile 16 der Datei www.walk.c.

Wird benutzt von Request().


Dokumentation der Funktionen

private string CreateLink ( object  item,
string  url,
string  type 
)

Definiert in Zeile 214 der Datei www.walk.c.

Benutzt i, P_IDS, P_NAME, R_WALK und REQ.

00215 {
00216   string s, *tmp; mixed nm; int i;
00217   if((s = item->short()) && (nm = item->QueryProp(P_NAME)))
00218   {
00219     if(pointerp(nm)) nm = nm[0];
00220     if(member(nm, ' ') != -1) nm = item->QueryProp(P_IDS)[<1];
00221     if((i = member(tmp = regexplode(s, nm), nm)) == -1) i = 0;
00222     tmp[i] = "<A HREF=\""+url+"&"+REQ+"="+R_WALK
00223            + "&"+type+"="+lower_case(nm)+"\">"+tmp[i]+"</A>";
00224     return implode(tmp, "");
00225   }
00226   return "";
00227 }

private string CRYPT ( string  str,
string  tab,
string  passwd 
)
private string DECRYPT ( string  str,
string  tab,
string  passwd 
)
string Request ( mapping  cmds  ) 

Definiert in Zeile 60 der Datei www.walk.c.

Benutzt BACK, CRYPT, DECRYPT, DETAIL, ERROR, exits, file(), i, item, items, light(), MUDHOST, MUDNAME, MUDWWW, NUMBER, P_AGGRESSIVE, P_DETAILS, P_EXITS, P_INT_LONG, P_INT_SHORT, P_LIGHT, P_WWWINFO, PASSWD, query(), R_FINGER, R_WALK, REQ, ROOM, StartPoints, TAB, text() und Validate().

00061 {
00062   string file, text;
00063   object obj;
00064   
00065   if (!sizeof(cmds)) return ERROR("Anfrage ung&uuml;ltig!");
00066   if(!sizeof(cmds) || !cmds[ROOM]) 
00067     return "<H2>WebVoyeur!</H2>\n"
00068          +"Der WebVoyeur erlaubt Dir, Dich umzusehen ohne, daß Du direkt "
00069                  +"einloggen mußt. Damit kann man sich einige Gegenden ansehen und "
00070                  +"das eine oder andere Ding oder auch Spieler betrachten.<P>\n"
00071                  +"Such Dir einen Anfangspunkt aus:<P>"
00072                  +"<UL><LI>"
00073                  +implode(map(m_indices(StartPoints), 
00074                                                   lambda(({'i}),
00075                                                   ({#'+, ({#'+, ({#'+, ({#'+, "<A HREF=\""+MUDWWW+"?"+REQ+"="+R_WALK+"&"+ROOM+"=", 'i}), "\">"}), 'i}), "</A>"}))),
00076                    "<LI>")+"</UL>" // '
00077          +"<P>"
00078                  +"Alternativ kannst Du auch über einen speziellen Service in "
00079                  +"einige Angebote anderer MUDs schauen. Hier gehts zum "
00080                  +"<A HREF=\"/cgi-bin/mudwww?REQ=intermud\">InterMUD</A>";
00081   else
00082     if(member(StartPoints, cmds[ROOM]))
00083       cmds[ROOM] = CRYPT(StartPoints[cmds[ROOM]], TAB, PASSWD);
00084 
00085   file = DECRYPT(cmds[ROOM], TAB, PASSWD);
00086   if(!Validate(file))
00087     return "<H1>"+MUDNAME+" -- MudWWW Zugang</H1><HR><TT>"
00088                  + "Hier geht es zwar noch weiter, aber aus gewissen Gr&uuml;nden "
00089                  + "k&ouml;nnen wir den Zugang weiter nicht erlauben!<P>"
00090                  + "Allerdings kannst Du auch richtig "
00091                  + "<A HREF=\"http://"+MUDHOST+"/online/\">"+MUDNAME+" spielen</A>. "
00092          + "Da geht es dann "
00093                  + "hier auch weiter."
00094                  + "Im Moment bleibt Dir nur die M&ouml;glichkeit "
00095                  + "zur&uuml;ck zu gehen."
00096                  + "</TT><HR>";
00097   text = "";
00098 
00099   // HERE COMES YOUR OWN SPECIAL ROOM/DETAILS ETC DESCRIPTION!!!!
00100 
00101   // load the room, if it doesn't already exists
00102   if(!(obj = find_object(file)))
00103   {
00104     file->__DoesThisRoomExist();
00105     obj = find_object(file);
00106   }
00107   if(obj)
00108   {
00109     int i, light;
00110     mapping exits;
00111     object *items;
00112     closure query;
00113 
00114     query = symbol_function("QueryProp", obj = find_object(file));
00115     if(light = funcall(query, P_LIGHT) > 0)
00116     {
00117       // it needs to be bright to see whats there!
00118       // put the short description in the first line and the long one as
00119       // body underneath the shadow line
00120       text = "<H1>"+funcall(query, P_INT_SHORT)+"</H1><HR>"
00121            + "<PRE>"+funcall(query, P_INT_LONG);
00122 
00123       // now lets have a look at the items (not details!)
00124       if(sizeof(items = all_inventory(obj)))
00125       {
00126                 string *shorts;
00127          // if there is an aggressive monster there don't allow further
00128          // processing, just allow to go back (one could map_ldfied!)
00129                  if(sizeof(map_objects(items, "QueryProp", P_AGGRESSIVE)-({0})))
00130                    return "<H1>Gefahr!</H1><HR>"
00131                  +"<PRE>"
00132                                  + "In diesem Raum ist es so gef&auml;hrlich, dass Du "
00133                  +"lieber sofort zur&uuml;ck gehst.</PRE>";
00134 
00135          // try to wrap the items with links
00136          if(sizeof(shorts = map(items, #'CreateLink/*'*/, 
00137                                              MUDWWW+"?"+ROOM+"="+
00138                                                                          CRYPT(file, TAB, PASSWD)+
00139                                                                          "&"+BACK+"="+MUDWWW+"?"+cmds[BACK],
00140                                              DETAIL) - ({0})))
00141            text+="<BR>Du siehst hier:<UL><LI>"+implode(shorts, "<LI>")+"</UL>";
00142          else text += "Hier steht und liegt niemand und nichts herum.";
00143       }
00144       text += "</PRE>";
00145     } 
00146     else // if it's too dark just display the following text
00147       text = "<H1>Irgendwo</H1><HR><PRE>"
00148            + "Es ist zu dunkel, um etwas zu sehen.</PRE>";
00149 
00150     // is there a details to be shown?
00151     if(cmds[DETAIL])
00152     {
00153       string det;
00154       object item;
00155       // don't show items, when it's dark or it is not found or
00156       // when the item is invisible
00157       cmds[DETAIL]=lower_case(cmds[DETAIL]);
00158       if(light <= 0 ||
00159          (!(det = funcall(query, P_DETAILS)[cmds[DETAIL]]) &&
00160           !((item = present(cmds[DETAIL], obj)) && !item->QueryProp(P_INVIS))))
00161         det = "\""+capitalize(cmds[DETAIL])+"\" kannst Du hier nicht sehen!<BR>"
00162             + "Es ist m&ouml;glicherweise entfernt worden.";
00163       if(objectp(item)) 
00164       {
00165                 string wwwinfo;
00166                 det = item->long();
00167                 if(wwwinfo = item->QueryProp(P_WWWINFO)) det += wwwinfo;
00168                 if(query_once_interactive(item))
00169                   det += "\nMehr Information zu <A HREF=\""+MUDWWW+"?"
00170                       + REQ+"="+R_FINGER+"&"
00171                       + "USER="+getuid(item)+"&"+BACK+"="+MUDWWW+"?"+cmds[BACK]+"\">"
00172                       + capitalize(getuid(item))+"</A>!";
00173       }
00174       if(!stringp(det)) det = (string)det[0];
00175       text += "<HR><H3>"+capitalize(cmds[DETAIL])+"</H3>"
00176                    + "<PRE>"+det+"</PRE><HR>";
00177     }
00178 
00179     // now display the exits
00180     text += "<H3>";
00181     exits = funcall(query, P_EXITS);
00182     walk_mapping(exits, #'StraightExits/*'*/, exits);
00183     if(!light || !(i = sizeof(exits))) 
00184       text += "Es gibt hier keine sichtbaren Ausg&auml;nge!";
00185     else 
00186     {
00187       string *ind;
00188       text += "Es gibt hier "+NUMBER(i)
00189             + " sichtbare"+(i==1?"n Ausgang":" Ausg&auml;nge")+": ";
00190       for(i = 0; i < sizeof(ind = m_indices(exits)); i++)
00191         text += "<A HREF=\""+MUDWWW+"?"+REQ+"="+R_WALK+"&"
00192                       + ROOM+"="+CRYPT(exits[ind[i]], TAB, PASSWD)
00193                       + "&"+BACK+"="+MUDWWW+"?"+cmds[BACK]+"\">"
00194                       + ind[i]+"</A> ";
00195     }
00196     text += "</H3>";
00197 
00198   }
00199   // this should never occur!
00200   else return "<H1>Der Raum ist momentan nicht verf&uuml;gbar!</H1>";
00201   return text
00202        + "<FORM ACTION=\""+MUDWWW+"\">"
00203        + "Was m&ouml;chtest Du n&auml;her betrachten? "
00204        + "<INPUT TYPE=\"hidden\" NAME=\""+REQ+"\" VALUE=\""+R_WALK+"\">"
00205        + "<INPUT TYPE=\"hidden\" NAME=\""+ROOM+"\" VALUE=\""
00206        + CRYPT(file, TAB, PASSWD)+"\">"
00207        + "<INPUT TYPE=text NAME=\""+DETAIL+"\">"
00208        + "<INPUT TYPE=submit VALUE=\"Ansehen!\"></FORM><BR>";
00209 }

Hier ist ein Graph der zeigt, was diese Funktion aufruft:

private void StraightExits ( string  dir,
string  file,
mapping  exits 
)

Definiert in Zeile 229 der Datei www.walk.c.

Benutzt i.

00230 {
00231   int i;
00232   if((i = member(file, '#')) != -1)
00233     file = file[i+1..];
00234   exits[dir] = file;
00235 }

private int Validate ( string  file  ) 

Definiert in Zeile 238 der Datei www.walk.c.

Benutzt i, Paths und PathsExclude.

00239 {
00240   int i;
00241 
00242                 if(file[0]!='/')
00243                   file = "/"+file;
00244 
00245   i = sizeof(PathsExclude);
00246   while(i--)
00247     if(strstr(file, PathsExclude[i]) > 0) return 0;
00248   i = sizeof(Paths);
00249   while(i--)
00250     if(strstr(file, Paths[i]) != -1) return 1;
00251   return 0;
00252 }


Variablen-Dokumentation

inherit UDPPATH www crypt

Definiert in Zeile 12 der Datei www.walk.c.

Wird benutzt von check_password(), CheckPasswd(), efun_crypt(), format_paths() und update_password().

private string* Paths
Initialisierung:
 ({ "/gilden/",
                                                   "/d/ebene/room/PortVain/",
                           "/d/wald/room/",
                                           "/d/wald/quasimodo/room/",
                                                   "/d/gebirge/room/he",
                                                   "/d/gebirge/room/z",
                                                   "/d/gebirge/room/schl",
                                                   "/d/gebirge/room/kueste",
                                                   "/d/gebirge/room/anhoehe",
                                                   "/d/gebirge/room/beisshoehle1",
                                                   "/d/gebirge/amynthor/maerchen/schloss",
                        })

Definiert in Zeile 36 der Datei www.walk.c.

Wird benutzt von Validate().

private string* PathsExclude = ({"/d/wald/room/hoehle/",})

Definiert in Zeile 50 der Datei www.walk.c.

Wird benutzt von Validate().

private mapping StartPoints
Initialisierung:
 ([ "Menschen" : "/gilden/abenteurer",
                                 "Zwerge"   : "/d/gebirge/room/zkapelle",
                                 "Elfen"    : "/d/wald/room/es_mitte",
                              ])

Definiert in Zeile 30 der Datei www.walk.c.

Wird benutzt von Request().

Erzeugt am Thu Jun 3 14:42:02 2010 für MorgenGrauen Mudlib von  doxygen 1.6.3