Skip to content

Commit

Permalink
fix up edge case of Character progression
Browse files Browse the repository at this point in the history
- Updated: Fix up logic around Act V being marked complete when the truth is the game does not mark that act complete when completing that difficulty.
- Updated: Fix up Quest dialog logic to properly handle cases when quests state are modified.
  • Loading branch information
WalterCouto committed Jan 8, 2022
1 parent 4084462 commit b934df1
Show file tree
Hide file tree
Showing 17 changed files with 899 additions and 337 deletions.
Binary file modified D2Editor.exe
Binary file not shown.
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ Check the following site for updates at https://github.com/WalterCouto/D2CE<br>
* [d2s Binary File Format](d2s_File_Format.md)<br>

### Revision History
**Version 2.09 (Jan 8, 2022)**<br>
- Updated: Fix up logic around Act V being marked complete when the truth is the game does not mark that act complete when completing that difficulty.<br>
- Updated: Fix up Quest dialog logic to properly handle cases when quests state are modified.<br>
<br>

**Version 2.08 (Jan 6, 2022)**<br>
- Updated: logic for handling Character progressions properly. Now characer Title, Last Difficulty Played, Last Act Played, or Quest completed will be properly validated.<br>
- Updated: Quest and Waypoint dialogs now properly take into account Character progression.<br>
Expand Down
7 changes: 7 additions & 0 deletions source/D2Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
Revision History
================
Version 2.09 (Jan 8, 2022)
- Updated: Fix up logic around Act V being marked complete
when the truth is the game does not mark that
act complete when completing that difficulty.
- Updated: Fix up Quest dialog logic to properly handle
cases when quests state are modified.
Version 2.08 (Jan 6, 2022)
- Updated: logic for handling Character progressions properly. Now
characer Title, Last Difficulty Played, Last Act Played,
Expand Down
113 changes: 110 additions & 3 deletions source/D2MainForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,26 @@ void CD2MainForm::OnCbnSelchangeCharTitleCmb()
{
bs.Title = getCharacterTitle();
CtrlEditted.insert(CharTitle.GetDlgCtrlID());

std::uint8_t titlePos = (bs.Title.bits() & 0x0C) >> 2;
auto progression = d2ce::EnumDifficulty::Hell;
switch (titlePos)
{
case 0:
progression = d2ce::EnumDifficulty::Normal;
break;

case 1:
progression = d2ce::EnumDifficulty::Nightmare;
break;
}

if (bs.DifficultyLastPlayed > progression)
{
bs.DifficultyLastPlayed = progression;
CtrlEditted.insert(Difficulty.GetDlgCtrlID());
}

CharInfo.updateBasicStats(bs);
UpdateCharInfo();
StatsChanged();
Expand All @@ -1959,12 +1979,11 @@ void CD2MainForm::OnCbnSelchangeCharTitleCmb()
//---------------------------------------------------------------------------
void CD2MainForm::OnCbnSelchangeStartingActCmb()
{
d2ce::EnumAct startingAct = static_cast<d2ce::EnumAct>(StartingAct.GetCurSel());
d2ce::BasicStats bs;
CharInfo.fillBasicStats(bs);
if (bs.StartingAct != startingAct)
if (bs.StartingAct != getStartingAct())
{
bs.StartingAct = startingAct;
bs.StartingAct = getStartingAct();
CtrlEditted.insert(StartingAct.GetDlgCtrlID());
CharInfo.updateBasicStats(bs);
UpdateCharInfo();
Expand All @@ -1976,11 +1995,36 @@ void CD2MainForm::OnCbnSelchangeDifficultyCmb()
{
d2ce::BasicStats bs;
CharInfo.fillBasicStats(bs);
std::uint8_t titlePos = (bs.Title.bits() & 0x0C) >> 2;
auto progression = d2ce::EnumDifficulty::Hell;
switch (titlePos)
{
case 0:
progression = d2ce::EnumDifficulty::Normal;
break;

case 1:
progression = d2ce::EnumDifficulty::Nightmare;
break;
}

bool updateCharInfo = false;
if (bs.DifficultyLastPlayed > progression)
{
updateCharInfo = true;
bs.DifficultyLastPlayed = progression;
}

if (bs.DifficultyLastPlayed != getDifficultyLastPlayed())
{
updateCharInfo = true;
bs.DifficultyLastPlayed = getDifficultyLastPlayed();
CtrlEditted.insert(Difficulty.GetDlgCtrlID());
CharInfo.updateBasicStats(bs);
}

if(updateCharInfo)
{
UpdateCharInfo();
StatsChanged();
}
Expand Down Expand Up @@ -2119,6 +2163,46 @@ void CD2MainForm::UpdateCharInfo()
}
}

if (getDifficultyLastPlayed() != bs.DifficultyLastPlayed)
{
Difficulty.SetCurSel(static_cast<std::underlying_type_t<d2ce::EnumDifficulty>>(bs.DifficultyLastPlayed));
if (bs.DifficultyLastPlayed == Bs.DifficultyLastPlayed)
{
auto iter = CtrlEditted.find(Difficulty.GetDlgCtrlID());
if (iter != CtrlEditted.end())
{
CtrlEditted.erase(iter);
}
}
else
{
CtrlEditted.insert(Difficulty.GetDlgCtrlID());
statsChanged = true;
}
}

if (getStartingAct() != bs.StartingAct)
{
UpdateStartingActDisplay();
if (bs.StartingAct == Bs.StartingAct)
{
auto iter = CtrlEditted.find(StartingAct.GetDlgCtrlID());
if (iter != CtrlEditted.end())
{
CtrlEditted.erase(iter);
}
}
else
{
CtrlEditted.insert(StartingAct.GetDlgCtrlID());
statsChanged = true;
}
}
else
{
UpdateStartingActDisplay();
}

d2ce::CharStats cs;
CharInfo.fillCharacterStats(cs);

Expand Down Expand Up @@ -4209,6 +4293,24 @@ bitmask::bitmask<d2ce::EnumCharTitle> CD2MainForm::getCharacterTitle() const
return title;
}
//---------------------------------------------------------------------------
d2ce::EnumDifficulty CD2MainForm::getCharacterTitleDifficulty() const
{
std::uint8_t titlePos = (getCharacterTitle().bits() & 0x0C) >> 2;
auto progression = d2ce::EnumDifficulty::Hell;
switch (titlePos)
{
case 0:
progression = d2ce::EnumDifficulty::Normal;
break;

case 1:
progression = d2ce::EnumDifficulty::Nightmare;
break;
}

return progression;
}
//---------------------------------------------------------------------------
d2ce::EnumCharClass CD2MainForm::getCharacterClass() const
{
return static_cast<d2ce::EnumCharClass>(CharClass.GetCurSel());
Expand All @@ -4219,6 +4321,11 @@ d2ce::EnumDifficulty CD2MainForm::getDifficultyLastPlayed() const
return static_cast<d2ce::EnumDifficulty>(Difficulty.GetCurSel());
}
//---------------------------------------------------------------------------
d2ce::EnumAct CD2MainForm::getStartingAct() const
{
return static_cast<d2ce::EnumAct>(StartingAct.GetCurSel());
}
//---------------------------------------------------------------------------
std::uint32_t CD2MainForm::getCharacterLevel() const
{
return CharInfo.getLevel();
Expand Down
2 changes: 2 additions & 0 deletions source/D2MainForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,10 @@ class CD2MainForm : public CDialogEx
d2ce::EnumCharVersion getCharacterVersion() const;
bitmask::bitmask<d2ce::EnumCharStatus> getCharacterStatus() const;
bitmask::bitmask<d2ce::EnumCharTitle> getCharacterTitle() const;
d2ce::EnumDifficulty getCharacterTitleDifficulty() const;
d2ce::EnumCharClass getCharacterClass() const;
d2ce::EnumDifficulty getDifficultyLastPlayed() const;
d2ce::EnumAct getStartingAct() const;
std::uint32_t getCharacterLevel() const;

std::uint32_t getWeaponSet() const;
Expand Down
Loading

0 comments on commit b934df1

Please sign in to comment.