Code Monkey home page Code Monkey logo

open-terraria-api's Introduction

Open Terraria API GitHub Workflow AppVeyor branch Nuget (with prereleases) License: GPL v3 Wiki

The Open Terraria API, known as OTAPI, is a low-level API for Terraria that rewrites and hooks into the official binaries for others to use.

It is primarily a server modification for the PC edition of Terraria, however v3 has seen additional support for the PC client assemblies, and the mobile windows server assembly too.

The upcoming branch is a ground up redesign and will take the place of the master branch when fully complete over in projects.

Significant changes this redesign brings are...

  • Modular script system, allowing single file patches using csharp, javascript and lua
  • A strong set of libraries with methods and extensions for use in extending or contributing back
  • .NET6 projects for all without Terraria's dependency to net4.

The stack consists upon:

  • OTAPI Scripts, a directory containing all the scripts used to patch the pc, mobile & client assemblies.
  • OTAPI Patcher, a program to process all OTAPI Scripts and produce the final OTAPI assemblies for all variants and also supports creating the NuGet packages.
  • ModFramework, a library that extends MonoMod and provides higher level patching methods and extensions, such as remapping fields to properties and arrays to collections
  • ModFramework Modules, additional plugins to add c#, javascript and lua scripts, for both patching and runtime.
  • FNA, for use on the client variants, for a consistent codebase on all platforms. Servers use the Xna shims instead.
  • MonoMod, for applying patches and generating runtime events/hooks.

Installation

For servers all you need to do is add a NuGet reference to OTAPI. See more in the wiki topic about server usage.

For client installations, you can download the launcher from the releases section, and follow the wiki topic.

Terraria support

Server assemblies used in the patching process are freely available at Terraria's website.

If you intend to patch a client version, you must own an existing copy of Terraria and have it installed in the default path of your machine. The OTAPI Project does not host or contain the original source file so it will extract files from and patch your existing installation.

All OTAPI builds support C#/lua/js scripts via plugins, however you may need to install the additional ModFramework module plugins if you use this in another project.

Variant Status Version
Windows Server for PC Cross platform NuGet package produced. OTAPI.Upcoming 1.4.2.3
Linux Server for PC not required or supported
MacOS Server for PC not required or supported
Windows Server for Mobile Cross platform NuGet package produced. OTAPI.Upcoming.Mobile 1.4.0.5
Linux Server for Mobile not required or supported
MacOS Server for Mobile not required or supported
Windows Client for PC Full support to install a patched OTAPI into an existing Windows install (steam confirmed), Xna is replaced with FNA and x64 enabled. 1.4.2.3
MacOS Client for PC Full support to install a patched OTAPI into an existing MacOS install (Steam/Gog confirmed) 1.4.2.3
Linux Client for PC not yet supported but planned. should be similar to MacOS
iOS Client not supported or planned
Android Client not supported or planned
tModLoader Server work has conducted in testing support for TML on Terraria 1.3, but no clear outcome until 1.4 support is released. 1.3.5.3

All packages

OTAPI.Upcoming OTAPI.Upcoming.Mobile
ModFramework
ModFramework ModFramework ModFramework


Bitcoin donations are welcomed via address 3PRfyMh1brjCqzkw9az2aT7yNjbfkwFZqo

QR

open-terraria-api's People

Contributors

arthri avatar axeelander avatar deathcradle avatar dependabot[bot] avatar drunderscore avatar hakusaro avatar ijwu avatar kevzhao2 avatar patrikkk avatar punchready avatar sgkoishi avatar signaturebeef avatar tylerjwatson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

open-terraria-api's Issues

OTAPIv3 Client; Windows Launcher: Fails to launch due to missing libwinpthread-1.dll

Describe the bug
OTAPIv3 client fails to launch due to libwinpthread-1.dll being missing.

To Reproduce

Expected behavior
The game launches without issues.

