Skip to content

Commit 0b1f213

Browse files
committed
refactor(YHV1): More sane approach and tooltip warning
1 parent 11488e0 commit 0b1f213

3 files changed

Lines changed: 12 additions & 34 deletions

File tree

SSV2/includes/features/YimHeistsV1.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
---@field public val integer
1313
---@field public cooldown_name string
1414
---@field public cooldown_gvar string GVar path name
15-
---@field public gvar fun(set_val?: boolean): boolean? Getter/setter for cooldown GVar
1615

1716
---@class HeistInfo
1817
---@field public get_name fun(): string

SSV2/includes/frontend/yhv1_ui.lua

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ local HEIST_TYPES = {
3535
val = 31,
3636
cooldown_name = "MPX_SALV23_CFR_COOLDOWN",
3737
cooldown_gvar = "cfr_cd",
38-
gvar = function(set)
39-
if (type(set) ~= "boolean") then
40-
return GVars.features.yim_heists.cfr_cd
41-
end
42-
GVars.features.yim_heists.cfr_cd = set
43-
end,
4438
},
4539
},
4640
{ -- KnoWay
@@ -55,12 +49,6 @@ local HEIST_TYPES = {
5549
val = 4,
5650
cooldown_name = "MPX_M25_AVI_MISSION_CD",
5751
cooldown_gvar = "knoway_cd",
58-
gvar = function(set)
59-
if (type(set) ~= "boolean") then
60-
return GVars.features.yim_heists.knoway_cd
61-
end
62-
GVars.features.yim_heists.knoway_cd = set
63-
end,
6452
},
6553
},
6654
{ -- Dr Dre
@@ -75,12 +63,6 @@ local HEIST_TYPES = {
7563
val = 4095,
7664
cooldown_name = "MPX_FIXER_STORY_COOLDOWN",
7765
cooldown_gvar = "dre_cd",
78-
gvar = function(set)
79-
if (type(set) ~= "boolean") then
80-
return GVars.features.yim_heists.dre_cd
81-
end
82-
GVars.features.yim_heists.dre_cd = set
83-
end,
8466
}
8567
},
8668
{ -- Oscar Guzman
@@ -95,12 +77,6 @@ local HEIST_TYPES = {
9577
val = 31,
9678
cooldown_name = "MPX_HACKER24_MFM_COOLDOWN",
9779
cooldown_gvar = "ogfa_cd",
98-
gvar = function(set)
99-
if (type(set) ~= "boolean") then
100-
return GVars.features.yim_heists.ogfa_cd
101-
end
102-
GVars.features.yim_heists.ogfa_cd = set
103-
end,
10480
},
10581
opt_info = "Complete first mission on Hard first!"
10682
},
@@ -142,15 +118,15 @@ local function drawBasicTab()
142118
ImGui.EndDisabled()
143119
ImGui.SameLine()
144120

145-
local new_cd_state, cd_state_changed = GUI:CustomToggle(_T("CP_HEIST_COOLDOWN_DISABLE"), heist.stat.gvar(), {
146-
onClick = function()
147-
YRV3:SetCooldownStateDirty(heist.stat.cooldown_gvar, true)
148-
end
149-
})
150-
151-
if (cd_state_changed) then
152-
heist.stat.gvar(new_cd_state)
153-
end
121+
local key = heist.stat.cooldown_gvar
122+
GVars.features.yim_heists[key], _ = GUI:CustomToggle(_T("CP_HEIST_COOLDOWN_DISABLE"),
123+
GVars.features.yim_heists[key], {
124+
tooltip = _T("YH_COOLDOWN_BYPASS_TOOLTIP"),
125+
color = Color("#AA0000"),
126+
onClick = function()
127+
YRV3:SetCooldownStateDirty(key, true)
128+
end
129+
})
154130

155131
ImGui.PopID()
156132

@@ -307,6 +283,8 @@ local function drawCayoTab()
307283

308284
GVars.features.yim_heists.cayo_cd, _ = GUI:CustomToggle(_T("CP_HEIST_COOLDOWN_DISABLE"),
309285
GVars.features.yim_heists.cayo_cd, {
286+
tooltip = _T("YH_COOLDOWN_BYPASS_TOOLTIP"),
287+
color = Color("#AA0000"),
310288
onClick = function()
311289
YRV3:SetCooldownStateDirty("cayo_cd", true)
312290
end

SSV2/includes/lib/translations/en-US.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ return {
728728
["YH_CAYO_TAB"] = "Cayo Perico",
729729
["YH_SUBMARINE_NOT_OWNED"] = "Purchase a Kosatka to access the Cayo Perico Heist.", -- HIF_SUB_HELP
730730
["YH_PREP_SKIP_NOTIF"] = "All preparation missions have been skipped. You can now start the final mission.",
731+
["YH_COOLDOWN_BYPASS_TOOLTIP"] = "Disables cooldown, may result in ban. Use at your own risk!",
731732
["YH_CAYO_REQUEST_SUB"] = "Request Submarine",
732733
["YH_CAYO_TARGET_PRIMARY"] = "Primary Target",
733734
["YH_CAYO_TARGET_SECONDARY_I"] = "Secondary Target (Island)",

0 commit comments

Comments
 (0)