37
37
LogWheelDestroy ,
38
38
LogPlayerMakeGroggy ,
39
39
LogPlayerRevive ,
40
- LogRedZoneEnded
40
+ LogRedZoneEnded ,
41
+ LogPhaseChange ,
42
+ LogPlayerUseThrowable
41
43
)
42
44
from pubg_python .domain .telemetry .objects import (
43
45
Location ,
@@ -89,7 +91,10 @@ def test_log_player_create():
89
91
90
92
def test_log_player_position ():
91
93
events = telemetry .events_from_type ('LogPlayerPosition' )
92
- data = events [0 ]
94
+ for i in events :
95
+ if isinstance (i .vehicle , Vehicle ):
96
+ data = i
97
+ break
93
98
assert isinstance (data , LogPlayerPosition )
94
99
assert isinstance (data .character , Character )
95
100
assert isinstance (data .vehicle , Vehicle )
@@ -110,7 +115,10 @@ def test_log_weapon_fire_count():
110
115
111
116
def test_log_player_attack ():
112
117
events = telemetry .events_from_type ('LogPlayerAttack' )
113
- data = events [62 ]
118
+ for e in events :
119
+ if e .weapon .item_id != '' :
120
+ data = e
121
+ break
114
122
assert isinstance (data , LogPlayerAttack )
115
123
assert isinstance (data .attacker , Character )
116
124
assert isinstance (data .weapon , Item )
@@ -128,7 +136,7 @@ def test_log_player_take_damage():
128
136
assert isinstance (data , LogPlayerTakeDamage )
129
137
assert isinstance (data .attacker , Character )
130
138
assert isinstance (data .victim , Character )
131
- assert isinstance ( data .damage , float )
139
+ assert data .damage > 0
132
140
assert data .damage_type_category in DAMAGE_TYPE_MAP
133
141
assert data .damage_reason in DAMAGE_REASON
134
142
assert data .damage_causer_name in DAMAGE_CAUSER_MAP
@@ -151,7 +159,8 @@ def test_log_player_kill():
151
159
assert data .damage_causer_name in DAMAGE_CAUSER_MAP
152
160
assert data .damage_reason in DAMAGE_REASON
153
161
if data .victim_weapon :
154
- assert data .victim_weapon [:- 3 ] in DAMAGE_CAUSER_MAP
162
+ cut_idx = data .victim_weapon .index ('_C_' ) + 2
163
+ assert data .victim_weapon [:cut_idx ] in DAMAGE_CAUSER_MAP
155
164
156
165
157
166
def test_log_parachute_landing ():
@@ -330,7 +339,7 @@ def test_log_vehicle_leave():
330
339
331
340
def test_log_vehicle_destroy ():
332
341
events = telemetry .events_from_type ('LogVehicleDestroy' )
333
- data = events [3 ]
342
+ data = events [0 ]
334
343
assert isinstance (data , LogVehicleDestroy )
335
344
assert isinstance (data .attacker , Character )
336
345
assert isinstance (data .vehicle , Vehicle )
@@ -474,7 +483,8 @@ def test_log_player_make_groggy():
474
483
if not data .victim_weapon :
475
484
assert True
476
485
else :
477
- assert data .victim_weapon [:- 3 ] in DAMAGE_CAUSER_MAP
486
+ cut_idx = data .victim_weapon .index ('_C_' ) + 2
487
+ assert data .victim_weapon [:cut_idx ] in DAMAGE_CAUSER_MAP
478
488
479
489
480
490
def test_log_player_revive ():
@@ -491,3 +501,20 @@ def test_log_red_zone_ended():
491
501
data = events [0 ]
492
502
assert isinstance (data , LogRedZoneEnded )
493
503
assert isinstance (data .drivers , list )
504
+
505
+
506
+ def test_log_phase_change ():
507
+ events = telemetry .events_from_type ('LogPhaseChange' )
508
+ data = events [0 ]
509
+ assert isinstance (data , LogPhaseChange )
510
+ assert isinstance (data .phase , int )
511
+
512
+
513
+ def test_log_player_use_throwable ():
514
+ events = telemetry .events_from_type ('LogPlayerUseThrowable' )
515
+ data = events [0 ]
516
+ assert isinstance (data , LogPlayerUseThrowable )
517
+ assert isinstance (data .attacker , Character )
518
+ assert isinstance (data .weapon , Item )
519
+ assert isinstance (data .fire_weapon_stack_count , int )
520
+ assert data .attack_type in ATTACK_TYPE
0 commit comments