Commit graph

229 commits

Author SHA1 Message Date
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
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
Kamron Batman
54b0a7dcb5
fix(core): Updates prompt packet (#332)
- [X] Updates prompt packet
2020-11-30 23:33:47 -08:00
Kamron Batman
75c1b32513
fix(core): NPE in Cycles per second (#331)
- [X] Fixes an edge case where the cycle index goes negative and crashes
- [X] Fixes average CPS calculation
- [X] Fixes issue with logout delay
- [X] Bumps release version
2020-11-30 23:12:16 -08:00
Kamron Batman
b71c754738
Converts targeting packets (#330)
- [X] Converts targeting packets.

### BREAKING CHANGE TO TARGET CLASS

```cs
public virtual Packet GetPacketFor(NetState ns)
```

Changed to:
```cs
public virtual void SendPacketTo(NetState ns)
```

Bumps release version
2020-11-29 23:01:31 -08:00
Kamron Batman
8c4c30da7d
Converts secure trade packets (#329) 2020-11-29 22:20:10 -08:00
Kamron Batman
77f665502b
Converts Item & Entity Packets (#326)
- [X] Converts World Item packets
- [X] Converter Remove Entity packets
- [X] Updates `LOSBlocker` and `Blocker`
- [X] Fixes a few bugs
- [X] Converts container packets

Bumps release version
2020-11-29 03:24:51 -08:00
Kamron Batman
c41906d3c7
Fixes messages and removes movement console logs (#328) 2020-11-28 18:36:08 -08:00
Kamron Batman
3551d962f7
C# 9 Cleanup (#325)
- [X] Removes EventArgs - not needed
- [X] Merges sequential checks
- [X] Removes redundant type declarations
2020-11-27 00:29:21 -08:00
Kamron Batman
351611a23a
Updates movement packets & Fastwalk (#324)
- [X] Updates Movement packets
- [X] Adds OSI fastwalk packets. These aren't used on OSi anymore.
- [X] Adds new movement handling, but looks like the client doesn't use it. (Also leaving the 0x4000 Character List Flag off)
- [X] Adds time sync request handler, but also looks like the client doesn't use it.
- [X] Adds time sync response for time sync, just in case, but it isn't used, so not sure about the arguments.
- [X] Reimplements RunUO's fastwalk to use a circular array on the netstate instead of every mobile
- [X] Removes ClearFastwalkStack from RunUO implementation. This shouldn't be needed anymore

Changed fastwalk settings:
```cs
        public static int WalkFootDelay { get; set; } = 440;
        public static int RunFootDelay { get; set; } = 220;
        public static int WalkMountDelay { get; set; } = 220;
        public static int RunMountDelay { get; set; } = 110;

        public static bool EnableFastwalkPrevention { get; set; } = true;
        public static AccessLevel FastwalkExemptionLevel { get; set; } = AccessLevel.Counselor;

        // If this is changed during runtime, then the steps array needs resizing.
        public static int MaxSteps { get; private set; } = 4;
```

modernuo.json
```json
{
  "settings": {
    "movement.delay.runFoot": "220",
    "movement.delay.runMount": "110",
    "movement.delay.walkFoot": "440",
    "movement.delay.walkMount": "220",
    "movement.enableFastWalkPrevention": "True",
    "movement.fastwalkExemptionLevel": "Counselor",
    "movement.maxSteps": "4"
  }
}
```

Notes about OSI fastwalk:
While it does work, I can't find a benefit in using it because of the variable speeds. If players moved at a single speed then we could refill the stack every X milliseconds with 6 keys and use a naive token bucket implementation.
Unfortunately variable speeds mount/run/walk/etc means we would have to use a leaky bucket algorithm.
If we are using a leaky bucket algorithm with a variable leak, then we don't need to send tokens because we are already tracking it on the server side.

ModernUO vs OSI Fastwalk:
When the fastwalk was implemented on OSI, it used up to 6 tokens. These tokens were probably distributed every 600-750 milliseconds. To get the same effect, the new fastwalk settings might need to be adjusted. I would tweak them and feel free to let me know what worked for you!

Bumps release version
2020-11-26 23:53:47 -08:00
Kamron Batman
b6cd408623
Updates Message Packets (#321)
### API Breaking Change
Combined `AsciiMessage` and `UnicodeMessage` into a single function that takes two arguments, `bool ascii` and `string lang`. Lang can be null (or anything) if ascii is true. 

- [X] Changes message packets
- [X] Cleans up some code
- [X] Uses benchmarks to determine if the spanwriter + copyfrom
2020-11-20 21:50:13 -08:00
Kamron Batman
10d884fe30
Fixes divide by zero (#323) 2020-11-18 18:29:21 -08:00
Kamron Batman
602c14fed7
Updates menu packets (#320) 2020-11-17 21:47:00 -08:00
Kamron Batman
ceb8d4ad49
Updates map packets (#319) 2020-11-17 20:58:28 -08:00
Kamron Batman
00beaf8e6e
Fixes NBGV & Adds Big Sur to CI/CD (#317) 2020-11-17 13:02:51 -08:00
Kamron Batman
d2cfeb06ab
Updates Light Packets & World Loading (#316)
- [X] Changes light packets
- [X] Updates world loading

Bumps release version
2020-11-17 00:46:06 -08:00
Kamron Batman
313eda6a3e
Speeds up world loading (#315)
- [X] Speeds up world loading
- [X] Removes PeekChar cause it wasn't used
- [X] Adds a BufferReader
- [X] Removes BinaryFileReader
- [X] Removes reading/writing `char` since it is not consistent and will cause a deserialize issue if used.

Bumps version release
2020-11-16 21:58:58 -08:00
Kamron Batman
1fb7ac5cda
Converts equipment packets (#314)
### Change to how DisplayEquipInfo works
* Fixes a bug where raw name wasn't used
* Fixes another bug where an empty, blank, or null string was still sending an empty crafted by property.

Bumps release version
2020-11-16 01:04:56 -08:00
Kamron Batman
b0d8dd42c0
Fixes NPE (#312)
- [X] Fixes issue with world load where items modify mobiles before mobiles are initialized

Bumps release version
2020-11-15 13:52:05 -08:00
Kamron Batman
0ec30e22d1
Fixes another NPE (#311)
Bumps release version
2020-11-15 12:30:59 -08:00
Kamron Batman
525cda5413
Cleanup & Fixes for .NET 5 (#309)
- [X] Fixes several bugs
- [X] Updates more ordinal issues
- [X] Cleans up the code a bit
- [X] Turns classes static that should have been
- [X] Changes TcpServer.Instances to a HashSet

Bumps release version
2020-11-15 10:03:50 -08:00
Kamron Batman
4ad8811df2
Fixes NPE with expansions (#310)
Bumps release version
2020-11-14 19:48:40 -08:00
Kamron Batman
361ec4dba4
Effects packets (#308)
- [X] Changes effect packets
- [X] Updates playing sounds
- [X] Updates Effects class to have more options so there are less direct calls to building the packets
- [X] Changes bonding status packet
2020-11-12 00:52:38 -08:00
Kamron Batman
1c9439e4fd
Drop .NET Core 3.1 (#307)
- [X] Updates Zlib Bindings
- [X] Updates Argon2 Bindings
- [X] Drops .NET Core 3.1 support
- [X] Updates CI/CD

Bumps release version
Updates documentation
2020-11-10 20:28:05 -08:00
Kamron Batman
ae436cb55f
Fix bad serials (#304)
- [X] Fixes bad serial calculations
- [X] Tightens HexStrings

Bumps release version
Updates documentation
2020-11-08 12:09:26 -08:00
Kamron Batman
013f333898
Adds official .NET 5 support (#300) 2020-11-07 13:26:27 -08:00
Kamron Batman
c3289a20ab
Changes damage packets (#299)
- [X] Changes damage packets

Bumps release version
2020-11-01 22:44:23 -08:00
Kamron Batman
6f5cb00cdd
Updates Combat Packets & Moves Tracking to Content (#298)
- [X] Changes outgoing combat packets
- [X] Moves quest arrow to PlayerMobile and moves quest arrow packets to content.

Bumps release version
2020-11-01 21:33:01 -08:00