Skip to content

Commit

Permalink
Moved from base to item
Browse files Browse the repository at this point in the history
Moved from cbase to citem
  • Loading branch information
DragonSlayer62 committed Jan 14, 2025
1 parent fe9f789 commit 0f49d28
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion source/UOXJSPropertySpecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ inline JSPropertySpec CItemProps[] =
{ "ammoFXHue", CIP_AMMOFXHUE, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "ammoFXRender", CIP_AMMOFXRENDER, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "speed", CIP_SPEED, JSPROP_ENUMANDPERM, nullptr, nullptr },
{ "artifactRarity", CIP_ARTIFACTRARITY, 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 },
{ "baseRange", CIP_BASERANGE, JSPROP_ENUMANDPERM, nullptr, nullptr },
Expand Down
25 changes: 1 addition & 24 deletions source/cBaseObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const SI16 DEFBASE_KILLS = 0;
const UI16 DEFBASE_RESIST = 0;
const bool DEFBASE_NAMEREQUESTACTIVE = 0;
const ExpansionRuleset DEFBASE_ORIGIN = ER_UO;
const SI16 DEFBASE_ARTIFACTRARITY = 0;

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject constructor
Expand All @@ -111,8 +110,7 @@ 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 ),
artifactRarity( DEFBASE_ARTIFACTRARITY )
fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN )
{
multis = nullptr;
tempMulti = INVALIDSERIAL;
Expand Down Expand Up @@ -1038,27 +1036,6 @@ void CBaseObject::IncHP( SI16 amtToChange )
SetHP( hitpoints + amtToChange );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetArtifactRarity()
//| CBaseObject::SetArtifactRarity()
//| Date - 9 May, 2024
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Artifacts Rarity of the object
//o------------------------------------------------------------------------------------------------o
SI16 CBaseObject::GetArtifactRarity( void ) const
{
return artifactRarity;
}
void CBaseObject::SetArtifactRarity( SI16 newValue )
{
artifactRarity = newValue;

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

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetDir()
//| CBaseObject::SetDir()
Expand Down
4 changes: 0 additions & 4 deletions source/cBaseObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class CBaseObject
SI16 dexterity;
SI16 intelligence;
SI16 hitpoints;
SI16 artifactRarity;
VisibleTypes visible;
SI16 hiDamage;
SI16 loDamage;
Expand Down Expand Up @@ -224,9 +223,6 @@ class CBaseObject
virtual void SetHP( SI16 newValue );
void IncHP( SI16 amtToChange );

virtual SI16 GetArtifactRarity( void ) const;
virtual void SetArtifactRarity( SI16 newValue );

void SetDir( UI08 newDir, bool sendUpdate = true );
UI08 GetDir( void ) const;

Expand Down
24 changes: 23 additions & 1 deletion source/cItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const UI16 DEFITEM_MAXUSES = 0;
const UI16 DEFITEM_REGIONNUM = 255;
const UI16 DEFITEM_TEMPLASTTRADED = 0;
const SI08 DEFITEM_STEALABLE = 1;
const SI16 DEFITEM_ARTIFACTRARITY = 0;

//o------------------------------------------------------------------------------------------------o
//| Function - CItem()
Expand All @@ -107,7 +108,7 @@ spd( DEFITEM_SPEED ), maxHp( DEFITEM_MAXHP ), amount( DEFITEM_AMOUNT ),
layer( DEFITEM_LAYER ), type( DEFITEM_TYPE ), offspell( DEFITEM_OFFSPELL ), entryMadeFrom( DEFITEM_ENTRYMADEFROM ),
creator( DEFITEM_CREATOR ), gridLoc( DEFITEM_GRIDLOC ), weightMax( DEFITEM_WEIGHTMAX ), baseWeight( DEFITEM_BASEWEIGHT ), maxItems( DEFITEM_MAXITEMS ),
maxRange( DEFITEM_MAXRANGE ), baseRange( DEFITEM_BASERANGE ), maxUses( DEFITEM_MAXUSES ), usesLeft( DEFITEM_USESLEFT ), regionNum( DEFITEM_REGIONNUM ),
tempLastTraded( DEFITEM_TEMPLASTTRADED ), stealable( DEFITEM_STEALABLE )
tempLastTraded( DEFITEM_TEMPLASTTRADED ), stealable( DEFITEM_STEALABLE ), artifactRarity(DEFITEM_ARTIFACTRARITY)
{
spells[0] = spells[1] = spells[2] = 0;
value[0] = value[1] = value[2] = 0;
Expand Down Expand Up @@ -542,6 +543,27 @@ auto CItem::SetSpawnerList( bool newValue ) -> void
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetArtifactRarity()
//| CBaseObject::SetArtifactRarity()
//| Date - 9 May, 2024
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Artifacts Rarity of the object
//o------------------------------------------------------------------------------------------------o
SI16 CItem::GetArtifactRarity( void ) const
{
return artifactRarity;
}
void CItem::SetArtifactRarity( SI16 newValue )
{
artifactRarity = newValue;

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

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::GetName2()
//| CItem::SetName2()
Expand Down
4 changes: 4 additions & 0 deletions source/cItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class CItem : public CBaseObject
UI16 entryMadeFrom;
SERIAL creator; // Store the serial of the player made this item
SI08 gridLoc;
SI16 artifactRarity;
SI32 weightMax; // Maximum weight a container can hold
SI32 baseWeight; // Base weight of item. Applied when item is created for the first time, based on weight. Primarily used to determine base weight of containers
UI16 maxItems; // Maximum amount of items a container can hold
Expand Down Expand Up @@ -110,6 +111,9 @@ class CItem : public CBaseObject
auto GetGridLocation() const -> SI08;
auto SetGridLocation( SI08 newLoc ) -> void;

virtual SI16 GetArtifactRarity(void) const;
virtual void SetArtifactRarity(SI16 newValue);

auto GetStealable() const -> UI08;
auto SetStealable( UI08 newValue ) -> void;

Expand Down

0 comments on commit 0f49d28

Please sign in to comment.