dschu012 / D2SLib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Same NPCDialogDifficulty data

Vitalick opened this issue · comments

idx variable should be declared upper then cycle foreach (var npcDialogSectionProperty in typeof(NPCDialogSection).GetProperties())
In this moment every NPCDialogDifficulty in NPCDialogSection have same data

var skippedProperties = new string[] { "Header", "Length" };
foreach (var npcDialogSectionProperty in typeof(NPCDialogSection).GetProperties())
{
if (skippedProperties.Contains(npcDialogSectionProperty.Name)) continue;
NPCDialogDifficulty npcDialogDifficulty = new NPCDialogDifficulty();
int idx = 0;
foreach (var property in typeof(NPCDialogDifficulty).GetProperties())
{
NPCDialogData data = new NPCDialogData();
data.Introduction = bits[idx];
data.Congratulations = bits[idx + (0x18 * 8)];
idx++;
property.SetValue(npcDialogDifficulty, data);
}
npcDialogSectionProperty.SetValue(npcDialogSection, npcDialogDifficulty);
}