public static void Compose(ServerHandler Client, Habbo cUser, Environment Server) throws Exception { Habbo CurrentUser = Client.GetSession(); int RoomId = CurrentUser.CurrentRoomId; Channel Socket = Client.Socket; Room R = Room.Rooms.get(RoomId); String Gender = Client.inreader.readUTF(); String Look = Client.inreader.readUTF(); Server.GetDatabase() .executeUpdate("UPDATE users SET look = '" + Look + "' WHERE id = " + CurrentUser.Id); Server.GetDatabase() .executeUpdate("UPDATE users SET gender = '" + Gender + "' WHERE id = " + CurrentUser.Id); CurrentUser.Look = Look; CurrentUser.Gender = Gender; ServerMessage UpdateInfo = new ServerMessage(ServerEvents.UpdateInfo); UpdateInfo.writeInt(-1); UpdateInfo.writeUTF(Look); UpdateInfo.writeUTF(Gender.toLowerCase()); UpdateInfo.writeUTF(CurrentUser.Motto); UpdateInfo.writeInt(525); // achv points UpdateInfo.Send(Socket); ServerMessage UpdateGInfo = new ServerMessage(ServerEvents.UpdateInfo); UpdateGInfo.writeInt(CurrentUser.SessionId); UpdateGInfo.writeUTF(Look); UpdateGInfo.writeUTF(Gender.toLowerCase()); UpdateGInfo.writeUTF(CurrentUser.Motto); UpdateGInfo.writeInt(525); // achv points UserManager.SendMessageToUsersOnRoomId(RoomId, UpdateGInfo); CurrentUser.UpdateStateForFriends(); }
public static void Compose(ServerHandler Client, Habbo cUser, Environment Server) throws Exception { Room RoomData = Room.Rooms.get(cUser.CurrentRoomId); int lol = Client.inreader.readInt(); int ItemId = Client.inreader.readInt(); Server.WriteLine("To remove: " + ItemId); RoomItem Item = RoomItem.Items.get(ItemId); ItemInformation furniData = ItemInformation.Items.get(Item.FurniId); if (!RoomData.HavePowers(cUser.Id)) { return; } Server.GetDatabase().executeUpdate("DELETE FROM rooms_items WHERE id = " + Item.Id); Server.GetDatabase() .executeUpdate( "INSERT INTO users_items (id, userid, itemid, extradata) VALUES (NULL, '" + cUser.Id + "', '" + Item.FurniId + "', '" + Item.ExtraData + "');"); UserItem I = new UserItem(); I.Id = UserItem.LastId + 1; UserItem.LastId++; I.UserId = cUser.Id; I.ItemId = Item.FurniId; I.ExtraData = Item.ExtraData; UserItem.Items.put(I.Id, I); RoomItem.Items.remove(Item); if (lol == 2) { ServerMessage RemoveFloorItem = new ServerMessage(ServerEvents.RemoveFloorItem); RemoveFloorItem.writeUTF(Item.Id + ""); RemoveFloorItem.writeInt(0); RemoveFloorItem.writeInt(cUser.Id); RemoveFloorItem.Send(Client.Socket); ServerMessage Remove = new ServerMessage(ServerEvents.RemoveWhatItem); Remove.writeInt(Item.Id); UserManager.SendMessageToUsersOnRoomId(cUser.CurrentRoomId, Remove); RoomData.FloorItems.remove(Item); } else { ServerMessage RemoveWallItem = new ServerMessage(ServerEvents.RemoveWallItem); RemoveWallItem.writeUTF(I.Id + ""); RemoveWallItem.writeInt(cUser.Id); UserManager.SendMessageToUsersOnRoomId(cUser.CurrentRoomId, RemoveWallItem); RoomData.WallItems.remove(Item); } ServerMessage Message = new ServerMessage(ServerEvents.UpdateInventory); Message.Send(Client.Socket); /*ServerMessage FloorInventory = new ServerMessage(ServerEvents.AddItemToInventary); if(lol == 2) { FloorInventory.writeInt(I.Id); FloorInventory.writeUTF(furniData.Type.toUpperCase()); FloorInventory.writeInt(furniData.Id); FloorInventory.writeInt(furniData.SpriteId); FloorInventory.writeInt(1); FloorInventory.writeUTF(Item.ExtraData); FloorInventory.writeInt(0); FloorInventory.writeBoolean(furniData.CanRecycle); FloorInventory.writeBoolean(furniData.CanTrade); FloorInventory.writeBoolean(furniData.CanStack); FloorInventory.writeBoolean(furniData.CanSell); FloorInventory.writeInt(-1); FloorInventory.writeUTF(""); FloorInventory.writeInt(0); FloorInventory.writeInt(24); } else { FloorInventory.writeInt(I.Id); FloorInventory.writeUTF(furniData.Type.toUpperCase()); FloorInventory.writeInt(furniData.Id); FloorInventory.writeInt(furniData.SpriteId); FloorInventory.writeInt(1); FloorInventory.writeInt(0); FloorInventory.writeUTF(Item.ExtraData); FloorInventory.writeBoolean(furniData.CanRecycle); FloorInventory.writeBoolean(furniData.CanTrade); FloorInventory.writeBoolean(furniData.CanStack); FloorInventory.writeBoolean(furniData.CanSell); FloorInventory.writeInt(-1); FloorInventory.writeInt(25); }*/ // FloorInventory.Send(Client.Socket); }