Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复: EconomicsAPI 删除调试代码 #140

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Economics.Projectile/Economics.Projectile.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\template.targets" />

<ItemGroup>
<ProjectReference Include="..\EconomicsAPI\EconomicsAPI.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions Economics.Projectile/Internet/CustomProjectile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

namespace Economics.Projectile.Internet;

public class CustomProjectile
{
[JsonProperty("弹幕ID")]
public int Id { get; set; }

[JsonProperty("伤害")]
public int Damage { get; set; }

[JsonProperty("击退")]
public float Knockback { get; set; }

[JsonProperty("射速")]
public float Speed { get; set; }
}
48 changes: 48 additions & 0 deletions Economics.Projectile/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Reflection;
using Terraria;
using TerrariaApi.Server;
using TShockAPI;

namespace Economics.Projectile;

[ApiVersion(2, 1)]
public class Plugin : TerrariaPlugin
{
public override string Author => "少司命";

public override string Description => Assembly.GetExecutingAssembly().GetName().Name!;

public override string Name => Assembly.GetExecutingAssembly().GetName().Name!;

public override Version Version => Assembly.GetExecutingAssembly().GetName().Version!;

internal static string PATH = Path.Combine(EconomicsAPI.Economics.SaveDirPath, "Projectile.json");

public Plugin(Main game) : base(game)
{
}

public override void Initialize()
{
GetDataHandlers.NewProjectile.Register(OnProj);
ServerApi.Hooks.NetGetData.Register(this, GetData);

}

private void GetData(GetDataEventArgs args)
{
if(args.MsgID == PacketTypes.MinionAttackTargetUpdate)
{
var reader = new BinaryReader(new MemoryStream(args.Msg.readBuffer, args.Index, args.Length));
var who = reader.ReadByte();
var npcid = reader.ReadInt16();
Console.WriteLine(npcid);
Console.WriteLine(Main.npc[npcid].FullName);
}
}

private void OnProj(object? sender, GetDataHandlers.NewProjectileEventArgs e)
{
throw new NotImplementedException();
}
}
1 change: 0 additions & 1 deletion EconomicsAPI/Utils/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public static string GetGradientText(string text)
index++;
}
}
Console.WriteLine(result);
return result;
}
/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions Plugin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SignInSign", "SignInSign\Si
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WeaponPlus", "WeaponPlusCostCoin\WeaponPlus.csproj", "{D860EB42-E6F5-4991-8F2D-DB84FBD6BA1D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Economics.Projectile", "Economics.Projectile\Economics.Projectile.csproj", "{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -746,6 +748,14 @@ Global
{D860EB42-E6F5-4991-8F2D-DB84FBD6BA1D}.Release|Any CPU.Build.0 = Release|Any CPU
{D860EB42-E6F5-4991-8F2D-DB84FBD6BA1D}.Release|x64.ActiveCfg = Release|Any CPU
{D860EB42-E6F5-4991-8F2D-DB84FBD6BA1D}.Release|x64.Build.0 = Release|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Debug|x64.ActiveCfg = Debug|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Debug|x64.Build.0 = Debug|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Release|Any CPU.Build.0 = Release|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Release|x64.ActiveCfg = Release|Any CPU
{1F11D206-B4CE-430B-A8BD-6D7C93BC4C8F}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading