-
-
Notifications
You must be signed in to change notification settings - Fork 36
Modifications List
Luke edited this page May 29, 2017
·
6 revisions
Assembly/Modification | Description |
---|---|
ChangeArchitecture/ChangeArchitecture | Changes the architecture of the server assembly from x86 to match OTAPI |
Chest.Item.Add/QuickStack | |
Chest.Item.Add/ServerPlace | |
Collision.GetEntityEdgeTiles/GetEntityEdgeTilesPoint | |
Collision.PressurePlate/PlayerPressurePlate | |
Collision.PressurePlate/SwitchTiles | This mod we will replace the HitSwitch calls with our own custom version, as the SendData method will also be ripped out as it's quicker and easier to do this than hacking ourselves into the if blocks. |
Collision.SwitchTilesEntity/SwitchTilesEntitiy | This patch adds an extra parameter to SwitchTiles to allow the entity to be passed by callers. |
Console/ConsoleWrites | |
Core/AssemblyModification | |
Core/PlatformModification | |
Input.Command/Command | This modification will add a command hook to the vanilla command thread. Typically consumers will just run their own command thread, but this one allows me to keep vanilla functionality in my test app. |
Input.Command/StartCommandThread | This modification will allow the hook for starting a custom command thread to function. |
Item.CheckMaterial/CheckMaterial | |
Item.NetDefaults/NetDefaults | |
Item.SetDefaultsById/SetDefaultsById | |
Item.Update/Update | |
Json/PatchJson | Vanilla Terraria uses Newtonsoft.JSON 7.0.0.0. We rather a higher version, and we also rather use NuGet. |
Main.Christmas/Christmas | Adds a hook for checking if it's christmas |
Main.GameInitialize/GameInitialize | This modification is to allow the Game.Initialize hooks to be ran by injecting callbacks into the start and end of the vanilla method. |
Main.GameStarted/GameStarted | |
Main.GameUpdate/GameUpdate | This modification is to allow the Game.Update hooks to be ran by injecting callbacks into the start and end of the vanilla method. |
Main.Halloween/Halloween | Adds a hook for checking if it's halloween |
Main.StatusText/DedServModification | The purpose of this modification is to remove all Console.WriteLines* from a Main.statusText change. Instead, this will be handled by our SetStatusText callback. |
Main.StatusText/StatusTextModification | The purpose of this modification is to capture writes to Main.statusText and to mark it as internal so no one else can use it as it's a terrible field to use in the first place. |
MakeTypesPublic/MakeTypesPublic | Makes all types public in the OTAPI assembly dll. |
MessageBuffer.NameCollision/NameCollision | Injects a hook into the if statement that surrounds the name collision kick. |
MessageBuffer.ReceiveData.Exception/ReceiveDataException | |
MessageBuffer.ReceiveData/ReceiveData | |
Mono/HandlePlatformIO | Since we use the Windows TerrariaServer.exe we need to handle windows specific code In this case we need to replace all calls to 'FileOperationAPIWrapper.MoveToRecycleBin' and redirect them to our own callback that will handle mono+.net |
Mono/RemoveConsoleCtrlCheck | Mono does not like the SetConsoleCtrlHandler method that terraria uses for its server. This modification will remove the call to this method, allowing mono to continue. Alternatively we could have used , but we would then have to implement the assembly resolving (at least while terraria still contains embedded assemblies) |
Mono/RemoveNatFromNetplay | |
Net.CheckBytes/CheckBytes | |
Net.NetworkText/BroadcastChatMessageModification | |
Net.NetworkText/SendChatMessageToClientModification | |
Net.RemoteClient.Reset/RemoteClientReset | |
Net.SendBytes/SendBytes | |
Net.SendData.Locking/AvoidLocking | this modification will remove the locking in the NetMessage.SendData method as it frequently conflicts with the CheckBytes lock, causing heavy lag |
Net.SendData.Locking/ReplaceWriter | |
Net.SendData/SendData | |
Net.SendUnknownPacket/SendUnknownPacket | In this modification we add the "default" statement to the SendData switch statement. This is so I can also add a hook to allow custom packets to be sent so we don't have to replicate SendData code. |
Net.Socket.Accepted/ServerSocketAccepted | |
Net.Socket.Create/ServerSocketCreate | In this modification we will replace the "new TcpSocket" call in ServerLoop to allow a custom implementations. |
Npc.AI/AI | |
Npc.BossBagItem/BossBagItem | In this patch we will replace the server code to use a custom Item.NewItem method named "BossBagItem". We then insert some IL to check the result variable for the int -1. If they match then we cancel the vanilla function by returning. |
Npc.Create/Create | |
Npc.DropLoot/DropLoot_1_DropLoot | |
Npc.DropLoot/DropLoot_1_NetDrop | |
Npc.DropLoot/DropLoot_1_SwapItemCalls | |
Npc.Killed/Killed | |
Npc.NetDefaults/NetDefaults | |
Npc.SetDefaultsById/SetDefaultsById | |
Npc.Spawn/Spawn | |
Npc.Strike/Args | |
Npc.Strike/Strike | |
Npc.Transform/Transform | |
Npc.Update/Update | |
Player.Greet/Announce | This modification is to allow the NetMessage.greetPlayer hooks to be ran by injecting callbacks into the start and end of the vanilla method. |
Player.Greet/Greet | This modification is to allow the NetMessage.greetPlayer hooks to be ran by injecting callbacks into the start and end of the vanilla method. |
Player.Update/Update | |
Projectile.AI/AI | |
Projectile.Kill/Kill | |
Projectile.SetDefaultsById/SetDefaultsById | |
Projectile.Update/Update | |
Sockets/Modification | |
Tile/ITileModification | |
Tile/TileCollectionAccessorModification | |
Tile/TileCollectionModification | |
Tile/TileConstructor | This modification is used to move all tile property/field updates from the constructor out into a virtual Initialise method. This gives consumers more control over the default tile mechanism. |
Tile/TileReplacementModification | |
Wiring.AnnouncementBox/AnnouncementBox | |
World.DropMeteor/DropMeteor | This modification will insert a callback right before the 'stopDrops = true` in the WorldGen.meteor method so we can create a hook for when meteors drop. |
World.Generate/Generate | |
World.HardMode.TileUpdate/TilePlace | |
World.HardMode.TileUpdate/TileUpdate | |
World.Hardmode/Hardmode | |
World.Load/Load | |
World.RemoveMap/RemoveMap | |
World.Save/Save | |
World.Save/SaveAndPlay | Adds a Terraria.WorldGen.autoSave check in saveAndPlay |
World.SpawnNpc/SpawnNpc | |
World.SpreadGrass/SpreadGrass | |
World.Statue/Statue | In this modification we will insert our callback to be the return value of the MechSpawn function in both NPC and Item. Additionally we also append all the arguments and some local variables so we have more data to work with. |
Xna/RemoveXna | Replaces all Xna references to use OTAPI.Xna.dll |
Info | Count |
---|---|
Total modifications in OTAPI v2 | 137 |
void Main()
{
var patcher = new CustomPatcher();
var modifications = patcher.ModificationAssemblies
.Select(x => new { AssemblyPath = x, Assembly = Assembly.LoadFile(x), CommentsPath = Path.ChangeExtension(x, "xml") })
.Select(x => new
{
Assembly = x.Assembly,
Reader = File.Exists(x.CommentsPath) ? new Jolt.XmlDocCommentReader(Path.ChangeExtension(x.AssemblyPath, "xml")) : null,
Modifications = GetTypesLoaded(x.Assembly).Where(t => typeof(OTAPI.Patcher.Engine.Modification.ModificationBase).IsAssignableFrom(t))
});
(
"## Modifications\n" +
"Assembly/Modification | Description\n" +
"---- | -----------\n" +
String.Join("\n", modifications
.SelectMany(x => x.Modifications.Select(y => new {
Assembly = x.Assembly.GetName().Name,
Modification = y,
Reader = x.Reader
}))
.OrderBy(x => x.Assembly + '/' + x.Modification.Name)
.Select(x => $"[{x.Assembly.Replace("OTAPI.Modifications.", "") + '/' + x.Modification.Name}](https://github.com/DeathCradle/Open-Terraria-API/tree/master/OTAPI.Modifications/{x.Assembly})" + " | " + String.Join("<br/>", x.Reader?
.GetComments(x.Modification)?
.Value?
.Trim()
.Split(new [] {'\n'}, StringSplitOptions.RemoveEmptyEntries)
.Select(l => l.Trim())
?? new string[] {}
)
)
.Distinct()
)
+ "\n\n## Stats\n" +
(
"Info | Count\n" +
"---- | -----------\n" +
"Total modifications in OTAPI v2 | " + modifications.Count()
)
+ "\n\n### Page generated using LINQPad 5 + Jolt.NET\n```C#\n```"
)
.Dump()
;
}
public static Type[] GetTypesLoaded(System.Reflection.Assembly assembly)
{
try
{
return assembly.GetTypes();
}
catch (System.Reflection.ReflectionTypeLoadException e)
{
return e.Types.Where(t => t != null).ToArray();
}
}
class CustomPatcher : OTAPI.Patcher.Engine.Patcher
{
const String OTAPI_BASE = "C:/Backup/Git/Open-Terraria-API/";
public CustomPatcher()
: base(
$"{OTAPI_BASE}wrap/TerrariaServer/TerrariaServer.exe",
new[] {$"{OTAPI_BASE}OTAPI.Modifications/OTAPI.**/bin/Debug/OTAPI.Modification**.dll"},
$"{OTAPI_BASE}OTAPI.dll"
)
{
Assembly.LoadFile(this.SourceAssemblyPath);
}
public IEnumerable<string> ModificationAssemblies => this.GlobModificationAssemblies();
}