ksys/act: Start adding actInfoCommon

This commit is contained in:
Léo Lam
2021-01-09 16:59:00 +01:00
parent 9069c4e9f8
commit 8569722db6
6 changed files with 205 additions and 37 deletions
@@ -66,6 +66,8 @@ target_sources(uking PRIVATE
actBaseProcUnit.h
actDebug.cpp
actDebug.h
actInfoCommon.cpp
actInfoCommon.h
actInfoData.cpp
actInfoData.h
actInstParamPack.cpp
@@ -0,0 +1,118 @@
#include "KingSystem/ActorSystem/actInfoCommon.h"
#include "KingSystem/ActorSystem/actInfoData.h"
namespace ksys::act {
bool getSystemIsGetItemSelf(InfoData* data, const char* actor) {
return data->getBool(actor, "systemIsGetItemSelf");
}
bool getSystemIsGetItemSelf(const al::ByamlIter& iter) {
return InfoData::getBoolByKey(iter, "systemIsGetItemSelf");
}
int getGeneralLife(InfoData* data, const char* actor) {
return data->getInt(actor, "generalLife", 100);
}
int getGeneralLife(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "generalLife", 100);
}
int getEnemyRank(InfoData* data, const char* actor) {
return data->getInt(actor, "enemyRank");
}
int getAttackPower(InfoData* data, const char* actor) {
return data->getInt(actor, "attackPower");
}
int getWeaponCommonGuardPower(InfoData* data, const char* actor) {
return data->getInt(actor, "weaponCommonGuardPower");
}
float getWeaponCommonSharpWeaponPer(InfoData* data, const char* actor) {
return data->getFloat(actor, "weaponCommonSharpWeaponPer", 10.0);
}
int getWeaponCommonSharpWeaponAddAtkMin(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddAtkMin");
}
int getWeaponCommonSharpWeaponAddAtkMax(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddAtkMax");
}
int getWeaponCommonSharpWeaponAddLifeMin(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddLifeMin");
}
int getWeaponCommonSharpWeaponAddLifeMax(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddLifeMax");
}
bool getWeaponCommonSharpWeaponAddCrit(const al::ByamlIter& iter) {
return InfoData::getBoolByKey(iter, "weaponCommonSharpWeaponAddCrit");
}
int getWeaponCommonSharpWeaponAddGuardMin(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddGuardMin");
}
int getWeaponCommonSharpWeaponAddGuardMax(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddGuardMax");
}
int getWeaponCommonPoweredSharpAddAtkMin(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddAtkMin");
}
int getWeaponCommonPoweredSharpAddAtkMax(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddAtkMax");
}
int getWeaponCommonPoweredSharpAddLifeMin(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddLifeMin");
}
int getWeaponCommonPoweredSharpAddLifeMax(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddLifeMax");
}
int getWeaponCommonPoweredSharpAddGuardMin(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddGuardMin");
}
int getWeaponCommonPoweredSharpAddGuardMax(const al::ByamlIter& iter) {
return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddGuardMax");
}
float getWeaponCommonPoweredSharpAddThrowMin(const al::ByamlIter& iter) {
return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddThrowMin", 1.0);
}
float getWeaponCommonPoweredSharpAddThrowMax(const al::ByamlIter& iter) {
return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddThrowMax", 1.0);
}
bool getWeaponCommonPoweredSharpAddSpreadFire(const al::ByamlIter& iter) {
return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddSpreadFire");
}
bool getWeaponCommonPoweredSharpAddZoomRapid(const al::ByamlIter& iter) {
return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddZoomRapid");
}
float getWeaponCommonPoweredSharpAddRapidFireMin(const al::ByamlIter& iter) {
return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddRapidFireMin", 1.0);
}
float getWeaponCommonPoweredSharpAddRapidFireMax(const al::ByamlIter& iter) {
return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddRapidFireMax", 1.0);
}
bool getWeaponCommonPoweredSharpAddSurfMaster(const al::ByamlIter& iter) {
return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddSurfMaster");
}
} // namespace ksys::act
@@ -0,0 +1,45 @@
#pragma once
namespace al {
class ByamlIter;
}
namespace ksys::act {
class InfoData;
bool getSystemIsGetItemSelf(InfoData* data, const char* actor);
bool getSystemIsGetItemSelf(const al::ByamlIter& iter);
int getGeneralLife(InfoData* data, const char* actor);
int getGeneralLife(const al::ByamlIter& iter);
int getEnemyRank(InfoData* data, const char* actor);
int getAttackPower(InfoData* data, const char* actor);
int getWeaponCommonGuardPower(InfoData* data, const char* actor);
float getWeaponCommonSharpWeaponPer(InfoData* data, const char* actor);
int getWeaponCommonSharpWeaponAddAtkMin(const al::ByamlIter& iter);
int getWeaponCommonSharpWeaponAddAtkMax(const al::ByamlIter& iter);
int getWeaponCommonSharpWeaponAddLifeMin(const al::ByamlIter& iter);
int getWeaponCommonSharpWeaponAddLifeMax(const al::ByamlIter& iter);
bool getWeaponCommonSharpWeaponAddCrit(const al::ByamlIter& iter);
int getWeaponCommonSharpWeaponAddGuardMin(const al::ByamlIter& iter);
int getWeaponCommonSharpWeaponAddGuardMax(const al::ByamlIter& iter);
int getWeaponCommonPoweredSharpAddAtkMin(const al::ByamlIter& iter);
int getWeaponCommonPoweredSharpAddAtkMax(const al::ByamlIter& iter);
int getWeaponCommonPoweredSharpAddLifeMin(const al::ByamlIter& iter);
int getWeaponCommonPoweredSharpAddLifeMax(const al::ByamlIter& iter);
int getWeaponCommonPoweredSharpAddGuardMin(const al::ByamlIter& iter);
int getWeaponCommonPoweredSharpAddGuardMax(const al::ByamlIter& iter);
float getWeaponCommonPoweredSharpAddThrowMin(const al::ByamlIter& iter);
float getWeaponCommonPoweredSharpAddThrowMax(const al::ByamlIter& iter);
bool getWeaponCommonPoweredSharpAddSpreadFire(const al::ByamlIter& iter);
bool getWeaponCommonPoweredSharpAddZoomRapid(const al::ByamlIter& iter);
float getWeaponCommonPoweredSharpAddRapidFireMin(const al::ByamlIter& iter);
float getWeaponCommonPoweredSharpAddRapidFireMax(const al::ByamlIter& iter);
bool getWeaponCommonPoweredSharpAddSurfMaster(const al::ByamlIter& iter);
} // namespace ksys::act
+3 -3
View File
@@ -204,7 +204,7 @@ void InfoData::getRecipeInfo(const char* actor, InfoData::RecipeInfo& info) cons
}
}
s32 InfoData::getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_) {
s32 InfoData::getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_, bool) {
s32 value;
return iter.tryGetIntByKey(&value, key) ? value : default_;
}
@@ -511,12 +511,12 @@ bool InfoData::getBool(const char* actor, const char* key, bool default_, bool x
return getBoolByKey(iter, key, default_);
}
f32 InfoData::getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_) {
f32 InfoData::getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_, bool) {
f32 value;
return iter.tryGetFloatByKey(&value, key) ? value : default_;
}
bool InfoData::getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_) {
bool InfoData::getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_, bool) {
bool value;
return iter.tryGetBoolByKey(&value, key) ? value != 0 : default_;
}
+6 -3
View File
@@ -133,9 +133,12 @@ public:
f32 getFloat(const char* actor, const char* key, f32 default_ = 0, bool x = true) const;
bool getBool(const char* actor, const char* key, bool default_ = false, bool x = true) const;
static s32 getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_ = 0);
static f32 getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_ = 0);
static bool getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_ = false);
static s32 getIntByKey(const al::ByamlIter& iter, const char* key, s32 default_ = 0,
bool x = true);
static f32 getFloatByKey(const al::ByamlIter& iter, const char* key, f32 default_ = 0,
bool x = true);
static bool getBoolByKey(const al::ByamlIter& iter, const char* key, bool default_ = false,
bool x = true);
static const char* getStringByKey(const al::ByamlIter& iter, const char* key,
const sead::SafeString& default_);