137 lines
6.4 KiB
C++
137 lines
6.4 KiB
C++
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <optional>
|
||
|
|
|
||
|
|
#include <Unreal/NameTypes.hpp>
|
||
|
|
|
||
|
|
#include <Api/UnrealWrapper.hpp>
|
||
|
|
#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<PalCharacter>(), 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<UObject*>(STR("GetIndividualParameter")).value_or(nullptr);
|
||
|
|
}
|
||
|
|
|
||
|
|
auto Identify() -> PalIdentity
|
||
|
|
{
|
||
|
|
return PalIndividual::IdentifyFromParameter(GetIndividualParameterObject());
|
||
|
|
}
|
||
|
|
|
||
|
|
auto CharacterId() -> std::optional<FName>
|
||
|
|
{
|
||
|
|
return PalIndividual::CharacterId(GetIndividualParameterObject());
|
||
|
|
}
|
||
|
|
|
||
|
|
auto BlueprintClassName() const -> std::optional<StringType>
|
||
|
|
{
|
||
|
|
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<bool> { return CallForReturn<bool>(STR("IsInitialized")); }
|
||
|
|
auto IsPart() -> std::optional<bool> { return CallForReturn<bool>(STR("IsPart")); }
|
||
|
|
auto IsCooping() -> std::optional<bool> { return CallForReturn<bool>(STR("IsCooping")); }
|
||
|
|
auto IsPreCooping() -> std::optional<bool> { return CallForReturn<bool>(STR("IsPreCooping")); }
|
||
|
|
auto IsLocalHiddenForCutscene() -> std::optional<bool> { return CallForReturn<bool>(STR("IsLocalHiddenForCutscene")); }
|
||
|
|
auto IsUseCustomAutoAimTarget() -> std::optional<bool> { return CallForReturn<bool>(STR("IsUseCustomAutoAimTarget")); }
|
||
|
|
auto IsAllActiveSkillCooldownFinished() -> std::optional<bool> { return CallForReturn<bool>(STR("IsAllActiveSkillCooldownFinished")); }
|
||
|
|
auto GetBattleMode() -> std::optional<bool> { return CallForReturn<bool>(STR("GetBattleMode")); }
|
||
|
|
auto GetTalkMode() -> std::optional<bool> { return CallForReturn<bool>(STR("GetTalkMode")); }
|
||
|
|
auto GetActiveActorFlag() -> std::optional<bool> { return CallForReturn<bool>(STR("GetActiveActorFlag")); }
|
||
|
|
|
||
|
|
auto IsActiveSkillCooldownFinished(EPalWazaID_ WazaID) -> std::optional<bool>
|
||
|
|
{
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|