1# Copyright 2013-2017 the openage authors. See copying.md for legal info. 2 3# TODO pylint: disable=C,R 4 5from ..dataformat.exportable import Exportable 6from ..dataformat.members import SubdataMember 7from ..dataformat.member_access import READ 8 9 10class ResearchResourceCost(Exportable): 11 name_struct = "research_resource_cost" 12 name_struct_file = "research" 13 struct_description = "amount definition for a single type resource for researches." 14 15 data_format = [ 16 (READ, "resource_id", "int16_t"), # see unit/resource_cost, TODO: type xref 17 (READ, "amount", "int16_t"), 18 (READ, "enabled", "int8_t"), 19 ] 20 21 22class Research(Exportable): 23 name_struct = "research" 24 name_struct_file = "research" 25 struct_description = "one researchable technology." 26 27 data_format = [ 28 (READ, "required_techs", "int16_t[6]"), # research ids of techs that are required for activating the possible research 29 (READ, "research_resource_costs", SubdataMember( 30 ref_type=ResearchResourceCost, 31 length=3, 32 )), 33 (READ, "required_tech_count", "int16_t"), # a subset of the above required techs may be sufficient, this defines the minimum amount 34 ] 35 36 # TODO: Enable conversion for AOE1; replace "civilisation_id", "full_tech_mode" 37 # =========================================================================== 38 # if (GameVersion.aoe_1 or GameVersion.aoe_ror) not in game_versions: 39 # data_format.extend([ 40 # (READ, "civilisation_id", "int16_t"), # id of the civ that gets this technology 41 # (READ, "full_tech_mode", "int16_t"), # 1: research is available when the full tech tree is activated on game start, 0: not 42 # ]) 43 # =========================================================================== 44 data_format.extend([ 45 (READ, "civilisation_id", "int16_t"), # id of the civ that gets this technology 46 (READ, "full_tech_mode", "int16_t"), # 1: research is available when the full tech tree is activated on game start, 0: not 47 ]) 48 49 data_format.extend([ 50 (READ, "research_location_id", "int16_t"), # unit id, where the tech will appear to be researched 51 (READ, "language_dll_name", "uint16_t"), 52 (READ, "language_dll_description", "uint16_t"), 53 (READ, "research_time", "int16_t"), # time in seconds that are needed to finish this research 54 (READ, "tech_effect_id", "int16_t"), # techage id that actually contains the research effect information 55 (READ, "tech_type", "int16_t"), # 0: research is not dependant on current age, 2: implied by new age 56 (READ, "icon_id", "int16_t"), # frame id - 1 in icon slp (57029) 57 (READ, "button_id", "int8_t"), # button id as defined in the unit.py button matrix 58 (READ, "language_dll_help", "int32_t"), # 100000 + the language file id for the name/description 59 (READ, "language_dll_techtree", "int32_t"), # 149000 + lang_dll_description 60 (READ, "hotkey", "int32_t"), # -1 for every tech 61 (READ, "name_length", "uint16_t"), 62 (READ, "name", "char[name_length]"), 63 ]) 64 65 # TODO: Enable conversion for SWGB 66 # =========================================================================== 67 # if (GameVersion.swgb_10 or GameVersion.swgb_cc) in game_versions: 68 # data_format.extend([ 69 # (READ, "name2_length", "uint16_t"), 70 # (READ, "name2", "char[name2_length]"), 71 # ]) 72 # =========================================================================== 73