Medal notifications
This commit is contained in:
parent
b7211b7c75
commit
b76ea2c4ae
@ -2178,11 +2178,11 @@ class Citizen(CitizenMilitary, CitizenAnniversary, CitizenEconomy, CitizenSocial
|
|||||||
for medal in notifications.get('notifications', []):
|
for medal in notifications.get('notifications', []):
|
||||||
if medal.get('details', {}).get('type') == "citizenAchievement":
|
if medal.get('details', {}).get('type') == "citizenAchievement":
|
||||||
params: dict = medal.get('details', {}).get('achievement')
|
params: dict = medal.get('details', {}).get('achievement')
|
||||||
about: str = medal.get('details').get('description')
|
about: str = medal.get('body')
|
||||||
title: str = medal.get('title')
|
title: str = medal.get('title')
|
||||||
|
|
||||||
award_id: int = medal.get('id')
|
award_id: int = medal.get('id')
|
||||||
if award_id and title:
|
if award_id and title and medal.get('details').get('isWallMaterial'):
|
||||||
self._post_main_wall_post_automatic(title.lower(), award_id)
|
self._post_main_wall_post_automatic(title.lower(), award_id)
|
||||||
|
|
||||||
if params.get('ccValue'):
|
if params.get('ccValue'):
|
||||||
@ -2206,7 +2206,8 @@ class Citizen(CitizenMilitary, CitizenAnniversary, CitizenEconomy, CitizenSocial
|
|||||||
" totaling {} {currency}".format(d["count"] * d["reward"], **d) for d in data.values()]
|
" totaling {} {currency}".format(d["count"] * d["reward"], **d) for d in data.values()]
|
||||||
|
|
||||||
msgs = "\n".join(msgs)
|
msgs = "\n".join(msgs)
|
||||||
self.telegram.report_medal(msgs)
|
if self.config.telegram:
|
||||||
|
self.telegram.report_medal(msgs, len(data) > 1)
|
||||||
self.write_log(f"Found awards:\n{msgs}")
|
self.write_log(f"Found awards:\n{msgs}")
|
||||||
for info in data.values():
|
for info in data.values():
|
||||||
self.reporter.report_action("NEW_MEDAL", info)
|
self.reporter.report_action("NEW_MEDAL", info)
|
||||||
@ -2249,8 +2250,28 @@ class Citizen(CitizenMilitary, CitizenAnniversary, CitizenEconomy, CitizenSocial
|
|||||||
if pps:
|
if pps:
|
||||||
self.details.next_pp.append(int(pps.group(1)))
|
self.details.next_pp.append(int(pps.group(1)))
|
||||||
|
|
||||||
|
def should_fight(self, silent: bool = True) -> Tuple[int, str, bool]:
|
||||||
|
count, log_msg, force_fight = super().should_fight()
|
||||||
|
|
||||||
|
if count > 0 and not force_fight:
|
||||||
|
if self.energy.food_fights - self.my_companies.ff_lockdown < count:
|
||||||
|
log_msg = (f"Fight count modified (old count: {count} | FF: {self.energy.food_fights} | "
|
||||||
|
f"WAM ff_lockdown: {self.my_companies.ff_lockdown} |"
|
||||||
|
f" New count: {count - self.my_companies.ff_lockdown})")
|
||||||
|
count -= self.my_companies.ff_lockdown
|
||||||
|
if count <= 0:
|
||||||
|
count = 0
|
||||||
|
log_msg = f"Not fighting because WAM needs {self.my_companies.ff_lockdown} food fights"
|
||||||
|
|
||||||
|
if self.max_time_till_full_ff > self.time_till_week_change:
|
||||||
|
max_count = (int(self.time_till_week_change.total_seconds()) // 360 * self.energy.interval) // 10
|
||||||
|
log_msg = ("End for Weekly challenge is near "
|
||||||
|
f"(Recoverable until WC end {max_count}hp | want to do {count}hits)")
|
||||||
|
count = count if max_count > count else max_count
|
||||||
|
|
||||||
|
self.write_log(log_msg, False)
|
||||||
|
|
||||||
|
return count, log_msg, force_fight
|
||||||
|
|
||||||
def collect_weekly_reward(self):
|
def collect_weekly_reward(self):
|
||||||
self.update_weekly_challenge()
|
self.update_weekly_challenge()
|
||||||
|
@ -723,8 +723,9 @@ class TelegramBot:
|
|||||||
message = f"Full energy ({available}hp/{limit}hp +{interval}hp/6min)"
|
message = f"Full energy ({available}hp/{limit}hp +{interval}hp/6min)"
|
||||||
self.send_message(message)
|
self.send_message(message)
|
||||||
|
|
||||||
def report_medal(self, msg):
|
def report_medal(self, msg, multiple: bool=True):
|
||||||
self.send_message(f"New award: *{msg}*")
|
new_line = '\n' if multiple else ''
|
||||||
|
self.send_message(f"New award: {new_line}*{msg}*")
|
||||||
|
|
||||||
def __send_messages(self):
|
def __send_messages(self):
|
||||||
while self._next_time > utils.now():
|
while self._next_time > utils.now():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user