private static void ChangeQuest(Constants.Difficulty difficulty, Constants.Act act, Constants.Quest quest, bool complete, byte[] rawSaveFile) { int offset = Constants.QUESTS_SECTION_OFFSET + GetQuestOffset(difficulty, act, quest); if (offset == -1) { return; } if (complete) { rawSaveFile[offset] = 0x01; // Quest complete rawSaveFile[offset + 1] = 0x10; // Quest log animation viewed if (act == Constants.Act.LordOfDestruction && quest == Constants.Quest.ThirdQuest) { // Scroll of resist rawSaveFile[offset] += 0xC0; } } else { rawSaveFile[offset] = 0; rawSaveFile[offset + 1] = 0; } // Allow travel to the next act. // For Act4, the diablo quest is quest2 if (complete && (quest == Constants.Quest.SixthQuest || (act == Constants.Act.TheHarrowing && quest == Constants.Quest.SecondQuest))) { if (act != Constants.Act.TheHarrowing) { rawSaveFile[offset + 2] = 1; } else { rawSaveFile[offset + 4] = 1; } } }
private static int GetQuestOffset(Constants.Difficulty difficulty, Constants.Act act, Constants.Quest quest) { int offset = -1; if (act != Constants.Act.TheHarrowing || quest < Constants.Quest.FourthQuest) { offset = 12; // 10 bytes for the quest header, 2 bytes for the act introduction offset += (int)difficulty * 96; // choose to the right difficulty offset += (int)act * 16; // choose to the right act offset += (int)quest * 2; // choose the right quest if (act == Constants.Act.LordOfDestruction) { offset += 4; // there are additional bytes in act 4 } } return(offset); }