Commit graph

32 commits

Author SHA1 Message Date
Kamron Batman
6e69d25e33
fix: Fixes structured logging (#1043)
- [X] Fixes various bugs in logging.
2022-06-05 01:00:22 -07:00
Kamron Batman
bdee7bc671
fix: Fixes NPC slowness. (#955)
* Adds the following configurations:
  * `movement.delay.npcMinDelay` - 0.1 - Pets or Non-monster NPCs
  * `movement.delay.npcMaxDelay` - 0.4 - Pets or Non-monster NPCs
  * `movement.delay.monsterMinDelay` - 0.4 - Non-pet Monsters or NPC vs Player Combat
  * `movement.delay.monsterMaxDelay` - 0.8 - Non-pet Monsters or NPC vs Player Combat
  * `movement.delay.monsterMinDex` - 150 - Dex maximum for delay by dex
  * `movement.delay.MinDex` - 190 - Dex maximum for delay by dex
2022-03-10 22:55:06 -08:00
Kamron Batman
5b7b99e0de
fix: Adds CUO settings support and adds more robust 7.0.9 support (#945) 2022-02-27 02:15:06 -08:00
Kamron Batman
1ac803e778
fix: Adds better client verification (#853)
* Adds MinRequired and MaxRequired settings
* Removes god client detection
* Streamlines the kick messaging
* Fixes detecting client version on mac/linux
2021-11-27 10:06:39 -08:00
Kamron Batman
3f6a87483b
feat: Adds auto archiving (#794)
## Adds Auto Archiving
Backups are archived once an hour, day, and month. Archives older than 60 days are pruned automatically.

_Note: Automatic pruning is off by default_

### Archive compression format
The following formats are supported:
* Zstd (The fastest with best compression ratio)
* GZip
* Zip
* None (Tar)

_Note: By default archives use [zstandard](http://facebook.github.io/zstd/) format.
The archive format can be changed in modernuo.json `autoArchive.compressionFormat`_

### Restoring world from archive
Move the archive to the Saves folder (tar.zst file). On startup the server will extract the file and restore the latest save. See pictures below.

### Manually extracting an archives
#### Windows
* Use the latest version of [7-zip w/ ZStandard](https://github.com/mcmilk/7-Zip-zstd/releases/latest)
  1. Extract the `.tar.zst` file.
  2. Extract the `.tar` file. (Yes you have to do it in two steps)
* On Windows 10 you can use the command line. `zstd.exe` is in the Assemblies folder after building ModernUO.
  1. `tar --use-compress-program "Distribution\Assemblies\zstd.exe -d" -xvf "Archives\Hourly\archivefile.tar.zst" -C "path to where you want to extract it"`
#### Mac
* Install [Keka](https://www.keka.io)
  1. Drop the .tar.zst onto the keka interface.
#### Linux
  1. Install zstd from a package manager
  2. Run `tar -I zstd -xvf "Archives\Hourly\archivefile.tar.zst" -C "path to where you want to extract it"`

### Other changes
* Changes Autosave to occur at the same time no matter when the server is booted.
* Adds `[SaveFrequency <delay> [warning]`command to set save frequency and warning frequency in-game.
* Adds support for time zones that are configurable. The system timezone can also be manually configured. Check `TimeZoneHandler.cs` for details.

<img width="257" alt="Screen Shot 2021-09-22 at 11 23 18 PM" src="https://user-images.githubusercontent.com/3953314/134464929-a5bf3cd8-2ef0-4476-a9ad-71d0816a19ac.png">
<img width="241" alt="Screen Shot 2021-09-22 at 11 23 39 PM" src="https://user-images.githubusercontent.com/3953314/134464945-5f6f96dc-3d1e-434d-8256-5c6b3705e786.png">
<img width="836" alt="Screen Shot 2021-09-22 at 11 34 39 PM" src="https://user-images.githubusercontent.com/3953314/134464957-625e57f2-ef47-4ca1-a0a7-cd40c9b6539c.png">
<img width="631" alt="Screen Shot 2021-09-22 at 11 34 50 PM" src="https://user-images.githubusercontent.com/3953314/134464969-b2d65c0d-f8f5-497a-a832-5d805e8e0b22.png">
2021-09-25 17:22:05 -07:00
Kamron Batman
54e56d2fc1
fix: Fixes assembly loading. (#759)
* `AssemblyHandler.Assemblies` will now only contain assemblies listed in `assemblies.json`
* `assemblies.json` has been updated to only contain asssemblies directly loaded by the server. Namely, only `UOContent.dll`.
  * Specifically assemblies loaded by assemblies.json are subject to check for `Configure` and `Initialize` methods.
* `modernuo.json` now has a new property called `assemblyDirectories`. This will be automatically set to `Distribution/Assemblies` (absolute path on your machine).
  * You can add more directories to this list.
* All assemblies in assemblies.json _AND_ dependents of any assembly will be searched for in the directories specified by `assemblyDirectories`.
2021-09-03 23:35:44 -07:00
Kamron Batman
9729b5a7b0
fix(map): Fixes map diffs (Old Haven/Minax) (#720)
* Fixes reading map/static diffs.
2021-08-22 23:35:18 -07:00
Kamron Batman
f795ab4698
fix: Updates first load configuration (#680)
<img width="814" alt="Screen Shot 2021-08-08 at 11 33 24 PM" src="https://user-images.githubusercontent.com/3953314/128667907-be43bf24-df7b-481b-ab0a-8b9094f01188.png">
2021-08-08 23:42:10 -07:00
Pedro Pardal
3a619e0103
feat(logging): Adds support for Serilog (#573)
Example:
```cs
public class SomeClass
{
  private static ILogger _logger;
  private static Logger => _logger ??= LogFactory.GetLogger(typeof(SomeClass));
  ...
}
```
2021-04-19 23:43:54 -07:00
Pedro Pardal
c8f4149fed
fix(core): Configure expansion from config (#571) 2021-04-15 12:27:08 -07:00
Kamron Batman
98ce65083a
fix(core): Updates expansion and map configurations (fixes map issues) (#570)
- [X] Adds question about expansion at start of server
- [X] Adds question about client version to determine old have and map diffs
- [X] Adds config setting "maps.enablePre6000Trammel"
- [X] Rearranges some of the loading order.
- [X] Added support for deserializing nullable enums from json

TODO:
Expand the nullable enums deserialization factory to work with any type by pulling the factory and creating an instance of the converter.
2021-04-14 01:45:18 -07:00
Kamron Batman
da01f5b8a5
fix(core): Fixes flow for saves, adds logging and configurations (#513)
- [X] Adds better diagnostics for world saves.
- [X] Adds world save stats.
- [X] World now saves to a temporary folder.
- [X] Backups are now stored by timestamp.
- [X] Backup is now made after the world save.
- [X] "Saves" folder is now configurable.
- [X] Temporary folder is now configurable.
- [X] Backups folder is now configurable.
2021-02-20 19:32:08 -08:00
Kamron Batman
8006fa20df
fix(core): Fixes errors from missing files (#511) 2021-02-14 18:30:53 -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
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
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
013f333898
Adds official .NET 5 support (#300) 2020-11-07 13:26:27 -08:00
Kamron Batman
12e935e4f4
Adds property sorting for json output (#266) 2020-09-26 22:38:50 -07:00
Kamron Batman
741e8d8300
Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
Kamron Batman
c3d2740983
Fixes bug with configurations (#236)
- [X] Changes brace style to enforced
- [X] Fixes null source with assemblies.json
- [X] Fixes bad path for missing json files

Bumps release version
2020-09-10 23:38:06 -07:00
Kamron Batman
e8fe3852cd
Fixes email configurations (#225)
Fixes email configuration and bumps release
2020-09-04 22:42:15 -07:00
Kamron Batman
dad5997c85
Fixes copyright headers and live template (#216) 2020-09-03 01:47:20 -07:00
Kamron Batman
86b7b3aed1
Fixes formatting (#200) 2020-08-25 18:53:35 -07:00
Kamron Batman
f868c34678
Adds listening sockets to the configuration file (#172) 2020-07-03 20:45:37 -07:00
Kamron Batman
5ea11cef11
Fixes data file loading (#145) 2020-05-25 00:37:46 -07:00
Kamron Batman
8ec166bcd0
Adds assemblies config, fixes crash bugs. (#134) 2020-05-09 12:55:56 -07:00
Kamron Batman
11227391d3
Fixes configurations (#130) 2020-05-03 23:52:16 -07:00
Kamron Batman
f336a56364
Adds settings (#126) 2020-05-02 23:41:30 -07:00
Kamron Batman
8028a85ffe
Fixes copyright headers 2020-05-02 18:12:20 -07:00
Kamron Batman
c7daf97f5e
Removes console log 2020-05-02 17:32:57 -07:00
Kamron Batman
5b01754e3e
Adds configuration system. (#125) 2020-05-02 16:44:05 -07:00