public static void LoadTeleportBuildings() { try { using (System.IO.TextReader streamReader = new System.IO.StringReader(reader.GetFileText("teleportbuilding.txt"))) { string line = streamReader.ReadLine(); while (line != null) { if (line == "" || line.Contains('\t') == false) { line = streamReader.ReadLine(); continue; } string[] vars = line.Split('\t'); if (vars.Length >= 13) { try { bool Used = (vars[0] == "1") ? true : false; if (Used) { DataInfo.MediaModel newModel = new DataInfo.MediaModel(); newModel.ObjRefID = UInt32.Parse(vars[1]); newModel.MediaName = vars[2]; string SN = vars[5]; if (Data.Translation.ContainsKey(SN)) { newModel.TranslationName = Data.Translation[SN]; } newModel.Classes.A = Int32.Parse(vars[7]); newModel.Classes.B = Int32.Parse(vars[8]); newModel.Classes.C = Int32.Parse(vars[9]); newModel.Classes.D = Int32.Parse(vars[10]); newModel.Classes.E = Int32.Parse(vars[11]); newModel.Classes.F = Int32.Parse(vars[12]); newModel.Type = Utility.GetModelType(newModel); Data.MediaModels.Add(newModel.ObjRefID, newModel); } } catch (Exception) { //Console.WriteLine(ex.StackTrace); } } line = streamReader.ReadLine(); } } } catch (Exception ex) { throw new Exception("Error loading teleport buildings." + ex.Message); } }
public static ModelType GetModelType(DataInfo.MediaModel obj) { ModelType type; string seq = obj.Classes.A.ToString() + obj.Classes.B.ToString() + obj.Classes.C.ToString() + obj.Classes.D.ToString() + obj.Classes.E.ToString() + obj.Classes.F.ToString(); if (seq == "011234") { type = ModelType.PickupPet; } else if (seq == "011233") { type = ModelType.AttackPet; } else if (seq == "011231") { type = ModelType.NormalPet; } else if (seq == "011232") { type = ModelType.JobPet; } else if (seq == "111232") { type = ModelType.JobSilkPet; } else if (seq == "011220") { type = ModelType.NPC; } else if (seq.StartsWith("01121")) { type = ModelType.Mob; } else if (seq == "011100") { type = ModelType.Character; } else if (seq == "003350") { type = ModelType.Gold; } else if (seq == "003390") { type = ModelType.QuestItem; } else if (seq.StartsWith("0033111") || seq.StartsWith("0033112")) { type = ModelType.StonesType; } else if (seq.StartsWith("0031")) { type = ModelType.PlusItem; } else if (seq.StartsWith("0033")) { type = ModelType.CountableItem; } else if (seq.StartsWith("1033")) { type = ModelType.MallCountItem; } else if (seq.StartsWith("1031")) { type = ModelType.MallPlusItem; } else if (seq == "011212") { type = ModelType.NPCMob; } else if (seq.StartsWith("00411")) { type = ModelType.Portal1; } else if (seq == "004120") { type = ModelType.Portal2; } else if (seq.StartsWith("01125")) { type = ModelType.Structure; } else { type = ModelType.Unknown; } return(type); }
public static void LoadItems() //TODO: Add extra attrs, Add Item Models to MediaModels { try { using (System.IO.StringReader filesReader = new System.IO.StringReader(reader.GetFileText("itemdata.txt"))) { string dataFile = filesReader.ReadLine(); while (dataFile != null) { if (dataFile == "") { continue; } //Console.WriteLine(dataFile); using (System.IO.TextReader streamReader = new System.IO.StringReader(reader.GetFileText(dataFile.ToLower()))) { string line = streamReader.ReadLine(); while (line != null) { if (line == "" || line.Contains('\t') == false) { line = streamReader.ReadLine(); continue; } string[] vars = line.Split('\t'); if (vars.Length >= 118) { try { bool Used = (vars[0] == "1") ? true : false; if (Used) { var newItem = new DataInfo.Item(); var newModel = new DataInfo.MediaModel(); newItem.ObjRefID = newModel.ObjRefID = UInt32.Parse(vars[1]); newItem.MediaName = newModel.MediaName = vars[2]; string SN = vars[5]; if (Data.Translation.ContainsKey(SN)) { newItem.TranslationName = newModel.TranslationName = Data.Translation[SN]; } SN = vars[6]; if (Data.Translation.ContainsKey(SN)) { newItem.Description = newModel.TranslationName = Data.Translation[SN]; } newItem.Classes.A = newModel.Classes.A = Int32.Parse(vars[7]); newItem.Classes.B = newModel.Classes.B = Int32.Parse(vars[8]); newItem.Classes.C = newModel.Classes.C = Int32.Parse(vars[9]); newItem.Classes.D = newModel.Classes.D = Int32.Parse(vars[10]); newItem.Classes.E = newModel.Classes.E = Int32.Parse(vars[11]); newItem.Classes.F = newModel.Classes.F = Int32.Parse(vars[12]); newItem.Type = Utility.GetItemType(newItem); newModel.Type = ModelType.Unknown; newItem.MaxStack = Int32.Parse(vars[57]); newItem.Degree = Utility.GetItemDegree(byte.Parse(vars[33])); if (newItem.Degree == 0) //No required level items. { byte.Parse(vars[61]); } newItem.Duration = Int32.Parse(vars[118]); newItem.SOX = (Int32.Parse(vars[15]) == 2); if (newItem.Type == ItemType.RidePet) { if (Int32.Parse(vars[61]) == 5) { newItem.Type = ItemType.TradeRidePet; } } Data.MediaItems.Add(newItem.ObjRefID, newItem); Data.MediaModels.Add(newModel.ObjRefID, newModel); } } catch (Exception) { //Console.WriteLine(ex.Message + ex.StackTrace); } } line = streamReader.ReadLine(); } } dataFile = filesReader.ReadLine(); } } } catch (Exception ex) { throw new Exception("Error loading Items." + ex.Message); } }