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); |
|
} |
idxvariable should be declared upper then cycleforeach (var npcDialogSectionProperty in typeof(NPCDialogSection).GetProperties())In this moment every
NPCDialogDifficultyinNPCDialogSectionhave same dataD2SLib/src/Model/Save/NPCDialogs.cs
Lines 30 to 45 in c74bb90