Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename/clarify D2Common_11246 and its parameters #124

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion D2.Detours.patches/1.10f/D2Common.patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ static PatchAction patchActions[GetOrdinalCount()] = {
PatchAction::FunctionReplacePatchByOriginal, // STATLIST_GetBaseStatsData @11243
PatchAction::FunctionReplacePatchByOriginal, // ITEMS_GetRealmData @11244
PatchAction::FunctionReplacePatchByOriginal, // ITEMS_SetRealmData @11245
PatchAction::FunctionReplacePatchByOriginal, // D2Common_11246 @11246
PatchAction::FunctionReplacePatchByOriginal, // MONSTERS_ApplyClassicScaling @11246
PatchAction::FunctionReplacePatchByOriginal, // DATATBLS_GetMonsterLevelInArea @11247
PatchAction::FunctionReplacePatchByOriginal, // D2Common_11248 @11248
PatchAction::FunctionReplacePatchByOriginal, // DATATBLS_GetExpRatio @11249
Expand Down
2 changes: 1 addition & 1 deletion source/D2Common/definitions/D2Common.1.10f.def
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ EXPORTS
STATLIST_GetBaseStatsData @11243
ITEMS_GetRealmData @11244
ITEMS_SetRealmData @11245
D2Common_11246 @11246
MONSTERS_ApplyClassicScaling @11246
DATATBLS_GetMonsterLevelInArea @11247
D2Common_11248 @11248
DATATBLS_GetExpRatio @11249
Expand Down
2 changes: 1 addition & 1 deletion source/D2Common/include/D2Monsters.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ D2COMMON_DLL_DECL void __stdcall D2Common_11066(D2UnitStrc* pMonster, int* pDire
//D2Common.0x6FDA6730 (#11067)
D2COMMON_DLL_DECL int __stdcall MONSTERS_GetHirelingTypeId(D2UnitStrc* pHireling);
//D2Common.0x6FDA6790 (#11246)
D2COMMON_DLL_DECL void __stdcall D2Common_11246(D2UnitStrc* pMonster, int a2, uint8_t a3);
D2COMMON_DLL_DECL void __stdcall MONSTERS_ApplyClassicScaling(D2UnitStrc* pMonster, BOOL bExpansion, uint8_t nDifficulty);
//D2Common.0x6FDA6920
int __fastcall MONSTERS_GetBaseIdFromMonsterId(int nMonsterId);
//D2Common.0x6FDA6950
Expand Down
6 changes: 3 additions & 3 deletions source/D2Common/src/Monsters/Monsters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1257,19 +1257,19 @@ int __stdcall MONSTERS_GetHirelingTypeId(D2UnitStrc* pHireling)
}

//D2Common.0x6FDA6790 (#11246)
void __stdcall D2Common_11246(D2UnitStrc* pMonster, int a2, uint8_t a3)
void __stdcall MONSTERS_ApplyClassicScaling(D2UnitStrc* pMonster, BOOL bExpansion, uint8_t nDifficulty)
{
D2MonStatsTxt* pMonStatsTxtRecord = NULL;

if (!a2 && a3 && pMonster && pMonster->dwUnitType == UNIT_MONSTER)
if (!bExpansion && nDifficulty && pMonster && pMonster->dwUnitType == UNIT_MONSTER)
{
pMonStatsTxtRecord = DATATBLS_GetMonStatsTxtRecord(pMonster->dwClassId);
if (pMonStatsTxtRecord && pMonStatsTxtRecord->nAlign != 1)
{
STATLIST_SetUnitStat(pMonster, STAT_MAXHP, STATLIST_UnitGetStatValue(pMonster, STAT_MAXHP, 0) / 2, 0);
STATLIST_SetUnitStat(pMonster, STAT_ARMORCLASS, 10 * STATLIST_UnitGetStatValue(pMonster, STAT_ARMORCLASS, 0) / 12, 0);
STATLIST_SetUnitStat(pMonster, STAT_EXPERIENCE, 10 * STATLIST_UnitGetStatValue(pMonster, STAT_EXPERIENCE, 0) / (a3 == 1 ? 17 : 26), 0);
STATLIST_SetUnitStat(pMonster, STAT_LEVEL, 25 * a3 + pMonStatsTxtRecord->nLevel[0], 0);
STATLIST_SetUnitStat(pMonster, STAT_LEVEL, 25 * nDifficulty + pMonStatsTxtRecord->nLevel[0], 0);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/D2Game/src/MONSTER/Monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void __fastcall MONSTER_InitializeStatsAndSkills(D2GameStrc* pGame, D2RoomStrc*
STATLIST_SetUnitStat(pUnit, STAT_EXPERIENCE, monStatsInit.nExp + MONSTERUNIQUE_CalculatePercentage(monStatsInit.nExp, playerCountBonus.nExperience, 100), 0);
STATLIST_SetUnitStat(pUnit, STAT_HPREGEN, (nShiftedHp * pMonStatsTxtRecord->dwDamageRegen) >> 12, 0);

D2Common_11246(pUnit, pGame->bExpansion, pGame->nDifficulty);
MONSTERS_ApplyClassicScaling(pUnit, pGame->bExpansion, pGame->nDifficulty);

D2COMMON_10475_PostStatToStatList(pUnit, STATLIST_AllocStatList(pGame->pMemoryPool, 1u, 0, UNIT_MONSTER, pUnit->dwUnitId), 1);

Expand Down
Loading