Skip to content

Commit 652b978

Browse files
authored
Merge pull request UOX3DevTeam#282 from DragonSlayer62/Three-New-AOS-Props
Three new AOS properties
2 parents 5682ad4 + e66c552 commit 652b978

13 files changed

+236
-6
lines changed

source/CPacketSend.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7665,6 +7665,27 @@ void CPToolTip::CopyItemData( CItem& cItem, size_t &totalStringLen, bool addAmou
76657665
FinalizeData( tempEntry, totalStringLen );
76667666
}
76677667

7668+
if( cItem.GetHealthBonus() > 0 )
7669+
{
7670+
tempEntry.stringNum = 1060431; // hit point increase ~1_val~
7671+
tempEntry.ourText = oldstrutil::number( cItem.GetHealthBonus() );
7672+
FinalizeData( tempEntry, totalStringLen );
7673+
}
7674+
7675+
if( cItem.GetStaminaBonus() > 0 )
7676+
{
7677+
tempEntry.stringNum = 1060484; // stamina increase ~1_val~
7678+
tempEntry.ourText = oldstrutil::number( cItem.GetStaminaBonus() );
7679+
FinalizeData( tempEntry, totalStringLen );
7680+
}
7681+
7682+
if( cItem.GetManaBonus() > 0 )
7683+
{
7684+
tempEntry.stringNum = 1060439; // mana increase ~1_val~
7685+
tempEntry.ourText = oldstrutil::number( cItem.GetManaBonus() );
7686+
FinalizeData( tempEntry, totalStringLen );
7687+
}
7688+
76687689
if( cItem.GetStrength() > 1 )
76697690
{
76707691
tempEntry.stringNum = 1061170; // strength requirement ~1_val~

source/Changelog.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
13/06/2024 - Dragon Slayer
2+
Added three More AOS Props
3+
-HEALTHBONUS=#
4+
-MANABONUS=#
5+
-STAMINABONUS=#
6+
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
7+
These are also available as JS Engine object properties: .healthBonus, .staminaBonus, .manaBonus
8+
19
13/05/2024 - Dragon Slayer
210
Added New Shield Type 107 so shield ID's no longer have to be in hard code for shields to work properly
311

@@ -9,6 +17,7 @@
917
-ARTIFACTRARITY=#
1018
-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.
1119

20+
1221
1/05/2024 - Dragon Slayer/Xuri
1322
Fixed AutoUnequipAttempt function in clumsy.js, createfood.js level1target.js, will no longer fail on casting and return to hardcode.
1423
Fixed createfood to check for reagents on cast.

source/UOXJSPropertyEnums.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ enum CI_Properties
517517
CIP_ISCONTTYPE,
518518
CIP_CARVESECTION,
519519
CIP_SPEED,
520+
CIP_HEALTHBONUS,
521+
CIP_STAMINABONUS,
522+
CIP_MANABONUS,
520523
CIP_MULTI,
521524
CIP_AMMOID,
522525
CIP_AMMOHUE,

source/UOXJSPropertyFuncs.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,9 @@ JSBool CItemProps_getProperty( JSContext *cx, JSObject *obj, jsval id, jsval *vp
676676
case CIP_DAMAGERAIN: *vp = BOOLEAN_TO_JSVAL( gPriv->GetWeatherDamage( RAIN )); break;
677677
case CIP_DAMAGESNOW: *vp = BOOLEAN_TO_JSVAL( gPriv->GetWeatherDamage( SNOW )); break;
678678
case CIP_SPEED: *vp = INT_TO_JSVAL( gPriv->GetSpeed() ); break;
679+
case CIP_HEALTHBONUS: *vp = INT_TO_JSVAL( gPriv->GetHealthBonus() ); break;
680+
case CIP_STAMINABONUS: *vp = INT_TO_JSVAL( gPriv->GetStaminaBonus() ); break;
681+
case CIP_MANABONUS: *vp = INT_TO_JSVAL( gPriv->GetManaBonus() ); break;
679682
case CIP_ARTIFACTRARITY: *vp = INT_TO_JSVAL( gPriv->GetArtifactRarity() ); break;
680683
case CIP_NAME2:
681684
tString = JS_NewStringCopyZ( cx, gPriv->GetName2().c_str() );
@@ -1322,6 +1325,9 @@ JSBool CItemProps_setProperty( JSContext *cx, JSObject *obj, jsval id, jsval *vp
13221325
case CIP_DAMAGERAIN: gPriv->SetWeatherDamage( RAIN, encaps.toBool() ); break;
13231326
case CIP_DAMAGESNOW: gPriv->SetWeatherDamage( SNOW, encaps.toBool() ); break;
13241327
case CIP_SPEED: gPriv->SetSpeed( static_cast<UI08>( encaps.toInt() )); break;
1328+
case CIP_HEALTHBONUS: gPriv->SetHealthBonus( static_cast<SI16>( encaps.toInt() )); break;
1329+
case CIP_STAMINABONUS: gPriv->SetStaminaBonus( static_cast<SI16>( encaps.toInt() )); break;
1330+
case CIP_MANABONUS: gPriv->SetManaBonus( static_cast<SI16>( encaps.toInt() )); break;
13251331
case CIP_ARTIFACTRARITY: gPriv->SetArtifactRarity( static_cast<SI16>( encaps.toInt() )); break;
13261332
case CIP_NAME2: gPriv->SetName2( encaps.toString() ); break;
13271333
case CIP_RACE: gPriv->SetRace( static_cast<RACEID>( encaps.toInt() )); break;

source/UOXJSPropertySpecs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,9 @@ inline JSPropertySpec CItemProps[] =
535535
{ "ammoFXHue", CIP_AMMOFXHUE, JSPROP_ENUMANDPERM, nullptr, nullptr },
536536
{ "ammoFXRender", CIP_AMMOFXRENDER, JSPROP_ENUMANDPERM, nullptr, nullptr },
537537
{ "speed", CIP_SPEED, JSPROP_ENUMANDPERM, nullptr, nullptr },
538+
{ "healthBonus", CIP_HEALTHBONUS, JSPROP_ENUMANDPERM, nullptr, nullptr },
539+
{ "staminaBonus", CIP_STAMINABONUS, JSPROP_ENUMANDPERM, nullptr, nullptr },
540+
{ "manaBonus", CIP_MANABONUS, JSPROP_ENUMANDPERM, nullptr, nullptr },
538541
{ "artifactRarity", CIP_ARTIFACTRARITY, JSPROP_ENUMANDPERM, nullptr, nullptr },
539542
{ "multi", CIP_MULTI, JSPROP_ENUMANDPERM, nullptr, nullptr },
540543
{ "maxRange", CIP_MAXRANGE, JSPROP_ENUMANDPERM, nullptr, nullptr },

source/cBaseObject.cpp

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ const SI16 DEFBASE_KILLS = 0;
9494
const UI16 DEFBASE_RESIST = 0;
9595
const bool DEFBASE_NAMEREQUESTACTIVE = 0;
9696
const ExpansionRuleset DEFBASE_ORIGIN = ER_UO;
97+
const SI16 DEFBASE_HEALTHBONUS = 0;
98+
const SI16 DEFBASE_STAMINABONOS = 0;
99+
const SI16 DEFBASE_MANABONUS = 0;
97100

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

1638+
//o------------------------------------------------------------------------------------------------o
1639+
//| Function - CBaseObject::GetHealthBonus()
1640+
//| CBaseObject::SetHealthBonus()
1641+
//o------------------------------------------------------------------------------------------------o
1642+
//| Purpose - Gets/Sets the health max var associated with the object. For chars, it's the
1643+
//| bonuses (via armour and such)
1644+
//o------------------------------------------------------------------------------------------------o
1645+
SI16 CBaseObject::GetHealthBonus( void ) const
1646+
{
1647+
return healthBonus;
1648+
}
1649+
void CBaseObject::SetHealthBonus( SI16 nVal )
1650+
{
1651+
healthBonus = nVal;
1652+
1653+
if( CanBeObjType( OT_ITEM ))
1654+
{
1655+
( static_cast<CItem *>( this ))->UpdateRegion();
1656+
}
1657+
}
1658+
1659+
//o------------------------------------------------------------------------------------------------o
1660+
//| Function - CBaseObject::GetStaminaBonus()
1661+
//| CBaseObject::SetStaminaBonus()
1662+
//o------------------------------------------------------------------------------------------------o
1663+
//| Purpose - Gets/Sets the stamina max var associated with the object. For chars, it's the
1664+
//| bonuses (via armour and such)
1665+
//o------------------------------------------------------------------------------------------------o
1666+
SI16 CBaseObject::GetStaminaBonus( void ) const
1667+
{
1668+
return staminaBonus;
1669+
}
1670+
void CBaseObject::SetStaminaBonus( SI16 nVal )
1671+
{
1672+
staminaBonus = nVal;
1673+
1674+
if( CanBeObjType( OT_ITEM ))
1675+
{
1676+
( static_cast<CItem *>( this ))->UpdateRegion();
1677+
}
1678+
}
1679+
1680+
//o------------------------------------------------------------------------------------------------o
1681+
//| Function - CBaseObject::GetManaBonus()
1682+
//| CBaseObject::SetManaBonus()
1683+
//o------------------------------------------------------------------------------------------------o
1684+
//| Purpose - Gets/Sets the Mana max var associated with the object. For chars, it's the
1685+
//| bonuses (via armour and such)
1686+
//o------------------------------------------------------------------------------------------------o
1687+
SI16 CBaseObject::GetManaBonus( void ) const
1688+
{
1689+
return manaBonus;
1690+
}
1691+
void CBaseObject::SetManaBonus( SI16 nVal )
1692+
{
1693+
manaBonus = nVal;
1694+
1695+
if( CanBeObjType( OT_ITEM ))
1696+
{
1697+
( static_cast<CItem *>( this ))->UpdateRegion();
1698+
}
1699+
}
1700+
16341701
//o------------------------------------------------------------------------------------------------o
16351702
//| Function - CBaseObject::IncStrength()
16361703
//o------------------------------------------------------------------------------------------------o

source/cBaseObject.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ class CBaseObject
7979
SI16 st2;
8080
SI16 dx2;
8181
SI16 in2;
82+
SI16 healthBonus;
83+
SI16 staminaBonus;
84+
SI16 manaBonus;
8285
mutable SI32 FilePosition;
8386
SERIAL tempMulti;
8487
std::string name;
@@ -256,6 +259,15 @@ class CBaseObject
256259
void IncDexterity( SI16 toInc = 1 );
257260
void IncIntelligence( SI16 toInc = 1 );
258261

262+
SI16 GetHealthBonus( void ) const;
263+
virtual void SetHealthBonus( SI16 nVal );
264+
265+
SI16 GetStaminaBonus( void ) const;
266+
virtual void SetStaminaBonus( SI16 nVal );
267+
268+
SI16 GetManaBonus( void ) const;
269+
virtual void SetManaBonus( SI16 nVal );
270+
259271
virtual void PostLoadProcessing( void );
260272
virtual bool LoadRemnants( void ) = 0;
261273

source/cChar.cpp

Lines changed: 82 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,6 +2920,10 @@ bool CChar::WearItem( CItem *toWear )
29202920
IncDexterity2( itemLayers[tLayer]->GetDexterity2() );
29212921
IncIntelligence2( itemLayers[tLayer]->GetIntelligence2() );
29222922

2923+
IncHealthBonus( itemLayers[tLayer]->GetHealthBonus() );
2924+
IncStaminaBonus( itemLayers[tLayer]->GetStaminaBonus() );
2925+
IncManaBonus( itemLayers[tLayer]->GetManaBonus() );
2926+
29232927
if( toWear->IsPostLoaded() )
29242928
{
29252929
if( itemLayers[tLayer]->GetPoisoned() )
@@ -2979,6 +2983,11 @@ bool CChar::TakeOffItem( ItemLayers Layer )
29792983
IncStrength2( -itemLayers[Layer]->GetStrength2() );
29802984
IncDexterity2( -itemLayers[Layer]->GetDexterity2() );
29812985
IncIntelligence2( -itemLayers[Layer]->GetIntelligence2() );
2986+
2987+
IncHealthBonus( -itemLayers[Layer]->GetHealthBonus() );
2988+
IncStaminaBonus( -itemLayers[Layer]->GetStaminaBonus() );
2989+
IncManaBonus( -itemLayers[Layer]->GetManaBonus() );
2990+
29822991
if( itemLayers[Layer]->GetPoisoned() )
29832992
{
29842993
if( itemLayers[Layer]->GetPoisoned() > GetPoisoned() )
@@ -3787,7 +3796,7 @@ UI16 CChar::GetMaxHP( void )
37873796
oldRace = GetRace();
37883797

37893798
}
3790-
return maxHP;
3799+
return maxHP + GetHealthBonus();
37913800
}
37923801
void CChar::SetMaxHP( UI16 newmaxhp, UI16 newoldstr, RACEID newoldrace )
37933802
{
@@ -3830,7 +3839,7 @@ void CChar::SetFixedMaxHP( SI16 newmaxhp )
38303839
SI16 CChar::GetMaxMana( void )
38313840
{
38323841
if(( maxMana_oldint != GetIntelligence() || oldRace != GetRace() ) && !GetMaxManaFixed() )
3833-
//if int/race changed since last calculation, recalculate maxHp
3842+
//if int/race changed since last calculation, recalculate maxMana
38343843
{
38353844
CRace *pRace = Races->Race( GetRace() );
38363845

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

38493858
}
3850-
return maxMana;
3859+
return maxMana + GetManaBonus();
38513860
}
38523861
void CChar::SetMaxMana( SI16 newmaxmana, UI16 newoldint, RACEID newoldrace )
38533862
{
@@ -3889,7 +3898,7 @@ void CChar::SetFixedMaxMana( SI16 newmaxmana )
38893898
//o------------------------------------------------------------------------------------------------o
38903899
SI16 CChar::GetMaxStam( void )
38913900
{
3892-
// If dex/race changed since last calculation, recalculate maxHp
3901+
// If dex/race changed since last calculation, recalculate maxStam
38933902
if(( maxStam_olddex != GetDexterity() || oldRace != GetRace() ) && !GetMaxStamFixed() )
38943903
{
38953904
CRace *pRace = Races->Race( GetRace() );
@@ -3907,7 +3916,7 @@ SI16 CChar::GetMaxStam( void )
39073916
oldRace = GetRace();
39083917

39093918
}
3910-
return maxStam;
3919+
return maxStam + GetStaminaBonus();
39113920
}
39123921
void CChar::SetMaxStam( SI16 newmaxstam, UI16 newolddex, RACEID newoldrace )
39133922
{
@@ -5593,6 +5602,74 @@ void CChar::SetIntelligence2( SI16 nVal )
55935602
UpdateRegion();
55945603
}
55955604

5605+
//o------------------------------------------------------------------------------------------------o
5606+
//| Function - CChar::SetHealthBonus()
5607+
//o------------------------------------------------------------------------------------------------o
5608+
//| Purpose - Sets bonus Hits stat for character
5609+
//o------------------------------------------------------------------------------------------------o
5610+
void CChar::SetHealthBonus( SI16 nVal )
5611+
{
5612+
CBaseObject::SetHealthBonus( nVal );
5613+
Dirty( UT_HITPOINTS );
5614+
UpdateRegion();
5615+
}
5616+
5617+
//o------------------------------------------------------------------------------------------------o
5618+
//| Function - CChar::SetStaminaBonus()
5619+
//o------------------------------------------------------------------------------------------------o
5620+
//| Purpose - Sets bonus Stam stat for character
5621+
//o------------------------------------------------------------------------------------------------o
5622+
void CChar::SetStaminaBonus( SI16 nVal )
5623+
{
5624+
CBaseObject::SetStaminaBonus( nVal );
5625+
Dirty( UT_STAMINA );
5626+
UpdateRegion();
5627+
}
5628+
5629+
//o------------------------------------------------------------------------------------------------o
5630+
//| Function - CChar::SetManaBonus()
5631+
//o------------------------------------------------------------------------------------------------o
5632+
//| Purpose - Sets bonus Mana stat for character
5633+
//o------------------------------------------------------------------------------------------------o
5634+
void CChar::SetManaBonus( SI16 nVal )
5635+
{
5636+
CBaseObject::SetManaBonus( nVal );
5637+
Dirty( UT_MANA );
5638+
UpdateRegion();
5639+
}
5640+
5641+
//o------------------------------------------------------------------------------------------------o
5642+
//| Function - CChar::IncHealthBonus()
5643+
//o------------------------------------------------------------------------------------------------o
5644+
//| Purpose - Increments GetHealthBonus (modifications) by toAdd
5645+
//o------------------------------------------------------------------------------------------------o
5646+
void CChar::IncHealthBonus( SI16 toAdd )
5647+
{
5648+
SetHealthBonus( static_cast<SI16>( GetHealthBonus() + toAdd ));
5649+
}
5650+
5651+
//o------------------------------------------------------------------------------------------------o
5652+
//| Function - CChar::IncStaminaBonus()
5653+
//| Date - 26 May 2024
5654+
//o------------------------------------------------------------------------------------------------o
5655+
//| Purpose - Increments GetBonusStam (modifications) by toAdd
5656+
//o------------------------------------------------------------------------------------------------o
5657+
void CChar::IncStaminaBonus( SI16 toAdd )
5658+
{
5659+
SetStaminaBonus( static_cast<SI16>( GetStaminaBonus() + toAdd ));
5660+
}
5661+
5662+
//o------------------------------------------------------------------------------------------------o
5663+
//| Function - CChar::IncManaBonus()
5664+
//| Date - 26 May 2024
5665+
//o------------------------------------------------------------------------------------------------o
5666+
//| Purpose - Increments GetBonusMana (modifications) by toAdd
5667+
//o------------------------------------------------------------------------------------------------o
5668+
void CChar::IncManaBonus( SI16 toAdd )
5669+
{
5670+
SetManaBonus( static_cast<SI16>( GetManaBonus() + toAdd ));
5671+
}
5672+
55965673
//o------------------------------------------------------------------------------------------------o
55975674
//| Function - CChar::IncStamina()
55985675
//o------------------------------------------------------------------------------------------------o

source/cChar.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,15 @@ class CChar : public CBaseObject
628628
virtual void SetStrength2( SI16 newValue ) override;
629629
virtual void SetDexterity2( SI16 newValue ) override;
630630
virtual void SetIntelligence2( SI16 newValue ) override;
631+
632+
virtual void SetHealthBonus( SI16 newValue ) override;
633+
virtual void SetStaminaBonus( SI16 newValue ) override;
634+
virtual void SetManaBonus( SI16 newValue ) override;
635+
636+
void IncHealthBonus( SI16 toAdd = 1 );
637+
void IncStaminaBonus( SI16 toAdd = 1 );
638+
void IncManaBonus( SI16 toAdd = 1 );
639+
631640
void IncStamina( SI16 toInc );
632641
void IncMana( SI16 toInc );
633642
void SetMaxLoyalty( UI16 newMaxLoyalty );

source/cItem.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,9 @@ auto CItem::CopyData( CItem *target ) -> void
16711671
target->SetWeightMax( GetWeightMax() );
16721672
target->SetBaseWeight( GetBaseWeight() );
16731673
target->SetMaxItems( GetMaxItems() );
1674+
target->SetHealthBonus( GetHealthBonus() );
1675+
target->SetStaminaBonus( GetStaminaBonus() );
1676+
target->SetManaBonus( GetManaBonus() );
16741677
//target->SetWipeable( IsWipeable() );
16751678
target->SetPriv( GetPriv() );
16761679
target->SetBaseRange( GetBaseRange() );
@@ -1754,6 +1757,7 @@ bool CItem::DumpBody( std::ostream &outStream ) const
17541757
outStream << "MaxItems=" + std::to_string( GetMaxItems() ) + newLine;
17551758
outStream << "MaxHP=" + std::to_string( GetMaxHP() ) + newLine;
17561759
outStream << "Speed=" + std::to_string( GetSpeed() ) + newLine;
1760+
outStream << "BonusStats=" + std::to_string( GetHealthBonus() ) + "," + std::to_string( GetStaminaBonus() ) + "," + std::to_string( GetManaBonus() ) + newLine;
17571761
outStream << "ArtifactRarity=" + std::to_string( GetArtifactRarity() ) + newLine;
17581762
outStream << "Movable=" + std::to_string( GetMovable() ) + newLine;
17591763
outStream << "Priv=" + std::to_string( GetPriv() ) + newLine;
@@ -1843,6 +1847,13 @@ bool CItem::HandleLine( std::string &UTag, std::string &data )
18431847
bools = static_cast<UI08>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 ));
18441848
rValue = true;
18451849
}
1850+
else if( UTag == "BONUSSTATS" )
1851+
{
1852+
SetHealthBonus( static_cast<SI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[0], "//" )), nullptr, 0 )));
1853+
SetStaminaBonus( static_cast<SI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[1], "//" )), nullptr, 0 )));
1854+
SetManaBonus( static_cast<SI16>( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( csecs[2], "//" )), nullptr, 0 )));
1855+
rValue = true;
1856+
}
18461857
break;
18471858
case 'C':
18481859
if( UTag == "CONT" )

0 commit comments

Comments
 (0)