public static void BuildCache() { if (IO.FileManager.Instance.Version == IO.FileDataVersion.Warlords) { CreatureDisplayInfo.BuildCache <IO.Files.Models.WoD.CreatureDisplayInfoEntry>(); CreatureModelData.BuildCache <IO.Files.Models.WoD.CreatureModelDataEntry>(); FileData.BuildCache <IO.Files.Models.WoD.FileDataIDEntry>(); } else if (IO.FileManager.Instance.Version == IO.FileDataVersion.Lichking) { CreatureDisplayInfo.BuildCache <IO.Files.Models.Wotlk.CreatureDisplayInfoEntry>(); CreatureModelData.BuildCache <IO.Files.Models.Wotlk.CreatureModelDataEntry>(); CreatureDisplayInfoExtra.BuildCache <IO.Files.Models.Wotlk.CreatureDisplayInfoExtraEntry>(); AreaTable.BuildCache <IO.Files.Terrain.Wotlk.AreaTable>(); } }
static void Main(string[] args) { try { Print("This program will use ID's {0}+ for CreatureDisplayInfo and CreatureModelInfo.", DBCStartingEntry); Print("This program will use creature ID's {0}+ for creature_template.", CTStartingEntry); Print("This program will spawn the creatures on map {0}.", MapEntry); Print("Loading Import\\SPELLS folder..."); if (!Directory.Exists("Import/SPELLS")) { throw new Exception("Spells folder does not exist!"); } DirectoryInfo dir = new DirectoryInfo("Import/SPELLS"); loadAllSpells(dir); Print("Loaded {0} spells. Loading Import\\CreatureModelData.dbc...", paths.Count); CreatureModelData modelData = new CreatureModelData(); Print("Loaded {0} models from CreatureModelData.", modelData.header.RecordCount); Print("Loading Input\\CreatureDisplayInfo.dbc..."); CreatureDisplayInfo displayInfo = new CreatureDisplayInfo(); Print("Loaded {0} display ID's from CreatureDisplayInfo.", displayInfo.header.RecordCount); Print("Creating {0} new entries in both DBC's...", paths.Count); populateNewEntries(modelData, displayInfo); Print("Creating Export\\CreatureModelData.dbc..."); modelData.SaveDBCFile(); Print("Creating Export\\CreatureDisplayInfo.dbc..."); displayInfo.SaveDBCFile(); Print("Creating creature_template queries..."); generateTemplateQueries(); Print("Creating creature queries..."); generateSpawnQueries(); Print("Program finished successfully."); } catch (Exception e) { Print("ERROR: " + e.Message); } }
public static void Initialize() { Map.Load(@"DBFilesClient\Map.dbc"); LoadingScreen.Load(@"DBFilesClient\LoadingScreens.dbc"); Light.Load(@"DBFilesClient\Light.dbc"); try { CreatureDisplayInfo.Load(@"DBFilesClient\CreatureDisplayInfo.dbc"); } catch (Exception) { if (FileManager.Instance.Version < FileDataVersion.Warlords) { throw; } CreatureDisplayInfo = new DB2File(); CreatureDisplayInfo.Load(@"DBFilesClient\CreatureDisplayInfo.db2"); } CreatureDisplayInfoExtra.Load(@"DBFilesClient\CreatureDisplayInfoExtra.dbc"); CreatureModelData.Load(@"DBFilesClient\CreatureModelData.dbc"); if (FileManager.Instance.Version <= FileDataVersion.Mists) { InitLightsMop(); } if (FileManager.Instance.Version == FileDataVersion.Lichking) { LightIntBand.Load(@"DBFilesClient\LightIntBand.dbc"); LightFloatBand.Load(@"DBFilesClient\LightFloatBand.dbc"); } if (FileManager.Instance.Version <= FileDataVersion.Warlords) { FileData.Load(@"DBFilesClient\FileData.dbc"); } GroundEffectDoodad.Load(@"DBFilesClient\GroundEffectDoodad.dbc"); GroundEffectTexture.Load(@"DBFilesClient\GroundEffectTexture.dbc"); AreaTable.Load(@"DBFilesClient\AreaTable.dbc"); MapFormatGuess.Initialize(); SkyManager.Instance.Initialize(); }
public static List<CreatureDisplayInfo> LoadCreatureDisplayInfo() { List<CreatureDisplayInfo> list = new List<CreatureDisplayInfo>(); using (FileStream stream = File.Open(DATA_PATH + "DBC/CreatureDisplayInfo.dbc", FileMode.Open)) { BinaryReader r = new BinaryReader(stream); DBCHeader header = DBC.ReadDBCHeader(r); int dataSize = 20 + header.RowSize * header.Records; for (int i = 0; i != header.Records; ++i) { CreatureDisplayInfo info = new CreatureDisplayInfo(); info.ID = r.ReadInt32(); info.Model = r.ReadInt32(); info.Sound = r.ReadInt32(); info.DisplayEx = r.ReadInt32(); info.Scale = r.ReadSingle(); info.Opacity = r.ReadInt32(); info.Skin1 = DBC.ReadString(r, dataSize); info.Skin2 = DBC.ReadString(r, dataSize); info.Skin3 = DBC.ReadString(r, dataSize); info.Portait = DBC.ReadString(r, dataSize); info.BloodLevel = r.ReadInt32(); info.Blood = r.ReadInt32(); info.NPCSound = r.ReadInt32(); info.Particles = r.ReadInt32(); info.GeosetData = r.ReadInt32(); info.EffectPackage = r.ReadInt32(); list.Add(info); } r.Close(); } return list; }
private static void populateNewEntries(CreatureModelData modelData, CreatureDisplayInfo displayInfo) { // CreatureModelData int index = (int)modelData.header.RecordCount; int newSize = index + paths.Count; Array.Resize(ref modelData.body.records, newSize); Array.Resize(ref modelData.body.pathStrings, newSize); modelData.header.RecordCount = (uint)newSize; string[] stringPaths = paths.ToArray(); uint entry = DBCStartingEntry; for (int i = index; i < newSize; ++i) { CreatureModelData.DBC_Record newRecord = new CreatureModelData.DBC_Record(); newRecord.ID = entry++; newRecord.Flags = 0; newRecord.AlternateModel = 0; newRecord.sizeClass = 1; newRecord.modelScale = 1; newRecord.BloodLevel = 0; newRecord.Footprint = 0; newRecord.footprintTextureLength = 0; newRecord.footprintTextureWidth = 0; newRecord.footstepShakeSize = 0; newRecord.footprintParticleScale = 0; newRecord.foleyMaterialId = 0; newRecord.deathThudShakeSize = 0; newRecord.SoundData = 0; newRecord.CollisionHeight = 0; newRecord.CollisionWidth = 0; newRecord.mountHeight = 0; newRecord.geoBoxMaxF1 = 0; newRecord.geoBoxMinF1 = 0; newRecord.geoBoxMaxF2 = 0; newRecord.geoBoxMinF2 = 0; newRecord.geoBoxMaxF3 = 0; newRecord.geoBoxMinF3 = 0; newRecord.worldEffectScale = 1; newRecord.Unknown6 = 0; newRecord.Unknown5 = 0; newRecord.attachedEffectScale = 0; modelData.body.pathStrings[i] = stringPaths[i - index]; modelData.body.records[i] = newRecord; } // CreatureDisplayInfo index = (int)displayInfo.header.RecordCount; newSize = index + paths.Count; Array.Resize(ref displayInfo.body.records, newSize); displayInfo.header.RecordCount = (uint)newSize; entry = DBCStartingEntry; for (int i = index; i < newSize; ++i) { CreatureDisplayInfo.DBC_Record newRecord = new CreatureDisplayInfo.DBC_Record(); newRecord.Model = entry; newRecord.ID = entry++; newRecord.blood = 0; newRecord.bloodLevel = 0; newRecord.creatureGeosetData = 0; newRecord.ExtraDisplayInfo = 0; newRecord.NPCSounds = 0; newRecord.objectEffectPackageID = 0; newRecord.Opacity = 255; newRecord.Particles = 0; newRecord.portraitTextureName = 0; newRecord.Scale = 1; newRecord.Skin1 = 0; newRecord.Skin2 = 0; newRecord.Skin3 = 0; newRecord.Sound = 0; displayInfo.body.records[i] = newRecord; } }