diff --git a/Source/ACE.Server/Managers/HouseManager.cs b/Source/ACE.Server/Managers/HouseManager.cs index d218fdc548..a5d73114a0 100644 --- a/Source/ACE.Server/Managers/HouseManager.cs +++ b/Source/ACE.Server/Managers/HouseManager.cs @@ -400,6 +400,7 @@ private static void HandleRentPaid(PlayerHouse playerHouse) player.SaveBiotaToDatabase(); + var clearedInventoryStatus = ""; if (playerHouse.House.HouseStatus == HouseStatus.Active) { // clear out slumlord inventory @@ -407,9 +408,10 @@ private static void HandleRentPaid(PlayerHouse playerHouse) slumlord.ClearInventory(); slumlord.SaveBiotaToDatabase(); + clearedInventoryStatus = "and cleared "; } - log.DebugFormat("[HOUSE] HouseManager.HandleRentPaid({0}): rent payment successful!", playerHouse.PlayerName); + log.DebugFormat($"[HOUSE] HouseManager.HandleRentPaid({0}): rent payment successfully collected {clearedInventoryStatus}from SlumLord!", playerHouse.PlayerName); // re-add item to queue AddRentQueue(player, playerHouse.House); @@ -450,7 +452,7 @@ public static void HandleEviction(House house, uint playerGuid, bool multihouse var nextRentTime = house.GetRentDue(purchaseTime); player.HouseRentTimestamp = (int)nextRentTime; - log.DebugFormat("[HOUSE] HouseManager.HandleRentPaid({0}): house rent disabled via config", player.Name); + log.DebugFormat("[HOUSE] HouseManager.HandleEviction({0}): house rent disabled via config", player.Name); // re-add item to queue AddRentQueue(player, house); diff --git a/Source/ACE.Server/Network/Structure/HouseData.cs b/Source/ACE.Server/Network/Structure/HouseData.cs index e4b232aad4..4a55dd3f60 100644 --- a/Source/ACE.Server/Network/Structure/HouseData.cs +++ b/Source/ACE.Server/Network/Structure/HouseData.cs @@ -56,6 +56,12 @@ public void SetRentItems(List rentItems) /// public void SetPaidItems(SlumLord slumlord) { + if (slumlord.House?.HouseOwner != null) + { + foreach (var item in Buy) + item.Paid = item.Num; + } + if (slumlord.House?.HouseStatus == HouseStatus.InActive) { foreach (var item in Rent) diff --git a/Source/ACE.Server/Network/Structure/HouseProfile.cs b/Source/ACE.Server/Network/Structure/HouseProfile.cs index 7e021603cd..b4323bde79 100644 --- a/Source/ACE.Server/Network/Structure/HouseProfile.cs +++ b/Source/ACE.Server/Network/Structure/HouseProfile.cs @@ -58,6 +58,12 @@ public void SetRentItems(List rentItems) /// public void SetPaidItems(SlumLord slumlord) { + if (slumlord.House?.HouseOwner != null) + { + foreach (var item in Buy) + item.Paid = item.Num; + } + if (slumlord.House?.HouseStatus == HouseStatus.InActive) { foreach (var item in Rent) diff --git a/Source/ACE.Server/WorldObjects/House.cs b/Source/ACE.Server/WorldObjects/House.cs index 91b6f5b48c..6486756bd8 100644 --- a/Source/ACE.Server/WorldObjects/House.cs +++ b/Source/ACE.Server/WorldObjects/House.cs @@ -167,6 +167,8 @@ public static House Load(uint houseGuid, bool isBasement = false) house.ChildLinks.Remove(house.SlumLord); house.ChildLinks.Add(slumlord); + + slumlord.ParentLink = house; } return house; } diff --git a/Source/ACE.Server/WorldObjects/Player_House.cs b/Source/ACE.Server/WorldObjects/Player_House.cs index aaaee3e478..18aeef4cdf 100644 --- a/Source/ACE.Server/WorldObjects/Player_House.cs +++ b/Source/ACE.Server/WorldObjects/Player_House.cs @@ -191,12 +191,17 @@ public void HandleActionRentHouse(uint slumlord_id, List item_ids) var slumlord = FindObject(slumlord_id, SearchLocations.Landblock) as SlumLord; if (slumlord == null) + { + log.Warn($"[HOUSE] {Name}.HandleActionRentHouse({slumlord_id:X8}): Could not find SlumLord in world."); return; + } if (slumlord.IsRentPaid()) { //Session.Network.EnqueueSend(new GameEventWeenieError(Session, WeenieError.HouseRentFailed)); // WeenieError.HouseRentFailed == blank message Session.Network.EnqueueSend(new GameMessageSystemChat("The maintenance has already been paid for this period.\nYou may not prepay next period's maintenance.", ChatMessageType.Broadcast)); + + log.Info($"[HOUSE] {Name}.HandleActionRentHouse({slumlord_id:X8}): The maintenance has already been paid for this period."); return; } @@ -211,6 +216,8 @@ public void HandleActionRentHouse(uint slumlord_id, List item_ids) if (ownerHouses.Count() > 1) { Session.Network.EnqueueSend(new GameMessageSystemChat("The owner of this house currently owns multiple houses. Maintenance cannot be paid until they only own 1 house.", ChatMessageType.Broadcast)); + + log.Info($"[HOUSE] {Name}.HandleActionRentHouse({slumlord_id:X8}): The owner of this house currently owns multiple houses. Maintenance cannot be paid until they only own 1 house."); return; } } @@ -275,7 +282,10 @@ public void HandleActionRentHouse(uint slumlord_id, List item_ids) } if (consumeItems.Count == 0) + { + log.Warn($"[HOUSE] {Name}.HandleActionRentHouse({slumlord_id:X8}): Nothing sent could be transferred to slumlord for rent."); return; + } foreach (var consumeItem in consumeItems) TryConsumeItemForRent(slumlord, consumeItem); @@ -292,7 +302,11 @@ public void HandleActionRentHouse(uint slumlord_id, List item_ids) HandleActionQueryHouse(); - Session.Network.EnqueueSend(new GameMessageSystemChat($"Maintenance {(slumlord.IsRentPaid() ? "" : "partially ")}paid.", ChatMessageType.Broadcast)); + var maintenanceStatus = $"Maintenance {(slumlord.IsRentPaid() ? "" : "partially ")}paid."; + + Session.Network.EnqueueSend(new GameMessageSystemChat(maintenanceStatus, ChatMessageType.Broadcast)); + + log.Info($"[HOUSE] {Name}.HandleActionRentHouse({slumlord_id:X8}): {maintenanceStatus}"); } ///