Stack trace
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL '.\x64\FNA3D.dll' or one of its dependencies: The specified module couldn't be resolved. (0x8007007E) at System.Runtime.InteropServices.NativeLibrary.LoadFromPath(String libraryName, Boolean throwOnError) at System.Runtime.InteropServices.NativeLibrary.Load(String libraryPath) at OTAPI.Client.Launcher.Actions.OTAPI.ResolveNativeDep(String libraryName, Assembly assembly, Nullable`1 searchPath) in D:\a\Open-Terraria-API\Open-Terraria-API\OTAPI.Client.Launcher\Actions\OTAPI.cs:line 190 at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags) at Microsoft.Xna.Framework.SDL2_FNAPlatform.CreateWindow() in D:\a\Open-Terraria-API\Open-Terraria-API\FNA\src\FNAPlatform\SDL2_FNAPlatform.cs:line 284 at Microsoft.Xna.Framework.Game..ctor() in D:\a\Open-Terraria-API\Open-Terraria-API\FNA\src\Game.cs:line 274 at Terraria.Main..ctor() at HostGame..ctor() in csharp\plugins\modules\otapi-runtime\HostGame.cs:line 37 at HostGamePlugin.<>c.<PatchClient>b__3_0() in csharp\plugins\modules\otapi-runtime\HostGamePlugin.cs:line 64 at OTAPI.Hooks.Main.InvokeCreate() in patchtime\csharp\plugins\toplevel\otapi\HookMainCtor.Client.cs:line 60 at Terraria.Program.orig_LaunchGame(String[] args, Boolean monoArgs) at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs) in patchtime\csharp\plugins\patches\otapi\Terraria.Program.Both.cs:line 139 at Terraria.WindowsLaunch.Main(String[] args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at OTAPI.Client.Launcher.Actions.OTAPI.Launch(String[] args) in D:\a\Open-Terraria-API\Open-Terraria-API\OTAPI.Client.Launcher\Actions\OTAPI.cs:line 56 at OTAPI.Client.Launcher.Program.Main(String[] args) in D:\a\Open-Terraria-API\Open-Terraria-API\OTAPI.Client.Launcher\Program.cs:line 66

Platform and patch info (please complete the following information):

  • OS: Windows 8.1
  • Assembly and version you are patching: Terraria.exe 1.4.3.2
  • Version of OTAPI/git commit: 57114e0
  • .NET runtime: .NET 6

Additional context
I looked up what happened using ProcMon, and it seems that it is looking for libwinpthread-1.dll. Maybe my system is outdated and the DLL is part of all newer system versions? I don't know.
For now I installed mingw-w64, and copied the DLL to OTAPI's folder, and it works. Kind of "resolved", but I think it'd be better if OTAPI could fetch all the libraries it needs so the user doesn't have to go hunt DLLs on their own.

Exception trying to load `HostGamePlugin` on Linux (or, launcher tries to load a Windows plugin on Linux)

Describe the bug
Installing and starting OTAPI fails during load of HostGamePlugin

To Reproduce

  • Change base game path to /home/james/.steam/steam/steamapps/common/Terraria/
  • Install OTAPI
  • Launch OTAPI

Expected behavior
No load error exception

Stack trace
here

