feat(carmod_shop): don't influence stats implicitly (#3462)
Closes #3359
This commit is contained in:
parent
adb2c02e77
commit
4ec9da8cb5
@ -6,59 +6,6 @@ namespace big
|
||||
{
|
||||
namespace carmod_shop
|
||||
{
|
||||
inline void STAT_GET_INT(rage::scrNativeCallContext* src)
|
||||
{
|
||||
const auto hash = src->get_arg<Hash>(0);
|
||||
int* out = src->get_arg<int*>(1);
|
||||
src->set_return_value<BOOL>(1);
|
||||
|
||||
switch (hash)
|
||||
{
|
||||
case "MP0_RACES_WON"_J:
|
||||
case "MP0_NUMBER_TURBO_STARTS_IN_RACE"_J:
|
||||
case "MP0_USJS_COMPLETED"_J:
|
||||
case "MP0_AWD_FM_RACES_FASTEST_LAP"_J:
|
||||
case "MP1_RACES_WON"_J:
|
||||
case "MP1_NUMBER_TURBO_STARTS_IN_RACE"_J:
|
||||
case "MP1_USJS_COMPLETED"_J:
|
||||
case "MP1_AWD_FM_RACES_FASTEST_LAP"_J: *out = 50; break;
|
||||
case "MP0_NUMBER_SLIPSTREAMS_IN_RACE"_J:
|
||||
case "MP1_NUMBER_SLIPSTREAMS_IN_RACE"_J: *out = 100; break;
|
||||
case "MP0_CHAR_FM_CARMOD_1_UNLCK"_J:
|
||||
case "MP0_CHAR_FM_CARMOD_2_UNLCK"_J:
|
||||
case "MP0_CHAR_FM_CARMOD_3_UNLCK"_J:
|
||||
case "MP0_CHAR_FM_CARMOD_4_UNLCK"_J:
|
||||
case "MP0_CHAR_FM_CARMOD_5_UNLCK"_J:
|
||||
case "MP0_CHAR_FM_CARMOD_6_UNLCK"_J:
|
||||
case "MP0_CHAR_FM_CARMOD_7_UNLCK"_J:
|
||||
case "MP1_CHAR_FM_CARMOD_1_UNLCK"_J:
|
||||
case "MP1_CHAR_FM_CARMOD_2_UNLCK"_J:
|
||||
case "MP1_CHAR_FM_CARMOD_3_UNLCK"_J:
|
||||
case "MP1_CHAR_FM_CARMOD_4_UNLCK"_J:
|
||||
case "MP1_CHAR_FM_CARMOD_5_UNLCK"_J:
|
||||
case "MP1_CHAR_FM_CARMOD_6_UNLCK"_J:
|
||||
case "MP1_CHAR_FM_CARMOD_7_UNLCK"_J: *out = -1; break;
|
||||
case "MP0_AWD_FMRALLYWONDRIVE"_J:
|
||||
case "MP0_AWD_FMRALLYWONNAV"_J:
|
||||
case "MP0_AWD_FMWINSEARACE"_J:
|
||||
case "MP0_AWD_FMWINAIRRACE"_J:
|
||||
case "MP1_AWD_FMRALLYWONDRIVE"_J:
|
||||
case "MP1_AWD_FMRALLYWONNAV"_J:
|
||||
case "MP1_AWD_FMWINSEARACE"_J:
|
||||
case "MP1_AWD_FMWINAIRRACE"_J: *out = 1; break;
|
||||
default: src->set_return_value<BOOL>(STATS::STAT_GET_INT(hash, out, src->get_arg<int>(2))); break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void STAT_SET_INT(rage::scrNativeCallContext* src)
|
||||
{
|
||||
const auto hash = src->get_arg<Hash>(0);
|
||||
if (hash == "SP0_TOTAL_CASH"_J || hash == "SP1_TOTAL_CASH"_J || hash == "SP2_TOTAL_CASH"_J)
|
||||
return;
|
||||
|
||||
src->set_return_value<BOOL>(STATS::STAT_SET_INT(hash, src->get_arg<int>(1), src->get_arg<int>(2)));
|
||||
}
|
||||
|
||||
inline void SET_ENTITY_COORDS(rage::scrNativeCallContext* src)
|
||||
{
|
||||
if (!g.vehicle.ls_customs)
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
#include "all_scripts.hpp"
|
||||
#include "am_launcher.hpp"
|
||||
#include "am_pi_menu.hpp"
|
||||
#include "carmod_shop.hpp"
|
||||
#include "creator.hpp"
|
||||
#include "freemode.hpp"
|
||||
#include "network_session_host.hpp"
|
||||
#include "shop_controller.hpp"
|
||||
#include "tunables.hpp"
|
||||
#include "am_pi_menu.hpp"
|
||||
|
||||
#include <script/scrProgram.hpp>
|
||||
|
||||
@ -48,7 +48,7 @@ namespace big
|
||||
|
||||
for (auto& [replacement_index, replacement_handler] : native_replacements)
|
||||
{
|
||||
auto og_handler = native_invoker::get_handlers()[static_cast<int>(replacement_index)];
|
||||
auto og_handler = native_invoker::get_handlers()[static_cast<int>(replacement_index)];
|
||||
handler_replacements[og_handler] = replacement_handler;
|
||||
}
|
||||
|
||||
@ -107,8 +107,6 @@ namespace big
|
||||
add_native_detour("carmod_shop"_J, NativeIndex::SET_ENTITY_COORDS, carmod_shop::SET_ENTITY_COORDS);
|
||||
add_native_detour("carmod_shop"_J, NativeIndex::SET_ENTITY_HEADING, carmod_shop::SET_ENTITY_HEADING);
|
||||
add_native_detour("carmod_shop"_J, NativeIndex::SET_VEHICLE_LIGHTS, carmod_shop::SET_VEHICLE_LIGHTS);
|
||||
add_native_detour("carmod_shop"_J, NativeIndex::STAT_GET_INT, carmod_shop::STAT_GET_INT);
|
||||
add_native_detour("carmod_shop"_J, NativeIndex::STAT_SET_INT, carmod_shop::STAT_SET_INT);
|
||||
add_native_detour("carmod_shop"_J, NativeIndex::DISABLE_ALL_CONTROL_ACTIONS, carmod_shop::DISABLE_ALL_CONTROL_ACTIONS);
|
||||
|
||||
add_native_detour("freemode"_J, NativeIndex::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH, freemode::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH);
|
||||
|
Reference in New Issue
Block a user