» SmaugMuds » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Modifying prototype ite...
[Bug] Modifying prototype item affects can corrupt player stats
< Newer Topic
:: Older Topic >
AFKMud 1.77
Pages:<< prev 1 next >>
#1 Sep 10, 2006 5:09 pm
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:
Below it, add:
build.c, do_oset
Locate:
Change to:
Locate:
Change to:
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.
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 >>