public static void HandleHouseSelect(Session session, bool confirmed, params string[] parameters) { if (!int.TryParse(parameters[0], out var houseIdx)) { return; } // ensure current multihouse owner if (!session.Player.IsMultiHouseOwner(false)) { log.Warn($"{session.Player.Name} tried to /house-select {houseIdx}, but they are not currently a multi-house owner!"); return; } // get house info for this index var multihouses = session.Player.GetMultiHouses(); if (houseIdx < 1 || houseIdx > multihouses.Count) { session.Network.EnqueueSend(new GameMessageSystemChat($"Please enter a number between 1 and {multihouses.Count}.", ChatMessageType.Broadcast)); return; } var keepHouse = multihouses[houseIdx - 1]; // show confirmation popup if (!confirmed) { var houseType = $"{keepHouse.HouseType}".ToLower();; var loc = HouseManager.GetCoords(keepHouse.SlumLord.Location); var msg = $"Are you sure you want to keep the {houseType} at\n{loc}?"; session.Player.ConfirmationManager.EnqueueSend(new Confirmation_Custom(session.Player.Guid, () => HandleHouseSelect(session, true, parameters)), msg); return; } // house to keep confirmed, abandon the other houses var abandonHouses = new List <House>(multihouses); abandonHouses.RemoveAt(houseIdx - 1); foreach (var abandonHouse in abandonHouses) { var house = session.Player.GetHouse(abandonHouse.Guid.Full); HouseManager.HandleEviction(house, house.HouseOwner ?? 0, true); } // set player properties for house to keep var player = PlayerManager.FindByGuid(keepHouse.HouseOwner ?? 0, out bool isOnline); if (player == null) { log.Error($"{session.Player.Name}.HandleHouseSelect({houseIdx}) - couldn't find HouseOwner {keepHouse.HouseOwner} for {keepHouse.Name} ({keepHouse.Guid})"); return; } player.HouseId = keepHouse.HouseId; player.HouseInstance = keepHouse.Guid.Full; player.SaveBiotaToDatabase(); // update house panel for current player var actionChain = new ActionChain(); actionChain.AddDelaySeconds(3.0f); // wait for slumlord inventory biotas above to save actionChain.AddAction(session.Player, session.Player.HandleActionQueryHouse); actionChain.EnqueueChain(); Console.WriteLine("OK"); }