private void PacketHandler_0x43_PointClick(Object obj, ClientPacket packet) { var user = (User) obj; var clickType = packet.ReadByte(); Rectangle commonViewport = user.GetViewport(); // User has clicked an X,Y point if (clickType == 3) { var x = (byte) packet.ReadUInt16(); var y = (byte) packet.ReadUInt16(); var coords = new Tuple<byte, byte>(x, y); Logger.DebugFormat("coordinates were {0}, {1}", x, y); if (user.Map.Doors.ContainsKey(coords)) { if (user.Map.Doors[coords].Closed) user.SendMessage("It's open.", 0x1); else user.SendMessage("It's closed.", 0x1); user.Map.ToggleDoors(x, y); } else if (user.Map.Signposts.ContainsKey(coords)) { user.Map.Signposts[coords].OnClick(user); } else { Logger.DebugFormat("User clicked {0}@{1},{2} but no door/signpost is present", user.Map.Name, x, y); } } // User has clicked on another entity else if (clickType == 1) { var entityId = packet.ReadUInt32(); Logger.DebugFormat("User {0} clicked ID {1}: ", user.Name, entityId); WorldObject clickTarget = new WorldObject(); if (user.World.Objects.TryGetValue(entityId, out clickTarget)) { if (clickTarget is User || clickTarget is Merchant) { Type type = clickTarget.GetType(); MethodInfo methodInfo = type.GetMethod("OnClick"); methodInfo.Invoke(clickTarget, new[] {user}); } } } else { Logger.DebugFormat("Unsupported clickType {0}", clickType); Logger.DebugFormat("Packet follows:"); packet.DumpPacket(); } }