Object Flags to limit class use

From: Jeff (jfink@csugrad.cs.vt.edu)
Date: 02/10/94


Ok... here's how we did object flags so that certain classes can't
use objects... We had a hack in place, but this one works better 
if you're going to add classes later.

1)	Go into structs.h. Search for the following line:

#define ITEM_NOINVIS	     (1 << 14) /* not allowed to cast invis on */

	After this line, add the following:

#define ITEM_NOMGAE	     (1 << 15)
#define ITEM_NOCLERIC	     (1 << 16)
#define ITEM_NOTHIEF	     (1 << 17)
#define ITEM_NOWARRIOR	     (1 << 18)
	

2)	Go into handler.c and find the following line in equip_char().


   if ((IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_EVIL(ch)) || 


	Add this block above the ANTI_EVIL line:


   if (((IS_OBJ_STAT(obj, ITEM_NOMAGE) && GET_CLASS(ch) == CLASS_MAGIC_USER) ||
	(IS_OBJ_STAT(obj, ITEM_NOCLERIC) && GET_CLASS(ch) == CLASS_CLERIC) ||
 	(IS_OBJ_STAT(obj, ITEM_NOTHIEF) && GET_CLASS(ch) == CLASS_THIEF) ||
 	(IS_OBJ_STAT(obj, ITEM_NOWARRIOR) && GET_CLASS(ch) == CLASS_WARRIOR)) 
 	&& !IS_NPC(ch)) {
 
 	sprintf(buf, "You have no idea how to use this %s.\n\r",
 		fname(obj->name));
 	send_to_char(buf, ch);
 	return;
   }
 

That should do it!
-Jeff
> 
> 



This archive was generated by hypermail 2b30 : 12/07/00 PST