public void newData(string data) { switch (state) { case 0: //New stack sb = new StringBuilder(); state = 1; newData(data); break; case 1: //Message Header sb.Append(data); if (sb.Length == headersize) { waitFor = Base64Encoding.DecodeInt(sb.ToString()); sb = new StringBuilder(); state = 2; } break; case 2: //Message sb.Append(data); if (sb.Length == waitFor) { stackDone = true; state = 0; } break; } }
//158 - "SETBADGE": "B^" public void Listener158() { int badgeLen = Base64Encoding.DecodeInt(mPacketBody.Substring(0, 2)); string badge = mPacketBody.Substring(2, badgeLen); if (ArgumentEncoding.decodeInt(mPacketBody.Substring(mPacketBody.Length - 1, 1)) == 1) { if (mUserInfo.Badges.Contains(badge)) { mUserInfo.sBadge = badge; } } else { if (mUserInfo.sBadge == badge) { mUserInfo.sBadge = ""; } } InstanceManager.Game.Users.SetBadge(mUserInfo.userId, mUserInfo.sBadge); mUserInfo = InstanceManager.Game.Users.GetUser(mUserInfo.userId); mMessage.Init(228); //Cd mMessage.appendArgumentInt(mRoomInstance.GetUser(mSessionID).RoomUserID); mMessage.appendString(mUserInfo.sBadge); mMessage.appendChar(2); mRoomInstance.RoomBroadcast(mMessage); }
//75 - "MOVE": "AK" public void Listener75() { int x = Base64Encoding.DecodeInt(mPacketBody.Substring(0, 2)); int y = Base64Encoding.DecodeInt(mPacketBody.Substring(2)); mRoomInstance.Interactor.RequestMovePlayer(mSessionID, x, y, null, false); }
private void btnDecode64_Click(object sender, EventArgs e) { try { txtB64Output.Text = Base64Encoding.DecodeInt(txtBase64Input.Text).ToString(); } catch { MessageBox.Show("Invalid input."); } }
private void NewMessage(string data) { string header = data.Substring(0, 2); int headerId = Base64Encoding.DecodeInt(header); string body = ""; if (data.Length > 2) { body = data.Substring(2); } mHeaderBody = header; mHeaderID = headerId; mPacketBody = body; ProcessMessage(); }
//2 - "room_directory": "@B" public void Listener2() { int roomId = InstanceManager.Sessions.GetSession(mSessionID).mRoomID; if (roomId != 0) { InstanceManager.Game.Rooms.GetRoomInstance(roomId).RemoveUser(mSessionID); } int requestType = Base64Encoding.DecodeInt(mPacketBody.Substring(0, 1)); roomId = ArgumentEncoding.decodeInt(mPacketBody.Substring(1)); mMessage.Init(19); //@S SendMessage(mMessage); if (requestType == 1) // Public { enterRoom(roomId, false); } }
//98 - "LETUSERIN": "Ab" public void Listener98() { if (mRoomInstance.GetUser(mSessionID).HasRights || mRoomInstance.GetUser(mSessionID).HasAdmin) { string userName = FuseMessage.getArgument(1, mPacketBody); string letIn = mPacketBody.Substring(mPacketBody.Length - 1); Session.SessionHandler session = InstanceManager.Sessions.GetSession(InstanceManager.Sessions.GetSessionFromUser(userName)); if (session.waitingFlat == mRoomInstance.RoomInfo.RoomID) { session.waitingFlat = 0; if (Base64Encoding.DecodeInt(letIn) == 0) { mMessage.Init(131); //BC } else { session.authenticatedFlat = mRoomInstance.RoomInfo.RoomID; mMessage.Init(41); // @i } session.SendMessage(mMessage); } } }