Platform and patch info (please complete the following information):

  • OS: Linux JAMES-DESKTOP 5.10.41-1-MANJARO #1 SMP PREEMPT Fri May 28 19:10:32 UTC 2021 x86_64 GNU/Linux
  • Assembly and version you are patching: Terraria Server v1.4.2.3
  • Version of OTAPI/git commit: 318aec0
  • .NET runtime: `5.0.203

OTAPI Client does not work at all.

Describe the bug
OTAPI also included make clients with using Terraria's source code but it does not start the client because XNA Modification removes main bootable code.

To Reproduce

  • Use OTAPI.Client.Xna solution and build client OTAPI
  • Use Client Test to test the OTAPI
  • Observe.

Expected behavior
The client should start without issues.

Actual result
Client can not be started because XNA method Microsoft.Xna.Framework.Game.Run() was removed from OTAPI due XNA modification.

Notes: Client OTAPI can not be compiled without this modification. Both real Terraria and OTAPI checked with decompiler. Original one contains the boot code but OTAPI does not. Also this is not the only critical method removed from the OTAPI due the modification.

Stack trace

at OTAPI.Tests.Common.dll.GameRunner.Main  (IL offset: 0x6a)
at OTAPI.Tests.Common.dll.GameRunner.Menu  (IL offset: 0x12d)
at OTAPI.Tests.Common.dll.<>c__DisplayClass5_0.<Menu>b__0  (IL offset: 0xc)
at OTAPI.Tests.Common.dll.GameRunner.StartGame  (IL offset: 0x12)
at OTAPI.dll.WindowsLaunch.Main  (IL offset: 0x30)
at OTAPI.dll.Program.LaunchGame  (IL offset: 0xffffffff)
System.MissingMethodException: Metot bulunamadı: 'Void Microsoft.Xna.Framework.Game.Run()'.
   konum: Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   konum: Terraria.WindowsLaunch.Main(String[] args)
   konum: OTAPI.Tests.Common.GameRunner.StartGame(String[] args) \Open-Terraria-API-master\OTAPI.Tests\OTAPI.Tests.Common\GameRunner.cs içinde: satır 92
   konum: OTAPI.Tests.Common.GameRunner.<>c__DisplayClass5_0.<Menu>b__0() \Open-Terraria-API-master\OTAPI.Tests\OTAPI.Tests.Common\GameRunner.cs içinde: satır 113
   konum: OTAPI.Tests.Common.GameRunner.Menu(String[] args) \Open-Terraria-API-master\OTAPI.Tests\OTAPI.Tests.Common\GameRunner.cs içinde: satır 147
   konum: OTAPI.Tests.Common.GameRunner.Main(String[] args) \Open-Terraria-API-master\OTAPI.Tests\OTAPI.Tests.Common\GameRunner.cs içinde: satır 61

Screenshots
Not available.

Platform and patch info (please complete the following information):

  • OS: Windows 10 Enterprise
  • Assembly and version you are patching: TerrariaServer 1.4.2.3
  • Version of OTAPI/git commit: latest
  • .NET runtime: .Net Framework 4.7.2

OTAPIv3 Client; Windows launcher: Cannot paste text.

Describe the bug
It is possible to copy or cut text from the game, but not to paste text.
Attempting to copy or paste text does not do anything, cutting simply deletes the text.

To Reproduce
Steps to reproduce the behavior:

  • Download the windows launcher from https://github.com/DeathCradle/Open-Terraria-API/releases/tag/launcher-windows.
  • Extract it, and run OTAPI.Client.Launcher.exe.
  • Press the "Build OTAPI" button, and wait until the operation finishes.
  • Press the "Launch modded Terraria (otapi)" button.
  • Once the game has loaded, join a singleplayer/multiplayer world.
  • Once in the world, copy text from the chat/a sign using Ctrl+C.
  • Attempt to paste it in the chat/a sign using Ctrl+V
    ->Nothing happens.

Expected behavior
It is possible to paste text in game, just as it is possible in vanilla.

Platform and patch info (please complete the following information):

  • OS: Windows 8.1
  • Assembly and version you are patching: Terraria.exe 1.4.3.2
  • Version of OTAPI/git commit: 8f0437f
  • .NET runtime: .NET 6

Missing `RailSDK.Net` assembly

This happens upon player join. I'm not sure where to download this assembly

Additional Info:

Server: Running on Windows 10 machine
Using NET 5

image

start-server files

start-server files still point to tdsm.exe which is now TerrariaServer.exe

Some suggestions

Overall otapi 3 works really well server side but there was a few inconsistencies compared to the original source

PlayerAnnounce hook
Originally this hook just checked if the hook was handled and returned accordingly. Now it logs to the console that the player has left or joined regardless
image

Netplay.Open/ClosePort()
Not sure if this is otapi related but in v2 all the code in those methods were removed.
OpenPort in v2
image

OpenPort now
image

All of these differences are pretty subtle but they get in the way while trying to work with the server

Platform Mismatch

OTAPI.Server.Launcher compiles for AnyCPU but has a dependency on Steamworks.NET which has a ref library that targets AMD64. This causes consuming projects to raise platform mismatch warnings

Segfault trying to "Launch modded Terraria"

Describe the bug
A segfault occurs

To Reproduce

  • Change base game path to /home/james/.steam/steam/steamapps/common/Terraria/
  • Install OTAPI
  • Remove csharp/plugins/modules/otapi-runtime/HostGamePlugin.cs (required due to #38)
  • Launch OTAPI

Expected behavior
The game to launch, modded with OTAPI

Stack trace
No stack trace available, this is a segfault. GDB provides no relevant output, but if you think it does I can provide it. i lied
output before segfault
GDB backtrace:

0x00007ffff7b7da0e in __strcmp_avx2 () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff7b7da0e in __strcmp_avx2 () at /usr/lib/libc.so.6
#1  0x00007ffff4bc157d in OPENGL_PrepareWindowAttributes () at /home/james/otapi/bin/Release/net5.0/ubuntu.16.04-x64/publish/lib64/libFNA3D.so.0
#2  0x00007ffff4bbf4d1 in FNA3D_PrepareWindowAttributes () at /home/james/otapi/bin/Release/net5.0/ubuntu.16.04-x64/publish/lib64/libFNA3D.so.0
#3  0x00007fff81e0289e in  ()
#4  0x0000000004254e45 in  ()
#5  0x00007ffff74f9848 in  () at /home/james/otapi/bin/Release/net5.0/ubuntu.16.04-x64/publish/libcoreclr.so
#6  0x00007fffffffd080 in  ()
#7  0x0000000000000000 in  ()

Platform and patch info (please complete the following information):

  • OS: Linux JAMES-DESKTOP 5.10.41-1-MANJARO #1 SMP PREEMPT Fri May 28 19:10:32 UTC 2021 x86_64 GNU/Linux
  • Assembly and version you are patching: Terraria Server v1.4.2.3
  • Version of OTAPI/git commit: 318aec0
  • .NET runtime: `5.0.203

