public void SetNewTables(ColorTableValues table, List <uint> times, List <Vector3> colors) { mTimeTables[(int)table] = times; mColorTables[(int)table] = colors; DBC.LightIntBand band = DBC.DBCStores.LightIntBand[mLight.skyParam * 18 + (uint)table - 17]; band.NumEntries = (uint)times.Count; for (int i = 0; i < times.Count; ++i) { band.Times[i] = times[i]; band.Values[i] = ToUint(colors[i]); } }
private void InitColorTables() { uint baseIndex = mLight.skyParam * 18; for (int i = 0; i < 18; ++i) { DBC.LightIntBand lib = DBC.DBCStores.LightIntBand[baseIndex + (uint)i - 17]; for (int j = 0; j < lib.NumEntries; ++j) { mColorTables[i].Add(ToVector(lib.Values[j])); mTimeTables[i].Add(lib.Times[j]); } } }
private void button7_Click(object sender, EventArgs e) { DBC.Light light = new DBC.Light(); light.ID = DBC.DBCStores.Light.MaxKey + 1; light.deathParam = 0; light.waterParam = 0; light.otherParam = 0; light.MapID = Game.GameManager.WorldManager.MapID; light.sunsetParam = 0; light.unk1 = light.unk2 = light.unk3 = 0; light.x = (((float)numericUpDown1.Value) + Utils.Metrics.MidPoint) * 36.0f; light.z = (((float)numericUpDown2.Value) + Utils.Metrics.MidPoint) * 36.0f; light.y = ((float)numericUpDown3.Value) * 36.0f; light.falloff = (float)numericUpDown4.Value * 36.0f; light.falloffEnd = (float)numericUpDown5.Value * 36.0f; uint maxIntParam = DBC.DBCStores.LightIntBand.MaxKey; maxIntParam /= 18; ++maxIntParam; uint maxLightParam = DBC.DBCStores.LightParams.MaxKey; ++maxLightParam; uint skyParam = (uint)Math.Max(maxIntParam, maxLightParam); light.skyParam = skyParam; DBC.LightParams param = new DBC.LightParams() { ID = skyParam, glow = (float)numericUpDown6.Value, cloudID = (uint)comboBox1.SelectedIndex, HighlightSky = (checkBox1.Checked ? 1u : 0u), oceanDeepAlpha = (float)numericUpDown10.Value, oceanShallowAlpha = (float)numericUpDown9.Value, waterDeepAlpha = (float)numericUpDown8.Value, waterShallowAlpha = (float)numericUpDown7.Value, skyboxID = (uint)textBox1.Tag }; DBC.DBCStores.LightParams.AddEntry(skyParam, param); #region LightIntBand for (uint i = 0; i < 18; ++i) { DBC.LightIntBand lib = new DBC.LightIntBand(); lib.Times = new uint[16]; lib.Values = new uint[16]; lib.ID = skyParam * 18 - 17 + i; switch ((World.ColorTableValues)i) { case World.ColorTableValues.GlobalDiffuse: { var times = lightColorSelector1.Interpolator.TimeTable; var colors = lightColorSelector1.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.GlobalAmbient: { var times = lightColorSelector2.Interpolator.TimeTable; var colors = lightColorSelector2.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Fog: { var times = lightColorSelector3.Interpolator.TimeTable; var colors = lightColorSelector3.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color0: { var times = lightColorSelector4.Interpolator.TimeTable; var colors = lightColorSelector4.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color1: { var times = lightColorSelector5.Interpolator.TimeTable; var colors = lightColorSelector5.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color2: { var times = lightColorSelector6.Interpolator.TimeTable; var colors = lightColorSelector6.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color3: { var times = lightColorSelector7.Interpolator.TimeTable; var colors = lightColorSelector7.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color4: { var times = lightColorSelector8.Interpolator.TimeTable; var colors = lightColorSelector8.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.SunColor: { var times = lightColorSelector9.Interpolator.TimeTable; var colors = lightColorSelector9.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.SunHaloColor: { var times = lightColorSelector10.Interpolator.TimeTable; var colors = lightColorSelector10.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.WaterDark: { var times = lightColorSelector11.Interpolator.TimeTable; var colors = lightColorSelector11.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.WaterLight: { var times = lightColorSelector12.Interpolator.TimeTable; var colors = lightColorSelector12.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Shadow: { var times = lightColorSelector13.Interpolator.TimeTable; var colors = lightColorSelector13.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; default: { lib.NumEntries = 0; break; } } DBC.DBCStores.LightIntBand.AddEntry(lib.ID, lib); } #endregion for (int i = 0; i < 6; ++i) { DBC.LightFloatBand lfb = new DBC.LightFloatBand(); lfb.ID = skyParam * 6 - 5 + (uint)i; lfb.NumEntries = 0; lfb.Times = new uint[16]; lfb.Values = new float[16]; DBC.DBCStores.LightFloatBand.AddEntry(lfb.ID, lfb); } DBC.DBCStores.Light.AddEntry(light.ID, light); World.WorldLightEntry wle = new World.WorldLightEntry(light); if (Game.GameManager.IsPandaria == false) Game.GameManager.SkyManager.GetSkyForMap(light.MapID).AddNewLight(wle); DBC.DBCStores.LightIntBand.SaveDBC(); DBC.DBCStores.LightParams.SaveDBC(); DBC.DBCStores.Light.SaveDBC(); DBC.DBCStores.LightFloatBand.SaveDBC(); }
private void button7_Click(object sender, EventArgs e) { DBC.Light light = new DBC.Light(); light.ID = DBC.DBCStores.Light.MaxKey + 1; light.deathParam = 0; light.waterParam = 0; light.otherParam = 0; light.MapID = Game.GameManager.WorldManager.MapID; light.sunsetParam = 0; light.unk1 = light.unk2 = light.unk3 = 0; light.x = (((float)numericUpDown1.Value) + Utils.Metrics.MidPoint) * 36.0f; light.z = (((float)numericUpDown2.Value) + Utils.Metrics.MidPoint) * 36.0f; light.y = ((float)numericUpDown3.Value) * 36.0f; light.falloff = (float)numericUpDown4.Value * 36.0f; light.falloffEnd = (float)numericUpDown5.Value * 36.0f; uint maxIntParam = DBC.DBCStores.LightIntBand.MaxKey; maxIntParam /= 18; ++maxIntParam; uint maxLightParam = DBC.DBCStores.LightParams.MaxKey; ++maxLightParam; uint skyParam = (uint)Math.Max(maxIntParam, maxLightParam); light.skyParam = skyParam; DBC.LightParams param = new DBC.LightParams() { ID = skyParam, glow = (float)numericUpDown6.Value, cloudID = (uint)comboBox1.SelectedIndex, HighlightSky = (checkBox1.Checked ? 1u : 0u), oceanDeepAlpha = (float)numericUpDown10.Value, oceanShallowAlpha = (float)numericUpDown9.Value, waterDeepAlpha = (float)numericUpDown8.Value, waterShallowAlpha = (float)numericUpDown7.Value, skyboxID = (uint)textBox1.Tag }; DBC.DBCStores.LightParams.AddEntry(skyParam, param); #region LightIntBand for (uint i = 0; i < 18; ++i) { DBC.LightIntBand lib = new DBC.LightIntBand(); lib.Times = new uint[16]; lib.Values = new uint[16]; lib.ID = skyParam * 18 - 17 + i; switch ((World.ColorTableValues)i) { case World.ColorTableValues.GlobalDiffuse: { var times = lightColorSelector1.Interpolator.TimeTable; var colors = lightColorSelector1.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.GlobalAmbient: { var times = lightColorSelector2.Interpolator.TimeTable; var colors = lightColorSelector2.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Fog: { var times = lightColorSelector3.Interpolator.TimeTable; var colors = lightColorSelector3.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color0: { var times = lightColorSelector4.Interpolator.TimeTable; var colors = lightColorSelector4.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color1: { var times = lightColorSelector5.Interpolator.TimeTable; var colors = lightColorSelector5.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color2: { var times = lightColorSelector6.Interpolator.TimeTable; var colors = lightColorSelector6.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color3: { var times = lightColorSelector7.Interpolator.TimeTable; var colors = lightColorSelector7.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Color4: { var times = lightColorSelector8.Interpolator.TimeTable; var colors = lightColorSelector8.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.SunColor: { var times = lightColorSelector9.Interpolator.TimeTable; var colors = lightColorSelector9.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.SunHaloColor: { var times = lightColorSelector10.Interpolator.TimeTable; var colors = lightColorSelector10.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.WaterDark: { var times = lightColorSelector11.Interpolator.TimeTable; var colors = lightColorSelector11.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.WaterLight: { var times = lightColorSelector12.Interpolator.TimeTable; var colors = lightColorSelector12.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; case World.ColorTableValues.Shadow: { var times = lightColorSelector13.Interpolator.TimeTable; var colors = lightColorSelector13.Interpolator.ColorTable; lib.NumEntries = (uint)times.Count; for (int j = 0; j < times.Count; ++j) { lib.Times[j] = times[j]; lib.Values[j] = World.WorldLightEntry.ToUint(colors[j]); } } break; default: { lib.NumEntries = 0; break; } } DBC.DBCStores.LightIntBand.AddEntry(lib.ID, lib); } #endregion for (int i = 0; i < 6; ++i) { DBC.LightFloatBand lfb = new DBC.LightFloatBand(); lfb.ID = skyParam * 6 - 5 + (uint)i; lfb.NumEntries = 0; lfb.Times = new uint[16]; lfb.Values = new float[16]; DBC.DBCStores.LightFloatBand.AddEntry(lfb.ID, lfb); } DBC.DBCStores.Light.AddEntry(light.ID, light); World.WorldLightEntry wle = new World.WorldLightEntry(light); if (Game.GameManager.IsPandaria == false) { Game.GameManager.SkyManager.GetSkyForMap(light.MapID).AddNewLight(wle); } DBC.DBCStores.LightIntBand.SaveDBC(); DBC.DBCStores.LightParams.SaveDBC(); DBC.DBCStores.Light.SaveDBC(); DBC.DBCStores.LightFloatBand.SaveDBC(); }