#include "/secure/scoremaster.h"#include "/secure/wizlevels.h"#include <properties.h>#include <files.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | ZDEBUG(x) |
Funktionen | |
| public mapping | getFreeEKsForPlayer (object player) |
| public int | addTip (mixed key, string tip) |
| public int | changeTip (mixed key, string tip) |
| public int | removeTip (mixed key) |
| private string | getTipFromList (mixed key) |
| public string | getTip (mixed key) |
| public void | CheckNPCs (int num) |
| public void | check_all_player (mapping allplayer) |
| public varargs int | DumpNPCs (int sortkey) |
| private void | make_num (string key, int num, int score) |
| private int | allowed () |
| protected void | create () |
| public int | ClearUsersEKCache () |
| public mixed | QueryUsersEKCache () |
| public mixed | Query_free_num () |
| public mixed | Add_free_num (int what) |
| public mixed | Remove_free_num (int what) |
| public mixed | Query_to_change (string who) |
| public mixed | Add_to_change (string who, int what) |
| public mixed | Remove_to_change (string who, int what) |
| void | reset () |
| public varargs mixed | QueryNPC (int score) |
| public varargs mixed | NewNPC (string key, int score) |
| public varargs mixed | AddNPC (string key, int score) |
| public int | RestoreEK (string key, int bit, int score) |
| public int | ConfirmScore (mixed key) |
| public int | RejectScore (mixed key) |
| public void | DumpUnconfirmedScores () |
| public mapping | _query_unconfirmed () |
| public varargs int | SetScore (mixed key, int score) |
| public int * | MarkEKForLiquidation (mixed key) |
| public int * | UnmarkEKForLiquidation (mixed key) |
| public int * | QueryLiquidationMarks () |
| public int | RemoveScore (mixed key) |
| public varargs int | MoveScore (mixed oldkey, string newpath) |
| public string | QueryAllKills (string pl) |
| public string | QueryKills (string pl) |
| public int | QueryKillPoints (mixed pl) |
| public mixed * | QueryNPCbyNumber (int num) |
| protected mixed * | StaticQueryNPCbyNumber (int num) |
| public mixed * | QueryNPCbyObject (object o) |
| public int | GiveKill (object pl, int bit) |
| public int | HasKill (mixed pl, mixed npc) |
| private void | WriteDumpFile (string *keys) |
| public int | SetScoreBit (string pl, int bit) |
| public int | ClearScoreBit (string pl, int bit) |
| private status | ektipAllowed () |
| private string | _getTip (mixed key) |
| private string * | makeTiplistFromBitString (string bitstr) |
| public string * | QueryTipObjects (mixed player) |
| public string | allTipsForPlayer (object player) |
| public status | playerMayGetTip (object player) |
| public string | giveTipForPlayer (object player) |
| private void | LiquidateEK (int bit) |
| private void | check_player (string pl) |
Variablen | |
| private int | lastNum |
| private mapping | npcs = m_allocate(0,3) |
| private mapping | to_change = ([]) |
| private mapping | tipList = ([]) |
| private int * | free_num = ({}) |
| private int * | to_be_removed = ({}) |
| private mapping | unconfirmed_scores = ([]) |
| private nosave mapping | by_num = m_allocate(0,2) |
| private nosave mapping | users_ek = ([]) |
| private nosave string | active_eks = "" |
| #define ZDEBUG | ( | x | ) |
if (find_player("zesstra")) \ tell_object(find_player("zesstra"),sprintf("SCM: %s\n",x))
Definiert in Zeile 22 der Datei scoremaster.c.
| private string _getTip | ( | mixed | key | ) |
Definiert in Zeile 1030 der Datei scoremaster.c.
Benutzt getTipFromList(), npcs und path.
Wird benutzt von getTip().
01031 { 01032 string fn; 01033 string tip; 01034 string* path; 01035 01036 if ((!objectp(key) && !stringp(key))) 01037 return ""; 01038 01039 fn=load_name(key); 01040 01041 if(!member(npcs,fn)) return ""; 01042 01043 tip=getTipFromList(fn); 01044 if(!tip || tip==""){ 01045 path=explode(fn,"/")-({""}); 01046 if(sizeof(path)<3) return ""; 01047 if(path[0]=="players") 01048 return "Schau Dich doch mal bei "+capitalize(path[1])+" um."; 01049 01050 if(path[0]=="d"){ 01051 tip+="Schau Dich doch mal "; 01052 01053 if(file_size("/players/"+path[2])==-2){ 01054 tip+="bei "+capitalize(path[2]+" "); 01055 } 01056 01057 if(path[1]=="anfaenger") 01058 tip+="in den Anfaengergebieten "; 01059 if(path[1]=="fernwest") 01060 tip+="in Fernwest "; 01061 if(path[1]=="dschungel") 01062 tip+="im Dschungel "; 01063 if(path[1]=="schattenwelt") 01064 tip+="in der Welt der Schatten "; 01065 if(path[1]=="unterwelt") 01066 tip+="in der Unterwelt "; 01067 if(path[1]=="gebirge") 01068 tip+="im Gebirge "; 01069 if(path[1]=="seher") 01070 tip+="bei den Sehergebieten "; 01071 if(path[1]=="vland") 01072 tip+="auf dem Verlorenen Land "; 01073 if(path[1]=="ebene") 01074 tip+="in der Ebene "; 01075 if(path[1]=="inseln") 01076 tip+="auf den Inseln "; 01077 if(path[1]=="wald") 01078 tip+="im Wald "; 01079 if(path[1]=="erzmagier") 01080 tip+="bei den Erzmagiern "; 01081 if(path[1]=="polar") 01082 tip+="im eisigen Polar "; 01083 if(path[1]=="wueste") 01084 tip+="in der Wueste "; 01085 tip+="um."; 01086 } 01087 } 01088 return tip; 01089 }


| public mapping _query_unconfirmed | ( | ) |
Definiert in Zeile 471 der Datei scoremaster.c.
00471 { 00472 if (allowed()) return unconfirmed_scores; 00473 return 0; 00474 }
| public mixed Add_free_num | ( | int | what | ) |
Definiert in Zeile 125 der Datei scoremaster.c.
00126 { 00127 if (!allowed()) 00128 return SCORE_NO_PERMISSION; 00129 if (!what || !intp(what) || by_num[what]) 00130 return SCORE_INVALID_ARG; 00131 if (member(free_num,what)==-1) 00132 free_num+=({what}); 00133 save_object(SCORESAVEFILE); 00134 write_file(SCORELOGFILE,sprintf("ADDFREENUM: %s %5d (%s, %O)\n", 00135 strftime("%d%m%Y-%T",time()),what, 00136 geteuid(previous_object()), this_interactive())); 00137 00138 return free_num; 00139 }
| public mixed Add_to_change | ( | string | who, | |
| int | what | |||
| ) |
Definiert in Zeile 166 der Datei scoremaster.c.
00167 { 00168 if (!allowed()) 00169 return SCORE_NO_PERMISSION; 00170 if (!who || !stringp(who) || !what || !intp(what)) 00171 return SCORE_INVALID_ARG; 00172 if (member(to_change,who)) 00173 { 00174 to_change[who]-=({-what}); 00175 if (member(to_change[who],what)==-1) 00176 to_change[who]+=({what}); 00177 } 00178 else 00179 to_change[who]=({what}); 00180 save_object(SCORESAVEFILE); 00181 write_file(SCORELOGFILE,sprintf("ADDTOCHANGE: %s %s %5d (%s, %O)\n", 00182 strftime("%d%m%Y-%T",time()),who,what, 00183 geteuid(previous_object()), this_interactive())); 00184 return to_change[who]; 00185 }
| public varargs mixed AddNPC | ( | string | key, | |
| int | score | |||
| ) |
Definiert in Zeile 347 der Datei scoremaster.c.
| public int addTip | ( | mixed | key, | |
| string | tip | |||
| ) |
Definiert in Zeile 969 der Datei scoremaster.c.
Benutzt allowed, npcs, save_object(), SCORE_INVALID_ARG, SCORE_NO_PERMISSION, SCORESAVEFILE und tipList.
00970 { 00971 string fn; 00972 00973 if (!allowed()) 00974 return SCORE_NO_PERMISSION; 00975 00976 if (!tip || (!objectp(key) && !stringp(key))) 00977 return SCORE_INVALID_ARG; 00978 00979 fn=load_name(key); 00980 00981 if (!member(npcs, fn)) return SCORE_INVALID_ARG; 00982 tipList+=([fn:tip]); 00983 save_object(SCORESAVEFILE); 00984 00985 return 1; 00986 }

