Commit graph

1427 commits

Author SHA1 Message Date
Kamron Batman
0b9fb9c071
fix(core): Cleans up OPL code (#396)
- [X] Cleans up OPL code to simplify the calls
2021-01-09 11:56:05 -08:00
Kamron Batman
5882b1ab3f
fix(core): Fixes OPL packets (#395)
- [X] Fixes an issue with OPL packets using the wrong endianness and not updating the position properly.
- [X] Fixes an issue with SpanWriter not updating bytes written when it is used adhoc.
- [X] Moves packet creation for OPL inside the SendInfoTo function.

Bumps release version
2021-01-08 23:55:23 -08:00
Kamron Batman
1a593089e9
chore: Updates discord links (#394) 2021-01-07 01:04:05 -08:00
Kamron Batman
6428f02dc1
chore: Updates 3rd party notices (#393) 2021-01-07 00:58:34 -08:00
Kamron Batman
7531b58ae2
fix(network): Adds protocol extensions (#392)
- [X] Adds protocol extensions for CUO
2021-01-07 00:03:12 -08:00
Kamron Batman
1006352333
fix(core): Disables new movement and time sync (#391)
Bumps release version
2021-01-06 22:40:07 -08:00
Kamron Batman
dfe89024ca
Makes gump code a little more readable (#390)
- [X] Adds a WriteAscii for individual characters
- [X] Updates gump code to use it so it is a little more readable
2021-01-06 01:17:34 -08:00
Kamron Batman
03bdff2293
fix(content): Converts buff icon packets (#389)
- [X] Converts buff icon packets, and avoids string formatting.
2021-01-06 01:01:21 -08:00
Kamron Batman
0912876f7c
fix(core): Converts virtual hair packets (#388)
- [X] Converts virtual hair packets
2021-01-05 22:14:54 -08:00
Kamron Batman
30ef0761cb
chore(core): Cleans up networking leftovers from packet conversions (#387)
- [X] Removes span writing extensions
- [X] Removes span reading extensions
- [X] Cleans up OPL and uses uninitialized arrays

Bumps release version
2021-01-05 01:31:52 -08:00
Kamron Batman
a278623f38
fix(core): Converts Gump Packets (v1) (#379)
- [X] Converts gump packets
2021-01-05 01:17:34 -08:00
Kamron Batman
126b80f74b
fix(core): Cleans up networking (#386)
- [X] Deletes some unused networking code.
2021-01-05 00:41:22 -08:00
Kamron Batman
3dd0d8f42b
fix(core): Converts the rest of the packets (#385)
- [X] Converts vendor buy packets
- [X] Converts vendor sell packets
- [X] Converts target packets
- [X] Converts secure trade packets
- [X] Converts some player packets that were missed
2021-01-05 00:35:56 -08:00
Kamron Batman
ffc26459ff
fix(core): Converts message, mobile, movement, player packets (#384)
- [X] Converts message packets
- [X] Convers mobile packets
- [X] Converts movement packets
- [X] Converts player packets
2021-01-04 23:47:20 -08:00
Kamron Batman
353b46fbbd
fix(core): Converts more packets (#383)
- [X] Converts damage packets
- [X] Converts effect packets
- [X] Converts equipment packets
- [X] Converts gump packets
- [X] Converts light packets
- [X] Converts map packets
- [X] Converts menu packets
2021-01-04 23:11:43 -08:00
Kamron Batman
75c0527284
fix(core): Converts combat and container packets (#382)
- [X] Converts container packets
- [X] Converts combat packets
2021-01-04 21:17:39 -08:00
Kamron Batman
ac76c57c39
fix(core): Converts account packets to spanwriter (#381)
- [X] Converts account packets to spanwriter
2021-01-04 18:47:20 -08:00
Kamron Batman
3b413371dc
fix(core): Adds Gump component functionality (#377)
- [X] Adds gump close packet
- [X] Fixes gump tooltip
- [X] Adds new compile/append functions for the new gump packets
2021-01-02 19:08:35 -08:00
Kamron Batman
cc91fe2b10
Fixes random NPEs (#378) 2021-01-01 02:16:23 -08:00
Kamron Batman
582e1877b8
feat(core): Makes spanwriter resizable (#376)
SpanWriter now has an argument that allows it to be resizable.
```cs
public SpanWriter(Span<byte> initialBuffer, bool resize = false)
public SpanWriter(int initialCapacity, bool resize = false)
```

If a SpanWriter is set to be resizable, or given an initial capacity instead of a buffer, it must be disposed:
```cs
public static void SomeMethod()
{
    using var writer = new SpanWriter(stackalloc byte[512], true);
    // stuff
    
    // Automatic Dispose of writer
}
```

This is because the SpanWriter uses `ArrayPool<byte>.Shared` _rented buffers_ to resize. If the writer is not disposed, those buffers will never be reused resulting in a _memory leak_.

It is possible that the SpanWriter will outright ditch the initial buffer if resize is set to true and growing is needed. To check/account for that we can do the following:

```cs
public static void SomeMethod()
{
    Span<byte> span = stackalloc byte[512];
    using var writer = new SpanWriter(span, true);
    // write some stuff that causes the span to grow
    
    span = writer.RawBuffer;
    // Do stuff with the span
}
```

Make sure you don't accidentally `Dispose()` the writer or use the `RawBuffer` outside of the `using` block. If you do, bad things will happen! (NullPointerException, or a fresh SpanWriter with no buffer, depending on the situation).

SpanWriter can also now be used with a fixed statement since it has a `PinnableReference()` function.
2020-12-31 19:57:02 -08:00
Kamron Batman
2a2af424ad
fix(core): Converts vendor sell packets (#375)
- [X] Converts vendor sell packets

Bumps release version
2020-12-30 16:27:37 -08:00
Kamron Batman
540a879d63
fix(core): Converts remaining player packets (#374)
- [X] Converts the remainder of the player packets
2020-12-30 16:09:51 -08:00
Kamron Batman
1e2242bb1a
chore(content): Updates to C# 9 syntax (#373) 2020-12-30 12:50:10 -08:00
Kamron Batman
a59fda6a3a
fix(core): Converts some player packets (#372)
- [X] Converts some player packets

Note:
- Not caching weather packet because it is copying directly from stackalloc using aggressive inlining. Don't need to do more optimizations.
2020-12-29 23:47:56 -08:00
Kamron Batman
67c23bf9ad
fix(AI): Fixes direction issue with NPCs (#371)
- [X] Fixes a bug with RunUO where direction is set multiple times and the run flag is not set properly.

TODO: Fix other direction/movement issues and duplicate packets.

Bumps release version
2020-12-29 22:32:10 -08:00
Kamron Batman
7ef1d41c6f
fix(core): Converts mobile incoming packet (#370)
- [X] Converts mobile incoming packet

Bumps release version
2020-12-28 02:30:47 -08:00
Kamron Batman
9d4161b3e4
fix(core): Converts MobileUpdate packet (#369)
- [X] Converts mobile update packet
2020-12-28 01:50:17 -08:00
Kamron Batman
3d98e6e193
fix(core): Converts mobile status packets (#368)
- [X] Combines compact/extended statuses
2020-12-28 01:13:02 -08:00
Kamron Batman
8f8b650ab5
fix(core): Converts healthbar packets (#367)
- [X] Converts healthbar packets
2020-12-27 23:22:21 -08:00
Kamron Batman
26243a72a7
fix(core): Converts mobile name and animation packets (#366)
- [X] Converts mobile name
- [X] Converts animation
- [X] Updates some old tests
2020-12-27 19:57:38 -08:00
Kamron Batman
5b69f1d389
fix(core): Converts mobile stats packets (#360)
- [X] Converts mobile stats packets
- [X] Removes human racial from non-players
2020-12-27 14:44:03 -08:00
Kamron Batman
d73afdba8e
feat(core): Adds CPU conservation (#364) 2020-12-26 13:53:43 -08:00
Kamron Batman
03d0a4664e
fix(core): Adds SkipLocalsInitAttribute support, optimizes broadcasted packets (#363)
- [X] Adds support for `SkipLocalsInitAttribute`. SkipLocalsInitAttribute skips initializing stack variables including `stackalloc`. I don't think it is wired/working yet but should be implemented soon.
- [X] Optimizes broadcasted packets by checking if the first byte (packet ID) is non-zero. If it is already set, it reuses the buffer.
- [X] Removes unnecessary refs to Spans. I don't think the Span struct itself is mutable, so a ref is not helpful.
2020-12-26 12:46:06 -08:00
Kamron Batman
9c9591b098
fix(core): Fixes wrap not slicing properly (#362)
- [X] Fixes wrap not slicing properly

Bumps release version
2020-12-26 09:26:10 -08:00
Kamron Batman
10a6e17640
fix(core): Converts mobile moving packet (#357)
- [X] Converts mobile moving packet
2020-12-24 17:13:55 -08:00
Kamron Batman
c2143584bc
fix(core): Fixes BufferWriter Seek and removes World.SaveBuffers (#359)
- [X] Fixes an issue in BufferWriter where if SeekOrigin.End is used, it will yield the wrong index.
- [X] Changes BinaryFileWriter to dispose pattern
- [X] Removes World.SaveBuffers. They were dangerous and should be done in-line while the world is loading, even if it is slower
- [X] Fixes BufferReader Seek too
- [X] Changes BufferWriter to use uninitialized arrays to speed up resizing
- [X] Changes World loading so it doesn't buffer the whole file, even if it makes things slower. It lowers allocations/fragmentation over all which is good.
- [X] Changes World Loading to use uninitialized arrays and directly saves them to the SaveBuffer which eliminates having to open/load the files _again_ which is dangerous. Also looping through items while the world is running is dangerous since async references can and will cause exceptions.

Bumps release version
2020-12-24 14:21:17 -08:00
Kamron Batman
4ddb3de026
fix(core): Fixes several serialization issues (#355)
- [X] Fixes an issue where a buffer smaller than 8 bytes would not double with enough space in some cases.
- [X] Fixes an issue with dupe copying the savebuffer reference (ugh).
- [X] Streamlines the IGenericWriter API to use better generics.
- [X] Streamlines the IGenericReader API to use better generics.
- [X] Forces `tidying` of a List/HashSet to be done externally since Writers/Readers should not have side effects.
- [X] Fixes an issue where Tidying a list didn't TrimExcess, causing memory leaks.
- [X] Reverted the meaning of `World.Running` to specifically refer to any world state post world loading.
  - NOTE: Do not use this if you want to block on world saves. Instead use checks against `WorldState.Saving` states.
- [X] Fixes an issue with serializing negative DateTime deltas.
- [X] Fixes a potential issue with serializing non-UTC DateTime.

Bumps release version
2020-12-23 07:11:41 -08:00
Kamron Batman
0888ab9b86
fix(core): Fixes object property list not big enough exception (#358)
Bumps release version
2020-12-22 13:08:46 -08:00
Kamron Batman
90393fea2a
fix(core): Converts death animation (#356)
- [X] Converts death animation
- [X] Fixes tests for movement packets
2020-12-21 23:43:45 -08:00
Kamron Batman
77ce2e1980
fix(core): Optimizes strings / .NET 5 compatibility changes (#354)
- [X] Removes some string allocations (e.g. split)
- [X] Optimizes some collections
- [X] Converts insensitive to extension methods of built-ins.
- [X] Adds ordinal (case sensitive) string helpers
- [X] Fixes conditionals for in-game commands so they use Ordinal comparisons.
- [X] Replaces ToLower.Contains with InsensitiveContains
- [X] Adds ValueStringBuilder
- [X] Implements ValueStringBuilder in a few places where it makes sense
- [X] Removes the redundant Wrap function and replaces it with an optimized version
- [X] Fixes list conversions in Utility

Closes #351

Bumps release version
2020-12-20 23:21:55 -08:00
Kamron Batman
92aae8d482
fix(core): Adds IPv6 support (#348)
## Breaking Change
* IP Matching no longer supports `?` (e.g. you cannot do: "192.16?.0.1")
* IP Matching no longer supports `*` and other values in the same section (e.g. you cannot do "192.1\*.0.1")
  * To do "192.1\*.0.1", you should use the range option with three separate entries: "192.100-199.0.1", "192.1.0.1", "192.10-19.0.1"

## Non-Breaking Changes
- [X] Adds IPv6 support (not for servers though, just clients)
- [X] Adds interning support for IPv4 mapped to IPv6
- [X] Updates IPv4ToAddress (don't use this unless you know it is IPv4 or IPv4 mapped to IPv6)

## Note:
UO Does not support IPv6 for the server. To support an IPv6 server IP you will need to use CUO or some kind of custom client and probably modify it accordingly.

Bumps release version
2020-12-19 00:27:39 -08:00
Kamron Batman
baf724ead8
fix(spawns): Deletes VendorGen.cs (#352)
- [X] Removes [vendorgen

Closes #76
Bumps release version
2020-12-16 09:19:33 -08:00
Kamron Batman
e17413af21
fix(core): Serialization issues (#350)
- [X] Fixes IPAddresses not having enough space
- [X] Streamlines some code
- [X] Fixes base escortables to not load destination tables in a dangerous way.
- [X] Fixes some bad assumptions about resizing buffers
- [X] Fixes little endian issue with circular buffer writer

This doesn't seem to address #349. That issue requires more investigation because I am not seeing where the issue would be.

Closes #347
Closes #322
2020-12-13 13:15:48 -08:00
Kamron Batman
3acb1414dd
fix(spawner): Fixes spawners infinitely spawning (#346)
Bumps release version
2020-12-11 22:04:49 -08:00
Kamron Batman
5b7a4151c7
fix(publish): Removes or from publish script (#340)
Fixes publish script
Bumps release version
2020-12-11 19:37:02 -08:00
Kamron Batman
02d27036af
fix(core): Fixes wrong offset for CircularBuffer (#344)
Bumps release version
2020-12-11 16:46:38 -08:00
Kamron Batman
5e991f6fb5
fix(core): Converts vendor buy packets (#339) 2020-12-11 00:04:39 -08:00
Kamron Batman
d71856ddbe
fix(net): Clean up for mobile packets (#338)
### Breaking Change
- [X] `Mobile.GetOldPacketFlags()` no longer exists. Instead there is a flag for `Mobile.GetPacketFlags()`.

### Non-Breaking Changes
- [X] Consolidates move to world for mobiles
- [X] Consolidates mobile packets between stygian abyss and older

This PR supersedes changes in #337. That PR will need to be redone and broken out anyway.
2020-12-10 17:46:58 -08:00
Kamron Batman
4b2e4fbd36
fix(core): Adds object help response packets (#336) 2020-12-07 21:19:21 -08:00
Kamron Batman
c77b5b1462
fix (basecreature): NPE crash for IsFriendPet (#335)
Bumps release for the fix
2020-12-07 12:18:09 -08:00