public override void Process(int whoAmI, byte[] readBuffer, int length, int num) { int x = (int)ReadInt16(readBuffer); int y = (int)ReadInt16(readBuffer); int signIndex = Sign.ReadSign(x, y); var player = Main.player[whoAmI]; var ctx = new HookContext { Connection = player.Connection, Sender = player, Player = player, }; var args = new HookArgs.SignTextGet { X = x, Y = y, SignIndex = (short)signIndex, Text = (signIndex >= 0 && Main.sign[signIndex] != null) ? Main.sign[signIndex].text : null, }; HookPoints.SignTextGet.Invoke(ref ctx, ref args); if (ctx.CheckForKick() || ctx.Result == HookResult.IGNORE) return; if (args.Text != null) { var msg = NewNetMessage.PrepareThreadInstance(); msg.WriteSign(signIndex, x, y, args.Text); msg.Send(whoAmI); } }
private static void ProcessReadSign(int bufferId) { var buffer = NetMessage.buffer[bufferId]; var player = Main.player[bufferId]; if (Main.netMode != 2) { return; } int x = (int)buffer.reader.ReadInt16(); int y = (int)buffer.reader.ReadInt16(); int id = Sign.ReadSign(x, y, true); if (id >= 0) { var ctx = new HookContext { Connection = player.Connection.Socket, Sender = player, Player = player }; var args = new HookArgs.SignTextGet { X = x, Y = y, SignIndex = (short)id, Text = (id >= 0 && Main.sign[id] != null) ? Main.sign[id].text : null, }; HookPoints.SignTextGet.Invoke(ref ctx, ref args); if (ctx.CheckForKick() || ctx.Result == HookResult.IGNORE) return; if (args.Text != null) { NetMessage.SendData(47, bufferId, -1, "", id, (float)bufferId, 0, 0, 0, 0, 0); return; } } }