From 3ce304d7713b6c299a0d7bef3d3ee3f3e86814be Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Fri, 3 Jan 2025 23:15:58 -0600 Subject: [PATCH 01/14] small fix for unequip Unequip fix fixed spelling mistake in script --- data/js/item/equip_effects/skill_boosting_equipment.js | 6 +++--- source/cChar.cpp | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/data/js/item/equip_effects/skill_boosting_equipment.js b/data/js/item/equip_effects/skill_boosting_equipment.js index 641e56b94..5fb73d150 100644 --- a/data/js/item/equip_effects/skill_boosting_equipment.js +++ b/data/js/item/equip_effects/skill_boosting_equipment.js @@ -31,7 +31,7 @@ function onEquip( pEquipper, iEquipped ) } } -function onUnequip( pUnquipper, iUnequipped ) +function onUnequip( pUnequipper, iUnequipped ) { var skillBonusID = iUnequipped.GetTag( "skillBonusID" ); var skillBonusVal = iUnequipped.GetTag( "skillBonusVal" ); @@ -39,10 +39,10 @@ function onUnequip( pUnquipper, iUnequipped ) switch( skillBonusID ) { case 7: // Blacksmithing - pUnquipper.skills.blacksmithing -= skillBonusVal; + pUnequipper.skills.blacksmithing -= skillBonusVal; break; case 45: // Mining - pUnquipper.skills.mining -= skillBonusVal; + pUnequipper.skills.mining -= skillBonusVal; break; default: break; diff --git a/source/cChar.cpp b/source/cChar.cpp index 7aa03f6fa..b93e11d8f 100644 --- a/source/cChar.cpp +++ b/source/cChar.cpp @@ -2991,6 +2991,9 @@ bool CChar::TakeOffItem( ItemLayers Layer ) } } + scriptTriggers.clear(); + scriptTriggers.shrink_to_fit(); + scriptTriggers = itemLayers[Layer]->GetScriptTriggers(); for( auto i : scriptTriggers ) { cScript *tScript = JSMapping->GetScript( i ); From 29d9124cdad32a5e4639a9a5793ce6f013d2b6da Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Fri, 3 Jan 2025 23:41:16 -0600 Subject: [PATCH 02/14] Update StringUtility.cpp --- source/StringUtility.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/StringUtility.cpp b/source/StringUtility.cpp index 6adb6c46c..54a379019 100644 --- a/source/StringUtility.cpp +++ b/source/StringUtility.cpp @@ -5,6 +5,7 @@ // #include "StringUtility.hpp" +#include #include #include #include From ce1a93fad2505fdaf937c9016adf986257158ad8 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Fri, 3 Jan 2025 23:46:56 -0600 Subject: [PATCH 03/14] Update StringUtility.hpp --- source/StringUtility.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/StringUtility.hpp b/source/StringUtility.hpp index 2be725277..2cb94fe7a 100644 --- a/source/StringUtility.hpp +++ b/source/StringUtility.hpp @@ -7,6 +7,7 @@ #ifndef StringUtility_hpp #define StringUtility_hpp +#include #include #include #include From 022612f19da5aee1e158d7dae55fbbb8c51aefe1 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:30:32 -0600 Subject: [PATCH 04/14] fixed pr --- source/CPacketSend.cpp | 7 +++++++ source/Changelog.txt | 4 ++++ source/UOXJSPropertyEnums.h | 1 + source/UOXJSPropertyFuncs.cpp | 2 ++ source/UOXJSPropertySpecs.h | 1 + source/cItem.cpp | 27 ++++++++++++++++++++++++++- source/cItem.h | 4 ++++ source/items.cpp | 7 +++++++ 8 files changed, 52 insertions(+), 1 deletion(-) diff --git a/source/CPacketSend.cpp b/source/CPacketSend.cpp index ba30f52d8..26ace5932 100644 --- a/source/CPacketSend.cpp +++ b/source/CPacketSend.cpp @@ -7467,6 +7467,13 @@ void CPToolTip::CopyItemData( CItem& cItem, size_t &totalStringLen, bool addAmou FinalizeData( tempEntry, totalStringLen ); } + if( cItem.GetDurabilityHpBonus() > 0) + { + tempEntry.stringNum = 1151780; // durability +~1_VAL~% + tempEntry.ourText = oldstrutil::number( cItem.GetDurabilityHpBonus() ); + FinalizeData( tempEntry, totalStringLen ); + } + if( cItem.GetType() == IT_MAGICWAND && cItem.GetTempVar( CITV_MOREZ )) { tempEntry.stringNum = 1060584; // uses remaining: ~1_val~ diff --git a/source/Changelog.txt b/source/Changelog.txt index b0801d426..6793d7f87 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,3 +1,7 @@ +11/05/2024 - Dragon Slayer/Xuri/Maarc + Added Support for new AOS property tag. + -DURABILITYHPBONUS - Add durability (aka Health) to the hp and max hp as a bonus + 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 diff --git a/source/UOXJSPropertyEnums.h b/source/UOXJSPropertyEnums.h index 45517f28d..a251ff810 100644 --- a/source/UOXJSPropertyEnums.h +++ b/source/UOXJSPropertyEnums.h @@ -462,6 +462,7 @@ enum CI_Properties CIP_DAMAGERAIN, CIP_DAMAGESNOW, CIP_ARTIFACTRARITY, + CIP_DURABILITYHPBONUS, CIP_NAME2, CIP_ISITEM, CIP_ISCHAR, diff --git a/source/UOXJSPropertyFuncs.cpp b/source/UOXJSPropertyFuncs.cpp index 5fc2a3a82..3ff32a939 100644 --- a/source/UOXJSPropertyFuncs.cpp +++ b/source/UOXJSPropertyFuncs.cpp @@ -676,6 +676,7 @@ 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_DURABILITYHPBONUS: *vp = INT_TO_JSVAL( gPriv->GetDurabilityHpBonus() ); break; case CIP_ARTIFACTRARITY: *vp = INT_TO_JSVAL( gPriv->GetArtifactRarity() ); break; case CIP_NAME2: tString = JS_NewStringCopyZ( cx, gPriv->GetName2().c_str() ); @@ -1323,6 +1324,7 @@ JSBool CItemProps_setProperty( JSContext *cx, JSObject *obj, jsval id, jsval *vp case CIP_DAMAGESNOW: gPriv->SetWeatherDamage( SNOW, encaps.toBool() ); break; case CIP_SPEED: gPriv->SetSpeed( static_cast( encaps.toInt() )); break; case CIP_ARTIFACTRARITY: gPriv->SetArtifactRarity( static_cast( encaps.toInt() )); break; + case CIP_DURABILITYHPBONUS: gPriv->SetDurabilityHpBonus( static_cast( encaps.toInt() )); break; case CIP_NAME2: gPriv->SetName2( encaps.toString() ); break; case CIP_RACE: gPriv->SetRace( static_cast( encaps.toInt() )); break; case CIP_MAXHP: gPriv->SetMaxHP( static_cast( encaps.toInt() )); break; diff --git a/source/UOXJSPropertySpecs.h b/source/UOXJSPropertySpecs.h index 8607ffab5..d6e870642 100644 --- a/source/UOXJSPropertySpecs.h +++ b/source/UOXJSPropertySpecs.h @@ -536,6 +536,7 @@ inline JSPropertySpec CItemProps[] = { "ammoFXRender", CIP_AMMOFXRENDER, JSPROP_ENUMANDPERM, nullptr, nullptr }, { "speed", CIP_SPEED, JSPROP_ENUMANDPERM, nullptr, nullptr }, { "artifactRarity", CIP_ARTIFACTRARITY, JSPROP_ENUMANDPERM, nullptr, nullptr }, + { "durabilityHpBonus", CIP_DURABILITYHPBONUS, 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/cItem.cpp b/source/cItem.cpp index 3a2acd106..73d7ba539 100644 --- a/source/cItem.cpp +++ b/source/cItem.cpp @@ -94,6 +94,7 @@ const UI16 DEFITEM_REGIONNUM = 255; const UI16 DEFITEM_TEMPLASTTRADED = 0; const SI08 DEFITEM_STEALABLE = 1; const SI16 DEFITEM_ARTIFACTRARITY = 0; +const SI16 DEFITEM_DURABLITITYHPBONUS = 0; //o------------------------------------------------------------------------------------------------o //| Function - CItem() @@ -108,7 +109,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 ), artifactRarity(DEFITEM_ARTIFACTRARITY) +tempLastTraded( DEFITEM_TEMPLASTTRADED ), stealable( DEFITEM_STEALABLE ), artifactRarity(DEFITEM_ARTIFACTRARITY), durabilityHpBonus( DEFITEM_DURABLITITYHPBONUS ) { spells[0] = spells[1] = spells[2] = 0; value[0] = value[1] = value[2] = 0; @@ -1374,6 +1375,23 @@ auto CItem::SetBaseWeight( SI32 newValue ) -> void UpdateRegion(); } +//o------------------------------------------------------------------------------------------------o +//| Function - CItem::GetDurabilityHpBonus() +//| CItem::SetDurabilityHpBonus() +//| Date - 5 May, 2024 +//o------------------------------------------------------------------------------------------------o +//| Purpose - Gets/Sets the Bonus hp on the object +//o------------------------------------------------------------------------------------------------o +SI16 CItem::GetDurabilityHpBonus(void) const +{ + return durabilityHpBonus; +} +void CItem::SetDurabilityHpBonus(SI16 newValue) +{ + durabilityHpBonus = newValue; + UpdateRegion(); +} + //o------------------------------------------------------------------------------------------------o //| Function - CItem::GetMaxItems() //| CItem::SetMaxItems() @@ -1655,6 +1673,7 @@ auto CItem::CopyData( CItem *target ) -> void target->SetSpawn( GetSpawn() ); target->SetSpeed( GetSpeed() ); target->SetArtifactRarity( GetArtifactRarity() ); + target->SetDurabilityHpBonus( GetDurabilityHpBonus() ); target->SetSpell( 0, GetSpell( 0 )); target->SetSpell( 1, GetSpell( 1 )); target->SetSpell( 2, GetSpell( 2 )); @@ -1755,6 +1774,7 @@ bool CItem::DumpBody( std::ostream &outStream ) const outStream << "MaxHP=" + std::to_string( GetMaxHP() ) + newLine; outStream << "Speed=" + std::to_string( GetSpeed() ) + newLine; outStream << "ArtifactRarity=" + std::to_string( GetArtifactRarity() ) + newLine; + outStream << "DurabilityHpBonus=" + std::to_string( GetDurabilityHpBonus() ) + newLine; outStream << "Movable=" + std::to_string( GetMovable() ) + newLine; outStream << "Priv=" + std::to_string( GetPriv() ) + newLine; outStream << "Value=" + std::to_string( GetBuyValue() ) + "," + std::to_string( GetSellValue() ) + "," + std::to_string( GetVendorPrice() ) + newLine; @@ -1877,6 +1897,11 @@ bool CItem::HandleLine( std::string &UTag, std::string &data ) SetDir( static_cast( std::stoi(oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 ))); rValue = true; } + else if( UTag == "DURABILITYHPBONUS" ) + { + SetDurabilityHpBonus( static_cast( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 ))); + rValue = true; + } else if( UTag == "DYEABLE" ) { SetDye( static_cast( std::stoul( oldstrutil::trim( oldstrutil::removeTrailing( data, "//" )), nullptr, 0 )) == 1 ); diff --git a/source/cItem.h b/source/cItem.h index 4b220999e..a9ae5bec6 100644 --- a/source/cItem.h +++ b/source/cItem.h @@ -49,6 +49,7 @@ class CItem : public CBaseObject SERIAL creator; // Store the serial of the player made this item SI08 gridLoc; SI16 artifactRarity; + SI16 durabilityHpBonus; 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 @@ -114,6 +115,9 @@ class CItem : public CBaseObject virtual SI16 GetArtifactRarity(void) const; virtual void SetArtifactRarity(SI16 newValue); + virtual SI16 GetDurabilityHpBonus(void) const; + virtual void SetDurabilityHpBonus(SI16 newValue); + auto GetStealable() const -> UI08; auto SetStealable( UI08 newValue ) -> void; diff --git a/source/items.cpp b/source/items.cpp index a95e80f70..d1ed78f7f 100644 --- a/source/items.cpp +++ b/source/items.cpp @@ -1194,6 +1194,13 @@ CItem * cItem::CreateBaseScriptItem( CItem *mCont, std::string ourItem, const UI Console.Error( "Trying to apply an item section failed" ); } + // If the durabilityhpbonus tag is on the item, it will add to its Durability (aka Health). + auto durabilityHpBonus = iCreated->GetDurabilityHpBonus(); + if( durabilityHpBonus > 0 ) + { + iCreated->SetHP( iCreated->GetHP() + durabilityHpBonus ); + } + // If maxHP has not been defined for a new item, set it to the same value as HP if( !iCreated->GetMaxHP() && iCreated->GetHP() ) { From c1f2a79973511b51993d01a19cde72775cdc3d75 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:33:31 -0600 Subject: [PATCH 05/14] fix --- source/items.cpp | 1 + source/ssection.h | 1 + 2 files changed, 2 insertions(+) diff --git a/source/items.cpp b/source/items.cpp index d1ed78f7f..e460d1944 100644 --- a/source/items.cpp +++ b/source/items.cpp @@ -118,6 +118,7 @@ auto ApplyItemSection( CItem *applyTo, CScriptSection *toApply, std::string sect Console.Warning( oldstrutil::format( "Invalid data found in AMOUNT tag inside item script [%s]", sectionId.c_str() )); } break; + case DFNTAG_DURABILITYHPBONUS: applyTo->SetDurabilityHpBonus( static_cast( ndata )); break; case DFNTAG_DAMAGE: case DFNTAG_ATT: if( ndata >= 0 ) diff --git a/source/ssection.h b/source/ssection.h index c652b9d3b..86be259dc 100644 --- a/source/ssection.h +++ b/source/ssection.h @@ -60,6 +60,7 @@ enum DFNTAGS DFNTAG_CREATOR, DFNTAG_CUSTOMSTRINGTAG, DFNTAG_CUSTOMINTTAG, + DFNTAG_DURABILITYHPBONUS, DFNTAG_DAMAGE, DFNTAG_DAMAGEABLE, DFNTAG_DECAY, From 21082cf4ebece06734566fa7d8f63b23fe9bee7d Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:35:32 -0600 Subject: [PATCH 06/14] Update ssection.cpp --- source/ssection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/ssection.cpp b/source/ssection.cpp index fae41e7a1..9cea48baf 100644 --- a/source/ssection.cpp +++ b/source/ssection.cpp @@ -65,6 +65,7 @@ const UI08 dfnDataTypes[DFNTAG_COUNTOFTAGS] = DFN_NODATA, // DFNTAG_DISPELLABLE, DFN_NUMERIC, // DFNTAG_DISABLED, DFN_NUMERIC, // DFNTAG_DOORFLAG, + DFN_NUMERIC, // DFNTAG_DURABILITYHPBONUS, DFN_NUMERIC, // DFNTAG_DYE, DFN_NUMERIC, // DFNTAG_DYEBEARD, DFN_NUMERIC, // DFNTAG_DYEHAIR, @@ -319,6 +320,7 @@ const std::map strToDFNTag {"DISPELLABLE"s, DFNTAG_DISPELLABLE}, {"DISABLED"s, DFNTAG_DISABLED}, {"DOORFLAG"s, DFNTAG_DOORFLAG}, + {"DURABILITYHPBONUS"s, DFNTAG_DURABILITYHPBONUS}, {"DYE"s, DFNTAG_DYE}, {"DYEABLE"s, DFNTAG_DYE}, {"DYEHAIR"s, DFNTAG_DYEHAIR}, From add5789e065504a138cac07ed8bda8f9d559b00a Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:37:08 -0600 Subject: [PATCH 07/14] Update items.cpp --- source/items.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/items.cpp b/source/items.cpp index e460d1944..1189d3dc5 100644 --- a/source/items.cpp +++ b/source/items.cpp @@ -1207,6 +1207,10 @@ CItem * cItem::CreateBaseScriptItem( CItem *mCont, std::string ourItem, const UI { iCreated->SetMaxHP( iCreated->GetHP() ); } + else + {// If you add a maxhp tag and have durabilityHpBonus, it will increase the Durability (aka Health). + iCreated->SetMaxHP( iCreated->GetMaxHP() + durabilityHpBonus ); + } // If maxUses is higher than usesLeft for a new item, randomize the amount of usesLeft the item should have! if( iCreated->GetMaxUses() > iCreated->GetUsesLeft() ) From 39cda622d2dff605de1db0397f208ad80ad5afb1 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Thu, 16 Jan 2025 21:50:00 -0600 Subject: [PATCH 08/14] Update Changelog.txt --- source/Changelog.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Changelog.txt b/source/Changelog.txt index 6793d7f87..cc2108ceb 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,10 +1,10 @@ +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 + 11/05/2024 - Dragon Slayer/Xuri/Maarc Added Support for new AOS property tag. -DURABILITYHPBONUS - Add durability (aka Health) to the hp and max hp as a bonus -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 - 09/05/2024 - Dragon Slayer Added ArtifactRarity AOS Property for items -ARTIFACTRARITY=# From c338f92f6a201ffb2824c67f4a337561ff9364dd Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Thu, 16 Jan 2025 22:09:54 -0600 Subject: [PATCH 09/14] Update cItem.h --- source/cItem.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/cItem.h b/source/cItem.h index a9ae5bec6..2f503918c 100644 --- a/source/cItem.h +++ b/source/cItem.h @@ -112,11 +112,11 @@ class CItem : public CBaseObject auto GetGridLocation() const -> SI08; auto SetGridLocation( SI08 newLoc ) -> void; - virtual SI16 GetArtifactRarity(void) const; - virtual void SetArtifactRarity(SI16 newValue); + SI16 GetArtifactRarity(void) const; + void SetArtifactRarity(SI16 newValue); - virtual SI16 GetDurabilityHpBonus(void) const; - virtual void SetDurabilityHpBonus(SI16 newValue); + SI16 GetDurabilityHpBonus(void) const; + void SetDurabilityHpBonus(SI16 newValue); auto GetStealable() const -> UI08; auto SetStealable( UI08 newValue ) -> void; From 1d2bab8889539ebd64285fd93ac1e26fd2306276 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Wed, 22 Jan 2025 09:28:03 -0600 Subject: [PATCH 10/14] Fixed Fixed what maarc was talking about also adjusted this to be percent. --- source/items.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/source/items.cpp b/source/items.cpp index 1189d3dc5..be0149117 100644 --- a/source/items.cpp +++ b/source/items.cpp @@ -1197,19 +1197,32 @@ CItem * cItem::CreateBaseScriptItem( CItem *mCont, std::string ourItem, const UI // If the durabilityhpbonus tag is on the item, it will add to its Durability (aka Health). auto durabilityHpBonus = iCreated->GetDurabilityHpBonus(); - if( durabilityHpBonus > 0 ) - { - iCreated->SetHP( iCreated->GetHP() + durabilityHpBonus ); - } // If maxHP has not been defined for a new item, set it to the same value as HP - if( !iCreated->GetMaxHP() && iCreated->GetHP() ) + if (!iCreated->GetMaxHP() && iCreated->GetHP()) { - iCreated->SetMaxHP( iCreated->GetHP() ); + iCreated->SetMaxHP(iCreated->GetHP()); } - else - {// If you add a maxhp tag and have durabilityHpBonus, it will increase the Durability (aka Health). - iCreated->SetMaxHP( iCreated->GetMaxHP() + durabilityHpBonus ); + + if( durabilityHpBonus > 0 ) + { + // Calculate percentage increase + auto baseHP = iCreated->GetHP(); + auto baseMaxHP = iCreated->GetMaxHP(); + + // If maxHP has not been defined, default it to HP + if( baseMaxHP == 0 && baseHP > 0 ) + { + baseMaxHP = baseHP; + iCreated->SetMaxHP( baseMaxHP ); + } + + // Apply the percentage bonus to HP and MaxHP + auto hpBonus = static_cast( baseHP * ( durabilityHpBonus / 100.0 )); + auto maxHpBonus = static_cast( baseMaxHP * ( durabilityHpBonus / 100.0 )); + + iCreated->SetHP( baseHP + hpBonus ); + iCreated->SetMaxHP( baseMaxHP + maxHpBonus ); } // If maxUses is higher than usesLeft for a new item, randomize the amount of usesLeft the item should have! From af8e398c066b14e7bf0dcf38d4d351de268eb89f Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Wed, 22 Jan 2025 09:44:41 -0600 Subject: [PATCH 11/14] Update Changelog.txt --- source/Changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/Changelog.txt b/source/Changelog.txt index f64afbc32..8a4b1d4da 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,3 +1,6 @@ +22/01/2025 - Dragon Slayer + Fixed Unequip memory management and Fixed spelling issue in js script. + 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. From a895f604c600fecbe8e71817ce598118867dbca5 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Fri, 24 Jan 2025 10:49:47 -0600 Subject: [PATCH 12/14] Update Changelog.txt --- source/Changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Changelog.txt b/source/Changelog.txt index cc2108ceb..dab54daf9 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -3,7 +3,8 @@ 11/05/2024 - Dragon Slayer/Xuri/Maarc Added Support for new AOS property tag. - -DURABILITYHPBONUS - Add durability (aka Health) to the hp and max hp as a bonus + -DURABILITYHPBONUS = # - Add durability (aka Health) at percentage multiplier to hp. + .durabilityhpbonus (js) 09/05/2024 - Dragon Slayer Added ArtifactRarity AOS Property for items From 5541dab3a2caded5d8937035e23d76e2e8b9a9c3 Mon Sep 17 00:00:00 2001 From: Dragon Slayer <85514184+DragonSlayer62@users.noreply.github.com> Date: Tue, 28 Jan 2025 20:05:53 -0600 Subject: [PATCH 13/14] Fixed Tabs --- source/cChar.cpp | 68 ++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/source/cChar.cpp b/source/cChar.cpp index 90bd2bcd0..e59bb52ab 100644 --- a/source/cChar.cpp +++ b/source/cChar.cpp @@ -2924,24 +2924,24 @@ bool CChar::WearItem( CItem *toWear ) } scriptTriggers.clear(); - scriptTriggers.shrink_to_fit(); - scriptTriggers = this->GetScriptTriggers(); - for( auto i : scriptTriggers ) - { - cScript *tScript = JSMapping->GetScript( i ); - if( tScript != nullptr ) - { - // If script returns false, prevent item from being equipped - if( tScript->OnEquipAttempt( this, toWear ) == 0 ) - { - CSocket *mSock = this->GetSocket(); - if( mSock != nullptr ) - { - Bounce( mSock, toWear ); - } - return false; - } - } + scriptTriggers.shrink_to_fit(); + scriptTriggers = this->GetScriptTriggers(); + for( auto i : scriptTriggers ) + { + cScript *tScript = JSMapping->GetScript( i ); + if( tScript != nullptr ) + { + // If script returns false, prevent item from being equipped + if( tScript->OnEquipAttempt( this, toWear ) == 0 ) + { + CSocket *mSock = this->GetSocket(); + if( mSock != nullptr ) + { + Bounce( mSock, toWear ); + } + return false; + } + } } bool rValue = true; @@ -2970,7 +2970,7 @@ bool CChar::WearItem( CItem *toWear ) IncStaminaLeech( itemLayers[tLayer]->GetStaminaLeech() ); IncManaLeech( itemLayers[tLayer]->GetManaLeech() ); - IncHitChance( itemLayers[tLayer]->GetHitChance() ); + IncHitChance( itemLayers[tLayer]->GetHitChance() ); IncDefenseChance( itemLayers[tLayer]->GetDefenseChance() ); IncHealthBonus( itemLayers[tLayer]->GetHealthBonus() ); @@ -3030,20 +3030,20 @@ bool CChar::TakeOffItem( ItemLayers Layer ) } scriptTriggers.clear(); - scriptTriggers.shrink_to_fit(); - scriptTriggers = this->GetScriptTriggers(); - for( auto i : scriptTriggers ) - { - cScript *tScript = JSMapping->GetScript( i ); - if( tScript != nullptr ) - { - // If script returns false, prevent item from being equipped - if( tScript->OnUnequipAttempt( this, itemLayers[Layer] ) == 0 ) - { - return false; - } - } - } + scriptTriggers.shrink_to_fit(); + scriptTriggers = this->GetScriptTriggers(); + for( auto i : scriptTriggers ) + { + cScript *tScript = JSMapping->GetScript( i ); + if( tScript != nullptr ) + { + // If script returns false, prevent item from being equipped + if( tScript->OnUnequipAttempt( this, itemLayers[Layer] ) == 0 ) + { + return false; + } + } + } if( Layer == IL_PACKITEM ) // It's our pack! { @@ -3055,7 +3055,7 @@ bool CChar::TakeOffItem( ItemLayers Layer ) IncSwingSpeedIncrease( -itemLayers[Layer]->GetSwingSpeedIncrease() ); - IncHealthLeech( -itemLayers[Layer]->GetHealthLeech() ); + IncHealthLeech( -itemLayers[Layer]->GetHealthLeech() ); IncStaminaLeech( -itemLayers[Layer]->GetStaminaLeech() ); IncManaLeech( -itemLayers[Layer]->GetManaLeech() ); From 332de62fbedfcd59e3ac0828a8c7dd5876bbde03 Mon Sep 17 00:00:00 2001 From: Geir Ove Alnes Date: Wed, 29 Jan 2025 16:04:17 +0800 Subject: [PATCH 14/14] Update Changelog.txt --- source/Changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Changelog.txt b/source/Changelog.txt index af2e97c4c..cb849397d 100644 --- a/source/Changelog.txt +++ b/source/Changelog.txt @@ -1,5 +1,6 @@ 22/01/2025 - Dragon Slayer - Fixed Unequip memory management and Fixed spelling issue in js script. + Fixed an issue that prevented onUnequip JS event from triggering on items being unequipped + Minor cleanup of skill_boosting_equipment.js script 21/01/2025 - Dragon Slayer Fixed damage dealt in combat was incorrectly modified while applying defense modifiers. (combat.cpp)