Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Anti-flags not implemented in...
Forum Rules | Mark all | Recent Posts

Anti-flags not implemented in SmaugFUSS1.9
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
* #1 Nov 1, 2011, 5:07 pm
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

:facepalm:
The icon says it all. It was added into the codebase, but the denial factor of it was never implemented.

i.e.:
I create an item that is, say, antiwarrior. I set myself to be warrior. I can then wear the item. You read that right, antiwarrior does nothing, not even a message.

I'm working on writing up the denial process for flags such as this, but it should all be within the do_wear function in act_obj.c (there's nothing currently there to support this). I'll post here what I have written up for those that want to get it added--I'll even look into adding it into a snippet for 1.9, since this appears to be a missing element to the code. However, if someone's already written this themselves in a nice and neat, clean fashion and willing to share it, I'd be happy to see it. I'm currently in the process of specifying each flag as I can't think of an easier way to do this. Maybe a separate function that can check all this, as it's gonna be added into the "all" portion of the do_wear, as well as the else portion after the "all"--so, 2 places, which would make this a pretty large addition of repetitive work.
       
Post is unread #2 Nov 1, 2011, 7:50 pm   Last edited Nov 1, 2011, 8:10 pm by Aurin
Go to the top of the page
Go to the bottom of the page

Aurin
Magician
GroupMembers
Posts189
JoinedSep 5, 2010

As promised, here's a working snippet for those that want to add in the function.

/**********************************************************************
 * The purpose of this snippet is to add in antiflag functionality in *
 * SmaugFUSS1.9.  This is set up for version 1.9, but shouldn't be    *
 * difficult to retrofit to the earlier versions of the project.      *
 *                                                                    *
 * If you would like to contact me, feel free to do so via a PM on    *
 * smaugmuds.org, my screen name is Aurin.                            *
 *                                                                    *
 * Cheers,                                                            *
 * Aurin                                                              *
 **********************************************************************/

In act_obj.c:
1. Find "Local Functions" at the top and add in at the bottom:
bool anticheck          args((CHAR_DATA *ch, OBJ_DATA *obj));

2. In function do_wear, find:
   if( !str_cmp( arg1, "all" ) )
   {
      OBJ_DATA *obj_next;

      for( obj = ch->first_carrying; obj; obj = obj_next )
      {
         obj_next = obj->next_content;
         if( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) )
         {
            wear_obj( ch, obj, FALSE, -1 );
            if( char_died( ch ) )
               return;
         }
      }
      return;
   }
   else
   {
      if( ( obj = get_obj_carry( ch, arg1 ) ) == NULL )
      {
         send_to_char( "You do not have that item.\r\n", ch );
         return;
      }
      if( arg2[0] != '\0' )
         wear_bit = get_wflag( arg2 );
      else
         wear_bit = -1;
      wear_obj( ch, obj, TRUE, wear_bit );
   }
   
change to:

   // Updated to prevent the wearing of anti-flagged items. - Aurin
   if( !str_cmp( arg1, "all" ) )
   {
      OBJ_DATA *obj_next;

      for( obj = ch->first_carrying; obj; obj = obj_next )
      {
         obj_next = obj->next_content;
         if( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) )
         {
		    if(anticheck(ch, obj))
		       continue;
            wear_obj( ch, obj, FALSE, -1 );
            if( char_died( ch ) )
               return;
         }
      }
      return;
   }
   else
   {
      if( ( obj = get_obj_carry( ch, arg1 ) ) == NULL )
      {
         send_to_char( "You do not have that item.\r\n", ch );
         return;
      }
	  if(anticheck(ch, obj))
	     return;
      if( arg2[0] != '\0' )
         wear_bit = get_wflag( arg2 );
      else
         wear_bit = -1;
      wear_obj( ch, obj, TRUE, wear_bit );
   }
	  
3. Just above the do_remove function add:

/* Wow...the anti-class flags were made, but never implemented.
 * Time to implement them. - Aurin 11/1/2011
 */
bool anticheck(CHAR_DATA *ch, OBJ_DATA *obj)
{
    if((IS_OBJ_STAT(obj, ITEM_ANTI_WARRIOR) && ch->Class == 4)
	   || (IS_OBJ_STAT(obj, ITEM_ANTI_MAGE) && ch->Class == 2)
	   || (IS_OBJ_STAT(obj, ITEM_ANTI_THIEF) && ch->Class == 6)
	   || (IS_OBJ_STAT(obj, ITEM_ANTI_CLERIC) && ch->Class == 0)
	   || (IS_OBJ_STAT(obj, ITEM_ANTI_VAMPIRE) && ch->Class == 15)
	   || (IS_OBJ_STAT(obj, ITEM_ANTI_DRUID) && ch->Class == 1))	   
    {
	   ch_printf(ch, "That item is Anti-%s, you cannot wear it.\r\n", class_table[ch->Class]->who_name);
	   return TRUE;
    }
	if(IS_OBJ_STAT(obj, ITEM_ANTI_GOOD) && ch->alignment > 350)
	{
	   ch_printf(ch, "That item is Anti-Good, you cannot wear it.\r\n");
	   return TRUE;
	}
	else if(IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && ch->alignment >= -350 && ch->alignment <= 350)
	{
	   ch_printf(ch, "That item is Anti-Neutral, you cannot wear it.\r\n");
	   return TRUE;
	}
	else if(IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && ch->alignment < -350)
	{
       ch_printf(ch, "That item is Anti-Evil, you cannot wear it.\r\n");
	   return TRUE;
	}
	
	// If we get here, there is no anti-flag as described above.
	return FALSE;
}


You can also find this snippet here on this site under the smaug snippets.

Cheers,
Aurin

P.S. Edit, had a typo in there that was setup for 6D, where the CLERIC is called PRIEST. :P Updated here and will update the snippet in the files section accordingly.
       
Pages:<< prev 1 next >>