Fight reporting unified and moved to Reporter.report_fighting
This commit is contained in:
parent
f652b02443
commit
123b6cf4ed
@ -1662,10 +1662,11 @@ class CitizenMilitary(CitizenTravel):
|
|||||||
self.write_log("Hits: {:>4} | Damage: {}".format(total_hits, total_damage))
|
self.write_log("Hits: {:>4} | Damage: {}".format(total_hits, total_damage))
|
||||||
ok_to_fight = False
|
ok_to_fight = False
|
||||||
if total_damage:
|
if total_damage:
|
||||||
self.reporter.report_action('FIGHT', dict(battle_id=battle.id, side=side, dmg=total_damage,
|
self.reporter.report_fighting(battle, not side.is_defender, division, total_damage, total_hits)
|
||||||
air=battle.has_air, hits=total_hits,
|
# self.reporter.report_action('FIGHT', dict(battle_id=battle.id, side=side, dmg=total_damage,
|
||||||
round=battle.zone_id,
|
# air=battle.has_air, hits=total_hits,
|
||||||
extra=dict(battle=battle, side=side)))
|
# round=battle.zone_id,
|
||||||
|
# extra=dict(battle=battle, side=side)))
|
||||||
return error_count
|
return error_count
|
||||||
|
|
||||||
def _shoot(self, battle: classes.Battle, division: classes.BattleDivision, side: classes.BattleSide):
|
def _shoot(self, battle: classes.Battle, division: classes.BattleDivision, side: classes.BattleSide):
|
||||||
|
@ -618,6 +618,12 @@ class Reporter:
|
|||||||
else:
|
else:
|
||||||
self.__to_update.append(json_data)
|
self.__to_update.append(json_data)
|
||||||
|
|
||||||
|
def report_fighting(self, battle: "Battle", invader: bool, division: "BattleDivision", damage: float, hits: int):
|
||||||
|
side = battle.invader if invader else battle.defender
|
||||||
|
self.report_action('FIGHT', dict(battle_id=battle.id, side=side, dmg=damage,
|
||||||
|
air=battle.has_air, hits=hits,
|
||||||
|
round=battle.zone_id, extra=dict(battle=battle, side=side, division=division)))
|
||||||
|
|
||||||
def report_promo(self, kind: str, time_until: datetime.datetime):
|
def report_promo(self, kind: str, time_until: datetime.datetime):
|
||||||
self._req.post(f"{self.url}/promos/add/", data=dict(kind=kind, time_untill=time_until))
|
self._req.post(f"{self.url}/promos/add/", data=dict(kind=kind, time_untill=time_until))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user