public static bool Deserialize(GenericReader reader) { bool success = false; Map map = null; Point3D location = new Point3D(); MegaSpawner megaSpawner = new MegaSpawner(true); try { int version = reader.ReadInt(); if (version >= 1) { location = reader.ReadPoint3D(); map = reader.ReadMap(); megaSpawner.Active = reader.ReadBool(); megaSpawner.Imported = reader.ReadString(); megaSpawner.ImportVersion = reader.ReadString(); megaSpawner.ContainerSpawn = (Container)reader.ReadItem(); megaSpawner.Workspace = reader.ReadBool(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { megaSpawner.EntryList.Add(reader.ReadString()); } for (int i = 0; i < count; i++) { megaSpawner.SpawnRangeList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.WalkRangeList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { int amount = reader.ReadInt(); if (amount == 0) { amount = 1; } megaSpawner.AmountList.Add(amount); } for (int i = 0; i < count; i++) { megaSpawner.MinDelayList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.MaxDelayList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.SpawnTypeList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.ActivatedList.Add(reader.ReadBool()); } for (int i = 0; i < count; i++) { megaSpawner.EventRangeList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.EventKeywordList.Add(reader.ReadString()); } for (int i = 0; i < count; i++) { megaSpawner.KeywordCaseSensitiveList.Add(reader.ReadBool()); } for (int i = 0; i < count; i++) { megaSpawner.TriggerEventNowList.Add(reader.ReadBool()); } for (int i = 0; i < count; i++) { megaSpawner.EventAmbushList.Add(reader.ReadBool()); } for (int i = 0; i < count; i++) { megaSpawner.BeginTimeBasedList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.EndTimeBasedList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.GroupSpawnList.Add(reader.ReadBool()); } for (int i = 0; i < count; i++) { megaSpawner.MinStackAmountList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.MaxStackAmountList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.MovableList.Add(reader.ReadBool()); } if (version >= 2) { for (int i = 0; i < count; i++) { megaSpawner.MinDespawnList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.MaxDespawnList.Add(reader.ReadInt()); } for (int i = 0; i < count; i++) { megaSpawner.DespawnList.Add(reader.ReadBool()); } for (int i = 0; i < count; i++) { megaSpawner.DespawnGroupList.Add(reader.ReadBool()); } for (int i = 0; i < count; i++) { megaSpawner.DespawnTimeExpireList.Add(reader.ReadBool()); } } else { for (int i = 0; i < count; i++) { megaSpawner.MinDespawnList.Add(1800); } for (int i = 0; i < count; i++) { megaSpawner.MaxDespawnList.Add(3600); } for (int i = 0; i < count; i++) { megaSpawner.DespawnList.Add((bool)false); } for (int i = 0; i < count; i++) { megaSpawner.DespawnGroupList.Add((bool)false); } for (int i = 0; i < count; i++) { megaSpawner.DespawnTimeExpireList.Add((bool)true); } } int settingsCount = reader.ReadInt(); if (version >= 3) { for (int i = 0; i < settingsCount; i++) { ArrayList List = new ArrayList(); Setting setting = (Setting)reader.ReadInt(); List.Add(setting); switch (setting) { case Setting.OverrideIndividualEntries: { List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadBool()); List.Add(reader.ReadBool()); List.Add((SpawnType)reader.ReadInt()); List.Add(reader.ReadString()); List.Add(reader.ReadBool()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); List.Add(reader.ReadBool()); List.Add(reader.ReadBool()); List.Add(reader.ReadBool()); break; } case Setting.AddItem: { List.Add(reader.ReadString()); List.Add(reader.ReadInt()); List.Add(reader.ReadString()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); break; } case Setting.AddContainer: { List.Add(reader.ReadString()); List.Add(reader.ReadInt()); List.Add(reader.ReadString()); List.Add(reader.ReadInt()); List.Add(reader.ReadInt()); int settingCount = reader.ReadInt(); for (int j = 6; j < settingCount; j++) { ArrayList ItemsList = new ArrayList(); ItemsList.Add(reader.ReadString()); ItemsList.Add(reader.ReadInt()); ItemsList.Add(reader.ReadInt()); List.Add(ItemsList); } break; } } megaSpawner.SettingsList.Add(List); } } else { for (int i = 0; i < settingsCount; i++) { megaSpawner.SettingsList.Add(reader.ReadString()); } megaSpawner.ConvertOldSettings(); } } if (megaSpawner.Workspace) { megaSpawner.Delete(); } else { megaSpawner.MoveToWorld(location, map); megaSpawner.Start(); if (megaSpawner.Imported != "") { MC.FileImportAdd(megaSpawner.Imported, megaSpawner.ImportVersion); } megaSpawner.CompileSettings(); megaSpawner.CheckEntryErrors(); megaSpawner.SettingsList.Sort(new MC.SettingsSorter()); if (megaSpawner.OverrideIndividualEntries) { for (int i = 0; i < megaSpawner.OverrideAmount; i++) { megaSpawner.OverrideRespawnEntryList.Add(""); megaSpawner.OverrideRespawnTimeList.Add(0); megaSpawner.OverrideSpawnCounterList.Add(DateTime.Now); megaSpawner.OverrideSpawnTimeList.Add(0); megaSpawner.OverrideDespawnTimeList.Add(0); } } else { for (int i = 0; i < megaSpawner.EntryList.Count; i++) { ArrayList respawnEntryList = new ArrayList(); ArrayList respawnTimeList = new ArrayList(); ArrayList spawnCounterList = new ArrayList(); ArrayList spawnTimeList = new ArrayList(); ArrayList respawnOnSaveList = new ArrayList(); ArrayList despawnTimeList = new ArrayList(); for (int j = 0; j < (int)megaSpawner.AmountList[i]; j++) { respawnEntryList.Add((string)megaSpawner.EntryList[i]); respawnTimeList.Add(0); spawnCounterList.Add(DateTime.Now); spawnTimeList.Add(0); respawnOnSaveList.Add((bool)false); despawnTimeList.Add(0); } megaSpawner.RespawnEntryList.Add(respawnEntryList); megaSpawner.RespawnTimeList.Add(respawnTimeList); megaSpawner.SpawnCounterList.Add(spawnCounterList); megaSpawner.SpawnTimeList.Add(spawnTimeList); megaSpawner.RespawnOnSaveList.Add(respawnOnSaveList); megaSpawner.DespawnTimeList.Add(despawnTimeList); megaSpawner.SpawnedEntries.Add(new ArrayList()); megaSpawner.LastMovedList.Add(new ArrayList()); } } megaSpawner.Respawn(); } success = true; } catch { if (megaSpawner != null) { megaSpawner.Delete(); } } return(success); }