Login
User Name:

Password:



Register

Forgot your password?
do_owhere recursive
Author: Khonsu
Submitted by: Khonsu
Changes list / Addchange
Author: Khonsu
Submitted by: Khonsu
6Dragons mp3 sound pack
Author: Vladaar
Submitted by: Vladaar
AFKMud 2.2.3
Author: AFKMud Team
Submitted by: Samson
SWFOTEFUSS 1.5
Author: Various
Submitted by: Samson
Users Online
AhrefsBot

Members: 0
Guests: 15
Stats
Files
Topics
Posts
Members
Newest Member
489
3,793
19,649
597
Aileenutz

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Modifying prototype ite...
Forum Rules | Mark all | Recent Posts

[Bug] Modifying prototype item affects can corrupt player stats
< Newer Topic :: Older Topic > AFKMud 1.77

Pages:<< prev 1 next >>
Post is unread #1 Sep 10, 2006 5:09 pm   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002

 
Bug: Modifying prototype item affects can corrupt player stats
Danger: Medium - Stat corruption on players.
Discovered in: AFKMud 1.77
Found by: Valcados
Fixed by: Valcados

---

build.c

Locate:
void close_area( AREA_DATA * pArea );
void fix_exits( void );


Below it, add:
void affect_modify( CHAR_DATA * ch, AFFECT_DATA * paf, bool fAdd );


build.c, do_oset

Locate:
      paf->bit = 0;
      if( IS_OBJ_FLAG( obj, ITEM_PROTOTYPE ) )
         LINK( paf, obj->pIndexData->first_affect, obj->pIndexData->last_affect, next, prev );
      else
         LINK( paf, obj->first_affect, obj->last_affect, next, prev );
      ++top_affect;


Change to:
      paf->bit = 0;
      if( IS_OBJ_FLAG( obj, ITEM_PROTOTYPE ) )
      {
         if( loc != APPLY_WEARSPELL && loc != APPLY_REMOVESPELL && loc != APPLY_STRIPSN && loc != APPLY_WEAPONSPELL )
         {
            CHAR_DATA *vch;
            OBJ_DATA *eq;

            for( vch = first_char; vch; vch = vch->next )
            {
               for( eq = vch->first_carrying; eq; eq = eq->next_content )
               {
                  if( eq->pIndexData == obj->pIndexData && eq->wear_loc != WEAR_NONE )
                     affect_modify( vch, paf, TRUE );
               }
            }
         }
         LINK( paf, obj->pIndexData->first_affect, obj->pIndexData->last_affect, next, prev );
      }
      else
         LINK( paf, obj->first_affect, obj->last_affect, next, prev );
      ++top_affect;


Locate:
      if( IS_OBJ_FLAG( obj, ITEM_PROTOTYPE ) )
      {
         OBJ_INDEX_DATA *pObjIndex;

         pObjIndex = obj->pIndexData;
         for( paf = pObjIndex->first_affect; paf; paf = paf->next )
         {
            if( ++count == loc )
            {
               UNLINK( paf, pObjIndex->first_affect, pObjIndex->last_affect, next, prev );
               DISPOSE( paf );
               send_to_char( "Object affect removed.\n\r", ch );
               --top_affect;
               return;
            }
         }
         send_to_char( "Object affect not found.\n\r", ch );
         return;
      }


Change to:
      if( IS_OBJ_FLAG( obj, ITEM_PROTOTYPE ) )
      {
         OBJ_INDEX_DATA *pObjIndex;

         pObjIndex = obj->pIndexData;
         for( paf = pObjIndex->first_affect; paf; paf = paf->next )
         {
            if( ++count == loc )
            {
               UNLINK( paf, pObjIndex->first_affect, pObjIndex->last_affect, next, prev );
               if( paf->location != APPLY_WEARSPELL && paf->location != APPLY_REMOVESPELL && paf->location != APPLY_STRIPSN
                && paf->location != APPLY_WEAPONSPELL )
               {
                  CHAR_DATA *vch;
                  OBJ_DATA *eq;

                  for( vch = first_char; vch; vch = vch->next )
                  {
                     for( eq = vch->first_carrying; eq; eq = eq->next_content )
                     {
                        if( eq->pIndexData == pObjIndex && eq->wear_loc != WEAR_NONE )
                           affect_modify( vch, paf, FALSE );
                     }
                  }
               }
               DISPOSE( paf );
               send_to_char( "Removed.\n\r", ch );
               --top_affect;
               return;
            }
         }
      }


Due to the odd way in which Smaug chooses to handle object affects, changing those on a prototype item can lead to stat corruption on players and mobs. This is more of an issue for players obviously since they'll get stuck with any bad results this carries and complain bitterly, or as is more often the case get stuck with any good affects this will have and never report it.

Pages:<< prev 1 next >>