shipSkinLicenseNoticeMessenger.py (2035B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\cosmetics\client\messengers\cosmetics\ship\shipSkinLicenseNoticeMessenger.py 2 import logging 3 from cosmetics.client.ships.ship_skin_svc_signals import * 4 from cosmetics.client.ships.skins.live_data.skin_license import SkinLicense 5 from eveProto.generated.eve_public.cosmetic.ship.skin.thirdparty.license.api.notices_pb2 import AddedNotice, UpdatedNotice, DeletedNotice 6 logger = logging.getLogger(__name__) 7 8 class PublicShipSkinLicenseNoticeMessenger(object): 9 public_gateway = None 10 11 def __init__(self, public_gateway): 12 self.public_gateway = public_gateway 13 self.public_gateway.subscribe_to_notice(AddedNotice, self._on_license_added_notice) 14 self.public_gateway.subscribe_to_notice(UpdatedNotice, self._on_license_updated_notice) 15 self.public_gateway.subscribe_to_notice(DeletedNotice, self._on_license_deleted_notice) 16 17 def _on_license_added_notice(self, notice_payload, _notice_primitive): 18 skin_hex = notice_payload.id.skin.hex 19 character_id = notice_payload.id.character.sequential 20 license_data = SkinLicense.build_from_proto(notice_payload.attributes, skin_hex, character_id) 21 on_skin_license_added_internal(skin_hex, license_data) 22 23 def _on_license_updated_notice(self, notice_payload, _notice_primitive): 24 skin_hex = notice_payload.id.skin.hex 25 character_id = notice_payload.id.character.sequential 26 license_data = SkinLicense.build_from_proto(notice_payload.attributes, skin_hex, character_id) 27 previous_license_data = SkinLicense.build_from_proto(notice_payload.previous_attributes, skin_hex, character_id) 28 on_skin_license_updated_internal(skin_hex, license_data, previous_license_data) 29 30 def _on_license_deleted_notice(self, notice_payload, _notice_primitive): 31 skin_hex = notice_payload.id.skin.hex 32 character_id = notice_payload.id.character.sequential 33 on_skin_license_deleted_internal(skin_hex, character_id)