Skip to content

Commit

Permalink
Show correct time on static time maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Dec 16, 2024
1 parent 754006d commit e2fd4c0
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Fika.Core/UI/Custom/MainMenuUIScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ private DateTime BackendTime
}
}

private DateTime StaticTime
{
get
{
return new DateTime(2016, 8, 4, 15, 28, 0);
}
}

protected void Start()
{
instance = this;
Expand Down Expand Up @@ -163,8 +171,14 @@ private void ClearAndQueryPlayers()
SetupPlayers(ref response);
}

private string ConvertToTime(EDateTime dateTime)
private string ConvertToTime(EDateTime dateTime, bool staticTime)
{
if (staticTime)
{
DateTime staticDate = StaticTime;
return dateTime == EDateTime.CURR ? staticDate.ToString("HH:mm:ss") : staticDate.AddHours(-12).ToString("HH:mm:ss");
}

DateTime backendTime = BackendTime;
if (backendTime == DateTime.MinValue)
{
Expand All @@ -173,6 +187,11 @@ private string ConvertToTime(EDateTime dateTime)
return dateTime == EDateTime.CURR ? backendTime.ToString("HH:mm:ss") : backendTime.AddHours(-12).ToString("HH:mm:ss");
}

private bool IsStaticTimeLocation(string location)
{
return location is "factory4_day" or "factory4_night" or "laboratory";
}

private void SetupPlayers(ref FikaPlayerPresence[] responses)
{
foreach (FikaPlayerPresence presence in responses)
Expand All @@ -184,7 +203,7 @@ private void SetupPlayers(ref FikaPlayerPresence[] responses)
{
RaidInformation information = presence.RaidInformation.Value;
string side = information.Side == ESideType.Pmc ? "RaidSidePmc".Localized() : "RaidSideScav".Localized();
string time = ConvertToTime(information.Time);
string time = ConvertToTime(information.Time, IsStaticTimeLocation(information.Location));
HoverTooltipArea tooltip = newPlayer.AddComponent<HoverTooltipArea>();
tooltip.enabled = true;
tooltip.SetMessageText(string.Format(LocaleUtils.UI_MMUI_RAID_DETAILS.Localized(), side,
Expand Down

0 comments on commit e2fd4c0

Please sign in to comment.