public static Test_Battle_Character_Data from_data(string type, string identifier, string data) { Test_Battle_Character_Data battler = new Test_Battle_Character_Data(); battler.Generic = type == "generic"; battler.Identifier = identifier; for (int i = 0; i < battler.Items.Length; i++) { battler.Items[i] = new TactileLibrary.Item_Data(); } if (battler.Generic) { battler.Actor_Id = -1; string[] ary = data.Split('\n'); battler.Name = ary[0].Split('|')[0]; battler.Class_Id = Convert.ToInt32(ary[1].Split('|')[0]); battler.Gender = Convert.ToInt32(ary[2].Split('|')[0]); battler.Level = Convert.ToInt32(ary[3].Split('|')[0]); //battler.Exp = ary[4 0|Exp battler.Team = Convert.ToInt32(ary[5].Split('|')[0]); battler.Prepromote_Levels = Convert.ToInt32(ary[6].Split('|')[0]); battler.Build = (Generic_Builds)Convert.ToInt32(ary[7].Split('|')[0]); battler.Con = Convert.ToInt32(ary[8].Split('|')[0]); battler.Priority = Convert.ToInt32(ary[9].Split('|')[0]); battler.Mission = Convert.ToInt32(ary[10].Split('|')[0]); battler.Weapon_Id = Convert.ToInt32(ary[11].Split('|')[0].Split(new string[] { ", " }, StringSplitOptions.None)[1]); // If units were created with NUM_ITEMS = 6, // and then NUM_ITEMS was changed to 4 or 6, things would break // Come up with a longterm solution//Yeti for (int i = 0; i < battler.Items.Length; i++) { string[] item = ary[i + 11].Split('|')[0].Split(new string[] { ", " }, StringSplitOptions.None); battler.Items[i] = new TactileLibrary.Item_Data(Convert.ToInt32(item[0]), Convert.ToInt32(item[1]), Convert.ToInt32(item[2])); } int index_after_items = 11 + Global.ActorConfig.NumItems; string[] wlvls = ary[index_after_items].Split('|')[0] .Split(new string[] { ", " }, StringSplitOptions.None); for (int i = 0; i < battler.WLvls.Length; i++) { if (i < wlvls.Length) { battler.WLvls[i] = Convert.ToInt32(wlvls[i]); } } } else { string[] ary = data.Split('\n'); battler.Actor_Id = Convert.ToInt32(ary[0].Split('|')[0]); battler.Team = Convert.ToInt32(ary[1].Split('|')[0]); battler.Priority = Convert.ToInt32(ary[2].Split('|')[0]); battler.Mission = Convert.ToInt32(ary[3].Split('|')[0]); } return(battler); }
public void UnitEditorUnitMenuCopyUnit() { Game_Unit unit = Global.game_map.units[Global.game_system.Selected_Unit_Id]; Global.test_battler_1 = Test_Battle_Character_Data.from_data( _unitData.Units[unit.loc].type, _unitData.Units[unit.loc].identifier, _unitData.Units[unit.loc].data); if (Global.test_battler_1.Generic) { Global.test_battler_1.Actor_Id = Global.game_actors.next_actor_id(); } Global.game_temp.menuing = false; close_map_menu(); Global.game_system.Selected_Unit_Id = -1; Global.game_map.move_range_visible = true; Global.game_map.highlight_test(); }
public void UnitEditorUnitMenuChangeTeam(bool increment) { Game_Unit unit = Global.game_map.units[Global.game_system.Selected_Unit_Id]; int team = unit.team; team = new_team(team, !increment); Global.game_map.change_unit_team(unit.id, team); Global.game_map.refresh_move_ranges(); Global.game_map.wait_for_move_update(); Global.test_battler_1 = Test_Battle_Character_Data.from_data( _unitData.Units[unit.loc].type, _unitData.Units[unit.loc].identifier, _unitData.Units[unit.loc].data); string[] ary = Global.test_battler_1.to_string(unit.team); _unitData.Units[Global.player.loc] = new Data_Unit(ary[0], ary[1], ary[2]); }
private static void load_data_content() { Loaded_Files = Content.Load <List <string> >(@"manifest"); repair_loaded_filenames(); SetConstants(Content.Load <TactileLibrary.Config.ConfigData>(@"Data/ConfigData")); Data_Actors = Content.Load <Dictionary <int, TactileLibrary.Data_Actor> >(@"Data/Actor_Data"); #if DEBUG System.Diagnostics.Debug.Assert(Data_Actors.Keys.Max() <= Tactile.Constants.Actor.MAX_ACTOR_COUNT, string.Format("An actor has a higher id than the maximum value \"{0}\"", Tactile.Constants.Actor.MAX_ACTOR_COUNT)); #endif if (content_exists(@"Data\Generic_Actor_Data")) { DataGenericActors = Content.Load <Dictionary <string, TactileLibrary.Data_Generic_Actor> >(@"Data\Generic_Actor_Data"); } Data_Animations = Content.Load <Dictionary <int, TactileLibrary.Battle_Animation_Data> >(@"Data/Animation_Data"); Data_Animation_Groups = Content.Load <Dictionary <string, int> >(@"Data/Animation_Group_Data"); Data_Battler_Animations = Content.Load <Dictionary <string, Battle_Animation_Association_Set> >(@"Data/Animation_Battler_Data"); var chapters = Content.Load <List <TactileLibrary.Data_Chapter> >(@"Data/Chapter_Data"); Chapter_List = chapters.Select(x => x.Id).ToList(); Data_Chapters = chapters.ToDictionary(x => x.Id, x => x); Data_Classes = Content.Load <Dictionary <int, TactileLibrary.Data_Class> >(@"Data/Class_Data"); Data_Items = Content.Load <Dictionary <int, TactileLibrary.Data_Item> >(@"Data/Item_Data"); Data_Skills = Content.Load <Dictionary <int, TactileLibrary.Data_Skill> >(@"Data/Skill_Data"); Data_Statuses = Content.Load <Dictionary <int, TactileLibrary.Data_Status> >(@"Data/Status_Data"); Data_Supports = load_supports(Content.Load <List <TactileLibrary.Data_Support> >(@"Data/Support_Data")); Data_Terrains = Content.Load <Dictionary <int, TactileLibrary.Data_Terrain> >(@"Data/Terrain_Data"); Data_Tilesets = Content.Load <Dictionary <int, TactileLibrary.Data_Tileset> >(@"Data/Tileset_Data"); Data_Weapons = Content.Load <Dictionary <int, TactileLibrary.Data_Weapon> >(@"Data/Weapon_Data"); WeaponTypes = Content.Load <List <WeaponType> >(@"Weapon_Types"); Frame_Data = Content.Load <Dictionary <string, TactileLibrary.Frame_Data> >(@"Data/Frame_Data"); if (content_exists("Face_Data")) { FaceData = Content.Load <Dictionary <string, TactileLibrary.Face_Data> >(@"Face_Data"); } BattlerPaletteData = Content.Load <Dictionary <string, SpritePalette> >(@"Battler_Palette_Data"); BattlerRecolorData = Content.Load <Dictionary <string, RecolorData> >(@"Data/BattlerRecolorData"); Face_Palette_Data = Content.Load <Dictionary <string, Color[]> >(@"Face_Palette_Data"); Map_Sprite_Colors = Global.Content.Load <MapSpriteRecolorData>(@"MapSpriteRecolors"); GlobalText = Global.Content.Load <TextData>(@"Data/Text/Global").Text; Battle_Text = Global.Content.Load <TextData>(@"Data/Text/Battle Quotes").Text; Death_Quotes = Global.Content.Load <TextData>(@"Data/Text/Death Quotes").Text; Supports = Global.Content.Load <TextData>(@"Data/Text/Supports").Text; System_Text = Global.Content.Load <TextData>(@"Data/Text/System").Text; Actor_Descriptions = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> description in Generic_Unit_Descriptions.DESCRIPTIONS) { Actor_Descriptions[description.Key] = description.Value; } foreach (TactileLibrary.Data_Actor actor in Data_Actors.Values) { Actor_Descriptions[actor.Name] = actor.Description; } Palette_Pool = new Palette_Handler(); #if DEBUG Test_Battler_1 = new Test_Battle_Character_Data(); Test_Battler_2 = new Test_Battle_Character_Data(); #endif }