/// <summary> /// 33 - "@a" /// </summary> private void SendMsg() { uint buddyID = Request.PopWireduint(); string sText = Request.PopFixedString(); // Buddy in list? if (mSession.GetMessenger().GetBuddy(buddyID) != null) { // Buddy online? GameClient buddyClient = KopimiEnvironment.GetHabboHotel().GetClients().GetClientOfHabbo(buddyID); if (buddyClient == null) { Response.Initialize(ResponseOpcodes.InstantMessageError); // Opcode Response.AppendInt32(5); // Error code Response.AppendUInt32(mSession.GetHabbo().ID); SendResponse(); } else { ServerMessage notify = new ServerMessage(ResponseOpcodes.NewConsole); notify.AppendUInt32(mSession.GetHabbo().ID); notify.AppendString(sText); buddyClient.GetConnection().SendMessage(notify); } } }
/// <summary> /// 41 - "@i" /// </summary> private void HabboSearch() { GetCatalogIndex(); return; // Parse search criteria string sCriteria = Request.PopFixedString(); sCriteria = sCriteria.Replace("%", ""); // Query Habbos with names similar to criteria List <MessengerBuddy> matches = KopimiEnvironment.GetHabboHotel().GetMessenger().SearchHabbos(sCriteria); // Build response Response.Initialize(ResponseOpcodes.HabboSearchResult); Response.AppendInt32(matches.Count); foreach (MessengerBuddy match in matches) { //... } SendResponse(); }
/// <summary> /// 34 - "@b" /// </summary> private void SendRoomInvite() { // TODO: check if this session is in room // Determine how many receivers int amount = Request.PopWiredInt32(); List <GameClient> receivers = new List <GameClient>(amount); // Get receivers for (int i = 0; i < amount; i++) { // User in buddy list? uint buddyID = Request.PopWireduint(); if (mSession.GetMessenger().GetBuddy(buddyID) != null) { // User online? GameClient buddyClient = KopimiEnvironment.GetHabboHotel().GetClients().GetClientOfHabbo(buddyID); if (buddyClient != null) { receivers.Add(buddyClient); } } } // Parse text string sText = Request.PopFixedString(); // Notify the receivers ServerMessage notify = new ServerMessage(ResponseOpcodes.RoomInvite); //... foreach (GameClient receiver in receivers) { receiver.GetConnection().SendMessage(notify); } }