improve house
This commit is contained in:
@@ -28,19 +28,10 @@ namespace ReallifeGamemode.Database.Entities
|
|||||||
public DateTime LastRentSetTime { get; set; }
|
public DateTime LastRentSetTime { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Vector3 Position => new Vector3(X, Y, Z);
|
public Position Position => new Position(X, Y, Z);
|
||||||
|
|
||||||
[NotMapped]
|
|
||||||
public Position NewPosition => new Position(X, Y, Z);
|
|
||||||
|
|
||||||
[ForeignKey("Owner")]
|
[ForeignKey("Owner")]
|
||||||
public int? OwnerId { get; set; }
|
public int? OwnerId { get; set; }
|
||||||
public User Owner { get; set; }
|
public User Owner { get; set; }
|
||||||
|
|
||||||
[NotMapped]
|
|
||||||
public Player User => Owner?.Player;
|
|
||||||
|
|
||||||
[NotMapped]
|
|
||||||
public IPlayer OwnerPlayer => new RagePlayer(User);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ namespace ReallifeGamemode.Server.Core.Managers
|
|||||||
|
|
||||||
public House GetNearHouse(Position position, DatabaseContext dbContext)
|
public House GetNearHouse(Position position, DatabaseContext dbContext)
|
||||||
{
|
{
|
||||||
return dbContext.Houses.Where(h => h.NewPosition.DistanceTo(position) <= 5f).Include(h => h.Owner).OrderBy(h => h.NewPosition.DistanceTo(position)).FirstOrDefault();
|
return dbContext.Houses.Where(h => h.Position.DistanceTo(position) <= 5f).Include(h => h.Owner).OrderBy(h => h.Position.DistanceTo(position)).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadAllHouses()
|
public void ReloadAllHouses()
|
||||||
@@ -337,7 +337,7 @@ namespace ReallifeGamemode.Server.Core.Managers
|
|||||||
|
|
||||||
player.SendNotification("~g~Du hast dich in das Haus eingemietet");
|
player.SendNotification("~g~Du hast dich in das Haus eingemietet");
|
||||||
|
|
||||||
house.OwnerPlayer?.SendNotification($"~y~{player.Name}~s~ hat sich in dein Haus eingemietet.");
|
house.Owner?.NewPlayer?.SendNotification($"~y~{player.Name}~s~ hat sich in dein Haus eingemietet.");
|
||||||
SendPlayerHouseData(player, house);
|
SendPlayerHouseData(player, house);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ namespace ReallifeGamemode.Server.Core.Managers
|
|||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
player.SendNotification("~g~Du hast den Mietvertrag gekündigt.");
|
player.SendNotification("~g~Du hast den Mietvertrag gekündigt.");
|
||||||
house.OwnerPlayer?.SendNotification($"~y~{player.Name}~s~ hat seinen Mietvertrag gekündigt.");
|
house.Owner?.NewPlayer?.SendNotification($"~y~{player.Name}~s~ hat seinen Mietvertrag gekündigt.");
|
||||||
|
|
||||||
RemoveHouse(house);
|
RemoveHouse(house);
|
||||||
LoadHouse(house);
|
LoadHouse(house);
|
||||||
|
|||||||
Reference in New Issue
Block a user