herostats 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1f8e5db6f9eea7245910409f1a33964062273b9
4
- data.tar.gz: 97bd992e34a48093d439833abbb8cfcd1fd36c54
3
+ metadata.gz: 0976a50f10368a9925e8180135a36d393c23178d
4
+ data.tar.gz: 0a9f39b294ffc6220360b8e94e89ae43ee858f5b
5
5
  SHA512:
6
- metadata.gz: 2e879ea0bfc763d42a3f5ef1c26669bcc1b5a41ac3d9e68ae6b75ba8f45dd1e2791534a7dbb8ac409d7c0e8cf5639aaed226ef001835177795e7355c74d350a3
7
- data.tar.gz: 60bd85487d12d75e093d4404c12c8a7da1f5ca08177d48fae1ec5b4360d7a809edb554a3fb46b6ce943e40f95859fcf05e56220a986d83d49b6c22afcc086043
6
+ metadata.gz: 4fbaf3d0a185ff3cf80e860fb0da641e18a180f819f2d570b3250570a70282f8ad776d9e0ec2b48dec195a8140d6b03f6c51f79e1ecb888ed88854ab67feaf5e
7
+ data.tar.gz: ce20c3bb2e57200a401de458588014a794e5230cf987a8b43cd9d915d02068d13ca8dfc44b864ecebbb4969ca313b370d7b1e9e2e569be36a0ffa638b6b60ecc
@@ -0,0 +1,531 @@
1
+ # Copyright (c) 2015 Blizzard Entertainment
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ from decoders import *
22
+
23
+
24
+ # Decoding instructions for each protocol type.
25
+ typeinfos = [
26
+ ('_int',[(0,7)]), #0
27
+ ('_int',[(0,4)]), #1
28
+ ('_int',[(0,5)]), #2
29
+ ('_int',[(0,6)]), #3
30
+ ('_int',[(0,14)]), #4
31
+ ('_int',[(0,22)]), #5
32
+ ('_int',[(0,32)]), #6
33
+ ('_choice',[(0,2),{0:('m_uint6',3),1:('m_uint14',4),2:('m_uint22',5),3:('m_uint32',6)}]), #7
34
+ ('_struct',[[('m_userId',2,-1)]]), #8
35
+ ('_blob',[(0,8)]), #9
36
+ ('_int',[(0,8)]), #10
37
+ ('_struct',[[('m_flags',10,0),('m_major',10,1),('m_minor',10,2),('m_revision',10,3),('m_build',6,4),('m_baseBuild',6,5)]]), #11
38
+ ('_int',[(0,3)]), #12
39
+ ('_bool',[]), #13
40
+ ('_array',[(16,0),10]), #14
41
+ ('_optional',[14]), #15
42
+ ('_blob',[(16,0)]), #16
43
+ ('_struct',[[('m_dataDeprecated',15,0),('m_data',16,1)]]), #17
44
+ ('_struct',[[('m_signature',9,0),('m_version',11,1),('m_type',12,2),('m_elapsedGameLoops',6,3),('m_useScaledTime',13,4),('m_ngdpRootKey',17,5),('m_dataBuildNum',6,6),('m_fixedFileHash',17,7)]]), #18
45
+ ('_fourcc',[]), #19
46
+ ('_blob',[(0,7)]), #20
47
+ ('_int',[(0,64)]), #21
48
+ ('_struct',[[('m_region',10,0),('m_programId',19,1),('m_realm',6,2),('m_name',20,3),('m_id',21,4)]]), #22
49
+ ('_struct',[[('m_a',10,0),('m_r',10,1),('m_g',10,2),('m_b',10,3)]]), #23
50
+ ('_int',[(0,2)]), #24
51
+ ('_optional',[10]), #25
52
+ ('_struct',[[('m_name',9,0),('m_toon',22,1),('m_race',9,2),('m_color',23,3),('m_control',10,4),('m_teamId',1,5),('m_handicap',0,6),('m_observe',24,7),('m_result',24,8),('m_workingSetSlotId',25,9),('m_hero',9,10)]]), #26
53
+ ('_array',[(0,5),26]), #27
54
+ ('_optional',[27]), #28
55
+ ('_blob',[(0,10)]), #29
56
+ ('_blob',[(0,11)]), #30
57
+ ('_struct',[[('m_file',30,0)]]), #31
58
+ ('_optional',[13]), #32
59
+ ('_int',[(-9223372036854775808,64)]), #33
60
+ ('_blob',[(0,12)]), #34
61
+ ('_blob',[(40,0)]), #35
62
+ ('_array',[(0,6),35]), #36
63
+ ('_optional',[36]), #37
64
+ ('_array',[(0,6),30]), #38
65
+ ('_optional',[38]), #39
66
+ ('_struct',[[('m_playerList',28,0),('m_title',29,1),('m_difficulty',9,2),('m_thumbnail',31,3),('m_isBlizzardMap',13,4),('m_restartAsTransitionMap',32,16),('m_timeUTC',33,5),('m_timeLocalOffset',33,6),('m_description',34,7),('m_imageFilePath',30,8),('m_campaignIndex',10,15),('m_mapFileName',30,9),('m_cacheHandles',37,10),('m_miniSave',13,11),('m_gameSpeed',12,12),('m_defaultDifficulty',3,13),('m_modPaths',39,14)]]), #40
67
+ ('_optional',[9]), #41
68
+ ('_optional',[35]), #42
69
+ ('_optional',[6]), #43
70
+ ('_struct',[[('m_race',25,-1)]]), #44
71
+ ('_struct',[[('m_team',25,-1)]]), #45
72
+ ('_blob',[(0,9)]), #46
73
+ ('_struct',[[('m_name',9,-18),('m_clanTag',41,-17),('m_clanLogo',42,-16),('m_highestLeague',25,-15),('m_combinedRaceLevels',43,-14),('m_randomSeed',6,-13),('m_racePreference',44,-12),('m_teamPreference',45,-11),('m_testMap',13,-10),('m_testAuto',13,-9),('m_examine',13,-8),('m_customInterface',13,-7),('m_testType',6,-6),('m_observe',24,-5),('m_hero',46,-4),('m_skin',46,-3),('m_mount',46,-2),('m_toonHandle',20,-1)]]), #47
74
+ ('_array',[(0,5),47]), #48
75
+ ('_struct',[[('m_lockTeams',13,-15),('m_teamsTogether',13,-14),('m_advancedSharedControl',13,-13),('m_randomRaces',13,-12),('m_battleNet',13,-11),('m_amm',13,-10),('m_competitive',13,-9),('m_practice',13,-8),('m_cooperative',13,-7),('m_noVictoryOrDefeat',13,-6),('m_heroDuplicatesAllowed',13,-5),('m_fog',24,-4),('m_observers',24,-3),('m_userDifficulty',24,-2),('m_clientDebugFlags',21,-1)]]), #49
76
+ ('_int',[(1,4)]), #50
77
+ ('_int',[(1,8)]), #51
78
+ ('_bitarray',[(0,6)]), #52
79
+ ('_bitarray',[(0,8)]), #53
80
+ ('_bitarray',[(0,2)]), #54
81
+ ('_bitarray',[(0,7)]), #55
82
+ ('_struct',[[('m_allowedColors',52,-6),('m_allowedRaces',53,-5),('m_allowedDifficulty',52,-4),('m_allowedControls',53,-3),('m_allowedObserveTypes',54,-2),('m_allowedAIBuilds',55,-1)]]), #56
83
+ ('_array',[(0,5),56]), #57
84
+ ('_struct',[[('m_randomValue',6,-26),('m_gameCacheName',29,-25),('m_gameOptions',49,-24),('m_gameSpeed',12,-23),('m_gameType',12,-22),('m_maxUsers',2,-21),('m_maxObservers',2,-20),('m_maxPlayers',2,-19),('m_maxTeams',50,-18),('m_maxColors',3,-17),('m_maxRaces',51,-16),('m_maxControls',10,-15),('m_mapSizeX',10,-14),('m_mapSizeY',10,-13),('m_mapFileSyncChecksum',6,-12),('m_mapFileName',30,-11),('m_mapAuthorName',9,-10),('m_modFileSyncChecksum',6,-9),('m_slotDescriptions',57,-8),('m_defaultDifficulty',3,-7),('m_defaultAIBuild',0,-6),('m_cacheHandles',36,-5),('m_hasExtensionMod',13,-4),('m_isBlizzardMap',13,-3),('m_isPremadeFFA',13,-2),('m_isCoopMode',13,-1)]]), #58
85
+ ('_optional',[1]), #59
86
+ ('_optional',[2]), #60
87
+ ('_struct',[[('m_color',60,-1)]]), #61
88
+ ('_array',[(0,4),46]), #62
89
+ ('_array',[(0,17),6]), #63
90
+ ('_array',[(0,9),6]), #64
91
+ ('_struct',[[('m_control',10,-22),('m_userId',59,-21),('m_teamId',1,-20),('m_colorPref',61,-19),('m_racePref',44,-18),('m_difficulty',3,-17),('m_aiBuild',0,-16),('m_handicap',0,-15),('m_observe',24,-14),('m_logoIndex',6,-13),('m_hero',46,-12),('m_skin',46,-11),('m_mount',46,-10),('m_artifacts',62,-9),('m_workingSetSlotId',25,-8),('m_rewards',63,-7),('m_toonHandle',20,-6),('m_licenses',64,-5),('m_tandemLeaderUserId',59,-4),('m_commander',46,-3),('m_commanderLevel',6,-2),('m_hasSilencePenalty',13,-1)]]), #65
92
+ ('_array',[(0,5),65]), #66
93
+ ('_struct',[[('m_phase',12,-11),('m_maxUsers',2,-10),('m_maxObservers',2,-9),('m_slots',66,-8),('m_randomSeed',6,-7),('m_hostUserId',59,-6),('m_isSinglePlayer',13,-5),('m_pickedMapTag',10,-4),('m_gameDuration',6,-3),('m_defaultDifficulty',3,-2),('m_defaultAIBuild',0,-1)]]), #67
94
+ ('_struct',[[('m_userInitialData',48,-3),('m_gameDescription',58,-2),('m_lobbyState',67,-1)]]), #68
95
+ ('_struct',[[('m_syncLobbyState',68,-1)]]), #69
96
+ ('_struct',[[('m_name',20,-1)]]), #70
97
+ ('_blob',[(0,6)]), #71
98
+ ('_struct',[[('m_name',71,-1)]]), #72
99
+ ('_struct',[[('m_name',71,-3),('m_type',6,-2),('m_data',20,-1)]]), #73
100
+ ('_struct',[[('m_type',6,-3),('m_name',71,-2),('m_data',34,-1)]]), #74
101
+ ('_array',[(0,5),10]), #75
102
+ ('_struct',[[('m_signature',75,-2),('m_toonHandle',20,-1)]]), #76
103
+ ('_struct',[[('m_gameFullyDownloaded',13,-14),('m_developmentCheatsEnabled',13,-13),('m_testCheatsEnabled',13,-12),('m_multiplayerCheatsEnabled',13,-11),('m_syncChecksummingEnabled',13,-10),('m_isMapToMapTransition',13,-9),('m_debugPauseEnabled',13,-8),('m_useGalaxyAsserts',13,-7),('m_platformMac',13,-6),('m_cameraFollow',13,-5),('m_baseBuildNum',6,-4),('m_buildNum',6,-3),('m_versionFlags',6,-2),('m_hotkeyProfile',46,-1)]]), #77
104
+ ('_struct',[[]]), #78
105
+ ('_int',[(0,16)]), #79
106
+ ('_struct',[[('x',79,-2),('y',79,-1)]]), #80
107
+ ('_struct',[[('m_which',12,-2),('m_target',80,-1)]]), #81
108
+ ('_struct',[[('m_fileName',30,-5),('m_automatic',13,-4),('m_overwrite',13,-3),('m_name',9,-2),('m_description',29,-1)]]), #82
109
+ ('_int',[(1,32)]), #83
110
+ ('_struct',[[('m_sequence',83,-1)]]), #84
111
+ ('_null',[]), #85
112
+ ('_int',[(0,20)]), #86
113
+ ('_int',[(-2147483648,32)]), #87
114
+ ('_struct',[[('x',86,-3),('y',86,-2),('z',87,-1)]]), #88
115
+ ('_struct',[[('m_targetUnitFlags',79,-7),('m_timer',10,-6),('m_tag',6,-5),('m_snapshotUnitLink',79,-4),('m_snapshotControlPlayerId',59,-3),('m_snapshotUpkeepPlayerId',59,-2),('m_snapshotPoint',88,-1)]]), #89
116
+ ('_choice',[(0,2),{0:('None',85),1:('TargetPoint',88),2:('TargetUnit',89)}]), #90
117
+ ('_struct',[[('m_target',90,-4),('m_time',87,-3),('m_verb',29,-2),('m_arguments',29,-1)]]), #91
118
+ ('_struct',[[('m_data',91,-1)]]), #92
119
+ ('_int',[(0,25)]), #93
120
+ ('_struct',[[('m_abilLink',79,-3),('m_abilCmdIndex',2,-2),('m_abilCmdData',25,-1)]]), #94
121
+ ('_optional',[94]), #95
122
+ ('_choice',[(0,2),{0:('None',85),1:('TargetPoint',88),2:('TargetUnit',89),3:('Data',6)}]), #96
123
+ ('_struct',[[('m_cmdFlags',93,-6),('m_abil',95,-5),('m_data',96,-4),('m_sequence',83,-3),('m_otherUnit',43,-2),('m_unitGroup',43,-1)]]), #97
124
+ ('_int',[(0,9)]), #98
125
+ ('_bitarray',[(0,9)]), #99
126
+ ('_array',[(0,9),98]), #100
127
+ ('_choice',[(0,2),{0:('None',85),1:('Mask',99),2:('OneIndices',100),3:('ZeroIndices',100)}]), #101
128
+ ('_struct',[[('m_unitLink',79,-4),('m_subgroupPriority',10,-3),('m_intraSubgroupPriority',10,-2),('m_count',98,-1)]]), #102
129
+ ('_array',[(0,9),102]), #103
130
+ ('_struct',[[('m_subgroupIndex',98,-4),('m_removeMask',101,-3),('m_addSubgroups',103,-2),('m_addUnitTags',64,-1)]]), #104
131
+ ('_struct',[[('m_controlGroupId',1,-2),('m_delta',104,-1)]]), #105
132
+ ('_struct',[[('m_controlGroupIndex',1,-3),('m_controlGroupUpdate',12,-2),('m_mask',101,-1)]]), #106
133
+ ('_struct',[[('m_count',98,-6),('m_subgroupCount',98,-5),('m_activeSubgroupIndex',98,-4),('m_unitTagsChecksum',6,-3),('m_subgroupIndicesChecksum',6,-2),('m_subgroupsChecksum',6,-1)]]), #107
134
+ ('_struct',[[('m_controlGroupId',1,-2),('m_selectionSyncData',107,-1)]]), #108
135
+ ('_array',[(0,3),87]), #109
136
+ ('_struct',[[('m_recipientId',1,-2),('m_resources',109,-1)]]), #110
137
+ ('_struct',[[('m_chatMessage',29,-1)]]), #111
138
+ ('_int',[(-128,8)]), #112
139
+ ('_struct',[[('x',87,-3),('y',87,-2),('z',87,-1)]]), #113
140
+ ('_struct',[[('m_beacon',112,-9),('m_ally',112,-8),('m_flags',112,-7),('m_build',112,-6),('m_targetUnitTag',6,-5),('m_targetUnitSnapshotUnitLink',79,-4),('m_targetUnitSnapshotUpkeepPlayerId',112,-3),('m_targetUnitSnapshotControlPlayerId',112,-2),('m_targetPoint',113,-1)]]), #114
141
+ ('_struct',[[('m_speed',12,-1)]]), #115
142
+ ('_struct',[[('m_delta',112,-1)]]), #116
143
+ ('_struct',[[('x',87,-2),('y',87,-1)]]), #117
144
+ ('_struct',[[('m_point',117,-4),('m_unit',6,-3),('m_pingedMinimap',13,-2),('m_option',87,-1)]]), #118
145
+ ('_struct',[[('m_verb',29,-2),('m_arguments',29,-1)]]), #119
146
+ ('_struct',[[('m_alliance',6,-2),('m_control',6,-1)]]), #120
147
+ ('_struct',[[('m_unitTag',6,-1)]]), #121
148
+ ('_struct',[[('m_unitTag',6,-2),('m_flags',10,-1)]]), #122
149
+ ('_struct',[[('m_conversationId',87,-2),('m_replyId',87,-1)]]), #123
150
+ ('_optional',[20]), #124
151
+ ('_struct',[[('m_gameUserId',1,-6),('m_observe',24,-5),('m_name',9,-4),('m_toonHandle',124,-3),('m_clanTag',41,-2),('m_clanLogo',42,-1)]]), #125
152
+ ('_array',[(0,5),125]), #126
153
+ ('_int',[(0,1)]), #127
154
+ ('_struct',[[('m_userInfos',126,-2),('m_method',127,-1)]]), #128
155
+ ('_struct',[[('m_purchaseItemId',87,-1)]]), #129
156
+ ('_struct',[[('m_difficultyLevel',87,-1)]]), #130
157
+ ('_choice',[(0,3),{0:('None',85),1:('Checked',13),2:('ValueChanged',6),3:('SelectionChanged',87),4:('TextChanged',30),5:('MouseButton',6)}]), #131
158
+ ('_struct',[[('m_controlId',87,-3),('m_eventType',87,-2),('m_eventData',131,-1)]]), #132
159
+ ('_struct',[[('m_soundHash',6,-2),('m_length',6,-1)]]), #133
160
+ ('_array',[(0,7),6]), #134
161
+ ('_struct',[[('m_soundHash',134,-2),('m_length',134,-1)]]), #135
162
+ ('_struct',[[('m_syncInfo',135,-1)]]), #136
163
+ ('_struct',[[('m_queryId',79,-3),('m_lengthMs',6,-2),('m_finishGameLoop',6,-1)]]), #137
164
+ ('_struct',[[('m_queryId',79,-2),('m_lengthMs',6,-1)]]), #138
165
+ ('_struct',[[('m_animWaitQueryId',79,-1)]]), #139
166
+ ('_struct',[[('m_sound',6,-1)]]), #140
167
+ ('_struct',[[('m_transmissionId',87,-2),('m_thread',6,-1)]]), #141
168
+ ('_struct',[[('m_transmissionId',87,-1)]]), #142
169
+ ('_optional',[80]), #143
170
+ ('_optional',[79]), #144
171
+ ('_optional',[112]), #145
172
+ ('_struct',[[('m_target',143,-6),('m_distance',144,-5),('m_pitch',144,-4),('m_yaw',144,-3),('m_reason',145,-2),('m_follow',13,-1)]]), #146
173
+ ('_struct',[[('m_skipType',127,-1)]]), #147
174
+ ('_int',[(0,11)]), #148
175
+ ('_struct',[[('x',148,-2),('y',148,-1)]]), #149
176
+ ('_struct',[[('m_button',6,-5),('m_down',13,-4),('m_posUI',149,-3),('m_posWorld',88,-2),('m_flags',112,-1)]]), #150
177
+ ('_struct',[[('m_posUI',149,-3),('m_posWorld',88,-2),('m_flags',112,-1)]]), #151
178
+ ('_struct',[[('m_achievementLink',79,-1)]]), #152
179
+ ('_struct',[[('m_hotkey',6,-2),('m_down',13,-1)]]), #153
180
+ ('_struct',[[('m_abilLink',79,-3),('m_abilCmdIndex',2,-2),('m_state',112,-1)]]), #154
181
+ ('_struct',[[('m_soundtrack',6,-1)]]), #155
182
+ ('_struct',[[('m_planetId',87,-1)]]), #156
183
+ ('_struct',[[('m_key',112,-2),('m_flags',112,-1)]]), #157
184
+ ('_struct',[[('m_resources',109,-1)]]), #158
185
+ ('_struct',[[('m_fulfillRequestId',87,-1)]]), #159
186
+ ('_struct',[[('m_cancelRequestId',87,-1)]]), #160
187
+ ('_struct',[[('m_error',87,-2),('m_abil',95,-1)]]), #161
188
+ ('_struct',[[('m_researchItemId',87,-1)]]), #162
189
+ ('_struct',[[('m_mercenaryId',87,-1)]]), #163
190
+ ('_struct',[[('m_battleReportId',87,-2),('m_difficultyLevel',87,-1)]]), #164
191
+ ('_struct',[[('m_battleReportId',87,-1)]]), #165
192
+ ('_int',[(0,19)]), #166
193
+ ('_struct',[[('m_decrementMs',166,-1)]]), #167
194
+ ('_struct',[[('m_portraitId',87,-1)]]), #168
195
+ ('_struct',[[('m_functionName',20,-1)]]), #169
196
+ ('_struct',[[('m_result',87,-1)]]), #170
197
+ ('_struct',[[('m_gameMenuItemIndex',87,-1)]]), #171
198
+ ('_int',[(-32768,16)]), #172
199
+ ('_struct',[[('m_wheelSpin',172,-2),('m_flags',112,-1)]]), #173
200
+ ('_struct',[[('m_purchaseCategoryId',87,-1)]]), #174
201
+ ('_struct',[[('m_button',79,-1)]]), #175
202
+ ('_struct',[[('m_cutsceneId',87,-2),('m_bookmarkName',20,-1)]]), #176
203
+ ('_struct',[[('m_cutsceneId',87,-1)]]), #177
204
+ ('_struct',[[('m_cutsceneId',87,-3),('m_conversationLine',20,-2),('m_altConversationLine',20,-1)]]), #178
205
+ ('_struct',[[('m_cutsceneId',87,-2),('m_conversationLine',20,-1)]]), #179
206
+ ('_struct',[[('m_leaveReason',1,-1)]]), #180
207
+ ('_struct',[[('m_observe',24,-7),('m_name',9,-6),('m_toonHandle',124,-5),('m_clanTag',41,-4),('m_clanLogo',42,-3),('m_hijack',13,-2),('m_hijackCloneGameUserId',59,-1)]]), #181
208
+ ('_optional',[83]), #182
209
+ ('_struct',[[('m_state',24,-2),('m_sequence',182,-1)]]), #183
210
+ ('_struct',[[('m_sequence',182,-2),('m_target',88,-1)]]), #184
211
+ ('_struct',[[('m_sequence',182,-2),('m_target',89,-1)]]), #185
212
+ ('_struct',[[('m_catalog',10,-4),('m_entry',79,-3),('m_field',9,-2),('m_value',9,-1)]]), #186
213
+ ('_struct',[[('m_index',6,-1)]]), #187
214
+ ('_struct',[[('m_shown',13,-1)]]), #188
215
+ ('_struct',[[('m_recipient',12,-2),('m_string',30,-1)]]), #189
216
+ ('_struct',[[('m_recipient',12,-2),('m_point',117,-1)]]), #190
217
+ ('_struct',[[('m_progress',87,-1)]]), #191
218
+ ('_struct',[[('m_status',24,-1)]]), #192
219
+ ('_struct',[[('m_abilLink',79,-3),('m_abilCmdIndex',2,-2),('m_buttonLink',79,-1)]]), #193
220
+ ('_struct',[[('m_behaviorLink',79,-2),('m_buttonLink',79,-1)]]), #194
221
+ ('_choice',[(0,2),{0:('None',85),1:('Ability',193),2:('Behavior',194),3:('Vitals',172)}]), #195
222
+ ('_struct',[[('m_announcement',195,-3),('m_otherUnitTag',6,-2),('m_unitTag',6,-1)]]), #196
223
+ ('_struct',[[('m_scoreValueMineralsCurrent',87,0),('m_scoreValueVespeneCurrent',87,1),('m_scoreValueMineralsCollectionRate',87,2),('m_scoreValueVespeneCollectionRate',87,3),('m_scoreValueWorkersActiveCount',87,4),('m_scoreValueMineralsUsedInProgressArmy',87,5),('m_scoreValueMineralsUsedInProgressEconomy',87,6),('m_scoreValueMineralsUsedInProgressTechnology',87,7),('m_scoreValueVespeneUsedInProgressArmy',87,8),('m_scoreValueVespeneUsedInProgressEconomy',87,9),('m_scoreValueVespeneUsedInProgressTechnology',87,10),('m_scoreValueMineralsUsedCurrentArmy',87,11),('m_scoreValueMineralsUsedCurrentEconomy',87,12),('m_scoreValueMineralsUsedCurrentTechnology',87,13),('m_scoreValueVespeneUsedCurrentArmy',87,14),('m_scoreValueVespeneUsedCurrentEconomy',87,15),('m_scoreValueVespeneUsedCurrentTechnology',87,16),('m_scoreValueMineralsLostArmy',87,17),('m_scoreValueMineralsLostEconomy',87,18),('m_scoreValueMineralsLostTechnology',87,19),('m_scoreValueVespeneLostArmy',87,20),('m_scoreValueVespeneLostEconomy',87,21),('m_scoreValueVespeneLostTechnology',87,22),('m_scoreValueMineralsKilledArmy',87,23),('m_scoreValueMineralsKilledEconomy',87,24),('m_scoreValueMineralsKilledTechnology',87,25),('m_scoreValueVespeneKilledArmy',87,26),('m_scoreValueVespeneKilledEconomy',87,27),('m_scoreValueVespeneKilledTechnology',87,28),('m_scoreValueFoodUsed',87,29),('m_scoreValueFoodMade',87,30),('m_scoreValueMineralsUsedActiveForces',87,31),('m_scoreValueVespeneUsedActiveForces',87,32),('m_scoreValueMineralsFriendlyFireArmy',87,33),('m_scoreValueMineralsFriendlyFireEconomy',87,34),('m_scoreValueMineralsFriendlyFireTechnology',87,35),('m_scoreValueVespeneFriendlyFireArmy',87,36),('m_scoreValueVespeneFriendlyFireEconomy',87,37),('m_scoreValueVespeneFriendlyFireTechnology',87,38)]]), #197
224
+ ('_struct',[[('m_playerId',1,0),('m_stats',197,1)]]), #198
225
+ ('_struct',[[('m_unitTagIndex',6,0),('m_unitTagRecycle',6,1),('m_unitTypeName',29,2),('m_controlPlayerId',1,3),('m_upkeepPlayerId',1,4),('m_x',10,5),('m_y',10,6)]]), #199
226
+ ('_struct',[[('m_unitTagIndex',6,0),('m_unitTagRecycle',6,1),('m_x',10,2),('m_y',10,3)]]), #200
227
+ ('_struct',[[('m_unitTagIndex',6,0),('m_unitTagRecycle',6,1),('m_killerPlayerId',59,2),('m_x',10,3),('m_y',10,4),('m_killerUnitTagIndex',43,5),('m_killerUnitTagRecycle',43,6)]]), #201
228
+ ('_struct',[[('m_unitTagIndex',6,0),('m_unitTagRecycle',6,1),('m_controlPlayerId',1,2),('m_upkeepPlayerId',1,3)]]), #202
229
+ ('_struct',[[('m_unitTagIndex',6,0),('m_unitTagRecycle',6,1),('m_unitTypeName',29,2)]]), #203
230
+ ('_struct',[[('m_playerId',1,0),('m_upgradeTypeName',29,1),('m_count',87,2)]]), #204
231
+ ('_struct',[[('m_unitTagIndex',6,0),('m_unitTagRecycle',6,1)]]), #205
232
+ ('_array',[(0,10),87]), #206
233
+ ('_struct',[[('m_firstUnitIndex',6,0),('m_items',206,1)]]), #207
234
+ ('_struct',[[('m_playerId',1,0),('m_type',6,1),('m_userId',43,2),('m_slotId',43,3)]]), #208
235
+ ('_struct',[[('m_key',29,0)]]), #209
236
+ ('_struct',[[('__parent',209,0),('m_value',29,1)]]), #210
237
+ ('_array',[(0,6),210]), #211
238
+ ('_optional',[211]), #212
239
+ ('_struct',[[('__parent',209,0),('m_value',87,1)]]), #213
240
+ ('_array',[(0,6),213]), #214
241
+ ('_optional',[214]), #215
242
+ ('_struct',[[('m_eventName',29,0),('m_stringData',212,1),('m_intData',215,2),('m_fixedData',215,3)]]), #216
243
+ ('_struct',[[('m_value',6,0),('m_time',6,1)]]), #217
244
+ ('_array',[(0,6),217]), #218
245
+ ('_array',[(0,5),218]), #219
246
+ ('_struct',[[('m_name',29,0),('m_values',219,1)]]), #220
247
+ ('_array',[(0,21),220]), #221
248
+ ('_struct',[[('m_instanceList',221,0)]]), #222
249
+ ]
250
+
251
+ # Map from protocol NNet.Game.*Event eventid to (typeid, name)
252
+ game_event_types = {
253
+ 5: (78, 'NNet.Game.SUserFinishedLoadingSyncEvent'),
254
+ 7: (77, 'NNet.Game.SUserOptionsEvent'),
255
+ 9: (70, 'NNet.Game.SBankFileEvent'),
256
+ 10: (72, 'NNet.Game.SBankSectionEvent'),
257
+ 11: (73, 'NNet.Game.SBankKeyEvent'),
258
+ 12: (74, 'NNet.Game.SBankValueEvent'),
259
+ 13: (76, 'NNet.Game.SBankSignatureEvent'),
260
+ 14: (81, 'NNet.Game.SCameraSaveEvent'),
261
+ 21: (82, 'NNet.Game.SSaveGameEvent'),
262
+ 22: (78, 'NNet.Game.SSaveGameDoneEvent'),
263
+ 23: (78, 'NNet.Game.SLoadGameDoneEvent'),
264
+ 25: (84, 'NNet.Game.SCommandManagerResetEvent'),
265
+ 26: (92, 'NNet.Game.SGameCheatEvent'),
266
+ 27: (97, 'NNet.Game.SCmdEvent'),
267
+ 28: (105, 'NNet.Game.SSelectionDeltaEvent'),
268
+ 29: (106, 'NNet.Game.SControlGroupUpdateEvent'),
269
+ 30: (108, 'NNet.Game.SSelectionSyncCheckEvent'),
270
+ 31: (110, 'NNet.Game.SResourceTradeEvent'),
271
+ 32: (111, 'NNet.Game.STriggerChatMessageEvent'),
272
+ 33: (114, 'NNet.Game.SAICommunicateEvent'),
273
+ 34: (115, 'NNet.Game.SSetAbsoluteGameSpeedEvent'),
274
+ 35: (116, 'NNet.Game.SAddAbsoluteGameSpeedEvent'),
275
+ 36: (118, 'NNet.Game.STriggerPingEvent'),
276
+ 37: (119, 'NNet.Game.SBroadcastCheatEvent'),
277
+ 38: (120, 'NNet.Game.SAllianceEvent'),
278
+ 39: (121, 'NNet.Game.SUnitClickEvent'),
279
+ 40: (122, 'NNet.Game.SUnitHighlightEvent'),
280
+ 41: (123, 'NNet.Game.STriggerReplySelectedEvent'),
281
+ 43: (128, 'NNet.Game.SHijackReplayGameEvent'),
282
+ 44: (78, 'NNet.Game.STriggerSkippedEvent'),
283
+ 45: (133, 'NNet.Game.STriggerSoundLengthQueryEvent'),
284
+ 46: (140, 'NNet.Game.STriggerSoundOffsetEvent'),
285
+ 47: (141, 'NNet.Game.STriggerTransmissionOffsetEvent'),
286
+ 48: (142, 'NNet.Game.STriggerTransmissionCompleteEvent'),
287
+ 49: (146, 'NNet.Game.SCameraUpdateEvent'),
288
+ 50: (78, 'NNet.Game.STriggerAbortMissionEvent'),
289
+ 51: (129, 'NNet.Game.STriggerPurchaseMadeEvent'),
290
+ 52: (78, 'NNet.Game.STriggerPurchaseExitEvent'),
291
+ 53: (130, 'NNet.Game.STriggerPlanetMissionLaunchedEvent'),
292
+ 54: (78, 'NNet.Game.STriggerPlanetPanelCanceledEvent'),
293
+ 55: (132, 'NNet.Game.STriggerDialogControlEvent'),
294
+ 56: (136, 'NNet.Game.STriggerSoundLengthSyncEvent'),
295
+ 57: (147, 'NNet.Game.STriggerConversationSkippedEvent'),
296
+ 58: (150, 'NNet.Game.STriggerMouseClickedEvent'),
297
+ 59: (151, 'NNet.Game.STriggerMouseMovedEvent'),
298
+ 60: (152, 'NNet.Game.SAchievementAwardedEvent'),
299
+ 61: (153, 'NNet.Game.STriggerHotkeyPressedEvent'),
300
+ 62: (154, 'NNet.Game.STriggerTargetModeUpdateEvent'),
301
+ 63: (78, 'NNet.Game.STriggerPlanetPanelReplayEvent'),
302
+ 64: (155, 'NNet.Game.STriggerSoundtrackDoneEvent'),
303
+ 65: (156, 'NNet.Game.STriggerPlanetMissionSelectedEvent'),
304
+ 66: (157, 'NNet.Game.STriggerKeyPressedEvent'),
305
+ 67: (169, 'NNet.Game.STriggerMovieFunctionEvent'),
306
+ 68: (78, 'NNet.Game.STriggerPlanetPanelBirthCompleteEvent'),
307
+ 69: (78, 'NNet.Game.STriggerPlanetPanelDeathCompleteEvent'),
308
+ 70: (158, 'NNet.Game.SResourceRequestEvent'),
309
+ 71: (159, 'NNet.Game.SResourceRequestFulfillEvent'),
310
+ 72: (160, 'NNet.Game.SResourceRequestCancelEvent'),
311
+ 73: (78, 'NNet.Game.STriggerResearchPanelExitEvent'),
312
+ 74: (78, 'NNet.Game.STriggerResearchPanelPurchaseEvent'),
313
+ 75: (162, 'NNet.Game.STriggerResearchPanelSelectionChangedEvent'),
314
+ 76: (161, 'NNet.Game.STriggerCommandErrorEvent'),
315
+ 77: (78, 'NNet.Game.STriggerMercenaryPanelExitEvent'),
316
+ 78: (78, 'NNet.Game.STriggerMercenaryPanelPurchaseEvent'),
317
+ 79: (163, 'NNet.Game.STriggerMercenaryPanelSelectionChangedEvent'),
318
+ 80: (78, 'NNet.Game.STriggerVictoryPanelExitEvent'),
319
+ 81: (78, 'NNet.Game.STriggerBattleReportPanelExitEvent'),
320
+ 82: (164, 'NNet.Game.STriggerBattleReportPanelPlayMissionEvent'),
321
+ 83: (165, 'NNet.Game.STriggerBattleReportPanelPlaySceneEvent'),
322
+ 84: (165, 'NNet.Game.STriggerBattleReportPanelSelectionChangedEvent'),
323
+ 85: (130, 'NNet.Game.STriggerVictoryPanelPlayMissionAgainEvent'),
324
+ 86: (78, 'NNet.Game.STriggerMovieStartedEvent'),
325
+ 87: (78, 'NNet.Game.STriggerMovieFinishedEvent'),
326
+ 88: (167, 'NNet.Game.SDecrementGameTimeRemainingEvent'),
327
+ 89: (168, 'NNet.Game.STriggerPortraitLoadedEvent'),
328
+ 90: (170, 'NNet.Game.STriggerCustomDialogDismissedEvent'),
329
+ 91: (171, 'NNet.Game.STriggerGameMenuItemSelectedEvent'),
330
+ 92: (173, 'NNet.Game.STriggerMouseWheelEvent'),
331
+ 93: (129, 'NNet.Game.STriggerPurchasePanelSelectedPurchaseItemChangedEvent'),
332
+ 94: (174, 'NNet.Game.STriggerPurchasePanelSelectedPurchaseCategoryChangedEvent'),
333
+ 95: (175, 'NNet.Game.STriggerButtonPressedEvent'),
334
+ 96: (78, 'NNet.Game.STriggerGameCreditsFinishedEvent'),
335
+ 97: (176, 'NNet.Game.STriggerCutsceneBookmarkFiredEvent'),
336
+ 98: (177, 'NNet.Game.STriggerCutsceneEndSceneFiredEvent'),
337
+ 99: (178, 'NNet.Game.STriggerCutsceneConversationLineEvent'),
338
+ 100: (179, 'NNet.Game.STriggerCutsceneConversationLineMissingEvent'),
339
+ 101: (180, 'NNet.Game.SGameUserLeaveEvent'),
340
+ 102: (181, 'NNet.Game.SGameUserJoinEvent'),
341
+ 103: (183, 'NNet.Game.SCommandManagerStateEvent'),
342
+ 104: (184, 'NNet.Game.SCmdUpdateTargetPointEvent'),
343
+ 105: (185, 'NNet.Game.SCmdUpdateTargetUnitEvent'),
344
+ 106: (137, 'NNet.Game.STriggerAnimLengthQueryByNameEvent'),
345
+ 107: (138, 'NNet.Game.STriggerAnimLengthQueryByPropsEvent'),
346
+ 108: (139, 'NNet.Game.STriggerAnimOffsetEvent'),
347
+ 109: (186, 'NNet.Game.SCatalogModifyEvent'),
348
+ 110: (187, 'NNet.Game.SHeroTalentTreeSelectedEvent'),
349
+ 111: (78, 'NNet.Game.STriggerProfilerLoggingFinishedEvent'),
350
+ 112: (188, 'NNet.Game.SHeroTalentTreeSelectionPanelToggledEvent'),
351
+ }
352
+
353
+ # The typeid of the NNet.Game.EEventId enum.
354
+ game_eventid_typeid = 0
355
+
356
+ # Map from protocol NNet.Game.*Message eventid to (typeid, name)
357
+ message_event_types = {
358
+ 0: (189, 'NNet.Game.SChatMessage'),
359
+ 1: (190, 'NNet.Game.SPingMessage'),
360
+ 2: (191, 'NNet.Game.SLoadingProgressMessage'),
361
+ 3: (78, 'NNet.Game.SServerPingMessage'),
362
+ 4: (192, 'NNet.Game.SReconnectNotifyMessage'),
363
+ 5: (196, 'NNet.Game.SPlayerAnnounceMessage'),
364
+ }
365
+
366
+ # The typeid of the NNet.Game.EMessageId enum.
367
+ message_eventid_typeid = 1
368
+
369
+ # Map from protocol NNet.Replay.Tracker.*Event eventid to (typeid, name)
370
+ tracker_event_types = {
371
+ 0: (198, 'NNet.Replay.Tracker.SPlayerStatsEvent'),
372
+ 1: (199, 'NNet.Replay.Tracker.SUnitBornEvent'),
373
+ 2: (201, 'NNet.Replay.Tracker.SUnitDiedEvent'),
374
+ 3: (202, 'NNet.Replay.Tracker.SUnitOwnerChangeEvent'),
375
+ 4: (203, 'NNet.Replay.Tracker.SUnitTypeChangeEvent'),
376
+ 5: (204, 'NNet.Replay.Tracker.SUpgradeEvent'),
377
+ 6: (199, 'NNet.Replay.Tracker.SUnitInitEvent'),
378
+ 7: (205, 'NNet.Replay.Tracker.SUnitDoneEvent'),
379
+ 8: (207, 'NNet.Replay.Tracker.SUnitPositionsEvent'),
380
+ 9: (208, 'NNet.Replay.Tracker.SPlayerSetupEvent'),
381
+ 10: (216, 'NNet.Replay.Tracker.SStatGameEvent'),
382
+ 11: (222, 'NNet.Replay.Tracker.SScoreResultEvent'),
383
+ 12: (200, 'NNet.Replay.Tracker.SUnitRevivedEvent'),
384
+ }
385
+
386
+ # The typeid of the NNet.Replay.Tracker.EEventId enum.
387
+ tracker_eventid_typeid = 2
388
+
389
+ # The typeid of NNet.SVarUint32 (the type used to encode gameloop deltas).
390
+ svaruint32_typeid = 7
391
+
392
+ # The typeid of NNet.Replay.SGameUserId (the type used to encode player ids).
393
+ replay_userid_typeid = 8
394
+
395
+ # The typeid of NNet.Replay.SHeader (the type used to store replay game version and length).
396
+ replay_header_typeid = 18
397
+
398
+ # The typeid of NNet.Game.SDetails (the type used to store overall replay details).
399
+ game_details_typeid = 40
400
+
401
+ # The typeid of NNet.Replay.SInitData (the type used to store the inital lobby).
402
+ replay_initdata_typeid = 69
403
+
404
+
405
+ def _varuint32_value(value):
406
+ # Returns the numeric value from a SVarUint32 instance.
407
+ for k,v in value.iteritems():
408
+ return v
409
+ return 0
410
+
411
+
412
+ def _decode_event_stream(decoder, eventid_typeid, event_types, decode_user_id):
413
+ # Decodes events prefixed with a gameloop and possibly userid
414
+ gameloop = 0
415
+ while not decoder.done():
416
+ start_bits = decoder.used_bits()
417
+
418
+ # decode the gameloop delta before each event
419
+ delta = _varuint32_value(decoder.instance(svaruint32_typeid))
420
+ gameloop += delta
421
+
422
+ # decode the userid before each event
423
+ if decode_user_id:
424
+ userid = decoder.instance(replay_userid_typeid)
425
+
426
+ # decode the event id
427
+ eventid = decoder.instance(eventid_typeid)
428
+ typeid, typename = event_types.get(eventid, (None, None))
429
+ if typeid is None:
430
+ raise CorruptedError('eventid(%d) at %s' % (eventid, decoder))
431
+
432
+ # decode the event struct instance
433
+ event = decoder.instance(typeid)
434
+ event['_event'] = typename
435
+ event['_eventid'] = eventid
436
+
437
+ # insert gameloop and userid
438
+ event['_gameloop'] = gameloop
439
+ if decode_user_id:
440
+ event['_userid'] = userid
441
+
442
+ # the next event is byte aligned
443
+ decoder.byte_align()
444
+
445
+ # insert bits used in stream
446
+ event['_bits'] = decoder.used_bits() - start_bits
447
+
448
+ yield event
449
+
450
+
451
+ def decode_replay_game_events(contents):
452
+ """Decodes and yields each game event from the contents byte string."""
453
+ decoder = BitPackedDecoder(contents, typeinfos)
454
+ for event in _decode_event_stream(decoder,
455
+ game_eventid_typeid,
456
+ game_event_types,
457
+ decode_user_id=True):
458
+ yield event
459
+
460
+
461
+ def decode_replay_message_events(contents):
462
+ """Decodes and yields each message event from the contents byte string."""
463
+ decoder = BitPackedDecoder(contents, typeinfos)
464
+ for event in _decode_event_stream(decoder,
465
+ message_eventid_typeid,
466
+ message_event_types,
467
+ decode_user_id=True):
468
+ yield event
469
+
470
+
471
+ def decode_replay_tracker_events(contents):
472
+ """Decodes and yields each tracker event from the contents byte string."""
473
+ decoder = VersionedDecoder(contents, typeinfos)
474
+ for event in _decode_event_stream(decoder,
475
+ tracker_eventid_typeid,
476
+ tracker_event_types,
477
+ decode_user_id=False):
478
+ yield event
479
+
480
+
481
+ def decode_replay_header(contents):
482
+ """Decodes and return the replay header from the contents byte string."""
483
+ decoder = VersionedDecoder(contents, typeinfos)
484
+ return decoder.instance(replay_header_typeid)
485
+
486
+
487
+ def decode_replay_details(contents):
488
+ """Decodes and returns the game details from the contents byte string."""
489
+ decoder = VersionedDecoder(contents, typeinfos)
490
+ return decoder.instance(game_details_typeid)
491
+
492
+
493
+ def decode_replay_initdata(contents):
494
+ """Decodes and return the replay init data from the contents byte string."""
495
+ decoder = BitPackedDecoder(contents, typeinfos)
496
+ return decoder.instance(replay_initdata_typeid)
497
+
498
+
499
+ def decode_replay_attributes_events(contents):
500
+ """Decodes and yields each attribute from the contents byte string."""
501
+ buffer = BitPackedBuffer(contents, 'little')
502
+ attributes = {}
503
+ if not buffer.done():
504
+ attributes['source'] = buffer.read_bits(8)
505
+ attributes['mapNamespace'] = buffer.read_bits(32)
506
+ count = buffer.read_bits(32)
507
+ attributes['scopes'] = {}
508
+ while not buffer.done():
509
+ value = {}
510
+ value['namespace'] = buffer.read_bits(32)
511
+ value['attrid'] = attrid = buffer.read_bits(32)
512
+ scope = buffer.read_bits(8)
513
+ value['value'] = buffer.read_aligned_bytes(4)[::-1].strip('\x00')
514
+ if not scope in attributes['scopes']:
515
+ attributes['scopes'][scope] = {}
516
+ if not attrid in attributes['scopes'][scope]:
517
+ attributes['scopes'][scope][attrid] = []
518
+ attributes['scopes'][scope][attrid].append(value)
519
+ return attributes
520
+
521
+
522
+ def unit_tag(unitTagIndex, unitTagRecycle):
523
+ return (unitTagIndex << 18) + unitTagRecycle
524
+
525
+
526
+ def unit_tag_index(unitTag):
527
+ return (unitTag >> 18) & 0x00003fff
528
+
529
+
530
+ def unit_tag_recycle(unitTag):
531
+ return (unitTag) & 0x0003ffff
@@ -1,3 +1,3 @@
1
1
  module Herostats
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herostats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronald Leask
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -135,6 +135,7 @@ files:
135
135
  - lib/heroprotocol/protocol40697.py
136
136
  - lib/heroprotocol/protocol40798.py
137
137
  - lib/heroprotocol/protocol41150.py
138
+ - lib/heroprotocol/protocol41393.py
138
139
  - lib/herostats.rb
139
140
  - lib/herostats/exp_breakdown.rb
140
141
  - lib/herostats/game.rb