#pragma once #include #include #include #include "PalIndividual.hpp" #include "PalTypes.hpp" namespace PalUIExtension::Api::Pal { class PalCharacter : public UnrealWrapper { public: static auto ClassPath() -> const TCHAR* { return STR("/Script/Pal.PalCharacter"); } static auto DebugTag() -> const TCHAR* { return STR("PalCharacter"); } PalCharacter() = default; explicit PalCharacter(UObject* Obj) : UnrealWrapper(Obj, ClassOf(), DebugTag()) {} // ---- components ------------------------------------------------ auto GetCharacterParameterComponent() -> UObject* { return ObjectGetter(STR("GetCharacterParameterComponent")); } auto GetActionComponent() -> UObject* { return ObjectGetter(STR("GetActionComponent")); } auto GetPalCharacterMovementComponent() -> UObject* { return ObjectGetter(STR("GetPalCharacterMovementComponent")); } auto GetMainMesh() -> UObject* { return ObjectGetter(STR("GetMainMesh")); } auto GetCurrentReservedMontage() -> UObject* { return ObjectGetter(STR("GetCurrentReservedMontage")); } auto GetOverrideFaceMesh() -> UObject* { return ObjectGetter(STR("GetOverrideFaceMesh")); } auto GetHandAttachMesh() -> UObject* { return ObjectGetter(STR("GetHandAttachMesh")); } // ---- identity -------------------------------------------------- auto GetIndividualParameterObject() -> UObject* { UObject* Comp = GetCharacterParameterComponent(); if (!Comp) return nullptr; LooseObject C{ Comp, STR("PalCharacterParameterComponent") }; return C.CallForReturn(STR("GetIndividualParameter")).value_or(nullptr); } auto Identify() -> PalIdentity { return PalIndividual::IdentifyFromParameter(GetIndividualParameterObject()); } auto CharacterId() -> std::optional { return PalIndividual::CharacterId(GetIndividualParameterObject()); } auto BlueprintClassName() const -> std::optional { if (!m_obj) return std::nullopt; UClass* Cls = m_obj->GetClassPrivate(); if (!Cls) return std::nullopt; return Cls->GetName(); } // ---- state queries --------------------------------------------- auto IsInitialized() -> std::optional { return CallForReturn(STR("IsInitialized")); } auto IsPart() -> std::optional { return CallForReturn(STR("IsPart")); } auto IsCooping() -> std::optional { return CallForReturn(STR("IsCooping")); } auto IsPreCooping() -> std::optional { return CallForReturn(STR("IsPreCooping")); } auto IsLocalHiddenForCutscene() -> std::optional { return CallForReturn(STR("IsLocalHiddenForCutscene")); } auto IsUseCustomAutoAimTarget() -> std::optional { return CallForReturn(STR("IsUseCustomAutoAimTarget")); } auto IsAllActiveSkillCooldownFinished() -> std::optional { return CallForReturn(STR("IsAllActiveSkillCooldownFinished")); } auto GetBattleMode() -> std::optional { return CallForReturn(STR("GetBattleMode")); } auto GetTalkMode() -> std::optional { return CallForReturn(STR("GetTalkMode")); } auto GetActiveActorFlag() -> std::optional { return CallForReturn(STR("GetActiveActorFlag")); } auto IsActiveSkillCooldownFinished(EPalWazaID_ WazaID) -> std::optional { struct P { EPalWazaID_ WazaID; bool ReturnValue; } p{ WazaID, false }; return CallForReturn(STR("IsActiveSkillCooldownFinished"), p, &P::ReturnValue); } // ---- local-only mutators --------------------------------------- auto ForceResetJumpState() -> bool { return CallVoid(STR("ForceResetJumpState")); } auto RequestJump() -> bool { return CallVoid(STR("RequestJump")); } auto ResetTickInterval() -> bool { return CallVoid(STR("ResetTickInterval")); } auto LocalInitialized() -> bool { return CallVoid(STR("LocalInitialized")); } auto RefreshDungeonLightingChannels() -> bool { return CallVoid(STR("RefreshDungeonLightingChannels")); } auto RequestExecuteTickNextFrameForAction() -> bool { return CallVoid(STR("RequestExecuteTickNextFrameForAction")); } auto BroadcastOnCompleteInitializeParameter() -> bool { return CallVoid(STR("BroadcastOnCompleteInitializeParameter")); } auto UpdateGroundRayCast(bool bImmediateApply) -> bool { struct P { bool bImmediateApply; } p{ bImmediateApply }; return Call(STR("UpdateGroundRayCast"), p); } auto SetVisibleCharacterMesh(bool Active) -> bool { struct P { bool Active; } p{ Active }; return Call(STR("SetVisibleCharacterMesh"), p); } auto SetVisibleHandAttachMesh(bool Active) -> bool { struct P { bool Active; } p{ Active }; return Call(STR("SetVisibleHandAttachMesh"), p); } auto SetLocalHiddenForCutscene(bool bHide) -> bool { struct P { bool bHide; } p{ bHide }; return Call(STR("SetLocalHiddenForCutscene"), p); } auto SetActiveCollisionMovement(bool Active) -> bool { struct P { bool Active; } p{ Active }; return Call(STR("SetActiveCollisionMovement"), p); } auto ChangeBattleModeFlag(bool IsBattle) -> bool { struct P { bool IsBattle; } p{ IsBattle }; return Call(STR("ChangeBattleModeFlag"), p); } auto SetDisableChangeIntervalByImportance(FName FlagName, bool bIsDisable) -> bool { struct P { FName flagName; bool isDisable; } p{ FlagName, bIsDisable }; return Call(STR("SetDisableChangeIntervalByImportance"), p); } private: auto ObjectGetter(const TCHAR* FunctionName) -> UObject* { struct P { UObject* ReturnValue; } p{ nullptr }; auto Result = CallForReturn(FunctionName, p, &P::ReturnValue); return (Result && *Result) ? *Result : nullptr; } }; }