OTAPIv3 Client: user-friendlyness

This is a rather broad topic & issue, but I'll try to get straight to the point.
As it currently stands, the client isn't very user friendly in my opinion, for a few reasons:

  • Many many files:
    the folder contains many files and subfolders, that could maybe be organised better.
    Could have a DLL folder for all libraries, a subfolder for each kind (FNA gets its subfolder, Avalonia too, etc), a folder for OTAPI MFW modifications, and maybe moving (or deleting?) the installation, single use files somewhere else.

  • Leftover test files:
    Some testing files for the MFW mods were left there, and while this can provide examples, I think that by default no scripts should be preinstalled, and only up to the user to do this.

  • MFW lacks documentation about plugins/scripts:
    I have searched a bit, and I couldn't find any tutorial other than the examples given already. Examples are nice, but they don't teach much more than what one is able to salvage from them. If possible I'd greatly appreciate to see a MFW wiki being created, but I'm aware that it may take time.

  • Basic UI?
    Not really a great point, more of a nitpick, but I think that the launcher's UI could be improved. This I could do a PR probably.
    Once I clicked "Build otapi" instead of "Launch otapi", I think you can understand my pain.

I think that it is potentially the best Terraria modding framework, but it may become not broadly used due to this^. Of course it is quite niche compared to tML, but I believe it could be used for things such as server custom clients - in that case being user-friendly would be worthwhile.

Pressure plate collision hook doesn't work

Hello!
I've been trying to update my TShock plugin that utilizes the OTAPI.Hooks.Collision.PressurePlate hook and it doesn't seem to work.

To test this out, I've written a simple OTAPI Server that utilizes this hook.
Even on this server, the hook wouldn't trigger.

I've attached my code in the spoiler below.
Other hooks work as one would expect.

Simple OTAPI Server code

Target framework: .net6.0
Built on the latest version of OTAPI (3.1.20) got from NuGet

using OTAPI;
using Terraria;

namespace OTest;

internal abstract class Program
{
    private static void Main(string[] args)
    {
        Console.WriteLine("Starting....");
        On.Terraria.Main.DedServ += OnDedicatedServer;
        Hooks.Collision.PressurePlate += OnPressurePlate;
        Hooks.NetMessage.PlayerAnnounce += OnPlayerAnnounce;
        WindowsLaunch.Main(args);
    }

