Skip to content

Commit

Permalink
isPlayingDLC
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnTW committed Oct 6, 2024
1 parent 2fdc702 commit 64b709c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions M2TWEOP Code/M2TWEOP library/dataOffsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ void dataOffsets::initDataOffsets(int gameVer)
offsets.eventManager = 0x16A7A30;
offsets.currentRegion = 0x18B4800;
offsets.uiStratUiV2 = 0x2C6D1B0;
offsets.isDLC = 0x016A284C;

offsets.audioEnable = reinterpret_cast<bool*>(0x01639f1d);
offsets.audioMaster_vol = reinterpret_cast<int*>(0x01639f60);
Expand Down
1 change: 1 addition & 0 deletions M2TWEOP Code/M2TWEOP library/dataOffsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class dataOffsets
DWORD scriptCountersSet = NULL;
DWORD buildingChainLimit = NULL;
DWORD guildCooldown = NULL;
DWORD isDLC = NULL;


DWORD unitTypesStart = NULL;
Expand Down
16 changes: 16 additions & 0 deletions M2TWEOP Code/M2TWEOP library/types/gameHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,20 @@ namespace gameHelpers
add esp, 0x20
}
}

bool isPlayingDlc()
{
if (getGameVersion() == 1)
return true;
return *reinterpret_cast<bool*>(dataOffsets::offsets.isDLC);
}

void setPlayingDlc(const bool value)
{
if (getGameVersion() == 1)
return;
*reinterpret_cast<bool*>(dataOffsets::offsets.isDLC) = value;
}

void historicEvent(const std::string& name, const std::string& title, const std::string& description, const bool isChoice)
{
Expand Down Expand Up @@ -708,6 +722,7 @@ namespace gameHelpers
@tfield int tutorialBattlePlayed
@tfield int disableVnVs
@tfield int allUsers
@tfield bool isPlayingDlc
@table options1
*/
Expand All @@ -724,6 +739,7 @@ namespace gameHelpers
typeAll.options1.set("isHotseatEnabled", &options1::isHotseatEnabled);
typeAll.options1.set("hotseatAutosave", &options1::hotseatAutosave);
typeAll.options1.set("email", &options1::email);
typeAll.options1.set("isPlayingDlc", sol::property(&isPlayingDlc, &setPlayingDlc));
typeAll.options1.set("saveConfig", &options1::saveConfig);
typeAll.options1.set("closeAfterSave", &options1::closeAfterSave);
typeAll.options1.set("validateData", &options1::validateData);
Expand Down

0 comments on commit 64b709c

Please sign in to comment.