Top.Mail.Ru
Перейти к содержанию

Чит мод - Lust Goddess LTS


Рекомендуемые сообщения

  • Релизер
Только что, akrabuamelu сказал:

при этом я за раз могу выполнить например 5 квестов, а после перезахода на мне эти 5 квестов как взятые висеть будут

 

Значит игра не считает что ты в альянсе. Советую поменять альянс или перезайти в свой.

https://boosty.to/sayanru/donate - Копим на бесперебойник

Ссылка на комментарий
Поделиться на другие сайты

3 минуты назад, SAYANru сказал:

Значит игра не считает что ты в альянсе. Советую поменять альянс или перезайти в свой.

перезаходил. сейчас на втором аккаунте проверил. такая же фигня (в клан только что зашёл)

Ссылка на комментарий
Поделиться на другие сайты

  • Релизер
16 минут назад, akrabuamelu сказал:

при этом меня игра ещё вот такими приколами развлекает https://imgur.com/a/Y4DeBFT

мдэ

 

https://boosty.to/sayanru/donate - Копим на бесперебойник

Ссылка на комментарий
Поделиться на другие сайты

  • Релизер
44 минуты назад, 45hgv43whgf сказал:

я поймал их всех :D

You're cool, buddy. Will you share?)

Технической поддержкой не занимаюсь!

Вся информация для Lust Goddess

lsg.jpg

Ссылка на комментарий
Поделиться на другие сайты

  • Релизер
9 минут назад, 45hgv43whgf сказал:

i believe some of you guys already fiddled with time change in CE but i changed the class responsible for server time to return a simulated server time

Can you clarify more precisely?) I've only worked with Cheat Engine once.

https://boosty.to/sayanru/donate - Копим на бесперебойник

Ссылка на комментарий
Поделиться на другие сайты

  • Релизер
2 минуты назад, SAYANru сказал:

Can you clarify more precisely?) I've only worked with Cheat Engine once.

Мне кажется он изменил файл, он же говорил про класс отвечающий за время.

  • Like 1

Технической поддержкой не занимаюсь!

Вся информация для Lust Goddess

lsg.jpg

Ссылка на комментарий
Поделиться на другие сайты

  • Релизер
Только что, sx66627 сказал:

Мне кажется он изменил файл, он же говорил про класс отвечающий за время.

Время сервера значит... Я к нему ещё не подбирался. Нужно проверить

https://boosty.to/sayanru/donate - Копим на бесперебойник

Ссылка на комментарий
Поделиться на другие сайты

ok here it is, replace the whole class with this and change the line for time to get to Commander Unlocks.  (for whatever reason i implemented it as running time, it also works as static time)

 

Class> DateTimeModule

 

Roxie:
SetManualServerTime(new DateTime(2024, 5, 29, 17, 0, 0));

Alexa:
SetManualServerTime(new DateTime(2024, 6, 22, 17, 0, 0));

S0lt:
SetManualServerTime(new DateTime(2024, 3, 30, 17, 0, 0));

(code with running time)

 

Спойлер
using System;
using System.Text;
using Assets.Scripts.UtilScripts;
using NGUI.Scripts.Internal;
using UnityEngine;

public class DateTimeModule
{
    private static TimeSpan serverDiff = new TimeSpan(0L);
    private static DateTime _serverNowTime = DateTime.UtcNow;
    private static double serverTimeUpdated = (double)Time.realtimeSinceStartup;
    private static bool isServerTimeSynced;
    private static int _serverNowCachedAtFrame;
    private static StringBuilder _sbTimeSpanToString = new StringBuilder();
    private static DateTime? initialManualServerTime = null;
    private static double manualServerTimeSetAt;

    public static DateTime now
    {
        get
        {
            return DateTime.Now;
        }
    }

    public static DateTime today
    {
        get
        {
            return DateTimeModule.now.Date;
        }
    }

    public static DateTime ServerToday
    {
        get
        {
            return new DateTime(DateTimeModule.ServerNow.Year, DateTimeModule.ServerNow.Month, DateTimeModule.ServerNow.Day, 12, 0, 0, DateTimeKind.Utc);
        }
    }