    private static void OnDedicatedServer(On.Terraria.Main.orig_DedServ orig, Main self)
    {
        Console.WriteLine("Dedicated server start!");
        orig(self);
    }

    private static void OnPressurePlate(object? sender, Hooks.Collision.PressurePlateEventArgs args)
    {
        Console.WriteLine($"Entity {args.Entity.entityId} triggered pressure plate");
    }

    private static void OnPlayerAnnounce(object? sender, Hooks.NetMessage.PlayerAnnounceEventArgs args)
    {
        Console.WriteLine($"Announcing player: {args.Text}");
    }
}

Weird OpCode issues while hooking QuickStack in OTAPI.Patcher.Engine.Modifications.Hooks.Item

Debugger Output:
System.ArgumentNullException: 'Value can not be null. Parameter Name: parameter'
at \OTAPI.Patcher.Engine\Extensions\ILProcessor\Insert.cs line 67

Console Output:
-> Hooking Chest.PutItemInNearbyChest...
Error executing modification QuickStack: Exception has been thrown by the target of an invocation.
at: System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at: System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at: System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at: System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at: OTAPI.Patcher.Engine.Extensions.ILProcessor.InsertExtensions.AnonymousToInstruction(Object anon) \OTAPI.Patcher.Engine\Extensions\ILProcessor\Insert.cs: line 67
at: OTAPI.Patcher.Engine.Extensions.ILProcessor.InsertExtensions.InsertAfter(ILProcessor processor, Instruction target, Object[] instructions) \OTAPI.Patcher.Engine\Extensions\ILProcessor\Insert.cs: line 86
at: OTAPI.Patcher.Engine.Modifications.Hooks.Item.QuickStack.Run() \OTAPI.Modifications\OTAPI.Modifications.Chest.Item.Add\Modifications\QuickStack.cs: line 29
at: OTAPI.Patcher.Engine.Patcher.RunModifications() \OTAPI.Patcher.Engine\Patcher.cs: line 256

OTAPIv3 PC; Nuget package: outdated/incorrect dependencies.

The OTAPI.Upcoming nuget packages 3.0.37-alpha reference dependencies:

ModFramework (>= 1.0.39-alpha)
MonoMod (>= 22.3.23.4)
MonoMod.RuntimeDetour (>= 22.3.23.4) 

but ships binaries that are built against updated ones from 6596b5b:

ModFramework 1.0.40-alpha
MonoMod 22.5.1.1
MonoMod.RuntimeDetour 22.5.1.1

therefore requiring consumers to manually install the updated dependencies.

Send section problem

If a section is very complicated, it's size will overflow the buffer. Clients recieved the broken tiles data and throw an exception, it causes the section can't be shown correctly.
This bug only exists in modified server, vanilla server works well.
Expand the buffer can solve it as I tried.

OTAPIv3 Client; Windows Launcher: Cannot maximize the game's windows.

Describe the bug
It isn't possible to maximize the game's window, doing so ends up in the action being reverted.

To Reproduce
Steps to reproduce the behavior:

  • Download the windows launcher from https://github.com/DeathCradle/Open-Terraria-API/releases/tag/launcher-windows.
  • Extract it, and run OTAPI.Client.Launcher.exe.
  • Press the "Build OTAPI" button, and wait until the operation finishes.
  • Press the "Launch modded Terraria (otapi)" button.
  • Once the game has loaded, attempt to maximize the window.
    ->The windows is automatically set back to its previous size.

Expected behavior
The windows should be maximized.

Platform and patch info (please complete the following information):

  • OS: Windows 8.1
  • Assembly and version you are patching: Terraria.exe 1.4.3.2
  • Version of OTAPI/git commit: 57114e0
  • .NET runtime: .NET 6

Additional context
Despite this issue, it is possible to use the game "Fullscreen" settings. I prefer using maximized but non-fullscreen, however.

ZipDownload doesn't unwrap exceptions properly

var data = client.GetByteArrayAsync(url).Result;

The above line causes download errors to be swallowed and displayed as "A task was canceled."

