1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-09-16 00:08:29 -04:00
OpenDiablo2/OpenDiablo2.Common/Enums/eLevelId.cs
nicholasdechiara 02e101edb8 Filled out eLevelId enum (#16)
* Filled out eLevelId enum

- Added OpenDiablo2.Core.UT unit test project
- Added ELevelIdHelper class which contains code that generates the enum from the mpq data
- Added a unit test that verifies EngineDataManager works
- Added a unit test that runs the ELevelIdHelper generate function
- Renamed some enum values for constistency (e.g. Act1_Town -> Act1_Town1, as it is in the mpq)

* Retargeted OpenDiablo2.Core.UT to .net Framework 4.6.1

* Added TestConsole

TestConsole currently only supports writing the elevelids enum to a file

Also, removed elevelids generation unit test
2018-11-25 14:12:25 -05:00

68 lines
1.8 KiB
C#

using OpenDiablo2.Common.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eLevelId
{
None,
Act1_Town1 = 1,
Act1_CaveTreasure2 = 13,
Act1_CaveTreasure3 = 14,
Act1_CaveTreasure4 = 15,
Act1_CaveTreasure5 = 16,
Act1_CryptCountessX = 25,
Act1_Tower2 = 20,
Act1_MonFront = 26,
Act1_Courtyard1 = 27,
Act1_Courtyard2 = 32,
Act1_Cathedral = 33,
Act1_Andariel = 37,
Act1_Tristram = 38,
Act2_Town = 40,
Act2_Harem = 50,
Act2_DurielsLair = 73,
Act3_Town = 75,
Act3_DungeonTreasure1 = 90,
Act3_DungeonTreasure2 = 91,
Act3_SewerTreasureX = 93,
Act3_Temple1 = 94,
Act3_Temple2 = 95,
Act3_Temple3 = 96,
Act3_Temple4 = 97,
Act3_Temple5 = 98,
Act3_Temple6 = 99,
Act3_MephistoComplex = 102,
Act4_Fortress = 103,
Act5_Town = 109,
Act5_TempleFinalRoom = 124,
Act5_ThroneRoom = 131,
Act5_WorldStone = 132,
Act5_TempleEntrance = 121,
Act5_BaalEntrance = 120,
}
public class ELevelIdHelper
{
public static string GenerateEnum(List<LevelPreset> levelPresets)
{
string output = string.Empty;
foreach (LevelPreset lp in levelPresets)
{
// need to convert e.g. 'Act 1 - Town 1' to 'Act1_Town'
if (lp.LevelId == 0)
{
continue;
}
string name = lp.Name.Replace(" - ", "_").Replace(" ", "").Replace("'", "");
output += name + " = " + lp.LevelId + ",\r\n";
}
return output;
}
}
}