    public static DateTime Server6ShiftToday
    {
        get
        {
            DateTime dateTime = DateTimeModule.ServerNow.AddHours(6.0);
            return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 12, 0, 0, DateTimeKind.Utc);
        }
    }

    public static DateTime GetServerNow()
    {
        return DateTimeModule.ServerNow;
    }

    public static TimeSpan ServerDiff
    {
        get
        {
            return DateTimeModule.serverDiff;
        }
    }

    public static void SyncServerTime(DateTime serverTime)
    {
        if (DateTimeModule._serverNowTime > serverTime && DateTimeModule.isServerTimeSynced)
        {
            return;
        }
        DateTimeModule.isServerTimeSynced = true;
        DateTimeModule._serverNowTime = serverTime;
        DateTimeModule.serverTimeUpdated = Time.realtimeSinceStartupAsDouble;
        DateTimeModule.serverDiff = serverTime - DateTime.Now;
    }

    public static DateTime ServerToLocal(DateTime serverTime)
    {
        DateTime result;
        try
        {
            result = serverTime.Add(-DateTimeModule.serverDiff);
        }
        catch (Exception)
        {
            string str = "Server to local error: server_time=";
            string str2 = serverTime.ToString("O");
            string str3 = " server_diff=";
            TimeSpan timeSpan = DateTimeModule.serverDiff;
            Debug.LogError(str + str2 + str3 + timeSpan.ToString());
            result = DateTime.Now;
        }
        return result;
    }

    public static DateTime ServerNow
    {
        get
        {
            if (initialManualServerTime.HasValue)
            {
                double elapsedTime = Time.realtimeSinceStartupAsDouble - manualServerTimeSetAt;
                return initialManualServerTime.Value.AddSeconds(elapsedTime);
            }

            if (DateTimeModule._serverNowCachedAtFrame == Time.frameCount)
            {
                return DateTimeModule._serverNowTime;
            }

            double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
            double value = realtimeSinceStartupAsDouble - DateTimeModule.serverTimeUpdated;
            DateTimeModule._serverNowTime = DateTimeModule._serverNowTime.AddSeconds(value);
            DateTimeModule.serverTimeUpdated = realtimeSinceStartupAsDouble;
            DateTimeModule._serverNowCachedAtFrame = Time.frameCount;
            return DateTimeModule._serverNowTime;
        }
    }

    public static TimeSpan GetTimeIn12HourInterval
    {
        get
        {
            return DateTimeModule.Server6ShiftToday.AddDays(1.0).AddHours(-18.0) - DateTimeModule.ServerNow;
        }
    }

    private static double GetTicksCount()
    {
        return IosUtils.GetUpTime();
    }

    public static string GetTimeAgoString(DateTime time, bool fullString = false, bool serverTime = true, bool shortTime = false)
    {
        string newValue = shortTime ? DateTimeModule.GetTimeBetweenShort(time, serverTime, fullString, false) : DateTimeModule.GetTimeBetween(time, fullString, serverTime, false);
        return Localization.LocalizeByKey("#time_ago", true, true).Replace("%time%", newValue);
    }

    public static string GetTimeBetween(int seconds, bool fullString = false, bool withSeconds = false)
    {
        return DateTimeModule.GetTimeBetween(TimeSpan.FromSeconds((double)seconds), fullString, withSeconds);
    }

    public static DateTime GetFirstDailyOccurence(DateTime start, DateTime utcTime)
    {
        DateTime dateTime = start;
        if (start.TimeOfDay > utcTime.TimeOfDay)
        {
            dateTime = start + TimeSpan.FromDays(1.0);
        }
        return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, utcTime.Hour, utcTime.Minute, utcTime.Second);
    }

    public static int GetSecondsFromString(string span)
    {
        if (span == "")
        {
            return -1;
        }
        span = span.Replace(" ", "");
        char c = span[span.Length - 1];
        int num = int.Parse(span.Replace(c.ToString(), ""));
        if (c <= 'h')
        {
            if (c == 'd')
            {
                return num * 86400;
            }
            if (c == 'h')
            {
                return num * 3600;
            }
        }
        else
        {
            if (c == 'm')
            {
                return num * 60;
            }
            if (c == 's')
            {
                return num;
            }
        }
        return 0;
    }

    public static string GetTimeBetween(DateTime time, bool fullString = false, bool serverTime = true, bool withSeconds = false)
    {
        return DateTimeModule.GetTimeBetween(DateTimeModule.GetTimeSpan(time, serverTime), fullString, withSeconds);
    }

    public static string GetTimeBetween(TimeSpan span, bool fullString = false, bool withSeconds = false)
    {
        string text;
        if (span.Days > 0)
        {
            if (span.Hours == 0)
            {
                text = Localization.LocalizeByKey("#time_difference_days_no_hours" + (fullString ? "_full" : ""), true, true).Replace("%days%", span.Days.ToString() ?? "").Replace("%hours%", span.Hours.ToString() ?? "");
            }
            else
            {
                text = Localization.LocalizeByKey("#time_difference_days" + (fullString ? "_full" : ""), true, true).Replace("%days%", span.Days.ToString() ?? "").Replace("%hours%", span.Hours.ToString() ?? "");
            }
        }
        else if (span.Hours > 0)
        {
            if (span.Minutes == 0)
            {
                text = Localization.LocalizeByKey("#time_difference_hours_no_minutes" + (fullString ? "_full" : ""), true, true).Replace("%hours%", span.Hours.ToString() ?? "").Replace("%mins%", span.Minutes.ToString() ?? "");
            }
            else
            {
                text = Localization.LocalizeByKey("#time_difference_hours" + (fullString ? "_full" : ""), true, true).Replace("%hours%", span.Hours.ToString() ?? "").Replace("%mins%", span.Minutes.ToString() ?? "");
            }
        }
        else if (span.Minutes > 0 && !withSeconds)
        {
            int num = span.Minutes;
            if (num == 0)
            {
                num = 1;
            }
            text = Localization.LocalizeByKey("#time_difference_minutes" + (fullString ? "_full" : ""), true, true).Replace("%minutes%", num.ToString() ?? "");
        }
        else if (span.Minutes > 0 && withSeconds)
        {
            text = Localization.LocalizeByKey("#time_difference_minutes_with_seconds" + (fullString ? "_full" : ""), true, true).Replace("%minutes%", span.Minutes.ToString()).Replace("%seconds%", span.Seconds.ToString());
        }
        else
        {
            text = Localization.LocalizeByKey("#time_difference_seconds" + (fullString ? "_full" : ""), true, true).Replace("%seconds%", span.Seconds.ToString() ?? "");
        }
        text = LocalizationUtils.ApplyEndings(text);
        return LocalizationUtils.RussianEnds(text);
    }

    public static string GetTimeBetweenLocalized(string key, DateTime targetTime, bool serverTime = true)
    {
        return DateTimeModule.GetTimeBetweenLocalized(key, DateTimeModule.GetTimeSpan(targetTime, serverTime));
    }

    public static string GetTimeBetweenLocalized(string key, TimeSpan timeSpan)
    {
        return Localization.LocalizeByKey(key, true, true).Replace("%days%", timeSpan.Days.ToString()).Replace("%hours%", timeSpan.Hours.ToString()).Replace("%minutes%", timeSpan.Minutes.ToString());
    }

    public static string GetTimeBetweenShort(DateTime time, bool serverTime = true, bool fullString = false, bool daysWithoutHours = false)
    {
        return DateTimeModule.GetTimeBetweenShort(DateTimeModule.GetTimeSpanBetween(time, serverTime), fullString, daysWithoutHours);
    }

    public static TimeSpan GetTimeSpanBetween(DateTime time, bool serverTime = true)
    {
        DateTime dateTime = serverTime ? DateTimeModule.ServerNow : DateTimeModule.now;
        TimeSpan result = time - dateTime;
        if (time < dateTime)
        {
            result = dateTime - time;
        }
        return result;
    }

    public static string GetTimeBetweenShort(int seconds, bool fullString = false, bool daysWithoutHours = false)
    {
        return DateTimeModule.GetTimeBetweenShort(TimeSpan.FromSeconds((double)seconds), fullString, daysWithoutHours);
    }

    public static string GetTimeBetweenShort(TimeSpan span, bool fullString = false, bool daysWithoutHours = false)
    {
        string result;
        if (span.TotalDays >= 1.0)
        {
            result = (daysWithoutHours ? Localization.LocalizeByKey("#time_difference_days_no_hours" + (fullString ? "_full" : ""), true, true).Replace("%days%", ((int)span.TotalDays).ToString() ?? "") : Localization.LocalizeByKey("#time_difference_days" + (fullString ? "_full" : ""), true, true).Replace("%days%", ((int)span.TotalDays).ToString() ?? "").Replace("%hours%", span.Hours.ToString() ?? ""));
        }
        else if (span.Hours > 0)
        {
            result = Localization.LocalizeByKey("#time_difference_hours_only" + (fullString ? "_full" : ""), true, true).Replace("%hours%", span.Hours.ToString() ?? "");
        }
        else if (span.Minutes > 0)
        {
            int minutes = span.Minutes;
            result = Localization.LocalizeByKey("#time_difference_minutes" + (fullString ? "_full" : ""), true, true).Replace("%minutes%", minutes.ToString() ?? "");
        }
        else
        {
            result = Localization.LocalizeByKey("#time_difference_less_minute" + (fullString ? "_full" : ""), true, true);
        }
        return result;
    }

    public static string TimeSpanToString(TimeSpan tSpan)
    {
        DateTimeModule._sbTimeSpanToString.Clear();
        if (tSpan.Days > 0)
        {
            DateTimeModule._sbTimeSpanToString.Append(tSpan.Hours + 24 * tSpan.Days).Append(':');
        }
        else
        {
            if (tSpan.Hours <= 9)
            {
                DateTimeModule._sbTimeSpanToString.Append('0');
            }
            DateTimeModule._sbTimeSpanToString.Append(tSpan.Hours).Append(':');
        }
        if (tSpan.Minutes <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Minutes).Append(':');
        if (tSpan.Seconds <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Seconds);
        return DateTimeModule._sbTimeSpanToString.ToString();
    }

    public static string TimeSpanToStringForCrashCars(TimeSpan tSpan)
    {
        DateTimeModule._sbTimeSpanToString.Clear();
        if (tSpan.Seconds <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Seconds).Append(':');
        if (tSpan.Milliseconds <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Milliseconds);
        return DateTimeModule._sbTimeSpanToString.ToString();
    }

    public static string GetTimeSpanString(TimeSpan time, bool fullString = false)
    {
        if (time.TotalHours < 25.0)
        {
            return DateTimeModule.TimeSpanToString(time);
        }
        return DateTimeModule.GetTimeBetween(time, fullString, false);
    }

    public static string DateTimeToString(DateTime dateTime)
    {
        string text = "%month%/%day%/%hrs%:%mnts%";
        string text2 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Month);
        string text3 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Day);
        string text4 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Hour);
        string text5 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Minute);
        return text.Replace("%month%", text2.ToString()).Replace("%day%", text3.ToString()).Replace("%hrs%", text4.ToString()).Replace("%mnts%", text5.ToString());
    }

    public static string DateTimeToStringWithSpace(DateTime dateTime)
    {
        string text = Localization.LocalizeByKey("#format_time_for_ban", true, true);
        string newValue = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Month);
        string newValue2 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Day);
        string newValue3 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Hour);
        string newValue4 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Minute);
        return text.Replace("%month%", newValue).Replace("%day%", newValue2).Replace("%hrs%", newValue3).Replace("%mnts%", newValue4);
    }

    public static string SecondsToString(int seconds)
    {
        string text;
        if (seconds >= 86400)
        {
            text = Localization.LocalizeByKey("#vip_time_days", true, true).Replace("%val%", Mathf.RoundToInt((float)seconds / 86400f).ToString());
        }
        else if (seconds >= 3600)
        {
            text = Localization.LocalizeByKey("#vip_time_hours", true, true).Replace("%val%", Mathf.RoundToInt((float)seconds / 3600f).ToString());
        }
        else if (seconds >= 60)
        {
            text = Localization.LocalizeByKey("#vip_time_minutes", true, true).Replace("%val%", Mathf.RoundToInt((float)seconds / 60f).ToString());
        }
        else
        {
            text = Localization.LocalizeByKey("#vip_time_seconds", true, true).Replace("%val%", seconds.ToString());
        }
        return LocalizationUtils.ApplyEndings(text);
    }

    public static string ValueToTwoSymbolFormat(int value)
    {
        if (value <= 9)
        {
            return "0" + value.ToString();
        }
        return value.ToString();
    }

    public static string TimeSpanToString(double seconds)
    {
        return DateTimeModule.TimeSpanToString(TimeSpan.FromSeconds(seconds));
    }

    public static bool IsToday(DateTime dateTime)
    {
        return DateTimeModule.ServerNow.Year == dateTime.Year && DateTimeModule.ServerNow.Month == dateTime.Month && DateTimeModule.ServerNow.Day == dateTime.Day;
    }

    public static TimeSpan GetTimeSpan(DateTime targetTime, bool serverTime = true)
    {
        DateTime dateTime = serverTime ? DateTimeModule.ServerNow : DateTimeModule.now;
        TimeSpan result = targetTime - dateTime;
        if (targetTime < dateTime)
        {
            result = dateTime - targetTime;
        }
        return result;
    }

    public static void SetManualServerTime(DateTime dateTime)
    {
        initialManualServerTime = dateTime;
        manualServerTimeSetAt = Time.realtimeSinceStartupAsDouble;
    }

    static DateTimeModule()
    {
        SetManualServerTime(new DateTime(2024, 6, 22, 17, 0, 0));
    }
}

 

