zlist update and a few bug fixes

This commit is contained in:
JamDog
2010-12-05 16:28:00 +00:00
parent 358d18b7fd
commit 143364cbc9
9 changed files with 104 additions and 47 deletions

View File

@@ -35,6 +35,12 @@ export (QQ's a zone into a tarball)
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(lots of major bugfixes too) (lots of major bugfixes too)
@ @
[Dec 05 2010] - Jamdog
Bug-Fix: 'Did you mean' now only shows commands you have access to (thanks Welcor)
Bug-Fix: Fixed crash bug introduced by new house system when saving house contents
Scan command now tells you when nothing is nearby (thanks Mirad)
zlist command can now list by builder, like show zones
zlist now uses page_string (thanks Mirad)
[Dec 02 2010] - Jamdog [Dec 02 2010] - Jamdog
Bug-Fix: identify command in shops was listing incorrect buy price (thanks Kam) Bug-Fix: identify command in shops was listing incorrect buy price (thanks Kam)
Added %actor.admlevel% and %actor.admlevel(<level>)% to dg-scripts Added %actor.admlevel% and %actor.admlevel(<level>)% to dg-scripts

View File

@@ -2670,6 +2670,7 @@ distance, int door)
ACMD(do_scan) ACMD(do_scan)
{ {
int door; int door;
bool found=FALSE;
int range; int range;
int maxrange = 3; int maxrange = 3;
@@ -2692,9 +2693,12 @@ ACMD(do_scan)
send_to_char(ch, "%s: It's too dark to see, but you can hear shuffling.\r\n", dirs[door]); send_to_char(ch, "%s: It's too dark to see, but you can hear shuffling.\r\n", dirs[door]);
else else
send_to_char(ch, "%s: It is too dark to see anything.\r\n", dirs[door]); send_to_char(ch, "%s: It is too dark to see anything.\r\n", dirs[door]);
found=TRUE;
} else { } else {
if (world[scanned_room].people) if (world[scanned_room].people) {
list_scanned_chars(world[scanned_room].people, ch, range - 1, door); list_scanned_chars(world[scanned_room].people, ch, range - 1, door);
found=TRUE;
}
} }
} // end of if } // end of if
else else
@@ -2702,5 +2706,8 @@ ACMD(do_scan)
} // end of range } // end of range
scanned_room = IN_ROOM(ch); scanned_room = IN_ROOM(ch);
} // end of directions } // end of directions
if (!found) {
send_to_char(ch, "You don't see aanything nearby!\r\n");
}
} // end of do_scan } // end of do_scan

View File

@@ -1568,7 +1568,6 @@ void set_default_admin_privs(struct char_data *ch, bool keep_old)
SET_BIT_AR(ADM_FLAGS(ch), ADM_TELLALL); SET_BIT_AR(ADM_FLAGS(ch), ADM_TELLALL);
SET_BIT_AR(ADM_FLAGS(ch), ADM_EATANYTHING); SET_BIT_AR(ADM_FLAGS(ch), ADM_EATANYTHING);
SET_BIT_AR(ADM_FLAGS(ch), ADM_BUILD); SET_BIT_AR(ADM_FLAGS(ch), ADM_BUILD);
SET_BIT_AR(ADM_FLAGS(ch), ADM_MONEY);
case ADMLVL_GOD: SET_BIT_AR(ADM_FLAGS(ch), ADM_WALKANYWHERE); case ADMLVL_GOD: SET_BIT_AR(ADM_FLAGS(ch), ADM_WALKANYWHERE);
SET_BIT_AR(ADM_FLAGS(ch), ADM_NOKEYS); SET_BIT_AR(ADM_FLAGS(ch), ADM_NOKEYS);
SET_BIT_AR(ADM_FLAGS(ch), ADM_SEEINV); SET_BIT_AR(ADM_FLAGS(ch), ADM_SEEINV);
@@ -1577,6 +1576,7 @@ void set_default_admin_privs(struct char_data *ch, bool keep_old)
SET_BIT_AR(ADM_FLAGS(ch), ADM_ALLSHOPS); SET_BIT_AR(ADM_FLAGS(ch), ADM_ALLSHOPS);
SET_BIT_AR(ADM_FLAGS(ch), ADM_SEESECRET); SET_BIT_AR(ADM_FLAGS(ch), ADM_SEESECRET);
SET_BIT_AR(ADM_FLAGS(ch), ADM_NOSTEAL); SET_BIT_AR(ADM_FLAGS(ch), ADM_NOSTEAL);
SET_BIT_AR(ADM_FLAGS(ch), ADM_MONEY);
case ADMLVL_IMMORT: SET_BIT_AR(ADM_FLAGS(ch), ADM_KNOWWEATHER); case ADMLVL_IMMORT: SET_BIT_AR(ADM_FLAGS(ch), ADM_KNOWWEATHER);
SET_BIT_AR(ADM_FLAGS(ch), ADM_SETQP); SET_BIT_AR(ADM_FLAGS(ch), ADM_SETQP);
SET_BIT_AR(ADM_FLAGS(ch), ADM_NOPOISON); SET_BIT_AR(ADM_FLAGS(ch), ADM_NOPOISON);

