Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # Version 39 - A reddit moderator permanently banned me for saying this so i feel obligated to repost it: "Don't play Arenas. That's the sink for autist cheaters. Every game has someone that walks around like a bot with a crosshair locked on your forehead".
- # POSTED ONLINE: https://pastebin.com/BZV5c4a6
- # SOURCE: https://tarkov-time.adam.id.au/
- # SOURCE: https://www.reddit.com/r/EscapefromTarkov/comments/u89ccn/i_made_a_physical_eft_clock_so_i_can_tell_when/i5kg22h/
- # SOURCE: https://escapefromtarkov.fandom.com/wiki/How_to_Play_Guide_for_Escape_from_Tarkov#IRL_time_vs_EFT_time
- # SOURCE: https://www.reddit.com/r/EscapefromTarkov/comments/ur05bc/at_what_time_of_the_raid_is_it_the_most_dark/
- # ----- Colors -----
- def ansi(code):
- return f"\033[{code}m"
- def rgb(r, g, b):
- return ansi(f"38;2;{r};{g};{b}")
- PURPLE = rgb(177, 72, 198) # Mingw64 purple.
- # PURPLE = rgb(128, 0, 128) # True purple.
- BLACK = ansi(30)
- RED = ansi(31)
- GREEN = ansi(32)
- YELLOW = ansi(33)
- BLUE = ansi(34)
- MAGENTA = ansi(35)
- CYAN = ansi(36)
- WHITE = ansi(37)
- BRIGHT_BLACK = ansi(90)
- BRIGHT_RED = ansi(91)
- BRIGHT_GREEN = ansi(92)
- BRIGHT_YELLOW = ansi(93)
- BRIGHT_BLUE = ansi(94)
- BRIGHT_MAGENTA = ansi(95)
- BRIGHT_CYAN = ansi(96)
- BRIGHT_WHITE = ansi(97)
- # ----- Styles -----
- RESET = ansi(0) # Reset all styles.
- BOLD = ansi(1)
- HALF_BRIGHT = ansi(2)
- ITALIC = ansi(3)
- UNDERLINE = ansi(4)
- REVERSED = ansi(7) # Reverse foreground and background colors.
- # ----- Color Helpers -----
- def color(text, *codes):
- return "".join(codes) + str(text) + RESET
- # Use these in situations where you can't use alignment formatting codes and padding, because you have two different colored strings in a row.
- # In this situation the padding added will be too little because the colored string will appear longer then it appears because len() includes the invisible formatting tags in the total length of the string.
- # By applying coloring tags AFTER padding the strings, you can avoid needing these functions.
- #
- # NOTE: These functions are based on string.ljust and string.rjust.
- def color_ljust(string, width, fillchar=' '):
- if color_len(string) >= width:
- return string
- return string + fillchar * (width - color_len(string))
- def color_rjust(string, width, fillchar=' '):
- if color_len(string) >= width:
- return string
- return fillchar * (width - color_len(string)) + string
- import re
- def color_len(string):
- # Remove formatting using regular expressions.
- string = re.sub(r'\033\[[0-9;]*m', '', string)
- return len(string)
- # -----
- import os
- def clear():
- os.system('cls' if os.name in ('nt', 'dos') else 'clear')
- clear() # Need to clear before color(...) can be used.
- # -----
- DAY_BRIGHT = WHITE
- DAY_MORB = YELLOW
- NIGHT = BRIGHT_BLACK
- UI_CHEVRON = PURPLE #RED
- UI_CULTIST = PURPLE #BRIGHT_MAGENTA
- UI_ETA = CYAN
- UI_LABELS = BRIGHT_GREEN #RED #BRIGHT_MAGENTA
- # -----
- # Added text to prevent emoji replacement which tend to be smaller.
- CULTIST = '~&' # Cultist with a poison knife.
- # CULTIST = "🗡\uFE0E"
- # CULTIST = "🥷"
- # CULTIST = "â›§\uFE0E"
- # CULTIST = "🕯\uFE0E" # Only Windows 11 terminal can show this emoji.
- CULTIST = "🕯 " # Only Windows 11 terminal can show this emoji. Suddenly now i need to replace \uFE0E with space to fix alignment issue?
- LEFT_ARROW = '<'
- LEFT_ARROW = "â—€"
- RIGHT_ARROW = '>'
- RIGHT_ARROW = "â–¶"
- # -----
- import datetime
- TARKOV_SECONDS_PER_SECOND = 7 # Seven seconds in Tarkov is one second IRL.
- CHARLIE_TIMEZONE = datetime.timezone(datetime.timedelta(hours=3)) # Tarkov uses St. Petersburg - MSK (UTC+3) timezone.
- TWELVE_HOUR_SHIFT = datetime.timedelta(hours=12) # Right time is +12 hours ahead of left time.
- def get_tarkov_time():
- utc_time = datetime.datetime.now(datetime.timezone.utc)
- tarkov_left_time = datetime.datetime.fromtimestamp(utc_time.timestamp() * TARKOV_SECONDS_PER_SECOND, CHARLIE_TIMEZONE)
- tarkov_right_time = tarkov_left_time + TWELVE_HOUR_SHIFT
- return tarkov_left_time, tarkov_right_time
- def convert_tarkov_timedelta_to_irl(tarkov_time_delta):
- irl_time_delta = tarkov_time_delta / TARKOV_SECONDS_PER_SECOND
- # Zero the microseconds created by the division because this is the easiest way to hide them.
- irl_time_delta_without_microseconds = irl_time_delta - datetime.timedelta(microseconds=irl_time_delta.microseconds)
- return irl_time_delta_without_microseconds
- def edit_time(dt, hour=None, minute=None, second=None, microsecond=None):
- return datetime.datetime(
- dt.year,
- dt.month,
- dt.day,
- hour if hour is not None else dt.hour,
- minute if minute is not None else dt.minute,
- second if second is not None else dt.second,
- microsecond if microsecond is not None else dt.microsecond,
- tzinfo=dt.tzinfo
- )
- # -----
- TIME_PERIODS = [
- (0, 'Moonrise'),
- (1, 'Low Moon'),
- (2, 'Mid Moon'),
- (3, 'High Moon'),
- (4, 'No Moon'),
- (5, 'Dawn'),
- (6, 'Sunrise'),
- (7, 'Early Morning'),
- (8, 'Mid Morning'),
- (9, 'Late Morning'),
- (10, 'Early Day'),
- (11, 'Late Day'),
- (12, 'High Noon'),
- (13, 'Early Afternoon'),
- (14, 'Mid Afternoon'),
- (15, 'Late Afternoon'),
- (16, 'Early Evening'),
- (17, 'Mid Evening'),
- (18, 'Late Evening'),
- (19, 'Pre Sunset'),
- (20, 'Sunset'),
- (21, 'Twilight'),
- (22, 'Early Night'),
- (23, 'Deep Night'),
- ]
- MAX_TIME_PERIOD_WIDTH = max(len(time_period[1]) for time_period in TIME_PERIODS)
- def get_time_period_name(dt):
- for hour, time_period in sorted(TIME_PERIODS, reverse=True):
- if dt.hour >= hour:
- return time_period
- def format_time(dt):
- return dt.strftime('%H:%M:%S')
- def format_hour(dt):
- return dt.strftime('%H')
- def format_eta(time_delta):
- total_seconds = int(time_delta.total_seconds())
- days, remainder = divmod(total_seconds, 86400)
- hours, remainder = divmod(remainder, 3600)
- minutes, seconds = divmod(remainder, 60)
- return f'T-{f"{days:02d}:" if days > 0 else ""}{hours:02d}:{minutes:02d}:{seconds:02d}'
- # -----
- def day_night_rotate_eta(dt):
- if is_bright_daylight(dt):
- future_time = datetime.time(hour=BRIGHT_DAYLIGHT_END, minute=0, second=0)
- else:
- future_time = datetime.time(hour=BRIGHT_DAYLIGHT_START, minute=0, second=0)
- return eta(dt, future_time)
- # The left and right times are 12 hours apart.
- DAY_START = 6
- DAY_END = DAY_START + 12
- def is_day(dt):
- return DAY_START <= dt.hour < DAY_END
- # SOURCE: https://www.reddit.com/r/EscapefromTarkov/comments/7wwbmw/bsg_why_are_there_16_hours_of_daylight_in_this/
- DAYLIGHT_END = DAY_START + 16 # Dim daylight end time.
- def is_any_daylight(dt):
- return DAY_START <= dt.hour < DAYLIGHT_END
- BRIGHT_DAYLIGHT_START = DAY_START + 2 # Bright daylight start time.
- BRIGHT_DAYLIGHT_END = DAY_END + 2 # Sun is setting.
- def is_bright_daylight(dt):
- return BRIGHT_DAYLIGHT_START <= dt.hour < BRIGHT_DAYLIGHT_END
- # SOURCE: ["Cultists appear between 22:00 and 7:00"] https://escapefromtarkov.fandom.com/wiki/Cultists
- # SOURCE: ["Between the times of 22:00 and 6:00"] https://youtu.be/pwIWGq6QACQ?si=fIPJFb-DrPObOzl_&t=269
- # SOURCE: ["So approximately 6:00 by Tarkov time they stand up and go into some place to despawn and just disappear. Their dead bodies do not disappear."] https://www.reddit.com/r/EscapefromTarkov/comments/14kan9b/i_always_was_wonder_how_when_and_does_cultists/
- # SOURCE: ["The Boss (Priest) spawns from 11PM to 6AM. After sunrise, the cultists disappear from the map."] https://tarkov.help/en/article/cultists
- # SOURCE: ["They absolutely despawn around 5:30 am"] https://www.reddit.com/r/EscapefromTarkov/comments/r14frs/cultist_despawn_at_daylight/
- # SOURCE: ["Cultists spawn from 23:00 (11 PM) to 5:00 (5 AM)"] https://www.reddit.com/r/EscapefromTarkov/comments/l69pvx/i_found_the_cultist_priest_on_day_time_woods/gkzxjpb/
- # SOURCE: ["I always thought they stopped spawning at 5 am not 7 am...22-5 you are correct."] https://www.reddit.com/r/EscapefromTarkov/comments/wvq6a4/how_do_cultist_spawns_really_work/
- # SOURCE: Cultist Spawn Locations: https://escapefromtarkov.fandom.com/wiki/Cultists
- # Customs=1 priest + 4 warriors at scav base (ZB-013 extraction).
- # Woods=1 priest + 4 warriors near their ritual places which are located west of sawmill and also at the dilapidated village in the north.
- # Shoreline= 1 priest + 3 warriors at health resort and(rare)/or north-east of the swamp village.
- # Night Factory=1 priest + 2 warriors.
- CULTIST_SPAWN_START = 22
- # CULTIST_SPAWN_END = 5 # 7 # TODO: The wiki says 7 but a lot of sources say this should be 5, to represent 05:00 - 05:59, with 06:00 being when cultists despawn but need more info.
- CULTIST_SPAWN_END = 7 # This guy says 7 AM but probably just quoting wiki. https://www.reddit.com/r/EscapefromTarkov/comments/1eq4n55/discussion_cultist_dagger_farming_for_night_sweep/
- def is_cultist_time(dt):
- h = dt.hour
- return h >= CULTIST_SPAWN_START or h <= CULTIST_SPAWN_END
- def eta(dt, future_time):
- future_dt = dt.replace(hour=future_time.hour, minute=future_time.minute, second=future_time.second)
- if future_dt < dt:
- future_dt += datetime.timedelta(days=1)
- remaining_time_delta = future_dt - dt
- return remaining_time_delta, future_dt
- def color_hour(string, dt):
- return color(string, DAY_BRIGHT if is_bright_daylight(dt) else DAY_MORB if is_any_daylight(dt) else NIGHT)
- ALIGN_LEFT = '<'
- ALIGN_RIGHT = '>'
- ALIGN_CENTER = '^'
- # -----
- import time
- def main():
- while True:
- print()
- left_time, right_time = get_tarkov_time()
- left_cultist = color(f'{" " + CULTIST if is_cultist_time(left_time) else ""}', UI_CULTIST)
- right_cultist = color(f'{CULTIST + " " if is_cultist_time(right_time) else ""}', UI_CULTIST)
- left_time_display = color_hour(f'{get_time_period_name(left_time)} {format_time(left_time)}', left_time) + left_cultist
- right_time_display = right_cultist + color_hour(f'{format_time(right_time)} {get_time_period_name(right_time)}', right_time)
- day_night_composition = '▛' if is_day(left_time) else '▜'
- bright_daylight_eta, left_day_night_sector_time = day_night_rotate_eta(left_time)
- # print(f' {color(f" Tarkov Times:", UI_LABELS)} {color("[", UI_LABELS)} {left_time_display} {color("-", UI_LABELS)} {right_time_display} {color("]", UI_LABELS)} {color(day_night_composition, DAY_MORB)} {color(format_eta(convert_tarkov_timedelta_to_irl(bright_daylight_eta)), UI_ETA)}')
- print(f' {color(f" Tarkov Times:", UI_LABELS)} {color("[", UI_LABELS)} {left_time_display} {color("-", UI_LABELS)} {right_time_display} {color("]", UI_LABELS)} {color(day_night_composition, DAY_BRIGHT)} {color(format_eta(convert_tarkov_timedelta_to_irl(bright_daylight_eta)), UI_ETA)}')
- # ----- Print horizontal time-progressbar -----
- # NOTE: Its kinda redundant to show this because cultist indicators are already visible on the vertical time list.
- # That's why i have it commented out.
- # It looks cool though.
- # print()
- # print(' ', end='')
- # # For [0,24).
- # for h in range(24):
- # h_time = datetime.time(hour=h)
- # if is_cultist_time(h_time):
- # print(color(f'{CULTIST} ', UI_CULTIST), end='')
- # else:
- # print(' ', end='')
- # print()
- # print(' ', end='')
- # # For [0,24).
- # for h in range(24):
- # h_time = datetime.time(hour=h)
- # if h == left_time.hour or h == right_time.hour:
- # print(color_hour(f'╳╳ ', h_time), end='')
- # # print(color_hour(f'◀▶ ', h_time), end='')
- # else:
- # print(color_hour(f'██ ', h_time), end='')
- # print()
- # print(' ', end='')
- # # For [0,24).
- # for h in range(24):
- # h_time = datetime.time(hour=h)
- # print(color_hour(h_time.strftime('%H '), h_time), end='')
- # print()
- # ----- Print time-period names while indicating what slot we are on -----
- # Cultist-spawn indicators and arrows are colored UI_CHEVRON.
- # print()
- # for h in range(DAY_START, DAY_END):
- # h_time = edit_time(left_time, hour=h, minute=0, second=0)
- # if not is_day(left_time):
- # h_time -= TWELVE_HOUR_SHIFT
- # left_game_time = color_hour(f'{get_time_period_name(h_time):{ALIGN_RIGHT}{MAX_TIME_PERIOD_WIDTH}} {format_hour(h_time)}', h_time)
- # left_cultist = color(f'{CULTIST if is_cultist_time(h_time) else " "}', UI_CULTIST)
- # on_time = left_time.hour == h or right_time.hour == h
- # left_arrow = color(LEFT_ARROW if on_time else ' ', UI_CHEVRON)
- # h_time += TWELVE_HOUR_SHIFT
- # right_arrow = color(RIGHT_ARROW if on_time else ' ', UI_CHEVRON)
- # right_cultist = color(f'{CULTIST if is_cultist_time(h_time) else " "}', UI_CULTIST)
- # right_game_time = color_hour(f'{format_hour(h_time)} {get_time_period_name(h_time)}', h_time)
- # closest_time_eta = min(eta(left_time, h_time)[0], eta(right_time, h_time)[0])
- # irl_time = color(format_eta(convert_tarkov_timedelta_to_irl(closest_time_eta)), UI_ETA)
- # print(f' {left_game_time} {left_cultist} {left_arrow} {irl_time} {right_arrow} {right_cultist} {right_game_time}')
- # Cultist-spawn indicators and arrows are colored based on the hour.
- print()
- for h in range(DAY_START, DAY_END):
- h_time = edit_time(left_time, hour=h, minute=0, second=0)
- if not is_day(left_time):
- h_time -= TWELVE_HOUR_SHIFT
- left_game_time = color_hour(f'{get_time_period_name(h_time):{ALIGN_RIGHT}{MAX_TIME_PERIOD_WIDTH}} {format_hour(h_time)}', h_time)
- left_cultist = color(f'{CULTIST if is_cultist_time(h_time) else " "}', UI_CULTIST)
- left_arrow = color_hour(f'{LEFT_ARROW if left_time.hour == h_time.hour else " "}', h_time)
- h_time += TWELVE_HOUR_SHIFT
- right_arrow = color_hour(f'{RIGHT_ARROW if right_time.hour == h_time.hour else " "}', h_time)
- right_cultist = color(f'{CULTIST if is_cultist_time(h_time) else " "}', UI_CULTIST)
- right_game_time = color_hour(f'{format_hour(h_time)} {get_time_period_name(h_time)}', h_time)
- closest_time_eta = min(eta(left_time, h_time)[0], eta(right_time, h_time)[0])
- irl_time = color(format_eta(convert_tarkov_timedelta_to_irl(closest_time_eta)), UI_ETA)
- print(f' {left_game_time} {left_cultist} {left_arrow} {irl_time} {right_arrow} {right_cultist} {right_game_time}')
- # No cultist-spawn indicators and arrows are colored UI_CHEVRON.
- # print()
- # for h in range(DAY_START, DAY_END):
- # h_time = edit_time(left_time, hour=h, minute=0, second=0)
- # if not is_day(left_time):
- # h_time -= TWELVE_HOUR_SHIFT
- # left_game_time = color_hour(f'{get_time_period_name(h_time):{ALIGN_RIGHT}{MAX_TIME_PERIOD_WIDTH}} {format_hour(h_time)}', h_time)
- # h_time += TWELVE_HOUR_SHIFT
- # right_game_time = color_hour(f'{format_hour(h_time)} {get_time_period_name(h_time)}', h_time)
- # on_time = left_time.hour == h or right_time.hour == h
- # left_arrow = color(LEFT_ARROW if on_time else ' ', UI_CHEVRON)
- # closest_time_eta = min(eta(left_time, h_time)[0], eta(right_time, h_time)[0])
- # irl_time = color(format_eta(convert_tarkov_timedelta_to_irl(closest_time_eta)), UI_ETA)
- # right_arrow = color(RIGHT_ARROW if on_time else ' ', UI_CHEVRON)
- # print(f' {left_game_time} {left_arrow} {irl_time} {right_arrow} {right_game_time}')
- # No cultist-spawn indicators and arrows are colored based on the hour.
- # print()
- # for h in range(DAY_START, DAY_END):
- # h_time = edit_time(left_time, hour=h, minute=0, second=0)
- # if not is_day(left_time):
- # h_time -= TWELVE_HOUR_SHIFT
- # left_game_time = color_hour(f'{get_time_period_name(h_time):{ALIGN_RIGHT}{MAX_TIME_PERIOD_WIDTH}} {format_hour(h_time)} {LEFT_ARROW if left_time.hour == h_time.hour else " "}', h_time)
- # h_time += TWELVE_HOUR_SHIFT
- # right_game_time = color_hour(f'{RIGHT_ARROW if right_time.hour == h_time.hour else " "} {format_hour(h_time)} {get_time_period_name(h_time)}', h_time)
- # closest_time_eta = min(eta(left_time, h_time)[0], eta(right_time, h_time)[0])
- # irl_time = color(format_eta(convert_tarkov_timedelta_to_irl(closest_time_eta)), UI_ETA)
- # print(f' {left_game_time} {irl_time} {right_game_time}')
- time.sleep(1)
- clear()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment