Beispiel #1
0
	def read(self, raw, offset):
		self.data = dict()

		#int8_t age_entry_count;
		#int8_t building_connection_count;
		#int8_t unit_connection_count;
		#int8_t research_connection_count;
		header_struct = Struct(endianness + "4b")

		header = header_struct.unpack_from(raw, offset)
		offset_info(offset, header, "techtree: entries[age, building, unit, research]", header_struct)
		offset += header_struct.size

		self.data["age_entry_count"]      = header[0]
		self.data["building_connection_count"] = header[1]
		self.data["unit_connection_count"]     = header[2]
		self.data["research_connection_count"] = header[3]

		self.data["age_tech_tree"] = list()
		for i in range(self.data["age_entry_count"]):
			dbg("=== age_tech_tree %d" % i, 2)
			t = AgeTechTree()
			offset = t.read(raw, offset)
			self.data["age_tech_tree"] += [t.data]

		tmp_struct = Struct(endianness + "i")
		offset += tmp_struct.size

		self.data["building_connection"] = list()
		for i in range(self.data["building_connection_count"]):
			dbg("=== building_connection %d" % i, 2)
			t = BuildingConnection()
			offset = t.read(raw, offset)
			self.data["building_connection"] += [t.data]

		self.data["unit_connection"] = list()
		for i in range(self.data["unit_connection_count"]):
			dbg("=== unit_connection %d" % i, 2)
			t = UnitConnection()
			offset = t.read(raw, offset)
			self.data["unit_connection"] += [t.data]

		self.data["research_connection"] = list()
		for i in range(self.data["research_connection_count"]):
			dbg("=== research_connection %d" % i, 2)
			t = ResearchConnection()
			offset = t.read(raw, offset)
			self.data["research_connection"] += [t.data]

		return offset
Beispiel #2
0
	def read(self, raw, offset):
		self.data = dict()

		#int16_t type;
		#int16_t amount;
		hit_type_struct = Struct(endianness + "2h")

		pc = hit_type_struct.unpack_from(raw, offset)
		offset_info(offset, pc, ">=60 hittype", hit_type_struct, mode=1)
		offset += hit_type_struct.size

		self.data["type"]   = pc[0]
		self.data["amount"] = pc[1]

		return offset
Beispiel #3
0
	def read(self, raw, offset):
		self.data = dict()

		#int16_t unit_id;
		#float misplaced0;
		#float misplaced1;
		building_annex_struct = Struct(endianness + "h 2f")

		pc = building_annex_struct.unpack_from(raw, offset)
		offset_info(offset, pc, ">=80 b_annex", building_annex_struct, mode=1)
		offset += building_annex_struct.size

		self.data["unit_id"]    = pc[0]
		self.data["misplaced0"] = pc[1]
		self.data["misplaced1"] = pc[2]

		return offset
Beispiel #4
0
	def read(self, raw, offset):
		self.data = dict()

		#int16_t type;
		#int16_t amount;
		#int16_t enabled;
		ressource_cost_struct = Struct(endianness + "3h")

		pc = ressource_cost_struct.unpack_from(raw, offset)
		offset_info(offset, pc, ">=70 ressource cost", ressource_cost_struct, mode=1)
		offset += ressource_cost_struct.size

		self.data["type"]    = pc[0]
		self.data["amount"]  = pc[1]
		self.data["enabled"] = pc[2]

		return offset
Beispiel #5
0
	def read(self, raw, offset):
		self.data = dict()

		#int16_t a;
		#float b;
		#int8_t c;
		ressource_storage_struct = Struct(endianness + "h f b")

		pc = ressource_storage_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "ressource storage", ressource_storage_struct, mode=1)
		offset += ressource_storage_struct.size

		self.data["a"] = pc[0]
		self.data["b"] = pc[1]
		self.data["c"] = pc[2]

		return offset
