NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

sovStructureReinforced.py (2176B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\notifications\common\formatters\sovStructureReinforced.py
      2 from notifications.common.formatters.baseFormatter import BaseNotificationFormatter
      3 from notifications.common.formatters.sovBase import DECLOAK_TIME, SOLAR_SYSTEM_ID
      4 from entosis import entosisConst as entosisconst
      5 CAMPAIGN_EVENT_TYPE = 'campaignEventType'
      6 
      7 class SovStructureReinforced(BaseNotificationFormatter):
      8 
      9     def __init__(self, localizationInject = None):
     10         self.localization = self.GetLocalizationImpl(localizationInject)
     11         BaseNotificationFormatter.__init__(self, bodyLabel='Notifications/bodySovereigntyStructureReinforced')
     12 
     13     @staticmethod
     14     def MakeData(campaignType, solarSystemID, decloakTime):
     15         extraData = {DECLOAK_TIME: decloakTime,
     16          CAMPAIGN_EVENT_TYPE: campaignType,
     17          SOLAR_SYSTEM_ID: solarSystemID}
     18         return extraData
     19 
     20     def Format(self, notification):
     21         data = notification.data
     22         self._FormatSubject(data, notification)
     23         self._FormatBody(data, notification)
     24 
     25     def _FormatSubject(self, data, notification):
     26         subjectLabel = self._GetSubjectLabelByType(data[CAMPAIGN_EVENT_TYPE])
     27         notification.subject = self.localization.GetByLabel(subjectLabel, solarSystemID=data[SOLAR_SYSTEM_ID])
     28 
     29     def _FormatBody(self, data, notification):
     30         notification.body = self.localization.GetByLabel(self.bodyLabel, decloakTime=data[DECLOAK_TIME])
     31 
     32     @staticmethod
     33     def MakeSampleData(variant = 0):
     34         return SovStructureReinforced.MakeData(entosisconst.EVENT_TYPE_TCU_DEFENSE, 30004797, 130801371921935747L)
     35 
     36     def _GetSubjectLabelByType(self, campaignType):
     37         if campaignType == entosisconst.EVENT_TYPE_IHUB_DEFENSE:
     38             return 'Notifications/subjSovereigntyStructureReinforcedIHub'
     39         if campaignType in [entosisconst.EVENT_TYPE_STATION_DEFENSE, entosisconst.EVENT_TYPE_STATION_FREEPORT]:
     40             return 'Notifications/subjSovereigntyStructureReinforcedStation'
     41         if campaignType == entosisconst.EVENT_TYPE_TCU_DEFENSE:
     42             return 'Notifications/subjSovereigntyStructureReinforcedTCU'