Skip to content

Commit

Permalink
修复: 修复ServerTools 禁止怪物捡钱无法生效得问题,移除禁止快速放入箱子功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Controllerdestiny committed May 11, 2024
1 parent 1b87098 commit 7746693
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 0 additions & 3 deletions ServerTools/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public class Config
[JsonProperty("禁止多鱼线")]
public bool MultipleFishingRodsAreProhibited = true;

[JsonProperty("禁止快速放入箱子")]
public bool LimitForceItemIntoNearestChest = false;

[JsonProperty("死亡倒计时")]
public bool DeadTimer = false;

Expand Down
18 changes: 10 additions & 8 deletions ServerTools/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public override void Initialize()
Commands.ChatCommands.Add(new Command("servertool.user.dead", DeathRank, "死亡排行"));
Commands.ChatCommands.Add(new("servertool.user.online", Online, "在线排行"));
#endregion

#region TShcok 钩子
GetDataHandlers.NewProjectile.Register(NewProj);
GetDataHandlers.ItemDrop.Register(OnItemDrop);
Expand All @@ -83,6 +82,8 @@ public override void Initialize()
HandleCommandLine(Environment.GetCommandLineArgs());
}



private void Exit(CommandArgs args)
{
args.Player.SendData(PacketTypes.ChestOpen, "", args.Player.Index, -1);
Expand Down Expand Up @@ -191,7 +192,7 @@ private void NewProj(object? sender, GetDataHandlers.NewProjectileEventArgs e)
if (Main.projectile[e.Index].bobber && Config.MultipleFishingRodsAreProhibited && Config.ForbiddenBuoys.FindAll(f => f == e.Type).Count > 0)
{
var bobber = Main.projectile.Where(f => f != null && f.owner == e.Owner && f.active && f.type == e.Type);
if (bobber.Count() > 1)
if (bobber.Count() > 2)
{
e.Player.SendErrorMessage("你因多鱼线被石化3秒钟!");
e.Player.SetBuff(156, 180, true);
Expand Down Expand Up @@ -287,14 +288,15 @@ private void GetData(GetDataEventArgs args)
{
var ply = TShock.Players[args.Msg.whoAmI];
if (args.Handled || ply == null) return;
if (args.MsgID == PacketTypes.ForceItemIntoNearestChest && Config.LimitForceItemIntoNearestChest)
{
ply.SendErrorMessage("禁止快速堆叠!");
args.Handled = true;
return;
}

if (Config.PickUpMoney && args.MsgID == PacketTypes.SyncExtraValue)
{
using BinaryReader reader = new(new MemoryStream(args.Msg.readBuffer, args.Index, args.Length));
var npcid = reader.ReadInt16();
var money = reader.ReadInt32();
var x = reader.ReadSingle();
var y = reader.ReadSingle();
ply.SendData(PacketTypes.SyncExtraValue, "", npcid, 0, x, y);
args.Handled = true;
return;
}
Expand Down

0 comments on commit 7746693

Please sign in to comment.