Beispiel #6
0
	def read(self, raw, offset):
		self.data = dict()

		#int16_t graphic_id;
		#int8_t damage_percent;
		#int8_t unknown;
		#int8_t unknown;
		damage_graphic_struct = Struct(endianness + "h 3b")

		pc = damage_graphic_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "damage graphic", damage_graphic_struct, mode=1)
		offset += damage_graphic_struct.size

		self.data["graphic_id"]     = pc[0]
		check_file(pc[0])
		self.data["damage_percent"] = pc[1]
		#self.data[""] = pc[2]
		#self.data[""] = pc[3]

		return offset
Beispiel #7
0
	def read(self, raw, offset):
		self.data = dict()

		#int32_t id;
		#int8_t unknown;
		#int32_t upper_building;
		#int32_t required_researches;
		#int32_t age;
		#int32_t unit_or_research0;
		#int32_t unit_or_research1;
		#int32_t unknown[8];
		#int32_t mode0;
		#int32_t mode1;
		#int32_t unknown[7];
		#int32_t vertical_line;
		#int8_t unit_count;
		unit_connection_struct = Struct(endianness + "i b 5i 8i 2i 7i i b")

		pc = unit_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "uconnection: id X upperbuilding req_researches age ur0 ur1 X[8] mode0 mode1 X[7] verticalline unitcount", unit_connection_struct)
		offset += unit_connection_struct.size

		self.data["id"]                  = pc[0]
		#self.data[""] = pc[1]
		self.data["upper_building"]      = pc[2]
		self.data["required_researches"] = pc[3]
		self.data["age"]                 = pc[4]
		self.data["unit_or_research0"]   = pc[5]
		self.data["unit_or_research1"]   = pc[6]
		#self.data[""] = pc[7:(7+8)]
		self.data["mode0"]               = pc[15]
		self.data["mode1"]               = pc[16]
		#self.data[""] = pc[17:(17+7)]
		self.data["vertical_line"]       = pc[24]
		self.data["unit_count"]          = pc[25]

		#int32_t unit[unit_count];
		unit_connection_struct = Struct(endianness + "%di" % self.data["unit_count"])
		pc = unit_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "uconnection: unit", unit_connection_struct, 1)
		offset += unit_connection_struct.size

		self.data["unit"] = pc

		#int32_t location_in_age;
		#int32_t required_research;
		#int32_t line_mode;
		#int32_t enabling_research;
		unit_connection_struct = Struct(endianness + "4i")

		pc = unit_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "uconnection: locationinage requiredresearch linemode enablingresearch", unit_connection_struct)
		offset += unit_connection_struct.size

		self.data["location_in_age"]   = pc[0]
		self.data["required_research"] = pc[1]
		self.data["line_mode"]         = pc[2]
		self.data["enabling_research"] = pc[3]

		return offset
Beispiel #8
0
	def read(self, raw, offset):
		self.data = dict()

		#int32_t id;
		#int8_t unknown;
		#int32_t upper_building;
		#int8_t building_count;
		research_connection_struct = Struct(endianness + "i b i b")

		pc = research_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "rconnection: id X upperbuilding building_count", research_connection_struct)
		offset += research_connection_struct.size

		self.data["id"]                  = pc[0]
		#self.data[""] = pc[1]
		self.data["upper_building"]      = pc[2]
		self.data["building_count"]      = pc[3]

		#int32_t building[building_count];
		research_connection_struct = Struct(endianness + "%di" % self.data["building_count"])
		pc = research_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "rconnection: building", research_connection_struct, 1)
		offset += research_connection_struct.size
		self.data["building"] = pc

		#int8_t unit_count;
		research_connection_struct = Struct(endianness + "b")
		pc = research_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "rconnection: unit_count", research_connection_struct, 1)
		offset += research_connection_struct.size
		self.data["unit_count"] = pc[0]

		#int32_t unit[unit_count];
		research_connection_struct = Struct(endianness + "%di" % self.data["unit_count"])
		pc = research_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "rconnection: unit", research_connection_struct, 1)
		offset += research_connection_struct.size
		self.data["unit"] = pc

		#int8_t research_count;
		research_connection_struct = Struct(endianness + "b")
		pc = research_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "rconnection: research_count", research_connection_struct, 1)
		offset += research_connection_struct.size
		self.data["research_count"] = pc[0]

		#int32_t research[research_count];
		research_connection_struct = Struct(endianness + "%di" % self.data["research_count"])
		pc = research_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "rconnection: research", research_connection_struct, 1)
		offset += research_connection_struct.size
		self.data["research"] = pc

		#int32_t required_research;
		#int32_t age;
		#int32_t upper_research;
		#int32_t unknown[9];
		#int32_t line_mode;
		#int32_t unknown[8];
		#int32_t vertical_line;
		#int32_t location_in_age;
		#int32_t unknown;
		research_connection_struct = Struct(endianness + "3i 9i i 8i 3i")
		pc = research_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "rconnection: requiredresearch age upperresearch X[9] linemode X[8] vericalline locationinage X", research_connection_struct)
		offset += research_connection_struct.size

		self.data["required_research"] = pc[0]
		self.data["age"] = pc[1]
		self.data["upper_research"] = pc[2]
		#self.data[""] = pc[3:(3+9)]
		self.data["line_mode"] = pc[12]
		#self.data[""] = pc[13:(13+8)]
		self.data["vertical_line"] = pc[21]
		self.data["location_in_age"] = pc[22]
		#self.data[""] = pc[23]

		return offset
