uking/ui: Implement material sorting for inventory

This commit is contained in:
Léo Lam
2021-01-21 23:57:37 +01:00
parent 7814fd527b
commit 48276bb4e7
6 changed files with 65 additions and 5 deletions
+26 -1
View File
@@ -1,8 +1,10 @@
#include "Game/UI/uiUtils.h"
#include "Game/Actor/actWeapon.h"
#include "Game/DLC/aoc2.h"
#include "Game/UI/uiPauseMenuDataMgr.h"
#include "KingSystem/ActorSystem/actInfoCommon.h"
#include "KingSystem/ActorSystem/actInfoData.h"
#include "Game/UI/uiPauseMenuDataMgr.h"
#include "KingSystem/Utils/Byaml/Byaml.h"
namespace uking::ui {
@@ -10,6 +12,29 @@ bool isMasterSwordItem(const PouchItem& item) {
return item.getType() == PouchItemType::Sword && isMasterSwordActorName(item.getName());
}
int getItemHitPointRecover(const sead::SafeString& name) {
auto* info = ksys::act::InfoData::instance();
if (!info)
return 0;
al::ByamlIter iter;
if (!info->getActorIter(&iter, name.cstr()))
return 0;
if (!info->hasTag(iter, ksys::act::tags::CureItem))
return 0;
if (!info->hasTag(iter, ksys::act::tags::CanUse))
return 0;
int value = ksys::act::getCureItemHitPointRecover(iter);
if (aoc2::instance() && aoc2::instance()->checkFlag(aoc2::Flag::EnableHardMode) &&
aoc2::instance()->isHardModeChangeOn(aoc2::HardModeChange::NerfHpRestore)) {
aoc2::instance()->nerfHpRestore(&value);
}
return value;
}
int getWeaponInventoryLife(const sead::SafeString& name) {
auto* info = ksys::act::InfoData::instance();
if (!info)