public static void HandleGameAction(GameActionOpcode opcode, ClientPacketFragment fragment, Session session) { if (!actionHandlers.ContainsKey(opcode)) { Console.WriteLine($"Received unhandled action opcode: 0x{(uint)opcode:X4}"); } else { Type actionType; if (actionHandlers.TryGetValue(opcode, out actionType)) { var gameAction = (GameActionPacket)Activator.CreateInstance(actionType, session, fragment); gameAction.Read(); gameAction.Handle(); } } }
public GameActionAttribute(GameActionOpcode opcode) { Opcode = opcode; }