QueryProperties() ausgebaut
Change-Id: Ie49181e44ebc551361f5ade5824ee9b508947d75
diff --git a/p/daemon/finger.c b/p/daemon/finger.c
index 3cfe288..1d11869 100644
--- a/p/daemon/finger.c
+++ b/p/daemon/finger.c
@@ -17,6 +17,10 @@
* 02-05.Dez94 -n, -p
*
* Gelegentlich minor changes, zuletzt 04.Okt.95
+ *
+ * 2025-06-28 rumata
+ * Daten einzeln per QueryProp auslesen (da QueryProperties im
+ * playerobjekt nicht mehr geboten).
*/
#pragma strong_types,save_types
@@ -36,7 +40,7 @@
#define TP this_player()
#define wiz (local && IS_LEARNER(TP))
#define seer (local && IS_SEER(TP))
-#define IN ((properties[P_GENDER]==2)?"in":"")
+#define IN ((pdata->QueryProp(P_GENDER)==2)?"in":"")
#define FLAG_NOPLAN 1
@@ -58,6 +62,9 @@
filetime=0;
}
+mixed QueryProp( mixed key ) {
+ return properties[key];
+}
string timediff(int time)
{
@@ -120,6 +127,7 @@
int wizlevel,idle,flags,last;
mixed h,data,tmp;
object player,ob;
+ object pdata;
/*DEBUG### tell_object((find_player("loco")||this_object()),"Finger request: '"+str+"'("+local+")\n");/**/
str=lower_case(str);
@@ -168,39 +176,37 @@
if (player) {
hc_play=player->query_hc_play();
- properties=player->QueryProperties();
- properties[P_RACE]=player->QueryProp(P_RACE);
- properties[P_VISIBLE_GUILD]=player->QueryProp(P_VISIBLE_GUILD);
- properties[P_TITLE]=player->QueryProp(P_TITLE);
+ pdata = player;
tmp = player->QueryProp(P_PRESAY);
- properties[P_PRESAY]=(stringp(tmp) && sizeof(tmp)>1) ? tmp[0..<2] : 0;
+ //properties[P_PRESAY]=(stringp(tmp) && sizeof(tmp)>1) ? tmp[0..<2] : 0;
}
- else
+ else {
restore_object(SAVEPATH+str[0..0]+"/"+str);
- if (!properties)
- {
- text+="Mist!!! Das Einlesen der Daten klappt nicht wie es soll :-(\n";
- properties=0;
- if (!local)
- return text;
- write(text);
- return "";
+ if (!properties) {
+ text+="Mist!!! Das Einlesen der Daten klappt nicht wie es soll :-(\n";
+ if (!local)
+ return text;
+ write(text);
+ return "";
+ }
+ pdata = this_object();
}
+
if ( player && interactive(player) )
ipnum = query_ip_number(player);
else
- ipnum = properties[P_CALLED_FROM_IP];
+ ipnum = pdata->QueryProp(P_CALLED_FROM_IP);
// frueher stand in P_CALLED_FROM_IP evtl. auch der Name direkt drin
// anstelle der numerischen IP
- ip=query_ip_name(ipnum)||properties[P_CALLED_FROM_IP];
+ ip=query_ip_name(ipnum)||pdata->QueryProp(P_CALLED_FROM_IP);
if(player) {
if (!interactive(player) || (idle=query_idle(player))<MINIDLE)
idle=0;
if (!(invis=age=player->QueryProp(P_INVIS)))
age=player->QueryProp(P_AGE);
} else {
- if (properties[P_INVIS]) age=properties[P_INVIS];
- idle=properties[P_LAST_LOGOUT];
+ if (pdata->QueryProp(P_INVIS)) age=pdata->QueryProp(P_INVIS);
+ idle=pdata->QueryProp(P_LAST_LOGOUT);
}
wizlevel=query_wiz_level(str);
@@ -208,11 +214,10 @@
// Hack, um bei ganz "frischen" Spielern (noch kein Savefile vorhanden)
// die Ausgabe von 1.1.1970 zu verhindern
tmp = time();
- last=properties[P_LAST_LOGOUT];
+ last=pdata->QueryProp(P_LAST_LOGOUT);
if ( last <= 0 || (!(flags&FLAG_VIS_LOGOUT) && wiz && wizlevel > 10
- && properties[P_INVIS] && tmp - last > 300) )
+ && pdata->QueryProp(P_INVIS) && tmp - last > 300) )
last = tmp;
-
/* output routine for all */
if(player) {
h=player->QueryProp(P_RACE);
@@ -220,48 +225,48 @@
text+=capitalize(str)+" ist anwesend,\n"+
"und zwar von: "+
(wiz ? (ip+(ipnum?" ("+ipnum+")":"")):"")+
- (stringp(properties[P_LOCATION]) ? (wiz ? "\n [" : "")
- +capitalize(properties[P_LOCATION])+
- ((properties[P_LOCATION] != country(ip, ipnum))
+ (stringp(pdata->QueryProp(P_LOCATION)) ? (wiz ? "\n [" : "")
+ +capitalize(pdata->QueryProp(P_LOCATION))+
+ ((pdata->QueryProp(P_LOCATION) != country(ip, ipnum))
? " (ueber "+country(ip, ipnum)+")" : "" )
: (wiz?" [":"")+country(ip, ipnum))+(wiz ? "]":"")+".\n";
if(idle)
text+="Passiv seit: "+timediff(idle)+"\n";
if (local)
- text+="Eingeloggt seit: "+dtime(properties[P_LAST_LOGIN])+"\n";
- if (properties[P_AWAY])
- away="z.Z. abwesend, Grund : "+properties[P_AWAY]+"\n";
+ text+="Eingeloggt seit: "+dtime(pdata->QueryProp(P_LAST_LOGIN))+"\n";
+ if (pdata->QueryProp(P_AWAY))
+ away="z.Z. abwesend, Grund : "+pdata->QueryProp(P_AWAY)+"\n";
} else
text+=capitalize(str)+" ist nicht anwesend.\nZuletzt eingeloggt von: "+
(wiz ? (ip+(ipnum&&ipnum!=ip?" ("+ipnum+")":"")):"")+
- (stringp(properties[P_LOCATION]) ?
+ (stringp(pdata->QueryProp(P_LOCATION)) ?
(wiz ? "\n [": "")
- +capitalize(properties[P_LOCATION])+" (ueber "+country(ip, ipnum)+")":
+ +capitalize(pdata->QueryProp(P_LOCATION))+" (ueber "+country(ip, ipnum)+")":
(wiz?" [":"")+country(ip, ipnum))+(wiz ? "]":"")+".\n"+
"Zuletzt ausgeloggt: "+dtime(last)+" ("+timediff(time()-last)+").\n";
}
else {
text+=capitalize(str)+" ist nicht anwesend.\nZuletzt eingeloggt von: "+
(wiz ? (ip+(ipnum&&ipnum!=ip?" ("+ipnum+")":"")):"")+
- (stringp(properties[P_LOCATION]) ?
+ (stringp(pdata->QueryProp(P_LOCATION)) ?
(wiz ? "\n [": "")
- +capitalize(properties[P_LOCATION])+" (ueber "+country(ip, ipnum)+")":
+ +capitalize(pdata->QueryProp(P_LOCATION))+" (ueber "+country(ip, ipnum)+")":
(wiz?" [":"")+country(ip, ipnum))+(wiz ? "]":"")+".\n"+
"Zuletzt ausgeloggt: "+dtime(last)+" ("+timediff(time()-last)+").\n";
}
- text+="Voller Name: "+(((h=properties[P_PRESAY]) && h!="") ? h+" " : "")+
- capitalize((h=properties[P_NAME]) ? h : str)+" "+
- ((h=properties[P_TITLE]) ? h :
- ((mappingp(h=properties["guild_title"]) && (h=(h[properties[P_GUILD]?properties[P_GUILD]:"abenteurer"])) ) ? h : "") )
+ text+="Voller Name: "+(((h=pdata->QueryProp(P_PRESAY)) && h!="") ? h+" " : "")+
+ capitalize((h=pdata->QueryProp(P_NAME)) ? h : str)+" "+
+ ((h=pdata->QueryProp(P_TITLE)) ? h :
+ ((mappingp(h=pdata->QueryProp("guild_title")) && (h=(h[pdata->QueryProp(P_GUILD)?pdata->QueryProp(P_GUILD):"abenteurer"])) ) ? h : "") )
+"\n";
- if (properties[P_GHOST]) text+="Hoppla, ein Geist!\n";
- if ((flags&FLAG_LONG)&&properties[P_LONG])
- text+="Beschreibung: \n"+break_string(properties[P_LONG],78,2);
+ if (pdata->QueryProp(P_GHOST)) text+="Hoppla, ein Geist!\n";
+ if ((flags&FLAG_LONG)&&pdata->QueryProp(P_LONG))
+ text+="Beschreibung: \n"+break_string(pdata->QueryProp(P_LONG),78,2);
if(wiz ||
- (properties[P_SHOWEMAIL]=="alle") ||
- ( (properties[P_SHOWEMAIL]=="freunde") &&
+ (pdata->QueryProp(P_SHOWEMAIL)=="alle") ||
+ ( (pdata->QueryProp(P_SHOWEMAIL)=="freunde") &&
objectp(player) &&
this_player() &&
(ob=present("\n\bfband",player)) &&
@@ -269,8 +274,7 @@
pointerp(tmp=tmp[1]) &&
(member(tmp,getuid(this_player()))!=-1))) tmp = 1;
else tmp=0;
-
- string shell=properties[P_RACE];
+ string shell=pdata->QueryProp(P_RACE);
if (!stringp(shell))
{
shell = master()->query_userlist(str, USER_OBJECT);
@@ -282,48 +286,48 @@
if (!stringp(shell)) shell="<keine>";
int creation = master()->query_userlist(str, USER_CREATION_DATE);
text+="Rasse: "+shell+", Gilde: "+
- ((h=properties[P_VISIBLE_GUILD])?capitalize(h):((h=properties[P_GUILD])?capitalize(h):"Abenteurer"))+
- ((h=properties[P_VISIBLE_SUBGUILD_TITLE])?" ("+capitalize(h)+")":((h=properties[P_SUBGUILD_TITLE])?" ("+capitalize(h)+")":""))+
- ", Geschlecht: "+({"neutral ?!","maennlich","weiblich","<verdammt seltsam>"})[properties[P_GENDER]]+"\n"+
+ ((h=pdata->QueryProp(P_VISIBLE_GUILD))?capitalize(h):((h=pdata->QueryProp(P_GUILD))?capitalize(h):"Abenteurer"))+
+ ((h=pdata->QueryProp(P_VISIBLE_SUBGUILD_TITLE))?" ("+capitalize(h)+")":((h=pdata->QueryProp(P_SUBGUILD_TITLE))?" ("+capitalize(h)+")":""))+
+ ", Geschlecht: "+({"neutral ?!","maennlich","weiblich","<verdammt seltsam>"})[pdata->QueryProp(P_GENDER)]+"\n"+
(seer ? "Alter: "+timediff(age*HBINT)+", " : "")+
(wizlevel>=10?"Magierlevel: "+wizlevel+
(wizlevel>=GOD_LVL?" (Mudgott)":str=="boing"?" (Mudgott a.D.)":str=="muadib"?" (Apostolischer Visitator)":wizlevel>=ARCH_LVL?" (Erzmagier)":IS_DEPUTY(str)?" (Hilfssheriff)":wizlevel>=ELDER_LVL?" (Weiser)":wizlevel>=LORD_LVL?" (Regionsmagier)":wizlevel>=SPECIAL_LVL?" (Hilfsmagier)":wizlevel>=DOMAINMEMBER_LVL?" (Regionsmitarbeiter)":wizlevel>WIZARD_LVL?" (Vollmagier)":" (Lehrling)"):
- ("Spielerlevel: "+properties[P_LEVEL]+( wizlevel ? " (Seher"+IN+")" : "" )+
- (((h=properties[P_GUILD_LEVEL]) && h=h[properties[P_GUILD]]) ?
+ ("Spielerlevel: "+pdata->QueryProp(P_LEVEL)+( wizlevel ? " (Seher"+IN+")" : "" )+
+ (((h=pdata->QueryProp(P_GUILD_LEVEL)) && h=h[pdata->QueryProp(P_GUILD)]) ?
(", Gildenlevel: "+h) : "" )
)) + ((sprintf("\nDatum des ersten Login: %s",
(creation > 0) ? dtime(creation) : "vor dem 10. Nov 1995")))+
- (tmp ? ("\nE-Mail-Adresse: "+((h=properties[P_MAILADDR]) ? h : "keine")+"\n") : "\n");
+ (tmp ? ("\nE-Mail-Adresse: "+((h=pdata->QueryProp(P_MAILADDR)) ? h : "keine")+"\n") : "\n");
- if (properties[P_HOMEPAGE])
- text+="Homepage: "+properties[P_HOMEPAGE]+"\n";
+ if (pdata->QueryProp(P_HOMEPAGE))
+ text+="Homepage: "+pdata->QueryProp(P_HOMEPAGE)+"\n";
- if (stringp(data=properties[P_MESSENGER])) {
+ if (stringp(data=pdata->QueryProp(P_MESSENGER))) {
text+=sprintf("Messenger: %s", data);
- if (intp(data=properties[P_ICQ])) {
+ if (intp(data=pdata->QueryProp(P_ICQ))) {
if (data<0 && IS_WIZARD(this_player())) data*=-1;
if (data>0) text += sprintf(", ICQ: %d", data);
}
text+="\n";
} else
- if (intp(data=properties[P_ICQ])) {
+ if (intp(data=pdata->QueryProp(P_ICQ))) {
if (data<0 && IS_WIZARD(this_player()))
data*=-1;
if (data>0)
text+=sprintf("ICQ: %d\n",data);
}
- if (properties[P_MARRIED])
- text+="Verheiratet mit: "+capitalize(properties[P_MARRIED])+"\n";
+ if (pdata->QueryProp(P_MARRIED))
+ text+="Verheiratet mit: "+capitalize(pdata->QueryProp(P_MARRIED))+"\n";
- if ( pointerp(properties[P_SIBLINGS]) )
- text += ({ "Es", "Er", "Sie" })[properties[P_GENDER]] + " ist Bluts" +
+ if ( pointerp(pdata->QueryProp(P_SIBLINGS)) )
+ text += ({ "Es", "Er", "Sie" })[pdata->QueryProp(P_GENDER)] + " ist Bluts" +
({ "verwandt mit ", "bruder von ", "schwester von " })
- [properties[P_GENDER]] +
- CountUp(properties[P_SIBLINGS]) + ".\n";
+ [pdata->QueryProp(P_GENDER)] +
+ CountUp(pdata->QueryProp(P_SIBLINGS)) + ".\n";
text+=away;
-
+
if(MASTER->check_late_player(str))
{
text+=capitalize(str)+" hat uns leider fuer immer verlassen.\n";
@@ -334,22 +338,22 @@
text+=capitalize(str)+" will fruehestens "+h[TBANISH_EXTRACT];
}
- if (h=properties[P_TESTPLAYER])
+ if (h=pdata->QueryProp(P_TESTPLAYER))
{
text+=capitalize(str)+" ist Testspieler"+IN;
if (stringp(h)) text+=" ("+h+")";
text+=".\n";
}
- if ( h=properties[P_SECOND])
+ if ( h=pdata->QueryProp(P_SECOND))
{
if (IS_WIZARD(this_player())) {
text+=capitalize(str)+" ist";
- switch(properties[P_SECOND_MARK]) {
+ switch(pdata->QueryProp(P_SECOND_MARK)) {
case -1: text+=" unsichtbar markierte"
- +(properties[P_GENDER]!=FEMALE ? "r": "");
+ +(pdata->QueryProp(P_GENDER)!=FEMALE ? "r": "");
break;
case 0: text+=" nicht namentlich markierte"
- +(properties[P_GENDER]!=FEMALE ? "r": "");
+ +(pdata->QueryProp(P_GENDER)!=FEMALE ? "r": "");
break;
default:
}
@@ -358,19 +362,20 @@
text+=" ("+capitalize(h)+")";
text+=".\n";
}
- else if (properties[P_SECOND_MARK]>0)
+ else if (pdata->QueryProp(P_SECOND_MARK)>0)
{
text+=capitalize(str)+" ist Zweitspieler"+IN;
if (stringp(h))
text+=" ("+capitalize(h)+")";
text+=".\n";
}
- else if (properties[P_SECOND_MARK]>-1)
+ else if (pdata->QueryProp(P_SECOND_MARK)>-1)
text+=capitalize(str)+" ist Zweitspieler"+IN+".\n";
}
- if (properties[P_DEADS])
+
+ if (pdata->QueryProp(P_DEADS))
{
- text+="Bisher bereits "+properties[P_DEADS]+" mal gestorben\n";
+ text+="Bisher bereits "+pdata->QueryProp(P_DEADS)+" mal gestorben\n";
// Bezieht sich nur auf den Zeitraum ab dem 30.11.'94
}
if(hc_play==1)
@@ -381,11 +386,13 @@
{
text+=capitalize(str)+" ist am "+dtime(hc_play)+" in das Nirvana eingegangen.\n";
}
-
+
data=master()->query_userlist(str, USER_DOMAIN);
- if (sizeof(data))
+ if (sizeof(data)) {
text+="Regionsmagier"+IN+" von : "
+implode(map(data,#'capitalize),", ")+".\n";
+ }
+
data="/secure/master"->get_domain_homes(str);
data=filter(data-({"erzmagier"}),#'stringp);
if ((wizlevel>=DOMAINMEMBER_LVL) && (sizeof(data)))
@@ -399,8 +406,8 @@
// ggf. Avatar-URI mit ausgeben.
if (flags & FLAG_AVATAR
- && stringp(properties[P_AVATAR_URI]))
- text += "Avatar-URI: " + properties[P_AVATAR_URI] + "\n";
+ && stringp(pdata->QueryProp(P_AVATAR_URI)))
+ text += "Avatar-URI: " + pdata->QueryProp(P_AVATAR_URI) + "\n";
if (flags & FLAG_SPONSOR)
text+=sponsoring(str);
@@ -430,6 +437,7 @@
if (!local)
return text;
this_player()->More(text);
+ pdata=0;
return "";
}