ModernUO/Projects/UOContent/Spells
Kamron Batman a4cabe2fa4
fix: Optimizes FindItemsByType by removing allocations. (#1515)
### Summary
Container enumeration is in dire need of optimization. Thanks to @stefanomerotta for initiating this work with PR #1443. This PR handles a small part of what Stefan started. Also included are some bug fixes.

### Method Signatures

```cs
// Use with foreach without moving/deleting items
FindItemsByTypeEnumerator<T> FindItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)

// Use with foreach when moving/deleting items
QueuedItemsEnumerator<T> EnumerateItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)

// Use when iterating multiple times or queuing
PooledRefQueue<T> QueueItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)

// Use when iterating multiples times or manipulating elements without traversing
PooledRefList<T> ListItemsByType<T>(bool recurse = true, Predicate<T> predicate = null)
```

* `FindItemsByType<T>` has changed from returning `List<T>` to `FindItemsByTypeEnumerator<T>` - This method is not safe to use in situations where an item may get consumed, deleted, or moved.

* `EnumerateItemsByType<T>` was added as a safe way to iterate and manipulate items.
  * **Note**: EnumerateItemsByType will _completely traverse the container_ before iteration starts because it uses `QueueItemsByType` under the hood.

* `QueueItemsByType<T>`  and `ListItemsByType<T>` was added to return a queue or list of items to iterate multiple times and manipulate the items. This isn't the most efficient since it uses a predicate and can result in 2 or 3 total iterations unnecessarily.

### Bug Fixes
- [X] Fishing had an error in the random check that may have caused slight bias.
2023-09-28 19:36:45 -07:00
..
Base fix: Optimizes redundant spell damage logic 2023-09-27 13:24:46 -07:00
Bushido fix: Fixes buff icons for confidence, honorable excution, and divine fury (#1291) 2022-12-04 13:52:44 -08:00
Chivalry fix: Renames WeightOverloading to StaminaSystem (#1495) 2023-09-06 18:58:45 -07:00
Eighth fix: Fixes disarm, strangle, curse, summons, looting rights, creatures attacking, and items going to the floor (#1174) 2022-09-27 22:19:15 -07:00
Fifth fix: Updates disguises and codegens tinkering items (#1353) 2023-02-25 12:01:06 -08:00
First fix: Fixes crafter deserialize, cleans up bandages, and codegens misc items (#1350) 2023-02-25 00:54:12 -08:00
Fourth fix: Renames WeightOverloading to StaminaSystem (#1495) 2023-09-06 18:58:45 -07:00
Gargoyle/SpellDefinitions fix: Cleans up more spells (#1122) 2022-07-16 23:15:45 -07:00
Mysticism fix: Adds name support for all mods (#1128) 2022-10-15 10:46:31 -07:00
Necromancy fix: Renames WeightOverloading to StaminaSystem (#1495) 2023-09-06 18:58:45 -07:00
Ninjitsu fix: Renames WeightOverloading to StaminaSystem (#1495) 2023-09-06 18:58:45 -07:00
Second fix: Adds name support for all mods (#1128) 2022-10-15 10:46:31 -07:00
Seventh fix: Optimizes FindItemsByType by removing allocations. (#1515) 2023-09-28 19:36:45 -07:00
Sixth fix: Explosion doesn't properly cleanup if mobile fails harmful check (#1412) 2023-06-17 19:42:46 -07:00
Spellweaving fix: Optimizes TextDefinition to eliminate allocations. Removes TextDefinition ctor. (#1221) 2022-10-30 16:53:23 -07:00
Targeting fix: Cleans up some comments and spell code (#1120) 2022-07-16 19:45:41 -07:00
Third fix: Renames WeightOverloading to StaminaSystem (#1495) 2023-09-06 18:58:45 -07:00
Initializer.cs fix: Adds Cleansing Winds Spell (#1126) 2022-07-17 07:49:55 -07:00
Reagent.cs Formats UO Content (#201) 2020-08-27 18:30:38 -07:00
UnsummonTimer.cs fix: Codegens talismans - Fixes memory leak (#1469) 2023-08-23 22:41:48 -07:00