mirror of https://github.com/zeldaret/botw.git
uking/ui: Implement getWeaponStats
This commit is contained in:
parent
5280254ef1
commit
39856b1a7d
|
@ -61697,8 +61697,8 @@
|
|||
0x0000007100aa6dd4,sub_7100AA6DD4,120,
|
||||
0x0000007100aa6e4c,sub_7100AA6E4C,324,
|
||||
0x0000007100aa6f90,sub_7100AA6F90,64,
|
||||
0x0000007100aa6fd0,sub_7100AA6FD0,544,
|
||||
0x0000007100aa71f0,sub_7100AA71F0,160,
|
||||
0x0000007100aa6fd0,sub_7100AA6FD0,544,_ZN5uking2ui14getWeaponStatsERKNS0_9PouchItemEPNS0_11WeaponStatsE
|
||||
0x0000007100aa71f0,sub_7100AA71F0,160,_ZN5uking2ui23getBowActorInfoAddValueERKN4sead14SafeStringBaseIcEE
|
||||
0x0000007100aa7290,sub_7100AA7290,344,
|
||||
0x0000007100aa73e8,sub_7100AA73E8,1548,
|
||||
0x0000007100aa79f4,getWeaponGeneralLifeTimes100,92,_ZN5uking2ui22getWeaponInventoryLifeERKN4sead14SafeStringBaseIcEE
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -1,9 +1,11 @@
|
|||
#include "Game/UI/uiUtils.h"
|
||||
#include "Game/Actor/actWeapon.h"
|
||||
#include "Game/DLC/aoc2.h"
|
||||
#include "Game/Damage/dmgInfoManager.h"
|
||||
#include "Game/UI/uiPauseMenuDataMgr.h"
|
||||
#include "KingSystem/ActorSystem/actInfoCommon.h"
|
||||
#include "KingSystem/ActorSystem/actInfoData.h"
|
||||
#include "KingSystem/GameData/gdtCommonFlagsUtils.h"
|
||||
#include "KingSystem/Utils/Byaml/Byaml.h"
|
||||
|
||||
namespace uking::ui {
|
||||
|
@ -35,6 +37,69 @@ int getItemHitPointRecover(const sead::SafeString& name) {
|
|||
return value;
|
||||
}
|
||||
|
||||
void getWeaponStats(const PouchItem& item, WeaponStats* stats) {
|
||||
stats->durability = item.getValue();
|
||||
auto& modifier = stats->modifier;
|
||||
modifier.fromItem(item);
|
||||
|
||||
auto* info = ksys::act::InfoData::instance();
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
if (item.getType() == PouchItemType::Shield) {
|
||||
stats->power = ksys::act::getWeaponCommonGuardPower(info, item.getName().cstr());
|
||||
stats->power += modifier.flags.isOn(act::WeaponModifier::AddGuard) ? modifier.value : 0;
|
||||
|
||||
} else if (isMasterSwordItem(item)) {
|
||||
int power = 0;
|
||||
if (item.getValue() > 0) {
|
||||
const bool is_true_form = dmg::DamageInfoMgr::instance()->isTrueFormMasterSword();
|
||||
auto* info_ = ksys::act::InfoData::instance();
|
||||
const char* name = item.getName().cstr();
|
||||
if (is_true_form) {
|
||||
power = ksys::act::getMasterSwordTrueFormAttackPower(info_, name);
|
||||
} else {
|
||||
const auto attack = ksys::act::getAttackPower(info_, name);
|
||||
power = ksys::gdt::getFlag_MasterSword_Add_Power() + attack;
|
||||
}
|
||||
}
|
||||
stats->power = power;
|
||||
|
||||
} else if (isOneHitObliteratorActorName(item.getName())) {
|
||||
stats->power = dmg::DamageInfoMgr::instance()->isOneHitObliteratorActive() ? 99999 : 1;
|
||||
} else {
|
||||
stats->power =
|
||||
ksys::act::getAttackPower(ksys::act::InfoData::instance(), item.getName().cstr());
|
||||
}
|
||||
|
||||
stats->power += modifier.flags.isOn(act::WeaponModifier::AddAtk) ? modifier.value : 0;
|
||||
|
||||
if (item.getType() == PouchItemType::Bow) {
|
||||
if (modifier.flags.isOn(act::WeaponModifier::AddSpreadFire))
|
||||
stats->bow_add_value = modifier.value;
|
||||
else
|
||||
stats->bow_add_value = getBowActorInfoAddValue(item.getName());
|
||||
}
|
||||
}
|
||||
|
||||
int getBowActorInfoAddValue(const sead::SafeString& name) {
|
||||
auto* info = ksys::act::InfoData::instance();
|
||||
al::ByamlIter iter;
|
||||
if (!info)
|
||||
return 0;
|
||||
|
||||
if (!info->getActorIter(&iter, name.cstr()))
|
||||
return 0;
|
||||
|
||||
if (ksys::act::getBowIsLeadShot(iter))
|
||||
return ksys::act::getBowLeadShotNum(iter);
|
||||
|
||||
if (ksys::act::getBowIsRapidFire(iter))
|
||||
return ksys::act::getBowRapidFireNum(iter);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getWeaponInventoryLife(const sead::SafeString& name) {
|
||||
auto* info = ksys::act::InfoData::instance();
|
||||
if (!info)
|
||||
|
|
|
@ -21,11 +21,14 @@ bool isMasterSwordItem(const PouchItem& item);
|
|||
int getItemHitPointRecover(const sead::SafeString& name);
|
||||
|
||||
void getWeaponStats(const PouchItem& item, WeaponStats* stats);
|
||||
int getBowActorInfoAddValue(const sead::SafeString& name);
|
||||
|
||||
int getWeaponInventoryLife(const sead::SafeString& name);
|
||||
bool isMasterSwordActorName(const sead::SafeString& name);
|
||||
|
||||
// TODO: move this to another translation unit (TBD)
|
||||
// TODO: move these to another translation unit (TBD)
|
||||
// Do not implement until the location is figured out
|
||||
bool isOneHitObliteratorActorName(const sead::SafeString& name);
|
||||
int getItemGeneralLife(const char* name);
|
||||
|
||||
// TODO: move this to yet another translation unit (TBD but not the same one as the above)
|
||||
|
|
Loading…
Reference in New Issue