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

attributes.py (3345B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\achievement_system\client\model\definition\contribution_method\parameter\attributes.py
      2 from achievement_system.client.api.error import UnsupportedTypeError
      3 from localization.client.cerberus_formatted_message import CerberusFormattedMessage
      4 from achievement_system.client.model.flatbuffer.generated import MethodParamDefinition as FlatbufferMethodParamDefinition
      5 from parameter_types.const import ParameterType
      6 if False:
      7     from typing import List
      8 
      9 class ContributionMethodParameterAttributes(object):
     10 
     11     def __init__(self, name_message, description_message, icon_id, param_type, accepted_value_types):
     12         self._name_message = name_message
     13         self._description_message = description_message
     14         self._icon_id = icon_id
     15         self._param_type = param_type
     16         self._accepted_value_types = accepted_value_types
     17 
     18     @property
     19     def name_message(self):
     20         return self._name_message
     21 
     22     @property
     23     def description_message(self):
     24         return self._description_message
     25 
     26     @property
     27     def icon_id(self):
     28         return self._icon_id
     29 
     30     @property
     31     def param_type(self):
     32         return self._param_type
     33 
     34     @property
     35     def accepted_value_types(self):
     36         return self._accepted_value_types
     37 
     38     @classmethod
     39     def from_flatbuffer(cls, fb_data):
     40         param_type = fb_data.Type()
     41         if param_type not in [ParameterType.INVENTORY_TYPE,
     42          ParameterType.LOCATION,
     43          ParameterType.SHIP_TYPE,
     44          ParameterType.MINEABLE_ORE_TYPE,
     45          ParameterType.MANUFACTURABLE_ITEM_TYPE,
     46          ParameterType.HARVESTABLE_GAS_TYPE,
     47          ParameterType.EMPIRE_FACTION,
     48          ParameterType.IDENTITY,
     49          ParameterType.FACTIONAL_WARFARE_COMPLEX_TYPE,
     50          ParameterType.NPC_CORPORATION,
     51          ParameterType.LP_NPC_CORPORATION,
     52          ParameterType.MIXED_HIERARCHY_INVENTORY,
     53          ParameterType.SECURITY_CLASS,
     54          ParameterType.ACHIEVEMENT,
     55          ParameterType.DUNGEON_ARCHETYPE,
     56          ParameterType.AGENT_DIVISION,
     57          ParameterType.AGENT_LEVEL,
     58          ParameterType.DUNGEON_TYPE,
     59          ParameterType.MISSION,
     60          ParameterType.STARGATE,
     61          ParameterType.CAMPAIGN_NAME]:
     62             raise UnsupportedTypeError
     63         return ContributionMethodParameterAttributes(name_message=CerberusFormattedMessage(identifier=fb_data.Name(), parameters={}), description_message=CerberusFormattedMessage(identifier=fb_data.Description(), parameters={}), icon_id=fb_data.IconId(), param_type=param_type, accepted_value_types=[ fb_data.AcceptedValueTypes(i) for i in range(fb_data.AcceptedValueTypesLength()) ])
     64 
     65     def __eq__(self, other):
     66         return self.name_message == other.name_message and self.description_message == other.description_message and self.icon_id == other.icon_id and self.param_type == other.param_type and self.accepted_value_types == other.accepted_value_types
     67 
     68     def __ne__(self, other):
     69         return not self.__eq__(other)
     70 
     71     def __str__(self):
     72         return 'name_message: %s\n' % self.name_message.get_localized_text() + 'description_message: %s\n' % self.description_message.get_localized_text() + 'icon_id: %s\n' % self.icon_id + 'param_type: %s\n' % self.param_type + 'accepted_value_types: %s\n' % self.accepted_value_types