Skip to content

Commit

Permalink
Merge pull request #201 from Andrene/dialog-control-event
Browse files Browse the repository at this point in the history
Dialog control event
  • Loading branch information
StoicLoofah authored May 30, 2024
2 parents a7778d0 + 702f781 commit 46629e5
Show file tree
Hide file tree
Showing 6 changed files with 499 additions and 352 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- checkout
- run: python --version ; pip --version ; pwd ; ls -l
- run: pip install black codespell ruff
- run: codespell -L queenland,uint
- run: codespell -L queenland,uint,assertin
- run: ruff .
- run: black . --check

Expand Down
16 changes: 8 additions & 8 deletions examples/sc2autosave.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@
keeps the script from looking into the 'Saved' subdirectory.
sc2autosave \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Mutliplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplater/Saved \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer/Saved \
--period 10 \
--depth 0
This next configuration runs in batch mode using the default renaming format.
sc2autosave \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Mutliplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplater/Saved \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer/Saved \
--rename
(ZvP) Lost Temple: ShadesofGray(Z) vs Trisfall(P).SC2Replay
Expand All @@ -96,8 +96,8 @@
by replay format and favors ShadesofGray in the player and team orderings.
sc2autosave \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Mutliplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplater/Saved \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer/Saved \
--rename "{:format}/{:matchup} on {:map}: {:teams}" \
--player-format "{:name}({:play_race})" \
--team-order-by number \
Expand All @@ -112,8 +112,8 @@
length to show both minutes and seconds.
sc2autosave \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Mutliplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplater/Saved \
--source ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer \
--dest ~/My\\ Documents/Starcraft\\ II/Accounts/.../Multiplayer/Saved \
--rename "{:matchup}/({:length}) {:map}: {:teams}" \
--player-format "{:name}({:play_race})" \
--team-order-by number \
Expand Down
8 changes: 4 additions & 4 deletions sc2reader/engine/plugins/creeptracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class creep_tracker:
def __init__(self, replay):
# if the debug option is selected, minimaps will be printed to a file
##and a stringIO containing the minimap image will be saved for
##every minite in the game and the minimap with creep highlighted
##every minute in the game and the minimap with creep highlighted
## will be printed out.
self.debug = replay.opt["debug"]
##This list contains creep spread area for each player
Expand All @@ -123,9 +123,9 @@ def __init__(self, replay):
self.unit_name_to_radius = {"CreepTumor": 10, "Hatchery": 8, "NydusCanal": 5}
self.radius_to_coordinates = dict()
for x in self.unit_name_to_radius:
self.radius_to_coordinates[
self.unit_name_to_radius[x]
] = self.radius_to_map_positions(self.unit_name_to_radius[x])
self.radius_to_coordinates[self.unit_name_to_radius[x]] = (
self.radius_to_map_positions(self.unit_name_to_radius[x])
)
# Get map information
replayMap = replay.map
# extract image from replay package
Expand Down
19 changes: 19 additions & 0 deletions sc2reader/events/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,3 +765,22 @@ def __init__(self, frame, pid, data):

#: Information on the users hijacking the game
self.user_infos = data["user_infos"]


@loggable
class DialogControlEvent(GameEvent):
"""
Generated when a dialog is interacted with.
"""

def __init__(self, frame, pid, data):
super().__init__(frame, pid)

#: Identifier for the dialog
self.control_id = data["control_id"]

#: How dialog was interacted with
self.event_type = data["event_type"]

#: Data specific to event type such as changes or clicks
self.event_data = data["event_data"]
Loading

0 comments on commit 46629e5

Please sign in to comment.