public Dragon(DragonInfo info) { Info = info; }
public void LoadDB() { lock (LoadLock) { if (!File.Exists(DatabasePath)) SaveDB(); using (FileStream stream = File.OpenRead(DatabasePath)) using (BinaryReader reader = new BinaryReader(stream)) { LoadVersion = reader.ReadInt32(); if (LoadVersion > 57) LoadCustomVersion = reader.ReadInt32(); MapIndex = reader.ReadInt32(); ItemIndex = reader.ReadInt32(); MonsterIndex = reader.ReadInt32(); if (LoadVersion > 33) { NPCIndex = reader.ReadInt32(); QuestIndex = reader.ReadInt32(); } int count = reader.ReadInt32(); MapInfoList.Clear(); for (int i = 0; i < count; i++) MapInfoList.Add(new MapInfo(reader)); count = reader.ReadInt32(); ItemInfoList.Clear(); for (int i = 0; i < count; i++) { ItemInfoList.Add(new ItemInfo(reader, LoadVersion, LoadCustomVersion)); if ((ItemInfoList[i] != null) && (ItemInfoList[i].RandomStatsId < Settings.RandomItemStatsList.Count)) { ItemInfoList[i].RandomStats = Settings.RandomItemStatsList[ItemInfoList[i].RandomStatsId]; } } count = reader.ReadInt32(); MonsterInfoList.Clear(); for (int i = 0; i < count; i++) MonsterInfoList.Add(new MonsterInfo(reader)); if (LoadVersion > 33) { count = reader.ReadInt32(); NPCInfoList.Clear(); for (int i = 0; i < count; i++) NPCInfoList.Add(new NPCInfo(reader)); count = reader.ReadInt32(); QuestInfoList.Clear(); for (int i = 0; i < count; i++) QuestInfoList.Add(new QuestInfo(reader)); } if (LoadVersion >= 11) DragonInfo = new DragonInfo(reader); else DragonInfo = new DragonInfo(); if (LoadVersion >= 58) { count = reader.ReadInt32(); for (int i = 0; i < count; i++) MagicInfoList.Add(new MagicInfo(reader)); } FillMagicInfoList(); } Settings.LinkGuildCreationItems(ItemInfoList); } }
public void LoadDB() { lock (LoadLock) { if (!File.Exists(DatabasePath)) SaveDB(); using (FileStream stream = File.OpenRead(DatabasePath)) using (BinaryReader reader = new BinaryReader(stream)) { LoadVersion = reader.ReadInt32(); if (LoadVersion > 57) LoadCustomVersion = reader.ReadInt32(); MapIndex = reader.ReadInt32(); ItemIndex = reader.ReadInt32(); MonsterIndex = reader.ReadInt32(); if (LoadVersion > 33) { NPCIndex = reader.ReadInt32(); QuestIndex = reader.ReadInt32(); } if (LoadVersion >= 63) { GameshopIndex = reader.ReadInt32(); } if (LoadVersion >= 66) { ConquestIndex = reader.ReadInt32(); } if (LoadVersion >= 68) RespawnIndex = reader.ReadInt32(); int count = reader.ReadInt32(); MapInfoList.Clear(); for (int i = 0; i < count; i++) MapInfoList.Add(new MapInfo(reader)); count = reader.ReadInt32(); ItemInfoList.Clear(); for (int i = 0; i < count; i++) { ItemInfoList.Add(new ItemInfo(reader, LoadVersion, LoadCustomVersion)); if ((ItemInfoList[i] != null) && (ItemInfoList[i].RandomStatsId < Settings.RandomItemStatsList.Count)) { ItemInfoList[i].RandomStats = Settings.RandomItemStatsList[ItemInfoList[i].RandomStatsId]; } } count = reader.ReadInt32(); MonsterInfoList.Clear(); for (int i = 0; i < count; i++) MonsterInfoList.Add(new MonsterInfo(reader)); if (LoadVersion > 33) { count = reader.ReadInt32(); NPCInfoList.Clear(); for (int i = 0; i < count; i++) NPCInfoList.Add(new NPCInfo(reader)); count = reader.ReadInt32(); QuestInfoList.Clear(); for (int i = 0; i < count; i++) QuestInfoList.Add(new QuestInfo(reader)); } if (LoadVersion >= 11) DragonInfo = new DragonInfo(reader); else DragonInfo = new DragonInfo(); if (LoadVersion >= 58) { count = reader.ReadInt32(); for (int i = 0; i < count; i++) MagicInfoList.Add(new MagicInfo(reader, LoadVersion, LoadCustomVersion)); } FillMagicInfoList(); if (LoadVersion <= 70) UpdateMagicInfo(); if (LoadVersion >= 63) { count = reader.ReadInt32(); GameShopList.Clear(); for (int i = 0; i < count; i++) { GameShopItem item = new GameShopItem(reader, LoadVersion, LoadCustomVersion); if (SMain.Envir.BindGameShop(item)) { GameShopList.Add(item); } } } if (LoadVersion >= 66) { ConquestInfos.Clear(); count = reader.ReadInt32(); for (int i = 0; i < count; i++) { ConquestInfos.Add(new ConquestInfo(reader)); } } if (LoadVersion > 67) RespawnTick = new RespawnTimer(reader); } Settings.LinkGuildCreationItems(ItemInfoList); } }