Commit graph

524 commits

Author SHA1 Message Date
Kamron Batman
e47b62c0ae
fix: Fixes serious stacking issue (#1225)
* Fixes a major bug where players can stack items into their backpack infinitely even if they get a message saying they can't.
* Fixes other minor issues and cleans up code.
2022-11-02 22:18:44 -07:00
Kamron Batman
fd6f4239e2
fix: Adds FindItemOnLayer generic (#1223) 2022-11-01 00:49:20 -07:00
mark1145
053dbcbad0
fix: Fixes ignoring mobs, champions, party crash, slayer rarity, boat speedhack, etc (#1222)
* Movie ignore mobiles to Mobile class
* Allow necromancer familiars to ignore mobiles
* ChampionSpawn should not quietly fail when creating new spawn
* Fix client party crash bug: 2 people partied, the leader logs out, other client is hung
* Fix spellbooks creating with magery/meditation only and creating magery multiple times
* Fix BaseRunicTool.GetRandomSlayer() creating more undead slayers than intended
* Do not allow players to dismount each other whilst mounted
* Fix AOS onwards damage increase tooltip and wrong formula in AOS
* Fix monsters killing other monster revenants + animate dead should not attack player pets + other animates
* Fix fire steed having loot pack added twice
* Fix oaks spawn not able to create Unicorns + Kirins via Activator.CreateInstace() due to constructor having name as parametr
* Fix ignoreMobiles flag not propagated to client for non-players.
* Fix harrower tents not leeching from players
* Fix boats speedhacking around the map
* Fix bless, agility etc. not renewing duration
* Fix reveal always worked
* Fix empty constructor for steeds so they don't throw now.
2022-10-31 22:16:50 -07:00
Kamron Batman
910e06767b
fix: Optimizes TextDefinition to eliminate allocations. Removes TextDefinition ctor. (#1221)
### BREAKING CHANGE ###
The constructor for `TextDefinition` has been removed. Instead use `TextDefinition.Of()` or cast the integer/string to TextDefinition.
2022-10-30 16:53:23 -07:00
Kamron Batman
8a26afe28b
fix: Fixes regression in primitive UO codegen (#1219) 2022-10-30 01:58:45 -07:00
Kamron Batman
d791feb583
feat: Adds TextDefinition serialization support. (#1217) 2022-10-30 01:42:48 -07:00
Kamron Batman
32a5825ddd
fix: Bumps serialization generator to add CanBeNull support (#1215) 2022-10-29 15:25:33 -07:00
Kamron Batman
ebbffc3755
fix: Fixes world load not deleting bad objects (#1212) 2022-10-28 16:58:52 -07:00
Kamron Batman
49e6c6f2d1
fix: Adds AfterSerialize support. Removes BeforeSerialize support. (#1208)
### Changes
* Implements an AfterSerialize method that is executed synchronously.
* Removes `BeforeSerialize` support since it was dangerous in its current implementation.
* Moves PlayerMobile kill/virtual decay to AfterSerialize.
* Adds kill decay to after Deserialize.
2022-10-27 23:27:22 -07:00
Harley Holt
be19d9aae6
fix: Optimizes Point2D by implementing ISpanFormattable (#1203)
Point2D implements a basic TryFormat function. Only a single format is supported: "(X, Y)" where X and Y are base 10 integers.

Uses recent improvements in string interpolation to write the characters to the destination without first allocating memory for boxed arguments or intermediate strings.

This is a partial solution to issue #1067. A similar solution well be implemented in other classes in Geometry if it looks promising.

Benchmarks
---
d6f8dabf3c/Program.cs

Before change:
```
BenchmarkDotNet=v0.13.2, OS=ubuntu 22.04
Intel Core i7-9700K CPU 3.60GHz (Coffee Lake), 1 CPU, 8 logical and 8 physical cores
.NET SDK=6.0.402
  [Host]     : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2
  DefaultJob : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2


|                           Method |      Mean |    Error |   StdDev |   Gen0 | Allocated |
|--------------------------------- |----------:|---------:|---------:|-------:|----------:|
|                     CallToString |  44.27 ns | 0.068 ns | 0.063 ns | 0.0063 |      40 B |
|               InterpolatedString | 110.64 ns | 0.316 ns | 0.295 ns | 0.0126 |      80 B |
| InterpolatedStringMultiplePoints | 211.36 ns | 0.349 ns | 0.326 ns | 0.0293 |     184 B |
```

After change:
```
BenchmarkDotNet=v0.13.2, OS=ubuntu 22.04
Intel Core i7-9700K CPU 3.60GHz (Coffee Lake), 1 CPU, 8 logical and 8 physical cores
.NET SDK=6.0.402
  [Host]     : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2
  DefaultJob : .NET 6.0.10 (6.0.1022.47605), X64 RyuJIT AVX2

|                           Method |      Mean |    Error |   StdDev |   Gen0 | Allocated |
|--------------------------------- |----------:|---------:|---------:|-------:|----------:|
|                     CallToString |  55.13 ns | 0.826 ns | 0.772 ns | 0.0063 |      40 B |
|               InterpolatedString |  55.73 ns | 0.954 ns | 0.892 ns | 0.0063 |      40 B |
| InterpolatedStringMultiplePoints | 105.42 ns | 0.151 ns | 0.134 ns | 0.0101 |      64 B |
```
2022-10-25 12:08:35 -07:00
Kamron Batman
5797c85d75
fix: Handles timers outside of the wheels max capacity of 17yrs (#1204) 2022-10-23 20:29:18 -07:00
Kamron Batman
bae017c45b
fix: Use TryWrite for Serial formatting (#1205) 2022-10-23 18:17:08 -07:00
Kamron Batman
24e2696510
fix: Adds reset RNG command (#1201) 2022-10-22 14:46:23 -07:00
Kamron Batman
28040582bc
fix: Fixes skill mods NPE with Skills (#1200) 2022-10-22 09:56:52 -07:00
Kamron Batman
c711e7ab02
fix: Fixes NPE with resistance mods in Mobile (#1199) 2022-10-22 09:11:56 -07:00
Kamron Batman
f936314326
fix: Removes debug message on timers for attach (#1198) 2022-10-19 21:10:18 -07:00
Kamron Batman
ca3b173c4c
fix: Removes timer error for world in initial state, and removes OPL requirement for spellbooks (#1197) 2022-10-19 02:32:04 -07:00
Kamron Batman
791128f238
fix: Fixes timer orphaning issue (#1196)
* Fixes an edge case where a check to see if a timer was being executed resulted in it not being properly detached on stop. Fixed this by changing how we determine what timer is currently being executed.
* Adds execution count to #DEBUG_TIMERS so shards can get notified (rudimentarily for now) about sequentially executing long chains of timers.

Unfortunately, for now, there is no good option when it comes to executing timers. If we execute let's say 500, and defer the rest, that makes all timers effectively 8ms off until it "catches up". Depending on the shard, that may never happen.
2022-10-18 18:14:26 -07:00
Kamron Batman
919b7e9416
fix: Adds more debugging to the timer system. Simplifies the timer pool. (#1195) 2022-10-17 23:25:49 -07:00
Kamron Batman
9b2b34f5fb
fix: Fixes debug say (#1193) 2022-10-16 17:57:14 -07:00
Kamron Batman
3396338926
fix: Fixes blocking sockets (#1191) 2022-10-15 22:23:34 -07:00
Kamron Batman
53ebc66a93
fix: Fixes code gen of nested classes (#1190) 2022-10-15 19:58:34 -07:00
Kamron Batman
8479306279
fix: Removes SetTypeRef for generated code. (#1189) 2022-10-15 15:12:49 -07:00
Kamron Batman
ffdc08259f
fix: Adds name support for all mods (#1128) 2022-10-15 10:46:31 -07:00
Kamron Batman
e1e30998ba
fix: Adds ReadType/Write(Type) and improves type referencing (#1172)
## Changes
* Improves type hashing by introducing xxHash3 (64bit)
* Removes individual `tdb` files in favor of a single `SerializedTypes.db` file. This file is only used to identify a type that is being deserialized, which doesn't exist.
* Adds duplicate type alias detection
* Adds `AssemblyHandler.FindTypeByHash`

View changed files whitespaces: https://github.com/modernuo/ModernUO/pull/1172/files?diff=split&w=1

## SerializedTypes.db
The serialized types file is used to get back the original name of a type in case it no longer exists in code. This can easily be necessary if a class is renamed in code and no `TypeAlias` is provided.

### Format
byte[4] - version
byte[4] - count
--array--
byte[8] - xxHash
byte[1] - flag, 0 - null, 1 - not null
byte[n] - Full class name in UTF8

### Example
<img width="472" alt="SerializedTypes_Example" src="https://user-images.githubusercontent.com/3953314/195255429-31d24293-6bd1-419e-811b-07874dd0f78d.png">

## Benchmarks
Serialized 500 Type fields. The 8192bytes comes from the _ConcurrentQueue_ that would later be used for SerializedTypes.
Note that the queue is never cleared, so it's size grew considerably.
```cs
|               Method |     Mean |    Error |   StdDev | Allocated |
|--------------------- |---------:|---------:|---------:|----------:|
|      BenchmarkXXHash | 18.44 us | 0.278 us | 0.260 us |    8192 B |
| BenchmarkTypeStrings | 25.09 us | 0.292 us | 0.259 us |         - |
```

TODO:
* Add support in the Serialization Generator for `ReadType()` and `Write(Type)`
* Remove `SetTypeRef` from Serialization Generator
2022-10-11 22:17:22 -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
2806e5d4b7
feat: Adds reflect damage ability. Fixes magical barrier (#1184) 2022-10-08 10:39:28 -07:00
Kamron Batman
43e7fe29c2
feat: Adds Monster Abilities (#1179)
* Adds ability to create monster abilities
* Adds Fire/Cold/Chaos Breath
* Adds Grasping Claw
* Adds Summon Skeletons & Summon Undead w/ Polymorph
2022-10-01 21:09:36 -07:00
Kamron Batman
4946afee51
fix: Fixes loading map and static files (#1177) 2022-09-29 16:02:41 -07:00
Kamron Batman
cd5541ec74
fix: Fixes compiling with .NET 7 SDK (#1176) 2022-09-28 21:17:30 -07:00
mark1145
060edaa76a
fix: Fixes disarm, strangle, curse, summons, looting rights, creatures attacking, and items going to the floor (#1174)
* Fixes disarm
* Fixes strangle not refreshing
* Fixes curse not refreshing
* Fixes 125% bonus to looting rights
* Fixes mobs attacking each other, or not attacking each other
* Fixes items dropping to the floor
* Fixes protection spell
* Fixes cure sending wrong message
2022-09-27 22:19:15 -07:00
Kamron Batman
906ec095b9
fix: Use the latest number for the next serial after world load. (#1171) 2022-09-13 21:25:21 -07:00
Kamron Batman
4499c8397d
fix: Fixes pooled ref list resizing (#1169) 2022-09-12 09:06:50 -07:00
Kamron Batman
b44c69bcee
fix: Source generates map item serialization (#1166) 2022-09-07 01:13:20 -07:00
Kamron Batman
93c2c824dd
feat: Bumps serialization generator (v2.3) to add diagnostics (#1163) 2022-09-06 00:18:15 -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
1a44d824d9
fix: Adds better error message for missing assemblies (#1150)
Adds better error messaging for when the server cannot find a dependency. The most common error is MimeKit is missing because the assemblyDirectories field in modernuo.json does not have any valid paths.
2022-08-27 18:55:43 -07:00
mark1145
b8146f26f1
fix: Fixes mobile titles not displaying properly (#1149) 2022-08-27 13:31:22 -07:00
Kamron Batman
2d95fb20a6
fix: Adds expansion specific mobile status version (#1145) 2022-08-22 21:04:59 -07:00
Kamron Batman
946a2acabf
fix: Fixes ref list infinite loop (#1142) 2022-08-21 14:04:29 -07:00
Daniel Knight
6e168c137b
fix: Fixes random skill chosen based on expansion (#1139) 2022-08-17 08:52:18 -07:00
Kamron Batman
2ae762904f
fix: Fixes serializing strings and uses memory mapped files for loading (#1133) 2022-08-16 08:59:00 -07:00
Kamron Batman
ec422988f5
fix: Fixes logging of world load (#1131) 2022-07-23 16:14:54 -07:00
Kamron Batman
fa3515f930
fix: Cleans up some comments and spell code (#1120) 2022-07-16 19:45:41 -07:00
Kamron Batman
d6d02de296
fix: Fixes spell mechanics and misc bugs (#1118)
- [X] Fixes NPE from account tags.
- [X] Fixes bad skill check due to missing cast to double.
- [X] Fixes water elemental duration.
- [X] Standardizes spell summon duration by expansion.
2022-07-14 22:01:59 -07:00
Kamron Batman
0d19a5ff99
fix: Do not use unsafe work queue for auto archiving (#1116) 2022-07-14 11:27:29 -07:00
Kamron Batman
a4168dc219
fix: Fixes pooled timer detach (#1115)
- [X] Fixes timers not returning on detach
2022-07-14 11:14:37 -07:00
Kamron Batman
9c374861d9
fix: Delays getting item id of craftables until they are needed (#1114)
- [X] Fixes world loading for multi.mul. It was taking 10-15s, now takes 1s or less.
- [X] Fixes loading the crafting system by offloading getting a label number to when the item needs it.
2022-07-10 22:44:24 -07:00
Kamron Batman
8303c74379
fix: Fixes ValueStringBuilder initial rented buffer (#1111)
Fixes issue with ValueStringBuilder having an empty initial buffer.
2022-07-03 08:14:54 -07:00
Kamron Batman
7c981b2d10
fix: Adds throwing weapons (#1107) 2022-07-01 17:03:27 -07:00