Skip to content

Commit

Permalink
Merge pull request UOX3DevTeam#282 from DragonSlayer62/Three-New-AOS-…
Browse files Browse the repository at this point in the history
…Props

Three new AOS properties
  • Loading branch information
Xoduz authored Jan 25, 2025
2 parents 5682ad4 + e66c552 commit 652b978
Show file tree
Hide file tree
Showing 13 changed files with 236 additions and 6 deletions.
21 changes: 21 additions & 0 deletions source/CPacketSend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7665,6 +7665,27 @@ void CPToolTip::CopyItemData( CItem& cItem, size_t &totalStringLen, bool addAmou
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetHealthBonus() > 0 )
{
tempEntry.stringNum = 1060431; // hit point increase ~1_val~
tempEntry.ourText = oldstrutil::number( cItem.GetHealthBonus() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetStaminaBonus() > 0 )
{
tempEntry.stringNum = 1060484; // stamina increase ~1_val~
tempEntry.ourText = oldstrutil::number( cItem.GetStaminaBonus() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetManaBonus() > 0 )
{
tempEntry.stringNum = 1060439; // mana increase ~1_val~
tempEntry.ourText = oldstrutil::number( cItem.GetManaBonus() );
FinalizeData( tempEntry, totalStringLen );
}

if( cItem.GetStrength() > 1 )
{
tempEntry.stringNum = 1061170; // strength requirement ~1_val~
Expand Down
9 changes: 9 additions & 0 deletions source/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
13/06/2024 - Dragon Slayer
Added three More AOS Props
-HEALTHBONUS=#
-MANABONUS=#
-STAMINABONUS=#
Add this properties to any weapon/armor/jewlery will give the player more hp/mana/stam why its equiped. depending on number you add with it
These are also available as JS Engine object properties: .healthBonus, .staminaBonus, .manaBonus

13/05/2024 - Dragon Slayer
Added New Shield Type 107 so shield ID's no longer have to be in hard code for shields to work properly

Expand All @@ -9,6 +17,7 @@
-ARTIFACTRARITY=#
-Artifact Rarity is an item property that is visible on some artifacts and meant to give players an idea of how rare the item is. Items with rarity 1 are supposed to be common while rarity 12 are extremely scarce.


1/05/2024 - Dragon Slayer/Xuri
Fixed AutoUnequipAttempt function in clumsy.js, createfood.js level1target.js, will no longer fail on casting and return to hardcode.
Fixed createfood to check for reagents on cast.
Expand Down
3 changes: 3 additions & 0 deletions source/UOXJSPropertyEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ enum CI_Properties
CIP_ISCONTTYPE,
CIP_CARVESECTION,
CIP_SPEED,
CIP_HEALTHBONUS,
CIP_STAMINABONUS,
CIP_MANABONUS,
CIP_MULTI,
CIP_AMMOID,
CIP_AMMOHUE,
Expand Down
6 changes: 6 additions & 0 deletions source/UOXJSPropertyFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ JSBool CItemProps_getProperty( JSContext *cx, JSObject *obj, jsval id, jsval *vp
case CIP_DAMAGERAIN: *vp = BOOLEAN_TO_JSVAL( gPriv->GetWeatherDamage( RAIN )); break;
case CIP_DAMAGESNOW: *vp = BOOLEAN_TO_JSVAL( gPriv->GetWeatherDamage( SNOW )); break;
case CIP_SPEED: *vp = INT_TO_JSVAL( gPriv->GetSpeed() ); break;
case CIP_HEALTHBONUS: *vp = INT_TO_JSVAL( gPriv->GetHealthBonus() ); break;
case CIP_STAMINABONUS: *vp = INT_TO_JSVAL( gPriv->GetStaminaBonus() ); break;
case CIP_MANABONUS: *vp = INT_TO_JSVAL( gPriv->GetManaBonus() ); break;
case CIP_ARTIFACTRARITY: *vp = INT_TO_JSVAL( gPriv->GetArtifactRarity() ); break;
case CIP_NAME2:
tString = JS_NewStringCopyZ( cx, gPriv->GetName2().c_str() );
Expand Down Expand Up @@ -1322,6 +1325,9 @@ JSBool CItemProps_setProperty( JSContext *cx, JSObject *obj, jsval id, jsval *vp
case CIP_DAMAGERAIN: gPriv->SetWeatherDamage( RAIN, encaps.toBool() ); break;
case CIP_DAMAGESNOW: gPriv->SetWeatherDamage( SNOW, encaps.toBool() ); break;
case CIP_SPEED: gPriv->SetSpeed( static_cast<UI08>( encaps.toInt() )); break;
case CIP_HEALTHBONUS: gPriv->SetHealthBonus( static_cast<SI16>( encaps.toInt() )); break;
case CIP_STAMINABONUS: gPriv->SetStaminaBonus( static_cast<SI16>( encaps.toInt() )); break;
case CIP_MANABONUS: gPriv->SetManaBonus( static_cast<SI16>( encaps.toInt() )); break;
case CIP_ARTIFACTRARITY: gPriv->SetArtifactRarity( static_cast<SI16>( encaps.toInt() )); break;
case CIP_NAME2: gPriv->SetName2( encaps.toString() ); break;
case CIP_RACE: gPriv->SetRace( static_cast<RACEID>( encaps.toInt() )); break;
Expand Down
3 changes: 3 additions & 0 deletions source/UOXJSPropertySpecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ inline JSPropertySpec CItemProps[] =
{ "ammoFXHue", CIP_AMMOFXHUE, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "ammoFXRender", CIP_AMMOFXRENDER, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "speed", CIP_SPEED, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "healthBonus", CIP_HEALTHBONUS, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "staminaBonus", CIP_STAMINABONUS, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "manaBonus", CIP_MANABONUS, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "artifactRarity", CIP_ARTIFACTRARITY, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "multi", CIP_MULTI, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "maxRange", CIP_MAXRANGE, JSPROP_ENUMANDPERM, nullptr, nullptr },
Expand Down
69 changes: 68 additions & 1 deletion source/cBaseObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ const SI16 DEFBASE_KILLS = 0;
const UI16 DEFBASE_RESIST = 0;
const bool DEFBASE_NAMEREQUESTACTIVE = 0;
const ExpansionRuleset DEFBASE_ORIGIN = ER_UO;
const SI16 DEFBASE_HEALTHBONUS = 0;
const SI16 DEFBASE_STAMINABONOS = 0;
const SI16 DEFBASE_MANABONUS = 0;

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject constructor
Expand All @@ -110,7 +113,8 @@ loDamage( DEFBASE_LODAMAGE ), weight( DEFBASE_WEIGHT ),
mana( DEFBASE_MANA ), stamina( DEFBASE_STAMINA ), scriptTrig( DEFBASE_SCPTRIG ), st2( DEFBASE_STR2 ), dx2( DEFBASE_DEX2 ),
in2( DEFBASE_INT2 ), FilePosition( DEFBASE_FP ),
poisoned( DEFBASE_POISONED ), carve( DEFBASE_CARVE ), oldLocX( 0 ), oldLocY( 0 ), oldLocZ( 0 ), oldTargLocX( 0 ), oldTargLocY( 0 ),
fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN )
fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN ),
healthBonus( DEFBASE_HEALTHBONUS ),staminaBonus( DEFBASE_STAMINABONOS ), manaBonus( DEFBASE_MANABONUS )
{
multis = nullptr;
tempMulti = INVALIDSERIAL;
Expand Down Expand Up @@ -1631,6 +1635,69 @@ void CBaseObject::SetIntelligence2( SI16 nVal )
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetHealthBonus()
//| CBaseObject::SetHealthBonus()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the health max var associated with the object. For chars, it's the
//| bonuses (via armour and such)
//o------------------------------------------------------------------------------------------------o
SI16 CBaseObject::GetHealthBonus( void ) const
{
return healthBonus;
}
void CBaseObject::SetHealthBonus( SI16 nVal )
{
healthBonus = nVal;

if( CanBeObjType( OT_ITEM ))
{
( static_cast<CItem *>( this ))->UpdateRegion();
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetStaminaBonus()
//| CBaseObject::SetStaminaBonus()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the stamina max var associated with the object. For chars, it's the
//| bonuses (via armour and such)
//o------------------------------------------------------------------------------------------------o
SI16 CBaseObject::GetStaminaBonus( void ) const
{
return staminaBonus;
}
void CBaseObject::SetStaminaBonus( SI16 nVal )
{
staminaBonus = nVal;

if( CanBeObjType( OT_ITEM ))
{
( static_cast<CItem *>( this ))->UpdateRegion();
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetManaBonus()
//| CBaseObject::SetManaBonus()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Mana max var associated with the object. For chars, it's the
//| bonuses (via armour and such)
//o------------------------------------------------------------------------------------------------o
SI16 CBaseObject::GetManaBonus( void ) const
{
return manaBonus;
}
void CBaseObject::SetManaBonus( SI16 nVal )
{
manaBonus = nVal;

if( CanBeObjType( OT_ITEM ))
{
( static_cast<CItem *>( this ))->UpdateRegion();
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::IncStrength()
//o------------------------------------------------------------------------------------------------o
Expand Down
12 changes: 12 additions & 0 deletions source/cBaseObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class CBaseObject
SI16 st2;
SI16 dx2;
SI16 in2;
SI16 healthBonus;
SI16 staminaBonus;
SI16 manaBonus;
mutable SI32 FilePosition;
SERIAL tempMulti;
std::string name;
Expand Down Expand Up @@ -256,6 +259,15 @@ class CBaseObject
void IncDexterity( SI16 toInc = 1 );
void IncIntelligence( SI16 toInc = 1 );

SI16 GetHealthBonus( void ) const;
virtual void SetHealthBonus( SI16 nVal );

SI16 GetStaminaBonus( void ) const;
virtual void SetStaminaBonus( SI16 nVal );

SI16 GetManaBonus( void ) const;
virtual void SetManaBonus( SI16 nVal );

virtual void PostLoadProcessing( void );
virtual bool LoadRemnants( void ) = 0;

Expand Down
87 changes: 82 additions & 5 deletions source/cChar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2920,6 +2920,10 @@ bool CChar::WearItem( CItem *toWear )
IncDexterity2( itemLayers[tLayer]->GetDexterity2() );
IncIntelligence2( itemLayers[tLayer]->GetIntelligence2() );

IncHealthBonus( itemLayers[tLayer]->GetHealthBonus() );
IncStaminaBonus( itemLayers[tLayer]->GetStaminaBonus() );
IncManaBonus( itemLayers[tLayer]->GetManaBonus() );

if( toWear->IsPostLoaded() )
{
if( itemLayers[tLayer]->GetPoisoned() )
Expand Down Expand Up @@ -2979,6 +2983,11 @@ bool CChar::TakeOffItem( ItemLayers Layer )
IncStrength2( -itemLayers[Layer]->GetStrength2() );
IncDexterity2( -itemLayers[Layer]->GetDexterity2() );
IncIntelligence2( -itemLayers[Layer]->GetIntelligence2() );

IncHealthBonus( -itemLayers[Layer]->GetHealthBonus() );
IncStaminaBonus( -itemLayers[Layer]->GetStaminaBonus() );
IncManaBonus( -itemLayers[Layer]->GetManaBonus() );

if( itemLayers[Layer]->GetPoisoned() )
{
if( itemLayers[Layer]->GetPoisoned() > GetPoisoned() )
Expand Down Expand Up @@ -3787,7 +3796,7 @@ UI16 CChar::GetMaxHP( void )
oldRace = GetRace();

}
return maxHP;
return maxHP + GetHealthBonus();
}
void CChar::SetMaxHP( UI16 newmaxhp, UI16 newoldstr, RACEID newoldrace )
{
Expand Down Expand Up @@ -3830,7 +3839,7 @@ void CChar::SetFixedMaxHP( SI16 newmaxhp )
SI16 CChar::GetMaxMana( void )
{
if(( maxMana_oldint != GetIntelligence() || oldRace != GetRace() ) && !GetMaxManaFixed() )
//if int/race changed since last calculation, recalculate maxHp
//if int/race changed since last calculation, recalculate maxMana
{
CRace *pRace = Races->Race( GetRace() );

Expand All @@ -3847,7 +3856,7 @@ SI16 CChar::GetMaxMana( void )
oldRace = GetRace();

}
return maxMana;
return maxMana + GetManaBonus();
}
void CChar::SetMaxMana( SI16 newmaxmana, UI16 newoldint, RACEID newoldrace )
{
Expand Down Expand Up @@ -3889,7 +3898,7 @@ void CChar::SetFixedMaxMana( SI16 newmaxmana )
//o------------------------------------------------------------------------------------------------o
SI16 CChar::GetMaxStam( void )
{
// If dex/race changed since last calculation, recalculate maxHp
// If dex/race changed since last calculation, recalculate maxStam
if(( maxStam_olddex != GetDexterity() || oldRace != GetRace() ) && !GetMaxStamFixed() )
{
CRace *pRace = Races->Race( GetRace() );
Expand All @@ -3907,7 +3916,7 @@ SI16 CChar::GetMaxStam( void )
oldRace = GetRace();

}
return maxStam;
return maxStam + GetStaminaBonus();
}
void CChar::SetMaxStam( SI16 newmaxstam, UI16 newolddex, RACEID newoldrace )
{
Expand Down Expand Up @@ -5593,6 +5602,74 @@ void CChar::SetIntelligence2( SI16 nVal )
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CChar::SetHealthBonus()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Sets bonus Hits stat for character
//o------------------------------------------------------------------------------------------------o
void CChar::SetHealthBonus( SI16 nVal )
{
CBaseObject::SetHealthBonus( nVal );
Dirty( UT_HITPOINTS );
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CChar::SetStaminaBonus()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Sets bonus Stam stat for character
//o------------------------------------------------------------------------------------------------o
void CChar::SetStaminaBonus( SI16 nVal )
{
CBaseObject::SetStaminaBonus( nVal );
Dirty( UT_STAMINA );
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CChar::SetManaBonus()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Sets bonus Mana stat for character
//o------------------------------------------------------------------------------------------------o
void CChar::SetManaBonus( SI16 nVal )
{
CBaseObject::SetManaBonus( nVal );
Dirty( UT_MANA );
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CChar::IncHealthBonus()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments GetHealthBonus (modifications) by toAdd
//o------------------------------------------------------------------------------------------------o
void CChar::IncHealthBonus( SI16 toAdd )
{
SetHealthBonus( static_cast<SI16>( GetHealthBonus() + toAdd ));
}

//o------------------------------------------------------------------------------------------------o
//| Function - CChar::IncStaminaBonus()
//| Date - 26 May 2024
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments GetBonusStam (modifications) by toAdd
//o------------------------------------------------------------------------------------------------o
void CChar::IncStaminaBonus( SI16 toAdd )
{
SetStaminaBonus( static_cast<SI16>( GetStaminaBonus() + toAdd ));
}

//o------------------------------------------------------------------------------------------------o
//| Function - CChar::IncManaBonus()
//| Date - 26 May 2024
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments GetBonusMana (modifications) by toAdd
//o------------------------------------------------------------------------------------------------o
void CChar::IncManaBonus( SI16 toAdd )
{
SetManaBonus( static_cast<SI16>( GetManaBonus() + toAdd ));
}

//o------------------------------------------------------------------------------------------------o
//| Function - CChar::IncStamina()
//o------------------------------------------------------------------------------------------------o
Expand Down
9 changes: 9 additions & 0 deletions source/cChar.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,15 @@ class CChar : public CBaseObject
virtual void SetStrength2( SI16 newValue ) override;
virtual void SetDexterity2( SI16 newValue ) override;
virtual void SetIntelligence2( SI16 newValue ) override;

virtual void SetHealthBonus( SI16 newValue ) override;
virtual void SetStaminaBonus( SI16 newValue ) override;
virtual void SetManaBonus( SI16 newValue ) override;

void IncHealthBonus( SI16 toAdd = 1 );
void IncStaminaBonus( SI16 toAdd = 1 );
void IncManaBonus( SI16 toAdd = 1 );

void IncStamina( SI16 toInc );
void IncMana( SI16 toInc );
void SetMaxLoyalty( UI16 newMaxLoyalty );
Expand Down
11 changes: 11 additions & 0 deletions source/cItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,9 @@ auto CItem::CopyData( CItem *target ) -> void
target->SetWeightMax( GetWeightMax() );
target->SetBaseWeight( GetBaseWeight() );
target->SetMaxItems( GetMaxItems() );
target->SetHealthBonus( GetHealthBonus() );
target->SetStaminaBonus( GetStaminaBonus() );
target->SetManaBonus( GetManaBonus() );
//target->SetWipeable( IsWipeable() );
target->SetPriv( GetPriv() );
target->SetBaseRange( GetBaseRange() );
Expand Down Expand Up @@ -1754,6 +1757,7 @@ bool CItem::DumpBody( std::ostream &outStream ) const
outStream << "MaxItems=" + std::to_string( GetMaxItems() ) + newLine;
outStream << "MaxHP=" + std::to_string( GetMaxHP() ) + newLine;
outStream << "Speed=" + std::to_string( GetSpeed() ) + newLine;
outStream << "BonusStats=" + std::to_string( GetHealthBonus() ) + "," + std::to_string( GetStaminaBonus() ) + "," + std::to_string( GetManaBonus() ) + newLine;
outStream << "ArtifactRarity=" + std::to_string( GetArtifactRarity() ) + newLine;
outStream << "Movable=" + std::to_string( GetMovable() ) + newLine;
outStream << "Priv=" + std::to_string( GetPriv() ) + newLine;
Expand Down Expand Up @@ -1843,6 +1847,13 @@ bool CItem::HandleLine( std::string &UTag, std::string &data )
bools = static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 ));
rValue = true;
}
else if( UTag == "BONUSSTATS" )
{
SetHealthBonus( static_cast<SI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[0], "//" )), nullptr, 0 )));
SetStaminaBonus( static_cast<SI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[1], "//" )), nullptr, 0 )));
SetManaBonus( static_cast<SI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[2], "//" )), nullptr, 0 )));
rValue = true;
}
break;
case 'C':
if( UTag == "CONT" )
Expand Down
Loading

0 comments on commit 652b978

Please sign in to comment.