Skip to content

Commit 2445061

Browse files
committed
fix: interface miss
1 parent a60e7f7 commit 2445061

File tree

4 files changed

+55
-127
lines changed

4 files changed

+55
-127
lines changed

src/OTAPI.UnifiedServerProcess.GlobalNetwork/Network/SyncHelper.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,12 @@ static unsafe void SendSmallPacket<TPacket>(ServerContext server, int plr, TPack
107107
null, plr);
108108
}
109109
public static void SyncServerOfflineToPlayer(ServerContext offlineServer, int plr) {
110-
byte[] data = [6, 0, MessageID.ItemOwner, default, default, 255];
111110
for (int i = 0; i < Terraria.Main.maxItems; i++) {
112111
var item = offlineServer.Main.item[i];
113112
if (!item.active || item.playerIndexTheItemIsReservedFor != plr) {
114113
continue;
115114
}
116-
short itemSlot = (short)i;
117-
data[3] = (byte)(itemSlot & 0xFF);
118-
data[4] = (byte)(itemSlot >> 8);
119-
SendRawData(offlineServer, plr, data, 0, 6);
120-
SendSmallPacket(offlineServer, plr, new ItemOwner())
115+
SendSmallPacket(offlineServer, plr, new ItemOwner((short)i, 255));
121116
}
122117
for (int i = 0; i < Terraria.Main.maxProjectiles; i++) {
123118
var proj = offlineServer.Main.projectile[i];
Lines changed: 29 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<Nullable>enable</Nullable>
8-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9-
<LangVersion>preview</LangVersion>
10-
</PropertyGroup>
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9+
<LangVersion>preview</LangVersion>
10+
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<Reference Include="ModFramework">
14-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\ModFramework.dll</HintPath>
15-
</Reference>
16-
<Reference Include="Mono.Cecil">
17-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.dll</HintPath>
18-
</Reference>
19-
<Reference Include="Mono.Cecil.Mdb">
20-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.Mdb.dll</HintPath>
21-
</Reference>
22-
<Reference Include="Mono.Cecil.Pdb">
23-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.Pdb.dll</HintPath>
24-
</Reference>
25-
<Reference Include="Mono.Cecil.Rocks">
26-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.Rocks.dll</HintPath>
27-
</Reference>
28-
<Reference Include="MonoMod">
29-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.dll</HintPath>
30-
</Reference>
31-
<Reference Include="MonoMod.Backports">
32-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Backports.dll</HintPath>
33-
</Reference>
34-
<Reference Include="MonoMod.Core">
35-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Core.dll</HintPath>
36-
</Reference>
37-
<Reference Include="MonoMod.Iced">
38-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Iced.dll</HintPath>
39-
</Reference>
40-
<Reference Include="MonoMod.ILHelpers">
41-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.ILHelpers.dll</HintPath>
42-
</Reference>
43-
<Reference Include="MonoMod.RuntimeDetour">
44-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.RuntimeDetour.dll</HintPath>
45-
</Reference>
46-
<Reference Include="MonoMod.RuntimeDetour.HookGen">
47-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.RuntimeDetour.HookGen.dll</HintPath>
48-
</Reference>
49-
<Reference Include="MonoMod.Utils">
50-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Utils.dll</HintPath>
51-
</Reference>
13+
<PackageReference Include="MonoMod.RuntimeDetour" Version="25.2.3" />
14+
<PackageReference Include="MonoMod.RuntimeDetour.HookGen" Version="22.7.31.1" />
15+
<PackageReference Include="ModFramework.Modules.CSharp" Version="1.1.15" />
16+
</ItemGroup>
17+
<ItemGroup>
5218
<Reference Include="OTAPI">
5319
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\output\OTAPI.dll</HintPath>
5420
</Reference>
@@ -57,23 +23,23 @@
5723
</Reference>
5824
</ItemGroup>
5925

60-
<ItemGroup>
61-
<Compile Update="TestWorlds.Designer.cs">
62-
<DesignTime>True</DesignTime>
63-
<AutoGen>True</AutoGen>
64-
<DependentUpon>TestWorlds.resx</DependentUpon>
65-
</Compile>
66-
</ItemGroup>
26+
<ItemGroup>
27+
<Compile Update="TestWorlds.Designer.cs">
28+
<DesignTime>True</DesignTime>
29+
<AutoGen>True</AutoGen>
30+
<DependentUpon>TestWorlds.resx</DependentUpon>
31+
</Compile>
32+
</ItemGroup>
6733

68-
<ItemGroup>
69-
<EmbeddedResource Update="TestWorlds.resx">
70-
<Generator>ResXFileCodeGenerator</Generator>
71-
<LastGenOutput>TestWorlds.Designer.cs</LastGenOutput>
72-
</EmbeddedResource>
73-
</ItemGroup>
34+
<ItemGroup>
35+
<EmbeddedResource Update="TestWorlds.resx">
36+
<Generator>ResXFileCodeGenerator</Generator>
37+
<LastGenOutput>TestWorlds.Designer.cs</LastGenOutput>
38+
</EmbeddedResource>
39+
</ItemGroup>
7440

75-
<ItemGroup>
76-
<ProjectReference Include="..\OTAPI.UnifiedServerProcess.ConsoleClient\OTAPI.UnifiedServerProcess.ConsoleClient.csproj" />
77-
</ItemGroup>
41+
<ItemGroup>
42+
<ProjectReference Include="..\OTAPI.UnifiedServerProcess.ConsoleClient\OTAPI.UnifiedServerProcess.ConsoleClient.csproj" />
43+
</ItemGroup>
7844

7945
</Project>
Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<Nullable>enable</Nullable>
8-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9-
</PropertyGroup>
10-
11-
<ItemGroup>
12-
<Reference Include="ModFramework">
13-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\ModFramework.dll</HintPath>
14-
</Reference>
15-
<Reference Include="Mono.Cecil">
16-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.dll</HintPath>
17-
</Reference>
18-
<Reference Include="Mono.Cecil.Mdb">
19-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.Mdb.dll</HintPath>
20-
</Reference>
21-
<Reference Include="Mono.Cecil.Pdb">
22-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.Pdb.dll</HintPath>
23-
</Reference>
24-
<Reference Include="Mono.Cecil.Rocks">
25-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\Mono.Cecil.Rocks.dll</HintPath>
26-
</Reference>
27-
<Reference Include="MonoMod">
28-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.dll</HintPath>
29-
</Reference>
30-
<Reference Include="MonoMod.Backports">
31-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Backports.dll</HintPath>
32-
</Reference>
33-
<Reference Include="MonoMod.Core">
34-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Core.dll</HintPath>
35-
</Reference>
36-
<Reference Include="MonoMod.Iced">
37-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Iced.dll</HintPath>
38-
</Reference>
39-
<Reference Include="MonoMod.ILHelpers">
40-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.ILHelpers.dll</HintPath>
41-
</Reference>
42-
<Reference Include="MonoMod.RuntimeDetour">
43-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.RuntimeDetour.dll</HintPath>
44-
</Reference>
45-
<Reference Include="MonoMod.RuntimeDetour.HookGen">
46-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.RuntimeDetour.HookGen.dll</HintPath>
47-
</Reference>
48-
<Reference Include="MonoMod.Utils">
49-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\MonoMod.Utils.dll</HintPath>
50-
</Reference>
51-
<Reference Include="OTAPI">
52-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\output\OTAPI.dll</HintPath>
53-
</Reference>
54-
<Reference Include="OTAPI.Runtime">
55-
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\output\OTAPI.Runtime.dll</HintPath>
56-
</Reference>
57-
</ItemGroup>
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<PackageReference Include="MonoMod.RuntimeDetour" Version="25.2.3" />
12+
<PackageReference Include="MonoMod.RuntimeDetour.HookGen" Version="22.7.31.1" />
13+
<PackageReference Include="ModFramework.Modules.CSharp" Version="1.1.15" />
14+
</ItemGroup>
15+
<ItemGroup>
16+
<Reference Include="OTAPI">
17+
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\output\OTAPI.dll</HintPath>
18+
</Reference>
19+
<Reference Include="OTAPI.Runtime">
20+
<HintPath>..\OTAPI.UnifiedServerProcess\bin\Debug\net9.0\output\OTAPI.Runtime.dll</HintPath>
21+
</Reference>
22+
</ItemGroup>
5823

5924
</Project>

src/OTAPI.UnifiedServerProcess/ModAssemblyMerger.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,11 @@ static void PrepareMethod(TypeDefinition targetType, MethodDefinition modMethod,
306306
}
307307

308308
static void AdjustInterfaces(ModuleDefinition target, ModuleDefinition mod, TypeDefinition type, TypeDefinition mappedType) {
309-
mappedType.Interfaces.Clear();
310-
for (int i = 0; i < type.Interfaces.Count; i++) {
311-
var interfImpl = type.Interfaces[i];
309+
foreach (var interfImpl in type.Interfaces) {
310+
var old = mappedType.Interfaces.FirstOrDefault(t => t.InterfaceType.FullName == interfImpl.InterfaceType.FullName);
311+
if (old is not null) {
312+
mappedType.Interfaces.Remove(old);
313+
}
312314
AdjustMemberAttributes(target, mod, interfImpl.CustomAttributes);
313315
var mappedInterfType = interfImpl.InterfaceType;
314316
if (RedirectTypeRef(target, mod, ref mappedInterfType)) {

0 commit comments

Comments
 (0)