static void Main(string[] args) { bool loadMap = false; XdbLoader loader = new XdbLoader(baseFolder); if (loadMap) { loader.LoadMap(@"Maps\Multiplayer\XL1\XL1.xdb"); int limit = 300; int count = 0; foreach (ModelDefinition def in loader.ModelDictionary.Values) { if (count == limit) break; if (badMapObjectsModels.Any(n => n == def.name)) continue; ConvertCreature(def, @"e:\HeroesAnimations\ConvertedMap2"); count++; } } ModelDefinition mod = loader.LoadEffect(@"E:\Heroes5Models\Effects\_(ModelInstance)\Effects\UI\ArmyFlag.xdb"); ConvertCreature(mod, @"e:\HeroesAnimations\ConvertedEffects"); //loader.LoadMapObjectDefinition(@"E:\Heroes5Models\MapObjects\Haven\ArchersTower.(AdvMapDwellingShared).xdb"); // LoadAllMapObjects(loader, null); // foreach (ObjectInstance obj in loader.Map.Objects) // { // ConvertCreature(obj.model, @"e:\HeroesAnimations\ConvertedMap2"); // } //ModelDefinition creature = loader.LoadCreature(@"Characters\Creatures\Haven\Archangel.(Character).xdb"); //ConvertCreature(creature, @"e:\HeroesAnimations\Converted"); // LoadAllCreatures(loader, null); //LoadAllCreatures(loader, null); // ConvertArenaTownsDirectory(loader, "river_noLM"); }
static void LoadAllCreatures(XdbLoader loader, string skipTo) { List<ModelDefinition> creatures = new List<ModelDefinition>(); string creatureFolder = Path.Combine(baseFolder, @"Characters\Creatures"); foreach (string file in Directory.GetFiles(creatureFolder, "*.xdb", SearchOption.AllDirectories)) { if (file.Contains("_LOD") || file.Contains("(CharacterView)") || !file.Contains("(Character)") || file.Contains("Renegades")) { continue; } ModelDefinition creature = loader.LoadCreature(file); if (creature == null) continue; creatures.Add(creature); // skip to this if (skipTo != null) { if(skipTo == creature.name) { skipTo = null; } else { continue; } } if (badCreatureModels.Any(n => n == creature.name)) continue; ConvertCreature(creature, @"e:\HeroesAnimations\Converted"); } }
static void LoadAllMapObjects(XdbLoader loader, string skipTo) { List<ModelDefinition> mapObjects = new List<ModelDefinition>(); string mapObjectsFolder = Path.Combine(baseFolder, @"MapObjects"); foreach (string file in Directory.GetFiles(mapObjectsFolder, "*.xdb", SearchOption.AllDirectories)) { if (file.Contains("(Texture)") || file.Contains("(Material)")) { continue; } ModelDefinition mapObject = loader.LoadMapObjectDefinition(file); if (mapObject == null) continue; mapObjects.Add(mapObject); // skip to this if (skipTo != null) { if (skipTo == mapObject.name) { skipTo = null; } else { continue; } } if (badMapObjectsModels.Any(n => n == mapObject.name)) continue; ConvertCreature(mapObject, @"e:\HeroesAnimations\ConvertedMap3"); } }
static void ConvertArenaTownsDirectory(XdbLoader loader, string skipTo) { string[] skipList = new string[] { "(Texture)", "(Material)", "(Camera)", "-geom", "(ArenaModObject)", "(ArenaLocObject)", "(ArenaEnvObject)", "(ArenaDesc)" }; List<ModelDefinition> mapObjects = new List<ModelDefinition>(); string mapObjectsFolder = Path.Combine(baseFolder, @"Arenas\Town\NewHaven"); foreach (string file in Directory.GetFiles(mapObjectsFolder, "*.xdb", SearchOption.AllDirectories)) { if (skipList.Any(s => file.Contains(s))) { continue; } ModelDefinition mapObject = loader.LoadArenaTownDefinition(file); if (mapObject == null) continue; mapObjects.Add(mapObject); // skip to this if (skipTo != null) { if (skipTo == mapObject.name) { skipTo = null; } else { continue; } } if (badArenaTownModels.Any(n => n == mapObject.name)) continue; ConvertCreature(mapObject, @"e:\HeroesAnimations\ConvertedArenas\Town\NewHaven"); } }