ModernUO/Projects/UOContent/Engines
Kamron Batman ecbee17690
fix: Optimizes OPL using string interpolation (#1041)
## Breaking Changes (New API)
ObjectPropertyList supports the following API:
```cs
list.Add(500000);
list.Add(500001, stringArgument);
list.Add("Some text");
list.Add($"Some text with {argument}");
list.Add(500002, $"{arg1}\t{arg2}");
```

## Notes
1. All API uses that require a formatter like this:
    ```cs
    list.Add(500002, "{0}\t{1}", arg1, arg2);
    ```
    Should be changed to use string interpolation, for example:
    ```cs
    list.Add(500002, $"{arg1}\t{arg2}");
    ```
2. The following paradigm should no longer be used:
    ```cs
    list.Add(1061170, prop.ToString()); // strength requirement ~1_val~
    ```
    The new string interpolation API will avoid having to convert the argument to a string before writing it to the packet. Instead use the following:
    ```cs
    list.Add(1061170, $"{prop}"); // strength requirement ~1_val~
    ```

### Benchmarks
```cs
|                         Method |     Mean |   Error |  StdDev |  Gen 0 | Allocated |
|------------------------------- |---------:|--------:|--------:|-------:|----------:|
|                BenchmarkOldOPL | 241.0 ns | 0.56 ns | 0.47 ns | 0.0105 |      88 B |
| BenchmarkStringInterpolatedOPL | 199.9 ns | 2.44 ns | 2.39 ns |      - |         - |
```

### Changes
- [X] Removes crash in STArray.Return when array is null.
- [X] Fixes NPE in OPL when entity is null. Serial in packet will be 0 when entity is null.
- [X] Fixes NPE in AosAttributes when Parent is null.
- [X] Changes OPL to use string interpolation.
- [X] Introduces `IPropertyList` to allow extending PropertyList for other uses.
2022-06-02 10:09:53 -07:00
..
Bulk Orders fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
CannedEvil fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Chat fix: Fixes packet length checks (#953) 2022-03-04 12:32:25 -08:00
ConPVP fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Craft fix: Adds more null checks for text definition to prevent NPEs (#936) 2022-02-18 11:13:38 -08:00
Doom fix: Fixes TextDefinition and optimizes CraftItem (#930) 2022-02-12 22:42:50 -08:00
Ethics fix: Fixes ValueStringBuilder empty ctor issue (#1035) 2022-05-27 17:49:36 -07:00
Events fix(core): Caches DateTime.NowUtc (#548) 2021-03-13 01:32:04 -08:00
Factions fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Harvest fix: Stops creating blocked packets entirely (#944) 2022-02-27 00:13:49 -08:00
Help fix: Stops creating blocked packets entirely (#944) 2022-02-27 00:13:49 -08:00
Khaldun fix: Codegens lockable containers and cleans up lockpickable (#976) 2022-03-26 21:48:18 -07:00
ML Quests fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Party fix: Stops creating blocked packets entirely (#944) 2022-02-27 00:13:49 -08:00
Pathing fix: Fixes bad movement checks (#960) 2022-03-15 19:39:52 -07:00
Plants fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Quests fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Spawners fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Stealables fix: Fixes factions and makes it static (#993) 2022-05-10 11:57:37 -07:00
Treasures of Tokuno fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
UltimaStore fix: Fixes packet length checks (#953) 2022-03-04 12:32:25 -08:00
Veteran Rewards fix: Optimizes OPL using string interpolation (#1041) 2022-06-02 10:09:53 -07:00
Virtues chore: Cleans up pattern checks. (#892) 2021-12-24 15:53:59 -08:00