From 286cb20c3ce499d8087ae5f52db8094bcf7858e4 Mon Sep 17 00:00:00 2001 From: Jorteck Date: Sat, 13 Aug 2022 22:40:33 +0200 Subject: [PATCH 1/2] Update changelog. --- CHANGELOG.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1fb1e1eb..60edc3614 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,19 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased -https://github.com/nwn-dotnet/Anvil/compare/v8193.34.13...HEAD +https://github.com/nwn-dotnet/Anvil/compare/v8193.34.14...HEAD ### Added -- NuiText: Added `Border` and `Scrollbars` properties. -- ItemProperty: Added properties for referencing 2da data. -- ItemProperty: Added Create() factory method overload using the new table class types. -- NwGameTables: Added `ItemPropertyTable`, `ItemPropertyItemMapTable`, `ItemPropertyCostTables`, `ItemPropertyParamTables` +- N/A ### Package Updates - N/A ### Changed -- **BREAKING CHANGE:** TwoDimArrays must now be initialized via `NwGameTables.GetTable`. +- N/A ### Deprecated - N/A @@ -24,6 +21,21 @@ https://github.com/nwn-dotnet/Anvil/compare/v8193.34.13...HEAD ### Removed - N/A +### Fixed +- N/A + +## 8193.34.14 +https://github.com/nwn-dotnet/Anvil/compare/v8193.34.13...v8193.34.14 + +### Added +- NuiText: Added `Border` and `Scrollbars` properties. +- ItemProperty: Added properties for referencing 2da data. +- ItemProperty: Added Create() factory method overload using the new table class types. +- NwGameTables: Added `ItemPropertyTable`, `ItemPropertyItemMapTable`, `ItemPropertyCostTables`, `ItemPropertyParamTables` + +### Changed +- **BREAKING CHANGE:** TwoDimArrays must now be initialized via `NwGameTables.GetTable`. + ### Fixed - Fixed a server crash when using TwoDimArray after the native array structure was evicted from the 2da cache. - Fixed updating the weight of a equipped item with `NwItem.Weight` not correctly updating creature weight and encumbrance. From 70d98ab8e0c913020fed472290125e95e783de98 Mon Sep 17 00:00:00 2001 From: Jorteck Date: Sat, 13 Aug 2022 23:13:57 +0200 Subject: [PATCH 2/2] ItemProperty: Fix off-by-one error for valid item lookup, expose SubTypeTable (#546) * Fix off-by-one error for valid item lookup. * Add ItemProperty.SubTypeTable. * Update changelog. * Fix analysis errors. --- CHANGELOG.md | 4 ++-- NWN.Anvil/src/main/API/EngineStructure/ItemProperty.cs | 5 +++++ .../API/TwoDimArray/Tables/ItemPropertyItemMapTableEntry.cs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60edc3614..af3d7eb03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). https://github.com/nwn-dotnet/Anvil/compare/v8193.34.14...HEAD ### Added -- N/A +- ItemProperty: Added `SubTypeTable`. ### Package Updates - N/A @@ -22,7 +22,7 @@ https://github.com/nwn-dotnet/Anvil/compare/v8193.34.14...HEAD - N/A ### Fixed -- N/A +- Fixed `CalculateValidItemsForProperty` returning false for base items using column 0. ## 8193.34.14 https://github.com/nwn-dotnet/Anvil/compare/v8193.34.13...v8193.34.14 diff --git a/NWN.Anvil/src/main/API/EngineStructure/ItemProperty.cs b/NWN.Anvil/src/main/API/EngineStructure/ItemProperty.cs index 72a39396c..a91002b8b 100644 --- a/NWN.Anvil/src/main/API/EngineStructure/ItemProperty.cs +++ b/NWN.Anvil/src/main/API/EngineStructure/ItemProperty.cs @@ -103,6 +103,11 @@ public ItemPropertyParamTableEntry? Param1TableValue /// public TimeSpan RemainingDuration => TimeSpan.FromSeconds(NWScript.GetItemPropertyDurationRemaining(this)); + /// + /// Gets the sub type table used by this item property. + /// + public TwoDimArray? SubTypeTable => Property.SubTypeTable; + /// /// Gets or sets the sub type that is set on this item property. /// diff --git a/NWN.Anvil/src/main/API/TwoDimArray/Tables/ItemPropertyItemMapTableEntry.cs b/NWN.Anvil/src/main/API/TwoDimArray/Tables/ItemPropertyItemMapTableEntry.cs index ef2e14dfd..3789a4331 100644 --- a/NWN.Anvil/src/main/API/TwoDimArray/Tables/ItemPropertyItemMapTableEntry.cs +++ b/NWN.Anvil/src/main/API/TwoDimArray/Tables/ItemPropertyItemMapTableEntry.cs @@ -64,7 +64,7 @@ private IReadOnlyDictionary CalculateValidItemsForProperty(Two Dictionary retVal = new Dictionary(); foreach (NwBaseItem item in NwRuleset.BaseItems) { - if (item.ItemPropertyColumnId > 0 && item.ItemPropertyColumnId < isValid.Length) + if (item.ItemPropertyColumnId < isValid.Length) { retVal[item] = isValid[item.ItemPropertyColumnId]; }