Commit graph

156 commits

Author SHA1 Message Date
Kamron Batman
76035f6bd1
fix(recipes): Fixes NPE with recipes on PlayerMobile (#476) 2021-02-06 21:07:59 -08:00
Kamron Batman
8d8a1b63bd
fix(vendors): Fixes DisplayCache deserialization (#471)
- [X] Fixes a dangerous mobile/item deletion in display caches during deserialization. This is left over from RunUO.

Notes: I broke up the deletion here because I didn't want to have to clear the mobiles list and trim excess. It is easier to just build a list of objects to delete and give the display cache a new list.

Closes #470
2021-02-06 19:49:19 -08:00
Kamron Batman
67625ad249
fix(core): Removes disposable netstates. (#467)
- [X] Removes IDisposable from NetState
- [X] Swaps Disconnect and Dispose methods
2021-02-05 14:33:35 -08:00
Kamron Batman
079eeb1b96
fix(core): Fixes nullables being disabled (#466) 2021-02-05 14:09:57 -08:00
Kamron Batman
40352cd566
fix(network): Fixes corpse packet (#456) 2021-02-04 14:05:24 -08:00
Kamron Batman
3f73baf280
fix(factions): Fixes faction saw trap (#455)
Adds back missing serial constructor for faction saw trap.
2021-02-04 10:49:14 -08:00
Kamron Batman
3664149422
fix(shrink): Changes shrink table to use json (#446)
- [X] Replaces shrink.cfg with shrink.json
- [X] Cleans up shrink loading code
2021-02-03 16:58:50 -08:00
Kamron Batman
5d9ebf062f
core(fix): Fixes type aliasing, categorizations, and NPE (#444)
- [X] Fixes lookup of type aliases
- [X] Fixes categorization
- [X] Removes rebuild categorizations
- [X] Fixes an NPE with DoHarmful and Combatant

Closes #441
2021-02-03 16:14:04 -08:00
Kamron Batman
24ebdd0f90
fix(core): Fixes IPMatch and some cleanup (#443)
- [X] Fixes a bug where IPMatch was returning false on some IP ranges
- [X] Cleans up shrink table load.
2021-02-03 14:31:02 -08:00
Kamron Batman
cb22e662b4
fix(admin): Replaces vendors with spawners (#439)
- [X] Replaces vendors with spawners
2021-02-03 10:53:40 -08:00
Kamron Batman
6f0e1a22f9
fix(core): Core cleanup, adds event loop synchronization, and fixes gumps (#429)
- [X] Cleans up gump packets
- [X] Adds event loop task synchronization
- [X] Moves timer pause and cleans up the delay task timer class
- [X] Cleans up the conserve cpu
- [X] Renames variables to make them consistent with the new style
- [X] Removes process delta recursion checking.
- [X] Properly diposes net states. This fixes edge cases that may cause hanging connections to stay open longer than they should.
- [X] Fixes an issue with gump items not compiling properly

Users can now utilize `Timer.Pause()` since the code will be executed on the proper thread.

```cs
public void async void Talk()
{
    _canTalk = false;
    await Timer.Pause(Utility.RandomMinMax(5000, 8000)); // Talk after 5-8 seconds
    DoTalk();
    await Timer.Pause(Utility.RandomMinMax(12000, 25000)); // Reset ability to talk after 12-25 seconds
    _canTalk = true;
}
```
2021-01-25 21:06:46 -08:00
Kamron Batman
07751654b7
fix(core): Moves map definitions and cleans up loading maps, regions, and tiles (#431)
- [X] Moves map definitions to a `map-definitions.json` file.
- [X] Creates a TileMatrixLoader.
- [X] Moves tile matrix and multi data configurations closer to their classes.
2021-01-25 11:05:52 -08:00
Kamron Batman
8580139544
chore(content): Cleans up frenzied whirlwind (#428) 2021-01-24 12:34:54 -08:00
Kamron Batman
178f71c6dc
chore(content): Cleans up abilities and some spell timers (#427)
- [X] Exposes Index/Count on the timer.
- [X] Cleans up abilities
- [X] Combines some spell context/info objects with their timers to reduce allocations
- [X] Fixes a bug where immolating weapon both finishes effect or stops in the wrong order due to a race condition.
2021-01-23 16:40:53 -08:00
Kamron Batman
9ef7752beb
fix(core): Converts to ref struct enumerators (#426)
- [X] Converts boat moving entities to ref struct enumerator
- [X] Converts skills to a ref struct enumerator
- [X] Converts type cache to ref struct enumerator
2021-01-22 19:41:44 -08:00
Kamron Batman
f3e53bfd7b
fix(core): Fixes NPE with Town Crier Entries 2021-01-20 10:37:23 -08:00
Kamron Batman
e869c105d0
fix(core): Fixes type caching & cleanup (#422)
- [X] Fixes some issues with the type caching
- [X] Changes type check default to ignore case
- [X] Splits out type caching of insensitive and sensitive lists. This means less stuff to iterate through when checking a type against the string.
- [X] Adds an ArrayEnumerator, mostly for reference purposes (copy/paste as needed)
2021-01-20 00:10:33 -08:00
Kamron Batman
b921c38879
fix(core): Removes some uses of Linq (#421)
- [X] Removes some uses of linq
- [X] Creates struct based enumerator for Skills
- [X] Creates a struct based enumerator for TypeCache
- [X] Changes HarvestDefinition to an init array instead of List
- [X] Changes HeritageTokenGump Response from List to Array
2021-01-18 21:05:11 -08:00
Kamron Batman
87764ca968
fix(build): Attempt to fix possible nullable warnings as errors with releases (#418) 2021-01-18 11:52:31 -08:00
Kamron Batman
08f05afd01
fix(core): Converts boat packets (#416)
- [X] Converts boat packets
- [X] Makes a packet container builder for packet 0xF7
- [X] Generalizes world item packet so it works for mobiles too

Notes:
- This PR doesn't address proper smooth movement for boats.
2021-01-18 08:38:32 -08:00
Kamron Batman
b4b1b0b122
fix(core): Converts more packets and switches to Moq (#415)
- [X] Switches testing to moq for mocking
- [X] Converts race changer packets
- [X] Renames some more folders and misc cleanup
2021-01-16 22:09:05 -08:00
Kamron Batman
fbafd7210d
fix(core): Converts some packets & misc fixes/cleanup (#414)
- [X] Adds a stop music packet
- [X] Converts chat packets
- [X] Breaks out chat code a little bit more
- [X] Converts character statue animation packet
- [X] Renames some folders to have spaces
- [X] Organizes and consolidates incoming/outgoing packets for other content
- [X] Fixes virtual checks
2021-01-16 21:01:54 -08:00
Kamron Batman
a146955f6c
fix(core): Converts book packets (#413)
- [X] Splits out BaseBook
- [X] Converts book packets
- [X] Makes FixHtml faster
2021-01-16 18:49:53 -08:00
Kamron Batman
97f311d7be
fix(core): Removes 6017 handler (#411)
- [X] Removes 6017 handler since it is only used in one place
- [X] Exposes a ref int to modify the packet length. This is acceptable since we technically have access to the entire reader/buffer.
2021-01-16 13:43:16 -08:00
Kamron Batman
c58aad733d
fix(core): Converts BB packets (#406)
- [X] Organizes and splits up bulletin boards
- [X] Converts packets
2021-01-13 22:28:31 -08:00
Kamron Batman
211c2ba8ee
fix(core): Streamlines text encoding (#407)
- [X] Streamlines text encoding
2021-01-13 18:56:32 -08:00
Kamron Batman
5631c1da6d
fix(core): Converts map item packets (#404)
- [X] Converts map item packets
2021-01-12 19:25:45 -08:00
Kamron Batman
4bb2be4574
fix(core): Converts help topic packet (#403)
- [X] Converts help topic packet
2021-01-12 18:59:16 -08:00
Kamron Batman
ca196e4729
fix(content): Converts mahjong packets (#402)
- [X] Converts mahjong packets
2021-01-12 00:59:42 -08:00
Kamron Batman
f4dd7c8e7f
fix(party): Converts party packets (#401)
- [X] Converts party packets
2021-01-10 14:23:10 -08:00
Kamron Batman
f52e63f320
fix(core): Converts corpse packets (#400)
- [X] Converts corpse packets
- [X] Some cleanup
2021-01-10 09:53:05 -08:00
Kamron Batman
764d303543
chore: Code cleanup (#399)
- [X] Code cleanup
2021-01-10 09:14:03 -08:00
Kamron Batman
a6e1172f97
fix(docs): Removes docgen (#398)
- [X] Removes "docgen"
2021-01-09 20:12:08 -08:00
Kamron Batman
8763be8a21
fix(core): Cleans up uninitialized packets (#397)
- [X] Encapsulates/abstracts buffer cache checking
- [X] Changes mobile moving cache to use Span2D
2021-01-09 14:10:29 -08:00
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
7531b58ae2
fix(network): Adds protocol extensions (#392)
- [X] Adds protocol extensions for CUO
2021-01-07 00:03:12 -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
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
3d98e6e193
fix(core): Converts mobile status packets (#368)
- [X] Combines compact/extended statuses
2020-12-28 01:13:02 -08:00