DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T e

⟦5ffc08b8d⟧ TextFile

    Length: 9191 (0x23e7)
    Types: TextFile
    Names: »extra.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Abermud/extra.c« 

TextFile

#include "kernel.h"
#ifdef	RCSID
static char RCS[] =
	"$Header: extra.c,v 1.1 89/03/13 09:36:15 rsalz Exp $";
#endif	/* RCSID */


static int jumtb[] = {-643, -633, -1050, -662, -1082, -1053, 0, 0};


helpcom()
{
    int a;
    char b[128];

    if (item1[0]) {
	if ((a = pl1) == -1) {
	    bprintf("Help who ?\n");
	    return;
	}
	if (ploc(a) != ploc(mynum)) {
	    bprintf("They are not here\n");
	    return;
	}
	if (a == mynum) {
	    bprintf("You can't help yourself.\n");
	    return;
	}
	if (phelping(mynum) != -1) {
	    sprintf(b, "\001p%s\001 has stopped helping you\n", pname(mynum));
	    sendsys(pname(a), pname(a), -10011, ploc(mynum), b);
	    bprintf("Stopped helping \001p%s\001.\n", pname(phelping(mynum)));
	}
	setphelping(mynum, a);
	sprintf(b, "\001p%s\001 has offered to help you\n", pname(mynum));
	sendsys(pname(a), pname(a), -10011, ploc(mynum), b);
	bprintf("OK...\n");
	return;
    }
    closeworld();
    bprintf("\001f%s\001", HELP1);
    if (plev(mynum) > 9) {
	pbfr();
	sig_alon();
	key_input("Hit <Return> For More....      ", 6);
	sig_aloff();
	bprintf("\001f%s\001", HELP2);
    }
    bprintf("\n");
    if (plev(mynum) > 9999) {
	pbfr();
	sig_alon();
	key_input("Hit <Return> For More....      ", 6);
	sig_aloff();
	bprintf("\001f%s\001", HELP3);

    }
    bprintf("\n");
}

levcom()
{
    closeworld();
    bprintf("\001f%s\001", LEVELS);
}

valuecom()
{
    int b;

    if ((b = ob1) == -1) {
	bprintf("There isn't one of those here.\n");
	return;
    }
    bprintf("%s : %d points\n", oname(b), (tscale() * (obaseval(b))) / 9);
}

stacom()
{
    int a;

    if (!item1[0]) {
	bprintf("STATS what ?\n");
	return;
    }
    if (plev(mynum) < 10) {
	bprintf("Sorry, this is a wizard command buster...\n");
	return;
    }
    if ((a = fobn(item1)) == -1) {
	statplyr();
	return;
    }
    bprintf("\nItem        :%s", oname(a));
    if (ocarrf(a) == 3)
	bprintf("\nContained in:%s", oname(oloc(a)));
    else {
	if (ocarrf(a) != 0)
	    bprintf("\nHeld By     :%s", pname(oloc(a)));
	else {
	    bprintf("\nPosition    :");
	    showname(oloc(a));
	}
    }
    bprintf("\nState       :%d", state(a));
    bprintf("\nCarr_Flag   :%d", ocarrf(a));
    bprintf("\nSpare       :%d", ospare(a));
    bprintf("\nMax State   :%d", omaxstate(a));
    bprintf("\nBase Value  :%d", obaseval(a));
    bprintf("\n");
}