View File

@@ -24,6 +24,7 @@
#include "oasis.h" #include "oasis.h"
#include "class.h" #include "class.h"
#include "quest.h" #include "quest.h"
#include "act.h"
/* Utility functions */ /* Utility functions */

View File

@@ -49,7 +49,7 @@ int is_name(const char *str, const char *namelist)
{ {
const char *curname, *curstr; const char *curname, *curstr;
if (!*str || !*namelist || !str || !namelist) if (!str || !namelist || !*str || !*namelist)
return (0); return (0);
curname = namelist; curname = namelist;

View File

@@ -104,6 +104,8 @@ int House_save(struct obj_data *obj, FILE *fp)
int result; int result;
room_vnum rv; room_vnum rv;
if (!obj) return(1);
rv = world[(IN_ROOM(obj))].number; rv = world[(IN_ROOM(obj))].number;
hse = find_house(rv); hse = find_house(rv);

View File

@@ -482,6 +482,22 @@ void sort_commands(void)
qsort(cmd_sort_info + 1, num_of_cmds - 2, sizeof(int), sort_commands_helper); qsort(cmd_sort_info + 1, num_of_cmds - 2, sizeof(int), sort_commands_helper);
} }
/* Returns TRUE if 'ch' has sufficient access to use the command 'cmd' */
bool can_use_command(struct char_data *ch, int cmd)
{
if (complete_cmd_info[cmd].admin_flag == ADM_NONE &&
complete_cmd_info[cmd].minimum_admlevel == ADMLVL_MORTAL &&
GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
return TRUE;
if (complete_cmd_info[cmd].admin_flag == ADM_NONE && GET_ADMLEVEL(ch) >= complete_cmd_info[cmd].minimum_admlevel)
return TRUE;
if (complete_cmd_info[cmd].admin_flag != ADM_NONE && ADM_FLAGGED(ch, complete_cmd_info[cmd].admin_flag))
return TRUE;
return FALSE;
}
/* This is the actual command interpreter called from game_loop() in comm.c /* This is the actual command interpreter called from game_loop() in comm.c
* It makes sure you are the proper level and position to execute the command, * It makes sure you are the proper level and position to execute the command,
@@ -567,6 +583,8 @@ void command_interpreter(struct char_data *ch, char *argument)
if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) && if ( (levenshtein_distance(arg, cmd_info[cmd].command) <= 2) &&
(cmd_info[cmd].minimum_level >= 0) ) (cmd_info[cmd].minimum_level >= 0) )
{ {
/* Does this person have access to this command? */
if (can_use_command(ch, cmd)) {
if (!found) if (!found)
{ {
send_to_char(ch, "\r\nDid you mean:\r\n"); send_to_char(ch, "\r\nDid you mean:\r\n");
@@ -576,6 +594,7 @@ void command_interpreter(struct char_data *ch, char *argument)
} }
} }
} }
}
else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && !IS_ADMIN(ch, ADMLVL_IMPL)) else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && !IS_ADMIN(ch, ADMLVL_IMPL))
send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n"); send_to_char(ch, "You try, but the mind-numbing cold prevents you...\r\n");
else if (complete_cmd_info[cmd].command_pointer == NULL) else if (complete_cmd_info[cmd].command_pointer == NULL)

