-
-
Save ikkentim/5b3e0bae8b25e4706e0762aab5f4cdd8 to your computer and use it in GitHub Desktop.
VehicleInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LSRES | |
// Copyright (C) 2015 Tim Potze | |
using System.Collections.Generic; | |
using FluentNHibernate.Mapping; | |
using LSRES.Positioning; | |
using LSRES.Teams; | |
using LSRES.World; | |
using SampSharp.GameMode.Definitions; | |
namespace LSRES.Data | |
{ | |
/// <summary> | |
/// Contains information about a <see cref="Vehicle" />. | |
/// </summary> | |
public class VehicleInfo | |
{ | |
/// <summary> | |
/// Initializes a new instance of the <see cref="VehicleInfo" /> class. | |
/// </summary> | |
public VehicleInfo() | |
{ | |
Mods = new List<VehicleModInfo>(); | |
Color1 = -1; | |
Color2 = -1; | |
Paintjob = 3; | |
} | |
/// <summary> | |
/// Gets or sets the identifier of this vehicle. | |
/// </summary> | |
public virtual int Id { get; set; } | |
/// <summary> | |
/// Gets or sets the position of this vehicle. | |
/// </summary> | |
public virtual SpawnPoint Position { get; set; } | |
/// <summary> | |
/// Gets or sets a value indicating whether this vehicle is static. | |
/// </summary> | |
public virtual bool IsStatic { get; set; } | |
/// <summary> | |
/// Gets or sets the model of this vehicle. | |
/// </summary> | |
public virtual VehicleModelType Model { get; set; } | |
/// <summary> | |
/// Gets or sets the color1 of this vehicle. | |
/// </summary> | |
public virtual int Color1 { get; set; } | |
/// <summary> | |
/// Gets or sets the color2 of this vehicle. | |
/// </summary> | |
public virtual int Color2 { get; set; } | |
/// <summary> | |
/// Gets or sets the paintjob of this vehicle. | |
/// </summary> | |
public virtual int Paintjob { get; set; } | |
/// <summary> | |
/// Gets or sets the team of this vehicle. | |
/// </summary> | |
public virtual TeamType Team { get; set; } | |
/// <summary> | |
/// Gets or sets the number plate of this vehicle. | |
/// </summary> | |
public virtual NumberPlateInfo NumberPlate { get; set; } | |
/// <summary> | |
/// Gets or sets the state of the panels of this vehicle. | |
/// </summary> | |
public virtual int PanelsState { get; set; } | |
/// <summary> | |
/// Gets or sets the state of the doors of this vehicle. | |
/// </summary> | |
public virtual int DoorsState { get; set; } | |
/// <summary> | |
/// Gets or sets the state of the tires of this vehicle. | |
/// </summary> | |
public virtual int TiresState { get; set; } | |
/// <summary> | |
/// Gets or sets the state of the lights of this vehicle. | |
/// </summary> | |
public virtual int LightsState { get; set; } | |
/// <summary> | |
/// Gets or sets the health of this vehicle. | |
/// </summary> | |
public virtual float Health { get; set; } | |
/// <summary> | |
/// Gets or sets the mods of this vehicle. | |
/// </summary> | |
public virtual IList<VehicleModInfo> Mods { get; protected set; } | |
/// <summary> | |
/// Gets or sets a value indicating whether the lights of this vehicle are on. | |
/// </summary> | |
public virtual bool LightsOn { get; set; } | |
/// <summary> | |
/// Gets or sets a value indicating whether the engine of this vehicle is on. | |
/// </summary> | |
public virtual bool EngineOn { get; set; } | |
private class ClassMap : ClassMap<VehicleInfo> | |
{ | |
public ClassMap() | |
{ | |
Id(x => x.Id); | |
Component(x => x.Position).ColumnPrefix("Position"); | |
Map(x => x.Model); | |
Map(x => x.IsStatic); | |
Map(x => x.Color1); | |
Map(x => x.Color2); | |
Map(x => x.Paintjob); | |
Map(x => x.Team); | |
References(x => x.NumberPlate) | |
.Not.LazyLoad() | |
.Cascade.SaveUpdate(); | |
Map(x => x.PanelsState); | |
Map(x => x.DoorsState); | |
Map(x => x.TiresState); | |
Map(x => x.LightsState); | |
Map(x => x.Health); | |
HasMany(x => x.Mods) | |
.KeyColumns.Add("Vehicle_id") | |
.Not.LazyLoad() | |
.Cascade.SaveUpdate(); | |
Map(x => x.LightsOn); | |
Map(x => x.EngineOn); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment