using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Models
{
public sealed class LevelDetail
{
/// Internal level name
public string Name { get; set; }
/// Level ID (Used in columns like VIS0-1)
public int Id { get; set; }
/// Palette
public int Pal { get; set; }
/// Act
public int Act { get; set; }
/// What layer the level is on (surface levels are always 0)
public int Layer { get; set; }
/// Horizontal size of the level
public int SizeX { get; set; }
/// Vertical size of the level
public int SizeY { get; set; }
/// Horizontal Placement Offset
public int OffsetX { get; set; }
/// Vertical placement offset
public int OffsetY { get; set; }
/// Special setting for levels that aren't random or preset (like Outer Cloister and Arcane Sancturary)
public int Depend { get; set; }
/// If true, it rains (or snows)
public int Rain { get; set; }
/// Unused
public int Mud { get; set; }
/// Perspective mode forced to off if set to 1
public int NoPer { get; set; }
/// Level of sight drawing
public int LOSDraw { get; set; }
/// Unknown
public int FloorFilter { get; set; }
/// Unknown
public int BlankScreen { get; set; }
/// For levels bordered with mountains or walls
public int DrawEdges { get; set; }
/// Set to 1 if this is underground or inside
public int IsInside { get; set; }
/// Setting for Level Generation: 1=Random Size, amount of rooms defined by LVLMAZE.TXT, 2=pre set map (example: catacombs lvl4) and 3=Random Area with preset size (wildernesses)
public int DrlgType { get; set; }
/// The level id to reference in lvltypes.txt
public int LevelType { get; set; }
/// Setting Regarding Level Type for lvlsub.txt (6=wilderness, 9=desert etc, -1=no subtype)
public int SubType { get; set; }
///
public int SubTheme { get; set; }
///
public int SubWaypoint { get; set; }
///
public int SubShrine { get; set; }
/// Entry/Exit to level #1-#8
public int[] Vis0_7 { get; set; }
/// ID into lvlwarp.txt
public int[] Warp0_7 { get; set; }
/// Light intensity (0-255)
public int Intensity { get; set; }
///
public int Red { get; set; }
///
public int Green { get; set; }
///
public int Blue { get; set; }
/// Unknown
public int Portal { get; set; }
/// Settings for preset levels
public int Position { get; set; }
/// If true, monster/creatures get saved/loaded instead of despawning.
public int SaveMonsters { get; set; }
/// Quest flags
public int Quest { get; set; }
/// Usually 2025, unknown
public int WarpDist { get; set; }
/// Level on Normal (controls the item level of items that drop from chests etc)
public int MonLvl1 { get; set; }
/// Level on Nightmare (controls the item level of items that drop from chests etc)
public int MonLvl2 { get; set; }
/// Level on Hell (controls the item level of items that drop from chests etc)
public int MonLvl3 { get; set; }
/// The Density of Monsters
public int MonDen { get; set; }
/// Minimum Unique and Champion Monsters Spawned in this Level
public int MonUMin { get; set; }
/// Maximum Unique and Champion Monsters Spawned in this Level
public int MonUMax { get; set; }
///
public int MonWndr { get; set; }
///
public int MonSpcWalk { get; set; }
/// How many different Species of Monsters can occur in this area (example: if you use M1-25 then set Mtot to 25 etc)
public int Mtot { get; set; }
/// Monster Species 1-25 (use ID from MonStats.txt)
public int[] M1_25 { get; set; }
/// Spawned Species 1-25 (use ID from MonStats for Monsters which have eSpawnCol set to 2, related to M1-25, eg: if M1 Spawns S1 will Spawn)
public int[] S1_25 { get; set; }
/// How many different Species of Monsters can spawn as Uniques and Champions in this Area (works like Mtot)
public int Utot { get; set; }
/// Unique Species 1-25 (same as M1-M25 just for Monsters that you want to appear as Unique/Champions)
public int[] U1_25 { get; set; }
/// Critter Species 1-5 (For monsters set to 1 in the IsCritter Column in MonStats.txt)
public int[] C1_5 { get; set; }
/// Related to C1-5, eg: if you spawn a critter thru C1 then set this column to 30 etc. (function unknown)
public int[] CA1_5 { get; set; }
/// Unknown
public int[] CD1_5 { get; set; }
/// unknown
public int Themes { get; set; }
/// Referes to a entry in SoundEnviron.txt (for the Levels Music)
public int SoundEnv { get; set; }
/// 255=No way Point, other #'s Waypoint ID
public int Waypoint { get; set; }
/// String Code for the Display name of the Level
public string LevelName { get; set; }
/// String Code for the Display name of a entrance to this Level
public string LevelWarp { get; set; }
/// Which *.DC6 Title Image is loaded when you enter this area
public string EntryFile { get; set; }
/// Use the ID of the ObjectGroup you want to Spawn in this Area (from ObjectGroups.txt)
public int[] ObjGrp0_7 { get; set; }
/// Object Spawn Possibility: the Chance for this object to occur (if you use ObjGrp0 then set ObjPrb0 to a value below 100)
public int[] ObjPrb0_7 { get; set; }
/// Unused
public bool Beta { get; set; }
}
public static class LevelDetailHelper
{
public static LevelDetail ToLevelDetail(this string[] v)
{
var result = new LevelDetail();
int i = 0;
result.Name = v[i++];
result.Id = Convert.ToInt32(v[i++]);
result.Pal = Convert.ToInt32(v[i++]);
result.Act = Convert.ToInt32(v[i++]);
result.Layer = Convert.ToInt32(v[i++]);
result.SizeX = Convert.ToInt32(v[i++]);
result.SizeY = Convert.ToInt32(v[i++]);
result.OffsetX = Convert.ToInt32(v[i++]);
result.OffsetY = Convert.ToInt32(v[i++]);
result.Depend = Convert.ToInt32(v[i++]);
result.Rain = Convert.ToInt32(v[i++]);
result.Mud = Convert.ToInt32(v[i++]);
result.NoPer = Convert.ToInt32(v[i++]);
result.LOSDraw = Convert.ToInt32(v[i++]);
result.FloorFilter = Convert.ToInt32(v[i++]);
result.BlankScreen = Convert.ToInt32(v[i++]);
result.DrawEdges = Convert.ToInt32(v[i++]);
result.IsInside = Convert.ToInt32(v[i++]);
result.DrlgType = Convert.ToInt32(v[i++]);
result.LevelType = Convert.ToInt32(v[i++]);
result.SubType = Convert.ToInt32(v[i++]);
result.SubTheme = Convert.ToInt32(v[i++]);
result.SubWaypoint = Convert.ToInt32(v[i++]);
result.SubShrine = Convert.ToInt32(v[i++]);
result.Vis0_7 = new int[8];
for (int j = 0; j < 8; j++) result.Vis0_7[j] = Convert.ToInt32(v[i++]);
result.Warp0_7 = new int[8];
for (int j = 0; j < 8; j++) result.Warp0_7[j] = Convert.ToInt32(v[i++]);
result.Intensity = Convert.ToInt32(v[i++]);
result.Red = Convert.ToInt32(v[i++]);
result.Green = Convert.ToInt32(v[i++]);
result.Blue = Convert.ToInt32(v[i++]);
result.Portal = Convert.ToInt32(v[i++]);
result.Position = Convert.ToInt32(v[i++]);
result.SaveMonsters = Convert.ToInt32(v[i++]);
result.Quest = Convert.ToInt32(v[i++]);
result.WarpDist = Convert.ToInt32(v[i++]);
result.MonLvl1 = Convert.ToInt32(v[i++]);
result.MonLvl2 = Convert.ToInt32(v[i++]);
result.MonLvl3 = Convert.ToInt32(v[i++]);
result.MonDen = Convert.ToInt32(v[i++]);
result.MonUMin = Convert.ToInt32(v[i++]);
result.MonUMax = Convert.ToInt32(v[i++]);
result.MonWndr = Convert.ToInt32(v[i++]);
result.MonSpcWalk = Convert.ToInt32(v[i++]);
result.Mtot = Convert.ToInt32(v[i++]);
result.M1_25 = new int[25];
for (int j = 0; j < 25; j++) result.M1_25[j] = Convert.ToInt32(v[i++]);
result.S1_25 = new int[25];
for (int j = 0; j < 25; j++) result.S1_25[j] = Convert.ToInt32(v[i++]);
result.Utot = Convert.ToInt32(v[i++]);
result.U1_25 = new int[25];
for (int j = 0; j < 25; j++) result.U1_25[j] = Convert.ToInt32(v[i++]);
result.C1_5 = new int[5];
for (int j = 0; j < 5; j++) result.C1_5[j] = Convert.ToInt32(v[i++]);
result.CA1_5 = new int[5];
for (int j = 0; j < 5; j++) result.CA1_5[j] = Convert.ToInt32(v[i++]);
result.CD1_5 = new int[5];
for (int j = 0; j < 5; j++) result.CD1_5[j] = Convert.ToInt32(v[i++]);
result.Themes = Convert.ToInt32(v[i++]);
result.SoundEnv = Convert.ToInt32(v[i++]);
result.Waypoint = Convert.ToInt32(v[i++]);
result.LevelName = v[i++];
result.LevelWarp = v[i++];
result.EntryFile = v[i++];
result.ObjGrp0_7 = new int[8];
for (int j = 0; j < 5; j++) result.ObjGrp0_7[j] = Convert.ToInt32(v[i++]);
result.ObjPrb0_7 = new int[8];
for (int j = 0; j < 5; j++) result.ObjPrb0_7[j] = Convert.ToInt32(v[i++]);
result.Beta = Convert.ToInt32(v[i++]) == 1;
return result;
}
}
}