diff --git a/docs/idareplayobserver.rst b/docs/idareplayobserver.rst new file mode 100644 index 0000000000000000000000000000000000000000..c0753c9ace03d94275fb73b13b35a727bf485b5b --- /dev/null +++ b/docs/idareplayobserver.rst @@ -0,0 +1,39 @@ +IDABot +====== + +.. class:: library.IDAReplayObserver + + This is the basis of a replayObserver. + + Inherited methods: + + .. method:: IDAReplayObserver.on_game_start(self) + + This method is called when a Starcraft replay has stared, when you inherit it you have to + call the parent's on_game_start method in order to make it work (see + :ref:`replays`). + + .. method:: IDAReplayObserver.on_step(self) + + This method is called on every tick of the replay, when you inherit it you + have to call the parent's on_step method in order to make it work (see + :ref:`replays`). + + .. method:: IDAReplayObserver.on_game_end(self) + + This method is called when the replay has ended, when you inherit it you have to + call the parent's on_game_start method in order to make it work (see + :ref:`replays`). + + Methods: + + .. method:: IDABot.get_all_units(self) -> List[library.ReplayUnit] + + Retrieves a list of all visible units + + + Attributes: + + .. autoattribute:: minerals + + diff --git a/docs/replays.rst b/docs/replays.rst index c6af956e47fc4b5f718d94cc289f163a179f075f..cce599d017bec3019752393e214a7cf4cb18179b 100644 --- a/docs/replays.rst +++ b/docs/replays.rst @@ -56,7 +56,7 @@ Here is a short example that uses SC2Reader to extract the build order. print("Res: " + text) -SC2Reader has good documation_ that also describe what information +SC2Reader has documation_ that also describe what information could be found. `What is in a Replay`_ and Events_ gives a good idea if the information you want could be colleced whithe SC2Reader. @@ -66,8 +66,8 @@ if the information you want could be colleced whithe SC2Reader. ReplayObserver -------------- -This is the second technique it is much like using a bot but whit the diffrens -that no action can be preform just observations +This is the second technique it is much like using a bot but whit the main difference +that no action can be preform just observations. No debug actions can be taken. .. code-block:: python @@ -85,14 +85,29 @@ that no action can be preform just observations def on_step(self): ReplayObserver.on_step(self) + def on_game_end(self): + IDAReplayObserver.on_game_end(self) def main(): coordinator = Coordinator(r"D:\StarCraft II\Versions\Base69232\SC2_x64.exe") print(coordinator.load_replay_list("D:\\Replays\\")) - coordinator.add_replay_observer(MyObserver()) + my_observer = MyObserver() + coordinator.add_replay_observer(my_observer) while coordinator.update(): pass - if __name__ == "__main__": - main() \ No newline at end of file + main() + + +Replay files +------------ +Replay files are version depended. + +Replays with tracker events for some versions can be found for example at spawningtool_ and gggreplays_. + +Replays without tracker events can be download with s2client-proto_. The requested version is 4.6.2 + +.. _spawningtool: https://lotv.spawningtool.com/replays/?pro_only=on +.. _gggreplays: https://gggreplays.com/matches +.. _s2client-proto: https://github.com/Blizzard/s2client-proto/tree/master/samples/replay-api \ No newline at end of file diff --git a/docs/replayunit.rst b/docs/replayunit.rst new file mode 100644 index 0000000000000000000000000000000000000000..472018a9a625abaf5f93f63f1c8d26e749748565 --- /dev/null +++ b/docs/replayunit.rst @@ -0,0 +1,76 @@ +Unit +==== + +.. class:: library.ReplayUnit + + An instance of the class Unit represents one unit in a replay. A ReplayUnit is a + :class`library.Unit` white some limitations. + + It is possible to use ReplayUnit as keys in a dictionary, which might be helpful + for bookkeeping. + + Properties: + + .. autoattribute:: buffs + + Returns a list of BuffID + + .. autoattribute:: build_percentage + .. autoattribute:: energy + .. autoattribute:: facing + + Returns the direction the unit is facing + + .. autoattribute:: hit_points + .. autoattribute:: max_hit_points + .. autoattribute:: id + .. autoattribute:: is_alive + .. autoattribute:: is_blip + + Returns true if unit is a "blip" - a ping on the map. + + .. autoattribute:: is_being_constructed + + Returns build_progress > 0 + + .. autoattribute:: is_burrowed + .. autoattribute:: is_cloaked + .. autoattribute:: is_completed + + Returns build_progress >= 1 + + .. autoattribute:: is_flying + .. autoattribute:: is_idle + .. autoattribute:: is_powered + .. autoattribute:: is_training + .. autoattribute:: is_valid + .. attribute:: ReplayUnit.player + + Returns the constant corresponding to player which this unit belongs to. + See :ref:`playerconstants` for more information. + + .. autoattribute:: position + .. autoattribute:: current_ability_id + + .. autoattribute:: progress + + Returns the progress of currently used ability (-1 if not using ability) + + .. autoattribute:: radius + + Retruns the radius of the unit + + .. autoattribute:: shields + .. autoattribute:: tile_position + .. autoattribute:: unit_type + + Returns the id of the unit_type + + .. autoattribute:: unit_type_name + + Returns the name of the unit_type + + .. autoattribute:: weapon_cooldown + .. autoattribute:: is_carrying_minerals + + Returns if this unit is currently holding minerals