-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
189 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSExtraData.h" | ||
|
||
namespace RE | ||
{ | ||
class TESKey; | ||
class TESObjectREFR; | ||
|
||
enum class LOCK_LEVEL | ||
{ | ||
kUnlocked = static_cast<std::underlying_type_t<LOCK_LEVEL>>(-1), | ||
kEasy = 0, | ||
kAverage = 1, | ||
kHard = 2, | ||
kVeryHard = 3, | ||
kRequiresKey = 4, | ||
kInaccessible = 5, | ||
kTerminal = 6, | ||
kBarred = 7, | ||
kChained = 8, | ||
}; | ||
|
||
struct REFR_LOCK | ||
{ | ||
enum class Flag | ||
{ | ||
kNone = 0, | ||
kLocked = 1 << 0, | ||
kLeveled = 1 << 2 | ||
}; | ||
|
||
[[nodiscard]] LOCK_LEVEL GetLockLevel(const TESObjectREFR* a_owner) const; | ||
[[nodiscard]] constexpr bool IsLocked() const noexcept { return flags.all(Flag::kLocked); } | ||
void SetLocked(bool a_locked); | ||
|
||
// members | ||
TESKey* key; // 00 | ||
std::uint32_t numTries; // 08 | ||
stl::enumeration<Flag, std::uint8_t> flags; // 0C | ||
std::int8_t baseLevel; // 0D | ||
}; | ||
static_assert(sizeof(REFR_LOCK) == 0x10); | ||
|
||
class ExtraLock : public BSExtraData | ||
{ | ||
public: | ||
SF_RTTI_VTABLE(ExtraLock); | ||
SF_EXTRADATATYPE(Lock); | ||
|
||
~ExtraLock() override; // 00 | ||
|
||
// members | ||
REFR_LOCK* lock; // 18 | ||
}; | ||
static_assert(sizeof(ExtraLock) == 0x20); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include "RE/B/BSTEvent.h" | ||
#include "RE/E/ExtraLock.h" | ||
#include "RE/N/NiSmartPointer.h" | ||
|
||
namespace RE | ||
{ | ||
class TESObjectREFR; | ||
class BGSTerminalMenu; | ||
|
||
struct LockPickedEvent | ||
{ | ||
public: | ||
[[nodiscard]] static BSTEventSource<LockPickedEvent>* GetEventSource() | ||
{ | ||
using func_t = decltype(&LockPickedEvent::GetEventSource); | ||
REL::Relocation<func_t> func{ ID::LockPickedEvent::GetEventSource }; | ||
return func(); | ||
} | ||
|
||
static void Notify(const NiPointer<TESObjectREFR>& a_actionRef, const NiPointer<TESObjectREFR>& a_lock, bool a_succeeded, bool a_isOffLimits, LOCK_LEVEL lockLevel, std::uint32_t a_numDigiPicksUsed, float a_arg7 = 0.0f, float a_arg8 = 0.0f, BGSTerminalMenu* a_terminalMenu = nullptr, std::int32_t a_arg10 = -1) | ||
{ | ||
using func_t = decltype(&LockPickedEvent::Notify); | ||
REL::Relocation<func_t> func{ ID::LockPickedEvent::Notify }; | ||
return func(a_actionRef, a_lock, a_succeeded, a_isOffLimits, lockLevel, a_numDigiPicksUsed, a_arg7, a_arg8, a_terminalMenu, a_arg10); | ||
} | ||
|
||
// members | ||
NiPointer<TESObjectREFR> actionRef; // 00 | ||
NiPointer<TESObjectREFR> lock; // 08 | ||
BGSTerminalMenu* terminalMenu; // 10 | ||
std::int32_t unk18; // 14 - terminalMenu related | ||
std::uint32_t numDigiPicksUsed; // 18 | ||
float unk20; // 20 - 0.0f | ||
float unk24; // 24 - 0.0f | ||
stl::enumeration<LOCK_LEVEL, std::uint32_t> lockLevel; // 28 | ||
bool succeeded; // 2C | ||
bool isOffLimits; // 2D | ||
}; | ||
static_assert(sizeof(LockPickedEvent) == 0x30); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "RE/E/ExtraLock.h" | ||
|
||
namespace RE | ||
{ | ||
LOCK_LEVEL REFR_LOCK::GetLockLevel(const TESObjectREFR* a_owner) const | ||
{ | ||
if (IsLocked()) { | ||
using func_t = decltype(&REFR_LOCK::GetLockLevel); | ||
REL::Relocation<func_t> func{ ID::REFR_LOCK::GetLockLevel }; | ||
return func(this, a_owner); | ||
} else { | ||
return LOCK_LEVEL::kUnlocked; | ||
} | ||
} | ||
|
||
void REFR_LOCK::SetLocked(bool a_locked) | ||
{ | ||
if (a_locked) { | ||
flags.set(Flag::kLocked); | ||
} else { | ||
flags.reset(Flag::kLocked); | ||
numTries = 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters