Skip to content

Commit

Permalink
Added more audit checks. Improved VNUM OBJ FOCILIST.
Browse files Browse the repository at this point in the history
  • Loading branch information
luciensadi committed Oct 23, 2023
1 parent 1d61c70 commit f6e6b50
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 15 deletions.
106 changes: 105 additions & 1 deletion src/act.wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7727,13 +7727,117 @@ int audit_zone_objects_(struct char_data *ch, int zone_num, bool verbose) {
printed = TRUE;
issues++;
}

else if (GET_OBJ_TYPE(obj) == ITEM_FOUNTAIN && GET_FOUNTAIN_POISON_RATING(obj) > 0) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yis poisoned^n (^y%d^n)^n.\r\n", GET_FOUNTAIN_POISON_RATING(obj));
printed = TRUE;
issues++;
}

// Check for weapons with high stats etc.
if (GET_OBJ_TYPE(obj) == ITEM_WEAPON) {
if (WEAPON_IS_GUN(obj)) {
// Ranged checks.

// Recoil comp
if (GET_WEAPON_INTEGRAL_RECOIL_COMP(obj)) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - has ^c%d^n integral recoil comp^n.\r\n", GET_WEAPON_INTEGRAL_RECOIL_COMP(obj));
printed = TRUE;
issues++;
}

// Attachments
for (int idx = ACCESS_LOCATION_TOP; idx <= ACCESS_LOCATION_UNDER; idx++) {
vnum_t attach_vnum = GET_WEAPON_ATTACH_LOC(obj, idx);

if (attach_vnum) {
rnum_t attach_rnum = real_object(attach_vnum);
const char *attach_loc = gun_accessory_locations[idx - ACCESS_LOCATION_TOP];

if (attach_rnum < 0) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - has ^yinvalid^n %s-attached item (%ld).\r\n", attach_loc, attach_vnum);
printed = TRUE;
issues++;
} else {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - has %s-attached item %s^n (%ld).\r\n",
attach_loc,
GET_OBJ_NAME(&obj_proto[attach_rnum]),
attach_vnum);
printed = TRUE;
issues++;
}
}
}
} else {
// Melee checks.

// Reach
if (GET_WEAPON_REACH(obj)) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - has ^c%d^n reach^n.\r\n", GET_WEAPON_REACH(obj));
printed = TRUE;
issues++;
}
}
}

// Check for cash items with high values.
switch (GET_OBJ_TYPE(obj)) {
case ITEM_MONEY:
if (GET_ITEM_MONEY_VALUE(obj)) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yis money^n with ^c%d^n value^n.\r\n", GET_ITEM_MONEY_VALUE(obj));
printed = TRUE;
issues++;
}
break;
case ITEM_DECK_ACCESSORY:
if (GET_DECK_ACCESSORY_TYPE(obj) == TYPE_PARTS && GET_OBJ_COST(obj)) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yis chips/parts^n with ^c%d^n value^n.\r\n", GET_OBJ_COST(obj));
printed = TRUE;
issues++;
}
break;
case ITEM_MAGIC_TOOL:
if (GET_MAGIC_TOOL_TYPE(obj) == TYPE_SUMMONING && GET_OBJ_COST(obj)) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^yis summoning mats^n with ^c%d^n value^n.\r\n", GET_OBJ_COST(obj));
printed = TRUE;
issues++;
}
break;
}

// Check for foci with high ratings.
if (GET_OBJ_TYPE(obj) == ITEM_FOCUS) {
switch (GET_FOCUS_TYPE(obj)) {
case FOCI_EXPENDABLE:
break;
case FOCI_SPEC_SPELL:
break;
case FOCI_SPELL_CAT:
break;
case FOCI_SPIRIT:
break;
case FOCI_POWER:
if (GET_FOCUS_FORCE(obj) > 4) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^Ris an over-strength power focus^n (%d).\r\n", GET_FOCUS_FORCE(obj));
printed = TRUE;
issues++;
}
break;
case FOCI_SUSTAINED:
if (GET_FOCUS_FORCE(obj) > 4) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^Ris an over-strength sustain focus^n (%d).\r\n", GET_FOCUS_FORCE(obj));
printed = TRUE;
issues++;
} else if (GET_FOCUS_FORCE(obj) == 4) {
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), " - ^Yis a max-strength sustain focus^n (%d): check wearslots for eyes only.\r\n", GET_FOCUS_FORCE(obj));
printed = TRUE;
issues++;
}
break;
case FOCI_SPELL_DEFENSE:
break;
}
}