examcom()
{
    int a;
    FILE *x;
    char r[88];

    if (!item1[0]) {
	bprintf("Examine what ?\n");
	return;
    }
    if ((a = ob1) == -1) {
	bprintf("You see nothing special at all\n");
	return;
    }
    switch (a) {
    case 144:
	if (obyte(144, 0) == 0) {
	    osetbyte(144, 0, 1);
	    bprintf("You take a scroll from the tube.\n");
	    oclrbit(145, 0);
	    setoloc(145, mynum, 1);
	    return;
	}
	break;
    case 145:
	setploc(mynum, -114);
	bprintf("As you read the scroll you are teleported!\n");
	destroy(145);
	trapch(ploc(mynum));
	return;
    case 101:
	if (obyte(101, 0) == 0) {
	    bprintf("You take a key from one pocket\n");
	    osetbyte(101, 0, 1);
	    oclrbit(107, 0);
	    setoloc(107, mynum, 1);
	    return;
	}
	break;
    case 13:
	if (obyte(13, 1) != 0) {
	    bprintf("It seems to be charged\n");
	    return;
	}
	break;
    case 7:
	setobjstate(7, randperc() % 3 + 1);
	switch (state(7)) {
	case 1:
	    bprintf("It glows red");
	    break;
	case 2:
	    bprintf("It glows blue");
	    break;
	case 3:
	    bprintf("It glows green");
	    break;
	}
	bprintf("\n");
	return;
    case 8:
	if (state(7) != 0) {
	    if (iscarrby(3 + state(7), mynum) && otstbit(3 + state(7), 13)) {
		bprintf("Everything shimmers and then solidifies into a different view!\n");
		destroy(8);
		teletrap(-1074);
		return;
	    }
	}
	break;
    case 85:
	if (!obyte(83, 0)) {
	    bprintf("Aha. under the bed you find a loaf and a rabbit pie\n");
	    oclrbit(83, 0);
	    oclrbit(84, 0);
	    osetbyte(83, 0, 1);
	    return;
	}
	break;
    case 91:
	if (!obyte(90, 0)) {
	    oclrbit(90, 0);
	    bprintf("You pull an amulet from the bedding\n");
	    osetbyte(90, 0, 1);
	    return;
	}
	break;
    }

    sprintf(r, "%s%d", EXAMINES, a);
    if ((x = fopen(r, "r")) == NULL)
	bprintf("You see nothing special.\n");
    else {
	while (fgets(r, sizeof r, x))
	    bprintf("%s", r);
	fclose(x);
    }
}

statplyr()
{
    int b;

    if ((b = fpbn(item1)) == -1)
	bprintf("Whats that ?\n");
    else {
	bprintf("Name      : %s\n", pname(b));
	bprintf("Level     : %d\n", plev(b));
	bprintf("Vis Level : %d\n", pvis(b));
	bprintf("Strength  : %d\n", pstr(b));
	bprintf("Sex       : %s\n", (psex(b) == 0) ? "MALE" : "FEMALE");
	bprintf("Score     : %d\n", pscore(b));
	bprintf("Location  : ");
	showname(ploc(b));
    }
}

wizlist()
{
    if (plev(mynum) < 10)
	bprintf("Huh ?\n");
    else {
	closeworld();
	bprintf("\001f%s\001", WIZLIST);
    }
}

incom()
{
    char st[80], rn[80], rv[80];
    int x;
    int y;

    if (plev(mynum) < 10) {
	bprintf("Huh\n");
	return;
    }
    if (brkword() == -1) {
	bprintf("In where ?\n");
	return;
    }
    strcpy(rn, wordbuf);
    if (brkword() == -1) {
	bprintf("In where ?\n");
	return;
    }
    strcpy(rv, wordbuf);
    if ((x = roomnum(rn, rv)) == 0) {
	bprintf("Where is that ?\n");
	return;
    }
    getreinput(st);
    y = ploc(mynum);
    setploc(mynum, x);
    if (!exists(x)) {
	setploc(mynum, y);
	bprintf("No such room\n");
	return;
    }
    gamecom(st);
    setploc(mynum, y);
}

jumpcom()
{
    int a, b;
    char ms[128];

    for (a = 0, b = 0; jumtb[a]; a += 2)
	if (jumtb[a] == ploc(mynum)) {
	    b = jumtb[a + 1];
	    break;
	}
    if (b == 0) {
	bprintf("Wheeeeee....\n");
	return;
    }
    if (plev(mynum) < 10 && (!iscarrby(1, mynum) || state(1) == 0)) {
	setploc(mynum, b);
	bprintf("Wheeeeeeeeeeeeeeeee  <<<<SPLAT>>>>\n");
	bprintf("You seem to be splattered all over the place\n");
	loseme();
	crapup("I suppose you could be scraped up - with a spatula");
    }
    sprintf(ms, "\001s%s\001%s has just left\n\001",
	pname(mynum), pname(mynum));
    sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), ms);
    setploc(mynum, b);
    sprintf(ms, "\001s%s\001%s has just dropped in\n\001",
	pname(mynum), pname(mynum));
    sendsys(pname(mynum), pname(mynum), -10000, ploc(mynum), ms);
    trapch(b);
}


wherecom()
{
    int cha, rnd;

    if (pstr(mynum) < 10) {
	bprintf("You are too weak\n");
	return;
    }
    if (plev(mynum) < 10)
	setpstr(mynum, pstr(mynum) - 2);
    rnd = randperc();
    cha = 10 * plev(mynum);
    if (iscarrby(111, mynum) || iscarrby(121, mynum) || iscarrby(163, mynum))
	cha = 100;
    closeworld();
    if (rnd > cha) {
	bprintf("Your spell fails...\n");
	return;
    }
    if (!item1[0]) {
	bprintf("What is that ?\n");
	return;
    }
    if (EQ(item1, "<null>")) {
	bprintf("NULL, we don't have NULLs in this game!\n");
	return;
    }

    for (cha = 0, rnd = 0; cha < numobs; cha++) {
	if (EQ(oname(cha), item1) || EQ(oaltname(cha), item1)) {
	    rnd = 1;
	    if (plev(mynum) > 9999)
		bprintf("[%3d]", cha);
	    bprintf("%16s - ", oname(cha));
	    if ((plev(mynum) < 10) && (ospare(cha) == -1))
		bprintf("Nowhere\n");
	    else
		desrm(oloc(cha), ocarrf(cha));
	}
    }

    if ((cha = pl1) != -1) {
	rnd++;
	bprintf("%s - ", pname(cha));
	desrm(ploc(cha), 0);
    }
    if (!rnd)
	bprintf("I dont know what that is\n");
}

desrm(loc, cf)
    int loc, cf;
{
    int wizinvis, awizinvis;

    if (plev(mynum) < 10 && cf == 0 && loc > -5) {
	bprintf("Somewhere.....\n");
	return;
    }
    if (cf == 3) {
	bprintf("In the %s\n", oname(loc));
	return;
    }

    if (cf > 0) {
	wizinvis = (plev(loc) > 10 && pvis(loc));
	awizinvis = (plev(loc) > 9999 && pvis(loc));
	if ((wizinvis && plev(mynum) <= 10)
	 || (awizinvis && plev(mynum) < 9999))
	    bprintf("Somewhere.....\n");
	else
	    bprintf("Carried by \001c%s\001\n", pname(loc));
	return;
    }

    if (!exists(loc)) {
	if (plev(mynum) < 10000)
	    bprintf("Out in the void\n");
	else
	    bprintf("NOT IN UNIVERSE[%d]\n", loc);
	return;
    }
    bprintf("%-36s", sdesc(loc));
    if (plev(mynum) < 10)
	bprintf("\n");
    else if (!cf || (plev(mynum) > 9 && !awizinvis) || plev(mynum) > 9999) {
	bprintf(" | ");
	showname(loc);
    }
    else
	bprintf("\n");
}


edit_world()
{
    int b, c, d;

    if (!ptstflg(mynum, 5)) {
	bprintf("Must be Game Administrator\n");
	return;
    }
    if (brkword() == -1) {
	bprintf("Must Specify Player or Object\n");
	return;
    }
    if (EQ(wordbuf, "player")) {
	if ((b = getnarg(0, 47)) == -1)
	    return;
	if ((c = getnarg(0, 15)) == -1)
	    return;
	if ((d = getnarg(0, 0)) == -1)
	    return;
	ublock[16 * b + c] = d;
    }
    else if (EQ(wordbuf, "object")) {
	if ((b = getnarg(0, numobs - 1)) == -1)
	    return;
	if ((c = getnarg(0, 3)) == -1)
	    return;
	if ((d = getnarg(0, 0)) == -1)
	    return;
	objinfo[4 * b + c] = d;
    }
    else {
	bprintf("Must specify Player or Object\n");
	return;
    }
    bprintf("Tis done\n");
}


int 
getnarg(bt, to)
    int bt, to;
{
    int x;

    if (brkword() == -1) {
	bprintf("Missing numeric argument\n");
	return -1;
    }
    x = atoi(wordbuf);
    if ((bt != to && x < bt) || (to && x > to)) {
	bprintf("Invalid range\n");
	return -1;
    }
    return x;
}