Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, Sogou

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] wear_obj is an evil lit...
Forum Rules | Mark all | Recent Posts

[Bug] wear_obj is an evil little bitch
< Newer Topic :: Older Topic > AFKMud 1.76

Pages:<< prev 1 next >>
Post is unread #1 Sep 17, 2005, 4:29 pm   Last edited Nov 13, 2005, 8:57 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: wear_obj is an evil little bitch
Discovered in: AFKMud 1.76
Danger: Low - Inconsistent handling of wielding/wearing items
Found by: Remcon
Fixed by: Remcon

---

act_obj.c, wear_obj

Locate:
      case ITEM_WEAR_SHIELD:
         if( get_eq_char( ch, WEAR_DUAL_WIELD )
             || ( get_eq_char( ch, WEAR_WIELD ) && get_eq_char( ch, WEAR_MISSILE_WIELD ) ) )
         {
            send_to_char( "You can't use a shield AND two weapons!\n\r", ch );
            return;
         }


Change to:
      case ITEM_WEAR_SHIELD:
         if( get_eq_char( ch, WEAR_DUAL_WIELD )
             || ( get_eq_char( ch, WEAR_WIELD ) && get_eq_char( ch, WEAR_MISSILE_WIELD ) )
             || ( get_eq_char( ch, WEAR_WIELD ) && get_eq_char( ch, WEAR_HOLD ) ) )
         {
            if( get_eq_char( ch, WEAR_HOLD ) )
               send_to_char( "You can't use a shield while wielding a weapon and holding something!\n\r", ch );
            else
               send_to_char( "You can't use a shield AND two weapons!\n\r", ch );
            return;
         }
         tmpobj = get_eq_char( ch, WEAR_WIELD );
         if( IS_OBJ_FLAG( tmpobj, ITEM_TWOHAND ) )
         {
            send_to_char( "You cannot wear a shield while wielding a two-handed weapon!\n\r", ch );
            return;
         }


Locate:
      case ITEM_HOLD:
         if( get_eq_char( ch, WEAR_DUAL_WIELD )
             || ( get_eq_char( ch, WEAR_WIELD ) && get_eq_char( ch, WEAR_MISSILE_WIELD ) ) )
         {
            send_to_char( "You cannot hold something AND two weapons!\n\r", ch );
            return;
         }


Change to:
      case ITEM_HOLD:
         if( get_eq_char( ch, WEAR_DUAL_WIELD )
         || ( get_eq_char( ch, WEAR_WIELD )
         && ( get_eq_char( ch, WEAR_MISSILE_WIELD ) || get_eq_char( ch, WEAR_SHIELD ) ) ) )
         {
            if( get_eq_char( ch, WEAR_SHIELD ) )
               send_to_char( "You cannot hold something while wielding a weapon and a shield!\n\r", ch );
            else
               send_to_char( "You cannot hold something AND two weapons!\n\r", ch );
            return;
         }
         tmpobj = get_eq_char( ch, WEAR_WIELD );
         if( IS_OBJ_FLAG( tmpobj, ITEM_TWOHAND ) )
         {
            send_to_char( "You cannot hold something while wielding a two-handed weapon!\n\r", ch );
            return;
         }


Locate:
            OBJ_DATA *mw, *dw, *hd, *sd;
            tmpobj = get_eq_char( ch, WEAR_WIELD );
            mw = get_eq_char( ch, WEAR_MISSILE_WIELD );
            dw = get_eq_char( ch, WEAR_DUAL_WIELD );
            hd = get_eq_char( ch, WEAR_HOLD );
            sd = get_eq_char( ch, WEAR_SHIELD );


Below that, add:
            if( hd && sd )
            {
               send_to_char( "You are already holding something and wearing a shield.\n\r", ch );
               return;
            }


Locate can_dual and replace the function with:
bool can_dual( CHAR_DATA * ch )
{
   OBJ_DATA *wield = NULL;
   bool nwield = FALSE;

   if( !could_dual( ch ) )
      return FALSE;

   wield = get_eq_char( ch, WEAR_WIELD );

   /* Check for missile wield or dual wield */
   if( get_eq_char( ch, WEAR_MISSILE_WIELD ) || get_eq_char( ch, WEAR_DUAL_WIELD ) )
      nwield = TRUE;

   if( wield && nwield )
   {
      send_to_char( "You are already wielding two weapons!\n\r", ch );
      return FALSE;
   }

   if( ( wield || nwield ) && get_eq_char( ch, WEAR_SHIELD ) )
   {
      send_to_char( "You cannot dual wield, you're already holding a shield!\n\r", ch );
      return FALSE;
   }

   if( ( wield || nwield ) && get_eq_char( ch, WEAR_HOLD ) )
   {
      send_to_char( "You cannot hold another weapon, you're already holding something in that hand!\n\r", ch );
      return FALSE;
   }

   if( IS_OBJ_FLAG( wield, ITEM_TWOHAND ) )
   {
      send_to_char( "You cannot wield a second weapon while already wielding a two-handed weapon!\n\r", ch );
      return FALSE;
   }
   return TRUE;
}


The problems with all of this are so numerous I'm not even sure where to start, but the fixes here should bring the whole mess under control once and for all.
       
Pages:<< prev 1 next >>