Multiple achievements are joined under one notification - use achievementAmount for count

This commit is contained in:
Eriks Karls 2020-03-27 10:31:39 +02:00
parent 4b4ed18cdb
commit 1b5b5f736f
2 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@
__author__ = """Eriks Karls""" __author__ = """Eriks Karls"""
__email__ = 'eriks@72.lv' __email__ = 'eriks@72.lv'
__version__ = '0.20.0' __version__ = '0.20.0'
__commit_id__ = "d928ffc" __commit_id__ = "4b4ed18"
from erepublik import classes, utils from erepublik import classes, utils
from erepublik.citizen import Citizen from erepublik.citizen import Citizen

View File

@ -2128,6 +2128,7 @@ class Citizen(CitizenAnniversary, CitizenCompanies, CitizenEconomy, CitizenLeade
params: dict = medal.get('details', {}).get('achievement') params: dict = medal.get('details', {}).get('achievement')
about: str = medal.get('body') about: str = medal.get('body')
title: str = medal.get('title') title: str = medal.get('title')
count: int = medal.get('details', {}).get('achievementAmount', 1)
award_id: int = medal.get('id') award_id: int = medal.get('id')
if award_id and title and medal.get('details').get('isWallMaterial'): if award_id and title and medal.get('details').get('isWallMaterial'):
@ -2144,10 +2145,10 @@ class Citizen(CitizenAnniversary, CitizenCompanies, CitizenEconomy, CitizenLeade
currency = "Energy" currency = "Energy"
if (title, reward) not in data: if (title, reward) not in data:
data[(title, reward)] = {'about': about, 'kind': title, 'reward': reward, "count": 1, data[(title, reward)] = {'about': about, 'kind': title, 'reward': reward, "count": count,
"currency": currency, "params": params} "currency": currency, "params": params}
else: else:
data[(title, reward)]['count'] += 1 data[(title, reward)]['count'] += count
self._post_main_global_alerts_close(medal.get('id')) self._post_main_global_alerts_close(medal.get('id'))
if data: if data:
msgs = ["{count} x {kind}," msgs = ["{count} x {kind},"