| private int allowed | ( | ) |
Definiert in Zeile 80 der Datei scoremaster.c.
Benutzt ARCH_SECURITY, process_call() und ROOTID.
00081 { 00082 if (previous_object() && geteuid(previous_object())==ROOTID) 00083 return 1; 00084 if (!process_call() && previous_object() && this_interactive() && ARCH_SECURITY) 00085 return 1; 00086 return 0; 00087 }

| public string allTipsForPlayer | ( | object | player | ) |
Definiert in Zeile 1157 der Datei scoremaster.c.
Benutzt IS_ARCH und QueryTipObjects().
01158 { 01159 01160 if(!player || !this_interactive() || 01161 (this_interactive()!=player && !IS_ARCH(this_interactive())) ) 01162 return ""; 01163 01164 string *tips = QueryTipObjects(player); 01165 01166 tips = map(tips, #'_getTip); 01167 tips -= ({0,""}); 01168 01169 return implode(tips, "\n"); 01170 }

| public int changeTip | ( | mixed | key, | |
| string | tip | |||
| ) |
Definiert in Zeile 988 der Datei scoremaster.c.
Benutzt addTip().
00989 { 00990 return addTip(key,tip); 00991 }

| public void check_all_player | ( | mapping | allplayer | ) |
Definiert in Zeile 1357 der Datei scoremaster.c.
Benutzt allowed, call_out(), master, NPC_COUNT, npcs und WERKILLTWEN.
01357 { 01358 01359 if (extern_call() && !allowed()) 01360 return; 01361 01362 if (!mappingp(allplayer)) { 01363 foreach(string key: npcs) { 01364 npcs[key,NPC_COUNT]=0; 01365 } 01366 allplayer=(mapping)master()->get_all_players(); 01367 rm(WERKILLTWEN); 01368 call_out(#'check_all_player,2,allplayer); 01369 return; 01370 } 01371 01372 // offenbar fertig mit allen Spielern, jetzt noch den Rest erledigen. 01373 if (!sizeof(allplayer)) { 01374 foreach(int bit: to_be_removed) { 01375 LiquidateEK(bit); 01376 } 01377 to_be_removed=({}); 01378 save_object(SCORESAVEFILE); 01379 ZDEBUG("Spielerchecks und EK-Liquidation fertig.\n"); 01380 return; 01381 } 01382 01383 string dir=m_indices(allplayer)[0]; 01384 string *pls=allplayer[dir]; 01385 foreach(string pl: pls) { 01386 if (get_eval_cost() < 1250000) 01387 break; // spaeter weitermachen. 01388 catch(check_player(pl) ; publish); 01389 pls-=({pl}); 01390 } 01391 allplayer[dir] = pls; 01392 01393 if (!sizeof(allplayer[dir])) 01394 efun::m_delete(allplayer,dir); 01395 01396 call_out(#'check_all_player,2,allplayer); 01397 }

| private void check_player | ( | string | pl | ) |
Definiert in Zeile 1294 der Datei scoremaster.c.
Benutzt by_num, BYNUM_KEY, changed, CountUp(), EKCLEANLOG, ektips, master, NPC_COUNT, npcs, p, SCORECHECKFILE, strftime(), to_be_removed und WERKILLTWEN.
01294 { 01295 int changed, changed2; 01296 01297 // EKs pruefen 01298 string eks=(string)master()->query_ek(pl) || ""; 01299 string *opfer=allocate( (sizeof(eks)*6)+1, ""); 01300 int p=-1; 01301 while ((p=next_bit(eks,p)) != -1) { 01302 if (!member(by_num, p)) { 01303 write_file(SCORECHECKFILE, sprintf( 01304 "UNKNOWNEK %s %5d in %s gefunden.\n", 01305 strftime("%d%m%Y-%T",time()), p, pl)); 01306 } 01307 // wenn das aktuelle Bit geloescht werden soll, also in to_be_removed 01308 // steht... 01309 if (member(to_be_removed,p) != -1) { 01310 eks = clear_bit(eks,p); 01311 changed=1; 01312 write_file(EKCLEANLOG,sprintf( 01313 "CLEARBIT: %s %O %5d %s\n", 01314 strftime("%d%m%Y-%T",time()), pl, p, 01315 by_num[p,BYNUM_KEY] || "NoName")); 01316 } 01317 else { 01318 // sonst statistikpflege 01319 npcs[by_num[p,BYNUM_KEY],NPC_COUNT]++; 01320 // loggen, welche NPC der Spieler hat 01321 opfer[p]=to_string(p); 01322 } 01323 } 01324 // und noch die Ek-Tips... 01325 string ektips = (string)master()->query_ektips(pl) || ""; 01326 p = -1; 01327 while ((p=next_bit(ektips,p)) != -1) { 01328 if (!member(by_num, p)) { 01329 write_file(EKCLEANLOG, sprintf( 01330 "UNKNOWNEK %s %5d in %s (EKTips) gefunden - clearing.\n", 01331 strftime("%d%m%Y-%T",time()), p, pl)); 01332 ektips = clear_bit(ektips, p); // hier direkt loeschen. 01333 changed2 = 1; 01334 } 01335 // wenn das aktuelle Bit geloescht werden soll, also in to_be_removed 01336 // steht... 01337 else if (member(to_be_removed,p) != -1) { 01338 ektips = clear_bit(ektips,p); 01339 changed2=1; 01340 write_file(EKCLEANLOG,sprintf( 01341 "CLEAREKTIP: %s %O %5d %s\n", 01342 strftime("%d%m%Y-%T",time()), pl, p, 01343 by_num[p,BYNUM_KEY] || "NoName")); 01344 } 01345 } 01346 01347 if (changed) { 01348 master()->update_ek(pl, eks); 01349 } 01350 if (changed2) { 01351 master()->update_ektips(pl, ektips); 01352 } 01353 opfer-=({""}); 01354 write_file(WERKILLTWEN,sprintf("%s\n%=-78s\n\n",pl,CountUp(opfer)||"")); 01355 }

| public void CheckNPCs | ( | int | num | ) |
Definiert in Zeile 1242 der Datei scoremaster.c.
01242 { 01243 string fn; 01244 object ekob; 01245 if (!num) rm(SCORECHECKFILE); 01246 while (num <= lastNum && get_eval_cost() > 1480000) { 01247 if (!by_num[num,1] || !by_num[num,0]) { 01248 num++; 01249 continue; 01250 } 01251 fn = by_num[num,0] + ".c"; 01252 if (file_size(fn) <= 0) { 01253 // File nicht existent 01254 write_file(SCORECHECKFILE, sprintf( 01255 "EK %.4d ist nicht existent (%s)\n",num,fn)); 01256 } 01257 else if (catch(ekob=load_object(fn)) || !objectp(ekob) ) { 01258 // NPC offenbar nicht ladbar. 01259 write_file(SCORECHECKFILE, sprintf( 01260 "EK %.4d ist nicht ladbar (%s)\n",num,fn)); 01261 } 01262 num++; 01263 } 01264 ZDEBUG(sprintf("%d NPC checked",num)); 01265 if (num <= lastNum) 01266 call_out(#'CheckNPCs,4,num); 01267 else 01268 ZDEBUG("Finished!"); 01269 }
| public int ClearScoreBit | ( | string | pl, | |
| int | bit | |||
| ) |
Definiert in Zeile 882 der Datei scoremaster.c.
Benutzt allowed, by_num, BYNUM_KEY, BYNUM_SCORE, ek, m_delete(), MASTER, NPC_COUNT, npcs, SCORE_NO_PERMISSION, SCORELOGFILE, strftime() und users_ek.
00883 { 00884 string ek; 00885 00886 if (!allowed()) 00887 return SCORE_NO_PERMISSION; 00888 00889 ek = (MASTER->query_ek(pl) || ""); 00890 ek = clear_bit(ek, bit); 00891 MASTER->update_ek(pl, ek); 00892 00893 // Vergabestatistik runterzaehlen. 00894 npcs[by_num[bit,BYNUM_KEY],NPC_COUNT]--; 00895 00896 if (member(users_ek, pl)) 00897 users_ek = m_delete(users_ek, pl); 00898 00899 write_file(SCORELOGFILE,sprintf( 00900 "CLEARBIT: %s %s %5d Sc: %.3d %s (%s, %O)\n", 00901 strftime("%d%m%Y-%T",time()),pl,bit, 00902 by_num[bit,BYNUM_SCORE],by_num[bit,BYNUM_KEY], 00903 geteuid(previous_object()), this_interactive())); 00904 return 1; 00905 }

| public int ClearUsersEKCache | ( | ) |
Definiert in Zeile 103 der Datei scoremaster.c.
00104 { 00105 if (!allowed()) 00106 return SCORE_NO_PERMISSION; 00107 users_ek = ([]); 00108 return 1; 00109 }
| public int ConfirmScore | ( | mixed | key | ) |
Definiert in Zeile 376 der Datei scoremaster.c.
00376 { 00377 // Bits in den Spielern in unconfirmed_scores setzen und Statistik 00378 // hochzaehlen 00379 // Bit in active_eks setzen 00380 // Eintrag aus unconfirmed_scores loeschen 00381 int bit; 00382 00383 if (!allowed()) return SCORE_NO_PERMISSION; 00384 if (stringp(key) && member(npcs,key)) { 00385 bit = npcs[key, NPC_NUMBER]; 00386 } 00387 else if (intp(key) && member(by_num,key)) { 00388 bit = key; 00389 } 00390 else 00391 return SCORE_INVALID_ARG; 00392 00393 if (!member(unconfirmed_scores, bit)) 00394 return SCORE_INVALID_ARG; 00395 00396 string obname = by_num[bit, BYNUM_KEY]; 00397 int score = by_num[bit,BYNUM_SCORE]; 00398 00399 foreach(string pl: unconfirmed_scores[bit]) { 00400 string eks = (string)master()->query_ek(pl); 00401 eks = set_bit(eks, bit); 00402 master()->update_ek(pl, eks); 00403 write_file(SCOREAUTOLOG, sprintf( 00404 "SETBIT: %s %5d %s\n", 00405 strftime("%d%m%Y-%T",time()), bit, pl)); 00406 } 00407 //Vergabestatistik hochzaehlen... 00408 npcs[obname,NPC_COUNT]+=sizeof(unconfirmed_scores[bit]); 00409 00410 efun::m_delete(unconfirmed_scores, bit); 00411 active_eks = set_bit(active_eks, bit); 00412 save_object(SCORESAVEFILE); 00413 00414 write_file(SCORELOGFILE,sprintf( 00415 "CONFIRMNPC: %s %5d Score %3d %s [%s, %O]\n", 00416 strftime("%d%m%Y-%T",time()), bit, score, obname, 00417 getuid(previous_object()),this_interactive())); 00418 00419 return 1; 00420 }
| protected void create | ( | ) |
Definiert in Zeile 89 der Datei scoremaster.c.
Benutzt lastNum, npcs, restore_object(), SCORESAVEFILE, tipList und to_change.
00090 { 00091 seteuid(getuid()); 00092 if (!restore_object(SCORESAVEFILE)) 00093 { 00094 lastNum=0; 00095 npcs=m_allocate(0,3); 00096 to_change=m_allocate(0,1); 00097 tipList=([]); 00098 } 00099 npcs-=([0]); 00100 walk_mapping(npcs, #'make_num); 00101 }

| public varargs int DumpNPCs | ( | int | sortkey | ) |
Definiert in Zeile 843 der Datei scoremaster.c.
00843 { 00844 00845 if (extern_call() && !allowed()) return SCORE_NO_PERMISSION; 00846 if (!intp(sortkey)) return SCORE_INVALID_ARG; 00847 00848 rm(SCOREDUMPFILE); 00849 00850 // sortieren 00851 string *keys=sort_array(m_indices(npcs), function int (string a, string b) { 00852 return(npcs[a,sortkey] < npcs[b,sortkey]); } ); 00853 call_out(#'WriteDumpFile, 2, keys); 00854 00855 return 1; 00856 }
| public void DumpUnconfirmedScores | ( | ) |
Definiert in Zeile 460 der Datei scoremaster.c.
00460 { 00461 if (!objectp(this_player())) return; 00462 00463 write(sprintf("%5s %5s %4s %s\n", 00464 "Nr.", "Cnt", "Sc", "Objekt")); 00465 foreach(int bit, string *pls: unconfirmed_scores) { 00466 write(sprintf("%5d %5d %4d %s\n", 00467 bit, sizeof(pls), by_num[bit,BYNUM_SCORE], by_num[bit,BYNUM_KEY])); 00468 } 00469 }
| private status ektipAllowed | ( | ) |
Definiert in Zeile 907 der Datei scoremaster.c.
Benutzt allowed, EKTIPGIVER und EKTIPLIST.
Wird benutzt von getFreeEKsForPlayer(), getTip() und getTipFromList().
00908 { 00909 status poOK; 00910 string poName; 00911 status ret; 00912 00913 poName=load_name(previous_object()); 00914 poOK=previous_object() && 00915 ((previous_object()==find_object(EKTIPGIVER)) || (poName==EKTIPLIST) ); 00916 00917 ret=allowed() || 00918 (this_player() && this_interactive() && previous_object() && 00919 this_interactive()==this_player() && poOK); 00920 return ret; 00921 }

| public mapping getFreeEKsForPlayer | ( | object | player | ) |
Definiert in Zeile 925 der Datei scoremaster.c.
Benutzt active_eks, by_num, count_bits(), ektipAllowed(), ektips, master und p.
00926 { 00927 if(!ektipAllowed() || !objectp(player) || !query_once_interactive(player)){ 00928 return ([]); 00929 } 00930 // alle EKs, die der Spieler hat 00931 string eks = (string)master()->query_ek(getuid(player)); 00932 // als Tips kommen alle in Frage, die er nicht hat, vor dem Invertieren muss 00933 // aber sichergestellt werden, dass eks min. so lang ist wie active_eks, da 00934 // die Invertierung ja z.B. nur EKs 0-1700 beruecksichtigt, wenn 1700 der 00935 // hoechste EK im Spieler ist und dann als Tips alle EKs ueber 00936 // 1700 verlorengingen. 00937 // hier wird das letzte Bit von active_eks ermittelt und das darauf folgende 00938 // Bit im Spieler-EK-String gesetzt und wieder geloescht, woraufhin der 00939 // EK-String min. so lang wie active_eks ist. (es ist egal, wenn er 00940 // laenger ist, auch egal, wenn man ein Bit ueberschreibt, das faellt alles 00941 // gleich beim and_bits() raus. 00942 int lb = last_bit(active_eks) + 1; 00943 eks = clear_bit(set_bit(eks, lb), lb); 00944 // jetzt invertieren 00945 string non_eks = invert_bits(eks); 00946 // jetzt vorhande EK-Tips ausfiltern. Im Prinzip gleiches Spiel wie oben. 00947 string ektips = (string)master()->query_ektips(getuid(player)); 00948 // jetzt alle nicht als Tip vergebenen NPC ermitteln, vor dem Invertieren 00949 // wieder Laenge angleichen... 00950 ektips = invert_bits(clear_bit(set_bit(ektips, lb), lb)); 00951 // verunden liefert EKs, die der Spieler nicht hat und nicht als Tip hat 00952 ektips = and_bits(ektips, non_eks); 00953 00954 // und nun die inaktive EKs ausfiltern, nochmal verunden 00955 ektips = and_bits(ektips, active_eks); 00956 00957 // mal Platz reservieren, entsprechend der Menge an Bits 00958 mapping freeKills = m_allocate( count_bits(ektips), 2); 00959 // durch alle jetzt gesetzten Bits laufen, d.h. alle EKs, die der Spieler 00960 // nicht hat und ein Mapping a la npcs erstellen. 00961 int p=-1; 00962 while ( (p=next_bit(ektips, p)) != -1) { 00963 freeKills += ([ by_num[p,0]: p; by_num[p,1] ]); 00964 } 00965 00966 return freeKills; 00967 }

| public string getTip | ( | mixed | key | ) |
Definiert in Zeile 1092 der Datei scoremaster.c.
Benutzt _getTip(), ektipAllowed() und path.
01093 { 01094 string fn; 01095 string tip; 01096 string* path; 01097 01098 if (!ektipAllowed()) 01099 return ""; 01100 01101 return _getTip(key); 01102 }

| private string getTipFromList | ( | mixed | key | ) |
Definiert in Zeile 1013 der Datei scoremaster.c.
Benutzt ektipAllowed() und tipList.
Wird benutzt von _getTip().
01014 { 01015 string fn; 01016 01017 if (!ektipAllowed()) 01018 return ""; 01019 01020 if ((!objectp(key) && !stringp(key))) 01021 return ""; 01022 01023 fn=load_name(key); 01024 01025 if (!member(tipList, fn)) return ""; 01026 01027 return tipList[fn]; 01028 }


| public int GiveKill | ( | object | pl, | |
| int | bit | |||
| ) |
Definiert in Zeile 758 der Datei scoremaster.c.
00759 { 00760 mixed info; 00761 object po; 00762 int drin; 00763 string pls, ek; 00764 00765 00766 if (!pointerp(info = StaticQueryNPCbyNumber(bit))) 00767 return -1; 00768 00769 if ((!po=previous_object()) 00770 || load_name(po) != info[SCORE_KEY]) 00771 return -2; 00772 00773 pls=getuid(pl); 00774 00775 // wenn unbestaetigt, Spieler fuer spaeter merken 00776 if (member(unconfirmed_scores, bit)) { 00777 if (member(unconfirmed_scores[bit], pls) == -1) 00778 unconfirmed_scores[bit] += ({pls}); 00779 } 00780 else { 00781 // sonst wird das Bit direkt im Spieler gesetzt. 00782 ek = (MASTER->query_ek(pls) || ""); 00783 if (test_bit(ek, bit)) 00784 return -3; 00785 ek = set_bit(ek, bit); 00786 MASTER->update_ek(pls, ek); 00787 // Vergabestatistik hochzaehlen. 00788 npcs[by_num[bit,BYNUM_KEY],NPC_COUNT]++; 00789 } 00790 00791 if (member(users_ek, pls)) 00792 users_ek = m_delete(users_ek, pls); 00793 00794 EK_GIVENLOG(sprintf("%s: %s", info[SCORE_KEY], pls)); 00795 00796 return info[SCORE_SCORE]; 00797 }
| public string giveTipForPlayer | ( | object | player | ) |
Definiert in Zeile 1207 der Datei scoremaster.c.
01208 { 01209 string* tmp; 01210 mapping free; 01211 string tip,pl,ektip; 01212 int index; 01213 01214 if(!ektipAllowed() || !player || 01215 !query_once_interactive(player) || !playerMayGetTip(player)) 01216 return ""; 01217 01218 pl=getuid(player); 01219 free=getFreeEKsForPlayer(player); 01220 01221 if(!mappingp(free) || sizeof(free)==0) 01222 return ""; 01223 01224 tmp=m_indices(free); 01225 01226 ektip=(string)MASTER->query_ektips(pl) || ""; 01227 01228 foreach(int i: EKTIPS_MAX_RETRY) { 01229 index=random(sizeof(tmp)); 01230 tip=getTip(tmp[index]); 01231 if (stringp(tip) && strlen(tip)) { 01232 ektip=set_bit(ektip,npcs[tmp[index],NPC_NUMBER]); 01233 MASTER->update_ektips(pl,ektip); 01234 break; //fertig 01235 } 01236 } 01237 01238 return tip; 01239 }
| public int HasKill | ( | mixed | pl, | |
| mixed | npc | |||
| ) |
Definiert in Zeile 799 der Datei scoremaster.c.
00800 { 00801 string fn, *pls; 00802 00803 if (!objectp(pl) && !stringp(pl) && !objectp(npc) && !stringp(npc)) 00804 return 0; 00805 if (!stringp(pl)) 00806 pl=getuid(pl); 00807 00808 fn=load_name(npc); 00809 00810 if (!member(npcs, fn)) return 0; 00811 00812 int bit = npcs[fn, NPC_NUMBER]; 00813 00814 if (pointerp(pls=unconfirmed_scores[bit]) && 00815 member(pls,pl) != -1) 00816 return 1; 00817 00818 string eks = (MASTER->query_ek(pl) || ""); 00819 00820 return test_bit(eks, bit); 00821 }
| private void LiquidateEK | ( | int | bit | ) |
Definiert in Zeile 1273 der Datei scoremaster.c.
Benutzt active_eks, by_num, BYNUM_KEY, BYNUM_SCORE, free_num, m_delete(), NPC_NUMBER, npcs, removeTip(), score(), SCOREAUTOLOG, strftime() und unconfirmed_scores.
01273 { 01274 01275 if (!intp(bit) || bit < 0) return; 01276 01277 string obname = by_num[bit, BYNUM_KEY]; 01278 int score = by_num[bit, BYNUM_SCORE]; 01279 01280 if (member(npcs, obname) && (npcs[obname, NPC_NUMBER] == bit)) { 01281 efun::m_delete(by_num, bit); 01282 efun::m_delete(npcs, obname); 01283 if (member(unconfirmed_scores,bit)) 01284 efun::m_delete(unconfirmed_scores,bit); 01285 active_eks = clear_bit(active_eks,bit); 01286 removeTip(obname); 01287 free_num += ({bit}); 01288 write_file(SCOREAUTOLOG,sprintf( 01289 "LIQUIDATEEK: %s %5d Score %3d %s\n", 01290 strftime("%d%m%Y-%T",time()), bit, score, obname)); 01291 } 01292 }

| private void make_num | ( | string | key, | |
| int | num, | |||
| int | score | |||
| ) |
Definiert in Zeile 71 der Datei scoremaster.c.
Benutzt active_eks, by_num und unconfirmed_scores.
00071 { 00072 by_num += ([ num : key; score ]); 00073 // fuer aktive EKs, die also einen Scorewert > 0 haben, wird das jeweilige 00074 // Bit gesetzt. Wird spaeter zum Ausfiltern inaktiver EKs aus den Bitstrings 00075 // in den Spieler gebraucht. 00076 if (score>0 && !member(unconfirmed_scores,num)) 00077 active_eks = set_bit(active_eks, num); 00078 }
| private string* makeTiplistFromBitString | ( | string | bitstr | ) |
Definiert in Zeile 1106 der Datei scoremaster.c.
Benutzt by_num, count_bits(), i und p.
Wird benutzt von QueryTipObjects().
01107 { 01108 string * ret= allocate(count_bits(bitstr)); 01109 // ueber alle gesetzten bits laufen und Array zusammensammeln 01110 int i; 01111 int p=-1; 01112 while ((p=next_bit(bitstr,p)) != -1) { 01113 ret[i] = by_num[p, 0]; 01114 i++; 01115 } 01116 // zur Sicherheit 01117 ret -= ({0}); 01118 01119 return ret; 01120 }


| public int* MarkEKForLiquidation | ( | mixed | key | ) |
Definiert in Zeile 528 der Datei scoremaster.c.
Benutzt NPC_NUMBER und npcs.
00528 { 00529 int bit; 00530 if (!allowed()) 00531 return 0; 00532 // nicht in to_be_removed aendern, wenn check_all_player() laeuft. 00533 if (find_call_out(#'check_all_player) != -1) 00534 return 0; 00535 00536 if (stringp(key) && strlen(key)) { 00537 if (!member(npcs,key)) return 0; 00538 bit = npcs[key,NPC_NUMBER]; 00539 } 00540 else if (intp(key) && key>=0) { 00541 bit = key; 00542 } 00543 else 00544 return 0; 00545 00546 if (member(to_be_removed,bit) == -1) 00547 to_be_removed += ({bit}); 00548 write_file(SCORELOGFILE,sprintf("DELETEFLAG: %s %5d %s (%s, %O)\n", 00549 strftime("%d%m%Y-%T",time()), bit, by_num[bit,BYNUM_KEY] || "NoName", 00550 geteuid(previous_object()), this_interactive())); 00551 00552 save_object(SCORESAVEFILE); 00553 00554 return to_be_removed; 00555 }
| public varargs int MoveScore | ( | mixed | oldkey, | |
| string | newpath | |||
| ) |
Definiert in Zeile 641 der Datei scoremaster.c.
00642 { 00643 int num,score; 00644 string oldpath; 00645 string tip; 00646 00647 if (!allowed()) 00648 return SCORE_NO_PERMISSION; 00649 if (!stringp(newpath)) 00650 return SCORE_INVALID_ARG; 00651 00652 if (stringp(oldkey)) { 00653 oldkey = load_name(oldkey); 00654 num=npcs[oldkey,NPC_NUMBER]; 00655 } 00656 else if (intp(oldkey)) num=oldkey; 00657 else return SCORE_INVALID_ARG; 00658 00659 if (!member(by_num,num)) return SCORE_INVALID_ARG; 00660 00661 tip=getTipFromList(oldkey); 00662 oldpath = by_num[num, BYNUM_KEY]; 00663 score = by_num[num, BYNUM_SCORE]; 00664 00665 if (member(npcs, oldpath)) { 00666 efun::m_delete(npcs, oldpath); 00667 removeTip(oldkey); 00668 if(tip!="") addTip(newpath,tip); 00669 npcs[newpath, NPC_SCORE] = score; 00670 npcs[newpath, NPC_NUMBER] = num; 00671 } 00672 else return SCORE_INVALID_ARG; 00673 00674 by_num += ([num: newpath; score]); 00675 00676 ClearUsersEKCache(); 00677 save_object(SCORESAVEFILE); 00678 write_file(SCORELOGFILE,sprintf("MOVESCORE: %s %s %s (%s, %O)\n", 00679 strftime("%d%m%Y-%T",time()),oldpath,newpath, 00680 geteuid(previous_object()),this_interactive())); 00681 00682 while(remove_call_out("DumpNPCs") != -1) ; 00683 call_out("DumpNPCs",60); 00684 return 1; 00685 }
| public varargs mixed NewNPC | ( | string | key, | |
| int | score | |||
| ) |
Definiert in Zeile 310 der Datei scoremaster.c.
00311 { 00312 int val; 00313 00314 if (!allowed()) 00315 return SCORE_NO_PERMISSION; 00316 if (!key || !stringp(key)) 00317 return SCORE_INVALID_ARG; 00318 00319 key = load_name(key); 00320 if (val=npcs[key,NPC_NUMBER]) 00321 return ({val,npcs[key,NPC_SCORE]}); 00322 if (score<=0) 00323 return SCORE_INVALID_ARG; 00324 00325 if (sizeof(free_num)) { 00326 val=free_num[0]; 00327 free_num=free_num[1..]; 00328 } 00329 else val=++lastNum; 00330 00331 npcs[key,NPC_SCORE] = score; 00332 npcs[key,NPC_NUMBER] = val; 00333 npcs[key,NPC_COUNT] = 0; 00334 by_num += ([val: key; score]); 00335 active_eks = set_bit(active_eks, val); 00336 00337 ClearUsersEKCache(); 00338 save_object(SCORESAVEFILE); 00339 write_file(SCORELOGFILE,sprintf("NEWNPC: %s %5d %4d %s (%s, %O)\n", 00340 strftime("%d%m%Y-%T",time()),val,score,key, 00341 geteuid(previous_object()), this_interactive())); 00342 while(remove_call_out("DumpNPCs") != -1) ; 00343 call_out("DumpNPCs",60); 00344 return ({val,score}); 00345 }
| public status playerMayGetTip | ( | object | player | ) |
Definiert in Zeile 1172 der Datei scoremaster.c.
01173 { 01174 int numElegible; 01175 int numReceived; 01176 int lvl; 01177 int i; 01178 string tips; 01179 01180 if(!ektipAllowed() || !player || !query_once_interactive(player)) 01181 return 0; 01182 01183 if(!player || !query_once_interactive(player)) 01184 return 0; 01185 01186 lvl=(int)player->QueryProp(P_LEVEL); 01187 numElegible=0; 01188 i=sizeof(EKTIPS_LEVEL_LIMITS)-1; 01189 01190 if(lvl>EKTIPS_LEVEL_LIMITS[i]) 01191 numElegible+=(lvl-EKTIPS_LEVEL_LIMITS[i]); 01192 01193 for(i;i>=0;i--){ 01194 if(lvl>=EKTIPS_LEVEL_LIMITS[i]) numElegible++; 01195 } 01196 01197 tips=(string)MASTER->query_ektips(getuid(player)) || ""; 01198 // inaktive EKs ausfiltern. 01199 tips = and_bits(tips, active_eks); 01200 // und Gesamtzahl an Tips zaehlen. Hier werden erledigte Tips explizit nicht 01201 // ausgefiltert! 01202 numReceived=count_bits(tips); 01203 01204 return numElegible>numReceived; 01205 }
| public mixed Query_free_num | ( | ) |
Definiert in Zeile 118 der Datei scoremaster.c.
00119 { 00120 if (!allowed()) 00121 return SCORE_NO_PERMISSION; 00122 return free_num; 00123 }
| public mixed Query_to_change | ( | string | who | ) |
Definiert in Zeile 155 der Datei scoremaster.c.
| public string QueryAllKills | ( | string | pl | ) |
Definiert in Zeile 689 der Datei scoremaster.c.
| public int QueryKillPoints | ( | mixed | pl | ) |
Definiert in Zeile 703 der Datei scoremaster.c.
00703 { 00704 00705 if (!allowed() && 00706 (!previous_object() 00707 || strstr(object_name(previous_object()), "/gilden/") != 0) ) 00708 return 0; 00709 00710 if (!stringp(pl)) pl=getuid(pl); 00711 00712 if (member(users_ek,pl)) return users_ek[pl]; 00713 00714 string s = (MASTER->query_ek(pl) || ""); 00715 00716 int p=-1; 00717 int summe; 00718 while ((p=next_bit(s,p)) != -1) { 00719 summe+=by_num[p,BYNUM_SCORE]; 00720 } 00721 00722 users_ek += ([pl:summe]); 00723 return summe; 00724 }
| public string QueryKills | ( | string | pl | ) |
Definiert in Zeile 696 der Datei scoremaster.c.
00696 { 00697 string res = (string)MASTER->query_ek(pl) || ""; 00698 // vergleichen mit den aktiven EKs aus active_eks und nur jene Bits 00699 // zurueckliefern, die in beiden Strings gesetzt sind. 00700 return and_bits(res,active_eks); 00701 }
| public int* QueryLiquidationMarks | ( | ) |
Definiert in Zeile 586 der Datei scoremaster.c.
00586 { 00587 if (allowed()) 00588 return to_be_removed; 00589 else 00590 return 0;; 00591 }
| public varargs mixed QueryNPC | ( | int | score | ) |
Definiert in Zeile 260 der Datei scoremaster.c.
00261 { 00262 string key; 00263 int val; 00264 00265 if (!previous_object()) 00266 return SCORE_INVALID_ARG; 00267 00268 key = load_name(previous_object()); 00269 00270 // schon bekannter EK? 00271 if (member(npcs,key)) 00272 return ({npcs[key,NPC_NUMBER],npcs[key,NPC_SCORE]}); 00273 00274 if (score<=0 || 00275 member(inherit_list(previous_object()),"/std/living/life.c") < 0) 00276 return SCORE_INVALID_ARG; 00277 00278 if (key[0..8]=="/players/") return SCORE_INVALID_ARG; 00279 00280 if (score>2) score=2; 00281 00282 if (sizeof(free_num)) { 00283 val = free_num[0]; 00284 free_num -= ({val}); 00285 } 00286 else val=++lastNum; 00287 00288 npcs[key,NPC_SCORE] = score; 00289 npcs[key,NPC_NUMBER] = val; 00290 npcs[key,NPC_COUNT] = 0; 00291 by_num += ([val: key; score]); 00292 // werden noch nicht als aktive EKs gewertet, damit sie nicht als Ek-Tips 00293 // vergben werden. 00294 //active_eks = set_bit(active_eks, val); 00295 00296 unconfirmed_scores += ([ val: ({}) ]); 00297 00298 ClearUsersEKCache(); 00299 save_object(SCORESAVEFILE); 00300 write_file(SCOREAUTOLOG,sprintf( 00301 "ADDNPC: %s %5d %4d %s (UID: %s, TI: %O, TP: %O)\n", 00302 strftime("%d%m%Y-%T",time()),val,score,key, 00303 getuid(previous_object()), this_interactive(), this_player())); 00304 00305 while(remove_call_out("DumpNPCs") != -1) ; 00306 call_out("DumpNPCs",60); 00307 return ({val,score}); 00308 }
| public mixed* QueryNPCbyNumber | ( | int | num | ) |
Definiert in Zeile 726 der Datei scoremaster.c.
| public mixed* QueryNPCbyObject | ( | object | o | ) |
Definiert in Zeile 745 der Datei scoremaster.c.
00746 { 00747 string key; 00748 int val; 00749 00750 key=load_name(o); 00751 if (member(npcs,key)) { 00752 val = npcs[key,NPC_NUMBER]; 00753 return ({val, by_num[val, BYNUM_SCORE], by_num[val, BYNUM_KEY]}); 00754 } 00755 return 0; 00756 }
| public string* QueryTipObjects | ( | mixed | player | ) |
Definiert in Zeile 1123 der Datei scoremaster.c.
Benutzt active_eks, allowed, makeTiplistFromBitString() und master.
Wird benutzt von allTipsForPlayer().
01123 { 01124 01125 if (extern_call() && !allowed()) 01126 return 0; 01127 if (objectp(player) && query_once_interactive(player)) 01128 player=getuid(player); 01129 if (!stringp(player)) 01130 return 0; 01131 01132 string tipstr=(string)master()->query_ektips(player); 01133 // jetzt EK-Tips ausfiltern, die erledigt sind. Dazu EK-Liste holen... 01134 string eks=(string)master()->query_ek(player); 01135 // als Tips kommen alle in Frage, die er nicht hat, vor dem Invertieren muss 01136 // aber sichergestellt werden, dass eks min. so lang ist wie tipstr, da 01137 // die Invertierung ja z.B. nur EKs 0-1700 beruecksichtigt, wenn 1700 der 01138 // hoechste EK im Spieler ist und dann alle Tips ueber 01139 // 1700 verlorengingen. 01140 // hier wird das letzte Bit von tipstr ermittelt und das darauf folgende 01141 // Bit im Spieler-EK-String gesetzt und wieder geloescht, woraufhin der 01142 // EK-String min. so lang wie der Tipstring ist. (es ist egal, wenn er 01143 // laenger ist, auch egal, wenn man ein Bit ueberschreibt, das faellt alles 01144 // gleich beim and_bits() raus. 01145 int lb = last_bit(tipstr) + 1; 01146 eks = clear_bit(set_bit(eks, lb), lb); 01147 // jetzt invertieren 01148 string non_eks = invert_bits(eks); 01149 // jetzt verunden und man hat die Tips, die noch nicht gehauen wurden. 01150 tipstr = and_bits(tipstr, non_eks); 01151 // noch inaktive EKs ausfiltern... 01152 tipstr = and_bits(tipstr, active_eks); 01153 01154 return makeTiplistFromBitString(tipstr); 01155 }


| public mixed QueryUsersEKCache | ( | ) |
Definiert in Zeile 111 der Datei scoremaster.c.
00112 { 00113 if (!allowed()) 00114 return SCORE_NO_PERMISSION; 00115 return users_ek; 00116 }
| public int RejectScore | ( | mixed | key | ) |
Definiert in Zeile 422 der Datei scoremaster.c.
00422 { 00423 // Eintrag aus unconfirmed_scores, npcs, by_num loeschen 00424 // Bit-Nr. in free_num eintragen 00425 // evtl. EK-Spruch entfernen? 00426 int bit; 00427 00428 if (!allowed()) return SCORE_NO_PERMISSION; 00429 if (stringp(key) && member(npcs,key)) { 00430 bit = npcs[key, NPC_NUMBER]; 00431 } 00432 else if (intp(key) && member(by_num,key)) { 00433 bit = key; 00434 } 00435 else 00436 return SCORE_INVALID_ARG; 00437 00438 if (!member(unconfirmed_scores, bit)) 00439 return SCORE_INVALID_ARG; 00440 00441 string obname = by_num[bit, BYNUM_KEY]; 00442 int score = by_num[bit,BYNUM_SCORE]; 00443 00444 efun::m_delete(by_num, bit); 00445 efun::m_delete(npcs, obname); 00446 efun::m_delete(unconfirmed_scores,bit); 00447 removeTip(obname); 00448 free_num += ({bit}); 00449 00450 save_object(SCORESAVEFILE); 00451 00452 write_file(SCORELOGFILE,sprintf( 00453 "REJECTNPC: %s %5d Score %3d %s [%s, %O]\n", 00454 strftime("%d%m%Y-%T",time()), bit, score, obname, 00455 getuid(previous_object()),this_interactive())); 00456 return 1; 00457 }
| public mixed Remove_free_num | ( | int | what | ) |
Definiert in Zeile 141 der Datei scoremaster.c.
00142 { 00143 if (!allowed()) 00144 return SCORE_NO_PERMISSION; 00145 if (!what || !intp(what)) 00146 return SCORE_INVALID_ARG; 00147 free_num-=({what}); 00148 save_object(SCORESAVEFILE); 00149 write_file(SCORELOGFILE,sprintf("REMOVEFREENUM: %s %5d (%s, %O)\n", 00150 strftime("%d%m%Y-%T",time()),what, 00151 geteuid(previous_object()),this_interactive())); 00152 return free_num; 00153 }
| public mixed Remove_to_change | ( | string | who, | |
| int | what | |||
| ) |
Definiert in Zeile 187 der Datei scoremaster.c.
00188 { 00189 if (!allowed()) 00190 return SCORE_NO_PERMISSION; 00191 if (!who || !stringp(who) || !what || !intp(what)) 00192 return SCORE_INVALID_ARG; 00193 if (member(to_change,who)) 00194 { 00195 to_change[who]-=({what}); 00196 if (!sizeof(to_change[who])) 00197 to_change=m_delete(to_change,who); 00198 } 00199 save_object(SCORESAVEFILE); 00200 write_file(SCORELOGFILE,sprintf("REMOVETOCHANGE: %s %s %5d (%s, %O)\n", 00201 strftime("%d%m%Y-%T",time()),who,what, 00202 geteuid(previous_object()), this_interactive())); 00203 return to_change[who]; 00204 }
| public int RemoveScore | ( | mixed | key | ) |
Definiert in Zeile 595 der Datei scoremaster.c.
00595 { 00596 int changed; 00597 int oldscore; 00598 00599 if (!allowed()) 00600 return SCORE_NO_PERMISSION; 00601 00602 if (stringp(key) && member(npcs,key)) { 00603 int num = npcs[key, NPC_NUMBER]; 00604 if ( key == by_num[num, BYNUM_KEY]) { 00605 oldscore = by_num[num, BYNUM_SCORE]; 00606 npcs[key, NPC_SCORE] = 0; 00607 by_num[num, BYNUM_SCORE] = 0; 00608 active_eks = clear_bit(active_eks,num); 00609 write_file(SCORELOGFILE,sprintf( 00610 "REMOVESCORE: %s %5d OSc: %.3d %s (%s, %O)\n", 00611 strftime("%d%m%Y-%T",time()), num, oldscore, key, 00612 geteuid(previous_object()), this_interactive())); 00613 changed = 1; 00614 } 00615 } 00616 else if (intp(key) && member(by_num, key)) { 00617 string obname = by_num[key, BYNUM_KEY]; 00618 if (key == npcs[obname, NPC_NUMBER]) { 00619 oldscore = by_num[key, BYNUM_SCORE]; 00620 npcs[obname, NPC_SCORE] = 0; 00621 by_num[key, BYNUM_SCORE] = 0; 00622 active_eks = clear_bit(active_eks,key); 00623 write_file(SCORELOGFILE,sprintf( 00624 "REMOVESCORE: %s %5d OSc: %.3d %s (%s, %O)\n", 00625 strftime("%d%m%Y-%T",time()),key, oldscore, obname, 00626 geteuid(previous_object()), this_interactive())); 00627 changed = 1; 00628 } 00629 } 00630 00631 if (changed) { 00632 ClearUsersEKCache(); 00633 save_object(SCORESAVEFILE); 00634 while(remove_call_out("DumpNPCs") != -1) ; 00635 call_out("DumpNPCs",60); 00636 return 1; 00637 } 00638 return SCORE_INVALID_ARG; 00639 }
| public int removeTip | ( | mixed | key | ) |
Definiert in Zeile 993 der Datei scoremaster.c.
Benutzt allowed, m_delete(), save_object(), SCORE_INVALID_ARG, SCORE_NO_PERMISSION, SCORESAVEFILE und tipList.
00994 { 00995 string fn; 00996 00997 if (!allowed()) 00998 return SCORE_NO_PERMISSION; 00999 01000 if ((!objectp(key) && !stringp(key))) 01001 return SCORE_INVALID_ARG; 01002 01003 fn=load_name(key); 01004 01005 if (!member(tipList, fn)) return SCORE_INVALID_ARG; 01006 01007 efun::m_delete(tipList,fn); 01008 save_object(SCORESAVEFILE); 01009 01010 return 1; 01011 }

| void reset | ( | void | ) |
Definiert in Zeile 206 der Datei scoremaster.c.
00207 { 00208 string *whop,who,ek; 00209 mixed what; 00210 int i,j,value,changed; 00211 00212 // falls EKs global entfernt werden sollen, schonmal den noetigen Callout 00213 // starten. 00214 if (sizeof(to_be_removed) && find_call_out(#'check_all_player) == -1) 00215 call_out(#'check_all_player, 10, 0); 00216 // EK-Mainteiner ueber unbestaetigte EKs informieren 00217 if (sizeof(unconfirmed_scores)) { 00218 foreach(string n: SCOREMAINTAINERS) { 00219 if (objectp(find_player(n))) 00220 tell_object(find_player(n),break_string( 00221 "Es gibt unbestaetigte EKs im Scoremaster. Schau Dir die doch " 00222 "mal an. ;-)",78, "Der Scoremaster teilt Dir mit: ")); 00223 } 00224 } 00225 00226 i=sizeof(whop=m_indices(to_change))-1; 00227 while (i>=0 && get_eval_cost()>100000) 00228 { 00229 ek = (string)(MASTER->query_ek(who=whop[i]) || ""); 00230 for (j=sizeof(what=to_change[who])-1;j>=0;j--) { 00231 if ((value=what[j])>0) { 00232 // Vergabestatistik hochzaehlen. 00233 npcs[by_num[value,BYNUM_KEY],NPC_COUNT]++; 00234 ek=set_bit(ek,value); 00235 } 00236 else { 00237 // Vergabestatistik hochzaehlen. 00238 npcs[by_num[-value,BYNUM_KEY],NPC_COUNT]++; 00239 ek=clear_bit(ek,-value); 00240 } 00241 // if (find_player("rikus")) 00242 //tell_object(find_player("rikus"),"SCOREMASTER "+who+" "+erg+"\n"); 00243 00244 write_file(SCOREAUTOLOG, 00245 sprintf("SET_CLEAR_BIT (reset): %s %4d %s\n", 00246 who, j, strftime("%d%m%Y-%T",time()) )); 00247 } 00248 MASTER->update_ek(who, ek); 00249 00250 if (member(users_ek, who)) 00251 efun::m_delete(users_ek, who); 00252 00253 efun::m_delete(to_change,who); 00254 changed=1; 00255 i--; 00256 } 00257 if (changed) save_object(SCORESAVEFILE); 00258 }
| public int RestoreEK | ( | string | key, | |
| int | bit, | |||
| int | score | |||
| ) |
Definiert in Zeile 351 der Datei scoremaster.c.
00351 { 00352 if (!allowed()) 00353 return SCORE_NO_PERMISSION; 00354 if (!stringp(key) || !strlen(key) 00355 || !intp(bit) || bit < 0 00356 || !intp(score) || score < 0) 00357 return SCORE_INVALID_ARG; 00358 00359 if (member(npcs,key) || member(by_num,bit)) 00360 return SCORE_INVALID_ARG; 00361 00362 npcs += ([key: bit;score;0 ]); 00363 by_num += ([bit: key;score ]); 00364 00365 ClearUsersEKCache(); 00366 save_object(SCORESAVEFILE); 00367 write_file(SCORELOGFILE,sprintf("RESTOREEK: %s %5d %4d %s (%s, %O)\n", 00368 strftime("%d%m%Y-%T",time()), bit, score, key, 00369 geteuid(previous_object()), this_interactive())); 00370 while(remove_call_out("DumpNPCs") != -1) ; 00371 call_out("DumpNPCs",60); 00372 return 1; 00373 00374 }
| public varargs int SetScore | ( | mixed | key, | |
| int | score | |||
| ) |
Definiert in Zeile 476 der Datei scoremaster.c.
00477 { 00478 int num; 00479 string ob; 00480 int oldscore; 00481 00482 if (!allowed()) 00483 return SCORE_NO_PERMISSION; 00484 if (!key) return SCORE_INVALID_ARG; 00485 00486 if (stringp(key) && strlen(key)) { 00487 ob = load_name(key); 00488 if (!member(npcs, ob)) return SCORE_INVALID_ARG; 00489 num = npcs[ob, NPC_NUMBER]; 00490 if (ob != by_num[num, BYNUM_KEY]) 00491 return SCORE_INVALID_ARG; 00492 } 00493 else if (intp(key) && member(by_num,key) ) { 00494 num = key; 00495 ob = by_num[num, BYNUM_KEY]; 00496 if (!member(npcs, ob) || (npcs[ob, NPC_NUMBER] != num)) 00497 return SCORE_INVALID_ARG; 00498 } 00499 else 00500 return SCORE_INVALID_ARG; 00501 00502 oldscore = by_num[num,BYNUM_SCORE]; 00503 by_num[num,BYNUM_SCORE] = score; 00504 npcs[ob, NPC_SCORE] = score; 00505 00506 if (score > 0) 00507 active_eks = set_bit(active_eks, num); 00508 else 00509 active_eks = clear_bit(active_eks, num); 00510 00511 ClearUsersEKCache(); 00512 save_object(SCORESAVEFILE); 00513 write_file(SCORELOGFILE,sprintf( 00514 "SETSCORE: %s %5d %.3d OSc: %.3d %s (%s, %O)\n", 00515 strftime("%d%m%Y-%T",time()),num,score,oldscore, ob, 00516 geteuid(previous_object()), this_interactive())); 00517 while(remove_call_out("DumpNPCs") != -1) ; 00518 call_out("DumpNPCs",60); 00519 return 1; 00520 }
| public int SetScoreBit | ( | string | pl, | |
| int | bit | |||
| ) |
Definiert in Zeile 858 der Datei scoremaster.c.
Benutzt allowed, by_num, BYNUM_KEY, BYNUM_SCORE, ek, m_delete(), MASTER, NPC_COUNT, npcs, SCORE_NO_PERMISSION, SCORELOGFILE, strftime() und users_ek.
00859 { 00860 string ek; 00861 00862 if (!allowed()) 00863 return SCORE_NO_PERMISSION; 00864 00865 ek = (MASTER->query_ek(pl) || ""); 00866 ek = set_bit(ek, bit); 00867 MASTER->update_ek(pl, ek); 00868 00869 // Vergabestatistik hochzaehlen. 00870 npcs[by_num[bit,BYNUM_KEY],NPC_COUNT]++; 00871 00872 if (member(users_ek, pl)) 00873 users_ek = m_delete(users_ek, pl); 00874 00875 write_file(SCORELOGFILE,sprintf("SETBIT: %s %s %5d Sc: %.3d %s (%s, %O)\n", 00876 strftime("%d%m%Y-%T",time()),pl, bit, 00877 by_num[bit,BYNUM_SCORE], by_num[bit,BYNUM_KEY], 00878 geteuid(previous_object()), this_interactive())); 00879 return 1; 00880 }

| protected mixed* StaticQueryNPCbyNumber | ( | int | num | ) |
Definiert in Zeile 737 der Datei scoremaster.c.
00738 { 00739 if (member(by_num, num)) 00740 return ({num, by_num[num, BYNUM_SCORE], by_num[num, BYNUM_KEY]}); 00741 00742 return 0; 00743 }
| public int* UnmarkEKForLiquidation | ( | mixed | key | ) |
Definiert in Zeile 558 der Datei scoremaster.c.
Benutzt allowed.
00558 { 00559 int bit; 00560 if (!allowed()) 00561 return 0; 00562 // nicht in to_be_removed aendern, wenn check_all_player() laeuft. 00563 if (find_call_out(#'check_all_player) != -1) 00564 return 0; 00565 00566 if (stringp(key) && strlen(key)) { 00567 if (!member(npcs,key)) return 0; 00568 bit = npcs[key,NPC_NUMBER]; 00569 } 00570 else if (intp(key) && key>=0) { 00571 bit = key; 00572 } 00573 else 00574 return 0; 00575 00576 to_be_removed -= ({bit}); 00577 write_file(SCORELOGFILE,sprintf("UNDELETEFLAG: %s %5d %s (%s, %O\n", 00578 strftime("%d%m%Y-%T",time()),bit, by_num[bit, BYNUM_KEY] || "NoName", 00579 geteuid(previous_object()), this_interactive())); 00580 00581 save_object(SCORESAVEFILE); 00582 00583 return to_be_removed; 00584 }
| private void WriteDumpFile | ( | string * | keys | ) |
Definiert in Zeile 823 der Datei scoremaster.c.
00823 { 00824 int maxn; 00825 00826 if (!pointerp(keys)) return; 00827 00828 rm(SCOREDUMPFILE); 00829 00830 write_file(SCOREDUMPFILE,sprintf("%5s %5s %4s %s\n", 00831 "Nr.", "Cnt", "Sc", "Objekt")); 00832 foreach(string key: keys) { 00833 write_file(SCOREDUMPFILE,sprintf("%5d %5d %4d %O\n", 00834 npcs[key,NPC_NUMBER], npcs[key,NPC_COUNT], 00835 npcs[key,NPC_SCORE], key)); 00836 maxn += npcs[key,NPC_SCORE]; 00837 } 00838 write_file(SCOREDUMPFILE,sprintf( 00839 "========================================================\n" 00840 "NPCs gesamt: %d Punkte\n\n",maxn)); 00841 }
| private nosave string active_eks = "" |
Definiert in Zeile 57 der Datei scoremaster.c.
Wird benutzt von getFreeEKsForPlayer(), LiquidateEK(), make_num() und QueryTipObjects().
| private nosave mapping by_num = m_allocate(0,2) |
Definiert in Zeile 51 der Datei scoremaster.c.
Wird benutzt von check_player(), ClearScoreBit(), getFreeEKsForPlayer(), LiquidateEK(), make_num(), makeTiplistFromBitString() und SetScoreBit().
| private int* free_num = ({}) |
Definiert in Zeile 40 der Datei scoremaster.c.
Wird benutzt von LiquidateEK().
| private int lastNum |
Definiert in Zeile 26 der Datei scoremaster.c.
| private mapping npcs = m_allocate(0,3) |
Definiert in Zeile 29 der Datei scoremaster.c.
| private mapping tipList = ([]) |
Definiert in Zeile 37 der Datei scoremaster.c.
| private int* to_be_removed = ({}) |
Definiert in Zeile 43 der Datei scoremaster.c.
Wird benutzt von check_player().
| private mapping to_change = ([]) |
Definiert in Zeile 34 der Datei scoremaster.c.
Wird benutzt von create().
| private mapping unconfirmed_scores = ([]) |
Definiert in Zeile 47 der Datei scoremaster.c.
Wird benutzt von LiquidateEK() und make_num().
| private nosave mapping users_ek = ([]) |
Definiert in Zeile 54 der Datei scoremaster.c.
Wird benutzt von ClearScoreBit() und SetScoreBit().
1.6.3