From 0f49d28020b652a5f75b260567144bae485e41a9 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:11:19 -0600 Subject: [PATCH] Moved from base to item Moved from cbase to citem --- source/UOXJSPropertySpecs.h | 2 +- source/cBaseObject.cpp | 25 +------------------------ source/cBaseObject.h | 4 ---- source/cItem.cpp | 24 +++++++++++++++++++++++- source/cItem.h | 4 ++++ 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/source/UOXJSPropertySpecs.h b/source/UOXJSPropertySpecs.h index 498f414a2..8607ffab5 100644 --- a/source/UOXJSPropertySpecs.h +++ b/source/UOXJSPropertySpecs.h @@ -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 }, diff --git a/source/cBaseObject.cpp b/source/cBaseObject.cpp index 5a474d345..506c247ac 100644 --- a/source/cBaseObject.cpp +++ b/source/cBaseObject.cpp @@ -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 @@ -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; @@ -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( this ))->UpdateRegion(); - } -} - //o------------------------------------------------------------------------------------------------o //| Function - CBaseObject::GetDir() //| CBaseObject::SetDir() diff --git a/source/cBaseObject.h b/source/cBaseObject.h index 41f5b6667..638e826f7 100644 --- a/source/cBaseObject.h +++ b/source/cBaseObject.h @@ -69,7 +69,6 @@ class CBaseObject SI16 dexterity; SI16 intelligence; SI16 hitpoints; - SI16 artifactRarity; VisibleTypes visible; SI16 hiDamage; SI16 loDamage; @@ -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; diff --git a/source/cItem.cpp b/source/cItem.cpp index 0b569e08b..4d6e231f2 100644 --- a/source/cItem.cpp +++ b/source/cItem.cpp @@ -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() @@ -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; @@ -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( this ))->UpdateRegion(); + } +} + //o------------------------------------------------------------------------------------------------o //| Function - CItem::GetName2() //| CItem::SetName2() diff --git a/source/cItem.h b/source/cItem.h index 3a3b60e5d..4b220999e 100644 --- a/source/cItem.h +++ b/source/cItem.h @@ -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 @@ -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;