Better unlock all loot
This commit is contained in:
parent
02def5dc98
commit
32c72362fb
@ -169,12 +169,3 @@ Cac.IsCustomClassLocked = function(...)
|
||||
|
||||
return isclasslocked(...)
|
||||
end
|
||||
|
||||
local getlockstate = Engine.GetItemLockState
|
||||
Engine.GetItemLockState = function(...)
|
||||
local status, state, msg = getlockstate(...)
|
||||
if (state == Cac.ItemLockStatus.NotInInventory and Engine.GetDvarBool("cg_unlockall_loot")) then
|
||||
return "Unlocked", 0, ""
|
||||
end
|
||||
return status, state, msg
|
||||
end
|
||||
|
@ -16,8 +16,10 @@ namespace stats
|
||||
namespace
|
||||
{
|
||||
game::dvar_t* cg_unlock_all_items;
|
||||
game::dvar_t* cg_unlock_all_loot;
|
||||
|
||||
utils::hook::detour is_item_unlocked_hook;
|
||||
utils::hook::detour is_item_unlocked_hook2;
|
||||
|
||||
int is_item_unlocked_stub(int a1, void* a2, void* a3, void* a4, int a5, void* a6)
|
||||
{
|
||||
@ -33,6 +35,16 @@ namespace stats
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_item_unlocked_stub2(void* a1, void* a2)
|
||||
{
|
||||
const auto state = is_item_unlocked_hook2.invoke<int>(a1, a2);
|
||||
if (state == 15 /*Not In Inventory*/ && cg_unlock_all_loot->current.enabled)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
@ -51,16 +63,18 @@ namespace stats
|
||||
{
|
||||
utils::hook::jump(0x19E070_b, is_item_unlocked, true);
|
||||
utils::hook::jump(0x19D390_b, is_item_unlocked, true);
|
||||
utils::hook::jump(0x19D140_b, is_item_unlocked, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
is_item_unlocked_hook.create(0x19E070_b, is_item_unlocked_stub);
|
||||
is_item_unlocked_hook2.create(0x19D140_b, is_item_unlocked_stub2);
|
||||
|
||||
cg_unlock_all_items = dvars::register_bool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED,
|
||||
"Whether items should be locked based on the player's stats or always unlocked.");
|
||||
dvars::register_bool("cg_unlockall_classes", false, game::DVAR_FLAG_SAVED,
|
||||
"Whether classes should be locked based on the player's stats or always unlocked.");
|
||||
dvars::register_bool("cg_unlockall_loot", false, game::DVAR_FLAG_SAVED,
|
||||
cg_unlock_all_loot = dvars::register_bool("cg_unlockall_loot", false, game::DVAR_FLAG_SAVED,
|
||||
"Whether loot should be locked based on the player's stats or always unlocked.");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user