private static void WriteActions() { SetStatus("Writing Actions to Actions.db...", 0, 0, Actions.Count); DataStreamEx s = new DataStreamEx(); var values = Actions.Values.ToArray(); s.WriteS32(values.Length); for (int i = 0; i < Actions.Count; i++) { var value = values[i]; s.WriteString(value.Name); s.WriteS32(value.Level); s.WriteBitmapSource(value.Images[ClassJobInfo.GSM]); s.WriteBitmapSource(value.Images[ClassJobInfo.CRP]); s.WriteBitmapSource(value.Images[ClassJobInfo.BLM]); s.WriteBitmapSource(value.Images[ClassJobInfo.ARM]); s.WriteBitmapSource(value.Images[ClassJobInfo.LTW]); s.WriteBitmapSource(value.Images[ClassJobInfo.WVR]); s.WriteBitmapSource(value.Images[ClassJobInfo.ALC]); s.WriteBitmapSource(value.Images[ClassJobInfo.CUL]); if (i % 100 == 0) { SetStatus(null, i); } } SetStatus(null, values.Length); File.WriteAllBytes("Actions.db", s.GetBytes()); s.Flush(); s.Close(); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { GameData.WriteRecipeRotations(); TextBlockCP.Text.ToString(); if (Sim == null) { return; } DataStreamEx s = new DataStreamEx(); Sim.CraftsmanshipBuff = 0; Sim.ControlBuff = 0; Sim.MaxCPBuff = 0; if (Sim.CurrentRecipe != null) { s.WriteInt(Sim.CurrentRecipe.Id); } else { s.WriteInt(0); } s.WriteInt(Sim.Level); s.WriteInt(Sim.Craftsmanship); s.WriteInt(Sim.Control); s.WriteInt(Sim.MaxCP); s.WriteByte(CheckBoxIsSpecialist.IsChecked == true ? (byte)1 : (byte)0); s.WriteInt(SelectedFood == null ? 0 : SelectedFood.Id); if (SelectedFood != null) { s.WriteByte(FoodIsHQ ? (byte)1 : (byte)0); } s.WriteInt(SelectedTea == null ? 0 : SelectedTea.Id); if (SelectedTea != null) { s.WriteByte(TeaIsHQ ? (byte)1 : (byte)0); } var actions = Sim.GetCraftingActions(); foreach (var action in actions) { s.WriteInt(action.Id); } if (File.Exists("Settings.db")) { File.Delete("Settings.db"); } File.WriteAllBytes("Settings.db", s.GetBytes()); s.Flush(); s.Close(); } catch (Exception ee) { Debugger.Break(); } }
private static void WriteItems() { SetStatus("Writing Items to Items.db...", 0, 0, Items.Count); DataStreamEx s = new DataStreamEx(); var values = Items.Values.ToArray(); s.WriteS32((ushort)values.Length); for (int i = 0; i < Items.Count; i++) { var value = values[i]; s.WriteS32(value.Id); s.WriteString(value.Name); s.WriteByte(value.FoodInfo == null ? (byte)0 : (byte)1); if (value.FoodInfo != null) { var f = value.FoodInfo; s.WriteByte((byte)f.StatTypes.Length); s.WriteByte((byte)f.FoodType); for (int j = 0; j < f.StatTypes.Length; j++) { s.WriteByte((byte)f.StatTypes[j]); s.WriteS32(f.PercentageIncrease[j]); s.WriteS32(f.MaxIncrease[j]); s.WriteS32(f.PercentageIncreaseHQ[j]); s.WriteS32(f.MaxIncreaseHQ[j]); } } if (i % 100 == 0) { SetStatus(null, i); } } SetStatus(null, values.Length); File.WriteAllBytes("Items.db", s.GetBytes()); s.Flush(); s.Close(); }
private static void WriteRecipes() { SetStatus("Writing Recipes to Recipes.db...", 0, 0, Recipes.Count); DataStreamEx s = new DataStreamEx(); s.WriteS32(Recipes.Count); for (int i = 0; i < Recipes.Count; i++) { var value = Recipes[i]; s.WriteS32(value.Id); s.WriteString(value.Name); s.WriteS32(value.Level); s.WriteS32(value.ClassJobLevel); s.WriteS32((int)value.ClassJob); s.WriteS32(value.RequiredCraftsmanship); s.WriteS32(value.RequiredControl); s.WriteS32(value.Durability); s.WriteS32(value.MaxProgress); s.WriteS32(value.MaxQuality); var ingredients = Ingredients[value]; s.WriteByte((byte)ingredients.Count); for (int j = 0; j < ingredients.Count; j++) { s.WriteS32(ingredients[j].Id); } if (i % 100 == 0) { SetStatus(null, i); } } SetStatus(null, Recipes.Count); File.WriteAllBytes("Recipes.db", s.GetBytes()); s.Flush(); s.Close(); }