/***************************************************************************** ** Administration commands. Dyrt/idirt/pdirt ** ** Project: pDirt (Aber IV MUD daemon) ** Module : admin.c ** Author : Various. ** Date : unknown ** Description: Some functions used to administrate the mud. Some functions ** that were in here in the original Dyrt code have been moved ** to ther files, and some have been placed in here by Marty. ** Additions: ** [Marty/15 Juli] ** Recoded the wizfrob/awizfrob/dgodfrob/godfrob a little. ** [Marty/11 Nov] ** Added warn, also added new ban/unban. *****************************************************************************/ #define ADMIN_C #include "verbs.h" #include "kernel.h" #include "config.h" #include <unistd.h> #include <stdlib.h> #include <string.h> #ifdef RS6000 #include <strings.h> #endif #include "admin.h" #include "pflags.h" #include "sflags.h" #include "sendsys.h" #include "lflags.h" #include "mobile.h" #include "bprintf.h" #include "uaf.h" #include "mud.h" #include "fight.h" #include "rooms.h" #include "wizlist.h" #include "calendar.h" #include "log.h" #include "main.h" #include "parse.h" #include "flags.h" #include "utils.h" #include "wizlist.h" #include "flags.h" #include "quests.h" #include "tables.h" #include "special.h" A_COMMAND(startbecom) { bprintf("I'm sorry, but the become function has been disabled.\n"); return; } /***************************************************************************** ** Online player/host banning system. ** Usage: fban [<player name>/host/lock/report] <hostname> ** Examples: ** fban Foo: ban player Foo from mud. ** fban host foo.bar.soap: will ban host foo.bar.soap ** fban lock foo.bar.soap: will lock the host foo.bar.soap for new users. ** fban report <message>: Log <message> stating why you banned a host etc., ** Note: To be able to use this command you must have the PFL_BANHOST ** or PFL_BANPLR. ******************************************************************************/ A_COMMAND(bancom) { int ret; /* Check for command execute rights */ if (!ptstflg(mynum,PFL_BANPLR) && !ptstflg(mynum,PFL_BANHOST)) { erreval(); return; } if (brkword() == -1) { bprintf("Ban What/Who?\n"); return; } if (EQ(wordbuf,"lock")) /* Locking a host */ { if (!ptstflg(mynum,PFL_BANHOST)) { bprintf("You are not allowed to ban/lock hosts.\n"); return; } getreinput(wordbuf); /* Get Hostname */ if (strlen(wordbuf) < 3) { bprintf("I doubt that is a valid hostname.\n"); return; } ret = add_host(LOCKED_HOSTS,wordbuf); if (ret == HOST_NOTADDED) { bprintf("Host was already in file.\n"); return; } else if (ret == HOST_FERROR) { bprintf("Error opening file.\n"); return; } #ifdef LOG_BAN mudlog("BAN: Lock %s by %s",wordbuf,pname(mynum)); #endif bprintf("Okay, %s is in the locked host file.\n",wordbuf); } else if (EQ(wordbuf,"host")) /* Banning of host */ { if (!ptstflg(mynum,PFL_BANHOST)) { bprintf("You are not allowed to ban hosts.\n"); return; } getreinput(wordbuf); if (strlen(wordbuf) < 3) { bprintf("I doubt that is a valid hostname.\n"); return; } ret = add_host(BAN_HOSTS,wordbuf); #ifdef LOG_BAN mudlog("BAN: Host %s by %s",wordbuf,pname(mynum)); #endif bprintf("Okay, %s is in the banned host file.\n",wordbuf); } else if (EQ(wordbuf,"report")) { getreinput(wordbuf); if (strlen(wordbuf) < 5) { bprintf("Please say something a bit more useful.\n"); return; } #ifdef LOG_BAN mudlog("BAN: report (%s) %s",pname(mynum),wordbuf); #endif bprintf("Your report has been noted.\n"); } else /* Banning of char */ { if (!ptstflg(mynum,PFL_BANPLR)) { bprintf("You are not allowed to ban players.\n"); return; } ret = add_host(BAN_CHARS,wordbuf); #ifdef LOG_BAN mudlog("BAN: Player %s by %s",wordbuf,pname(mynum)); #endif bprintf("Okay, the name %s is now banned.\n",wordbuf); } } A_COMMAND(unbancom) { int ret = HOST_FERROR; if (!ptstflg(mynum,PFL_BANHOST) && !ptstflg(mynum,PFL_BANPLR)) { erreval(); return; } if (brkword() == -1) { bprintf("Usage: Unban <host/lock/user> name\n"); return; } if (strncasecmp(wordbuf,"host",strlen(wordbuf)) == 0) { if (!ptstflg(mynum,PFL_BANHOST)) { bprintf("You are not allowed to do that.\n"); return; } ret = remove_host(BAN_HOSTS,getreinput(globalbuf)); } else if (strncasecmp(wordbuf,"lock",strlen(wordbuf)) == 0) { if (!ptstflg(mynum,PFL_BANHOST)) { bprintf("You do not have the rights to do that.\n"); return; } ret = remove_host(LOCKED_HOSTS,getreinput(globalbuf)); } else if (strncasecmp(wordbuf,"user",strlen(wordbuf)) == 0) { if (!ptstflg(mynum,PFL_BANPLR)) { bprintf("You can't do that yet.\n"); return; } ret = remove_host(BAN_CHARS,getreinput(globalbuf)); } else { bprintf("Usage: Unban <host/lock/user> name\n"); return; } if (ret == HOST_NOTFOUND) { bprintf("No Match found for %s.\n",globalbuf); return; } else if (ret == HOST_FERROR) { bprintf("Error opening files.\n"); } else { bprintf("Okay %s %s has been removed.\n", wordbuf,globalbuf); #ifdef LOG_BAN mudlog("BAN: %s %s unbanned by %s",wordbuf,globalbuf,pname(mynum)); #endif } } /*************************************************************************** ** BugCom: Post a bug report in the syslog ** Available: Everybody **************************************************************************/ A_COMMAND(bugcom) { char b[80]; int l = ploc(mynum); getreinput (globalbuf); /* Jail code */ if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD)) { bprintf("Obviously, YOU'RE the bug, or you wouldn't be in here.\n"); return; } if (EMPTY (globalbuf)) { bprintf ("What do you want to bug me about?\n"); } else { buglog ("&+wBUG BY &+w%s &+w[&+w%s&+w]&*: %s", pname (mynum), xshowname(b,l),globalbuf); bprintf ("Your input has been noted.\n"); } } A_COMMAND(suggestcom) { getreinput(globalbuf); if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD)) { bprintf("I have a suggestion for you, next time: &+wbehave&*!\n"); return; } if (EMPTY(globalbuf)) { bprintf("What suggestion do you have?\n"); } else { suggestlog("&+wSUGGESTION&+w by %s: %s",pname(mynum),globalbuf); bprintf("Thanks, we will taken in consideration.\n"); } } /***************************************************************************** ** TypoCom: Post a typo in the syslog ** Available: All ****************************************************************************/ A_COMMAND(typocom) { int l = ploc (mynum); char y[80]; getreinput (globalbuf); /* jail code */ if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_ARCHWIZARD) ) { bprintf("You don't like the accomodations? We keep our jails spotless!\n"); return; } if (EMPTY (globalbuf)) bprintf ("What typo do you wish to inform me of?\n"); else { buglog ("&+wTYPO BY &+w%s &+win %s &+w[&+w%s&+w]: %s", pname (mynum), xshowname (y, l), sdesc (l), globalbuf); bprintf ("Your input has been noted.\n"); } } /***************************************************************************** ** General purpose log command. To explain actions, add comments etc. ** Access: WIZ+ *****************************************************************************/ A_COMMAND(logcom) { getreinput(globalbuf); if (EMPTY(globalbuf)) { bprintf("&+wUsage: &+wlog <message>&*\n"); } else { mudlog("LOG (%s): %s",pname(mynum),globalbuf); send_msg(DEST_ALL,MODE_QUIET|MODE_BRACKET,LVL_ARCHWIZARD,LVL_MAX,mynum,NOBODY, "&+wLOG &+w(%s)&+w: %s",pname(mynum),globalbuf); bprintf("Message has been logged.\n"); } } /**************************************************************************** ** Disconnect a player which seems to be stuck (or who is misbehaving ;)) ****************************************************************************/ A_COMMAND(disconnectcom) { int x = 0; if (!ptstflg (mynum, PFL_DISCONNECT)) { erreval(); return; } if (EMPTY (item1)) { bprintf ("Disconnect who?\n"); return; } if ((x = pl1) == -1) { bprintf ("No such player or mobile on the game.\n"); return; } if (x >= max_players) { bprintf("You cannot disconnect a mobile.\n"); return; } if (wlevel (plev (mynum)) < wlevel (plev (x))) { bprintf ("You can't disconnect %s.\n", pname (x)); } else { p_crapup (x,"\tSocket error: Connection Reset by Foreign Host.", CRAP_SAVE | CRAP_RETURN); } return; } /**************************************************************************** ** This command makes a god of every one who uses it, if his/her name is ** also in the prived file. ****************************************************************************/ A_COMMAND(unveilstart) { unveilcom(NULL); } void unveilcom (char *unv_pass) { int lev; if (cur_player->aliased || cur_player->polymorphed != -1) { bprintf("Not while aliased.\n"); return; } if (!cur_player->isawiz) { erreval(); return; } if (unv_pass == NULL) /* Ask player for the magic word */ { cur_player->work = LVL_GOD; bprintf("Welcome to the gates of the gods. Please unveil your right to be a God\n" "by entering the right password.\n"); if (brkword() == -1) { cur_player->work = LVL_GOD; } else { cur_player->work = atoi(wordbuf); if (cur_player->work < LVL_GOD) cur_player->work = LVL_GOD; } strcpy(cur_player->cprompt,cur_player->prompt); strcpy(cur_player->prompt, "Magic Word: "); bprintf("\n\377\373\001\001Magic Word: "); cur_player->no_echo = True; push_input_handler(unveilcom); } else { bprintf("\377\374\001\001"); cur_player->no_echo = False; pop_input_handler(); if (!EQ(unv_pass, UNVEILPASSWD)) { bprintf("\nWhat? Get away you puny mortal!\a\n"); mudlog("UNVEIL: bad unveil attempt by %s", pname(mynum)); } else { lev = cur_player->work; if (lev >= LVL_MAX) { mudlog("UNVEIL: bad unveil %s to %d", pname(mynum), plev(mynum)); bprintf("The maximum level is %d.\n", LVL_MAX - 1); } else { setplev(mynum, lev); update_wizlist(pname(mynum), wlevel(lev)); mudlog("UNVEIL: %s to %d", pname(mynum), plev(mynum)); bprintf("\nYes Sir!\n"); } } strcpy(cur_player->prompt,cur_player->cprompt); get_command(NULL); } } /************************************************************************** ** Declare WAR on the world (allow fights) **************************************************************************/ A_COMMAND(warcom) { the_world->w_peace = 0; broad ("&+wThe air of peace and friendship lifts.&*\n"); send_msg (DEST_ALL, MODE_QUIET | MODE_BRACKET, LVL_APPREN, LVL_MAX, mynum, NOBODY, "&+wWar declared&+w by %s", pname (mynum)); #ifdef LOG_WAR mudlog ("WAR by %s", pname (mynum)); #endif } /**************************************************************************** ** Declare PEACE on the world (stop fights) ****************************************************************************/ A_COMMAND(peacecom) { int m; the_world->w_peace = 1; for (m = 0; m < max_players; m++) { setpfighting (m, -1); } send_msg (DEST_ALL, MODE_QUIET | MODE_BRACKET, LVL_APPREN, LVL_MAX, mynum, NOBODY, "&+wPeace declared &+wby %s", pname (mynum)); broad ("&+wPeace and tranquility descend upon the world.&*\n"); #ifdef LOG_WAR mudlog ("PEACE by %s", pname (mynum)); #endif } A_COMMAND(wizlock) { extern char *WizLevels[]; extern char *MLevels[]; extern char *FLevels[]; char levelbuf[80]; char line[100]; int len, new_lev=0, x; int param= -1; static int wlev_2_nlev[] = { 0, LVL_APPRENTICE, LVL_EMERITUS, LVL_WIZARD, LVL_SENIOR, LVL_COUNSEL, LVL_ARCHWIZARD, LVL_HIGHARCH, LVL_ADVISOR, LVL_DEMI, LVL_HIGHDEMI, LVL_GOD, LVL_MASTER }; param = brkword(); if (plev(mynum) < LVL_APPREN || !ptstflg(mynum,PFL_LOCK) || param == -1) { bprintf("The world is currently %slocked.\n", lev2s(levelbuf,the_world->w_lock,False)); } else { len = strlen(wordbuf); if (strncasecmp(wordbuf,"off",len) == 0 || strncasecmp(wordbuf,"unlock",len) == 0) new_lev = 0; else if ((x = tlookup(wordbuf,WizLevels)) > 0) new_lev = wlev_2_nlev[x]; else if ((x = tlookup(wordbuf,MLevels)) > 0) new_lev = x; else if ((x = tlookup(wordbuf,FLevels)) > 0) new_lev = x; else if (isdigit(*wordbuf)) new_lev = atoi(wordbuf); else new_lev = the_world->w_lock; if (new_lev > plev(mynum)) { bprintf("You can't %slock the game.\n",lev2s(levelbuf,new_lev,False)); } else { sprintf(line,"&+w[&+wThe World is now &+w%s&+wlocked&+w]&#&#&*\n", new_lev == 0 ? "Un" : lev2s(levelbuf,new_lev,False)); the_world->w_lock = new_lev; broad(line); } } } A_COMMAND(zapcom) { int vic, x; if (!ptstflg (mynum, PFL_ZAP)) { bprintf ("The spell fails.\n"); return; } /* Jail code */ if (ltstflg(ploc(mynum),LFL_JAIL) && (plev(mynum) < LVL_DEMI) ) { bprintf("If you're not careful, YOU can be the one being zapped!\n"); return; } if (brkword () == -1) { bprintf ("Zap who?\n"); return; } if ((vic = pl1) == -1) { bprintf ("There is no one on with that name.\n"); return; } if (vic == mynum) { bprintf("Please be so kind to use the delete function at the login menu.\n"); return; } /* Message to everyone in the same room */ send_msg (ploc (vic), 0, pvis (vic), LVL_MAX, vic, NOBODY, "\001A\033[1m\003\001c&+wA massive lightning " "bolt strikes \003\001D%s\003\001c!\n\003\001A\033[0m\003&*", pname (vic)); if (!do_okay (mynum, vic, PFL_NOZAP)) { sendf (vic, "&+w%s casts a lightning bolt at you!&*\n", see_player (vic, mynum) ? pname (mynum) : "Someone"); } /* end ZAP not successful */ else { sendf (vic, "\001A\033[1m\003&+wA massive lightning bolt arcs down out of " "the sky to strike you between&*\n&+wthe eyes!&*\001A\033[0m\003\n" "&+wYou have been utterly destroyed by %s.&*\n", see_player (vic, mynum) ? pname (mynum) : "Someone"); if (vic < max_players) { if (plev (vic) >= LVL_APPREN) update_wizlist (pname (vic), LEV_MORTAL); deluaf (pname (vic)); send_msg (ploc (vic), 0, pvis (vic), LVL_MAX, vic, NOBODY, "\001s%s\003%s has just died.\n\003", pname (vic), pname (vic)); x = real_mynum; p_crapup (vic,"\t\t&+wBye Bye.... Slain by a Thunderbolt&*", CRAP_RETURN); } /* end if PC was zapped */ else wound_player (mynum, vic, pstr (vic) + 1, VERB_ZAP); #ifdef LOG_ZAP mudlog ("ZAP: %s &+wZAPped&+w %s", pname (mynum), pname (vic)); #endif /* Send info-msg. to wizards */ send_msg (DEST_ALL, MODE_BRACKET, Max(pvis(mynum),LVL_APPREN), LVL_MAX, vic, NOBODY, "\001p%s\003 has just been &+wzapped&+w by \001p%s\003", pname (vic), pname (mynum)); /* end if NPC was zapped */ } /* end ZAP successful */ broad ("\001dYou hear an ominous clap of thunder in the distance.\n\002"); } /* end ZAPcom */ /***************************************************************************** ** Delete a entry in the users file. ** Note: the player's setin/out messages remain in setins file. *****************************************************************************/ A_COMMAND(deletecom) { if (!ptstflg(mynum, PFL_DELETE)) { erreval(); return; } if (brkword() == -1 || strlen(wordbuf) > PNAME_LEN) { bprintf("Delete who?\n"); return; } mudlog("UAF: %s deleted %s", pname(mynum), wordbuf); deluaf(wordbuf); update_wizlist(wordbuf, LEV_MORTAL); bprintf("Deleted %s.\n", wordbuf); } /* Soc stuff, by cornwall */ A_COMMAND(socinfo) { int i; int usercount = 0; if (!ptstflg(mynum, PFL_SOCKET)) { erreval (); return; } bprintf ("&+wSocket(?) Status Name Host&*\n" "&+w%s&*\n", DASHLINE); for (i = 0; i < max_players; i++) { if ((pvis (i) > plev (mynum) && i != mynum) || #ifdef TCP_ANNOUNCE !players[i].inp_handler || (plev(mynum) < LVL_ARCHWIZARD && !players[i].iamon) || #else !players[i].iamon || #endif strncasecmp(pname(i), item1, strlen(item1)) ) continue; bprintf ("&+w[&+w %d&+w ] ",i); if (!players[i].iamon) { if (players[i].linkdead) bprintf ("[&+w No Link &+w]"); else if (!EMPTY(pname(i))) bprintf ("[&+w *tcp*&+w ]"); else bprintf ("[&+w Setup&+w ]"); } else { bprintf("[&+wConnected&+w]"); } bprintf ("&+w %-*s", PNAME_LEN, EMPTY(pname(i)) ? "Undecided" : pname(i)); bprintf ("&+w%s&*\n", players[i].realhostname); usercount++; } bprintf ("&+w%s\n&+wA total of &+w%d&+w visible connection(s).&+w\n",DASHLINE, (long)usercount); } A_COMMAND(killsocket) { int s; if (EMPTY(txt1)) { bprintf("No input given.\n"); return; } if (!ptstflg(mynum, PFL_SOCKET)) { erreval (); return; } s = atoi(txt1); if ((s > 31) || (s<0)) { bprintf("Invalid input. Please specify socket number.\n"); return; } bprintf("&+wSocket chosen: &+w%d&+w. Trying to clean up socket...\n" "&+wSocket killed for &+w%s&+w.&*\n",s,EMPTY(pname(s)) ? "John Doe" : pname(s)); mudlog("SOCKET: Socket %d killed for %s by %s.",s,EMPTY(pname(s)) ? "John Doe" : pname(s),pname(mynum)); send_msg (DEST_ALL, MODE_BRACKET|MODE_QUIET, Max(pvis(mynum),LVL_APPRENTICE), LVL_MAX, NOBODY, NOBODY, "%s killed socket %d, player %s", pname (mynum), s, EMPTY(pname(s)) ? "John Doe" : pname(s)); p_crapup (s,"\tConnection killed by foreign host [bad connect].", CRAP_RETURN); } A_COMMAND(jailcom) { PERSONA d; char buff[80]; if (plev(mynum) < LVL_ARCHWIZARD) { bprintf("Pardon?\n"); return; } if ((pl1 > max_players) || (pl1 < 0 || EMPTY(item1))) { bprintf("Jail who?\n"); return; } if (getuaf(strcpy (buff, item1), &d)) { if (d.p_level >= LVL_ARCHWIZARD) { bprintf("I don't think that would be effective.\n"); return; } if (findroomnum(d.p_home) != jail_loc) { strcpy(d.p_home,showname(jail_loc)); bprintf("You have jailed %s.\n", d.p_name); if (pl1 > -1) setphome (pl1,jail_loc); } else { if (plev(mynum) < LVL_DEMI) { bprintf("They are already jailed and you cannot let them out.\n"); return; } bprintf("You have released %s from jail.\n",d.p_name); strcpy(d.p_home,""); if (pl1 > -1) setphome(pl1,0); } putuaf(&d); } else { bprintf("No such player %s.\n", buff); return; } if (pl1 != -1) { if (phome(pl1) == jail_loc) { sendf(pl1,"You have been jailed!\n"); mudlog ("JAIL: %s has been jailed by %s.",pname(pl1), pname(mynum) ); send_msg (DEST_ALL, MODE_BRACKET | MODE_QUIET, LVL_ARCHWIZARD, LVL_MAX, mynum, NOBODY, "%s has been jailed by %s", buff , pname(mynum) ); setploc(pl1 ,jail_loc); } else { sendf(pl1,"You have been set free. Let this be a lesson to you!\n"); mudlog("JAIL: %s has freed %s",pname(mynum), buff); send_msg(DEST_ALL,MODE_BRACKET|MODE_QUIET, LVL_ARCHWIZARD, LVL_MAX, mynum, NOBODY, "%s has been freed by %s", buff, pname(mynum) ); setploc (pl1, get_rand_start()); } } } A_COMMAND(noruncom) { int loc=0; if (!ptstflg(mynum,PFL_RESET)) { erreval(); return; } if (the_world->w_start_loc == 0) { if (brkword() == -1) { loc = get_rand_start(); } else { loc = find_loc_by_name(wordbuf); if (loc == 0) loc = get_rand_start(); } bprintf("Running not allowed anymore.\n" "Players will enter in %s [%s]\n",sdesc(loc),showname(loc)); send_msg(DEST_ALL,MODE_QUIET|MODE_BRACKET,LVL_APPREN,LVL_MAX,mynum,NOBODY, "NoRun Mode activated. Setting start to %s", showname(loc)); the_world->w_start_loc = loc; return; } else { bprintf("Running is now allowed again.\n"); send_msg(DEST_ALL,MODE_QUIET|MODE_BRACKET,LVL_APPREN,LVL_MAX,mynum,NOBODY, "NoRun Mode de-activated", showname(loc)); the_world->w_start_loc = 0; } } /***************************************************************************** ** FROB promotion commands *****************************************************************************/ PRIVATE void froblog (char *n, int lev, int sco, int str) { mudlog ("FROB: %s by %s: Lev = %d, Sco = %d, Str = %d", n, pname (mynum), lev, sco, str); } PUBLIC A_COMMAND(frobstart) { frobcom(NULL); } PUBLIC void frobcom (char *line) { PERSONA p; struct _f *f; int x; if (line == NULL) { /* First (initial) time */ if (!ptstflg(mynum, PFL_FROB)) { erreval (); return; } if (brkword () == -1 || ((x = fpbn (wordbuf)) == -1 && !ptstflg (mynum, PFL_UAF)) ) { bprintf ("Frob who?\n"); return; } if (x == -1) { if (!getuaf (wordbuf, &p)) { bprintf ("No such persona in system.\n"); return; } if (cant_frob (p.p_level)) { bprintf ("You can't frob %s!\n", wordbuf); return; } } else if (x >= max_players) { bprintf ("You can't frob mobiles!\n"); return; } else if (cant_frob (plev (x))) { bprintf ("You can't frob %s!\n", wordbuf); return; } else { p.p_level = plev (x); p.p_strength = pstr (x); p.p_score = pscore (x); strcpy (p.p_name, pname (x)); } f = NEW (struct _f, 1); strcpy (f->name, p.p_name); f->ingame = fpbn(f->name); f->state = 0; f->level = p.p_level; f->oldlev = p.p_level; f->strength = p.p_strength; f->score = p.p_score; f->oldprompt = COPY (cur_player->prompt); bprintf("\001f"FROBINFO"\003"); strcpy (cur_player->prompt, "New Level: "); f->oldwork = cur_player->work; cur_player->work = (int) f; bprintf ("&+wLevel is:&+w %d\n", f->level); push_input_handler (frobcom); } else { while (*line == ' ' || *line == '\t') ++line; f = (struct _f *) cur_player->work; switch (f->state) { case 0: if (*line == '\0') x = f->level; else x = atoi (line); if (x < LVL_ONE || x > LVL_MAX-1) { bprintf ("Level must be between %d and %d\n", LVL_ONE, LVL_MAX-1); f->state = 20; } else if (cant_fro (x)) { bprintf ("You can't do that.\n"); f->state = 20; } else { f->level = x; f->state = 1; bprintf ("Score is: %d\n", f->score); strcpy (cur_player->prompt, "New Score: "); } break; case 1: if (*line == '\0') x = f->score; else x = atoi (line); f->score = x; f->state = 2; bprintf ("Strength is: %d\n", f->strength); strcpy (cur_player->prompt, "New Strength: "); break; case 2: if (*line == '\0') x = f->strength; else x = atoi (line); if (x <= 0) { bprintf ("Strength must be positive.\n"); f->state = 20; } else { f->strength = x; if ((x = fpbn (f->name)) == -1) { if (!ptstflg (mynum, PFL_UAF)) { bprintf ("%s isn't here.\n", f->name); f->state = 20; } else if (!getuaf (f->name, &p)) { bprintf ("No player named %s.\n", f->name); f->state = 20; } } else { p.p_level = plev (x); p.p_strength = pstr (x); p.p_score = pscore (x); } if (f->state == 2) { froblog (f->name, f->level, f->score, f->strength); if (x >= 0) { setpstr (x, f->strength); pscore (x)= f->score; plev (x) = f->level; if (players[x].defrob != NULL) { players[x].defrob->real_level = f->level; } if (f->level >= 4) /* Fix pflags */ { set_doublebit (&pflags (x), PFL_TITLES); set_doublebit (&pflags (x), PFL_EMOTE); } if (f->level >= LVL_TWELVE) { set_doublebit(&pflags(x), PFL_CANTRANCE); set_doublebit(&pflags(x), PFL_CANTRANCE); } if (wlevel (f->level) != wlevel (f->oldlev)) set_xpflags (f->level, &pflags (x), &pmask (x)); if (f->level <= LVL_APPREN || f->oldlev <= LVL_APPREN) setptitle (x, std_title (f->level, psex (x))); } else { p.p_level = f->level; p.p_strength = f->strength; p.p_score = f->score; if (wlevel (f->level) != wlevel (f->oldlev)) set_xpflags (f->level, &p.p_pflags, &p.p_mask); if (f->level <= LVL_APPREN || f->oldlev <= LVL_APPREN) { strcpy (p.p_title, std_title (f->level, tst_doublebit(&p.p_sflags, SFL_FEMALE))); } putuaf (&p); } update_wizlist (f->name, wlevel (f->level)); bprintf ("Ok.\n"); f->state = 20; } } break; } /* End switch */ if (f->state == 20) { strcpy (cur_player->prompt, f->oldprompt); free (f->oldprompt); cur_player->work = f->oldwork; if(f->ingame >=0 && is_in_game(f->ingame)) { save_player(f->ingame,True); sendf(f->ingame,"%s", players[f->ingame].prompt); if (pvis(f->ingame) > f->level) pvis(f->ingame) = f->level; } free (f); pop_input_handler (); } } bprintf ("%s", cur_player->prompt); } /***************************************************************************** ** Standard function used by wizfrob, awizfrob, dgodfrob, godfrob and ** emerifrob, for setting the levels and checking flags. *****************************************************************************/ PRIVATE int givefrob(int lvl, long score) { int x = -1; PERSONA p; Boolean ison; if (!ptstflg(mynum, PFL_FROB)) { erreval(); return -1; } if (brkword() == -1 || ((x = fpbn(wordbuf)) == -1 )) { if (!ptstflg(mynum,PFL_UAF)) { bprintf("You can only frob online players.\n"); return -1; } if (!getuaf(wordbuf,&p)) { bprintf("Frob who?\n"); return -1; } ison = False; } else { if (x >= max_players) { bprintf ("You can't frob mobiles!\n"); return -1; } player2pers(&p,NULL,x); ison = True; } if (cant_frob (p.p_level)) { bprintf ("You can't frob %s!\n", wordbuf); return -1; } else { p.p_level = lvl; p.p_strength = pmaxstrength(lvl); p.p_score = score; p.p_vlevel = lvl; if (lvl > 4) { set_doublebit(&p.p_pflags, PFL_EMOTE); set_doublebit(&p.p_pflags, PFL_TITLES); } if (lvl > 12) { set_doublebit(&p.p_pflags, PFL_CANTRANCE); } strcpy(p.p_title, std_title (lvl, tst_doublebit(&p.p_sflags,SFL_FEMALE))); bprintf("Ok\n"); putuaf(&p); if (ison) { pers2player(&p,x); calib_player(x); if (players[x].defrob != NULL) { players[x].defrob->real_level = p.p_level; } sendf(x,"You have been frobbed by %s to level %d.\n",pname(mynum),lvl); } } return x; } PUBLIC A_COMMAND(emerifrobcom) { int plx; if ((plx = givefrob(18,levels[LVL_APPRENTICE])) != -1) { set_xpflags(LVL_APPREN, &pflags(plx), &pmask(plx)); update_wizlist(pname(plx),LEV_EMERITUS); mudlog("FROB: emeri status for %s by %s.",pname(plx),pname(mynum)); } } PUBLIC A_COMMAND(wizfrobcom) { int plx; if ((plx = givefrob(10,40000)) != -1) mudlog("FROB: %s has given %s a wizfrob.",pname(mynum), pname(plx)); } PUBLIC A_COMMAND(awizfrobcom) { int plx; if ((plx = givefrob(11,60000)) != -1) mudlog("FROB: %s has given %s an awizfrob.",pname(mynum), pname(plx)); } PUBLIC A_COMMAND(dgodfrobcom) { int plx; if ((plx = givefrob(12,80000)) != -1) mudlog("FROB: %s has given %s a dgodfrob.",pname(mynum), pname(plx)); } PUBLIC A_COMMAND(godfrobcom) { int plx; if ((plx = givefrob(13,100000)) != -1) mudlog("FROB: %s has given %s a godfrob.",pname(mynum), pname(plx)); } /* Testrunners */ A_COMMAND(testruncom) { int loc = 0; if (cur_player->defrob != NULL) { if (!tst_doublebit(&cur_player->defrob->real_pflags,PFL_TESTRUNNER) && xplev(mynum) < LVL_ARCHWIZARD) { erreval(); return; } } else if (!ptstflg(mynum,PFL_TESTRUNNER) && xplev(mynum) < LVL_ARCHWIZARD) { erreval(); return; } if (brkword() == -1) { FILE *fp; char line[80]; int i=0; if ((fp = fopen(TESTRUN_FILE,"r")) == NULL) { bprintf("There are no testrun zones available.\n"); return; } bprintf("You can testrun the following zones:\n"); fgets(line,80,fp); while (!feof(fp)) { line[strlen(line) -1] = '\0'; bprintf(" %-12.12s",line); i++; if (i >= 5) { bprintf("\n"); i = 0; } fgets(line,80,fp); } fclose(fp); if (i > 0) bprintf("\n"); return; } if (EQ(wordbuf,"abort")) { mudlog("TESTRUN: %s has Aborted the testrunning",pname(mynum)); send_msg(DEST_ALL,MODE_BRACKET|MODE_QUIET|MODE_PFLAG|MP(PFL_TESTRUNNER),pvis(mynum), LVL_MAX,mynum,NOBODY,"%s has &+wAborted &+wthe &+wtestrun", pname(mynum)); bprintf("&+w>> You abort the testrunning.\n"); trapch(get_rand_start()); return; } else if (EQ(wordbuf,"insert") && xplev(mynum) >= LVL_ARCHWIZARD) { /* Using host adding here to add stuff */ if (brkword() == -1) { bprintf("Add which zone?\n"); return; } if ((loc = findroomnum(wordbuf)) >= 0) { bprintf("No such zone %s\n",wordbuf); return; } add_host(TESTRUN_FILE,wordbuf); bprintf("Ok.\n"); } else if (EQ(wordbuf,"remove") && xplev(mynum) >= LVL_ARCHWIZARD) { /* Same here */ if (brkword() == -1) { bprintf("Remove which host?\n"); return; } loc = remove_host(TESTRUN_FILE,wordbuf); switch (loc) { case HOST_FERROR: bprintf("A file error occured while removing the zone.\n" "Removal not completed, try doing it manually\n"); break; case HOST_DELETED: bprintf("Zone %s has succesfully been removed.\n",wordbuf); break; case HOST_NOTFOUND: bprintf("That zone isn't in the testzone file\n"); break; default: bprintf("Unknown response from system.\n"); break; } return; } else if (infile(TESTRUN_FILE,wordbuf)) { char locname[80]; strcpy(locname,wordbuf); strcat(locname,"1"); loc = findroomnum(locname); if (loc >= 0) { bprintf("Sorry that zone is currently not available for testrunning.\n"); return; } bprintf("&+w>> Entering testrun zone &+w%s.\n",lowner(loc)); trapch(loc); send_msg(DEST_ALL,MODE_BRACKET|MODE_QUIET|MODE_PFLAG|MP(PFL_TESTRUNNER),pvis(mynum),LVL_MAX, mynum,NOBODY,"%s is &+wtestrunning&* &+w%s",pname(mynum),lowner(loc)); mudlog("TESTRUN: %s has entered %s for testrunning",pname(mynum),lowner(loc)); } else bprintf("No such testrun zone.\n"); }