Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # Version 37 - A tarkov reddit moderator permanently banned me for saying this so i feel obligated to repost it here because i hate censorship: "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/
- # -----
- # 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.
- LEFT_ARROW = '<'
- LEFT_ARROW = "◀"
- RIGHT_ARROW = '>'
- RIGHT_ARROW = "▶"
- # -----
- PURPLE = '\033[38;2;177;72;198m' # Mingw64 purple.
- # PURPLE = '\033[38;2;128;0;128m' # True purple.
- # PURPLE = '\033[38;2;255;0;255m' # Brighter.
- BLACK = '\033[30m'
- RED = '\033[31m'
- GREEN = '\033[32m'
- YELLOW = '\033[33m'
- BLUE = '\033[34m'
- MAGENTA = '\033[35m'
- CYAN = '\033[36m'
- WHITE = '\033[37m'
- BRIGHT_BLACK = '\033[90m'
- BRIGHT_RED = '\033[91m'
- BRIGHT_GREEN = '\033[92m'
- BRIGHT_YELLOW = '\033[93m'
- BRIGHT_BLUE = '\033[94m'
- BRIGHT_MAGENTA = '\033[95m'
- BRIGHT_CYAN = '\033[96m'
- BRIGHT_WHITE = '\033[97m'
- RESET = '\033[0m'
- BOLD = '\033[1m'
- HALF_BRIGHT = '\033[2m'
- ITALIC = '\033[3m'
- UNDERLINE = '\033[4m'
- REVERSED = '\033[7m'
- # -----
- DAY_BRIGHT = BRIGHT_YELLOW
- DAY_MORB = YELLOW
- NIGHT = BRIGHT_BLACK
- UI_CHEVRON = RED
- UI_CULTIST = RED
- UI_ETA = BRIGHT_WHITE #BRIGHT_CYAN
- UI_LABELS = CYAN
- DAY_BRIGHT = WHITE
- DAY_MORB = YELLOW
- NIGHT = BRIGHT_BLACK
- UI_CHEVRON = RED
- UI_CULTIST = PURPLE #BRIGHT_MAGENTA
- UI_ETA = CYAN
- UI_LABELS = BRIGHT_GREEN #RED #BRIGHT_MAGENTA
- #
- # DAY_BRIGHT = WHITE
- # DAY_MORB = YELLOW
- # NIGHT = BRIGHT_BLACK
- # UI_CHEVRON = RED
- # UI_CULTIST = RED
- # UI_ETA = RED
- # UI_LABELS = RED#MAGENTA #BRIGHT_MAGENTA #BRIGHT_GREEN
- # -----
- # DAY_BRIGHT = BOLD + BRIGHT_CYAN
- # DAY_MORB = BOLD + BRIGHT_BLUE
- # NIGHT = BOLD + BRIGHT_GREEN
- # UI_CHEVRON = BOLD + RED
- # UI_ETA = BOLD + BRIGHT_BLACK
- # UI_LABELS = BOLD + BRIGHT_BLACK
- # -----
- 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
- # -----
- TIME_PERIODS = [
- (0, 'Moonrise'),
- (1, 'Low Moon'),
- (2, 'Medium Moon'),
- (3, 'High Moon'),
- (4, 'No Moon'),
- (5, 'Dawn'),
- (6, 'Sunrise'),
- (7, 'Morning'),
- (8, 'Early Day'),
- (9, 'Mid Morning'),
- (10, 'Late Morning'),
- (11, 'Pre Noon'),
- (12, 'High Noon'),
- (13, 'Post Meridiem'),
- (14, 'Early Afternoon'),
- (15, 'Mid Afternoon'),
- (16, 'Late Afternoon'),
- (17, 'Pre Dusk'),
- (18, 'Early Dusk'),
- (19, 'Late Dusk'),
- (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(date_time):
- for hour, time_period in sorted(TIME_PERIODS, reverse=True):
- if date_time.hour >= hour:
- return time_period
- def format_time(date_time):
- return date_time.strftime('%H:%M:%S')
- def format_hour(date_time):
- return date_time.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(date_time):
- if is_bright_daylight(date_time):
- 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(date_time, future_time)
- # The left and right times are 12 hours apart.
- DAY_START = 6
- DAY_END = DAY_START + 12
- def is_day(date_time):
- return DAY_START <= date_time.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(date_time):
- return DAY_START <= date_time.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(date_time):
- return BRIGHT_DAYLIGHT_START <= date_time.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/
- CULTIST_SPAWN_END = 6 # AI says its between 06:00 and 06:59 and then thats it, they are despawned.
- def is_cultist_time(date_time):
- return not (CULTIST_SPAWN_END < date_time.hour < CULTIST_SPAWN_START)
- def eta(date_time, future_time):
- future_date_time = date_time.replace(hour=future_time.hour, minute=future_time.minute, second=future_time.second)
- if future_date_time < date_time:
- future_date_time += datetime.timedelta(days=1)
- remaining_time_delta = future_date_time - date_time
- return remaining_time_delta, future_date_time
- def color_hour(string, date_time):
- return color(string, DAY_BRIGHT if is_bright_daylight(date_time) else DAY_MORB if is_any_daylight(date_time) else NIGHT)
- def color(var, color):
- return color + str(var) + RESET
- 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 color codes to measure visible characters.
- return len(re.sub(r'\033\[\d+m', '', string))
- import os
- def clear():
- os.system('cls' if os.name in ('nt', 'dos') else 'clear')
- import time
- def sleep(milliseconds):
- time.sleep(milliseconds / 1000)
- ALIGN_LEFT = '<'
- ALIGN_RIGHT = '>'
- ALIGN_CENTER = '^'
- # -----
- def main():
- while True:
- clear() # Need to clear before color(...) can be used.
- 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)}')
- # -----
- # TODO: commented out because its redundant with cultist-spawn indicators on the vertical times.
- #
- # Print horizontal time-progressbar.
- # 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()
- # -----
- # V2 - Added cultist-spawn indicators.
- #
- # Print time-period names while indicating which slot we are in.
- print()
- for h in range(DAY_START, DAY_END):
- h_time = datetime.datetime.now().replace(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_time = color_hour(f'{LEFT_ARROW if left_time.hour == h_time.hour else " "}', h_time)
- h_time += TWELVE_HOUR_SHIFT
- right_arrow_time = 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)
- on_time = left_time.hour == h or right_time.hour == h
- 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_time} {irl_time} {right_arrow_time} {right_cultist} {right_game_time}')
- # V1 - Arrows are colored based on the hour.
- #
- # Print time-period names while indicating which slot we are in.
- # print()
- # for h in range(DAY_START, DAY_END):
- # h_time = datetime.datetime.now().replace(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)
- # on_time = left_time.hour == h or right_time.hour == h
- # 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}')
- # V0 - Arrows are colored UI_CHEVRON.
- #
- # Print time-period names while indicating which slot we are in.
- # print()
- # for h in range(DAY_START, DAY_END):
- # h_time = datetime.datetime.now().replace(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}')
- sleep(1000)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement