Skip to content

Commit

Permalink
resolved skill init and skill floating value issues
Browse files Browse the repository at this point in the history
*. skillSys.Init() should be called in SkillSystem as suggested in comments;
*. skillLevelGet_1007D430 should be used in inventory as suggested in comments;
  • Loading branch information
anatoliy_savchak committed Jan 1, 2021
1 parent 402a0a3 commit 8f40be5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion TemplePlus/gamesystems/gamesystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ void GameSystems::InitializeSystems(LoadingScreen& loadingScreen) {
loadingScreen.SetProgress(79 / 79.0f);
mPathX = InitializeSystem<PathXSystem>(loadingScreen, mConfig);
mPoison = InitializeSystem<PoisonSystem>(loadingScreen);
skillSys.Init();
}

void GameSystems::EndGame() {
Expand Down
1 change: 1 addition & 0 deletions TemplePlus/gamesystems/legacysystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ SkillSystem::SkillSystem(const GameSystemConf &config) {
if (!startup(&config)) {
throw TempleException("Unable to initialize game system Skill");
}
skillSys.Init();
}
SkillSystem::~SkillSystem() {
auto shutdown = temple::GetPointer<void()>(0x1007d0c0);
Expand Down
6 changes: 4 additions & 2 deletions TemplePlus/inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,8 @@ int InventorySystem::IsTradeGoods(objHndl item)

int InventorySystem::GetAppraisedWorth(objHndl item, objHndl appraiser, objHndl vendor, SkillEnum skillEnum)
{
auto skillLevel = dispatch.dispatch1ESkillLevel(appraiser, skillEnum, nullptr, objHndl::null, 1);
auto skillLevelGet_1007D430 = temple::GetRef<double(__cdecl)(objHndl, int)>(0x1007D430);
auto skillLevel = skillLevelGet_1007D430(appraiser, skillEnum);
if (skillLevel > 19) skillLevel = 19;

double price = (double)GetSellWorth(item, appraiser, vendor, skillEnum);
Expand Down Expand Up @@ -1404,7 +1405,8 @@ int InventorySystem::GetAppraisedWorth(objHndl item, objHndl appraiser, objHndl

int InventorySystem::GetAppraisedTransactionSum(objHndl item, objHndl parent, objHndl appraiser, SkillEnum skillEnum)
{
auto skillLevel = dispatch.dispatch1ESkillLevel(appraiser, skillEnum, nullptr, objHndl::null, 1);
auto skillLevelGet_1007D430 = temple::GetRef<double(__cdecl)(objHndl, int)>(0x1007D430);
auto skillLevel = skillLevelGet_1007D430(appraiser, skillEnum);
if (skillLevel > 19) skillLevel = 19;

double price = (double)GetSellWorth(item, parent, appraiser, skillEnum);
Expand Down

0 comments on commit 8f40be5

Please sign in to comment.