Add Object Applies [by Frollo]
Snippet Posted Wednesday, August 12th @ 11:23:32 PM, by George Greer in the Wizard dept.
Added Jul 20, 1998. Click the link below to read it or download it.

From: Frollo <Mudaholic@aol.com>
Subject: Add an object apply

ACMD(do_apply)
{

int nr, found = FALSE, i, x, y = 0, plus = FALSE, minus = FALSE;

char arg2[256];


two_arguments(argument, arg, arg2);


if (!strcmp(arg2, "+"))


plus = TRUE;

if (!strcmp(arg2, "-"))


minus = TRUE;


for (x = 1; x < 28; x++) {


if (is_abbrev(arg, apply_types[x])) {



y = x;



found = TRUE;



x = 27;


}

}

if (!found || !*arg) {


sprintf(buf, "Usage: apply <stat> (+/-)\r\n   ");


for (x = 1; x < 28; x++)



sprintf(buf, "%s%s%s%s", buf, apply_types[x], x < 27 ? ", " : "", (x == 11 || x
 == 20 || x == 25 || x == 27) ? "\r\n   " : "");


send_to_char(buf, ch);


return;

}



found = FALSE;

sprintf(buf, "&n&m&uApply to %s:\r\n&n", apply_types[y]);

send_to_char(buf, ch);


for (nr = 0; nr <= top_of_objt; nr++) {


for (i = 0; i < MAX_OBJ_AFFECT; i++) {




if ((minus && obj_proto[nr].affected[i].modifier < 0) || (plus && obj_proto[nr]
.affected[i].modifier > 0) || (!minus && !plus && obj_proto[nr].affected[i].mod
ifier)) {




if (obj_proto[nr].affected[i].location == y) {





sprinttype(obj_proto[nr].affected[i].location, apply_types, buf2);





sprintf(buf, "&n&g[&c%5d&n] &y%-45s &c%+d to %s&n\r\n", obj_index[nr].virtual,
obj_proto[nr].short_description, obj_proto[nr].affected[i].modifier, buf2);





send_to_char(buf, ch);





found = TRUE;




}



}


}

}

if (!found)


send_to_char("&n&c None.&n\r\n", ch);
}


<< Ability Score Rolling Function [by fantasia] | Reply | View as text | Flattened | Affects screen for spell affects [by Jon Barrett] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

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.