Commit graph

87 commits

Author SHA1 Message Date
Kamron Batman
2c8d54549c
fix: Changes C# version to 11 (#1461) 2023-08-16 20:12:56 -07:00
Kamron Batman
c93fa004a3
chore: Bumps dependencies (#1414) 2023-06-20 22:57:16 -07:00
Kamron Batman
a7edba3712
fix: Removes scoped for gump AppendTo (#1405)
### Summary
.NET 6 had a bug that required the `scoped` keyword for the gump AppendTo. It looks like this was fixed since then.
2023-05-21 00:46:25 -07:00
Kamron Batman
a1a50603da
fix: Fixes releases (#1382) 2023-03-26 01:00:10 -07:00
Kamron Batman
0150e1a994
fix: Fixes broken chair (#1356) 2023-02-27 09:01:50 -08:00
Kamron Batman
5c99d0cb38
Adds github token to release action 2023-02-25 12:09:31 -08:00
Kamron Batman
ac7c3522f4
fix: Updates .NET 7 SDK to 7.0.201 for CI/CD (#1351) 2023-02-25 00:57:18 -08:00
Kamron Batman
3f400fc965
docs: Adds tzdata to README (#1317) 2022-12-30 15:32:54 -08:00
Kamron Batman
7591d687cd
chore: Fixes release (#1312) 2022-12-27 16:59:17 -08:00
Kamron Batman
94199f1186
fix: Adds migration checks to CICD, updates dependencies, adds Fedora 37, alpine 3.17 support (#1309)
- [X] Automatically collapses migration files in github PRs.
- [X] CI/CD now checks to see if migrations are missing or modified.
- [X] Updates dependencies
- [X] Adds Fedora 37, Alpine 3.17 support
2022-12-22 12:12:47 -08:00
Kamron Batman
810061db8c
chore: Update from .NET 7 preview to release. (#1234) 2022-11-08 09:46:48 -08:00
Kamron Batman
ab4aaa0fa8
chore: Adds .NET 7 to release workflow (#1230) 2022-11-06 10:04:32 -08:00
Kamron Batman
5bd41d5b68
feat: Adds .NET 7 & Arm64 support (#1229)
## BREAKING CHANGE
**Publishing for linux will no longer include runtimes**

## Major Changes
* Adds .NET 7 support.
* Adds ARM64 support (experimental).
* Changes linux support to be open-ended against anything .NET 7 supports.
* Fixes native library resolutions. (Make sure to install `dev` versions of the libraries)
* Updates README
* Adds Ubuntu 22, CentOS 8/9 Stream to CI/CD.

## TODOs:
* Update modernuo.com docs

Closes #1173
Closes #1159
2022-11-06 09:59:11 -08:00
Kamron Batman
5e7dbb53c1
fix: Updates Github Actions & Azure Pipelines (#1192) 2022-10-16 10:10:55 -07:00
Kamron Batman
f268d5d4e2
fix: Cleans up core code (#1187)
**Only one functional change**
* Fixes a bug in LogFactory where `Warning` is being logged as `Information`

Non-functional changes:
* Updates/Fixes copyright headers
* Removes namespace scopes for core files.

View with [whitespace off](https://github.com/modernuo/ModernUO/pull/1187/files?w=1).
2022-10-10 21:47:08 -07:00
Kamron Batman
5f91598c15
chore: Add generic linux target (#1164) 2022-09-06 10:28:19 -07:00
Kamron Batman
5a374e75c9
chore: Updates workflow to fix Fedora 35/36 (#1161) 2022-09-04 22:21:50 -07:00
Kamron Batman
89815ad4d3
feat: Updates to Serialization Generator v2.2 (#1157)
* Adds `SerializationProperty` - This will generate the private variable for serialization. Also provides an option `useField` to specify your own. Example:
  ```cs
  [SerializationProperty(0, useField: nameof(_resource)]
  ```
2022-09-04 08:45:27 -07:00
Kamron Batman
abdd868b7a
chore: Updates release permissions (#1085) 2022-06-21 16:00:06 -07:00
Kamron Batman
7a7637d2b5
fix: Fixes release workflow (#1077) 2022-06-17 23:54:33 -07:00
Kamron Batman
fd2d47cd75
chore: Removes MacOS 10 from CI/CD (#1060) 2022-06-13 17:39:43 -07:00
Kamron Batman
5b48843045
fix: Adds beta MacOS 12 CI/CD support (#1057) 2022-06-13 14:03:18 -07:00
Kamron Batman
6ea5508f5f
chore: Updates to .NET 6.0.5 (#1026) 2022-05-18 15:03:10 -07:00
Kamron Batman
daf89686d1
chore: Updates CI/CD to use .NET 6.0.201 (#964) 2022-03-18 19:49:50 -07:00
Kamron Batman
08df0307e5
docs: Adds workflow dispatch 2022-01-03 19:08:50 -08:00
Kamron Batman
7da6cec27e
fix: Bumps source generator to netstandard2.1 (#874) 2021-12-04 11:58:59 -08:00
Kamron Batman
fcc91cbd99
fix (workflow): Adds manual release for github actions (#863) 2021-11-22 13:29:17 -08:00
Kamron Batman
78f587f496
fix: Fixes dictionary codegen (#844)
* Fixes code gen with .net 6 by not using .net 6
* Fixes dictionary codegen
* Fixes kvp codegen
2021-11-13 16:18:16 -08:00
Kamron Batman
c31bf20d0e
feat: Updates to .NET 6 (#843)
* Fixes an issue with moving directories across volumes
* Removes usages of WebClient
* Removes usages of Cryptographic Providers

Note: Even though .NET 6 introduces Xoshiro RNG, there is no way to control the seed. I'll do some reconciliation of Xoshiro so it functions closer to the built in one. For the most part, it has parity though.
Benchmarks show there is nothing odd about the implementations, they are within 1ns of each other.
2021-11-13 13:38:01 -08:00
Kamron Batman
ef761f9035
fix(build): Updates releases to use github token (#817) 2021-10-05 09:07:32 -07:00
Kamron Batman
ec785e6f07
fix: Updates dependencies, cleans up csproj, and updates README (#784) 2021-09-15 09:54:15 -07:00
Kamron Batman
788b04b958
fix: Updates build/test workflow (#703) 2021-08-18 12:48:08 -07:00
Kamron Batman
9b554f69b0
feat(timers): Adds timer pooling, fixes timer related bugs, and changes timer api (#667)
### Changes/Fixes:
* Adds timer pooling.
* Allows pool to be configurable in ModernUO.json
* Pool replenishes itself asynchronously if depleted.
* Fixes an issue with barkeeps and town criers
* Fixes an issue with incognito buff icons not being removed
* Fixes an issue with polymorph name mod not being removed
* Fixes several places where timers go on forever even after an object is deleted, keeping a reference (memory leak)
* Eliminates the timer for MiningCart altogether.
* Deletes `AcidSlime` since it is a duplicate of `PoolOfAcid`
* Fixes HonorableExecution and standardizes the code for other Bushido moves.

## Changes to the Timer API:
```cs
public class Timer
{
  // Creates a timer that will be returned to the pool once execution stops.
  public static void StartTimer(Action callback);
  public static void StartTimer(TimeSpan delay, Action callback);
  public static void StartTimer(TimeSpan delay, TimeSpan interval, Action callback);
  public static void StartTimer(TimeSpan interval, int count, Action callback);
  public static void StartTimer(TimeSpan delay, TimeSpan interval, int count, Action callback);

  // Creates a timer and returns a token for more control. Requires manual cancellation in order for the timer to be returned to the pool.
  // If the token is dereferenced, the timer will be dereferenced too. While not returning a timer to the pool is not considered hazardous, it does defeat the purpose of pooled timers.
  public static void StartTimer(Action callback, out TimerExecutionToken token);
  public static void StartTimer(TimeSpan delay, Action callback, out TimerExecutionToken token);
  public static void StartTimer(TimeSpan delay, TimeSpan interval, Action callback, out TimerExecutionToken token);
  public static void StartTimer(TimeSpan interval, int count, Action callback, out TimerExecutionToken token);
  public static void StartTimer(TimeSpan delay, TimeSpan interval, int count, Action callback, out TimerExecutionToken token);

  // If you aren't sure how to use the API above, or you don't care about performance, then you can use the old RunUO Timer.DelayCall
  public static DelayCallTimer DelayCall(Action callback);
  public static DelayCallTimer DelayCall(TimeSpan delay, Action callback);
  public static DelayCallTimer DelayCall(TimeSpan delay, TimeSpan interval, Action callback);
  public static DelayCallTimer DelayCall(TimeSpan interval, int count, Action callback);
  public static DelayCallTimer DelayCall(TimeSpan delay, TimeSpan interval, int count, Action callback);
}

public struct TimerExecutionToken
{
  public bool Running { get; }
  public int Index { get; }
  public int RemainingCount { get; }
  public DateTime Next { get; }
}
```

## When to use `TimerExecutionToken`?
Use tokens when you want to gain the performance benefit of using a pooled timer, but you need one of the following:
* Access to the next time the timer will tick:`token.Next`
* Access to which interval, how many intervals there are, or how many are remaining: `token.Index`, `token.Count`, and `token.RemainingCount`
* Stop a timer manually.
* Determine if the timer is running: `timer.Running`
* See notes below about requirements for using tokens!

## Notes about using the TimerExecutionToken:
When you opt-in to receive a token, you must call `Cancel()` to return the timer. This can be done inside of the callback, or outside of the callback at any time.
If this is not called and your timer is an infinite interval, then you will create a potential memory leak, or null pointer exception in your callback.
If the timer ends and is stopped, but cancel is not called, then the timer will never return to the pool and stay referenced until the token is deleted or cancel is called. (Memory leak)

## Is this thread safe?
No. The ModernUO timer system is not thread safe at all. If you require a thread safe timer system, contact me and I'll help adapt this system. Keep in mind that there is a massive performance hit to make this thread safe when there are literally no use cases for it.

If you need to synchronize execution, meaning you want to execute code from another thread on the core thread. Let's say you have a discord bot that is pushing commands to the game server. Then use `EventLoopContext.Post(SendOrPostCallback callback, object state);`.
2021-08-07 14:33:35 -07:00
Kamron Batman
fb915992dd
fix(core): Adds Hashed & Hierarchical Timer Wheel (#655)
- Removes TimerPriority
- Removes TimerThread
- Adds a [Hashed & Hierarchical Timer Wheel](http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf)
2021-07-11 22:42:06 -07:00
Kamron Batman
9afa4e4cab
feat: Source generated Serialization/Deserialization (#550)
### Features
* Fully abstracts serialization by using compile-time attributes.
* Supports serializing the following:
  - Primitives (integers, strings, etc)
  - IP Addresses
  - BigDecimal
  - DateTime, Delta DateTimes
  - TimeSpan
  - Server.Race
  - Server.Map
  - Point2D, Point3D, Rect2D, Rect3D
  - Existing/New `ISerializable` references
  - Lists/Sets of serializable types
  - Type with a `Serialize` method and constructor that takes an `IGenericReader`
* Supports forward-only migration
* Supports existing RunUO deserialization for older versions by changing to the following signature:
  - `public void OldDeserialize(IGenericReader reader, int version)`
  - Must remove deserializing the version since this is already done
* Supports serializing from private fields or custom made properties.
* Types do not require inheriting Item/Mobile. Code gen will fully create `ISerializable` information.
  - This is not recommended yet, since it requires wiring to `Persistence` which will cause lots of unresolved symbol errors until code gen is built.

### Example
```cs
using System.Collections.Generic;

namespace Server.Items
{
    [Serializable(1)]
    public partial class TestItem1 : Item
    {
        [SerializableField(1)]
        [SerializableFieldAttr("[CommandProperty(AccessLevel.Administrator)]")]
        private List<Item> _someProperty;

        private void Deserialize(IGenericReader reader, int version)
        {
        }
    }
}
```

Generates this:
```cs
namespace Server.Items
{
    public partial class TestItem1
    {
#pragma warning disable 0414
        private const int _version = 1;
#pragma warning restore 0414

        [CommandProperty(AccessLevel.Administrator)]
        public System.Collections.Generic.List<Server.Item> SomeProperty
        {
            get => _someProperty;
            set
            {
                if (value != _someProperty)
                {
                    ((ISerializable)this).MarkDirty();
                    _someProperty = value;
                }
            }
        }

        public TestItem1(Serial serial) : base(serial)
        {
        }

        public override void Serialize(IGenericWriter writer)
        {
            var savePosition = ((Server.ISerializable)this).SavePosition;
            if (savePosition > -1)
            {
                writer.Seek(savePosition, System.IO.SeekOrigin.Begin);
                return;
            }
            writer.WriteEncodedInt(_version);
            writer.Write(_someProperty);
        }

        public override void Deserialize(IGenericReader reader)
        {
            var version = reader.ReadEncodedInt();
            if (version < 1)
            {
                OldDeserialize(reader, version);
                ((Server.ISerializable)this).MarkDirty();
                return;
            }
            SomeProperty = reader.ReadEntityList<Server.Item>();
        }
    }
}
```

And this:
```json
{
  "version": 1,
  "type": "TestItem1",
  "properties": [
    {
      "name": "SomeProperty",
      "type": "System.Collections.Generic.List\u003CServer.Item\u003E",
      "rule": "ListMigrationRule",
      "ruleArguments": [
        "Server.Item",
        "SerializableInterfaceMigrationRule"
      ]
    }
  ]
}
```
2021-05-23 21:06:23 -07:00
Kamron Batman
151eef470f
update(release): Updates .NET 5 version in workflows (#569) 2021-04-10 21:49:44 -07:00
Kamron Batman
ec1cc10821
fix(network): Converts House Design Detailed Packet (#538)
- [X] Converts design state detailed packet
- [X] Removes `Packet` class
- [X] Removes `Send(Packet)` function signatures
- [X] Removes `PacketWriter` class
- [X] Updates dependencies.
2021-03-03 02:09:15 -08:00
Kamron Batman
af021f748a
fix(workflow): Updates workflow for docs (#528) 2021-02-27 20:14:19 -08:00
Kamron Batman
6a80dfea00
fix(workflow): Fixes wrong branch (#505) 2021-02-09 10:32:39 -08:00
Kamron Batman
517190b820
fix(workflows): Deletes sonar cloud (#504) 2021-02-09 10:23:13 -08:00
Kamron Batman
d61f07abd5
fix(releases): Uses an access token for checkout (#501) 2021-02-08 16:33:50 -08:00
Kamron Batman
f1065b119d
fix(releases): Fixes broken merge (#500) 2021-02-08 16:24:32 -08:00
Kamron Batman
0895d43624
fix(releases): Adds git credentials (#499) 2021-02-08 16:21:03 -08:00
Kamron Batman
47dd962725
fix(releases): More cleanup (#498) 2021-02-08 15:54:48 -08:00
Kamron Batman
f107c96065
fix(releases): Add missing token for fake release tag (#497) 2021-02-08 15:51:58 -08:00
Kamron Batman
4bf8447530
fix(core): Fixes release token use (#496) 2021-02-08 15:37:00 -08:00
Kamron Batman
db76c941e6
fix(releases): Do not update tags remotely (#495) 2021-02-08 15:29:00 -08:00
Kamron Batman
ecf5a4f048
fix(release): Fixes error in syntax (#494) 2021-02-08 13:54:16 -08:00
Kamron Batman
e7f01c1326
fix(releases): Fix create release and remove old tag (#493) 2021-02-08 13:51:42 -08:00
Kamron Batman
6753822cd9
fix(releases): Adds fake release message (#492) 2021-02-08 13:43:39 -08:00