feat: add specific dvar to unlock loot (#1)
Co-authored-by: WantedDV <wanteddeviation@gmail.com> Reviewed-on: https://git.alterware.dev/AlterWare/s1-mod/pulls/1 Co-authored-by: Wanted <wanted@no-reply@alterware.dev> Co-committed-by: Wanted <wanted@no-reply@alterware.dev>
This commit is contained in:
parent
2deb2c340e
commit
1679ef60cc
1
.gitignore
vendored
1
.gitignore
vendored
@ -58,6 +58,7 @@ build
|
|||||||
|
|
||||||
# Visual Studio 2015 cache/options directory
|
# Visual Studio 2015 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
|
.vscode
|
||||||
|
|
||||||
# MSTest test Results
|
# MSTest test Results
|
||||||
[Tt]est[Rr]esult*/
|
[Tt]est[Rr]esult*/
|
||||||
|
@ -13,44 +13,45 @@ namespace stats
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
game::dvar_t* cg_unlock_all_items;
|
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_locked_hook1;
|
||||||
utils::hook::detour is_item_unlocked_hook2;
|
utils::hook::detour is_item_locked_hook2;
|
||||||
utils::hook::detour is_item_unlocked_hook3;
|
utils::hook::detour is_item_locked_hook3;
|
||||||
|
|
||||||
int is_item_unlocked_stub(void* a1, void* a2, void* a3)
|
int is_item_locked_stub1(void* a1, void* a2, void* a3)
|
||||||
{
|
{
|
||||||
if (cg_unlock_all_items->current.enabled)
|
if (cg_unlock_all_items->current.enabled)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return is_item_unlocked_hook.invoke<int>(a1, a2, a3);
|
return is_item_locked_hook1.invoke<int>(a1, a2, a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_item_unlocked_stub2(void* a1, void* a2, void* a3, void* a4, void* a5)
|
int is_item_locked_stub2(void* a1, void* a2, void* a3, void* a4, void* a5)
|
||||||
{
|
{
|
||||||
if (cg_unlock_all_items->current.enabled)
|
if (cg_unlock_all_items->current.enabled)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return is_item_unlocked_hook2.invoke<int>(a1, a2, a3, a4, a5);
|
return is_item_locked_hook2.invoke<int>(a1, a2, a3, a4, a5);
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_item_unlocked_stub3(void* a1)
|
int is_loot_locked_stub(void* a1)
|
||||||
{
|
{
|
||||||
if (cg_unlock_all_items->current.enabled)
|
if (cg_unlock_all_loot->current.enabled)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return is_item_unlocked_hook3.invoke<int>(a1);
|
return is_item_locked_hook3.invoke<int>(a1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_item_unlocked()
|
int is_item_locked()
|
||||||
{
|
{
|
||||||
return 0; // 0 == yes
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,20 +67,21 @@ namespace stats
|
|||||||
|
|
||||||
if (game::environment::is_dedi())
|
if (game::environment::is_dedi())
|
||||||
{
|
{
|
||||||
// unlock all items
|
// unlock all
|
||||||
utils::hook::jump(0x1403BD790, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable_LocalClient
|
utils::hook::jump(0x1403BD790, is_item_locked); // LiveStorage_IsItemUnlockedFromTable_LocalClient
|
||||||
utils::hook::jump(0x1403BD290, is_item_unlocked); // LiveStorage_IsItemUnlockedFromTable
|
utils::hook::jump(0x1403BD290, is_item_locked); // LiveStorage_IsItemUnlockedFromTable
|
||||||
utils::hook::jump(0x1403BAF60, is_item_unlocked); // idk ( unlocks loot etc )
|
utils::hook::jump(0x1403BAF60, is_item_locked); // unlocks supply drop loot
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// unlock all items
|
// unlock all
|
||||||
cg_unlock_all_items = game::Dvar_RegisterBool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED, "Whether items should be locked based on the player's stats or always unlocked.");
|
cg_unlock_all_items = game::Dvar_RegisterBool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED, "Unlock items that are level-locked by the player's stats.");
|
||||||
game::Dvar_RegisterBool("cg_unlockall_classes", false, game::DVAR_FLAG_SAVED, "Whether classes should be locked based on the player's stats or always unlocked.");
|
cg_unlock_all_loot = game::Dvar_RegisterBool("cg_unlockall_loot", false, game::DVAR_FLAG_SAVED, "Unlock supply drop loot.");
|
||||||
|
game::Dvar_RegisterBool("cg_unlockall_classes", false, game::DVAR_FLAG_SAVED, "Unlock extra class slots.");
|
||||||
|
|
||||||
is_item_unlocked_hook.create(0x1403BD790, is_item_unlocked_stub); // LiveStorage_IsItemUnlockedFromTable_LocalClient
|
is_item_locked_hook1.create(0x1403BD790, is_item_locked_stub1); // LiveStorage_IsItemUnlockedFromTable_LocalClient
|
||||||
is_item_unlocked_hook2.create(0x1403BD290, is_item_unlocked_stub2); // LiveStorage_IsItemUnlockedFromTable
|
is_item_locked_hook2.create(0x1403BD290, is_item_locked_stub2); // LiveStorage_IsItemUnlockedFromTable
|
||||||
is_item_unlocked_hook3.create(0x1403BAF60, is_item_unlocked_stub3); // idk (unlocks loot etc)
|
is_item_locked_hook3.create(0x1403BAF60, is_loot_locked_stub); // unlocks supply drop loot
|
||||||
}
|
}
|
||||||
|
|
||||||
command::add("setPlayerDataInt", [](const command::params& params)
|
command::add("setPlayerDataInt", [](const command::params& params)
|
||||||
|
Loading…
Reference in New Issue
Block a user