RE: Guildguards

From: Daniel W. Burke (dwb@ix.netcom.com)
Date: 06/20/96


An easy solution to letting guildguards allow more then one class in the 
same exit would be this:

Add bitvectors for each class:

#define CLASS_MAGE_BV      (1 << CLASS_MAGIC_USER)
#define CLASS_CLERIC_BV    (1 << CLASS_CLERIC)
#define CLASS_THIEF_BV     (1 << CLASS_THIEF)
#define CLASS_WARRIOR_BV   (1 << CLASS_WARRIOR)
#define CLASS_ASSASSIN_BV  (1 << CLASS_ASSASSIN)

Then change all of the guild_info's to:

int guild_info[][3] = {

/* Midgaard */
  {CLASS_MAGE_BV,	3017,	SCMD_SOUTH},
  {CLASS_CLERIC_BV,	3004,	SCMD_NORTH},
  {CLASS_THIEF_BV,	3027,	SCMD_EAST},
  {CLASS_WARRIOR_BV,	3021,	SCMD_EAST},


then you can add it so a thief can go in the same exit an assassin could
enter the thief guild:

  {CLASS_THIEF_BV|CLASS_ASSASSIN_BV,      3027,   SCMD_EAST},


And here's a changed guild_guard spec_proc to use the bitvectors



SPECIAL(guild_guard)
{
   int i, blocked = TRUE;
   extern int guild_info[][3];
   struct char_data *guard = (struct char_data *) me;
   char *buf = "The guard humiliates you, and blocks your way.\r\n";
   char *buf2 = "The guard humiliates $n, and blocks $s way.";

   if (!IS_MOVE(cmd) || IS_AFFECTED(guard, AFF_BLIND))
     return FALSE;

   if (GET_LEVEL(ch) >= LVL_IMMORT)
     return FALSE;

   for (i = 0; guild_info[i][0] != -1; i++) {
      if ((IS_NPC(ch) || !IS_SET(guild_info[i][0], (1 << GET_CLASS(ch)))) &&
	  world[ch->in_room].number == guild_info[i][1] &&
	  cmd == guild_info[i][2]) {
	 return TRUE;
      }
   }

   if (blocked) {
      send_to_char(buf, ch);
      act(buf2, FALSE, ch, 0, 0, TO_ROOM);
   }
   else 
     return FALSE;
   
   return FALSE;
}



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