diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/extractor_common/ExtractorDB2LoadInfo.h | 178 | ||||
-rw-r--r-- | src/tools/map_extractor/System.cpp | 130 | ||||
-rw-r--r-- | src/tools/vmap4_extractor/gameobject_extract.cpp | 28 | ||||
-rw-r--r-- | src/tools/vmap4_extractor/vmapexport.cpp | 41 |
4 files changed, 182 insertions, 195 deletions
diff --git a/src/tools/extractor_common/ExtractorDB2LoadInfo.h b/src/tools/extractor_common/ExtractorDB2LoadInfo.h new file mode 100644 index 00000000000..c088ac663ec --- /dev/null +++ b/src/tools/extractor_common/ExtractorDB2LoadInfo.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ExtractorDB2LoadInfo_h__ +#define ExtractorDB2LoadInfo_h__ + +#include "DB2FileLoader.h" +#include "DB2Meta.h" +#include <array> + +struct CinematicCameraLoadInfo +{ + static DB2FileLoadInfo const* Instance() + { + static DB2FieldMeta const fields[] = + { + { false, FT_INT, "ID" }, + { false, FT_INT, "SoundID" }, + { false, FT_FLOAT, "OriginX" }, + { false, FT_FLOAT, "OriginY" }, + { false, FT_FLOAT, "OriginZ" }, + { false, FT_FLOAT, "OriginFacing" }, + { false, FT_INT, "FileDataID" }, + }; + static char const* types = "iffi"; + static uint8 const arraySizes[4] = { 1, 3, 1, 1 }; + static DB2Meta const meta(-1, 4, 0x0062B0F4, types, arraySizes, -1); + static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + return &loadInfo; + } +}; + +struct GameobjectDisplayInfoLoadInfo +{ + static DB2FileLoadInfo const* Instance() + { + static DB2FieldMeta const fields[] = + { + { false, FT_INT, "ID" }, + { true, FT_INT, "FileDataID" }, + { false, FT_FLOAT, "GeoBoxMinX" }, + { false, FT_FLOAT, "GeoBoxMinY" }, + { false, FT_FLOAT, "GeoBoxMinZ" }, + { false, FT_FLOAT, "GeoBoxMaxX" }, + { false, FT_FLOAT, "GeoBoxMaxY" }, + { false, FT_FLOAT, "GeoBoxMaxZ" }, + { false, FT_FLOAT, "OverrideLootEffectScale" }, + { false, FT_FLOAT, "OverrideNameScale" }, + { true, FT_SHORT, "ObjectEffectPackageID" }, + }; + static char const* types = "ifffh"; + static uint8 const arraySizes[5] = { 1, 6, 1, 1, 1 }; + static DB2Meta const meta(-1, 5, 0x9F2098D1, types, arraySizes, -1); + static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + return &loadInfo; + } +}; + +struct LiquidTypeLoadInfo +{ + static DB2FileLoadInfo const* Instance() + { + static DB2FieldMeta const fields[] = + { + { false, FT_INT, "ID" }, + { false, FT_STRING_NOT_LOCALIZED, "Name" }, + { false, FT_STRING_NOT_LOCALIZED, "Texture1" }, + { false, FT_STRING_NOT_LOCALIZED, "Texture2" }, + { false, FT_STRING_NOT_LOCALIZED, "Texture3" }, + { false, FT_STRING_NOT_LOCALIZED, "Texture4" }, + { false, FT_STRING_NOT_LOCALIZED, "Texture5" }, + { false, FT_STRING_NOT_LOCALIZED, "Texture6" }, + { false, FT_INT, "SpellID" }, + { false, FT_FLOAT, "MaxDarkenDepth" }, + { false, FT_FLOAT, "FogDarkenIntensity" }, + { false, FT_FLOAT, "AmbDarkenIntensity" }, + { false, FT_FLOAT, "DirDarkenIntensity" }, + { false, FT_FLOAT, "ParticleScale" }, + { true, FT_INT, "Color1" }, + { true, FT_INT, "Color2" }, + { false, FT_FLOAT, "Float1" }, + { false, FT_FLOAT, "Float2" }, + { false, FT_FLOAT, "Float3" }, + { false, FT_FLOAT, "Float4" }, + { false, FT_FLOAT, "Float5" }, + { false, FT_FLOAT, "Float6" }, + { false, FT_FLOAT, "Float7" }, + { false, FT_FLOAT, "Float8" }, + { false, FT_FLOAT, "Float9" }, + { false, FT_FLOAT, "Float10" }, + { false, FT_FLOAT, "Float11" }, + { false, FT_FLOAT, "Float12" }, + { false, FT_FLOAT, "Float13" }, + { false, FT_FLOAT, "Float14" }, + { false, FT_FLOAT, "Float15" }, + { false, FT_FLOAT, "Float16" }, + { false, FT_FLOAT, "Float17" }, + { false, FT_FLOAT, "Float18" }, + { false, FT_INT, "Int1" }, + { false, FT_INT, "Int2" }, + { false, FT_INT, "Int3" }, + { false, FT_INT, "Int4" }, + { false, FT_SHORT, "Flags" }, + { false, FT_SHORT, "LightID" }, + { false, FT_BYTE, "SoundBank" }, + { false, FT_BYTE, "ParticleMovement" }, + { false, FT_BYTE, "ParticleTexSlots" }, + { false, FT_BYTE, "MaterialID" }, + { false, FT_BYTE, "FrameCountTexture1" }, + { false, FT_BYTE, "FrameCountTexture2" }, + { false, FT_BYTE, "FrameCountTexture3" }, + { false, FT_BYTE, "FrameCountTexture4" }, + { false, FT_BYTE, "FrameCountTexture5" }, + { false, FT_BYTE, "FrameCountTexture6" }, + { false, FT_INT, "SoundID" }, + }; + static char const* types = "ssifffffifihhbbbbbi"; + static uint8 const arraySizes[19] = { 1, 6, 1, 1, 1, 1, 1, 1, 2, 18, 4, 1, 1, 1, 1, 1, 1, 6, 1 }; + static DB2Meta const meta(-1, 19, 0x3313BBF3, types, arraySizes, -1); + static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + return &loadInfo; + } +}; + +struct MapLoadInfo +{ + static DB2FileLoadInfo const* Instance() + { + static DB2FieldMeta const fields[] = + { + { false, FT_INT, "ID" }, + { false, FT_STRING_NOT_LOCALIZED, "Directory" }, + { false, FT_STRING, "MapName" }, + { false, FT_STRING, "MapDescription0" }, + { false, FT_STRING, "MapDescription1" }, + { false, FT_STRING, "PvpShortDescription" }, + { false, FT_STRING, "PvpLongDescription" }, + { true, FT_INT, "Flags1" }, + { true, FT_INT, "Flags2" }, + { false, FT_FLOAT, "MinimapIconScale" }, + { false, FT_FLOAT, "CorpseX" }, + { false, FT_FLOAT, "CorpseY" }, + { false, FT_SHORT, "AreaTableID" }, + { true, FT_SHORT, "LoadingScreenID" }, + { true, FT_SHORT, "CorpseMapID" }, + { true, FT_SHORT, "TimeOfDayOverride" }, + { true, FT_SHORT, "ParentMapID" }, + { true, FT_SHORT, "CosmeticParentMapID" }, + { true, FT_SHORT, "WindSettingsID" }, + { false, FT_BYTE, "InstanceType" }, + { false, FT_BYTE, "MapType" }, + { false, FT_BYTE, "ExpansionID" }, + { false, FT_BYTE, "MaxPlayers" }, + { false, FT_BYTE, "TimeOffset" }, + }; + static char const* types = "ssssssiffhhhhhhhbbbbb"; + static uint8 const arraySizes[21] = { 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; + static DB2Meta const meta(-1, 21, 0xF568DF12, types, arraySizes, -1); + static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + return &loadInfo; + } +}; + +#endif // ExtractorDB2LoadInfo_h__ diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index e40dab823eb..e108d1be20c 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -22,6 +22,7 @@ #include "DB2CascFileSource.h" #include "DB2Meta.h" #include "DBFilesClientList.h" +#include "ExtractorDB2LoadInfo.h" #include "StringFormat.h" #include "adt.h" #include "wdt.h" @@ -50,133 +51,6 @@ std::set<std::string> CameraFileNames; boost::filesystem::path input_path; boost::filesystem::path output_path; -struct CinematicCameraLoadInfo -{ - static DB2FileLoadInfo const* Instance() - { - static DB2FieldMeta const fields[] = - { - { false, FT_INT, "ID" }, - { false, FT_INT, "SoundID" }, - { false, FT_FLOAT, "OriginX" }, - { false, FT_FLOAT, "OriginY" }, - { false, FT_FLOAT, "OriginZ" }, - { false, FT_FLOAT, "OriginFacing" }, - { false, FT_INT, "ModelFileDataID" }, - }; - static char const* types = "iffi"; - static uint8 const arraySizes[4] = { 1, 3, 1, 1 }; - static DB2Meta const meta(-1, 4, 0x0062B0F4, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); - return &loadInfo; - } -}; - -struct LiquidTypeLoadInfo -{ - static DB2FileLoadInfo const* Instance() - { - static DB2FieldMeta const fields[] = - { - { false, FT_INT, "ID" }, - { false, FT_STRING, "Name" }, - { false, FT_STRING_NOT_LOCALIZED, "Texture1" }, - { false, FT_STRING_NOT_LOCALIZED, "Texture2" }, - { false, FT_STRING_NOT_LOCALIZED, "Texture3" }, - { false, FT_STRING_NOT_LOCALIZED, "Texture4" }, - { false, FT_STRING_NOT_LOCALIZED, "Texture5" }, - { false, FT_STRING_NOT_LOCALIZED, "Texture6" }, - { false, FT_INT, "SpellID" }, - { false, FT_FLOAT, "MaxDarkenDepth" }, - { false, FT_FLOAT, "FogDarkenIntensity" }, - { false, FT_FLOAT, "AmbDarkenIntensity" }, - { false, FT_FLOAT, "DirDarkenIntensity" }, - { false, FT_FLOAT, "ParticleScale" }, - { false, FT_INT, "Color1" }, - { false, FT_INT, "Color2" }, - { false, FT_FLOAT, "Float1" }, - { false, FT_FLOAT, "Float2" }, - { false, FT_FLOAT, "Float3" }, - { false, FT_FLOAT, "Float4" }, - { false, FT_FLOAT, "Float5" }, - { false, FT_FLOAT, "Float6" }, - { false, FT_FLOAT, "Float7" }, - { false, FT_FLOAT, "Float8" }, - { false, FT_FLOAT, "Float9" }, - { false, FT_FLOAT, "Float10" }, - { false, FT_FLOAT, "Float11" }, - { false, FT_FLOAT, "Float12" }, - { false, FT_FLOAT, "Float13" }, - { false, FT_FLOAT, "Float14" }, - { false, FT_FLOAT, "Float15" }, - { false, FT_FLOAT, "Float16" }, - { false, FT_FLOAT, "Float17" }, - { false, FT_FLOAT, "Float18" }, - { false, FT_INT, "Int1" }, - { false, FT_INT, "Int2" }, - { false, FT_INT, "Int3" }, - { false, FT_INT, "Int4" }, - { false, FT_SHORT, "Flags" }, - { false, FT_SHORT, "LightID" }, - { false, FT_BYTE, "Type" }, - { false, FT_BYTE, "ParticleMovement" }, - { false, FT_BYTE, "ParticleTexSlots" }, - { false, FT_BYTE, "MaterialID" }, - { false, FT_BYTE, "DepthTexCount1" }, - { false, FT_BYTE, "DepthTexCount2" }, - { false, FT_BYTE, "DepthTexCount3" }, - { false, FT_BYTE, "DepthTexCount4" }, - { false, FT_BYTE, "DepthTexCount5" }, - { false, FT_BYTE, "DepthTexCount6" }, - { false, FT_INT, "SoundID" }, - }; - static char const* types = "ssifffffifihhbbbbbi"; - static uint8 const arraySizes[19] = { 1, 6, 1, 1, 1, 1, 1, 1, 2, 18, 4, 1, 1, 1, 1, 1, 1, 6, 1 }; - static DB2Meta const meta(-1, 19, 0x3313BBF3, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); - return &loadInfo; - } -}; - -struct MapLoadInfo -{ - static DB2FileLoadInfo const* Instance() - { - static DB2FieldMeta const fields[] = - { - { false, FT_INT, "ID" }, - { false, FT_STRING_NOT_LOCALIZED, "Directory" }, - { false, FT_STRING, "MapName" }, - { false, FT_STRING, "MapDescription0" }, - { false, FT_STRING, "MapDescription1" }, - { false, FT_STRING, "ShortDescription" }, - { false, FT_STRING, "LongDescription" }, - { false, FT_INT, "Flags1" }, - { false, FT_INT, "Flags2" }, - { false, FT_FLOAT, "MinimapIconScale" }, - { false, FT_FLOAT, "CorpsePosX" }, - { false, FT_FLOAT, "CorpsePosY" }, - { false, FT_SHORT, "AreaTableID" }, - { false, FT_SHORT, "LoadingScreenID" }, - { true, FT_SHORT, "CorpseMapID" }, - { false, FT_SHORT, "TimeOfDayOverride" }, - { true, FT_SHORT, "ParentMapID" }, - { true, FT_SHORT, "CosmeticParentMapID" }, - { false, FT_SHORT, "WindSettingsID" }, - { false, FT_BYTE, "InstanceType" }, - { false, FT_BYTE, "unk5" }, - { false, FT_BYTE, "ExpansionID" }, - { false, FT_BYTE, "MaxPlayers" }, - { false, FT_BYTE, "TimeOffset" }, - }; - static char const* types = "ssssssiffhhhhhhhbbbbb"; - static uint8 const arraySizes[21] = { 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - static DB2Meta const meta(-1, 21, 0xF568DF12, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); - return &loadInfo; - } -}; - // ************************************************** // Extractor options // ************************************************** @@ -389,7 +263,7 @@ void ReadLiquidTypeTableDBC() for (uint32 x = 0; x < db2.GetRecordCount(); ++x) { DB2Record record = db2.GetRecord(x); - LiqType[record.GetId()] = record.GetUInt8("Type"); + LiqType[record.GetId()] = record.GetUInt8("SoundBank"); } for (uint32 x = 0; x < db2.GetRecordCopyCount(); ++x) diff --git a/src/tools/vmap4_extractor/gameobject_extract.cpp b/src/tools/vmap4_extractor/gameobject_extract.cpp index 3f7cfc2de52..7e0a871670f 100644 --- a/src/tools/vmap4_extractor/gameobject_extract.cpp +++ b/src/tools/vmap4_extractor/gameobject_extract.cpp @@ -18,8 +18,8 @@ #include "adtfile.h" #include "DB2CascFileSource.h" -#include "DB2Meta.h" #include "Errors.h" +#include "ExtractorDB2LoadInfo.h" #include "model.h" #include "StringFormat.h" #include "vmapexport.h" @@ -57,32 +57,6 @@ bool ExtractSingleModel(std::string& fname) extern CASC::StorageHandle CascStorage; -struct GameobjectDisplayInfoLoadInfo -{ - static DB2FileLoadInfo const* Instance() - { - static DB2FieldMeta const fields[] = - { - { false, FT_INT, "ID" }, - { false, FT_INT, "FileDataID" }, - { false, FT_FLOAT, "GeoBoxMinX" }, - { false, FT_FLOAT, "GeoBoxMinY" }, - { false, FT_FLOAT, "GeoBoxMinZ" }, - { false, FT_FLOAT, "GeoBoxMaxX" }, - { false, FT_FLOAT, "GeoBoxMaxY" }, - { false, FT_FLOAT, "GeoBoxMaxZ" }, - { false, FT_FLOAT, "OverrideLootEffectScale" }, - { false, FT_FLOAT, "OverrideNameScale" }, - { false, FT_SHORT, "ObjectEffectPackageID" }, - }; - static char const* types = "ifffh"; - static uint8 const arraySizes[5] = { 1, 6, 1, 1, 1 }; - static DB2Meta const meta(-1, 5, 0x9F2098D1, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); - return &loadInfo; - } -}; - enum ModelTypes : uint32 { MODEL_MD20 = '02DM', diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index 80f10fd2af3..2a4cf4fcd54 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -21,7 +21,7 @@ #include "Common.h" #include "cascfile.h" #include "DB2CascFileSource.h" -#include "DB2Meta.h" +#include "ExtractorDB2LoadInfo.h" #include "StringFormat.h" #include "vmapexport.h" #include "wdtfile.h" @@ -66,45 +66,6 @@ std::unordered_set<uint32> maps_that_are_parents; boost::filesystem::path input_path; bool preciseVectorData = false; -struct MapLoadInfo -{ - static DB2FileLoadInfo const* Instance() - { - static DB2FieldMeta const fields[] = - { - { false, FT_INT, "ID" }, - { false, FT_STRING_NOT_LOCALIZED, "Directory" }, - { false, FT_STRING, "MapName" }, - { false, FT_STRING, "MapDescription0" }, - { false, FT_STRING, "MapDescription1" }, - { false, FT_STRING, "ShortDescription" }, - { false, FT_STRING, "LongDescription" }, - { false, FT_INT, "Flags1" }, - { false, FT_INT, "Flags2" }, - { false, FT_FLOAT, "MinimapIconScale" }, - { false, FT_FLOAT, "CorpsePosX" }, - { false, FT_FLOAT, "CorpsePosY" }, - { false, FT_SHORT, "AreaTableID" }, - { false, FT_SHORT, "LoadingScreenID" }, - { true, FT_SHORT, "CorpseMapID" }, - { false, FT_SHORT, "TimeOfDayOverride" }, - { true, FT_SHORT, "ParentMapID" }, - { true, FT_SHORT, "CosmeticParentMapID" }, - { false, FT_SHORT, "WindSettingsID" }, - { false, FT_BYTE, "InstanceType" }, - { false, FT_BYTE, "unk5" }, - { false, FT_BYTE, "ExpansionID" }, - { false, FT_BYTE, "MaxPlayers" }, - { false, FT_BYTE, "TimeOffset" }, - }; - static char const* types = "ssssssiffhhhhhhhbbbbb"; - static uint8 const arraySizes[21] = { 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - static DB2Meta const meta(-1, 21, 0xF568DF12, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); - return &loadInfo; - } -}; - // Constants //static const char * szWorkDirMaps = ".\\Maps"; |