generated from Yimura/TemplateHellBase
-
Notifications
You must be signed in to change notification settings - Fork 72
add heist modifier #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
add heist modifier #181
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,132 @@ | ||
#include "core/commands/IntCommand.hpp" | ||
#include "core/commands/Command.hpp" | ||
#include "game/gta/Stats.hpp" | ||
#include "game/backend/Players.hpp" | ||
#include "game/gta/ScriptGlobal.hpp" | ||
#include "game/gta/ScriptLocal.hpp" | ||
#include "core/backend/ScriptMgr.hpp" | ||
#include "types/script/globals/GlobalPlayerBD.hpp" | ||
|
||
namespace YimMenu::Features | ||
{ | ||
namespace ApartmentHeist | ||
{ | ||
static IntCommand _ApartmentHeistCut1{"apartmentheistcut1", "Player 1", "Player 1 cut", std::nullopt, std::nullopt, 0}; | ||
static IntCommand _ApartmentHeistCut2{"apartmentheistcut2", "Player 2", "Player 2 cut", std::nullopt, std::nullopt, 0}; | ||
static IntCommand _ApartmentHeistCut3{"apartmentheistcut3", "Player 3", "Player 3 cut", std::nullopt, std::nullopt, 0}; | ||
static IntCommand _ApartmentHeistCut4{"apartmentheistcut4", "Player 4", "Player 4 cut", std::nullopt, std::nullopt, 0}; | ||
|
||
class SetCuts : public Command | ||
{ | ||
using Command::Command; | ||
|
||
virtual void OnCall() override | ||
{ | ||
auto base1 = ScriptGlobal(1929794).At(1); | ||
auto base2 = ScriptGlobal(1931762).At(3008); | ||
|
||
*base1.At(1).As<int*>() = 100 - (_ApartmentHeistCut1.GetState() + _ApartmentHeistCut2.GetState() + _ApartmentHeistCut3.GetState() + _ApartmentHeistCut4.GetState()); | ||
*base1.At(2).As<int*>() = _ApartmentHeistCut2.GetState(); | ||
*base1.At(3).As<int*>() = _ApartmentHeistCut3.GetState(); | ||
*base1.At(4).As<int*>() = _ApartmentHeistCut4.GetState(); | ||
|
||
ScriptMgr::Yield(500ms); | ||
|
||
*base2.At(1).As<int*>() = -1 * (*base1.At(1).As<int*>() + *base1.At(2).As<int*>() + *base1.At(3).As<int*>() + *base1.At(4).As<int*>() - 100); | ||
*base2.At(2).As<int*>() = *base1.At(2).As<int*>(); | ||
*base2.At(3).As<int*>() = *base1.At(3).As<int*>(); | ||
*base2.At(4).As<int*>() = *base1.At(4).As<int*>(); | ||
} | ||
}; | ||
|
||
class ForceReady : public Command | ||
{ | ||
using Command::Command; | ||
|
||
virtual void OnCall() override | ||
{ | ||
if (auto gpbd = GlobalPlayerBD::Get(); gpbd && Scripts::SafeToModifyFreemodeBroadcastGlobals()) | ||
{ | ||
for (auto& player : Players::GetPlayers()) | ||
{ | ||
gpbd->Entries[player.second.GetId()].HeistCutSelectionStage = 6; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
class Setup : public Command | ||
{ | ||
using Command::Command; | ||
|
||
virtual void OnCall() override | ||
{ | ||
Stats::SetInt("MPX_HEIST_PLANNING_STAGE", -1); | ||
} | ||
}; | ||
|
||
class SkipHacking : public Command | ||
{ | ||
using Command::Command; | ||
|
||
virtual void OnCall() override | ||
{ | ||
*ScriptLocal("fm_mission_controller"_J, 12216).At(24).As<int*>() = 7; | ||
*ScriptLocal("fm_mission_controller"_J, 10213).As<int*>() = *ScriptLocal("fm_mission_controller"_J, 10213).As<int*>() | (1 << 9); | ||
} | ||
}; | ||
|
||
class SkipDrilling : public Command | ||
{ | ||
using Command::Command; | ||
|
||
virtual void OnCall() override | ||
{ | ||
*ScriptLocal("fm_mission_controller"_J, 10507).At(11).As<float*>() = 100.0f; | ||
} | ||
}; | ||
|
||
class InstantFinish : public Command | ||
{ | ||
using Command::Command; | ||
|
||
virtual void OnCall() override | ||
{ | ||
Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); | ||
ScriptMgr::Yield(500ms); | ||
|
||
*ScriptLocal("fm_mission_controller"_J, 20387).At(1725).At(1).As<int*>() = 80; | ||
*ScriptLocal("fm_mission_controller"_J, 20387).As<int*>() = 12; | ||
*ScriptLocal("fm_mission_controller"_J, 29006).At(1).As<int*>() = 99999; | ||
*ScriptLocal("fm_mission_controller"_J, 32462).At(1).At(68).As<int*>() = 99999; | ||
|
||
// TODO: find a way of getting current heist info so that InstantFinishPacific can be implemented here conditionally. | ||
} | ||
}; | ||
|
||
class InstantFinishPacific : public Command | ||
{ | ||
using Command::Command; | ||
|
||
virtual void OnCall() override | ||
{ | ||
Scripts::ForceScriptHost(Scripts::FindScriptThread("fm_mission_controller"_J)); | ||
ScriptMgr::Yield(500ms); | ||
|
||
*ScriptLocal("fm_mission_controller"_J, 20387).At(2686).As<int*>() = 1875000; | ||
*ScriptLocal("fm_mission_controller"_J, 20387).At(1062).As<int*>() = 5; | ||
*ScriptLocal("fm_mission_controller"_J, 20387).As<int*>() = 12; | ||
*ScriptLocal("fm_mission_controller"_J, 29006).At(1).As<int*>() = 99999; | ||
*ScriptLocal("fm_mission_controller"_J, 32462).At(1).At(68).As<int*>() = 99999; | ||
} | ||
}; | ||
|
||
static SetCuts _ApartmentHeistSetCuts{"apartmentheistsetcuts", "Set Cuts", "Sets heist cut"}; | ||
static ForceReady _ApartmentHeistForceReady{"apartmentheistforceready", "Force Ready", "Forces all players to be ready"}; | ||
static Setup _ApartmentHeistSetup{"apartmentheistsetup", "Setup", "Sets up current apartment heist"}; | ||
static SkipHacking _ApartmentHeistSkipHacking{"apartmentheistskiphacking", "Skip Hacking", "Skips hacking process"}; | ||
static SkipDrilling _ApartmentHeistSkipDrilling{"apartmentheistskipdrilling", "Skip Drilling", "Skips drilling process"}; | ||
static InstantFinish _ApartmentHeistInstantFinish{"apartmentheistinstantfinish", "Instant Finish", "Instantly passes the heist"}; | ||
static InstantFinishPacific _ApartmentHeistInstantFinishPacific{"apartmentheistinstantfinishpacific", "Instant Finish (Pacific)", "Instantly passes Pacific Standard Job"}; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterate all players and modify this field in GlobalPlayerBD instead. Modifying others' broadcast stuff is generally bad practice, but you should be fine for this one (assuming you are the script host)