if (printed) {
send_to_char(ch, "%s\r\n", buf);
}
Expand Down
1 change: 1 addition & 0 deletions src/awake.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,7 @@ enum {
#define FOCI_SUSTAINED 5
// #define FOCI_WEAPON 6
#define FOCI_SPELL_DEFENSE 7
#define NUM_FOCUS_TYPES 8

#define ACCESS_SMARTLINK 1
#define ACCESS_SCOPE 2
Expand Down
48 changes: 34 additions & 14 deletions src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3592,21 +3592,41 @@ int vnum_object_magazines(char *searchname, struct char_data * ch)

int vnum_object_foci(char *searchname, struct char_data * ch)
{
int nr, found = 0;
int found = 0;

for (nr = 0; nr <= top_of_objt; nr++)
{
if (GET_OBJ_TYPE(&obj_proto[nr]) == ITEM_FOCUS
&& !vnum_from_non_connected_zone(OBJ_VNUM_RNUM(nr))) {
snprintf(buf, sizeof(buf), "%3d. [%5ld -%2d] %s %s +%2d %s^n%s\r\n", ++found,
OBJ_VNUM_RNUM(nr),
ObjList.CountObj(nr),
vnum_from_non_connected_zone(OBJ_VNUM_RNUM(nr)) ? " " : (PRF_FLAGGED(ch, PRF_SCREENREADER) ? "(connected)" : "*"),
foci_type[GET_OBJ_VAL(&obj_proto[nr], 0)],
GET_OBJ_VAL(&obj_proto[nr], VALUE_FOCUS_RATING),
obj_proto[nr].text.name,
obj_proto[nr].source_info ? " ^g(canon)^n" : "");
send_to_char(buf, ch);
for (int type_idx = 0; type_idx < NUM_FOCUS_TYPES; type_idx++) {
for (int power = 10; power >= 0; power--) {
for (int nr = 0; nr <= top_of_objt; nr++) {
if (GET_OBJ_TYPE(&obj_proto[nr]) != ITEM_FOCUS)
continue;

if (GET_FOCUS_TYPE(&obj_proto[nr]) != type_idx)
continue;

// Skip anything that doesn't match our sought power. At max (10), we accept anything at or above.
if (power == 10 ? GET_FOCUS_FORCE(&obj_proto[nr]) >= power : GET_FOCUS_FORCE(&obj_proto[nr]) == power)
continue;

if (vnum_from_non_connected_zone(OBJ_VNUM_RNUM(nr)))
continue;

int count = ObjList.CountObj(nr);

snprintf(buf, sizeof(buf), "%3d. [%5ld -%s%2d^n] %s +%2d '%s^n'%s", ++found,
OBJ_VNUM_RNUM(nr),
count != 0 ? "^c" : "",
count,
foci_type[GET_OBJ_VAL(&obj_proto[nr], 0)],
GET_OBJ_VAL(&obj_proto[nr], VALUE_FOCUS_RATING),
obj_proto[nr].text.name,
obj_proto[nr].source_info ? " ^g(canon)^n" : "");

char wear_bit_buf[10000] = { '\0' };
obj_proto[nr].obj_flags.wear_flags.PrintBits(wear_bit_buf, sizeof(wear_bit_buf), wear_bits, NUM_WEARS);
snprintf(ENDOF(buf), sizeof(buf) - strlen(buf), "[%s]\r\n", wear_bit_buf);

send_to_char(buf, ch);
}
}
}
return (found);
Expand Down

0 comments on commit f6e6b50

Please sign in to comment.