Show house owner name when house has owner

This commit is contained in:
hydrant
2019-07-30 10:39:10 +02:00
parent 436902ca57
commit 63cb557d66
2 changed files with 10 additions and 5 deletions

View File

@@ -20,8 +20,6 @@ export default function house(globalData: GlobalData) {
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Hausmenü öffnen'); mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Hausmenü öffnen');
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1); mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
mp.keys.bind(0x45, false, keyPressHandler); mp.keys.bind(0x45, false, keyPressHandler);
keyBound = true; keyBound = true;
}); });
@@ -29,7 +27,13 @@ export default function house(globalData: GlobalData) {
function keyPressHandler() { function keyPressHandler() {
mp.gui.chat.push("open menu"); mp.gui.chat.push("open menu");
mp.game.ui.clearHelp(true); mp.game.ui.clearHelp(true);
houseMenu = new Menu("Hausverwaltung", houseData.Type, new Point(50, 50), null, null);
var subTitle = houseData.Type;
if (houseData.OwnerName) {
subTitle += " von " + houseData.OwnerData;
}
houseMenu = new Menu("Hausverwaltung", subTitle, new Point(50, 50), null, null);
globalData.InMenu = true; globalData.InMenu = true;
mp.gui.chat.push(houseState.toString()); mp.gui.chat.push(houseState.toString());

View File

@@ -83,12 +83,12 @@ namespace ReallifeGamemode.Server.Managers
{ {
using (dbContext = new DatabaseContext()) using (dbContext = new DatabaseContext())
{ {
return dbContext.Houses.Where(h => h.Id == id).FirstOrDefault(); return dbContext.Houses.Where(h => h.Id == id).Include(h => h.Owner).FirstOrDefault();
} }
} }
else else
{ {
return dbContext.Houses.Where(h => h.Id == id).FirstOrDefault(); return dbContext.Houses.Where(h => h.Id == id).Include(h => h.Owner).FirstOrDefault();
} }
} }
@@ -140,6 +140,7 @@ namespace ReallifeGamemode.Server.Managers
var newHouse = new var newHouse = new
{ {
OwnerName = house.Owner?.Name,
house.RentalFee, house.RentalFee,
house.Price, house.Price,
house.Type, house.Type,