#include <config.h>#include "/secure/wizlevels.h"#include "/secure/questmaster.h"#include "/secure/lepmaster.h"#include <properties.h>#include <daemon.h>#include <defines.h>#include <ansi.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
| #define | MSG_FROM 0 |
| #define | MSG_SENDER 1 |
| #define | MSG_RECIPIENT 2 |
| #define | MSG_CC 3 |
| #define | MSG_BCC 4 |
| #define | MSG_SUBJECT 5 |
| #define | MSG_DATE 6 |
| #define | MSG_ID 7 |
| #define | MSG_BODY 8 |
Funktionen | |
| void | save_info () |
| static void | make_num (string name, mixed werte) |
| void | create () |
| static private int | allowed () |
| void | reset () |
| int | RecalculateQP () |
| int | AddQuest (string name, int questpoints, int experience, string *allowedobj, string hint, int difficulty, int questclass, int active, string wiz, string scndwiz, int questattribute) |
| int | RemoveQuest (string name) |
| int | QueryNeededQP () |
| int | QueryMaxQP () |
| int | QueryOptQP () |
| int | QueryTotalQP () |
| mixed * | QueryGroupedKeys () |
| int | QueryDontneed (object pl) |
| int | QueryReadyForWiz (object player) |
| mixed * | QueryQuest (string name) |
| int | QueryQuestPoints (string name) |
| mixed * | QueryQuests () |
| string * | QueryAllKeys () |
| int | SetActive (string name, int flag) |
| string | name () |
| string | Name () |
| void | Channel (string msg) |
| void | SendMail (string questname, mixed *quest, object player) |
| static int | compare (mixed *i, mixed *j) |
| varargs string | liste (mixed pl) |
| int | ClearUsersMQCache () |
| mixed | QueryUsersMQCache () |
| int | DumpMiniQuests (object who) |
| int | AddMiniQuest (int mquestpoints, string allowedobj, mixed descr, int visible, int active) |
| int | RemoveMiniQuest (string name) |
| int | ChangeMiniQuest (int mquestpoints, string allowedobj, mixed descr, int visible, int active) |
| mixed | QueryMiniQuestByName (string name) |
| mixed | QueryMiniQuestByNumber (int nummer) |
| mixed | QueryMiniQuests () |
| int | SetMiniActive (string name, int flag) |
| int | GiveMiniQuest (object winner) |
| int | QueryMiniQuestPoints (mixed pl) |
| int | HasMiniQuest (mixed pl, mixed name) |
| int | SetPlayerMiniQuest (string pl, string name) |
| int | ClearPlayerMiniQuest (string pl, string name) |
Variablen | |
| private int | max_QP |
| private int | opt_QP |
| private mapping | quests |
| private int | last_num |
| private mapping | miniquests |
| static private mapping | by_num |
| static private mapping | users_mq |
| #define MSG_BCC 4 |
Definiert in Zeile 441 der Datei questmaster.c.
| #define MSG_BODY 8 |
Definiert in Zeile 445 der Datei questmaster.c.
| #define MSG_CC 3 |
Definiert in Zeile 440 der Datei questmaster.c.
| #define MSG_DATE 6 |
Definiert in Zeile 443 der Datei questmaster.c.
| #define MSG_FROM 0 |
Definiert in Zeile 437 der Datei questmaster.c.
| #define MSG_ID 7 |
Definiert in Zeile 444 der Datei questmaster.c.
| #define MSG_RECIPIENT 2 |
Definiert in Zeile 439 der Datei questmaster.c.
| #define MSG_SENDER 1 |
Definiert in Zeile 438 der Datei questmaster.c.
| #define MSG_SUBJECT 5 |
Definiert in Zeile 442 der Datei questmaster.c.
| int AddMiniQuest | ( | int | mquestpoints, | |
| string | allowedobj, | |||
| mixed | descr, | |||
| int | visible, | |||
| int | active | |||
| ) |
Definiert in Zeile 694 der Datei questmaster.c.
Benutzt allowed, by_num, call_out(), ClearUsersMQCache(), last_num, MASTER, miniquests, MQMLOG, old_explode() und save_info().
00696 { 00697 int nummer; 00698 00699 if (!allowed()) 00700 return 0; 00701 if (!stringp(allowedobj) || allowedobj=="") 00702 return -1; 00703 if (mquestpoints<1) 00704 return -2; 00705 00706 if (allowedobj[<2..] == ".c") 00707 allowedobj = allowedobj[0..<3]; 00708 allowedobj = old_explode(allowedobj, "#")[0]; 00709 allowedobj = (string)MASTER->_get_path(allowedobj,0); 00710 00711 if (file_size(allowedobj+".c") <=0) 00712 return -3; 00713 00714 if (miniquests[allowedobj]) 00715 return -4; 00716 00717 nummer = ++last_num; 00718 00719 if (!stringp(descr)) 00720 descr = 0; 00721 00722 miniquests += 00723 ([allowedobj:({mquestpoints, nummer, descr, visible, active})]); 00724 save_info(); 00725 by_num += ([nummer : ({mquestpoints, allowedobj})]); 00726 00727 MQMLOG(sprintf("AddMiniQuest: %s %O (%s)", allowedobj, miniquests[allowedobj], 00728 getuid(this_interactive()))); 00729 00730 ClearUsersMQCache(); 00731 //call_out("DumpMiniQuests",0); 00732 call_out("DumpMiniQuests",0,this_interactive()); 00733 return 1; 00734 }

| int AddQuest | ( | string | name, | |
| int | questpoints, | |||
| int | experience, | |||
| string * | allowedobj, | |||
| string | hint, | |||
| int | difficulty, | |||
| int | questclass, | |||
| int | active, | |||
| string | wiz, | |||
| string | scndwiz, | |||
| int | questattribute | |||
| ) |
Definiert in Zeile 154 der Datei questmaster.c.
Benutzt _get_path(), allowed, i, max_QP, QMLOG, quests, RecalculateQP() und save_info().
00157 { 00158 mixed *quest; 00159 int i; 00160 00161 if (!allowed()) return 0; 00162 if (!stringp(name) || strlen(name)<5) return -1; 00163 if (questpoints<1) return -2; 00164 if (!intp(experience)) return -3; 00165 if (stringp(allowedobj)) allowedobj=({allowedobj}); 00166 if (!pointerp(allowedobj)) return -4; 00167 for (i=sizeof(allowedobj)-1;i>=0;i--) 00168 { 00169 if (!stringp(allowedobj[i]) || allowedobj[i]=="") return -4; 00170 allowedobj[i]=(string)"/secure/master"->_get_path(allowedobj[i],0); 00171 } 00172 if (!stringp(hint) || hint=="") return -5; 00173 if (difficulty<-1 || difficulty>100) return -6; 00174 if (questclass<0 || questclass>5) return -11; 00175 if (active<0 || active>1) return -7; 00176 if (!stringp(wiz) || wiz=="" || 00177 file_size("/players/"+(wiz=lower_case(wiz))) != -2) return -8; 00178 if (!stringp(scndwiz)) 00179 scndwiz=""; 00180 else if (file_size("/players/"+(scndwiz=lower_case(scndwiz))) != -2) 00181 return -9; 00182 if (questattribute<0 || questattribute>4) 00183 return -10; 00184 if(quests[name]&&(quests[name][5]==0||quests[name][5]==1)&&quests[name][6]) 00185 max_QP-=quests[name][0]; 00186 quests+=([name:({questpoints,experience,allowedobj,hint,difficulty,questclass,active,wiz, scndwiz,questattribute})]); 00187 RecalculateQP(); 00188 save_info(); 00189 QMLOG(sprintf("add: %s %O (%s)",name,quests[name], 00190 getuid(this_interactive()))); 00191 return 1; 00192 }

| static private int allowed | ( | ) | [static] |
Definiert in Zeile 70 der Datei questmaster.c.
Benutzt ARCH_SECURITY, process_call() und ROOTID.
00071 { 00072 if (previous_object() && geteuid(previous_object())==ROOTID) 00073 return 1; 00074 if (!process_call() && previous_object() && this_interactive() && ARCH_SECURITY) 00075 return 1; 00076 return 0; 00077 }

| int ChangeMiniQuest | ( | int | mquestpoints, | |
| string | allowedobj, | |||
| mixed | descr, | |||
| int | visible, | |||
| int | active | |||
| ) |
Definiert in Zeile 756 der Datei questmaster.c.
Benutzt _get_path(), allowed, by_num, call_out(), ClearUsersMQCache(), miniquests, MQMLOG, old_explode() und save_info().
00758 { 00759 int nummer; 00760 mixed altemq; 00761 00762 if (!allowed()) 00763 return 0; 00764 if (!stringp(allowedobj) || allowedobj == "") 00765 return -1; 00766 if (mquestpoints<1) 00767 return -2; 00768 00769 if (allowedobj[<2..] == ".c") 00770 allowedobj = allowedobj[0..<3]; 00771 allowedobj = old_explode(allowedobj, "#")[0]; 00772 allowedobj = (string)"/secure/master"->_get_path(allowedobj,0); 00773 00774 if (file_size(allowedobj+".c") <= 0) 00775 return -3; 00776 if (!miniquests[allowedobj]) 00777 return -4; 00778 00779 altemq = miniquests[allowedobj]; 00780 nummer = miniquests[allowedobj][1]; 00781 00782 miniquests[allowedobj] = ({mquestpoints, nummer, descr, visible, active}); 00783 by_num[nummer] = ({mquestpoints, allowedobj}); 00784 save_info(); 00785 00786 MQMLOG(sprintf("ChangeMiniQuest: %s from %O to %O (%s)", allowedobj, 00787 altemq, miniquests[allowedobj], 00788 getuid(this_interactive()))); 00789 00790 ClearUsersMQCache(); 00791 //call_out("DumpMiniQuests",0); 00792 call_out("DumpMiniQuests",0,this_interactive()); 00793 return 1; 00794 }

| void Channel | ( | string | msg | ) |
Definiert in Zeile 429 der Datei questmaster.c.
Benutzt CHMASTER.
Wird benutzt von GiveQuest().
00430 { 00431 if(!interactive(previous_object())) 00432 return; 00433 catch(CHMASTER->send("Abenteuer", this_object(), msg);publish); 00434 }

| int ClearPlayerMiniQuest | ( | string | pl, | |
| string | name | |||
| ) |
Definiert in Zeile 986 der Datei questmaster.c.
Benutzt allowed, m_delete(), MASTER, miniquests, mq, MQMLOG und users_mq.
00987 { 00988 string mq; 00989 00990 if (!allowed()) 00991 return 0; 00992 if (!pl) 00993 return MQ_ILLEGAL_OBJ; 00994 if (!previous_object()) 00995 return MQ_ILLEGAL_OBJ; 00996 00997 if (!miniquests[name]) 00998 return MQ_KEY_INVALID; 00999 01000 mq = (MASTER->query_mq(pl) || ""); 01001 01002 if (!test_bit(mq, miniquests[name][1])) 01003 return MQ_ALREADY_SET; 01004 01005 catch (mq = clear_bit(mq, miniquests[name][1]);publish); 01006 MASTER->update_mq(pl, mq); 01007 01008 MQMLOG(sprintf("ClearPlayerMiniQuest: %s %s (%s)", 01009 pl, name, getuid(this_interactive()))); 01010 01011 if (member(users_mq, pl)) 01012 users_mq = m_delete(users_mq, pl); 01013 01014 return 1; 01015 }

| int ClearUsersMQCache | ( | ) |
Definiert in Zeile 618 der Datei questmaster.c.
Wird benutzt von AddMiniQuest(), ChangeMiniQuest() und RemoveMiniQuest().
00619 { 00620 if (!allowed()) 00621 return 0; 00622 00623 users_mq = ([]); 00624 00625 return 1; 00626 }

| static int compare | ( | mixed * | i, | |
| mixed * | j | |||
| ) | [static] |
Definiert in Zeile 496 der Datei questmaster.c.
| void create | ( | ) |
Definiert in Zeile 48 der Datei questmaster.c.
Benutzt by_num, last_num, max_QP, miniquests, opt_QP, quests, QUESTS, restore_object(), save_info(), set_next_reset() und users_mq.
00049 { 00050 seteuid(getuid(this_object())); 00051 if (!restore_object(QUESTS)) 00052 { 00053 quests = ([]); 00054 max_QP = 0; 00055 opt_QP = 0; 00056 00057 miniquests = ([]); 00058 last_num = 0; 00059 00060 save_info(); 00061 } 00062 00063 by_num = ([]); 00064 users_mq = ([]); 00065 walk_mapping(miniquests, #'make_num /*'*/ ); 00066 00067 set_next_reset(43200); // Reset alle 12 Stunden. 00068 }

| int DumpMiniQuests | ( | object | who | ) |
Definiert in Zeile 657 der Datei questmaster.c.
Benutzt allowed, dtime(), keys, miniquests, MQ_DUMP_FILE, MQMLOG und msg().
00658 { 00659 mixed keys; 00660 string *msg; 00661 int i, maxmq; 00662 00663 if (!allowed()) 00664 return 0; 00665 00666 MQMLOG(sprintf("DumpMiniQuests: PO: %O, TI: %O", 00667 previous_object(), 00668 // this_interactive())); 00669 who)); 00670 00671 rm(MQ_DUMP_FILE); 00672 00673 keys=m_indices(miniquests); 00674 write_file(MQ_DUMP_FILE, "MINIQUESTS: ("+dtime(time())+")\n\n"); 00675 msg = ({}); 00676 00677 for (i=sizeof(keys)-1; i>=0;i--) { 00678 msg += ({ sprintf("%4d %4d %s", 00679 miniquests[keys[i]][1], miniquests[keys[i]][0], 00680 keys[i]) }); 00681 maxmq += miniquests[keys[i]][0]; 00682 } 00683 00684 write_file(MQ_DUMP_FILE, implode(sort_array(msg, #'> /*'*/), "\n")); 00685 00686 write_file(MQ_DUMP_FILE, sprintf("\n\n" 00687 "============================================================\n" 00688 +"MiniQuests: %d Miniquests mit %d Punkten.\n\n", 00689 sizeof(keys), maxmq)); 00690 00691 return 1; 00692 }

| int GiveMiniQuest | ( | object | winner | ) |
Definiert in Zeile 847 der Datei questmaster.c.
Benutzt m_delete(), MASTER, miniquests, mq, MQSOLVEDLOG, name und users_mq.
00848 { 00849 string name, mq; 00850 00851 if (!winner || 00852 (this_interactive() && (this_interactive() != winner)) || 00853 ((this_player() == winner) && !query_once_interactive(winner))) 00854 return MQ_ILLEGAL_OBJ; 00855 if (winner->QueryGuest()) 00856 return MQ_GUEST; 00857 if (!previous_object()) 00858 return MQ_ILLEGAL_OBJ; 00859 00860 name = load_name(previous_object()); 00861 00862 if (!miniquests[name]) 00863 return MQ_KEY_INVALID; 00864 00865 if (!miniquests[name][4]) 00866 return MQ_IS_INACTIVE; 00867 00868 mq = (MASTER->query_mq(getuid(winner)) || ""); 00869 00870 if (test_bit(mq, miniquests[name][1])) 00871 return MQ_ALREADY_SET; 00872 00873 catch(mq = set_bit(mq, miniquests[name][1]);publish); 00874 MASTER->update_mq(getuid(winner), mq); 00875 00876 MQSOLVEDLOG(sprintf("%s: %s, (#%d), (Stupse %d)", 00877 name, geteuid(winner), 00878 miniquests[name][1], miniquests[name][0])); 00879 00880 if (member(users_mq, getuid(winner))) 00881 users_mq = m_delete(users_mq, getuid(winner)); 00882 00883 return 1; 00884 }

| int HasMiniQuest | ( | mixed | pl, | |
| mixed | name | |||
| ) |
Definiert in Zeile 919 der Datei questmaster.c.
Benutzt MASTER, miniquests, mq, old_explode() und spieler.
00920 { 00921 string mq, spieler; 00922 00923 if (!pl || !name) 00924 return MQ_ILLEGAL_OBJ; 00925 00926 if (!objectp(pl) && !stringp(pl)) 00927 return MQ_ILLEGAL_OBJ; 00928 00929 if (objectp(pl) && !query_once_interactive(pl)) 00930 return MQ_ILLEGAL_OBJ; 00931 00932 if (!objectp(name) && !stringp(name)) 00933 return MQ_ILLEGAL_OBJ; 00934 00935 if (objectp(name)) 00936 name = old_explode(object_name(name), "#")[0]; 00937 00938 if (objectp(pl)) 00939 spieler = getuid(pl); 00940 else 00941 spieler = pl; 00942 00943 if (!miniquests[name]) 00944 return MQ_KEY_INVALID; 00945 00946 mq = (MASTER->query_mq(spieler) || ""); 00947 00948 return test_bit(mq, miniquests[name][1]); 00949 }

| varargs string liste | ( | mixed | pl | ) |
Definiert in Zeile 504 der Datei questmaster.c.
Benutzt ANSI_GREEN, ANSI_NORMAL, ANSI_RED, find_netdead(), find_player(), format(), i, ME, P_TTY, PL, Q_ATTR, Q_CLASS, Q_DIFF, Q_QP, Q_WIZ, QGROUPS, QueryGroupedKeys() und QueryQuest().
00505 { 00506 int qgroups, i, j, qrfw; 00507 mixed *qlists, *qgrouped, *qtmp; 00508 string str; 00509 string ja, nein, format, ueberschrift; 00510 00511 if(!objectp(pl)) 00512 if(stringp(pl)) 00513 pl=find_player(pl) || find_netdead(pl); 00514 if(!objectp(pl)) 00515 pl=PL; 00516 if(!objectp(pl)) 00517 return "Ohne Spielernamen/Spielerobjekt gibt es auch keine Liste.\n"; 00518 00519 if ( ((string)pl->QueryProp(P_TTY)) == "ansi" 00520 && !((int)pl->TestIgnore(({"farbe"}))) ) { 00521 ja = ANSI_GREEN + "Ja" + ANSI_NORMAL; 00522 nein = ANSI_RED + "Nein" + ANSI_NORMAL; 00523 } 00524 else { 00525 ja = "Ja"; 00526 nein = "Nein"; 00527 } 00528 00529 str = ""; 00530 // Festlegen des Ausgabeformates 00531 format = "%=-30s %3d %-6s %-9s %-5s %-12s %s\n"; 00532 ueberschrift = sprintf("%-30s %3s %-6s %-9s %-5s %-12s %s\n", 00533 "Abenteuer", "AP", "Klasse", "Attribut", 00534 "Stufe", "Autor", "Geloest?"); 00535 00536 qgroups = sizeof(QGROUPS); 00537 qlists = allocate( qgroups+1 ); 00538 for( i=qgroups; i>=0; i-- ) 00539 qlists[i] = ({}); 00540 00541 qgrouped = QueryGroupedKeys(); 00542 00543 for (i=sizeof(qgrouped)-1;i>=0; i--) 00544 for (j=sizeof(qgrouped[i])-1;j>=0; j--) { 00545 qtmp = QueryQuest(qgrouped[i][j]); 00546 qlists[i] += ({ ({ 00547 qgrouped[i][j], 00548 qtmp[Q_QP], QCLASS_STARS(qtmp[Q_CLASS]), 00549 capitalize(QATTR_STRINGS[qtmp[Q_ATTR]]), 00550 qtmp[Q_DIFF], capitalize(qtmp[Q_WIZ]), 00551 pl->QueryQuest(qgrouped[i][j])?ja:nein 00552 }) }); 00553 } 00554 00555 for( i=0; i<qgroups; i++ ) 00556 { 00557 if (sizeof(qlists[i])) { 00558 str += "\n" + ueberschrift; 00559 str += sprintf("Stufen %d%s:\n", 00560 QGROUPS[i]+1, 00561 i==qgroups-1?"+":sprintf("-%d", QGROUPS[i+1])); 00562 qlists[i] = sort_array( qlists[i], "compare", ME ); 00563 for( j=0; j<sizeof(qlists[i]); j++ ) { 00564 if(qlists[i][j][Q_DIFF]>=0) 00565 str += sprintf( format, 00566 qlists[i][j][0], qlists[i][j][1], qlists[i][j][2], 00567 qlists[i][j][3], sprintf("%d",qlists[i][j][4]), 00568 qlists[i][j][5], qlists[i][j][6]); 00569 } 00570 str += "\n\n"; 00571 } 00572 } 00573 00574 qlists[qgroups] = sort_array(qlists[qgroups], "compare", ME); 00575 i = qgroups; 00576 if (sizeof(qlists[i])) { 00577 str += "\n" + ueberschrift; 00578 str += "Nur fuer Seher:\n"; 00579 for( j=0; j<sizeof(qlists[qgroups]); j++ ) { 00580 if(qlists[i][j][Q_DIFF]==-1) 00581 str += sprintf( format, 00582 qlists[i][j][0], qlists[i][j][1], qlists[i][j][2], 00583 qlists[i][j][3], "S", qlists[i][j][5], 00584 qlists[i][j][6]); 00585 } 00586 } 00587 00588 str += 00589 "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"+ 00590 "AP = Fuer die Quest vergebene Abenteuerpunkte\n"+ 00591 "Klasse = Subjektive Einstufung innerhalb der Gruppe bzgl. Arbeitsaufwand,\n"+ 00592 " Dauer oder Gefahren\n"+ 00593 "Attribut = Keines -> Keine besonderen Charakteristika\n"+ 00594 " Fleissig -> Vornehmlich Sammeln, Auffinden von Items oder von\n"+ 00595 " Informationen\n"+ 00596 " Heroisch -> Heldentat, die Mut, Kampfbereitschaft und eine\n"+ 00597 " gewisse Bereitschaft zum Forschen braucht\n"+ 00598 " Episch -> Grosse Anforderungen an Ausdauer und Mut, grosser\n"+ 00599 " Aufwand fuer das Erforschen der Loesung, Kaempfe\n"+ 00600 " mittlerer Haerte\n"+ 00601 " Legendaer -> Barden preisen die Einsatzbereitschaft der Helden,\n"+ 00602 " recht grosse Gefahr fuer Leib und Leben, mitunter\n"+ 00603 " lange Questzeit\n"+ 00604 "Stufe = Empfohlene Stufe fuer die Quest, keine Voraussetzung, ausser bei\n"+ 00605 " Seherquests, die teilweise den Status voraussetzen\n"+ 00606 "Autor = Magier, der die Quest geschrieben hat\n"+ 00607 "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"; 00608 00609 return str; 00610 }

| static void make_num | ( | string | name, | |
| mixed | werte | |||
| ) | [static] |
Definiert in Zeile 43 der Datei questmaster.c.
Benutzt by_num.
| string Name | ( | ) |
Definiert in Zeile 427 der Datei questmaster.c.
| string name | ( | ) |
Definiert in Zeile 423 der Datei questmaster.c.
| string* QueryAllKeys | ( | ) |
Definiert in Zeile 388 der Datei questmaster.c.
Benutzt quests.
00389 { 00390 return m_indices(quests); 00391 }
| int QueryDontneed | ( | object | pl | ) |
Definiert in Zeile 264 der Datei questmaster.c.
| mixed* QueryGroupedKeys | ( | ) |
Definiert in Zeile 229 der Datei questmaster.c.
Benutzt i, Q_ACTIVE, Q_DIFF, QGROUPS und quests.
Wird benutzt von liste().
00230 { 00231 string *qliste; 00232 mixed *qgliste; 00233 int i, j; 00234 00235 qgliste = allocate(sizeof(QGROUPS)+1); // letzte Gruppe sind die Seherquests 00236 qliste = m_indices(quests); 00237 00238 for (i=sizeof(qgliste)-1;i>=0;i--) 00239 qgliste[i]=({}); 00240 00241 for (i=sizeof(qliste)-1;i>=0;i--) 00242 { 00243 // inaktive quest? 00244 if (!quests[qliste[i]][Q_ACTIVE]) 00245 continue; 00246 // optionale quest? also Seherquest 00247 if (quests[qliste[i]][Q_DIFF]==-1) 00248 qgliste[sizeof(QGROUPS)] += ({qliste[i]}); 00249 else { 00250 // dann haben wir also eine normale Quest und daher Einordnung 00251 // nach dem Schwierigkeitswert 00252 for (j=sizeof(QGROUPS)-1; 00253 j>=0 && QGROUPS[j]>=quests[qliste[i]][Q_DIFF];j--) 00254 ; 00255 qgliste[j] += ({qliste[i]}); 00256 } 00257 } 00258 00259 return qgliste; 00260 }

| int QueryMaxQP | ( | ) |
Definiert in Zeile 214 der Datei questmaster.c.
Benutzt max_QP.
00215 { 00216 return max_QP; 00217 }
| mixed QueryMiniQuestByName | ( | string | name | ) |
Definiert in Zeile 796 der Datei questmaster.c.
Benutzt allowed und miniquests.
00797 { 00798 if (!allowed()) 00799 return 0; 00800 00801 if (extern_call()) 00802 return ([ name:deep_copy(miniquests[name]) ]); 00803 00804 return miniquests[name]; 00805 }
| mixed QueryMiniQuestByNumber | ( | int | nummer | ) |
Definiert in Zeile 807 der Datei questmaster.c.
Benutzt allowed, by_num und miniquests.
00808 { 00809 if (!allowed()) 00810 return 0; 00811 00812 if (extern_call()) 00813 return ([by_num[nummer][1]: 00814 deep_copy(miniquests[by_num[nummer][1]]) ]); 00815 return miniquests[by_num[nummer][1]]; 00816 }
| int QueryMiniQuestPoints | ( | mixed | pl | ) |
Definiert in Zeile 886 der Datei questmaster.c.
Benutzt allowed, by_num, MASTER, spieler und users_mq.
00887 { 00888 int i, j; 00889 string s, spieler; 00890 00891 if (!allowed()) 00892 return 0; 00893 00894 if (!pl) 00895 return -1; 00896 00897 if (!objectp(pl) && !stringp(pl)) 00898 return -2; 00899 00900 if (objectp(pl) && !query_once_interactive(pl)) 00901 return -3; 00902 00903 if (objectp(pl)) 00904 spieler = getuid(pl); 00905 else 00906 spieler = pl; 00907 00908 if (member(users_mq, spieler) == 0) { 00909 s = (MASTER->query_mq(spieler) || ""); 00910 for (j=0, i=6*strlen(s)-1;i>0;i--) 00911 if (test_bit(s,i)) 00912 j+=by_num[i][0]; 00913 users_mq += ([spieler:j]); 00914 return j; 00915 } else 00916 return users_mq[spieler]; 00917 }
| mixed QueryMiniQuests | ( | ) |
Definiert in Zeile 818 der Datei questmaster.c.
Benutzt allowed und miniquests.
00819 { 00820 if (!allowed()) 00821 return 0; 00822 00823 if (extern_call()) 00824 return ({m_indices(miniquests), map( 00825 m_values(miniquests), #'deep_copy /*'*/ )}); 00826 00827 return miniquests; 00828 }
| int QueryNeededQP | ( | ) |
Definiert in Zeile 209 der Datei questmaster.c.
Benutzt REQ_QP.
00210 { 00211 return REQ_QP; 00212 }
| int QueryOptQP | ( | ) |
Definiert in Zeile 219 der Datei questmaster.c.
Benutzt opt_QP.
00220 { 00221 return opt_QP; 00222 }
| int QueryQuest | ( | string | name | ) |
Definiert in Zeile 364 der Datei questmaster.c.
Benutzt quests.
Wird benutzt von DeleteQuest(), frag(), GiveQuest() und liste().
00365 { 00366 if(!quests[name]) 00367 return ({}); 00368 if( extern_call() ) 00369 return deep_copy( quests[name] ); 00370 return quests[name]; 00371 }

| int QueryQuestPoints | ( | string | name | ) |
| mixed* QueryQuests | ( | ) |
| int QueryReadyForWiz | ( | object | player | ) |
Definiert in Zeile 312 der Datei questmaster.c.
| int QueryTotalQP | ( | ) |
| mixed QueryUsersMQCache | ( | ) |
| int RecalculateQP | ( | ) |
Definiert in Zeile 130 der Datei questmaster.c.
Benutzt allowed, i, max_QP, opt_QP, Q_ACTIVE, Q_DIFF, Q_QP und quests.
Wird benutzt von AddQuest(), RemoveQuest() und SetActive().
00131 { 00132 int i; 00133 mixed q,n; 00134 00135 if (!allowed()) 00136 return -1; 00137 00138 max_QP=0; 00139 opt_QP=0; 00140 00141 n=m_indices(quests); 00142 q=m_values(quests); 00143 for (i=sizeof(q)-1;i>=0;i--) 00144 if (q[i][Q_ACTIVE]) { 00145 if (q[i][Q_DIFF]>=0) 00146 max_QP+=q[i][Q_QP]; 00147 if (q[i][Q_DIFF]==-1) 00148 opt_QP+=q[i][Q_QP]; 00149 } 00150 00151 return max_QP+opt_QP; 00152 }

| int RemoveMiniQuest | ( | string | name | ) |
Definiert in Zeile 736 der Datei questmaster.c.
Benutzt allowed, by_num, call_out(), ClearUsersMQCache(), m_delete(), miniquests, MQMLOG und save_info().
00737 { 00738 if (!allowed()) 00739 return 0; 00740 if (!miniquests[name]) 00741 return -1; 00742 00743 MQMLOG(sprintf("RemoveMiniQuest: %s %O (%s)", 00744 name, miniquests[name], getuid(this_interactive()))); 00745 00746 by_num = m_delete(by_num, miniquests[name][1]); 00747 miniquests = m_delete(miniquests, name); 00748 save_info(); 00749 00750 ClearUsersMQCache(); 00751 //call_out("DumpMiniQuests",0); 00752 call_out("DumpMiniQuests",0,this_interactive()); 00753 return 1; 00754 }

| int RemoveQuest | ( | string | name | ) |
Definiert in Zeile 194 der Datei questmaster.c.
Benutzt allowed, m_delete(), QMLOG, quests, RecalculateQP() und save_info().
00195 { 00196 mixed *quest; 00197 00198 if (!allowed()) return 0; 00199 if (!quests[name]) return -1; 00200 QMLOG(sprintf("remove: %s %O (%s)",name,quests[name], 00201 getuid(this_interactive()))); 00202 quests=m_delete(quests,name); 00203 RecalculateQP(); 00204 save_info(); 00205 return 1; 00206 }

| void reset | ( | void | ) |
Definiert in Zeile 79 der Datei questmaster.c.
Benutzt by_num, miniquests und set_next_reset().
00080 { 00081 by_num = ([]); 00082 walk_mapping(miniquests, #'make_num /*'*/ ); 00083 set_next_reset(43200); 00084 }

| void save_info | ( | ) |
Definiert in Zeile 38 der Datei questmaster.c.
Benutzt QUESTS und save_object().
00039 { 00040 save_object(QUESTS); 00041 }

| void SendMail | ( | string | questname, | |
| mixed * | quest, | |||
| object | player | |||
| ) |
Definiert in Zeile 447 der Datei questmaster.c.
Benutzt break_string(), dtime(), MSG_BCC, MSG_BODY, MSG_CC, MSG_DATE, MSG_FROM, MSG_ID, MSG_RECIPIENT, MSG_SENDER, MSG_SUBJECT, MUDNAME, Q_QP, Q_SCNDWIZ, Q_WIZ und text().
Wird benutzt von GiveQuest().
00448 { 00449 mixed* mail; 00450 string text; 00451 00452 mail = allocate(9); 00453 00454 text = 00455 "Hallo "+capitalize(getuid(player))+",\n\n"+ 00456 break_string("Nachdem Du gerade eben das Abenteuer '"+ 00457 questname +"' ("+quest[Q_QP]+" Punkte), das "+ 00458 capitalize(quest[Q_WIZ])+" fuer das "MUDNAME" entworfen hat, " 00459 "mit Erfolg bestanden hast, sind " 00460 "wir nun an Deiner Meinung dazu interessiert:", 78)+ 00461 "\n Hat Dir das Abenteuer gefallen und wieso bzw. wieso nicht?\n" 00462 " Ist die Einstufung Deiner Meinung nach richtig? (AP und Stufe)\n" 00463 " Gab es Probleme oder gar Fehler?\n" 00464 " Hast Du Verbesserungsvorschlaege?\n\n"; 00465 00466 if (quest[8]!="") { 00467 text += break_string("Diese Nachricht wurde automatisch verschickt, " 00468 "wenn Du mit dem 'r' Kommando darauf antwortest, geht die Antwort " 00469 "direkt an "+capitalize(quest[Q_SCNDWIZ]) 00470 +" als \"Warter\" des Abenteuers.",78); 00471 mail[MSG_FROM] = quest[Q_SCNDWIZ]; 00472 mail[MSG_SENDER] = quest[Q_SCNDWIZ]; 00473 } 00474 else { 00475 text += 00476 break_string("Diese Nachricht wurde automatisch verschickt, wenn Du mit " 00477 "dem 'r' Kommando darauf antwortest, geht die Antwort direkt an "+ 00478 capitalize(quest[Q_WIZ])+".", 78); 00479 mail[MSG_FROM] = quest[Q_WIZ]; 00480 mail[MSG_SENDER] = quest[Q_WIZ]; 00481 } 00482 00483 00484 mail[MSG_RECIPIENT] = getuid(player); 00485 mail[MSG_CC]=0; 00486 mail[MSG_BCC]=0; 00487 mail[MSG_SUBJECT]="Das Abenteuer: "+questname; 00488 mail[MSG_DATE]=dtime(time()); 00489 mail[MSG_ID]=MUDNAME":"+time(); 00490 mail[MSG_BODY]=text; 00491 00492 "/secure/mailer"->DeliverMail(mail,0); 00493 return; 00494 }


| int SetActive | ( | string | name, | |
| int | flag | |||
| ) |
Definiert in Zeile 394 der Datei questmaster.c.
Benutzt allowed, Q_ACTIVE, QMLOG, quests, RecalculateQP() und save_info().
00395 { 00396 mixed *quest; 00397 00398 if (!allowed()) return 0; 00399 if (!(quest=quests[name])) return -1; 00400 switch(flag) 00401 { 00402 case 0: 00403 if (quest[Q_ACTIVE] == flag) 00404 return -2; 00405 quest[Q_ACTIVE] = flag; 00406 break; 00407 case 1: 00408 if (quest[Q_ACTIVE] == flag) 00409 return -2; 00410 quest[Q_ACTIVE] = flag; 00411 break; 00412 default: 00413 return -3; 00414 } 00415 quests[name]=quest; 00416 RecalculateQP(); 00417 save_info(); 00418 QMLOG(sprintf("%s: %s (%s)",(flag?"activate":"deactivate"),name, 00419 getuid(this_interactive()))); 00420 return 1; 00421 }

| int SetMiniActive | ( | string | name, | |
| int | flag | |||
| ) |
Definiert in Zeile 830 der Datei questmaster.c.
Benutzt allowed, miniquests, MQMLOG und save_info().
00831 { 00832 if (!allowed()) 00833 return 0; 00834 if (!miniquests[name]) 00835 return -1; 00836 if (flag < 0 || flag > 1) 00837 return -2; 00838 00839 miniquests[name][4] = flag; 00840 save_info(); 00841 00842 MQMLOG(sprintf("%s: %s (%s)", (flag?"Activate":"Deactivate"), 00843 name, getuid(this_interactive()))); 00844 return 1; 00845 }

| int SetPlayerMiniQuest | ( | string | pl, | |
| string | name | |||
| ) |
Definiert in Zeile 954 der Datei questmaster.c.
Benutzt allowed, m_delete(), MASTER, miniquests, mq, MQMLOG und users_mq.
00955 { 00956 string mq; 00957 00958 if(!allowed()) 00959 return 0; 00960 if(!pl) 00961 return MQ_ILLEGAL_OBJ; 00962 if(!previous_object()) 00963 return MQ_ILLEGAL_OBJ; 00964 00965 if (!miniquests[name]) 00966 return MQ_KEY_INVALID; 00967 00968 mq = (MASTER->query_mq(pl) || ""); 00969 00970 if (test_bit(mq, miniquests[name][1])) 00971 return MQ_ALREADY_SET; 00972 00973 catch (mq = set_bit(mq, miniquests[name][1]);publish); 00974 MASTER->update_mq(pl, mq); 00975 00976 MQMLOG(sprintf("SetPlayerMiniQuest: %s %s (%s)", 00977 pl, name, getuid(this_interactive()))); 00978 00979 if (member(users_mq, pl)) 00980 users_mq = m_delete(users_mq, pl); 00981 00982 return 1; 00983 }

private mapping by_num [static] |
Definiert in Zeile 34 der Datei questmaster.c.
| private int last_num |
Definiert in Zeile 31 der Datei questmaster.c.
Wird benutzt von AddMiniQuest() und create().
| private int max_QP |
Definiert in Zeile 27 der Datei questmaster.c.
Wird benutzt von AddQuest(), create(), QueryMaxQP(), QueryTotalQP() und RecalculateQP().
| private mapping miniquests |
Definiert in Zeile 32 der Datei questmaster.c.
Wird benutzt von AddMiniQuest(), ChangeMiniQuest(), ClearPlayerMiniQuest(), create(), DumpMiniQuests(), GiveMiniQuest(), HasMiniQuest(), QueryMiniQuestByName(), QueryMiniQuestByNumber(), QueryMiniQuests(), RemoveMiniQuest(), reset(), SetMiniActive() und SetPlayerMiniQuest().
| private int opt_QP |
Definiert in Zeile 28 der Datei questmaster.c.
Wird benutzt von create(), QueryOptQP(), QueryTotalQP() und RecalculateQP().
| private mapping quests |
Definiert in Zeile 29 der Datei questmaster.c.
Wird benutzt von _query_questpoints(), _query_quests(), AddQuest(), create(), DeleteQuest(), frag(), GiveQuest(), QueryAllKeys(), QueryGroupedKeys(), QueryQuest(), QueryQuestPoints(), QueryQuests(), RecalculateQP(), RemoveQuest(), scan_obj(), SetActive() und stat().
private mapping users_mq [static] |
Definiert in Zeile 35 der Datei questmaster.c.
Wird benutzt von ClearPlayerMiniQuest(), ClearUsersMQCache(), create(), GiveMiniQuest(), QueryMiniQuestPoints(), QueryUsersMQCache() und SetPlayerMiniQuest().
1.6.3