hanf alle 8 stunden neu generieren
This commit is contained in:
@@ -90,13 +90,26 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly TimeSpan MAX_PLANT_TIME = TimeSpan.FromHours(6);
|
private static readonly TimeSpan MAX_PLANT_TIME = TimeSpan.FromHours(6);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ab welcher Zeit Pflanzen geerntet werden können
|
||||||
|
/// </summary>
|
||||||
private static readonly TimeSpan MIN_PLANT_TIME_TO_HARVEST = TimeSpan.FromHours(4);
|
private static readonly TimeSpan MIN_PLANT_TIME_TO_HARVEST = TimeSpan.FromHours(4);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interval, wann Hanf-Preise neu generiert werden sollen
|
||||||
|
/// </summary>
|
||||||
|
private static readonly TimeSpan REGENERATE_PRICES_INTERVAL = TimeSpan.FromHours(8);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Timer der den Status des Verarbeiters zurücksetzt
|
/// Timer der den Status des Verarbeiters zurücksetzt
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static Timer _manufacturerDoneTimer = new Timer(TimeSpan.FromSeconds(10).TotalMilliseconds);
|
private static Timer _manufacturerDoneTimer = new Timer(TimeSpan.FromSeconds(10).TotalMilliseconds);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Timer der die
|
||||||
|
/// </summary>
|
||||||
|
private static Timer _regeneratePricesTimes = new Timer(REGENERATE_PRICES_INTERVAL.TotalMilliseconds);
|
||||||
|
|
||||||
public static List<HanfNpc> HanfNpcs { get; private set; } = new List<HanfNpc>();
|
public static List<HanfNpc> HanfNpcs { get; private set; } = new List<HanfNpc>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -160,7 +173,8 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
colShape.OnEntityEnterColShape += OnHanfNpcColShapeEnter;
|
colShape.OnEntityEnterColShape += OnHanfNpcColShapeEnter;
|
||||||
colShape.OnEntityExitColShape += OnHanfNpcColShapeExit;
|
colShape.OnEntityExitColShape += OnHanfNpcColShapeExit;
|
||||||
}
|
}
|
||||||
|
_regeneratePricesTimes.Elapsed += (s, e) => RegeneratePrices();
|
||||||
|
_regeneratePricesTimes.Start();
|
||||||
RegeneratePrices();
|
RegeneratePrices();
|
||||||
|
|
||||||
NAPI.Marker.CreateMarker(GTANetworkAPI.MarkerType.VerticalCylinder, ASSERVATENKAMMER_POSITION.Subtract(new Vector3(0, 0, 3.0)), new Vector3(), new Vector3(), 3.0f, Colors.White);
|
NAPI.Marker.CreateMarker(GTANetworkAPI.MarkerType.VerticalCylinder, ASSERVATENKAMMER_POSITION.Subtract(new Vector3(0, 0, 3.0)), new Vector3(), new Vector3(), 3.0f, Colors.White);
|
||||||
@@ -192,6 +206,11 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
return $"{h.Id} ({h.Type}) {h.Price} dollars";
|
return $"{h.Id} ({h.Type}) {h.Price} dollars";
|
||||||
}));
|
}));
|
||||||
logger.LogInformation("Generated prices: {0}", generatedPricesStr);
|
logger.LogInformation("Generated prices: {0}", generatedPricesStr);
|
||||||
|
|
||||||
|
NAPI.Task.Run(() =>
|
||||||
|
{
|
||||||
|
ChatService.BroadcastAdmin("~b~[ADMIN]~s~ Die Hanf-Preise wurden neu generiert.", AdminLevel.ADMIN);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HanfNpc GetHanfNpcFromColShape(ColShape colShape)
|
private static HanfNpc GetHanfNpcFromColShape(ColShape colShape)
|
||||||
|
|||||||
Reference in New Issue
Block a user