Beispiel #9
0
	def read(self, raw, offset):
		self.data = dict()

		#int32_t id;
		#int8_t unknown;
		#int8_t building_count;
		building_connection_struct = Struct(endianness + "i 2b")

		pc = building_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "bconnection: id X building_count", building_connection_struct, 1)
		offset += building_connection_struct.size

		self.data["id"]             = pc[0]
		#self.data[""] = pc[1]
		self.data["building_count"] = pc[2]

		#int32_t building[building_count];
		building_connection_struct = Struct(endianness + "%di" % self.data["building_count"])
		pc = building_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "bconnection: buildings", building_connection_struct, 1)
		offset += building_connection_struct.size
		self.data["building"] = pc

		#int8_t unit_count;
		building_connection_struct = Struct(endianness + "b")
		pc = building_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "bconnection: unit_count", building_connection_struct, 1)
		offset += building_connection_struct.size
		self.data["unit_count"] = pc[0]

		#int32_t unit[unit_count];
		building_connection_struct = Struct(endianness + "%di" % self.data["unit_count"])
		pc = building_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "bconnection: unit", building_connection_struct, 1)
		offset += building_connection_struct.size
		self.data["unit"] = pc

		#int8_t research_count;
		building_connection_struct = Struct(endianness + "b")
		pc = building_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "bconnection: research_count", building_connection_struct, 1)
		offset += building_connection_struct.size
		self.data["research_count"] = pc[0]

		#int32_t research[research_count];
		building_connection_struct = Struct(endianness + "%di" % self.data["research_count"])
		pc = building_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "bconnection: research", building_connection_struct, 1)
		offset += building_connection_struct.size
		self.data["research"] = pc

		#int32_t age;
		#int32_t unit_or_research0;
		#int32_t unit_or_research1;
		#int32_t unknown[8];
		#int32_t mode0;
		#int32_t mode1;
		#int32_t unknown[7];
		#int8_t unknown[11];
		#int32_t connection;
		#int32_t enabling_research;
		building_connection_struct = Struct(endianness + "3i 8i 2i 7i xxxx 11b 2i")

		pc = building_connection_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "bconnection: age ur0 ur1 X[8] mode0 mode1 X[18] connection enablingresearch", building_connection_struct)
		offset += building_connection_struct.size

		self.data["age"]               = pc[0]
		self.data["unit_or_research0"] = pc[1]
		self.data["unit_or_research1"] = pc[2]
		#self.data[""] = pc[3:(3+8)]
		self.data["mode0"]             = pc[11]
		self.data["mode1"]             = pc[12]
		#self.data[""] = pc[13:(13+7)]
		#self.data[""] = pc[20:(20+11)]
		self.data["connection"]        = pc[31]
		self.data["enabling_research"] = pc[32]

		return offset
Beispiel #10
0
	def read(self, raw, offset):
		self.data = dict()

		#int32_t unknown;
		#int32_t id;
		#int8_t unknown;
		#int8_t building_count;
		age_tech_tree_struct = Struct(endianness + "2i 2b")

		pc = age_tech_tree_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "techtree: X id X buildingcount", age_tech_tree_struct, 1)
		offset += age_tech_tree_struct.size

		#self.data[""] = pc[0]
		self.data["id"]             = pc[1]
		#self.data[""] = pc[2]
		self.data["building_count"] = pc[3]

		#int32_t building[building_count];
		age_tech_tree_struct = Struct(endianness + "%di" % self.data["building_count"])
		pc = age_tech_tree_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "techtree: building", age_tech_tree_struct, 1)
		offset += age_tech_tree_struct.size
		self.data["building"] = pc

		#int8_t unit_count;
		age_tech_tree_struct = Struct(endianness + "b")
		pc = age_tech_tree_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "techtree: unitcount", age_tech_tree_struct, 1)
		offset += age_tech_tree_struct.size
		self.data["unit_count"] = pc[0]

		#int32_t unit[unit_count];
		age_tech_tree_struct = Struct(endianness + "%di" % self.data["unit_count"])
		pc = age_tech_tree_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "techtree: unit", age_tech_tree_struct, 1)
		offset += age_tech_tree_struct.size
		self.data["unit"] = pc

		#int8_t research_count;
		age_tech_tree_struct = Struct(endianness + "b")
		pc = age_tech_tree_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "techtree: researchcount", age_tech_tree_struct, 1)
		offset += age_tech_tree_struct.size
		self.data["research_count"] = pc[0]

		#int32_t research[research_count];
		age_tech_tree_struct = Struct(endianness + "%di" % self.data["research_count"])
		pc = age_tech_tree_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "techtree: research", age_tech_tree_struct, 1)
		offset += age_tech_tree_struct.size
		self.data["research"] = pc

		#int32_t unknown;
		#int32_t unknown;
		#int16_t zeroes[49];
		age_tech_tree_struct = Struct(endianness + "2i 49h")

		pc = age_tech_tree_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "techtree: X X zeroes", age_tech_tree_struct)
		offset += age_tech_tree_struct.size

		#self.data[""] = pc[0]
		#self.data[""] = pc[1]
		#self.data[""] = pc[2:(2+49)]

		return offset
