//43 - "REGISTER": "@k" public void Listener43() { //Registration packet breaks the standard structured argument rule - Handle this exception: mPacketBody = mPacketBody.Replace("A@", "@E"); //Get arguments UserInfo newUser = new UserInfo(); newUser.sUsername = FuseMessage.getStructured(2, mPacketBody); if (newUser.sUsername.Length > 16) { newUser.sUsername = newUser.sUsername.Substring(0, 16); } newUser.sUsername = SpecialFiltering.FilterName(newUser.sUsername); if (!InstanceManager.Game.Users.UserExists(newUser.sUsername) && newUser.sUsername.Length > 0 && !newUser.sUsername.ToUpper().Contains("MOD-")) { newUser.sPassword = FuseMessage.getStructured(3, mPacketBody); newUser.sFigure = FuseMessage.getStructured(4, mPacketBody); newUser.sSex = FuseMessage.getStructured(5, mPacketBody); newUser.sMission = FuseMessage.getStructured(6, mPacketBody); newUser.sEmail = FuseMessage.getStructured(7, mPacketBody); newUser.sDOB = FuseMessage.getStructured(8, mPacketBody); newUser.LastIP = InstanceManager.Connections.GetConnection(mSessionID).GetIP(); InstanceManager.Game.Users.CreateUser(newUser); ProcessLogin(newUser.sUsername, newUser.sPassword); } else { ReportError("user", false); } }
//44 - "UPDATE": "@l" public void Listener44() { string newFigure = FuseMessage.getStructured(4, mPacketBody); string newSex = FuseMessage.getStructured(5, mPacketBody); string newMission = FuseMessage.getStructured(6, mPacketBody); UserInfo userInfo = InstanceManager.Game.Users.GetUser(mUserInfo.userId); if (newFigure != "") { userInfo.sFigure = newFigure; } if (newSex != "") { userInfo.sSex = newSex; } if (newMission != "") { userInfo.sMission = newMission; } InstanceManager.Game.Users.UpdateUser(userInfo); mUserInfo = InstanceManager.Game.Users.GetUser(userInfo.userId); InstanceManager.Sessions.GetSession(mSessionID).UpdateUserInfo(mUserInfo); mMessage.Init(5); //@E mMessage.appendString(mUserInfo.buildUserObject()); SendMessage(mMessage); }
//149 - "UPDATE_ACCOUNT": "BU" public void Listener149() { string newEmail = FuseMessage.getStructured(7, mPacketBody); UserInfo userInfo = InstanceManager.Game.Users.GetUser(mUserInfo.userId); userInfo.sEmail = newEmail; InstanceManager.Game.Users.UpdateUser(userInfo); mUserInfo = InstanceManager.Game.Users.GetUser(userInfo.userId); InstanceManager.Sessions.GetSession(mSessionID).UpdateUserInfo(mUserInfo); mMessage.Init(169); //Bi mMessage.appendInt(0); SendMessage(mMessage); }