|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 37833 (0x93c9) Types: TextFile Names: »parse.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Abermud/parse.c«
/* ** */ #include "kernel.h" #include <signal.h> #ifdef RCSID static char RCS[] = "$Header: parse.c,v 1.1 89/03/13 09:37:30 rsalz Exp $"; #endif /* RCSID */ #define NOISECHAR(c) ((c) == ' ' || (c) == '.' || (c) == ',') static char *exittxt[] = { "north", "east", "south", "west", "up", "down", "n", "e", "s", "w", "u", "d", 0 }; static int exitnum[] = {1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6}; static int tmynum; /* Who am i really if aliased */ static int iraq; sendsys(to, from, codeword, chan, text) char *to, *from; int codeword, chan; char *text; { int block[128]; int *i; block[1] = codeword; block[0] = chan; sprintf((char *)&block[2], "%s%s%s%s", to, ".", from, "."); if (codeword != -9900 && codeword != -10021) strcpy((char *)&block[64], text); else { i = (int *)text; block[64] = i[0]; block[65] = i[1]; block[66] = i[2]; } send2(block); } /* ** Test if string contains a substring */ static int comparethem(a, b, n) register char *a; register char *b; register int n; { register char c; register char d; while (--n >= 0) { c = *a++; d = *b++; if (isupper(c)) c = tolower(c); if (c != d) return 0; } return 1; } contains(s1, s2) register char *s1; register char *s2; { register int b; register int c; b = strlen(s2); c = strlen(s1) - b; if (c >= 0) for (; c; c--) if (comparethem(s1 + c, s2, b - 1)) return 1; return -1; } pncom() { #ifndef LOWMEM bprintf("Current pronouns are:\n"); bprintf("Me : %s\n", globme); bprintf("Myself : %s\n", globme); bprintf("It : %s\n", wd_it); bprintf("Him : %s\n", wd_him); bprintf("Her : %s\n", wd_her); bprintf("Them : %s\n", wd_them); if (plev(mynum) > 9) { bprintf("There : %s %s\n", wd_there, wd_th2); } #else bprintf("I don't know that verb\n"); #endif } int gamecom(str) char *str; { int a; if (!EQ(str, "!")) strcpy(strbuf, str); stp = 0; if (EMPTY(str)) return 0; if (EQ(str, "!")) strcpy(str, strbuf); if (brkword() == -1) { bprintf("Pardon?\n"); return -1; } if ((a = fpbn(wordbuf)) != -1) { stp = 0; a = 20; doaction(a); return 0; } if ((a = chkverb()) == -1) { bprintf("I don't know that verb\n"); return -1; } if (debug_mode) bprintf("**VERB :%d\n", a); doaction(a); return 0; } int brkword() { static int neword = 0; int worp; if (!stp) neword = 0; if (neword) { strcpy(wordbuf, wd_th2); neword = 0; skicand = 0; return 0; } for ( ; ; ) { while (NOISECHAR(strbuf[stp])) stp++; for (worp = 0; strbuf[stp] && !NOISECHAR(strbuf[stp]); ) wordbuf[worp++] = strbuf[stp++]; wordbuf[worp] = 0; lowercase(wordbuf); if (EQ(wordbuf, "the") || EQ(wordbuf, "a") || EQ(wordbuf, "an") || EQ(wordbuf, "of")) continue; if (EQ(wordbuf, "it")) strcpy(wordbuf, wd_it); if (EQ(wordbuf, "them")) strcpy(wordbuf, wd_them); if (EQ(wordbuf, "him")) strcpy(wordbuf, wd_him); if (EQ(wordbuf, "her")) strcpy(wordbuf, wd_her); if (EQ(wordbuf, "me")) strcpy(wordbuf, globme); if (EQ(wordbuf, "myself")) strcpy(wordbuf, globme); if (EQ(wordbuf, "there")) { strcpy(wordbuf, wd_there); neword = 1; } if (EQ(wordbuf, "candle") && skicand) { skicand = 0; continue; } break; } skicand = 0; return worp ? 0 : -1; } chklist(word, lista, listb) char *word; char *lista[]; int listb[]; { int a, b, c, d; lowercase(word); for (b = 0, c = 0, d = -1, a = 0; lista[a]; a++) if ((b = Match(word, lista[a])) > c) { c = b; d = listb[a]; } return c < 5 ? -1 : d; } int Match(x, y) char *x, *y; { int c, n; if (EQ(x, y)) return 10000; if (EQ(y, "reset")) return -1; if (*x == 0) return 0; for (c = 0, n = 0; x[n] && y[n]; n++) { if (x[n] == y[n]) { if (n == 0) c += 2; else if (n == 1) c++; c++; } else c--; } return c; } chkverb() { return chklist(wordbuf, verbtxt, verbnum); } doaction(n) int n; { char xx[128]; openworld(); if (tables(n) == 2) return; if (n > 1 && n < 8) { if (i_follow) { bprintf("You stopped following.\n"); i_follow = 0; } dodirn(n); return; } if (isforce) switch (n) { case 8: case 150: case 152: case 156: case 163: case 175: case 176: case 179: case 203: bprintf("You can't be forced to do that\n"); return; } switch (n) { case 1: if (i_follow) { bprintf("You stopeed following.\n"); i_follow = 0; } dogocom(); break; case 139: if (in_fight) { bprintf("Not in a fight!\n"); break; } gropecom(); break; case 8: rte(); openworld(); if (in_fight) { bprintf("Not in the middle of a fight!\n"); break; } if (aliased) { unalias(); break; } sprintf(xx, "%s has left the game\n", pname(mynum)); bprintf("Ok"); sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), xx); sprintf(xx, "[ Quitting Game : %s ]\n", pname(mynum)); sendsys(pname(mynum), pname(mynum), -10113, 0, xx); loseme(); crapup(" Goodbye"); break; case 9: getobj(); break; case 137: crashcom(); break; case 10: dropitem(); break; case 13: whocom(); break; case 14: rescom(); break; case 15: lightning(); break; case 16: eatcom(); break; case 17: playcom(); break; case 21: saveme(); break; case 25: stealcom(); break; case 26: levcom(); break; case 27: helpcom(); break; case 28: valuecom(); break; case 29: stacom(); break; case 30: examcom(); break; case 31: /* delete user, in main menu now. */ case 32: /* change password, in main menu now. */ bprintf("Can't do that from here.\n"); break; case 33: sumcom(); break; case 34: weapcom(); break; case 35: killcom(); break; case 50: laughcom(); break; case 51: crycom(); break; case 52: burpcom(); break; case 53: fartcom(); break; case 54: hiccupcom(); break; case 55: grincom(); break; case 56: smilecom(); break; case 57: winkcom(); break; case 58: sniggercom(); break; case 59: posecom(); break; case 60: setcom(); break; case 61: praycom(); break; case 62: stormcom(); break; case 63: raincom(); break; case 64: suncom(); break; case 65: snowcom(); break; case 66: goloccom(); break; case 100: wearcom(); break; case 101: removecom(); break; case 102: putcom(); break; case 103: wavecom(); break; case 104: blizzardcom(); break; case 109: forcecom(); break; case 110: lightcom(); break; case 111: extinguishcom(); break; case 118: cripplecom(); break; case 119: curecom(); break; case 120: dumbcom(); break; case 121: changecom(); break; case 122: missilecom(); break; case 123: shockcom(); break; case 124: fireballcom(); break; case 126: blowcom(); break; case 127: sighcom(); break; case 128: kisscom(); break; case 129: hugcom(); break; case 130: slapcom(); break; case 131: ticklecom(); break; case 132: screamcom(); break; case 133: bouncecom(); break; case 134: wizcom(); break; case 135: starecom(); break; case 136: exits(); break; case 138: singcom(); break; case 140: spraycom(); break; case 141: groancom(); break; case 142: moancom(); break; case 143: dircom(); break; case 144: yawncom(); break; case 117:; case 113: pushcom(); break; case 145: wizlist(); break; case 146: incom(); break; case 147: lightcom(); break; case 114: inviscom(); break; case 115: viscom(); break; case 148: deafcom(); break; case 149: ressurcom(); break; case 150: logcom(); break; case 151: tsscom(); break; case 152: rmeditcom(); break; case 154: squeezecom(); break; case 153: loccom(); break; case 155: usercom(); break; case 156: u_system(); break; case 157: inumcom(); break; case 158: updcom(); break; case 159: becom(); break; case 160: systat(); break; case 161: convcom(); break; case 162: snoopcom(); break; case 163: shellcom(); break; case 164: if (!ptstflg(mynum, 3)) { bprintf("I don't know that verb.\n"); break; } rawcom(); break; case 165: purrcom(); break; case 166: cuddlecom(); break; case 167: sulkcom(); break; case 168: rollcom(); break; case 169: bprintf("\001f%s\001", CREDITS); break; case 170: if (ptstflg(mynum, 8)) pclrflg(mynum, 8); else psetflg(mynum, 8); break; case 171: debugcom(); break; case 172: jumpcom(); break; case 112: wherecom(); break; case 173: bprintf("Your adventurers automatic monster detecting radar, and long range\n"); bprintf("mapping kit, is, sadly, out of order.\n"); break; case 174: if (!in_fight) { dogocom(); break; } else { if (iscarrby(32, mynum)) { bprintf("The sword won't let you!\n"); break; } sprintf(xx, "\001s%s\001%s drops things as %s make a frantic attempt to escape\n\001", psex(mynum) ? "she" : "he", pname(mynum), pname(mynum)); sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), xx); sendsys(pname(mynum), pname(mynum), -20000, ploc(mynum), ""); setpscore(mynum, pscore(mynum) - pscore(mynum) / 33); /* loose 3% */ calibme(); in_fight = 9999; if (i_follow) { bprintf("You stopped following.\n"); i_follow = 0; } on_flee_event(); dogocom(); break; } case 175: bugcom(); break; case 176: typocom(); break; case 177: pncom(); break; case 178: blindcom(); break; case 179: edit_world(); break; case 180: if (ptstflg(mynum, 4)) debug_mode = 1 - debug_mode; break; case 181: setpflags(); break; case 182: frobnicate(); break; case 187: emotecom(); break; case 189: emptycom(); break; #ifndef LOWMEM case 190: timecom(); break; case 191: locdir(); break; case 192: showitem(); break; case 193: warcom(); break; case 194: peacecom(); break; case 195: awizlock(); break; case 196: wizlock(); break; case 197: awizunlock(); break; case 198: wizunlock(); break; case 199: awizcom(); break; #endif case 200: bprintf("Fly!, you haven't got a license!\n"); break; case 201: followcom(); break; case 202: losecom(); break; case 203: cls(); break; case 204: if (plev(mynum) > 9999) while (brkword() != -1) bprintf("'%s'\n", wordbuf); break; case 205: thankcom(); break; case 206: nodcom(); break; case 207: begcom(); break; case 208: tracecom(); break; case 209: startcom(); break; case 210: stopcom(); break; case 211: mobilecom(); break; case 212: peoplecom(); break; case 213: gigglecom(); break; case 214: pukecom(); break; case 215: readcom(); break; case 216: if (plev(mynum) < 10000) bprintf("Pardon?\n"); else broad("\001dA huge crash of thunder echoes through the land.\n\001d"); break; case 125: transcom(); break; case 217: godlock(); break; case 218: godunlock(); break; case 225: if (plev(mynum) > 9999) { cms = -2; update(); closeworld(); #ifdef SIGSTOP bprintf("Type fg to continue\n"); pbfr(); kill(getppid(), SIGSTOP); #endif /* SIGSTOP */ keysetup(); cms = -1; break; } else erreval(); break; case 227: if (plev(mynum) > 10 || aliased) { if (pl1 == -1) { bprintf("Who ?\n"); error(); break; } if (ptstflg(pl1, 14)) { bprintf("Already occupied!\n"); error(); break; } if (pl1 < 16) { bprintf("Thats a player though!\n"); error(); break; } if (aliased) pclrflg(mynum, 14); if (!aliased) { /* Hmm.. which way is this? was tmynum = tmynum */ tmynum = mynum; cms = -2; update(); } mynum = pl1; cms = -1; update(); bprintf("Aliased to %s\n", pname(pl1)); aliased = 1; psetflg(mynum, 14); } else bprintf("What ?\n"); break; case 228: sniffcom(); break; case 229: strutcom(); break; case 230: if (ptstflg(mynum, 3) == 0) { bprintf("I don't know that verb.\n"); break; } show_priv(); break; case 231: if (plev(mynum) > 10) shurrup = 1; else bprintf("Huh ?\n"); break; case 232: if (plev(mynum) > 10) shurrup = 0; else bprintf("Huh ?\n"); break; default: erreval(); break; } } dogocom() { int a; if (brkword() == -1) { bprintf("GO where ?\n"); return -1; } if (EQ(wordbuf, "rope")) strcpy(wordbuf, "up"); if (EQ(wordbuf, "well")) strcpy(wordbuf, "down"); if (EQ(wordbuf, "maiden")) strcpy(wordbuf, "east"); if (EQ(wordbuf, "window")) { if (ploc(mynum) == -102) strcpy(wordbuf, "west"); if (ploc(mynum) == -103) strcpy(wordbuf, "east"); } if (EQ(wordbuf, "cauldron")) { bprintf("You cant go into that!\n"); return -1; } if ((a = chklist(wordbuf, exittxt, exitnum)) == -1) { bprintf("Thats not a valid direction\n"); return -1; } return dodirn(a + 1); } dodirn(n) int n; { char block[256]; int newch, i; int drnum, droff; if (in_fight > 0 && in_fight != 9999) { bprintf("You can't just stroll out of a fight!\n"); bprintf("If you wish to leave a fight, you must FLEE in a direction\n"); return -1; } if (iscarrby(32, mynum) && ploc(25) == ploc(mynum) && !EMPTY(pname(25))) { bprintf("\001cThe Golem\001 bars the doorway!\n"); return -1; } n -= 2; if (chkcrip()) return -1; newch = getexit(ploc(mynum), n); if (newch > 999 && newch < 2000) { drnum = newch - 1000; droff = drnum ^ 1; /* other door side */ if (state(drnum)) { if (!EQ(oname(drnum), "door") || isdark() || EMPTY(olongt(drnum, state(drnum)))) { /* NOTE: ADD OLONGT to yield correct int text of object */ bprintf("You can't go that way\n"); /* Invis doors */ } else bprintf("The door is not open\n"); return -1; } newch = oloc(droff); } if (newch == -139) { if (!iswornby(113, mynum) && !iswornby(114, mynum) && !iswornby(89, mynum)) { bprintf("The intense heat drives you back\n"); return -1; } bprintf("The shield protects you from the worst of the lava stream's heat\n"); } if (n == 2) { if ((i = fpbns("figure")) != mynum && i != -1 && ploc(i) == ploc(mynum) && !iswornby(101, mynum) && !iswornby(102, mynum) && !iswornby(103, mynum)) { bprintf("\001pThe Figure\001 holds you back\n"); bprintf("\001pThe Figure\001 says 'Only true sorcerors may pass'\n"); return -1; } } if (newch == 10200) { if (state(137) != 0) { bprintf("That doesn't look a very good idea!\n"); return -1; } newch = -162; } if (newch >= -999 && newch <= -900) { if (plev(mynum)< 10 && !iscarrby(206, mynum) && !iscarrby(207, mynum)) { bprintf("You need a boat to go to sea!\n"); return -1; } } if (newch >= 0) { bprintf("You can't go that way\n"); return -1; } sprintf(block, "%s%s%s%s%s%s%s%s%s%s", "\001s", pname(mynum), "\001", pname(mynum), " has gone ", exittxt[n], " ", out_ms, ".", "\n\001"); sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), block); setploc(mynum, newch); sprintf(block, "%s%s%s%s %s%s", "\001s", pname(mynum), "\001", pname(mynum), in_ms, "\n\001"); sendsys(globme, globme, -10000, newch, block); in_fight = 0; trapch(ploc(mynum)); return 0; } gamrcv(blok) int *blok; { char zb[150]; int *i; char nam1[40], nam2[40], text[256], nameme[40]; int isme; lowercase(strcpy(nameme, pname(mynum))); isme = split(blok, nam1, nam2, text, nameme); if (blok[1] == -20000 && fpbns(nam1) == fighting) { in_fight = 0; fighting = -1; setpfighting(mynum, -1); } if (blok[1] < -10099) { new1rcv(isme, blok[0], nam1, nam2, blok[1], text); return; } i = (int *)text; switch (blok[1]) { case -9900: setpvis(i[0], i[1]); break; case -666: bprintf("Something Very Evil Has Just Happened...\n"); loseme(); crapup("Bye Bye Cruel World...."); case -599: if (isme) { sscanf(text, "%d.%d.%d.", &my_lev, &my_sco, &my_str); setpstr(mynum, my_str); setplev(mynum, my_lev); setpscore(mynum, my_sco); calibme(); } break; case -750: if (isme) { if (fpbns(nam2) != -1) loseme(); closeworld(); printf("***HALT\n"); exit(0); } case -400: if (isme) snoopd = -1; break; case -401: if (isme) snoopd = fpbns(nam2); break; case -10000: if (isme != 1 && blok[0] == ploc(mynum)) bprintf("%s", text); break; case -10030: wthrrcv(blok[0]); break; case -10021: if (ploc(mynum) == blok[0]) { if (isme == 1) { rdes = 1; vdes = i[0]; } else { if (i[0] == mynum) break; if (EMPTY(pname(i[0]))) return; bprintf("\001p%s\001 attacks \001p%s\001.\n", nam1, pname(i[0])); } } bloodrcv(i, isme); break; case -10020: if (isme == 1) { ades = blok[0]; sscanf(text, "%d", &iraq); if (plev(mynum) >= 10) { bprintf("\001p%s\001 tried to summon you\n", nam2); return; } if (iraq) bprintf("You drop everything you have as you are summoned by \001p%s\001\n", nam2); tdes = 1; } break; case -10001: if (isme == 1) { if (plev(mynum) > 10 && !op(nam2)) bprintf("\001p%s\001 cast a lightning bolt at you\n", nam2); else { /* You are in the .... */ bprintf("A massive lightning bolt arcs down out of the sky to strike"); sprintf(zb, "[ \001p%s\001 has just been zapped by \001p%s\001 and terminated ]\n", pname(mynum), nam2); sendsys(pname(mynum), pname(mynum), -10113, ploc(mynum), zb); bprintf(" you between\nthe eyes\n"); zapped = 1; delpers(pname(mynum)); sprintf(zb, "\001s%s\001%s has just died.\n\001", pname(mynum), pname(mynum)); sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), zb); loseme(); bprintf("You have been utterly destroyed by %s\n", nam2); crapup("Bye Bye.... Slain by a Thunderbolt"); } } else if (blok[0] == ploc(mynum)) bprintf("\001cA massive lightning bolt strikes \001\001D%s\001\001c\n\001", nam1); break; case -10002: if (isme != 1) { if (blok[0] == ploc(mynum) || plev(mynum) > 9) bprintf("\001P%s\001\001d shouts '%s'\n\001", nam2, text); else bprintf("\001dA voice shouts '%s'\n\001", text); } break; case -10003: if (isme != 1 && blok[0] == ploc(mynum)) bprintf("\001P%s\001\001d says '%s'\n\001", nam2, text); break; case -10004: if (isme) bprintf("\001P%s\001\001d tells you '%s'\n\001", nam2, text); break; case -10010: if (isme == 1) { zapped = 1; crapup("You have been kicked off"); } else bprintf("%s has been kicked off\n", nam1); break; case -10011: if (isme == 1) bprintf("%s", text); break; case -10015: if (isme == 1) { loseme(); kill(getppid(), SIGHUP); break; } } } eorte() { static time_t last_io_interrupt; time_t ctm; if (EMPTY(pname(mynum))) { zapped = 1; crapup("You have been exorcised from the game"); } if (snoopt != -1 && EMPTY(pname(snoopt))) { snoopt = -1; bprintf("You can no longer snoop on %s.\n", sntn); } time(&ctm); interrupt = 0; if (ctm - last_io_interrupt > 2) interrupt = 1; if (interrupt) last_io_interrupt = ctm; if (me_ivct) me_ivct--; if (me_ivct == 1) setpvis(mynum, 0); if (interrupt) dointerrupt(); dostatus(); if (me_cal) { me_cal = 0; calibme(); } if (tdes) dosumm(ades); if (in_fight) { if (ploc(fighting) != ploc(mynum)) { fighting = -1; in_fight = 0; setpfighting(mynum, -1); } if (EMPTY(pname(fighting))) { fighting = -1; in_fight = 0; setpfighting(mynum, -1); } if (in_fight && interrupt) { in_fight = 0; hitplayer(fighting, pwpn(mynum)); } } if (iswornby(18, mynum) || randperc() < 25) /* test to make regeneration real-time... (and avoid cheating) */ if (!in_fight && interrupt) { setpstr(mynum, pstr(mynum) + 1); if (i_setup) calibme(); } forchk(); if (me_drunk > 0) { me_drunk--; if (!ail_dumb) gamecom("hiccup"); } interrupt = 0; if (ploc(mynum) == -1067 && state(37) == 1) { loseme(); broad("\001dThere is a long drawn out scream in the distance\001"); crapup("The iron maiden closes....... S Q U I S H !"); } if (plev(mynum) < 10 && ploc(mynum) >= -999 && ploc(mynum) <= -900) { if (!iscarrby(206, mynum) && !iscarrby(207, mynum)) { loseme(); crapup("You plunge beneath the waves...."); } } on_follow(); if (pstr(mynum) < 0 && aliased) { bprintf("You've just died.\n"); unalias(); } } rescom() { FILE *b; time_t t; FILE *a; if (plev(mynum) < 10) { bprintf("What ?\n"); return; } time(&t); mudlog("RESET by %s at %s", pname(mynum), ctime(&t)); broad("Reset in progress....\nReset Completed....\n"); b = openlock(RESET_DATA, "r"); sec_read(b, objinfo, 0, 4 * numobs); closelock(b); a = fopen(RESET_N, "w"); fprintf(a, "%d\n", (int)t); fclose(a); resetplayers(); } lightning() { int vic; if (plev(mynum) < 10) { bprintf("Your spell fails.....\n"); return; } if ((vic = pl1) == -1) { bprintf("There is no one on with that name\n"); return; } sendsys(pname(vic), pname(mynum), -10001, ploc(vic), ""); mudlog("%s zapped %s", pname(mynum), pname(vic)); if (vic > 15) woundmn(vic, 10000); /* DIE */ broad("\001dYou hear an ominous clap of thunder in the distance\n\001"); } eatcom() { int b; if (brkword() == -1) { bprintf("What\n"); return; } if ((ploc(mynum) == -609) && (EQ(wordbuf, "water"))) strcpy(wordbuf, "spring"); if ((b = ob1 == -1 ? ob2 : ob1) == -1) { bprintf("There isn't one of those here\n"); return; } switch (b) { case 11: bprintf("You feel funny, and then pass out\n"); bprintf("You wake up elsewhere....\n"); teletrap(-1076); break; case 75: bprintf("very refreshing\n"); break; case 80: setpstr(mynum, 1000); calibme(); bprintf("You feel much much stronger!\n"); destroy(80); break; case 175: if (plev(mynum) < 3) { setpscore(mynum, pscore(mynum) + 40); calibme(); bprintf("You feel a wave of energy sweeping through you.\n"); } else { bprintf("Faintly magical by the taste.\n"); if (pstr(mynum) < 8) setpstr(mynum, pstr(mynum) + 2); calibme(); } break; default: if (otstbit(b, 6)) { destroy(b); bprintf("Ok....\n"); setpstr(mynum, pstr(mynum) + 12); calibme(); } else bprintf("Thats sure not the latest in health food....\n"); break; } } /* Routine to correct me in user file */ calibme() { int b; char sp[128]; if (!i_setup || aliased) return; if ((b = levelof(pscore(mynum))) != plev(mynum) && plev(mynum) > 0) { setplev(mynum, b); bprintf("You are now %s ", pname(mynum)); mudlog("%s to level %d", pname(mynum), b); disle3(b, psex(mynum)); sprintf(sp, "\001p%s\001 is now level %d\n", pname(mynum), plev(mynum)); sendsys(pname(mynum), pname(mynum), -10113, ploc(mynum), sp); if (b == 10) bprintf("\001f%s\001", GWIZ); } b = 50 + 8 * plev(mynum); if (pstr(mynum) > b) setpstr(mynum, b); } levelof(score) int score; { score /= 2; if (plev(mynum) > 10) return plev(mynum); if (score < 500) return 1; if (score < 1000) return 2; if (score < 3000) return 3; if (score < 6000) return 4; if (score < 10000) return 5; if (score < 20000) return 6; if (score < 32000) return 7; if (score < 44000) return 8; if (score < 70000) return 9; return 10; } playcom() { int a; if (EMPTY(item1)) { bprintf("Play what ?\n"); return; } if ((a = ob1) == -1) { bprintf("That isn't here\n"); return; } if (!isavl(a)) { bprintf("That isn't here\n"); return; } if (a != 40) { bprintf("You can't play that!\n"); return; } broad("There is a hideous wailing noise.\n"); } getreinput(blob) char *blob; { while (NOISECHAR(strbuf[stp])) stp++; strcpy(blob, &strbuf[stp]); if (randperc() < 10 && contains(blob, "richard") != -1) broad("\001dYou hear a distant raspberry on the wind..\n\001"); if (randperc() < 25 && contains(blob, "lorry") != -1) broad("\001dYou hear a faint and distant Vrooommm...\n\001"); if (contains(blob, "acsthad") != -1) said_eight(); } shoutcom() { char blob[200]; getreinput(blob); if (EQ(pname(mynum), "Roady")) { bprintf("Sorry , you've used up your quota of shouts for the year\n"); error(); } if (plev(mynum) > 9) sendsys(pname(mynum), pname(mynum), -10104, ploc(mynum), blob); else sendsys(pname(mynum), pname(mynum), -10002, ploc(mynum), blob); if (contains(blob, "foom") != -1) { if (fpbn("seamas") != -1) { sprintf(blob, "MOOF!"); sendsys("Seamas", "Seamas", -10002, ploc(fpbn("seamas")), blob); } } if (contains(blob, "eek!") != -1) { if (fpbn("seamas") != -1) { sprintf(blob, "OOK!"); sendsys("Seamas", "Seamas", -10002, ploc(fpbn("seamas")), blob); } } if (contains(blob, "shortarse") != -1 && randperc() < 10) { if (fpbn("dio") != -1) { sprintf(blob, "Who you calling a shortarse ?"); sendsys("Dio", "Dio", -10002, ploc(fpbns("Dio")), blob); } } } saycom() { char foo[128]; getreinput(foo); sendsys(pname(mynum), pname(mynum), -10003, ploc(mynum), txt1); } tellcom() { int b; if (EMPTY(item1)) { bprintf("Tell who ?\n"); return; } if ((b = pl1) == -1) { bprintf("No one with that name is playing\n"); error(); } if (b == mynum) { bprintf("You talk to yourself\n"); return; } sendsys(pname(b), pname(mynum), -10004, ploc(mynum), txt2); } scorecom() { if (mynum > 15) { bprintf("Your strength is %d\n", pstr(mynum)); return; } else bprintf("Your strength is %d(from %d), Your score is %d\nThis ranks you as %s ", pstr(mynum), 50 + 8 * plev(mynum), pscore(mynum), pname(mynum)); disle3(plev(mynum), psex(mynum)); } exorcom() { int x; if (EMPTY(item1)) { bprintf("Exorcise who ?\n"); error(); } if ((x = pl1) == -1) { bprintf("They aren't playing\n"); error(); } if (plev(mynum) < 10000 && plev(x) > 9999) { bprintf("You can't exorcise them\n"); return; } mudlog("%s exorcised %s", pname(mynum), pname(x)); dumpstuff(x, ploc(x)); sendsys(pname(x), pname(mynum), -10010, ploc(mynum), ""); pname(x)[0] = 0; if (x == mynum) crapup("You have been exorcised from the game"); } givecom() { int a, c; if (EMPTY(item1)) { bprintf("Give what to who ?\n"); return; } if (pl1 == mynum || pl2 == mynum) { bprintf("Are we having fun yet?\n"); return; } if (pl1 != -1) { if ((a = pl1) == -1) { bprintf("Who is %s\n", wordbuf); return; } if (EMPTY(item2)) { bprintf("Give them what ?\n"); return; } c = ob2; if (c == -1) { bprintf("You are not carrying that\n"); return; } dogive(c, a); return; } if ((a = ob1) == -1) { bprintf("You aren't carrying that\n"); return; } if (EMPTY(item2)) { bprintf("But to who ?\n"); return; } if ((c = pl2) == -1) { bprintf("I don't know who %s is\n", wordbuf); return; } dogive(a, c); bprintf("Ok.\n"); } dogive(ob, pl) int ob, pl; { char z[60]; if (plev(mynum) < 10 && ploc(pl) != ploc(mynum)) { bprintf("They are not here\n"); return; } if (!iscarrby(ob, mynum)) { bprintf("You are not carrying that\n"); return; } if (!cancarry(pl)) { bprintf("They can't carry that\n"); return; } if (plev(mynum) < 10 && ob == 32) { bprintf("It doesn't wish to be given away.....\n"); return; } if (pl == fpbns("hermit") && otstbit(ob, 6)) { bprintf("The hermit thanks you\n"); sendsys("", "", -10000, ploc(mynum), "The Hermit has left the game.\n"); dumpstuff(pl, ploc(pl)); strcpy(pname(pl), ""); setoloc(ob, -6, 0); return; } setoloc(ob, pl, 1); sprintf(z, "\001p%s\001 gives you the %s\n", pname(mynum), oname(ob)); sendsys(pname(pl), pname(mynum), -10011, ploc(mynum), z); if (ob == 44 && psex(mynum) != psex(pl)) { bprintf("How nice of you..\n"); setpscore(mynum, pscore(mynum) + 60); setpscore(pl, pscore(pl) + 50); } if (pl == fpbns("chicken") && ob == 1) { bprintf("It looks confused... it probably doesn't know how to use it.\n"); bprintf("But it takes it anyway.\n"); setpscore(mynum, pscore(mynum) + 1); } return; } stealcom() { int a; int c; char x[128]; int e, f; char tb[128]; if (EMPTY(item1)) { bprintf("Steal what from who ?\n"); return; } if (pl2 == mynum) { bprintf("Try to be sensible..\n"); return; } strcpy(x, item1); if (EMPTY(item2)) { bprintf("From who ?\n"); return; } if ((c = pl2) == -1) { bprintf("Who is that ?\n"); return; } if ((a = fobncb(x, c)) == -1) { bprintf("They are not carrying that\n"); return; } if (plev(mynum) < 10 && ploc(c) != ploc(mynum)) { bprintf("But they aren't here\n"); return; } if (ocarrf(a) == 2) { bprintf("They are wearing that\n"); return; } if (pwpn(c) == a) { bprintf("They have that firmly to hand .. for KILLING people with\n"); return; } if (c == fpbns("hermit")) { bprintf("He is too watchful...\n"); return; } if (c == fpbns("dragon")) { bprintf("He is too alert\n"); return; } if (!cancarry(mynum)) { bprintf("You can't carry any more\n"); return; } f = randperc(); e = (10 + plev(mynum) - plev(c)) * 5; if (f < e) { sprintf(tb, "\001p%s\001 steals the %s from you !\n", pname(mynum), oname(a)); if (f & 1) { sendsys(pname(c), pname(mynum), -10011, ploc(mynum), tb); if (c > 15) woundmn(c, 0); } setoloc(a, mynum, 1); } else bprintf("Your attempt fails\n"); } dosumm(loc) int loc; { char ms[128]; sprintf(ms, "\001s%s\001%s vanishes in a puff of smoke\n\001", pname(mynum), pname(mynum)); sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), ms); sprintf(ms, "\001s%s\001%s appears in a puff of smoke\n\001", pname(mynum), pname(mynum)); if (iraq) on_flee_event(); setploc(mynum, loc); sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), ms); trapch(ploc(mynum)); } tsscom() { int uid; if (plev(mynum) < 10000) { bprintf("I don't know that verb\n"); return; } if (userid == sys_uid) { #ifdef SHELLESC closeworld(); keysetback(); mudlog("***TSS by %s : %s", pname(mynum), txt1); uid = userid; setuid(sys_uid); system(txt1); setuid(uid); keysetup(); #else bprintf("No shell escapes allowed.\n"); #endif } else bprintf("Not permitted on this ID\n"); } rmeditcom() { bprintf("I don't know that verb\n"); } u_system() { #ifdef BBPACH if (plev(mynum) < 10) { bprintf("You'll have to leave the game first!\n"); return; } cms = -2; update(); sprintf(x, "%s%s%s%s%s", "\001s", pname(mynum), "\001", pname(mynum), " has dropped into BB\n\001"); sendsys(pname(mynum), pname(mynum), -10113, 0, x); closeworld(); keysetback(); system(BBPATH); keysetup(); openworld(); cms = -1; if (fpbns(pname(mynum)) == -1) { loseme(); crapup("You have been kicked off"); } rte(); openworld(); sprintf(x, "%s%s%s%s%s", "\001s", pname(mynum), "\001", pname(mynum), " has returned to AberMud\n\001"); sendsys(pname(mynum), pname(mynum), -10113, 0, x); #else bprintf("Not available on this version of the system\n"); #endif /* BBPATH */ } inumcom() { if (plev(mynum) < 10000) { bprintf("Huh ?\n"); return; } if (brkword() == -1) { bprintf("What...\n"); return; } bprintf("Item Number is %d\n", fobn(item1)); } updcom() { char x[128]; if (plev(mynum) < 10) { bprintf("Hmmm... you can't do that one\n"); return; } if (aliased) { bprintf("Not when aliased"); return; } sprintf(x, "[ %s has updated ]\n", pname(mynum)); sendsys(pname(mynum), pname(mynum), -10113, 0, x); sprintf(x, "%s", pname(mynum)); loseme(); closeworld(); execl(EXE, GAMENAME, x, (char *)NULL); /* GOTOSS eek! */ bprintf("Eeek! someones pinched the executable!\n"); } becom() { char x[128]; if (plev(mynum) < 10) { bprintf("Become what ?\n"); return; } if (aliased) { bprintf("Not when aliased"); error(); return; } if (EMPTY(item1)) { bprintf("To become what ?, inebriated ?\n"); return; } sprintf(x, "%s has quit, via BECOME\n", pname(mynum)); sendsys("", "", -10113, 0, x); keysetback(); loseme(); closeworld(); sprintf(x, "-n%s", item1); execl(EXE2, GAMENAME, x, (char *)NULL); /* GOTOSS eek! */ bprintf("Eek! someone's just run off with mud!\n"); } systat() { bprintf("What do you think this is a DEC 10 ?\n"); } convcom() { convflg = 1; bprintf("Type '**' on a line of its own to exit converse mode\n"); } shellcom() { if (plev(mynum) < 10000) { bprintf("There is nothing here you can shell\n"); return; } convflg = 2; bprintf("Type ** on its own on a new line to exit shell\n"); } rawcom() { char x[100], y[100]; if (plev(mynum) < 10000) { bprintf("I don't know that verb\n"); return; } getreinput(x); if (op(pname(mynum)) && x[0] == '!') { strcat(x + 1, "\n"); broad(x + 1); return; } else { sprintf(y, "%s%s%s", "** SYSTEM : ", x, "\n\007\007"); broad(y); } } rollcom() { int a; if (ohereandget(&a) == -1) return; switch (a) { case 122: case 123: gamecom("push pillar"); break; case 131: gamecom("push boulder"); break; default: bprintf("You can't roll that\n"); } } debugcom() { if (plev(mynum) < 10000) { bprintf("I don't know that verb\n"); return; } debug2(); } bugcom() { char x[120]; getreinput(x); mudlog("Bug by %s : %s", pname(mynum), x); } typocom() { char x[120], y[80]; sprintf(y, "%s in %d", pname(mynum), ploc(mynum)); getreinput(x); mudlog("Typo by %s : %s", y, x); } look_cmd() { int a; int brhold; if (brkword() == -1) { brhold = ptstflg(mynum, 8) ? 1 : 0; pclrflg(mynum, 8); lookin(ploc(mynum)); if (brhold) psetflg(mynum, 8); return; } if (EQ(wordbuf, "at")) { /* is this due to parser error (at is in item1 !! same for ob1)? */ strcpy(item1, item2); ob1 = ob2; examcom(); return; } if (!EQ(wordbuf, "in") && !EQ(wordbuf, "into")) { bprintf("I don't understand, are you trying to LOOK, LOOK AT, or LOOK IN something ?\n"); return; } if (EMPTY(item2)) { bprintf("In what ?\n"); return; } if ((a = ob2) == -1) { bprintf("What ?\n"); return; } if (a == 144 || a == 91) { strcpy(ob1, ob2); ob1 = ob2; examcom(); return; } if (!otstbit(a, 14)) { bprintf("That isn't a container\n"); return; } if (otstbit(a, 2) && state(a)) { bprintf("It's closed!\n"); return; } bprintf("The %s contains:\n", oname(a)); aobjsat(a, 3, 8); } set_ms(x) char *x; { getreinput(x); } setmincom() { set_ms(min_ms); } setincom() { set_ms(in_ms); } setoutcom() { set_ms(out_ms); } setmoutcom() { set_ms(mout_ms); } readcom() { char *ptr; if (!hasfarted) { mudlog("BAD UNVEIL: %s", pname(mynum)); bprintf("I don't know that verb\n"); return; } closeworld(); if (!EQ(UNVEIL_PASS, getpass("Magic Word: "))) { openworld(); bprintf("Eek! Go away!\n\7"); mudlog("BAD UNVEIL: %s", pname(mynum)); return; } bprintf("You are now seen in your true form!\n"); openworld(); psetflg(mynum, 2); /* Set flag 2 so we can set ourselves up */ if (brkword() == -1) { setplev(mynum, 10001); mudlog("UNVEIL: %s to %d", pname(mynum), plev(mynum)); return; } for (ptr = wordbuf; *ptr; ptr++) { if (*ptr == '-') { bprintf("I hope you know what you're doing!\n"); ptr++; } if (!isdigit(*ptr)) { bprintf("That's not a number!\n"); return; } } setplev(mynum, atoi(wordbuf)); mudlog("UNVEIL: %s to %d", pname(mynum), plev(mynum)); } emptycom() { int a, b; char x[81]; if ((b = ohereandget(&a)) == -1) return; for (b = 0; b < numobs; b++) { if (iscontin(b, a)) { setoloc(b, mynum, 1); bprintf("You empty the %s from the %s\n", oname(b), oname(a)); sprintf(x, "drop %s", oname(b)); gamecom(x); pbfr(); openworld(); } } } unalias() { aliased = 0; pclrflg(mynum, 14); mynum = tmynum; bprintf("Returning to self....\n"); cms = -1; in_fight = 0; fighting = -1; update(); } killplcom() { if (pl1 == -1) bprintf("There is noone with that name"); else sendsys(pname(pl1), pname(mynum), -10015, ploc(pl1), ""); }