Unhandled exception. System.AggregateException: One or more errors occurred. (A task was canceled.)
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at OTAPI.Patcher.Common.DownloadZip(String url) in \Open-Terraria-API\OTAPI.Patcher\Common.cs:line 73
   at OTAPI.Patcher.Targets.PCServerTarget.DownloadServer() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 43
   at OTAPI.Patcher.Targets.PCServerTarget.Patch() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 88
   at OTAPI.Patcher.Program.Main(String[] args) in \Open-Terraria-API\OTAPI.Patcher\Program.cs:line 28
--- End of stack trace from previous location ---

   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at OTAPI.Patcher.Common.DownloadZip(String url) in \Open-Terraria-API\OTAPI.Patcher\Common.cs:line 73
   at OTAPI.Patcher.Targets.PCServerTarget.DownloadServer() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 43
   at OTAPI.Patcher.Targets.PCServerTarget.Patch() in \Open-Terraria-API\OTAPI.Patcher\Targets\PCServerTarget.cs:line 88
   at OTAPI.Patcher.Program.Main(String[] args) in \Open-Terraria-API\OTAPI.Patcher\Program.cs:line 28

fwiw, my error was a network issue causing timeout

OTAPI v3 - Client Index doesn't get passed into SendBytesEventArgs

Describe the bug
The SendBytes hook doesn't pass the client's index into its arguments

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

image

Platform and patch info

  • OS: Windows
  • Assembly and version you are patching: TerrariaServer v1.4.3.2
  • Version of OTAPI/git commit: c6bd0df
  • .NET runtime: NET 6

Can't Build on linux/Ubuntu 16.04

I have been successful with building and launching this on windows 10.
However I can't for the life of me build this without errors on an Ubuntu system.

I thought i was nearly there but then it couldn't find "Terraria.WindowsLaunch" in "GameRunner.cs"

This is my current process of building following The Build Guide
Step 1. Clone Master repo
Step 2. Place the Windows ReLogic.Native.dll and Windows TerrariaServer.exe in /wrap/TerrariaServer/
Step 3. Restore OTAPI.Server.sln Nuget Packages
Step 4. Build OTAPI.Server.sln
Step 5. Build OTAPI.Patcher
Step 6. Try Run OTAPI.Patcher.exe
Error:
Then i get this error when Trying to run The patcher.exe
I thought maybe trying to restore packages but this doesn't work either...

Unhandled Exception:
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553'
  at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000f7] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00007] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00025] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00040] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.TypeReference.Resolve () [0x00006] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.Mixin.CheckedResolve (Mono.Cecil.TypeReference self) [0x00000] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.GetConstantType (Mono.Cecil.TypeReference constant_type, System.Object constant) [0x000a1] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddConstant (Mono.Cecil.IConstantProvider owner, Mono.Cecil.TypeReference type) [0x00007] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddField (Mono.Cecil.FieldDefinition field) [0x00072] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddFields (Mono.Cecil.TypeDefinition type) [0x00013] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddType (Mono.Cecil.TypeDefinition type) [0x0008c] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddTypeDefs () [0x00018] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.BuildTypes () [0x00014] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.BuildModule () [0x0007e] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.BuildMetadata () [0x00000] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleWriter.BuildMetadata (Mono.Cecil.ModuleDefinition module, Mono.Cecil.MetadataBuilder metadata) [0x00008] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleWriter.WriteModuleTo (Mono.Cecil.ModuleDefinition module, System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x000ab] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleDefinition.Write (System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00022] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x0000a] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.AssemblyDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at ILRepacking.ILRepack.Repack () [0x00385] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at OTAPI.Patcher.Program.Main (System.String[] args) [0x0034e] in <169dec57a75c4694b3259e5d2bb859df>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553'
  at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000f7] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00007] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00025] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00040] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.TypeReference.Resolve () [0x00006] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.Mixin.CheckedResolve (Mono.Cecil.TypeReference self) [0x00000] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.GetConstantType (Mono.Cecil.TypeReference constant_type, System.Object constant) [0x000a1] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddConstant (Mono.Cecil.IConstantProvider owner, Mono.Cecil.TypeReference type) [0x00007] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddField (Mono.Cecil.FieldDefinition field) [0x00072] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddFields (Mono.Cecil.TypeDefinition type) [0x00013] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddType (Mono.Cecil.TypeDefinition type) [0x0008c] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.AddTypeDefs () [0x00018] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.BuildTypes () [0x00014] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.BuildModule () [0x0007e] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.MetadataBuilder.BuildMetadata () [0x00000] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleWriter.BuildMetadata (Mono.Cecil.ModuleDefinition module, Mono.Cecil.MetadataBuilder metadata) [0x00008] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleWriter.WriteModuleTo (Mono.Cecil.ModuleDefinition module, System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x000ab] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleDefinition.Write (System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00022] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.ModuleDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x0000a] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at Mono.Cecil.AssemblyDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at ILRepacking.ILRepack.Repack () [0x00385] in <cb3fd49c3e8f4dc980bfa856efdddf05>:0 
  at OTAPI.Patcher.Program.Main (System.String[] args) [0x0034e] in <169dec57a75c4694b3259e5d2bb859df>:0 

