using System; using Woodpecker.Core; using Woodpecker.Sessions; using Woodpecker.Net.Game.Encoding; using Woodpecker.Net.Game.Messages; namespace Woodpecker.Net.Game { public class gameMessageHandler { internal gameConnection Connection; public gameMessageHandler(gameConnection Connection) { this.Connection = Connection; } public void Handle(clientMessage Message) { Logging.logClientMessage(this.Connection.connectionID, Message); serverMessage fuseResponse = null; switch (Message.ID) { case 2: // @B - "NAVIGATE" { } break; case 4: // @D - "TRY_LOGIN" { if (this.Connection.Session == null) { string[] s = Message.Parameters; sessionManager.attemptLogin(s[0], s[1], this); } break; } case 202: // CJ * GENERATEKEY { fuseResponse = new serverMessage(8); // @H fuseResponse.Append(Config.Client_characterSet); this.Connection.sendMessage(fuseResponse); fuseResponse = new serverMessage(257); // DA fuseResponse.Append("RAHIIIKHJIPAIQA"); fuseResponse.Append("dd-MM-yyyy"); this.Connection.sendMessage(fuseResponse); } break; default: { string debugHeader = Message.debugHeader; if (debugHeader == "null") { Logging.logWarning("No message handler for message " + Message.ID + " (" + Message.encodedID + "), no debug header is found aswell."); } else Logging.logWarning("No message handler for message " + Message.ID + " (" + Message.encodedID + ", " + debugHeader + ")"); } break; } } public void sendLocalError(string Error) { serverMessage Message = new serverMessage(33); // @a Message.Append(Error); this.Connection.sendMessage(Message); } } }