diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 50bad449..65731573 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -73263,8 +73263,8 @@ 0x0000007100d2d7c8,act::getWeaponCommonPoweredSharpAddAtkMax,20,_ZN4ksys3act36getWeaponCommonPoweredSharpAddAtkMaxERKN2al9ByamlIterE 0x0000007100d2d7dc,act::getWeaponCommonPoweredSharpAddLifeMin,20,_ZN4ksys3act37getWeaponCommonPoweredSharpAddLifeMinERKN2al9ByamlIterE 0x0000007100d2d7f0,act::getWeaponCommonPoweredSharpAddLifeMax,20,_ZN4ksys3act37getWeaponCommonPoweredSharpAddLifeMaxERKN2al9ByamlIterE -0x0000007100d2d804,act::getWeaponCommonPoweredSharpAddGuardMin,20,_ZN4ksys3act38getWeaponCommonPoweredSharpAddGuardMinERKN2al9ByamlIterE -0x0000007100d2d818,act::getWeaponCommonPoweredSharpAddGuardMax,20,_ZN4ksys3act38getWeaponCommonPoweredSharpAddGuardMaxERKN2al9ByamlIterE +0x0000007100d2d804,act::getWeaponCommonPoweredSharpAddGuardMin,20,_ZN4ksys3act44getWeaponCommonPoweredSharpWeaponAddGuardMinERKN2al9ByamlIterE +0x0000007100d2d818,act::getWeaponCommonPoweredSharpAddGuardMax,20,_ZN4ksys3act44getWeaponCommonPoweredSharpWeaponAddGuardMaxERKN2al9ByamlIterE 0x0000007100d2d82c,act::getWeaponCommonPoweredSharpAddThrowMin,20,_ZN4ksys3act38getWeaponCommonPoweredSharpAddThrowMinERKN2al9ByamlIterE 0x0000007100d2d840,act::getWeaponCommonPoweredSharpAddThrowMax,20,_ZN4ksys3act38getWeaponCommonPoweredSharpAddThrowMaxERKN2al9ByamlIterE 0x0000007100d2d854,act::getWeaponCommonPoweredSharpAddSpreadFire,20,_ZN4ksys3act40getWeaponCommonPoweredSharpAddSpreadFireERKN2al9ByamlIterE diff --git a/src/Game/Actor/actWeapon.cpp b/src/Game/Actor/actWeapon.cpp index 43621f49..d258e581 100644 --- a/src/Game/Actor/actWeapon.cpp +++ b/src/Game/Actor/actWeapon.cpp @@ -144,8 +144,8 @@ bool WeaponModifierRanges::loadTierYellow(const sead::SafeString& actor) { addLifeMin = ksys::act::getWeaponCommonPoweredSharpAddLifeMin(iter); addLifeMax = ksys::act::getWeaponCommonPoweredSharpAddLifeMax(iter); - addGuardMin = ksys::act::getWeaponCommonPoweredSharpAddGuardMin(iter); - addGuardMax = ksys::act::getWeaponCommonPoweredSharpAddGuardMax(iter); + addGuardMin = ksys::act::getWeaponCommonPoweredSharpWeaponAddGuardMin(iter); + addGuardMax = ksys::act::getWeaponCommonPoweredSharpWeaponAddGuardMax(iter); addThrowMin = ksys::act::getWeaponCommonPoweredSharpAddThrowMin(iter); addThrowMax = ksys::act::getWeaponCommonPoweredSharpAddThrowMax(iter); diff --git a/src/KingSystem/ActorSystem/actInfoCommon.cpp b/src/KingSystem/ActorSystem/actInfoCommon.cpp index 18994c55..441cc5c9 100644 --- a/src/KingSystem/ActorSystem/actInfoCommon.cpp +++ b/src/KingSystem/ActorSystem/actInfoCommon.cpp @@ -1,6 +1,8 @@ #include "KingSystem/ActorSystem/actInfoCommon.h" #include "KingSystem/ActorSystem/actInfoData.h" +// DO NOT EDIT. This file is automatically generated by actInfoCommon.py. + namespace ksys::act { bool getSystemIsGetItemSelf(InfoData* data, const char* actor) { @@ -23,94 +25,190 @@ int getEnemyRank(InfoData* data, const char* actor) { return data->getInt(actor, "enemyRank"); } +int getEnemyRank(const al::ByamlIter& iter) { + return InfoData::getIntByKey(iter, "enemyRank"); +} + int getAttackPower(InfoData* data, const char* actor) { return data->getInt(actor, "attackPower"); } +int getAttackPower(const al::ByamlIter& iter) { + return InfoData::getIntByKey(iter, "attackPower"); +} + int getWeaponCommonGuardPower(InfoData* data, const char* actor) { return data->getInt(actor, "weaponCommonGuardPower"); } +int getWeaponCommonGuardPower(const al::ByamlIter& iter) { + return InfoData::getIntByKey(iter, "weaponCommonGuardPower"); +} + float getWeaponCommonSharpWeaponPer(InfoData* data, const char* actor) { return data->getFloat(actor, "weaponCommonSharpWeaponPer", 10.0); } +float getWeaponCommonSharpWeaponPer(const al::ByamlIter& iter) { + return InfoData::getFloatByKey(iter, "weaponCommonSharpWeaponPer", 10.0); +} + +int getWeaponCommonSharpWeaponAddAtkMin(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonSharpWeaponAddAtkMin"); +} + int getWeaponCommonSharpWeaponAddAtkMin(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddAtkMin"); } +int getWeaponCommonSharpWeaponAddAtkMax(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonSharpWeaponAddAtkMax"); +} + int getWeaponCommonSharpWeaponAddAtkMax(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddAtkMax"); } +int getWeaponCommonSharpWeaponAddLifeMin(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonSharpWeaponAddLifeMin"); +} + int getWeaponCommonSharpWeaponAddLifeMin(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddLifeMin"); } +int getWeaponCommonSharpWeaponAddLifeMax(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonSharpWeaponAddLifeMax"); +} + int getWeaponCommonSharpWeaponAddLifeMax(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddLifeMax"); } +bool getWeaponCommonSharpWeaponAddCrit(InfoData* data, const char* actor) { + return data->getBool(actor, "weaponCommonSharpWeaponAddCrit"); +} + bool getWeaponCommonSharpWeaponAddCrit(const al::ByamlIter& iter) { return InfoData::getBoolByKey(iter, "weaponCommonSharpWeaponAddCrit"); } +int getWeaponCommonSharpWeaponAddGuardMin(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonSharpWeaponAddGuardMin"); +} + int getWeaponCommonSharpWeaponAddGuardMin(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddGuardMin"); } +int getWeaponCommonSharpWeaponAddGuardMax(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonSharpWeaponAddGuardMax"); +} + int getWeaponCommonSharpWeaponAddGuardMax(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonSharpWeaponAddGuardMax"); } +int getWeaponCommonPoweredSharpAddAtkMin(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonPoweredSharpAddAtkMin"); +} + int getWeaponCommonPoweredSharpAddAtkMin(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddAtkMin"); } +int getWeaponCommonPoweredSharpAddAtkMax(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonPoweredSharpAddAtkMax"); +} + int getWeaponCommonPoweredSharpAddAtkMax(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddAtkMax"); } +int getWeaponCommonPoweredSharpAddLifeMin(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonPoweredSharpAddLifeMin"); +} + int getWeaponCommonPoweredSharpAddLifeMin(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddLifeMin"); } +int getWeaponCommonPoweredSharpAddLifeMax(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonPoweredSharpAddLifeMax"); +} + int getWeaponCommonPoweredSharpAddLifeMax(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddLifeMax"); } -int getWeaponCommonPoweredSharpAddGuardMin(const al::ByamlIter& iter) { - return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddGuardMin"); +int getWeaponCommonPoweredSharpWeaponAddGuardMin(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonPoweredSharpWeaponAddGuardMin"); } -int getWeaponCommonPoweredSharpAddGuardMax(const al::ByamlIter& iter) { - return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpAddGuardMax"); +int getWeaponCommonPoweredSharpWeaponAddGuardMin(const al::ByamlIter& iter) { + return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpWeaponAddGuardMin"); +} + +int getWeaponCommonPoweredSharpWeaponAddGuardMax(InfoData* data, const char* actor) { + return data->getInt(actor, "weaponCommonPoweredSharpWeaponAddGuardMax"); +} + +int getWeaponCommonPoweredSharpWeaponAddGuardMax(const al::ByamlIter& iter) { + return InfoData::getIntByKey(iter, "weaponCommonPoweredSharpWeaponAddGuardMax"); +} + +float getWeaponCommonPoweredSharpAddThrowMin(InfoData* data, const char* actor) { + return data->getFloat(actor, "weaponCommonPoweredSharpAddThrowMin", 1.0); } float getWeaponCommonPoweredSharpAddThrowMin(const al::ByamlIter& iter) { return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddThrowMin", 1.0); } +float getWeaponCommonPoweredSharpAddThrowMax(InfoData* data, const char* actor) { + return data->getFloat(actor, "weaponCommonPoweredSharpAddThrowMax", 1.0); +} + float getWeaponCommonPoweredSharpAddThrowMax(const al::ByamlIter& iter) { return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddThrowMax", 1.0); } +bool getWeaponCommonPoweredSharpAddSpreadFire(InfoData* data, const char* actor) { + return data->getBool(actor, "weaponCommonPoweredSharpAddSpreadFire"); +} + bool getWeaponCommonPoweredSharpAddSpreadFire(const al::ByamlIter& iter) { return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddSpreadFire"); } +bool getWeaponCommonPoweredSharpAddZoomRapid(InfoData* data, const char* actor) { + return data->getBool(actor, "weaponCommonPoweredSharpAddZoomRapid"); +} + bool getWeaponCommonPoweredSharpAddZoomRapid(const al::ByamlIter& iter) { return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddZoomRapid"); } +float getWeaponCommonPoweredSharpAddRapidFireMin(InfoData* data, const char* actor) { + return data->getFloat(actor, "weaponCommonPoweredSharpAddRapidFireMin", 1.0); +} + float getWeaponCommonPoweredSharpAddRapidFireMin(const al::ByamlIter& iter) { return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddRapidFireMin", 1.0); } +float getWeaponCommonPoweredSharpAddRapidFireMax(InfoData* data, const char* actor) { + return data->getFloat(actor, "weaponCommonPoweredSharpAddRapidFireMax", 1.0); +} + float getWeaponCommonPoweredSharpAddRapidFireMax(const al::ByamlIter& iter) { return InfoData::getFloatByKey(iter, "weaponCommonPoweredSharpAddRapidFireMax", 1.0); } +bool getWeaponCommonPoweredSharpAddSurfMaster(InfoData* data, const char* actor) { + return data->getBool(actor, "weaponCommonPoweredSharpAddSurfMaster"); +} + bool getWeaponCommonPoweredSharpAddSurfMaster(const al::ByamlIter& iter) { return InfoData::getBoolByKey(iter, "weaponCommonPoweredSharpAddSurfMaster"); } @@ -119,18 +217,38 @@ const char* getBowArrowName(InfoData* data, const char* actor) { return data->getString(actor, "bowArrowName"); } +const char* getBowArrowName(const al::ByamlIter& iter) { + return InfoData::getStringByKey(iter, "bowArrowName"); +} + +bool getBowIsLeadShot(InfoData* data, const char* actor) { + return data->getBool(actor, "bowIsLeadShot"); +} + bool getBowIsLeadShot(const al::ByamlIter& iter) { return InfoData::getBoolByKey(iter, "bowIsLeadShot"); } +int getBowLeadShotNum(InfoData* data, const char* actor) { + return data->getInt(actor, "bowLeadShotNum"); +} + int getBowLeadShotNum(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "bowLeadShotNum"); } +bool getBowIsRapidFire(InfoData* data, const char* actor) { + return data->getBool(actor, "bowIsRapidFire"); +} + bool getBowIsRapidFire(const al::ByamlIter& iter) { return InfoData::getBoolByKey(iter, "bowIsRapidFire"); } +int getBowRapidFireNum(InfoData* data, const char* actor) { + return data->getInt(actor, "bowRapidFireNum"); +} + int getBowRapidFireNum(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "bowRapidFireNum"); } @@ -139,26 +257,50 @@ int getMasterSwordTrueFormAttackPower(InfoData* data, const char* actor) { return data->getInt(actor, "masterSwordTrueFormAttackPower", -1); } +int getMasterSwordTrueFormAttackPower(const al::ByamlIter& iter) { + return InfoData::getIntByKey(iter, "masterSwordTrueFormAttackPower", -1); +} + float getMasterSwordSearchEvilDist(InfoData* data, const char* actor) { return data->getFloat(actor, "masterSwordSearchEvilDist", -1.0); } +float getMasterSwordSearchEvilDist(const al::ByamlIter& iter) { + return InfoData::getFloatByKey(iter, "masterSwordSearchEvilDist", -1.0); +} + const char* getMasterSwordSleepActorName(InfoData* data, const char* actor) { return data->getString(actor, "masterSwordSleepActorName"); } +const char* getMasterSwordSleepActorName(const al::ByamlIter& iter) { + return InfoData::getStringByKey(iter, "masterSwordSleepActorName"); +} + const char* getMasterSwordTrueFormActorName(InfoData* data, const char* actor) { return data->getString(actor, "masterSwordTrueFormActorName"); } +const char* getMasterSwordTrueFormActorName(const al::ByamlIter& iter) { + return InfoData::getStringByKey(iter, "masterSwordTrueFormActorName"); +} + const char* getArmorNextRankName(InfoData* data, const char* actor) { - return data->getString(actor, "armorNextRankName", sead::SafeString::cEmptyString); + return data->getString(actor, "armorNextRankName"); +} + +const char* getArmorNextRankName(const al::ByamlIter& iter) { + return InfoData::getStringByKey(iter, "armorNextRankName"); } int getItemStainColor(InfoData* data, const char* actor) { return data->getInt(actor, "itemStainColor", -1); } +int getItemStainColor(const al::ByamlIter& iter) { + return InfoData::getIntByKey(iter, "itemStainColor", -1); +} + int getCureItemHitPointRecover(InfoData* data, const char* actor) { return data->getInt(actor, "cureItemHitPointRecover"); } @@ -167,8 +309,13 @@ int getCureItemHitPointRecover(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "cureItemHitPointRecover"); } +int getMonsterShopSellMamo(InfoData* data, const char* actor) { + return data->getInt(actor, "monsterShopSellMamo"); +} + int getMonsterShopSellMamo(const al::ByamlIter& iter) { return InfoData::getIntByKey(iter, "monsterShopSellMamo"); } + } // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actInfoCommon.h b/src/KingSystem/ActorSystem/actInfoCommon.h index 8b6b2425..aa269240 100644 --- a/src/KingSystem/ActorSystem/actInfoCommon.h +++ b/src/KingSystem/ActorSystem/actInfoCommon.h @@ -1,5 +1,7 @@ #pragma once +// DO NOT EDIT. This file is automatically generated by actInfoCommon.py. + namespace al { class ByamlIter; } @@ -15,51 +17,115 @@ int getGeneralLife(InfoData* data, const char* actor); int getGeneralLife(const al::ByamlIter& iter); int getEnemyRank(InfoData* data, const char* actor); +int getEnemyRank(const al::ByamlIter& iter); + int getAttackPower(InfoData* data, const char* actor); +int getAttackPower(const al::ByamlIter& iter); int getWeaponCommonGuardPower(InfoData* data, const char* actor); -float getWeaponCommonSharpWeaponPer(InfoData* data, const char* actor); +int getWeaponCommonGuardPower(const al::ByamlIter& iter); +float getWeaponCommonSharpWeaponPer(InfoData* data, const char* actor); +float getWeaponCommonSharpWeaponPer(const al::ByamlIter& iter); + +int getWeaponCommonSharpWeaponAddAtkMin(InfoData* data, const char* actor); int getWeaponCommonSharpWeaponAddAtkMin(const al::ByamlIter& iter); + +int getWeaponCommonSharpWeaponAddAtkMax(InfoData* data, const char* actor); int getWeaponCommonSharpWeaponAddAtkMax(const al::ByamlIter& iter); + +int getWeaponCommonSharpWeaponAddLifeMin(InfoData* data, const char* actor); int getWeaponCommonSharpWeaponAddLifeMin(const al::ByamlIter& iter); + +int getWeaponCommonSharpWeaponAddLifeMax(InfoData* data, const char* actor); int getWeaponCommonSharpWeaponAddLifeMax(const al::ByamlIter& iter); + +bool getWeaponCommonSharpWeaponAddCrit(InfoData* data, const char* actor); bool getWeaponCommonSharpWeaponAddCrit(const al::ByamlIter& iter); + +int getWeaponCommonSharpWeaponAddGuardMin(InfoData* data, const char* actor); int getWeaponCommonSharpWeaponAddGuardMin(const al::ByamlIter& iter); + +int getWeaponCommonSharpWeaponAddGuardMax(InfoData* data, const char* actor); int getWeaponCommonSharpWeaponAddGuardMax(const al::ByamlIter& iter); +int getWeaponCommonPoweredSharpAddAtkMin(InfoData* data, const char* actor); int getWeaponCommonPoweredSharpAddAtkMin(const al::ByamlIter& iter); + +int getWeaponCommonPoweredSharpAddAtkMax(InfoData* data, const char* actor); int getWeaponCommonPoweredSharpAddAtkMax(const al::ByamlIter& iter); + +int getWeaponCommonPoweredSharpAddLifeMin(InfoData* data, const char* actor); int getWeaponCommonPoweredSharpAddLifeMin(const al::ByamlIter& iter); + +int getWeaponCommonPoweredSharpAddLifeMax(InfoData* data, const char* actor); int getWeaponCommonPoweredSharpAddLifeMax(const al::ByamlIter& iter); -int getWeaponCommonPoweredSharpAddGuardMin(const al::ByamlIter& iter); -int getWeaponCommonPoweredSharpAddGuardMax(const al::ByamlIter& iter); + +int getWeaponCommonPoweredSharpWeaponAddGuardMin(InfoData* data, const char* actor); +int getWeaponCommonPoweredSharpWeaponAddGuardMin(const al::ByamlIter& iter); + +int getWeaponCommonPoweredSharpWeaponAddGuardMax(InfoData* data, const char* actor); +int getWeaponCommonPoweredSharpWeaponAddGuardMax(const al::ByamlIter& iter); + +float getWeaponCommonPoweredSharpAddThrowMin(InfoData* data, const char* actor); float getWeaponCommonPoweredSharpAddThrowMin(const al::ByamlIter& iter); + +float getWeaponCommonPoweredSharpAddThrowMax(InfoData* data, const char* actor); float getWeaponCommonPoweredSharpAddThrowMax(const al::ByamlIter& iter); + +bool getWeaponCommonPoweredSharpAddSpreadFire(InfoData* data, const char* actor); bool getWeaponCommonPoweredSharpAddSpreadFire(const al::ByamlIter& iter); + +bool getWeaponCommonPoweredSharpAddZoomRapid(InfoData* data, const char* actor); bool getWeaponCommonPoweredSharpAddZoomRapid(const al::ByamlIter& iter); + +float getWeaponCommonPoweredSharpAddRapidFireMin(InfoData* data, const char* actor); float getWeaponCommonPoweredSharpAddRapidFireMin(const al::ByamlIter& iter); + +float getWeaponCommonPoweredSharpAddRapidFireMax(InfoData* data, const char* actor); float getWeaponCommonPoweredSharpAddRapidFireMax(const al::ByamlIter& iter); + +bool getWeaponCommonPoweredSharpAddSurfMaster(InfoData* data, const char* actor); bool getWeaponCommonPoweredSharpAddSurfMaster(const al::ByamlIter& iter); const char* getBowArrowName(InfoData* data, const char* actor); +const char* getBowArrowName(const al::ByamlIter& iter); + +bool getBowIsLeadShot(InfoData* data, const char* actor); bool getBowIsLeadShot(const al::ByamlIter& iter); + +int getBowLeadShotNum(InfoData* data, const char* actor); int getBowLeadShotNum(const al::ByamlIter& iter); + +bool getBowIsRapidFire(InfoData* data, const char* actor); bool getBowIsRapidFire(const al::ByamlIter& iter); + +int getBowRapidFireNum(InfoData* data, const char* actor); int getBowRapidFireNum(const al::ByamlIter& iter); int getMasterSwordTrueFormAttackPower(InfoData* data, const char* actor); +int getMasterSwordTrueFormAttackPower(const al::ByamlIter& iter); + float getMasterSwordSearchEvilDist(InfoData* data, const char* actor); +float getMasterSwordSearchEvilDist(const al::ByamlIter& iter); + const char* getMasterSwordSleepActorName(InfoData* data, const char* actor); +const char* getMasterSwordSleepActorName(const al::ByamlIter& iter); + const char* getMasterSwordTrueFormActorName(InfoData* data, const char* actor); +const char* getMasterSwordTrueFormActorName(const al::ByamlIter& iter); const char* getArmorNextRankName(InfoData* data, const char* actor); +const char* getArmorNextRankName(const al::ByamlIter& iter); int getItemStainColor(InfoData* data, const char* actor); +int getItemStainColor(const al::ByamlIter& iter); int getCureItemHitPointRecover(InfoData* data, const char* actor); int getCureItemHitPointRecover(const al::ByamlIter& iter); +int getMonsterShopSellMamo(InfoData* data, const char* actor); int getMonsterShopSellMamo(const al::ByamlIter& iter); + } // namespace ksys::act diff --git a/src/KingSystem/ActorSystem/actInfoCommon.py b/src/KingSystem/ActorSystem/actInfoCommon.py new file mode 100755 index 00000000..d3fcdd81 --- /dev/null +++ b/src/KingSystem/ActorSystem/actInfoCommon.py @@ -0,0 +1,149 @@ +#!/usr/bin/env python3 +# Generates actInfoCommon.h and actInfoCommon.cpp. +from typing import Any, List, Tuple +from pathlib import Path + +# Section | Name | Type | Default value (optional) +PROPERTIES: List[Tuple[str, str, str, Any]] = [ + ("System", "IsGetItemSelf", "bool"), + + ("General", "Life", "int", 100), + + ("Enemy", "Rank", "int"), + + ("Attack", "Power", "int"), + + ("WeaponCommon", "GuardPower", "int"), + ("WeaponCommon", "SharpWeaponPer", "float", 10.0), + ("WeaponCommon", "SharpWeaponAddAtkMin", "int"), + ("WeaponCommon", "SharpWeaponAddAtkMax", "int"), + ("WeaponCommon", "SharpWeaponAddLifeMin", "int"), + ("WeaponCommon", "SharpWeaponAddLifeMax", "int"), + ("WeaponCommon", "SharpWeaponAddCrit", "bool"), + ("WeaponCommon", "SharpWeaponAddGuardMin", "int"), + ("WeaponCommon", "SharpWeaponAddGuardMax", "int"), + + ("WeaponCommon", "PoweredSharpAddAtkMin", "int"), + ("WeaponCommon", "PoweredSharpAddAtkMax", "int"), + ("WeaponCommon", "PoweredSharpAddLifeMin", "int"), + ("WeaponCommon", "PoweredSharpAddLifeMax", "int"), + ("WeaponCommon", "PoweredSharpWeaponAddGuardMin", "int"), + ("WeaponCommon", "PoweredSharpWeaponAddGuardMax", "int"), + ("WeaponCommon", "PoweredSharpAddThrowMin", "float", 1.0), + ("WeaponCommon", "PoweredSharpAddThrowMax", "float", 1.0), + ("WeaponCommon", "PoweredSharpAddSpreadFire", "bool"), + ("WeaponCommon", "PoweredSharpAddZoomRapid", "bool"), + ("WeaponCommon", "PoweredSharpAddRapidFireMin", "float", 1.0), + ("WeaponCommon", "PoweredSharpAddRapidFireMax", "float", 1.0), + ("WeaponCommon", "PoweredSharpAddSurfMaster", "bool"), + + ("Bow", "ArrowName", "const char*"), + ("Bow", "IsLeadShot", "bool"), + ("Bow", "LeadShotNum", "int"), + ("Bow", "IsRapidFire", "bool"), + ("Bow", "RapidFireNum", "int"), + + ("MasterSword", "TrueFormAttackPower", "int", -1), + ("MasterSword", "SearchEvilDist", "float", -1.0), + ("MasterSword", "SleepActorName", "const char*"), + ("MasterSword", "TrueFormActorName", "const char*"), + + ("Armor", "NextRankName", "const char*"), + + ("Item", "StainColor", "int", -1), + + ("CureItem", "HitPointRecover", "int"), + + ("MonsterShop", "SellMamo", "int"), +] + + +def generate_declarations(props: list) -> str: + lines = [] + for prop in props: + assert len(prop) == 3 or len(prop) == 4 + section, name, type_, *_ = prop + lines.append(f"{type_} get{section}{name}(InfoData* data, const char* actor);") + lines.append(f"{type_} get{section}{name}(const al::ByamlIter& iter);") + lines.append("") + return "\n".join(lines) + + +def get_key_name(section: str, name: str) -> str: + return section[0].lower() + section[1:] + name + + +def generate_definitions(props: list) -> str: + _getters = { + "int": "getInt", + "bool": "getBool", + "float": "getFloat", + "const char*": "getString", + } + + lines = [] + for prop in props: + assert len(prop) == 3 or len(prop) == 4 + if len(prop) == 3: + section, name, type_ = prop + key = get_key_name(section, name) + + lines.append(f"{type_} get{section}{name}(InfoData* data, const char* actor) {{") + lines.append(f" return data->{_getters[type_]}(actor, \"{key}\");") + lines.append(f"}}") + lines.append("") + lines.append(f"{type_} get{section}{name}(const al::ByamlIter& iter) {{") + lines.append(f" return InfoData::{_getters[type_]}ByKey(iter, \"{key}\");") + lines.append(f"}}") + lines.append("") + else: + section, name, type_, default_ = prop + key = get_key_name(section, name) + default_str = f'"{default_}"' if isinstance(default_, str) else str(default_) + + lines.append(f"{type_} get{section}{name}(InfoData* data, const char* actor) {{") + lines.append(f" return data->{_getters[type_]}(actor, \"{key}\", {default_str});") + lines.append(f"}}") + lines.append("") + lines.append(f"{type_} get{section}{name}(const al::ByamlIter& iter) {{") + lines.append(f" return InfoData::{_getters[type_]}ByKey(iter, \"{key}\", {str(default_str)});") + lines.append(f"}}") + lines.append("") + + return "\n".join(lines) + + +header_contents = """\ +#pragma once + +// DO NOT EDIT. This file is automatically generated by actInfoCommon.py. + +namespace al { +class ByamlIter; +} + +namespace ksys::act { + +class InfoData; + +""" + generate_declarations(PROPERTIES) + """\ + +} // namespace ksys::act +""" + +cpp_contents = """\ +#include "KingSystem/ActorSystem/actInfoCommon.h" +#include "KingSystem/ActorSystem/actInfoData.h" + +// DO NOT EDIT. This file is automatically generated by actInfoCommon.py. + +namespace ksys::act { + +""" + generate_definitions(PROPERTIES) + """\ + +} // namespace ksys::act +""" + +this_dir = Path(__file__).parent +(this_dir / "actInfoCommon.h").write_text(header_contents) +(this_dir / "actInfoCommon.cpp").write_text(cpp_contents)