View File

@@ -22,6 +22,7 @@
#include "constants.h" #include "constants.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "quest.h" #include "quest.h"
#include "modify.h"
/* local functions */ /* local functions */
static void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax); static void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax);
@@ -29,7 +30,7 @@ static void list_rooms(struct char_data *ch , zone_rnum rnum, room_vnum vmin, r
static void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin , mob_vnum vmax ); static void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin , mob_vnum vmax );
static void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin , obj_vnum vmax ); static void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin , obj_vnum vmax );
static void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax); static void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax);
static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax); static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax, char *name);
void perform_mob_flag_list(struct char_data * ch, char *arg) void perform_mob_flag_list(struct char_data * ch, char *arg)
{ {
@@ -102,6 +103,7 @@ ACMD(do_oasis_list)
char smin[MAX_INPUT_LENGTH]; char smin[MAX_INPUT_LENGTH];
char smax[MAX_INPUT_LENGTH]; char smax[MAX_INPUT_LENGTH];
char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
bool use_name = FALSE;
two_arguments(argument, smin, smax); two_arguments(argument, smin, smax);
@@ -110,7 +112,10 @@ ACMD(do_oasis_list)
} else if (!*smax) { } else if (!*smax) {
rzone = real_zone(atoi(smin)); rzone = real_zone(atoi(smin));
if (rzone == NOWHERE) { if ((rzone == NOWHERE || rzone == 0) && subcmd == SCMD_OASIS_ZLIST && !isdigit(*smin)) {
/* Must be zlist, with builder name as arg */
use_name = TRUE;
} else if (rzone == NOWHERE) {
send_to_char(ch, "Sorry, there's no zone with that number\r\n"); send_to_char(ch, "Sorry, there's no zone with that number\r\n");
return; return;
} }
@@ -131,7 +136,6 @@ ACMD(do_oasis_list)
two_arguments(argument, arg, arg2); two_arguments(argument, arg, arg2);
if (is_abbrev(arg, "level") || is_abbrev(arg, "flags")) { if (is_abbrev(arg, "level") || is_abbrev(arg, "flags")) {
int i; int i;
if (!*arg2) { if (!*arg2) {
@@ -153,17 +157,20 @@ ACMD(do_oasis_list)
else else
perform_mob_flag_list(ch, arg2); perform_mob_flag_list(ch, arg2);
} else } else
list_mobiles(ch, rzone, vmin, vmax); break; list_mobiles(ch, rzone, vmin, vmax);
break;
case SCMD_OASIS_OLIST: list_objects(ch, rzone, vmin, vmax); break; case SCMD_OASIS_OLIST: list_objects(ch, rzone, vmin, vmax); break;
case SCMD_OASIS_RLIST: list_rooms(ch, rzone, vmin, vmax); break; case SCMD_OASIS_RLIST: list_rooms(ch, rzone, vmin, vmax); break;
case SCMD_OASIS_TLIST: list_triggers(ch, rzone, vmin, vmax); break; case SCMD_OASIS_TLIST: list_triggers(ch, rzone, vmin, vmax); break;
case SCMD_OASIS_SLIST: list_shops(ch, rzone, vmin, vmax); break; case SCMD_OASIS_SLIST: list_shops(ch, rzone, vmin, vmax); break;
case SCMD_OASIS_QLIST: list_quests(ch, rzone, vmin, vmax); break; case SCMD_OASIS_QLIST: list_quests(ch, rzone, vmin, vmax); break;
case SCMD_OASIS_ZLIST: case SCMD_OASIS_ZLIST:
if (!*smin) if (!*smin) /* No args - list all zones */
list_zones(ch, NOWHERE, 0, zone_table[top_of_zone_table].number); list_zones(ch, NOWHERE, 0, zone_table[top_of_zone_table].number, NULL);
else else if (use_name) /* Builder name as arg */
list_zones(ch, rzone, vmin, vmax); list_zones(ch, NOWHERE, 0, zone_table[top_of_zone_table].number, smin);
else /* Numerical args */
list_zones(ch, rzone, vmin, vmax, NULL);
break; break;
default: default:
send_to_char(ch, "You can't list that!\r\n"); send_to_char(ch, "You can't list that!\r\n");
@@ -402,22 +409,30 @@ static void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, sho
} }
/* List all zones in the world (sort of like 'show zones'). */ /* List all zones in the world (sort of like 'show zones'). */
static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax) static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax, char *name)
{ {
int counter = 0; int counter = 0, len=0, tmp_len = 0;
zone_rnum i; zone_rnum i;
zone_vnum bottom, top; zone_vnum bottom, top;
char buf[MAX_STRING_LENGTH];
bool use_name=FALSE;
bottom = vmin;
top = vmax;
if (rnum != NOWHERE) { if (rnum != NOWHERE) {
/* Only one parameter was supplied - just list that zone */ /* Only one parameter was supplied - just list that zone */
print_zone(ch, zone_table[rnum].number); print_zone(ch, zone_table[rnum].number);
return; return;
} else { } else if (name && *name) {
bottom = vmin; use_name = TRUE;
top = vmax; if (!vmin)
bottom = zone_table[0].number; /* Lowest Zone */
if (!vmax)
top = zone_table[top_of_zone_table].number; /* Highest Zone */
} }
send_to_char(ch, len = snprintf(buf, sizeof(buf),
"VNum Zone Name Builder(s)\r\n" "VNum Zone Name Builder(s)\r\n"
"----- ------------------------------ --------------------------------------\r\n"); "----- ------------------------------ --------------------------------------\r\n");
@@ -426,15 +441,21 @@ static void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zon
for (i = 0; i <= top_of_zone_table; i++) { for (i = 0; i <= top_of_zone_table; i++) {
if (zone_table[i].number >= bottom && zone_table[i].number <= top) { if (zone_table[i].number >= bottom && zone_table[i].number <= top) {
send_to_char(ch, "[%s%3d%s] %s%-*s %s%-1s%s\r\n", tmp_len = 0;
if ((!use_name) || (is_name(name, zone_table[i].builders))) {
tmp_len = snprintf(buf+len, sizeof(buf)-len, "[%s%3d%s] %s%-*s %s%-1s%s\r\n",
QGRN, zone_table[i].number, QNRM, QCYN, count_color_chars(zone_table[i].name)+30, zone_table[i].name, QGRN, zone_table[i].number, QNRM, QCYN, count_color_chars(zone_table[i].name)+30, zone_table[i].name,
QYEL, zone_table[i].builders ? zone_table[i].builders : "None.", QNRM); QYEL, zone_table[i].builders ? zone_table[i].builders : "None.", QNRM);
}
len += tmp_len;
counter++; counter++;
} }
} }
if (!counter) if (!counter)
send_to_char(ch, " None found within those parameters.\r\n"); send_to_char(ch, " None found within those parameters.\r\n");
else
page_string(ch->desc, buf, TRUE);
} }
/* Prints all of the zone information for the selected zone. */ /* Prints all of the zone information for the selected zone. */

View File

@@ -26,6 +26,7 @@
#include "act.h" #include "act.h"
#include "modify.h" #include "modify.h"
#include "spells.h" /* for skill_name() */ #include "spells.h" /* for skill_name() */
#include "screen.h"
/* Global variables definitions used externally */ /* Global variables definitions used externally */
/* Constant list for printing out who we sell to */ /* Constant list for printing out who we sell to */