-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCheckerGen8SWSH.cs
More file actions
78 lines (65 loc) · 2.52 KB
/
CheckerGen8SWSH.cs
File metadata and controls
78 lines (65 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
namespace MissingEventFlagsCheckerPlugin
{
internal class CheckerGen8SWSH : EventFlagsChecker
{
static string? s_chkdb_res = null;
protected override void InitData(SaveFile savFile)
{
m_savFile = savFile;
#if DEBUG
// Force refresh
s_chkdb_res = null;
#endif
s_chkdb_res ??= ReadResFile("chkdb_gen8swsh");
m_flagsSourceInfo["0"] = 0;
m_flagsSourceInfo["1"] = 1;
m_flagsSourceInfo["-"] = -1;
ParseChecklist(s_chkdb_res);
}
protected override bool IsEvtSet(EventDetail evtDetail)
{
bool isEvtSet = false;
ulong idx = (uint)evtDetail.EvtId;
var savEventBlocks = ((ISCBlockArray)m_savFile!).Accessor;
switch (evtDetail.EvtSource)
{
case 0: // Bool blocks
isEvtSet = (savEventBlocks.GetBlockSafe((uint)idx).Type == SCTypeCode.Bool2);
break;
case 1: // Hidden Items
{
// Hidden Item data
// [0] - state 0: active
// 1: active (respawned)
// 2: obtained (will recycle)
// 3: obtained (permanently)
if (idx < 512)
{
isEvtSet = savEventBlocks.GetBlockSafe(0x6148F6AC).Data[(int)idx * 4] >= 2;
}
else if (idx < 1024)
{
var data = savEventBlocks.GetBlockSafe(0xE479EE37).Data;
if (data.Length == 0x810)
{
isEvtSet = data[((int)idx - 512) * 4] >= 2;
}
}
else if (idx < 1536)
{
var data = savEventBlocks.GetBlockSafe(0xE579EFCA).Data;
if (data.Length == 0x810)
{
isEvtSet = data[((int)idx - 1024) * 4] >= 2;
}
}
}
break;
default:
isEvtSet = false;
break;
}
return isEvtSet;
}
}
}