Posted Wednesday, August 12th @ 11:38:15 PM, by George Greer in the Wizard dept.
Added Apr 27, 1998. Click the link below to read it or download it.
From: Matt <quinn@shiva.ml.org>
Subject: Custom Trust System
Ok, this is my spoof of the trust system :)
if you use this please give me credit :)
-Matt Roach AKA Quinn ShadowStalker
ok in act.wizard.c at about the end of the file add this in:
ACMD(do_setcmd)
{
int l;
struct char_data *vict = NULL, *cbuf = NULL;
struct char_file_u tmp_store;
char field[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], val_arg[MAX_INPUT_LENGT
H];
int on = 0, off = 0, value = 0;
char is_file = 0, is_mob = 0, is_player = 0;
int player_i = 0;
int parse_class(char arg);
struct set_struct {
char *cmd;
char level;
char pcnpc;
char type;
} fields[] = {
{ "advance", LVL_IMPL, PC, BINARY }, /* 0 */
{ "ban", LVL_IMPL, PC, BINARY }, /* 1 */
{ "dc", LVL_IMPL, PC, BINARY }, /* 2 */
{ "force", LVL_IMPL, PC, BINARY }, /* 3 */
{ "freeze", LVL_IMPL, PC, BINARY }, /* 4 */
{ "hcontrol", LVL_IMPL, PC, BINARY }, /* 5 */
{ "load", LVL_IMPL, PC, BINARY }, /* 6 */
{ "mute", LVL_IMPL, PC, BINARY }, /* 7 */
{ "notitle", LVL_IMPL, PC, BINARY }, /* 8 */
{ "pardon", LVL_IMPL, PC, BINARY }, /* 9 */
{ "purge", LVL_IMPL, PC, BINARY }, /* 10 */
{ "reload", LVL_IMPL, PC, BINARY }, /* 11 */
{ "reroll", LVL_IMPL, PC, BINARY }, /* 12 */
{ "restore", LVL_IMPL, PC, BINARY }, /* 13 */
{ "set", LVL_IMPL, PC, BINARY }, /* 14 */
{ "show", LVL_IMPL, PC, BINARY }, /* 15 */
{ "shutdown", LVL_IMPL, PC, BINARY }, /* 16 */
{ "skillset", LVL_IMPL, PC, BINARY }, /* 17 */
{ "snoop", LVL_IMPL, PC, BINARY }, /* 18 */
{ "stat", LVL_IMPL, PC, BINARY }, /* 19 */
{ "teleport", LVL_IMPL, PC, BINARY }, /* 20 */
{ "transfer", LVL_IMPL, PC, BINARY }, /* 21 */
{ "unaffect", LVL_IMPL, PC, BINARY }, /* 22 */
{ "zreset", LVL_IMPL, PC, BINARY }, /* 23 */
{ "setcmd", LVL_IMPL, PC, BINARY }, /* 24 */
{ "immcmds", LVL_IMPL, PC, BINARY }, /* 25 */
{ "delete", LVL_IMPL, PC, BINARY }, /* 26 */
{ "impcmds", LVL_IMPL, PC, BINARY }, /* 27 */
{ "all", LVL_IMPL, PC, BINARY }, /* 28 */
{ "quest", LVL_IMPL, PC, BINARY }, /* 29 */
{ "olc", LVL_IMPL, PC, BINARY }, /* 30 */
{ "\n", 0, BOTH, MISC }
};
half_chop(argument, name, buf);
if (!CMD_FLAGGED(ch, CMD_SETCMD)) {
send_to_char("Huh?!?\r\n", ch);
return;
}
if (!strcmp(name, "file")) {
is_file = 1;
half_chop(buf, name, buf);
} else if (!str_cmp(name, "player")) {
is_player = 1;
half_chop(buf, name, buf);
} else if (!str_cmp(name, "mob")) {
is_mob = 1;
half_chop(buf, name, buf);
}
half_chop(buf, field, buf);
strcpy(val_arg, buf);
if (!*name || !*field) {
send_to_char("Usage: setcmd <victim> <field> <value>\r\n", ch);
return;
}
if (!is_file) {
if (is_player) {
if (!(vict = get_player_vis(ch, name, 0))) {
send_to_char("There is no such player.\r\n", ch);
return;
}
} else {
if (!(vict = get_char_vis(ch, name))) {
send_to_char("There is no such creature.\r\n", ch);
return;
}
}
} else if (is_file) {
CREATE(cbuf, struct char_data, 1);
clear_char(cbuf);
if ((player_i = load_char(name, &tmp_store)) > -1) {
store_to_char(&tmp_store, cbuf);
if (GET_LEVEL(cbuf) >= GET_LEVEL(ch)) {
free_char(cbuf);
send_to_char("Sorry, you can't do that.\r\n", ch);
return;
}
vict = cbuf;
} else {
free(cbuf);
send_to_char("There is no such player.\r\n", ch);
return;
}
}
for (l = 0; *(fields[l].cmd) != '\n'; l++)
if (!strncmp(field, fields[l].cmd, strlen(field)))
break;
if (GET_LEVEL(ch) < fields[l].level) {
send_to_char("You are not godly enough for that!\r\n", ch);
return;
}
if (IS_NPC(vict) && !(fields[l].pcnpc & NPC)) {
send_to_char("You can't do that to a beast!\r\n", ch);
return;
} else if (!IS_NPC(vict) && !(fields[l].pcnpc & PC)) {
send_to_char("That can only be done to a beast!\r\n", ch);
return;
}
if (fields[l].type == BINARY) {
if (!strcmp(val_arg, "on") || !strcmp(val_arg, "yes"))
on = 1;
else if (!strcmp(val_arg, "off") || !strcmp(val_arg, "no"))
off = 1;
if (!(on || off)) {
send_to_char("Value must be on or off.\r\n", ch);
return;
}
} else if (fields[l].type == NUMBER) {
value = atoi(val_arg);
}
strcpy(buf, "Okay."); /* can't use OK macro here 'cause of \r\n */
switch (l) {
case 0:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_ADVANCE);
break;
case 1:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_BAN);
break;
case 2:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_DC);
break;
case 3:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_FORCE);
break;
case 4:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_FREEZE);
break;
case 5:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_HCONTROL);
break;
case 6:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_LOAD);
break;
case 7:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_MUTE);
break;
case 8:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_NOTITLE);
break;
case 0:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_OLC);
break;
case 10:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_PARDON);
break;
case 11:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_PURGE);
break;
case 12:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_RELOAD);
break;
case 13:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_REROLL);
break;
case 14:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_RESTORE);
break;
case 15:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_SET);
break;
case 16:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_SHOW);
break;
case 17:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_SHUTDOWN);
break;
case 18:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_SKILLSET);
break;
case 19:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_SNOOP);
break;
case 20:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_STAT);
break;
case 21:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_TELEPORT);
break;
case 22:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_TRANSFER);
break;
case 23:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_UNAFFECT);
break;
case 24:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_ZRESET);
break;
case 25:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_SETCMD);
break;
case 26:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_IMM);
break;
case 27:
SET_OR_REMOVE(CMD)FLAGS(vict), CMD_IMPCMDS);
break;
case 28:
SET_OR_REMOVE(CMD_FLAGS(vict), CMD_ADVANCE | CMD_BAN | CMD_DC | CMD_IMPCMDS
|
CMD_FILE | CMD_FORCE | CMD_FREEZE | CMD_HCONTROL | CMD_LOAD |
CMD_MUTE | CMD_NOTITLE | CMD_OLC | CMD_PARDON | CMD_PCHECK |
CMD_PEACE | CMD_PURGE | CMD_RELOAD | CMD_REROLL | CMD_RESTORE |
CMD_SET | CMD_SHOW | CMD_SHUTDOWN | CMD_SKILLSET | CMD_SNOOP |
CMD_STAT | CMD_TELEPORT | CMD_TRANSFER | CMD_UNAFFECT | CMD_ZRESET |
CMD_IMM);
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_QUEST);
break;
case 29:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_BFIELD);
REMOVE_BIT(CMD_FLAGS(vict), CMD_BFIELD);
break;
case 30:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_DIVORCE);
break;
case 31:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_VADVANCE);
break;
case 32:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_BFIELD);
REMOVE_BIT(CMD_FLAGS(vict), CMD_BFIELD);
break;
case 33:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_DIVORCE);
break;
case 34:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_VADVANCE);
break;
case 35:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_QUEST);
break;
case 36:
SET_OR_REMOVE(CMD2_FLAGS(vict), CMD2_SUBTITLE);
break;
default:
sprintf(buf, "Can't set that!");
break;
}
if (fields[l].type == BINARY) {
sprintf(buf, "%s %s for %s.\r\n", fields[l].cmd, ONOFF(on),
GET_NAME(vict));
CAP(buf);
sprintf(buf2, "(GC) [Setcmd]: %s set %s's command %s %s",
GET_NAME(ch), GET_NAME(vict), fields[l].cmd, ONOFF(on));
mudlog(buf2, BRF, GET_LEVEL(ch)+1, TRUE);
} else if (fields[l].type == NUMBER) {
sprintf(buf, "%s's %s set to %d.\r\n", GET_NAME(vict),
fields[l].cmd, value);
} else
strcat(buf, "\r\n");
send_to_char(CAP(buf), ch);
if (!is_file && !IS_NPC(vict))
save_char(vict, NOWHERE);
if (is_file) {
char_to_store(vict, &tmp_store);
fseek(player_fl, (player_i) * sizeof(struct char_file_u), SEEK_SET);
fwrite(&tmp_store, sizeof(struct char_file_u), 1, player_fl);
free_char(cbuf);
send_to_char("Saved in file.\r\n", ch);
}
}
ACMD(do_new_wizhelp)
{
int nums = 0;
int comsend(long cmdbit, char *cmdname, int cmdnum)
{
if (CMD_FLAGGED(ch, cmdbit)) {
sprintf(buf, "%-11s", cmdname);
send_to_char(buf, ch);
cmdnum++;
if (cmdnum == 7) {
send_to_char("\r\n", ch);
cmdnum = 0;
}
}
return(cmdnum);
}
int comsend2(long cmdbit, char *cmdname, int cmdnum)
{
if (CMD2_FLAGGED(ch, cmdbit)) {
sprintf(buf, "%-11s", cmdname);
send_to_char(buf, ch);
cmdnum++;
if (cmdnum == 7) {
send_to_char("\r\n", ch);
cmdnum = 0;
}
}
return(cmdnum);
}
if (!CMD_FLAGGED(ch, CMD_IMM)) {
send_to_char("Huh?!?\r\n", ch);
return;
}
send_to_char("You have the following privledged commands:\r\n", ch);
nums = comsend(CMD_IMM, ";", nums);
nums = comsend(CMD_IMM, "at", nums);
nums = comsend(CMD_BAN, "ban", nums);
nums = comsend(CMD_IMM, "date", nums);
nums = comsend(CMD_DC, "dc", nums);
nums = comsend(CMD_IMM, "echo", nums);
nums = comsend(CMD_FORCE, "force", nums);
nums = comsend(CMD_FREEZE, "freeze", nums);
nums = comsend(CMD_IMM, "gecho", nums);
nums = comsend(CMD_IMM, "goto", nums);
nums = comsend(CMD_IMM, "handbook", nums);
nums = comsend(CMD_HCONTROL, "hcontrol", nums);
nums = comsend(CMD_IMM, "holylight", nums);
nums = comsend(CMD_ADVANCE, "advance", nums);
nums = comsend(CMD_IMM, "invis", nums);
nums = comsend(CMD_IMM, "last", nums);
nums = comsend(CMD_LOAD, "load", nums);
nums = comsend(CMD_OLC, "medit", nums);
nums = comsend(CMD_OLC, "mlist", nums);
nums = comsend(CMD_IMM, "nohassle", nums);
nums = comsend(CMD_NOTITLE, "notitle", nums);
nums = comsend(CMD_IMM, "nowiz", nums);
nums = comsend(CMD_OLC, "oedit", nums);
nums = comsend(CMD_IMM, "page", nums);
nums = comsend(CMD_PARDON, "pardon", nums);
nums = comsend(CMD_PCHECK, "pcheck", nums);
nums = comsend(CMD_PEACE, "peace", nums);
nums = comsend(CMD_IMM, "poofin", nums);
nums = comsend(CMD_IMM, "poofout", nums);
nums = comsend(CMD_PURGE, "purge", nums);
nums = comsend(CMD_IMM, "qecho", nums);
nums = comsend(CMD_OLC, "redit", nums);
nums = comsend(CMD_RELOAD, "reload", nums);
nums = comsend(CMD_REROLL, "reroll", nums);
nums = comsend(CMD_RESTORE, "restore", nums);
nums = comsend(CMD_IMM, "roomflags", nums);
nums = comsend(CMD_OLC, "sedit", nums);
nums = comsend(CMD_IMM, "send", nums);
nums = comsend(CMD_SET, "set", nums);
nums = comsend(CMD_SETCMD, "setcmd", nums);
nums = comsend(CMD_SHOW, "show", nums);
nums = comsend(CMD_SHUTDOWN, "shutdow", nums);
nums = comsend(CMD_SHUTDOWN, "shutdown", nums);
nums = comsend(CMD_SKILLSET, "skillset", nums);
nums = comsend(CMD_IMPCMDS, "slowns", nums);
nums = comsend(CMD_SNOOP, "snoop", nums);
nums = comsend(CMD_IMM, "snowball", nums);
nums = comsend(CMD_STAT, "stat", nums);
nums = comsend(CMD_SNOOP, "snoop", nums);
nums = comsend(CMD_IMM, "syslog", nums);
nums = comsend(CMD_TELEPORT, "teleport", nums);
nums = comsend(CMD_FREEZE, "freeze", nums);
nums = comsend(CMD_TRANSFER, "transfer", nums);
nums = comsend(CMD_UNAFFECT, "unaffect", nums);
nums = comsend(CMD_BAN, "ban", nums);
nums = comsend(CMD_IMM, "uptime", nums);
nums = comsend(CMD_IMM, "users", nums);
nums = comsend(CMD_IMM, "vnum", nums);
nums = comsend(CMD_STAT, "vstat", nums);
nums = comsend(CMD_IMM, "wizhelp", nums);
nums = comsend(CMD_IMPCMDS, "wizlock", nums);
nums = comsend(CMD_IMM, "wiznet", nums);
nums = comsend(CMD_OLC, "zedit", nums);
nums = comsend(CMD_ZRESET, "zreset", nums);
}
*******************************
** STOP EDITING ACT.WIZARD.C **
*******************************
ok now in intrepreter.c search for:
ACMD(do_set);
below it add:
ACMD(do_setcmd);
ok now search for:
{ "set" , POS_DEAD , do_set , LVL_IMMORT, 0 },
below it add:
{ "setcmd" , POS_DEAD , do_setcmd , LVL_IMPL, 0 },
<< Training stats [by Tyrone Watt] | Reply | View as text | Threaded | Vehicle code [by Chris Jacobson] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|