Commit graph

2842 commits

Author SHA1 Message Date
Kamron Batman
4aa272d429
feat: Adds an Item/Mobile memory leak detector. Fixes minor leak in doors. (#2159)
### Summary

Adds the command [TrackLeaks to enable tracking item/mobiles that have been deleted but still have dangling references. Requires adding the _TRACK_LEAKS_ define constant during build.
2025-04-15 19:14:45 -07:00
Kamron Batman
1e349f4369
fix: Fixes mutate speech character limit (#2157)
### Summary

* Fixes the accidental limitation of dead character speech (OoOo) to 256 characters.
* Optimizes it by 1.5x

```cs
| Method                  | Mean      | Error    | StdDev   | Allocated |
|------------------------ |----------:|---------:|---------:|----------:|
| ManuaLoopMutation       | 147.01 ns | 1.298 ns | 1.084 ns |         - |
| SpanLoopMutation        |  92.03 ns | 0.583 ns | 0.487 ns |         - |
```
2025-04-13 22:55:44 -07:00
Kamron Batman
61d074213b
chore(deps): Updates MailKit to 4.11.0 and Microsoft deps to 9.0.4 (#2156) 2025-04-12 12:54:40 -07:00
Kamron Batman
5a23d9f6f8
fix: Fixes an edge case in GetString that can cause a crash while parsing (#2155) 2025-04-12 12:52:10 -07:00
Kamron Batman
872de8d095
fix: Optimizes GetString to eliminate allocations (#2154)
### Summary

* Optimized GetString by eliminating the intermediate string allocation.

** Note **: Encoding.GetChars() is still really inefficient, especially when strings are not aligned or have regular ascii/unicode characters. Thankfully we generally don't have to worry about these odd edge cases, but if they happen then GetChars can allocate hundreds of bytes.


This is a benchmark for just the related changes. NonSpecial are just ascii characters, while the other tests include control codes.
```cs
| Method                         | Mean     | Error   | StdDev  | Gen0   | Allocated |
|------------------------------- |---------:|--------:|--------:|-------:|----------:|
| GetString                      | 306.7 ns | 5.96 ns | 6.86 ns | 0.0124 |     200 B |
| GetStringNotSpecial            | 257.0 ns | 4.83 ns | 4.52 ns | 0.0114 |     184 B |
| GetStringSpanHelpers           | 166.4 ns | 3.26 ns | 3.48 ns |      - |         - |
| GetStringSpanHelpersNotSpecial | 137.3 ns | 1.57 ns | 1.22 ns |      - |         - |
```
2025-04-12 12:42:15 -07:00
Kamron Batman
a94814a7ef
fix: Fixes and optimizes NameVerification and ProfanityProtection (#2153)
### Summary

Significantly improves the performance of NameVerification & ProfanityProtection:

```cs
| Method         | Mean      | Error     | StdDev    |
|--------------- |----------:|----------:|----------:|
| ValidateName   | 728.34 ns | 13.244 ns | 11.059 ns |
| ValidateNameSV |  26.62 ns |  0.233 ns |  0.207 ns |
```
2025-04-12 02:26:10 -07:00
Kamron Batman
0ce2a62a76
fix: Use vectorized search for username-password validation. (#2152)
### Summary

Optimizes account validation:

```cs
| Method              | Mean       | Error     | StdDev    |
|-------------------- |-----------:|----------:|----------:|
| ForLoopUsernameSafe | 158.536 ns | 1.6247 ns | 1.5198 ns |
| SVUsernameSafe      |   2.859 ns | 0.0581 ns | 0.0796 ns |
```
2025-04-11 22:40:06 -07:00
Kamron Batman
fdf8c5cf23
fix: Fixes critical bug in TickCount calculation. (#2151)
### Summary

On some operating systems (like hosted Linux VMs), the `TimeStamp.GetTimeStamp()` CPU tick count will wrap around. This is generally not an issue, except for legacy reasons the TickCount is returned in milliseconds instead of ticks. This means when the values wrap around, they are already divided by the CPU Frequency (usually 1million) and then converted to milliseconds. That means the delta between the tick count before and after wrapping is off by a magnitude of (Frequency / 1000).

Example:

TimeStamp A = 9223372036654775807
Some time has passed:
TimeStamp B = -9223372036654775809

The raw delta is 400_000_000 (400ms) when you do `unchecked(A - B)`.
If we do the calculation AFTER converting it to milliseconds, then:

TickCount A = 9223372036654
TickCount B = -9223372036654

The raw delta is -18446744073308 instead of 400_000_000.

To fix this the calculation was changed so `long` -> `ulong`, then divided, then converted back to `long`, effectively bypassing wrap-around issue.

The new TickCount values in our example become:

TickCount A = 9223372037054
TickCount B = 9223372036654

The delta is 400 (in milliseconds). 🎉
2025-04-09 16:46:53 -07:00
Kamron Batman
0a4579f298
fix: Fixes duping bags (#2148)
### Summary

Fixes duping items in a container not working properly.
2025-04-07 22:27:41 -07:00
Kamron Batman
2c6f1854fa
fix: Fixes guards attacking mobs (#2145)
### Summary

- Fixes infinite teleport from guard refactor for spawners
- Fixes guards not attacking Always Murderer creatures
- Fixes crash when calling guards due to map modification while enumeration
2025-03-12 16:45:39 -07:00
Kamron Batman
47da961a37
fix: Fixes spawning guards. Adds back non-lethal with config (#2140) 2025-03-12 13:08:14 -07:00
mark1145
0024d53739
fix: Fixes edge cases where a leader resigns and becomes promoted in their new guild. (#2136) 2025-03-05 17:59:07 -08:00
Kamron Batman
56e3086ed1
fix: Makes hairdye gump static (#2138) 2025-03-04 15:55:05 -08:00
Kamron Batman
ad361001c5
fix: Fixes CUO connecting with new TCP Peek Filtering (#2137) 2025-03-04 11:00:20 -08:00
Kamron Batman
49fd5f210d
fix: Fixes removing virtue when player is deleted (#2135) 2025-03-02 17:50:18 -08:00
Kamron Batman
2a8c62e8be
fix: Fixes TCPServer accept async, makes Firewall/IP Limiter multithreaded (#2134) 2025-02-27 22:19:38 -08:00
Kamron Batman
bcab91255a
fix: Fixes EVs/BSs attacking players in Pre-AOS (#2132) 2025-02-26 18:43:49 -08:00
Voxpire
b8a8bfd1a9
fix: Fixes console clobbering when prompted to add an owner account (#2133)
### Summary
- Updates AccountPrompt to use `logger` to avoid console clobbering

### Screenshot
![image](https://github.com/user-attachments/assets/8bfbaccc-3c23-4d05-ab49-a656e6a8803f)
2025-02-26 18:43:20 -08:00
Kamron Batman
0265e0673a
fix: Fixes empty spellbooks with EA client on Pre-AOS (#2131) 2025-02-25 20:46:20 -08:00
Kamron Batman
9b361822f3
fix: Fixes issue with delete all of missing type on deserialize (#2129) 2025-02-19 15:36:29 -08:00
Kamron Batman
d10b32aed3
fix: Fixes dead plant serialization (#2128) 2025-02-19 15:23:49 -08:00
Kamron Batman
525112943c
fix: Changes Chyloth gump to static (#2126) 2025-02-14 00:18:38 -08:00
Kamron Batman
2e08eda8cb
feat: Standardizes South/East selection gumps (#1839) 2025-02-14 00:15:14 -08:00
Kamron Batman
279b10dd0f
feat: Replaces params array with params ReadOnlySpan (#2125) 2025-02-13 21:19:02 -08:00
Kamron Batman
90059c5e74
feat: Adds convenience methods to GumpStringsBuilder (#2124) 2025-02-13 19:58:46 -08:00
Kamron Batman
6d7b1b8bee
fix: Adds missing string interpolation handler for SetStringSlot (#2123) 2025-02-13 19:30:47 -08:00
Kamron Batman
899146dcb7
fix: Fixes static gumps sending too much data. (#2122) 2025-02-13 19:12:28 -08:00
Kamron Batman
3cf1bd0f7d
fix: Fixes AddLabelPlaceholder on StaticGump (#2121) 2025-02-13 18:53:24 -08:00
Kamron Batman
41e909cd22
fix: Fixes serialization generator issue with arrays (#2120) 2025-02-12 22:30:46 -08:00
Kamron Batman
af027cdac6
Bumps dependencies. Fixes bugs with serialization generator (#2119) 2025-02-12 20:50:28 -08:00
Kamron Batman
2d0957119e
feat: Adds BaseGump.GetGumpOffsetForItemGraphic (#2116) 2025-02-10 19:53:47 -08:00
Kamron Batman
40479c946a
feat: Adds item graphic size to Bounds.bin and makes item graphic offset available to gumps (#2115) 2025-02-10 19:31:39 -08:00
Bohica
772511d1e8
fix: Reverts GetProtOffset, Adds PreT2A Weapon Damage & PreUOR Armor Durability (#2114) 2025-02-06 01:27:40 -08:00
Bohica
51367df0d2
fix: Fixes AR/Durability/Tool Uses for Pre-UOR and LBR (#2113) 2025-02-05 19:54:56 -08:00
Kamron Batman
d407847fc4
fix: Fixes axes not working when equipped or in backpack (#2112) 2025-02-04 22:11:29 -08:00
uogem
b83c52a7b1
fix: Spawned items should only decay after unlinked from spawner (#2109) 2025-02-04 16:14:56 -08:00
Bohica
1c5fa824d6
fix: Fixes all summon spells so they use summoned variation of monster (#2106) 2025-02-03 23:44:51 -08:00
Bohica
de12f8cb02
fix: Fixes turning to target on spellcast (#2107) 2025-02-03 17:38:07 -08:00
Kamron Batman
2c806cb072
fix: Converts house placement gumps to dynamic (#2100) 2025-02-02 13:25:05 -08:00
Kamron Batman
e64a632998
fix: Moves snapshot request synchronously (#2105) 2025-02-02 13:07:28 -08:00
Kamron Batman
717a1a062e
fix: Fixes race condition with world save snapshot request (#2104)
### Summary

* Fixes a race condition where the snapshot path isn't between the request snapshot being set on a background thread, and the main loop consuming that flag.


Closes #2102
2025-02-02 12:05:40 -08:00
Kamron Batman
019672b026
fix: Fixes cannot see that issue with Map LOS Refactor. (#2103) 2025-02-02 11:38:10 -08:00
Kamron Batman
1264302ee0
fix: Converts barkeep and house foundation commit gumps to dynamic (#2099) 2025-01-27 21:36:56 -08:00
Kamron Batman
cbae44ef20
fix: Updates SummonFamiliar & Tracking gumps to static (#2098) 2025-01-27 17:57:25 -08:00
Kamron Batman
ed87df1a61
fix: Converts bedroll/insurance gumps to static. (#2096) 2025-01-27 14:00:32 -08:00
Kamron Batman
b5e3f49d06
fix: Converts MakersMark gump to static & CraftGumpItem to dynamic (#2095) 2025-01-27 11:29:23 -08:00
Kamron Batman
6d879e1d22
feat: Simplifies honorable execution (#2089) 2025-01-26 23:05:54 -08:00
mark1145
c0eb6c81fe
fix: Fixes door monster LOS exploit & AOS House Gump NPE (#2091) 2025-01-26 23:04:01 -08:00
Kamron Batman
f241a9dec0
fix: Fixes the wrong unit used for BuffIcon Timers (#2093) 2025-01-26 22:17:03 -08:00
Kamron Batman
ea364237f0
fix: Fix crash from not enough fish to kill in Aquarium (#2092) 2025-01-25 18:45:20 -08:00