1 line
No EOL
12 KiB
JSON
1 line
No EOL
12 KiB
JSON
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"building-server/","title":"Creating a build","text":"<p>The server software must be built before it can be run.</p> WindowsOSX/Linux <p>Using windows terminal, git bash, or powershell, run: <pre><code>./publish.cmd <release|debug> <os> <arch>\n</code></pre></p> <p>Using terminal, run: <pre><code>./publish.sh <release|debug> <os> <arch>\n</code></pre></p> <p> <code>os</code> (Optional) The operating system to build the server against. If not specified then the server will be built for the same operating system.</p> <p> <code>win</code> <code>osx</code> <code>linux</code></p> <p> <code>arch</code> (Optional) The architecture to build the server against. If not specified then the server will be built for x64.</p> <p><code>x64</code> <code>arm64</code></p>"},{"location":"installation/","title":"Installation","text":"WindowsOSXLinux"},{"location":"installation/#prerequisites","title":"Prerequisites","text":"<ol> <li>Download and install the latest .NET 10 SDK</li> <li> <p>Download and install from here</p> <p>Tip</p> <p>Use Windows Terminal as your command prompt.</p> </li> </ol>"},{"location":"installation/#install-modernuo","title":"Install ModernUO","text":"<ol> <li>Navigate to the folder where you want to install ModernUO.</li> <li>Using Windows Terminal run: <pre><code>git clone https://github.com/modernuo/modernuo\ncd modernuo\n</code></pre></li> </ol>"},{"location":"installation/#prerequisites_1","title":"Prerequisites","text":"<ol> <li>Download and install the latest .NET 10 SDK.</li> <li>Using terminal, install homebrew and git: <pre><code>/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\"\nbrew install git\n</code></pre></li> </ol>"},{"location":"installation/#install-modernuo_1","title":"Install ModernUO","text":"<ol> <li>Using terminal, navigate to the folder where you want to install ModernUO and run: <pre><code> git clone https://github.com/modernuo/modernuo\n cd modernuo\n</code></pre></li> </ol>"},{"location":"installation/#prerequisites_2","title":"Prerequisites","text":"<ol> <li>Download and install the latest .NET 10 SDK.</li> <li> <p>Using bash, install git: <pre><code>sudo apt update && sudo apt install git\n</code></pre></p> <p>Note</p> <p>The command to install git might be different for your flavor of linux. Consult your local Google search for answers.</p> </li> </ol>"},{"location":"installation/#install-modernuo_2","title":"Install ModernUO","text":"<ol> <li>Using bash, navigate to the folder where you want to install ModernUO and run: <pre><code> git clone https://github.com/modernuo/modernuo\n cd modernuo\n</code></pre></li> </ol>"},{"location":"readme/","title":"ModernUO Website","text":""},{"location":"readme/#development","title":"Development","text":"<ol> <li>Install Python's <code>pip</code> package manager</li> <li>Install MkDocs: <code>pip install mkdocs</code></li> <li>Install Required Extensions</li> <li><code>pip install pymdown-extensions</code></li> <li><code>pip install mkdocs-material</code></li> <li>Launch development server: <code>mkdocs</code></li> </ol>"},{"location":"starting-server/","title":"Starting the server","text":"<p>Now that the software has been built, all you need to do is run it! Everything is run from the Distribution folder.</p> WindowsOSX/LinuxGame Files <p>Using windows terminal, git bash, or powershell, run: <pre><code>cd Distribution\nModernUO.exe\n</code></pre></p> <p>Using terminal, run: <pre><code>cd Distribution\ndotnet ModernUO.dll\n</code></pre></p> <p>Note</p> <p>Game files are required to initiate a server. Upon the initial launch, you will encounter a prompt asking for the location of your game files or ClassicUO installation. ClassicUO installations should be configured to reference game files directory within settings.json file.</p> <p>Tip</p> <p>Game files are not directly distributed in ModernUO, find the latest version to download these at client download</p>"},{"location":"scripting-guide/serialization/","title":"Serialization / Savings","text":"Generic persistenceCodegen <p><code>Persistence.Serialize</code> and <code>Persistence.Deserialize</code> is replaced with GenericPersistence class</p> <p>Example of how to persist a custom system.</p> <pre><code>namespace Server.ExampleSystem\n{\n public static class ExampleSerialization\n {\n public static void Configure()\n {\n GenericPersistence.Register(\"ExampleSystem\", Serialize, Deserialize);\n }\n\n public static void Serialize(IGenericWriter writer)\n {\n // Do serialization here\n writer.WriteEncodedInt(0); // version\n }\n\n public static void Deserialize(IGenericReader reader)\n {\n // Do deserialization here\n var version = reader.ReadEncodedInt();\n }\n }\n}\n</code></pre>"},{"location":"scripting-guide/serialization/#basic-info","title":"Basic info","text":"<p>ModernUO can programatically generate migrations. This feature is based on internal C# Source generators More info</p> <p>Old way of serializing objects: <pre><code>public class ExampleItem : Item\n{\n private string _exampleText;\n\n [CommandProperty(AccessLevel.GameMaster)]\n public string ExampleText\n {\n get => _exampleText;\n set\n {\n if (value != _exampleText)\n {\n _exampleText = value;\n this.MarkDirty();\n }\n }\n }\n\n [Constructible]\n public ExampleItem(string text) : base(0)\n {\n Example = text;\n }\n\n public ExampleItem(Serial serial) : base(serial)\n {\n }\n\n public override void Serialize(IGenericWriter writer)\n {\n base.Serialize(writer);\n\n writer.WriteEncodedInt(0); //Version\n writer.Write(_exampleText);\n }\n\n public override void Deserialize(IGenericReader reader)\n {\n base.Deserialize(reader);\n\n var version = reader.ReadEncodedInt();\n\n // version 0\n _exampleText = reader.ReadString();\n }\n}\n</code></pre></p> <p>Same class serialized with codegen <pre><code>[SerializationGenerator(0)]\npublic partial class ExampleItem : Item\n{\n [SerializableField(0)]\n [SerializedCommandProperty(AccessLevel.GameMaster)]\n private string _exampleText;\n\n [Constructible]\n public ExampleItem(string text) : base(0)\n {\n _exampleText = text;\n }\n}\n</code></pre></p>"},{"location":"scripting-guide/serialization/#step-by-step","title":"Step by step","text":"<ol> <li>Add <code>SerializationGenerator(versionNumber)</code> to your class and make the class <code>partial</code> <pre><code>[SerializationGenerator(0)]\npublic partial class ExampleItem : Item\n</code></pre></li> <li>Delete the constructor with <code>Serial serial</code></li> <li>Delete the <code>Serialize</code> and <code>Deserialize</code> methods.</li> <li>Add <code>SerializableField(fieldOrder)</code> attribute to all field you want to serialize. <pre><code>[SerializableField(0)]\nprivate string _exampleText;\n</code></pre></li> <li>Run <code>publish.cmd</code>.</li> </ol> <p>ModernUO will create migration files for you. In this case \"Server.Items.ExampleItem.v0.json\" and \"Server.Items.ExampleItem.Serialization.cs\". These files contains all information and classes needed for ModernUO to serialize/deserialize your objects.</p>"},{"location":"scripting-guide/serialization/#migrations","title":"Migrations","text":"<p>When new field is added to the serialization, you need to increment <code>versionNumber</code> and run <code>publish.cmd</code> again to generate a migration file for the new version. Here is little example.</p> <p>New class code will look like this: <pre><code>[SerializationGenerator(1)]\npublic partial class ExampleItem : Item\n{\n [SerializableField(0)]\n private string _exampleText;\n\n [SerializableField(1)]\n [SerializedCommandProperty(AccessLevel.GameMaster)]\n private string _addedExampleTest;\n\n [Constructible]\n public ExampleItem(string text, string addedText) : base(0)\n {\n _exampleText = text;\n _addedExampleTest = addedText;\n }\n}\n</code></pre></p> <p>Your IDE (Visual Studio, Rider, or VSCode), will show errors and the ModernUO will not compile. This happens because the code generator builds a migration from V0 to V1 and a new struct <code>V0Content</code> with all of the V0 fields is generated. ModernUO is expecting the developer to create a migration from the old version to the new. Now create a <code>MigrateFrom</code> method for each of the older versions, in this case V0, to the new version.</p> <pre><code>private void MigrateFrom(V0Content content)\n{\n _exampleText = content.ExampleText;\n}\n</code></pre> <p>Tip</p> <p>Since the class is <code>partial</code>, you can create a standalone file for migrations to keep them organized. For example \"ExampleItem.Migrations.cs\"</p> <p>Your migration is now complete.</p>"},{"location":"scripting-guide/serialization/#migrating-from-pre-codegen","title":"Migrating from pre-codegen","text":"<p>To migrate from pre-codegen serialization, change the old Deserialize method to this: <pre><code>private void Deserialize(IGenericReader reader, int version)\n</code></pre></p> <p>This method will be automatically called when the serialization generator doesn't have a migration for for that older version. In this method you can make old fashioned deserializations that are mostly compatible with RunUO.</p>"},{"location":"scripting-guide/serialization/#after-deserialization","title":"After Deserialization","text":"<p>To execute code after the deserialization, add the <code>AfterDeserialization()</code> attribute to a method. <pre><code>[AfterDeserialization]\nprivate void AfterDeserialization()\n{\n // Some code here\n}\n</code></pre></p> <p>Tip</p> <p>By default, <code>AfterDeserialization</code> is executed synchronously right after the actual deserialization. Passing <code>false</code> to the attribute will make it execute after all deserializations.</p>"},{"location":"scripting-guide/serialization/#serializing-non-entity-classes","title":"Serializing Non-Entity Classes","text":"<p>Sometimes you might need to serialize a nested object that is not an <code>ISerializable</code>. The syntax is largely the same except you must also mark the parent object for dirty tracking by using the <code>DirtyTrackingEntity</code> attribute. A good example of this is \"AquariumState\".</p> <p>Note</p> <p>Non-entity classes cannot be serialized by reference since that would require a reference Serial or ID. This means if the object is a serializable property on multiple objects, it will be serialized multiple times and will effectively get duplicated on world load. Consider either making it an <code>ISerializable</code> type and building world load/save mechanisms, or do not serialize the nested object directly. Instead opt for a global lookup, serialize with generic persistence, and then reattach to the objects using the <code>WorldLoad</code> event sink.</p>"},{"location":"scripting-guide/timers/","title":"Timers","text":"<p>ModernUO completely changed the timer system to use an optimized data structure called a timer wheel. This will allow shards to add thousands of timers without slowing down the server. Traditionally the timer system used a thread and locked to add/remove/process timers. All of this is gone. With the new timer system there is no TimerPriority. This can be deleted entirely from your scripts.</p>"}]} |