public static void Handle(Entities.GameClient client, DataPacket packet) { if (client.Trade.Trading) { return; } if (!client.Alive) { return; } using (var resp = new NPCResponsePacket(packet)) { switch (resp.Action) { case Enums.NPCDialogAction.Popup: case Enums.NPCDialogAction.Answer: { if (client.CurrentNPC == null) { return; } if (resp.Option == 255) { return; } if (Core.Screen.GetDistance(client.X, client.Y, client.CurrentNPC.X, client.CurrentNPC.Y) >= Core.NumericConst.MaxNPCDistance && client.CurrentNPC.NPCType != Enums.NPCType.Distance) { using (var fmsg = Packets.Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.TOO_FAR_NPC)) client.Send(fmsg); return; } client.NPCInput = resp.InputData; client.CurrentNPC.CallDialog(client, resp.Option); break; } } } }
public static void Handle(Entities.GameClient client, DataPacket packet) { if (client.Trade.Trading) return; if (!client.Alive) return; using (var resp = new NPCResponsePacket(packet)) { switch (resp.Action) { case Enums.NPCDialogAction.Popup: case Enums.NPCDialogAction.Answer: { if (client.CurrentNPC == null) { return; } if (resp.Option == 255) { return; } if (Core.Screen.GetDistance(client.X, client.Y, client.CurrentNPC.X, client.CurrentNPC.Y) >= Core.NumericConst.MaxNPCDistance && client.CurrentNPC.NPCType != Enums.NPCType.Distance) { using (var fmsg = Packets.Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.TOO_FAR_NPC)) client.Send(fmsg); return; } client.NPCInput = resp.InputData; client.CurrentNPC.CallDialog(client, resp.Option); break; } } } }