Beispiel #11
0
	def read(self, raw, offset):
		self.data = dict()

		#unit type==:
		#object = 10
		#flag = 20
		#dead_fish = 30
		#bird = 40
		#projectile = 60
		#creatable = 70
		#building = 80
		#tree = 90

		#int8_t type;
		#uint16_t name_length;
		#int16_t id0;
		#uint16_t language_dll_name;
		#uint16_t language_dll_creation;
		#int16_t unit_class;
		#int16_t graphic_standing0;
		#int16_t graphic_standing1;
		#int16_t graphic_dying0;
		#int16_t graphic_dying1;
		#int8_t death_mode;
		#int16_t hit_points;
		#float line_of_sight;
		#int8_t garnison_capacity;
		#float radius_size0;
		#float radius_size1;
		#float hp_bar_height0;
		#int16_t sound_train0;
		#int16_t sound_train1;
		#int16_t dead_unit_id;
		#int8_t placement_mode;
		#int8_t air_mode;
		#int16_t icon_id;
		#int8_t hidden_in_editor;
		#int16_t unknown;
		#int16_t enabled;
		#int16_t placement_by_pass_terrain0;
		#int16_t placement_by_pass_terrain1;
		#int16_t placement_terrain0;
		#int16_t placement_terrain1;
		#float editor_radius0;
		#float editor_radius1;
		#int8_t building_mode;
		#int8_t visible_in_fog;
		#int16_t terrain_restriction;
		#int8_t fly_mode;
		#int16_t ressource_capacity;
		#float ressource_decay;
		#int8_t blast_type;
		#int8_t unknown;
		#int8_t interaction_mode;
		#int8_t minimap_mode;
		#int16_t command_attribute;
		#int16_t unknown;
		#int16_t unknown;
		#uint16_t language_dll_help;
		#int16_t[4] hot_keys;
		#int8_t unknown;
		#int8_t unknown;
		#bool unselectable;
		#int8_t unknown;
		#int8_t unknown;
		#int8_t unknown;
		#int8_t selection_mask;
		#int8_t selection_shape_type;
		#int8_t selection_shape;
		#int8_t attribute;
		#int8_t civilisation;
		#int16_t unknown;
		#int8_t selection_effect;
		#uint8_t editor_selection_color;
		#float selection_radius0;
		#float selection_radius1;
		#float hp_bar_height1;
		unit0_struct = Struct(endianness + "b H h 2H 5h b h f b 3f 3h 2b h b 6h 2f 2b h b h f 4b 3h H 4h 2b ? 8b h b B 3f")

		pc = unit0_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "unit header0", unit0_struct)
		offset += unit0_struct.size


		self.data["type"]                       = pc[0]
		self.data["name_length"]                = pc[1]

		if self.data["name_length"] > 100:
			raise Exception("name is longer than 100, very unlikely: %d" % self.data["name_length"])

		self.data["id0"]                        = pc[2]
		self.data["language_dll_name"]          = pc[3]
		self.data["language_dll_creation"]      = pc[4]
		self.data["unit_class"]                 = pc[5]
		self.data["graphic_standing0"]          = pc[6]
		check_file(pc[6])
		self.data["graphic_standing1"]          = pc[7]
		check_file(pc[7])
		self.data["graphic_dying0"]             = pc[8]
		self.data["graphic_dying1"]             = pc[9]
		self.data["death_mode"]                 = pc[10]
		self.data["hit_points"]                 = pc[11]
		self.data["line_of_sight"]              = pc[12]
		self.data["garnison_capacity"]          = pc[13]
		self.data["radius_size0"]               = pc[14]
		self.data["radius_size1"]               = pc[15]
		self.data["hp_bar_height0"]             = pc[16]
		self.data["sound_train0"]               = pc[17]
		check_file(pc[17])
		self.data["sound_train1"]               = pc[18]
		check_file(pc[18])
		self.data["dead_unit_id"]               = pc[19]
		self.data["placement_mode"]             = pc[20]
		self.data["air_mode"]                   = pc[21]
		self.data["icon_id"]                    = pc[22]
		self.data["hidden_in_editor"]           = pc[23]
		#self.data[""] = pc[24]
		self.data["enabled"]                    = pc[25]
		self.data["placement_by_pass_terrain0"] = pc[26]
		self.data["placement_by_pass_terrain1"] = pc[27]
		self.data["placement_terrain0"]         = pc[28]
		self.data["placement_terrain1"]         = pc[29]
		self.data["editor_radius0"]             = pc[30]
		self.data["editor_radius1"]             = pc[31]
		self.data["building_mode"]              = pc[32]
		self.data["visible_in_fog"]             = pc[33]
		self.data["terrain_restriction"]        = pc[34]
		self.data["fly_mode"]                   = pc[35]
		self.data["ressource_capacity"]         = pc[36]
		self.data["ressource_decay"]            = pc[37]
		self.data["blast_type"]                 = pc[38]
		#self.data[""] = pc[39]
		self.data["interaction_mode"]           = pc[40]
		self.data["minimap_mode"]               = pc[41]
		self.data["command_attribute"]          = pc[42]
		#self.data[""] = pc[43]
		#self.data[""] = pc[44]
		self.data["language_dll_help"]          = pc[45]
		self.data["hot_keys"]                   = pc[46:(46+4)]
		#self.data[""] = pc[50]
		#self.data[""] = pc[51]
		self.data["unselectable"]               = pc[52]
		#self.data[""] = pc[53]
		#self.data[""] = pc[54]
		#self.data[""] = pc[55]
		self.data["selection_mask"]             = pc[56]
		self.data["selection_shape_type"]       = pc[57]
		self.data["selection_shape"]            = pc[58]
		self.data["attribute"]                  = pc[59]
		self.data["civilisation"]               = pc[60]
		#self.data[""] = pc[61]
		self.data["selection_effect"]           = pc[61]
		self.data["editor_selection_color"]     = pc[62]
		self.data["selection_radius0"]          = pc[63]
		self.data["selection_radius1"]          = pc[64]
		self.data["hp_bar_height1"]             = pc[65]


		self.data["ressource_storage"] = list()
		for i in range(3):
			t = RessourceStorage()
			offset = t.read(raw, offset)
			self.data["ressource_storage"] += [t.data]

		#int8_t damage_graphic_count
		unit1_struct = Struct(endianness + "b")

		pc = unit1_struct.unpack_from(raw, offset)
		offset += unit1_struct.size

		self.data["damage_graphic_count"], = pc

		self.data["damage_graphic"] = list()
		for i in range(self.data["damage_graphic_count"]):
			t = DamageGraphic()
			offset = t.read(raw, offset)
			self.data["damage_graphic"] += [t.data]


		#int16_t selection_sound;
		#int16_t dying_sound;
		#int16_t attack_sound;
		#char name[name_length];
		#int16_t id1;
		#int16_t id2;
		unit2_struct = Struct(endianness + "3h %ds 2h" % self.data["name_length"])

		pc = unit2_struct.unpack_from(raw, offset)
		offset_info(offset, pc, "unit header 2", unit2_struct)
		offset += unit2_struct.size


		self.data["sound_selection"] = pc[0]
		check_file(pc[0])
		self.data["sound_dying"]     = pc[1]
		check_file(pc[1])
		self.data["sound_attack"]    = pc[2]
		check_file(pc[2])
		self.data["name"]            = zstr(pc[3])
		self.data["id1"]             = pc[4]
		self.data["id2"]             = pc[5]


		dbg("unit type = %d\nname = %s" % (self.data["type"], self.data["name"]), 2)

		#every thing else only exists for non-trees (!= 90)
		#and things with id >= 20
		if self.data["type"] != 90 and self.data["type"] >= 20:
			#float speed;
			tmp_struct = Struct(endianness + "f")
			pc = tmp_struct.unpack_from(raw, offset)
			offset_info(offset, pc, ">=20 SPEED", tmp_struct)
			offset += tmp_struct.size

			self.data["speed"], = pc

			if math.isnan(self.data["speed"]):
				raise Exception("Speed is NaN!")

			dbg("speed:" + str(pc), 2)


			if self.data["type"] >= 30:
				#int16_t walking_graphics0;
				#int16_t walking_graphics1;
				#float rotation_speed;
				#int8_t unknown;
				#int16_t tracking_unit;
				#bool tracking_unit_used;
				#float tracking_unit_density;
				#float unknown;
				#int8_t unknown[17];
				tmp_struct = Struct(endianness + "2h f b h ? 2f 17b")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, ">=30", tmp_struct)
				offset += tmp_struct.size

				self.data["walking_graphics0"]     = pc[0]
				check_file(pc[0])
				self.data["walking_graphics1"]     = pc[1]
				check_file(pc[1])
				self.data["rotation_speed"]        = pc[2]
				#self.data[""] = pc[2]
				self.data["tracking_unit"]         = pc[3]
				self.data["tracking_unit_used"]    = pc[4]
				self.data["tracking_unit_density"] = pc[5]
				#self.data[""] = pc[6]
				#self.data[""] = pc[7:(7+17)]


			if self.data["type"] >= 40:
				#int16_t sheep_conversion;
				#float search_radius;
				#float work_rate;
				#int16_t drop_site0;
				#int16_t drop_site1;
				#int8_t villager_mode;
				#int16_t move_sound;
				#int16_t stop_sound;
				#int8_t animal_mode;
				tmp_struct = Struct(endianness + "h 2f 2h b 2h b")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, ">=40", tmp_struct)
				offset += tmp_struct.size


				self.data["sheep_conversion"] = pc[0]
				self.data["search_radius"]    = pc[1]
				self.data["work_rate"]        = pc[2]
				self.data["drop_site0"]       = pc[3]
				self.data["drop_site1"]       = pc[4]
				self.data["villager_mode"]    = pc[5]
				self.data["move_sound"]       = pc[6]
				check_file(pc[6])
				self.data["stop_sound"]       = pc[7]
				check_file(pc[7])
				self.data["animal_mode"]      = pc[8]


			if self.data["type"] >= 60:
				#int8_t unknown;
				#int8_t unknown;
				tmp_struct = Struct(endianness + "2b")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, ">=60 header0", tmp_struct)
				offset += tmp_struct.size

				#self.data[""] = pc[0]
				#self.data[""] = pc[1]

				#uint16_t attack_count;
				tmp_struct = Struct(endianness + "H")
				pc = tmp_struct.unpack_from(raw, offset)
				offset += tmp_struct.size

				self.data["attack_count"] = pc[0]

				self.data["attack"] = list()
				for i in range(self.data["attack_count"]):
					t = HitType()
					offset_tmp = t.read(raw, offset)
					self.data["attack"] += [t.data]
					offset = offset_tmp

				#uint16_t armor_count;
				tmp_struct = Struct(endianness + "H")
				pc = tmp_struct.unpack_from(raw, offset)
				offset += tmp_struct.size

				self.data["armor_count"] = pc[0]

				self.data["armor"] = list()
				for i in range(self.data["armor_count"]):
					t = HitType()
					offset_tmp = t.read(raw, offset)
					self.data["armor"] += [t.data]
					offset = offset_tmp

				#int16_t unknown;
				#float max_range;
				#float blast_radius;
				#float reload_time0;
				#int16_t projectile_unit_id;
				#int16_t accuracy_percent;
				#int8_t tower_mode;
				#int16_t delay;
				#float graphics_displacement[3];
				#int8_t unknown;
				#float min_range;
				#float garnison_recovery_rate;
				#int16_t attack_graphic;
				#int16_t melee_armor_displayed;
				#int16_t attack_displayed;
				#int16_t range_displayed;
				#float reload_time1;
				tmp_struct = Struct(endianness + "h 3f 2h b h 3f b 2f 4h xx f")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, ">=60 data", tmp_struct)
				offset += tmp_struct.size - 2


				#self.data[""] = pc[0]
				self.data["max_range"]              = pc[1]
				self.data["blast_radius"]           = pc[2]
				self.data["reload_time0"]           = pc[3]
				self.data["projectile_unit_id"]     = pc[4]
				self.data["accuracy_percent"]       = pc[5]
				self.data["tower_mode"]             = pc[6]
				self.data["delay"]                  = pc[7]
				self.data["graphics_displacement"]  = pc[8:(8+3)]

				#self.data[""] = pc[11]
				self.data["min_range"]              = pc[12]
				self.data["garnison_recovery_rate"] = pc[13]
				self.data["attack_graphic"]         = pc[14]
				self.data["melee_armor_displayed"]  = pc[15]
				self.data["attack_displayed"]       = pc[16]
				self.data["range_displayed"]        = pc[17]
				self.data["reload_time1"]           = pc[18]


			if self.data["type"] == 60:

				#int8_t stretch_mode;
				#int8_t compensation_mode;
				#int8_t drop_animation_mode;
				#int8_t penetration_mode;
				#int8_t unknown;
				#float projectile_arc;
				tmp_struct = Struct(endianness + "5b x x f")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, "==60", tmp_struct)
				offset += tmp_struct.size

				self.data["stretch_mode"]        = pc[0]
				self.data["compensation_mode"]   = pc[1]
				self.data["drop_animation_mode"] = pc[2]
				self.data["penetration_mode"]    = pc[3]
				#self.data[""] = pc[4]
				self.data["projectile_arc"]      = pc[5]


			if self.data["type"] >= 70:
				self.data["ressource_cost"] = list()
				for i in range(3):
					t = RessourceCost()
					offset = t.read(raw, offset)
					self.data["ressource_cost"] += [t.data]

				#int16_t train_time;
				#int16_t train_location_id;
				#int8_t button_id;
				#int32_t unknown;
				#int32_t unknown;
				#int8_t missile_graphic_delay;
				#int8_t hero_mode;
				#int16_t garnison_graphic0;
				#int16_t garnison_graphic1;
				#float attack_missile_duplication0;
				#int8_t attack_missile_duplication1;
				#float attack_missile_duplication_spawning[3];
				#int32_t attack_missile_duplication_unit;
				#int32_t attack_missile_duplication_graphic;
				#int8_t unknown;
				#int16_t pierce_armor_displayed;
				tmp_struct = Struct(endianness + "2h b 2i 2b 2h xx f b 3f 2i b h")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, ">=70", tmp_struct)
				offset += tmp_struct.size


				self.data["train_time"]                          = pc[0]
				self.data["train_location_id"]                   = pc[1]
				self.data["button_id"]                           = pc[2]
				#self.data[""] = pc[3]
				#self.data[""] = pc[4]
				self.data["missile_graphic_delay"]               = pc[5]
				self.data["hero_mode"]                           = pc[6]
				self.data["garnison_graphic0"]                   = pc[7]
				self.data["garnison_graphic1"]                   = pc[8]
				self.data["attack_missile_duplication0"]         = pc[9]
				self.data["attack_missile_duplication1"]         = pc[10]
				self.data["attack_missile_duplication_spawning"] = pc[11:(11+3)]
				self.data["attack_missile_duplication_unit"]     = pc[14]
				self.data["attack_missile_duplication_graphic"]  = pc[15]
				#self.data[""] = pc[16]
				self.data["pierce_armor_displayed"]              = pc[17]

				#raise Exception()


			if self.data["type"] >= 80:
				#int16_t construction_graphic_id;
				#int16_t snow_graphic_id;
				#int16_t adjacent_mode;
				#int8_t unknown;
				#int8_t unknown;
				#int16_t stack_unit_id;
				#int16_t terrain_id;
				#int16_t unknown;
				#int16_t research_id;
				#int8_t unknown;
				tmp_struct = Struct(endianness + "3h 2b 4h b")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, ">=80 header 0", tmp_struct)
				offset += tmp_struct.size

				self.data["construction_graphic_id"] = pc[0]
				check_file(pc[0])
				self.data["snow_graphic_id"]         = pc[1]
				check_file(pc[1])
				self.data["adjacent_mode"]           = pc[2]
				#self.data[""] = pc[3]
				#self.data[""] = pc[4]
				self.data["stack_unit_id"]           = pc[5]
				self.data["terrain_id"]              = pc[6]
				#self.data[""] = pc[7]
				#self.data["research_id"]             = pc[8]
				#self.data[""] = pc[9]

				self.data["building_annex"] = list()
				for i in range(4):
					t = BuildingAnnex()
					offset_tmp = t.read(raw, offset)
					offset = offset_tmp

					self.data["building_annex"] += [t.data]

				#int16_t head_unit;
				#int16_t transform_unit;
				#int16_t unknown;
				#int16_t construction_sound_id;
				#int8_t garnison_type;
				#float garnison_heal_rate;
				#int32_t unknown;
				#int16_t unknown;
				#int8_t unknown[6];
				tmp_struct = Struct(endianness + "4h b f i h 6b")
				pc = tmp_struct.unpack_from(raw, offset)
				offset_info(offset, pc, ">=80 header 1", tmp_struct)
				offset += tmp_struct.size

				self.data["head_unit"] = pc[0]
				self.data["transform_unit"] = pc[1]
				#self.data[""] = pc[2]
				self.data["construction_sound_id"] = pc[3]
				check_file(pc[3])
				self.data["garnison_type"] = pc[4]
				self.data["garnison_heal_rate"] = pc[5]
				#self.data[""] = pc[6]
				#self.data[""] = pc[7]
				#self.data[""] = pc[8:(8+6)]

		return offset