Fix stats
This commit is contained in:
parent
ad6acadd4f
commit
8071edfc55
@ -21,7 +21,7 @@ namespace stats
|
|||||||
utils::hook::detour is_item_unlocked_hook2;
|
utils::hook::detour is_item_unlocked_hook2;
|
||||||
utils::hook::detour is_item_unlocked_hook3;
|
utils::hook::detour is_item_unlocked_hook3;
|
||||||
|
|
||||||
int is_item_unlocked_stub(void* a1, void* a2, void* a3)
|
int is_item_unlocked_stub(int a1, void* a2, int a3)
|
||||||
{
|
{
|
||||||
if (cg_unlock_all_items->current.enabled)
|
if (cg_unlock_all_items->current.enabled)
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ namespace stats
|
|||||||
return is_item_unlocked_hook.invoke<int>(a1, a2, a3);
|
return is_item_unlocked_hook.invoke<int>(a1, a2, a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_item_unlocked_stub2(void* a1, void* a2, void* a3, void* a4, void* a5, void* a6)
|
int is_item_unlocked_stub2(int a1, void* a2, void* a3, void* a4, int a5, void* a6)
|
||||||
{
|
{
|
||||||
if (cg_unlock_all_items->current.enabled)
|
if (cg_unlock_all_items->current.enabled)
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@ namespace stats
|
|||||||
return is_item_unlocked_hook2.invoke<int>(a1, a2, a3, a4, a5, a6);
|
return is_item_unlocked_hook2.invoke<int>(a1, a2, a3, a4, a5, a6);
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_item_unlocked_stub3(void* a1)
|
int is_item_unlocked_stub3(int a1)
|
||||||
{
|
{
|
||||||
if (cg_unlock_all_items->current.enabled)
|
if (cg_unlock_all_items->current.enabled)
|
||||||
{
|
{
|
||||||
@ -50,6 +50,11 @@ namespace stats
|
|||||||
|
|
||||||
return is_item_unlocked_hook3.invoke<int>(a1);
|
return is_item_unlocked_hook3.invoke<int>(a1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int is_item_unlocked()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
@ -57,11 +62,19 @@ namespace stats
|
|||||||
public:
|
public:
|
||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
if (!game::environment::is_mp())
|
if (game::environment::is_sp())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (game::environment::is_dedi())
|
||||||
|
{
|
||||||
|
utils::hook::jump(0x140413E60, is_item_unlocked);
|
||||||
|
utils::hook::jump(0x140413860, is_item_unlocked);
|
||||||
|
utils::hook::jump(0x140412B70, is_item_unlocked);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cg_unlock_all_items = dvars::register_bool("cg_unlockall_items", false, game::DVAR_FLAG_SAVED,
|
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.");
|
"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,
|
dvars::register_bool("cg_unlockall_classes", false, game::DVAR_FLAG_SAVED,
|
||||||
@ -71,6 +84,7 @@ namespace stats
|
|||||||
is_item_unlocked_hook2.create(0x140413860, is_item_unlocked_stub2);
|
is_item_unlocked_hook2.create(0x140413860, is_item_unlocked_stub2);
|
||||||
is_item_unlocked_hook3.create(0x140412B70, is_item_unlocked_stub3);
|
is_item_unlocked_hook3.create(0x140412B70, is_item_unlocked_stub3);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user