code with static time

using System;
using System.Text;
using Assets.Scripts.UtilScripts;
using NGUI.Scripts.Internal;
using UnityEngine;

public class DateTimeModule
{
    private static TimeSpan serverDiff = new TimeSpan(0L);
    private static DateTime _serverNowTime = DateTime.UtcNow;
    private static double serverTimeUpdated = (double)Time.realtimeSinceStartup;
    private static bool isServerTimeSynced;
    private static int _serverNowCachedAtFrame;
    private static StringBuilder _sbTimeSpanToString = new StringBuilder();
    private static DateTime? manualServerTime = null;

    public static DateTime now
    {
        get
        {
            return DateTime.Now;
        }
    }

    public static DateTime today
    {
        get
        {
            return DateTimeModule.now.Date;
        }
    }

    public static DateTime ServerToday
    {
        get
        {
            return new DateTime(DateTimeModule.ServerNow.Year, DateTimeModule.ServerNow.Month, DateTimeModule.ServerNow.Day, 12, 0, 0, DateTimeKind.Utc);
        }
    }

    public static DateTime Server6ShiftToday
    {
        get
        {
            DateTime dateTime = DateTimeModule.ServerNow.AddHours(6.0);
            return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 12, 0, 0, DateTimeKind.Utc);
        }
    }

    public static DateTime GetServerNow()
    {
        return DateTimeModule.ServerNow;
    }

    public static TimeSpan ServerDiff
    {
        get
        {
            return DateTimeModule.serverDiff;
        }
    }

    public static void SyncServerTime(DateTime serverTime)
    {
        if (DateTimeModule._serverNowTime > serverTime && DateTimeModule.isServerTimeSynced)
        {
            return;
        }
        DateTimeModule.isServerTimeSynced = true;
        DateTimeModule._serverNowTime = serverTime;
        DateTimeModule.serverTimeUpdated = Time.realtimeSinceStartupAsDouble;
        DateTimeModule.serverDiff = serverTime - DateTime.Now;
    }

    public static DateTime ServerToLocal(DateTime serverTime)
    {
        DateTime result;
        try
        {
            result = serverTime.Add(-DateTimeModule.serverDiff);
        }
        catch (Exception)
        {
            string str = "Server to local error: server_time=";
            string str2 = serverTime.ToString("O");
            string str3 = " server_diff=";
            TimeSpan timeSpan = DateTimeModule.serverDiff;
            Debug.LogError(str + str2 + str3 + timeSpan.ToString());
            result = DateTime.Now;
        }
        return result;
    }

    public static DateTime ServerNow
    {
        get
        {
            if (manualServerTime.HasValue)
            {
                return manualServerTime.Value;
            }

            if (DateTimeModule._serverNowCachedAtFrame == Time.frameCount)
            {
                return DateTimeModule._serverNowTime;
            }

            double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
            double value = realtimeSinceStartupAsDouble - DateTimeModule.serverTimeUpdated;
            DateTimeModule._serverNowTime = DateTimeModule._serverNowTime.AddSeconds(value);
            DateTimeModule.serverTimeUpdated = realtimeSinceStartupAsDouble;
            DateTimeModule._serverNowCachedAtFrame = Time.frameCount;
            return DateTimeModule._serverNowTime;
        }
    }

    public static TimeSpan GetTimeIn12HourInterval
    {
        get
        {
            return DateTimeModule.Server6ShiftToday.AddDays(1.0).AddHours(-18.0) - DateTimeModule.ServerNow;
        }
    }

    private static double GetTicksCount()
    {
        return IosUtils.GetUpTime();
    }

    public static string GetTimeAgoString(DateTime time, bool fullString = false, bool serverTime = true, bool shortTime = false)
    {
        string newValue = shortTime ? DateTimeModule.GetTimeBetweenShort(time, serverTime, fullString, false) : DateTimeModule.GetTimeBetween(time, fullString, serverTime, false);
        return Localization.LocalizeByKey("#time_ago", true, true).Replace("%time%", newValue);
    }

    public static string GetTimeBetween(int seconds, bool fullString = false, bool withSeconds = false)
    {
        return DateTimeModule.GetTimeBetween(TimeSpan.FromSeconds((double)seconds), fullString, withSeconds);
    }

    public static DateTime GetFirstDailyOccurence(DateTime start, DateTime utcTime)
    {
        DateTime dateTime = start;
        if (start.TimeOfDay > utcTime.TimeOfDay)
        {
            dateTime = start + TimeSpan.FromDays(1.0);
        }
        return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, utcTime.Hour, utcTime.Minute, utcTime.Second);
    }

    public static int GetSecondsFromString(string span)
    {
        if (span == "")
        {
            return -1;
        }
        span = span.Replace(" ", "");
        char c = span[span.Length - 1];
        int num = int.Parse(span.Replace(c.ToString(), ""));
        if (c <= 'h')
        {
            if (c == 'd')
            {
                return num * 86400;
            }
            if (c == 'h')
            {
                return num * 3600;
            }
        }
        else
        {
            if (c == 'm')
            {
                return num * 60;
            }
            if (c == 's')
            {
                return num;
            }
        }
        return 0;
    }

    public static string GetTimeBetween(DateTime time, bool fullString = false, bool serverTime = true, bool withSeconds = false)
    {
        return DateTimeModule.GetTimeBetween(DateTimeModule.GetTimeSpan(time, serverTime), fullString, withSeconds);
    }

    public static string GetTimeBetween(TimeSpan span, bool fullString = false, bool withSeconds = false)
    {
        string text;
        if (span.Days > 0)
        {
            if (span.Hours == 0)
            {
                text = Localization.LocalizeByKey("#time_difference_days_no_hours" + (fullString ? "_full" : ""), true, true).Replace("%days%", span.Days.ToString() ?? "").Replace("%hours%", span.Hours.ToString() ?? "");
            }
            else
            {
                text = Localization.LocalizeByKey("#time_difference_days" + (fullString ? "_full" : ""), true, true).Replace("%days%", span.Days.ToString() ?? "").Replace("%hours%", span.Hours.ToString() ?? "");
            }
        }
        else if (span.Hours > 0)
        {
            if (span.Minutes == 0)
            {
                text = Localization.LocalizeByKey("#time_difference_hours_no_minutes" + (fullString ? "_full" : ""), true, true).Replace("%hours%", span.Hours.ToString() ?? "").Replace("%mins%", span.Minutes.ToString() ?? "");
            }
            else
            {
                text = Localization.LocalizeByKey("#time_difference_hours" + (fullString ? "_full" : ""), true, true).Replace("%hours%", span.Hours.ToString() ?? "").Replace("%mins%", span.Minutes.ToString() ?? "");
            }
        }
        else if (span.Minutes > 0 && !withSeconds)
        {
            int num = span.Minutes;
            if (num == 0)
            {
                num = 1;
            }
            text = Localization.LocalizeByKey("#time_difference_minutes" + (fullString ? "_full" : ""), true, true).Replace("%minutes%", num.ToString() ?? "");
        }
        else if (span.Minutes > 0 && withSeconds)
        {
            text = Localization.LocalizeByKey("#time_difference_minutes_with_seconds" + (fullString ? "_full" : ""), true, true).Replace("%minutes%", span.Minutes.ToString()).Replace("%seconds%", span.Seconds.ToString());
        }
        else
        {
            text = Localization.LocalizeByKey("#time_difference_seconds" + (fullString ? "_full" : ""), true, true).Replace("%seconds%", span.Seconds.ToString() ?? "");
        }
        text = LocalizationUtils.ApplyEndings(text);
        return LocalizationUtils.RussianEnds(text);
    }

    public static string GetTimeBetweenLocalized(string key, DateTime targetTime, bool serverTime = true)
    {
        return DateTimeModule.GetTimeBetweenLocalized(key, DateTimeModule.GetTimeSpan(targetTime, serverTime));
    }

    public static string GetTimeBetweenLocalized(string key, TimeSpan timeSpan)
    {
        return Localization.LocalizeByKey(key, true, true).Replace("%days%", timeSpan.Days.ToString()).Replace("%hours%", timeSpan.Hours.ToString()).Replace("%minutes%", timeSpan.Minutes.ToString());
    }

    public static string GetTimeBetweenShort(DateTime time, bool serverTime = true, bool fullString = false, bool daysWithoutHours = false)
    {
        return DateTimeModule.GetTimeBetweenShort(DateTimeModule.GetTimeSpanBetween(time, serverTime), fullString, daysWithoutHours);
    }

    public static TimeSpan GetTimeSpanBetween(DateTime time, bool serverTime = true)
    {
        DateTime dateTime = serverTime ? DateTimeModule.ServerNow : DateTimeModule.now;
        TimeSpan result = time - dateTime;
        if (time < dateTime)
        {
            result = dateTime - time;
        }
        return result;
    }

    public static string GetTimeBetweenShort(int seconds, bool fullString = false, bool daysWithoutHours = false)
    {
        return DateTimeModule.GetTimeBetweenShort(TimeSpan.FromSeconds((double)seconds), fullString, daysWithoutHours);
    }

    public static string GetTimeBetweenShort(TimeSpan span, bool fullString = false, bool daysWithoutHours = false)
    {
        string result;
        if (span.TotalDays >= 1.0)
        {
            result = (daysWithoutHours ? Localization.LocalizeByKey("#time_difference_days_no_hours" + (fullString ? "_full" : ""), true, true).Replace("%days%", ((int)span.TotalDays).ToString() ?? "") : Localization.LocalizeByKey("#time_difference_days" + (fullString ? "_full" : ""), true, true).Replace("%days%", ((int)span.TotalDays).ToString() ?? "").Replace("%hours%", span.Hours.ToString() ?? ""));
        }
        else if (span.Hours > 0)
        {
            result = Localization.LocalizeByKey("#time_difference_hours_only" + (fullString ? "_full" : ""), true, true).Replace("%hours%", span.Hours.ToString() ?? "");
        }
        else if (span.Minutes > 0)
        {
            int minutes = span.Minutes;
            result = Localization.LocalizeByKey("#time_difference_minutes" + (fullString ? "_full" : ""), true, true).Replace("%minutes%", minutes.ToString() ?? "");
        }
        else
        {
            result = Localization.LocalizeByKey("#time_difference_less_minute" + (fullString ? "_full" : ""), true, true);
        }
        return result;
    }

    public static string TimeSpanToString(TimeSpan tSpan)
    {
        DateTimeModule._sbTimeSpanToString.Clear();
        if (tSpan.Days > 0)
        {
            DateTimeModule._sbTimeSpanToString.Append(tSpan.Hours + 24 * tSpan.Days).Append(':');
        }
        else
        {
            if (tSpan.Hours <= 9)
            {
                DateTimeModule._sbTimeSpanToString.Append('0');
            }
            DateTimeModule._sbTimeSpanToString.Append(tSpan.Hours).Append(':');
        }
        if (tSpan.Minutes <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Minutes).Append(':');
        if (tSpan.Seconds <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Seconds);
        return DateTimeModule._sbTimeSpanToString.ToString();
    }

    public static string TimeSpanToStringForCrashCars(TimeSpan tSpan)
    {
        DateTimeModule._sbTimeSpanToString.Clear();
        if (tSpan.Seconds <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Seconds).Append(':');
        if (tSpan.Milliseconds <= 9)
        {
            DateTimeModule._sbTimeSpanToString.Append('0');
        }
        DateTimeModule._sbTimeSpanToString.Append(tSpan.Milliseconds);
        return DateTimeModule._sbTimeSpanToString.ToString();
    }

    public static string GetTimeSpanString(TimeSpan time, bool fullString = false)
    {
        if (time.TotalHours < 25.0)
        {
            return DateTimeModule.TimeSpanToString(time);
        }
        return DateTimeModule.GetTimeBetween(time, fullString, false);
    }

    public static string DateTimeToString(DateTime dateTime)
    {
        string text = "%month%/%day%/%hrs%:%mnts%";
        string text2 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Month);
        string text3 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Day);
        string text4 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Hour);
        string text5 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Minute);
        return text.Replace("%month%", text2.ToString()).Replace("%day%", text3.ToString()).Replace("%hrs%", text4.ToString()).Replace("%mnts%", text5.ToString());
    }

    public static string DateTimeToStringWithSpace(DateTime dateTime)
    {
        string text = Localization.LocalizeByKey("#format_time_for_ban", true, true);
        string newValue = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Month);
        string newValue2 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Day);
        string newValue3 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Hour);
        string newValue4 = DateTimeModule.ValueToTwoSymbolFormat(dateTime.Minute);
        return text.Replace("%month%", newValue).Replace("%day%", newValue2).Replace("%hrs%", newValue3).Replace("%mnts%", newValue4);
    }

    public static string SecondsToString(int seconds)
    {
        string text;
        if (seconds >= 86400)
        {
            text = Localization.LocalizeByKey("#vip_time_days", true, true).Replace("%val%", Mathf.RoundToInt((float)seconds / 86400f).ToString());
        }
        else if (seconds >= 3600)
        {
            text = Localization.LocalizeByKey("#vip_time_hours", true, true).Replace("%val%", Mathf.RoundToInt((float)seconds / 3600f).ToString());
        }
        else if (seconds >= 60)
        {
            text = Localization.LocalizeByKey("#vip_time_minutes", true, true).Replace("%val%", Mathf.RoundToInt((float)seconds / 60f).ToString());
        }
        else
        {
            text = Localization.LocalizeByKey("#vip_time_seconds", true, true).Replace("%val%", seconds.ToString());
        }
        return LocalizationUtils.ApplyEndings(text);
    }

    public static string ValueToTwoSymbolFormat(int value)
    {
        if (value <= 9)
        {
            return "0" + value.ToString();
        }
        return value.ToString();
    }

    public static string TimeSpanToString(double seconds)
    {
        return DateTimeModule.TimeSpanToString(TimeSpan.FromSeconds(seconds));
    }

    public static bool IsToday(DateTime dateTime)
    {
        return DateTimeModule.ServerNow.Year == dateTime.Year && DateTimeModule.ServerNow.Month == dateTime.Month && DateTimeModule.ServerNow.Day == dateTime.Day;
    }

    public static TimeSpan GetTimeSpan(DateTime targetTime, bool serverTime = true)
    {
        DateTime dateTime = serverTime ? DateTimeModule.ServerNow : DateTimeModule.now;
        TimeSpan result = targetTime - dateTime;
        if (targetTime < dateTime)
        {
            result = dateTime - targetTime;
        }
        return result;
    }

    public static void SetManualServerTime(DateTime dateTime)
    {
        manualServerTime = dateTime;
    }

    static DateTimeModule()
    {
        SetManualServerTime(new DateTime(2024, 5, 19, 17, 0, 0));
    }
}

code with static time

 

  • Like 3
Ссылка на комментарий
Поделиться на другие сайты

Гость
Эта тема закрыта для публикации ответов.

×
×
  • Создать...
Вверх