Sorry, I understand that this god does not belong here

Sorry, I understand that this god does not belong here
But I did not find a way to write it here I do not know how to crawl github.com Sorry
https://github.com/NyxStudios/Regions/blob/master/RegionManager.cs
I think it should be here

150wth

2017-08-28_10-33-13.log

2017-08-28 10:33:13 - TShock: INFO: TShock was improperly shut down. Please use the exit command in the future to prevent this.
2017-08-28 10:33:13 - TextLog: INFO: TShock 4.3.24.0 (Mintaka) now running.
2017-08-28 10:33:13 - TShock: INFO: AutoSave Enabled
2017-08-28 10:33:13 - TShock: INFO: Backups Disabled
2017-08-28 10:33:13 - TShock: INFO: Welcome to TShock for Terraria. Initialization complete.
2017-08-28 10:33:38 - RegionManager: ERROR: System.NullReferenceException: Object reference not set to an instance of an object.
at TShockAPI.DB.RegionManager.Reload()
2017-08-28 10:33:48 - Utils: INFO: Server executed: /region list.

ServerLog.txt

[08-28-17 10:33:12] [Server API] Verbose: TerrariaApi - Server v2.1.0.0 started.
[08-28-17 10:33:12] [Server API] Verbose: Command line: "C:\servers\tshock1717\TerrariaServer.exe"
[08-28-17 10:33:12] [Server API] Verbose: OS: Microsoft Windows NT 6.1.7600.0 (64bit: True)
[08-28-17 10:33:12] [Server API] Verbose: Mono: False
[08-28-17 10:33:13] [Server API] Info: Plugin TShock v4.3.24.0 (by The TShock Team) initiated.

No hook for bosses dying

I'm trying to make a plugin for DPS and % contribution to bosses calculation.

The way it works is by using TSAPI's extension of the Npc.Strike hook I add each boss to a dictionary with the needed information for the calculation. And then when the boss dies, using TSAPI's extension of the Npc.Killed hook I remove the boss from the dictionary.

It works fine for bosses like King Slime, Eye of Cthulhu and such (one part) bosses, but it gets very complicated when dealing with multiple part bosses (Skeletron Prime, Skeletron not included because their arms are not part of the boss's max health).
Eater of Worlds specifically can't be removed from the dictionary because while a part of it dies, the 'boss' is still alive.

I tried to go around it by getting the total number of segments of the boss (head and tail don't count, only type ID 14) and then only removing it after the number of segments dead is the same as total but that seemed to be less reliable as the boss split apart, and then some other bugs where I used a strong weapon and hit the boss after it was dead. All of my calculations would be possible, and easier to do if there was a hook for bosses dying with the Terraria.NPC property in it.

With such a hook, all I'd have to do is remove the NPC from my dictionary and it's done, no counting or anything.

[Proposition] Allow persistent plugin states

We were thinking along the lines of when a plugin is disabled it should be persisted between starts.
This could potentially be stored using the EF DbContext (OTAContext), or even fall back to local storage.

Is there hooks update doc?

Some hooks have been changed. For example.
image
This hook is no longer available. I can't find what it has changed to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.