Skip to content

Commit ceb9701

Browse files
authored
Merge pull request #94 from acidlabsdev/main
refactor(ImGuiExt): refactor notification widget
2 parents debd89a + 2416d51 commit ceb9701

34 files changed

Lines changed: 552 additions & 214 deletions

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ You are free to use any style you want, except in these cases:
9999
### Formatting
100100

101101
- **Indentations:**
102-
- Does not matter. If using tabs, make sure one tab equals **four** spaces.
102+
- Indentation and empty spaces are handled by [.editorconfig](.editorconfig). Please make sure you have it in your workspace.
103103

104104
- **Line Wrapping:**
105105
- Try to wrap wide lines using either your IDE's formatter or a Pythonic way.

SSV2/includes/data/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ local Config <const> = {
300300
sy_always_max_income = false,
301301
sy_disable_rob_cd = false,
302302
sy_disable_rob_weekly_cd = false,
303+
safe_loop_warn_ack = false,
303304
},
304305
bsv2 = {
305306
escort_groups = {

SSV2/includes/data/yrv3_data.lua

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@ local RawBusinessData <const> = {
521521
{
522522
property_stat = "MPX_ARCADE_OWNED",
523523
cash_value_stat = "MPX_ARCADE_SAFE_CASH_VALUE",
524+
paytime_stat = "MPX_ARCADE_PAY_TIME_LEFT",
525+
interior_id = 278273,
526+
room_hash = 3710124102, -- MAINW_RM
524527
raw_data_entry = "Arcades",
525528
get_max_cash = function()
526529
return tunables.get_int("MAXARCADESAFESTORAGE")
@@ -529,23 +532,32 @@ local RawBusinessData <const> = {
529532
{
530533
property_stat = "MPX_FIXER_HQ_OWNED",
531534
cash_value_stat = "MPX_FIXER_SAFE_CASH_VALUE",
535+
paytime_stat = "MPX_FIXER_PASSIVE_PAY_TIME_LEFT",
536+
interior_id = 288257,
537+
room_hash = 767622941, -- ROOM_MAIN
532538
raw_data_entry = "Agencies",
533539
get_max_cash = function()
534540
return tunables.get_int("MAXFIXERHQSAFESTORAGE")
535541
end,
536542
},
537543
{
538544
property_stat = "MPX_BAIL_OFFICE_OWNED",
539-
cash_value_stat = "MPX_ARCADE_SAFE_CASH_VALUE",
545+
cash_value_stat = "MPX_BAIL_SAFE_CASH_VALUE",
540546
raw_data_entry = "BailOffices",
547+
interior_id = 295425,
548+
room_hash = 2990789022, -- ROOM_OFFICE
541549
get_max_cash = function()
542550
return tunables.get_int(-1736487760)
543551
end,
552+
-- no paytime_stat; this functions somewhat similar to the clubhouse duffle
544553
},
545554
{
546555
property_stat = "MPX_HACKER_DEN_OWNED",
547556
cash_value_stat = "MPX_HDEN24_SAFE_CASH_VALUE",
557+
paytime_stat = "MPX_HDEN24_PAY_TIME_LEFT",
548558
raw_data_entry = "HackerDen",
559+
interior_id = 297729,
560+
room_hash = 1055494658, -- ROOM_WORKSHOP
549561
get_max_cash = function()
550562
return tunables.get_int(-792265290)
551563
end,
@@ -554,6 +566,9 @@ local RawBusinessData <const> = {
554566
fronts = {
555567
salvage_yard = {
556568
cash_value_stat = "MPX_SALVAGE_SAFE_CASH_VALUE",
569+
paytime_stat = "MPX_SALVAGE_PAY_TIME_LEFT",
570+
interior_id = 293377,
571+
room_hash = 1287104603, -- SHOP_OFFICE
557572
get_max_cash = function()
558573
if (stats.get_int("MPX_SALVAGE_YARD_WALL_SAFE") == 1) then
559574
return tunables.get_int(594814186)
@@ -563,12 +578,21 @@ local RawBusinessData <const> = {
563578
},
564579
clubhouse = {
565580
cash_value_stat = "MPX_BIKER_BAR_RESUPPLY_CASH",
581+
interior_id = 246273,
582+
room_hash = 405984664, -- BIKERDLC_INT01_OFFRM
566583
get_max_cash = function()
567584
return tunables.get_int("BIKER_PASSIVE_INCOME_BAG_LIMIT")
568585
end,
586+
-- there's no paytime stat; naturally there's still a timer
587+
-- but this uses a packed stat int and a bool global as well.
588+
-- Im not even gonna bother.
589+
-- hint: 36620
569590
},
570591
nightclub = {
571592
cash_value_stat = "MPX_CLUB_SAFE_CASH_VALUE",
593+
paytime_stat = "MPX_CLUB_PAY_TIME_LEFT",
594+
interior_id = 271617,
595+
room_hash = 3920029441, -- "INT_01_ORIFICE"
572596
get_max_cash = function()
573597
return tunables.get_int("NIGHTCLUBMAXSAFEVALUE")
574598
end,

SSV2/includes/features/YimResupplierV3.lua

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,23 @@ function YRV3:DoesPlayerOwnAnyBikerBusiness()
302302
return false
303303
end
304304

305+
---@param idx integer
306+
---@return boolean
307+
function YRV3:IsPropertyIndexValid(idx)
308+
if (type(idx) ~= "number") then
309+
return false
310+
end
311+
312+
return idx > 0 and idx < math.int32_max()
313+
end
314+
305315
function YRV3:PopulateClubhouse()
306316
local club_prop = stats.get_int("MPX_PROP_CLUBHOUSE")
307-
if (club_prop == 0) then
317+
if (not self:IsPropertyIndexValid(club_prop)) then
308318
return
309319
end
310320

311-
local idx = club_prop - 90
321+
local idx = club_prop - 90
312322
local club_ref = self.m_raw_data.Clubhouses[idx]
313323
if (not club_ref) then
314324
return
@@ -420,18 +430,22 @@ function YRV3:PopulateNightclub()
420430

421431
ThreadManager:Run(function()
422432
local nc_index = stats.get_int("MPX_NIGHTCLUB_OWNED")
423-
local ref = self.m_raw_data.Nightclubs[nc_index]
424-
if (nc_index == 0 or not ref) then
433+
local ref = self.m_raw_data.Nightclubs[nc_index]
434+
if (not self:IsPropertyIndexValid(nc_index) or not ref) then
425435
self.m_data_initialized = true
426436
return
427437
end
428438

439+
local nameid = stats.get_int("MPX_PROP_NIGHTCLUB_NAME_ID")
429440
local safedata = self.m_raw_data.CashSafes.fronts.nightclub
430-
safedata.name = "Nightclub Safe"
441+
local clubname = NightclubNames[nameid + 1]
442+
safedata.name = clubname
443+
444+
431445
self.m_businesses.nightclub = Nightclub.new({
432446
id = nc_index,
433447
name = Game.GetGXTLabel(_F("MP_NCLU_%d", nc_index)),
434-
custom_name = NightclubNames[stats.get_int("MPX_PROP_NIGHTCLUB_NAME_ID") + 1],
448+
custom_name = clubname,
435449
coords = ref.coords,
436450
safe_data = safedata
437451
})
@@ -471,7 +485,6 @@ function YRV3:PopulateNightclub()
471485
end
472486

473487
self.m_data_initialized = true
474-
sleep(3000)
475488

476489
if (GVars.features.yrv3.nc_always_popular) then
477490
self.m_businesses.nightclub:LockPopularityDecay()
@@ -480,7 +493,8 @@ function YRV3:PopulateNightclub()
480493
end
481494

482495
function YRV3:PopulateCarWash()
483-
if (stats.get_int("MPX_SB_CAR_WASH_OWNED") == 0) then
496+
local idx = stats.get_int("MPX_SB_CAR_WASH_OWNED")
497+
if (not self:IsPropertyIndexValid(idx)) then
484498
return
485499
end
486500

@@ -493,7 +507,7 @@ end
493507
function YRV3:PopulateCashSafes()
494508
for i, data in ipairs(self.m_raw_data.CashSafes.regular) do
495509
local property_index = stats.get_int(data.property_stat)
496-
if (property_index == 0) then
510+
if (not self:IsPropertyIndexValid(property_index)) then
497511
goto continue
498512
end
499513

@@ -504,6 +518,9 @@ function YRV3:PopulateCashSafes()
504518
name = name,
505519
coords = coords,
506520
cash_value_stat = data.cash_value_stat,
521+
paytime_stat = data.paytime_stat,
522+
interior_id = data.interior_id,
523+
room_hash = data.room_hash,
507524
get_max_cash = data.get_max_cash,
508525
})
509526

@@ -513,14 +530,16 @@ end
513530

514531
function YRV3:PopulateSalvageYard()
515532
local property_index = stats.get_int("MPX_SALVAGE_YARD_OWNED")
516-
if (property_index == 0) then
533+
if (not self:IsPropertyIndexValid(property_index)) then
517534
return
518535
end
519536

520-
local ref = self.m_raw_data.SalvageYards[property_index]
521-
local name = ref and Game.GetGXTLabel(ref.gxt) or _T("SY_SALVAGE_YARD")
522-
local safe_data = self.m_raw_data.CashSafes.fronts.salvage_yard
523-
safe_data.name = name
537+
local ref = self.m_raw_data.SalvageYards[property_index]
538+
local name = ref and Game.GetGXTLabel(ref.gxt) or _T("SY_SALVAGE_YARD")
539+
local safe_data = self.m_raw_data.CashSafes.fronts.salvage_yard
540+
safe_data.name = name
541+
542+
524543
self.m_businesses.salvage_yard = SalvageYard.new({
525544
id = property_index,
526545
name = name,
@@ -1023,20 +1042,19 @@ function YRV3:UpdateBusinesses()
10231042
end
10241043

10251044
for key, business in pairs(self.m_businesses) do
1026-
if (key == "safes" or key == "salvage_yard" or key == "car_wash") then
1027-
goto continue
1028-
end
1029-
10301045
if (key == "warehouses") then
10311046
for _, wh in ipairs(business) do
10321047
if (type(wh.Update) == "function") then
10331048
wh:Update()
10341049
end
10351050
end
1051+
elseif (key == "safes") then
1052+
for _, safe in ipairs(self.m_businesses.safes) do
1053+
safe:Update()
1054+
end
10361055
elseif (type(business.Update) == "function") then
10371056
business:Update()
10381057
end
1039-
::continue::
10401058
end
10411059

10421060
self.m_last_business_update_time = Time.millis()

SSV2/includes/frontend/entity_forge_ui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
local World = require("includes.modules.World")
1111
local t_GameObjects = require("includes.data.objects")
12-
local t_GamePeds = require("includes.data.ped_reverse_lookup")
12+
local t_GamePeds = require("includes.data.ped_hashmap")
1313
local t_GameVehicles = require("includes.data.vehicles")
1414
local t_PedScenarios = require("includes.data.actions.scenarios")
1515
local Refs = require("includes.data.refs")

0 commit comments

Comments
 (0)