GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ColdWaters-DotModCampaignChecker/events.py at main · DotModGroup/ColdWaters-DotModCampaignChecker

Expand file tree

/

events.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
60 lines (48 loc) · 1.81 KB
/

events.py

Copy path

File metadata and controls

60 lines (48 loc) · 1.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""This file holds the Events class, which holds all of the events at once.
Imports From:
os
union
rpg_mode.py
Classes:
Events
"""
import os
from typing import Union
from rpg_mode import RPGMode
class Events:
"""This class stores all events from a single campaign
Attributes:
events: dict[str, str] = [] | List of all events and NextActions as pulled from the files
Methods:
None
"""
def __init__(self, campaign_directory: str, current_language: str):
event_file_directory = (
f"{campaign_directory}\\language_{current_language}\\events"
)
self.events: dict[str, Union[str, str]] = {}
self.rpg_mode = None
for event_file in os.listdir(event_file_directory):
if (
event_file == "_notes.txt"
or os.path.isfile(f"{event_file_directory}\\{event_file}") is False
):
continue
with open(
f"{event_file_directory}\\{event_file}", encoding="utf-8"
) as open_event_file:
for line in open_event_file:
if line.startswith("NextAction"):
self.events[
event_file.strip().removesuffix(".txt")
] = line.strip().split("=")[1]
for content_file in os.listdir(f"{event_file_directory}\\content"):
if (
os.path.isfile(f"{event_file_directory}\\content\\{content_file}")
is not False
):
self.events[content_file.strip().removesuffix(".txt")] = "content"
if content_file.strip() == "rpg_mode.txt":
self.rpg_mode = RPGMode(
f"{event_file_directory}\\content\\rpg_mode.txt"
)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.