コード例 #1
0
ファイル: tune.c プロジェクト: CyberLeo/protomuck
void
tune_show_bool(dbref player, char *name)
{
    int total = 0;
    const char *lastname = NULL;
    char buf[BUFFER_LEN + 50];
    struct tune_bool_entry *tbool = tune_bool_list;

    while (tbool->name) {
        strcpy(buf, tbool->name);
        if (MLevel(OWNER(player)) >= tbool->readmlev) {
            sprintf(buf, SYSWHITE "(bool) " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = " SYSBLUE "%s",
                    (WLevel(OWNER(player)) >= tbool->writemlev) ? ' ' : '-',
                    tbool->name, ((*tbool->boolv) ? "yes" : "no"));
            lastname = tbool->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tbool++;
    }
    anotify_fmt(player, CINFO "%d bool-parm%s listed.", total,
                (total == 1) ? "" : "s");
}
コード例 #2
0
ファイル: tune.c プロジェクト: CyberLeo/protomuck
void
tune_show_refs(dbref player, char *name)
{
    int total = 0;
    const char *lastname = NULL;
    char buf[BUFFER_LEN + 50];
    struct tune_ref_entry *tref = tune_ref_list;

    while (tref->name) {
        strcpy(buf, tref->name);
        if (MLevel(OWNER(player)) >= tref->readmlev) {
            sprintf(buf, SYSYELLOW "(ref)  " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = %s",
                    (WLevel(OWNER(player)) >= tref->writemlev) ? ' ' : '-',
                    tref->name, ansi_unparse_object(player, *tref->ref));
            lastname = tref->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tref++;
    }
    anotify_fmt(player, CINFO "%d ref-parm%s listed.", total,
                (total == 1) ? "" : "s");
}
コード例 #3
0
ファイル: tune.c プロジェクト: CyberLeo/protomuck
void
tune_show_vals(dbref player, char *name)
{
    int total = 0;
    const char *lastname = NULL;
    char buf[BUFFER_LEN + 50];
    struct tune_val_entry *tval = tune_val_list;

    while (tval->name) {
        strcpy(buf, tval->name);
        if (MLevel(OWNER(player)) >= tval->readmlev) {
            sprintf(buf, SYSGREEN "(int)  " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = " SYSYELLOW "%d",
                    (WLevel(OWNER(player)) >= tval->writemlev) ? ' ' : '-',
                    tval->name, *tval->val);
            lastname = tval->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tval++;
    }
    anotify_fmt(player, CINFO "%d int-parm%s listed.", total,
                (total == 1) ? "" : "s");
}
コード例 #4
0
ファイル: tune.c プロジェクト: CyberLeo/protomuck
void
tune_show_times(dbref player, char *name)
{
    int total = 0;
    const char *lastname = NULL;
    char buf[BUFFER_LEN + 50];
    struct tune_time_entry *ttim = tune_time_list;

    while (ttim->name) {
        strcpy(buf, ttim->name);
        if (MLevel(OWNER(player)) >= ttim->readmlev) {
            sprintf(buf, SYSPURPLE "(time) " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = " SYSPURPLE "%s",
                    (WLevel(OWNER(player)) >= ttim->writemlev) ? ' ' : '-',
                    ttim->name, timestr_full(*ttim->tim));
            lastname = ttim->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        ttim++;
    }
    anotify_fmt(player, CINFO "%d time-parm%s listed.", total,
                (total == 1) ? "" : "s");
}
コード例 #5
0
ファイル: tune.c プロジェクト: CyberLeo/protomuck
void
tune_show_strings(dbref player, char *name)
{
    int total = 0;
    const char *lastname = NULL;
    char buf[BUFFER_LEN + 50], tbuf[BUFFER_LEN];
    struct tune_str_entry *tstr = tune_str_list;

    while (tstr->name) {
        strcpy(buf, tstr->name);
        if (MLevel(OWNER(player)) >= tstr->readmlev) {
            sprintf(buf, SYSCYAN "(str)  " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = " SYSCYAN "%.4096s",
                    (WLevel(OWNER(player)) >= tstr->writemlev) ? ' ' : '-',
                    tstr->name, tct(*tstr->str, tbuf));
            lastname = tstr->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tstr++;
    }
    anotify_fmt(player, CINFO "%d string-parm%s listed.", total,
                (total == 1) ? "" : "s");
}
コード例 #6
0
ファイル: mfuns2.c プロジェクト: GlowMUCK/GlowMUCK
const char *
mfn_force(MFUNARGS)
{
    char *nxt, *ptr;
    dbref obj = mesg_dbref_raw(player, what, perms, argv[0]);
    if (obj == AMBIGUOUS || obj == UNKNOWN || obj == NOTHING || obj == HOME)
	ABORT_MPI("FORCE","Failed match. (1)");
    if (obj == PERMDENIED)
	ABORT_MPI("FORCE","Permission denied. (1)");
    if (Typeof(obj) != TYPE_THING && Typeof(obj) != TYPE_PLAYER)
	ABORT_MPI("FORCE","Bad object reference. (1)");
    if (!*argv[1])
	ABORT_MPI("FORCE","Null command string. (2)");
    if (!tp_zombies && !Archperms(perms))
	ABORT_MPI("FORCE",NOPERM_MESG);
    if (!Archperms(perms)) {
	const char *ptr = RNAME(obj);
	char objname[BUFFER_LEN], *ptr2;
	dbref loc = getloc(obj);

	if (Typeof(obj) == TYPE_THING) {
	    if (FLAGS(obj) & DARK)
		ABORT_MPI("FORCE","Cannot force a dark puppet");
	    if ((FLAGS(OWNER(obj)) & ZOMBIE))
		ABORT_MPI("FORCE",NOPERM_MESG);
	    if (loc != NOTHING && (FLAGS(loc) & ZOMBIE) &&
		    Typeof(loc) == TYPE_ROOM)
		ABORT_MPI("FORCE","Cannot force a Puppet in a no-puppets room");
	    for (ptr2 = objname; *ptr && !isspace(*ptr);)
		*(ptr2++) = *(ptr++);
	    *ptr2 = '\0';
	    if (lookup_player(objname) != NOTHING)
		ABORT_MPI("FORCE","Cannot force a thing named after a player");
	}
	if (!(FLAGS(obj) & XFORCIBLE)) {
	    ABORT_MPI("FORCE",NOPERM_MESG);
	}
	if (!test_lock_false_default(perms, obj, "@/flk")) {
	    ABORT_MPI("FORCE",NOPERM_MESG);
	}
    }
    if (Man(obj) && !TMan(perms))
	ABORT_MPI("FORCE","You can't force " NAMEMAN);
    if (!controls(OWNER(perms),obj))
	ABORT_MPI("FORCE",NOPERM_MESG);
    if ((WLevel(OWNER(perms)) < WLevel(obj)) ||
	(WLevel(perms) < WLevel(obj))
    )	ABORT_MPI("FORCE",NOPERM_MESG);
    if (force_level)
	ABORT_MPI("FORCE","You can't force recursively");
    strcpy(buf, argv[1]);
    ptr = buf;
    do {
	nxt = index(ptr, '\r');
	if (nxt) *nxt++ = '\0';
	force_level++;
	if (*ptr) process_command(obj, ptr, 0);
	force_level--;
	ptr = nxt;
    } while (ptr);
    *buf = '\0';
    return "";
}
コード例 #7
0
ファイル: tune.c プロジェクト: CyberLeo/protomuck
int
tune_setparm(const dbref player, const char *parmname, const char *val)
{
    struct tune_str_entry *tstr = tune_str_list;
    struct tune_time_entry *ttim = tune_time_list;
    struct tune_val_entry *tval = tune_val_list;
    struct tune_ref_entry *tref = tune_ref_list;
    struct tune_bool_entry *tbool = tune_bool_list;
    char buf[BUFFER_LEN];
    char *parmval;

    strcpy(buf, val);
    parmval = buf;

    while (tstr->name) {
        if (!string_compare(parmname, tstr->name)) {
            if ((player != NOTHING)
                && (WLevel(OWNER(player)) < tstr->writemlev))
                return TUNESET_NOPERM;
            if (!tstr->isdefault)
                free((char *) *tstr->str);
            if (*parmval == '-')
                parmval++;
            *tstr->str = string_dup(parmval);
            tstr->isdefault = 0;
            return 0;
        }
        tstr++;
    }

    while (ttim->name) {
        if (!string_compare(parmname, ttim->name)) {
            int days, hrs, mins, secs, result;
            char *end;

            if ((player != NOTHING)
                && (WLevel(OWNER(player)) < ttim->writemlev))
                return TUNESET_NOPERM;
            days = hrs = mins = secs = 0;
            end = parmval + strlen(parmval) - 1;
            switch (*end) {
            case 's':
            case 'S':
                *end = '\0';
                if (!number(parmval))
                    return 2;
                secs = atoi(parmval);
                break;
            case 'm':
            case 'M':
                *end = '\0';
                if (!number(parmval))
                    return 2;
                mins = atoi(parmval);
                break;
            case 'h':
            case 'H':
                *end = '\0';
                if (!number(parmval))
                    return 2;
                hrs = atoi(parmval);
                break;
            case 'd':
            case 'D':
                *end = '\0';
                if (!number(parmval))
                    return 2;
                days = atoi(parmval);
                break;
            default:
                result = sscanf(parmval, "%dd %2d:%2d:%2d",
                                &days, &hrs, &mins, &secs);
                if (result != 4)
                    return 2;
                break;
            }
            *ttim->tim = (days * 86400) + (3600 * hrs) + (60 * mins) + secs;
            return 0;
        }
        ttim++;
    }

    while (tval->name) {
        if (!string_compare(parmname, tval->name)) {
            if ((player != NOTHING)
                && (WLevel(OWNER(player)) < tval->writemlev))
                return TUNESET_NOPERM;
            if (!number(parmval))
                return 2;
            *tval->val = atoi(parmval);
            return 0;
        }
        tval++;
    }

    while (tref->name) {
        if (!string_compare(parmname, tref->name)) {
            dbref obj;

            if ((player != NOTHING)
                && (WLevel(OWNER(player)) < tref->writemlev))
                return TUNESET_NOPERM;
            if (!strcmp(parmval, "me"))
                obj = player;
#ifndef SANITY
            else if (*parmval == '*')
                obj = lookup_player(parmval + 1);
#endif
            else {
                if (*parmval != NUMBER_TOKEN)
                    return 2;
                if (!number(parmval + 1))
                    return 2;
                obj = (dbref) atoi(parmval + 1);
            }
            if (obj < -1 || obj >= db_top)
                return 2;
            if (obj != -1 && tref->typ != NOTYPE && Typeof(obj) != tref->typ)
                return 3;
            *tref->ref = obj;
            return 0;
        }
        tref++;
    }

    while (tbool->name) {
        if (!string_compare(parmname, tbool->name)) {
            if ((player != NOTHING)
                && (WLevel(OWNER(player)) < tbool->writemlev))
                return TUNESET_NOPERM;
            if (*parmval == 'y' || *parmval == 'Y') {
                *tbool->boolv = 1;
            } else if (*parmval == 'n' || *parmval == 'N') {
                *tbool->boolv = 0;
            } else {
                return 2;
            }
            return 0;
        }
        tbool++;
    }

    return 1;
}
コード例 #8
0
ファイル: tune.c プロジェクト: CyberLeo/protomuck
void
tune_display_parms(dbref player, char *name)
{
    int total = 0;
    const char *lastname = NULL;
    char buf[BUFFER_LEN + 50], tbuf[BUFFER_LEN];
    struct tune_str_entry *tstr = tune_str_list;
    struct tune_time_entry *ttim = tune_time_list;
    struct tune_val_entry *tval = tune_val_list;
    struct tune_ref_entry *tref = tune_ref_list;
    struct tune_bool_entry *tbool = tune_bool_list;

    while (tstr->name) {
        strcpy(buf, tstr->name);
        if ((MLevel(OWNER(player)) >= tstr->readmlev) &&
            (!*name || equalstr(name, buf))) {
            sprintf(buf, SYSCYAN "(str)  " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = " SYSCYAN "%.4096s",
                    (WLevel(OWNER(player)) >= tstr->writemlev) ? ' ' : '-',
                    tstr->name, tct(*tstr->str, tbuf));
            lastname = tstr->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tstr++;
    }

    while (ttim->name) {
        strcpy(buf, ttim->name);
        if ((MLevel(OWNER(player)) >= ttim->readmlev) &&
            (!*name || equalstr(name, buf))) {
            sprintf(buf, SYSPURPLE "(time) " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = " SYSPURPLE "%s",
                    (WLevel(OWNER(player)) >= ttim->writemlev) ? ' ' : '-',
                    ttim->name, timestr_full(*ttim->tim));
            lastname = ttim->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        ttim++;
    }

    while (tval->name) {
        strcpy(buf, tval->name);
        if ((MLevel(OWNER(player)) >= tval->readmlev) &&
            (!*name || equalstr(name, buf))) {
            sprintf(buf, SYSGREEN "(int)  " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = " SYSYELLOW "%d",
                    (WLevel(OWNER(player)) >= tval->writemlev) ? ' ' : '-',
                    tval->name, *tval->val);
            lastname = tval->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tval++;
    }
    while (tref->name) {
        strcpy(buf, tref->name);
        if ((MLevel(OWNER(player)) >= tref->readmlev) &&
            (!*name || equalstr(name, buf))) {
            sprintf(buf, SYSYELLOW "(ref)  " SYSRED "%c" SYSGREEN "%-24s"
                    SYSRED " = %s",
                    (WLevel(OWNER(player)) >= tref->writemlev) ? ' ' : '-',
                    tref->name, ansi_unparse_object(player, *tref->ref));
            lastname = tref->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tref++;
    }

    while (tbool->name) {
        strcpy(buf, tbool->name);
        if ((MLevel(OWNER(player)) >= tbool->readmlev) &&
            (!*name || equalstr(name, buf))) {
            sprintf(buf, SYSWHITE "(bool) " SYSRED "%c" SYSGREEN "%-24s" SYSRED
                    " = " SYSBLUE "%s",
                    (WLevel(OWNER(player)) >= tbool->writemlev) ? ' ' : '-',
                    tbool->name, ((*tbool->boolv) ? "yes" : "no"));
            lastname = tbool->name;
            anotify_nolisten2(player, buf);
            total++;
        }
        tbool++;
    }
    if ((total == 1) && lastname && *lastname) {
        do_sysparm(player, lastname);
    } else {
        anotify_fmt(player, CINFO "%d sysparm%s listed.", total,
                    (total == 1) ? "" : "s");
        anotify(player,
                SYSYELLOW
                "@tune str, time, int, ref, or bool to list by data types.");
    }
}