-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGameObjectInfo.cs
144 lines (112 loc) · 4.3 KB
/
GameObjectInfo.cs
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
using System.Runtime.InteropServices;
using Dalamud;
namespace PathMapper;
[StructLayout(LayoutKind.Explicit)]
public struct GameObjectInfo : IComparable {
public static GameObjectInfo Equipment(FileType type, ushort setId, GenderRace gr = GenderRace.Unknown, EquipSlot slot = EquipSlot.Unknown, byte variant = 0) => new() {
FileType = type,
ObjectType = slot.IsAccessory() ? ObjectType.Accessory : ObjectType.Equipment,
PrimaryId = setId,
GenderRace = gr,
Variant = variant,
EquipSlot = slot,
};
public static GameObjectInfo EquipmentVfx(FileType type, ushort modelId, ushort effectId, EquipSlot slot, byte variant) => new() {
FileType = type,
ObjectType = ObjectType.Equipment,
PrimaryId = modelId,
SecondaryId = effectId,
Variant = variant,
EquipSlot = slot,
};
public static GameObjectInfo Weapon(FileType type, ushort setId, ushort weaponId, byte variant = 0) => new() {
FileType = type,
ObjectType = ObjectType.Weapon,
PrimaryId = setId,
SecondaryId = weaponId,
Variant = variant,
};
public static GameObjectInfo Customization(FileType type, CustomizationType customizationType, ushort id = 0, GenderRace gr = GenderRace.Unknown, BodySlot bodySlot = BodySlot.Unknown, byte variant = 0) => new() {
FileType = type,
ObjectType = ObjectType.Character,
PrimaryId = id,
GenderRace = gr,
BodySlot = bodySlot,
Variant = variant,
CustomizationType = customizationType,
};
public static GameObjectInfo Monster(FileType type, ushort monsterId, ushort bodyId, byte variant = 0) => new() {
FileType = type,
ObjectType = ObjectType.Monster,
PrimaryId = monsterId,
SecondaryId = bodyId,
Variant = variant,
};
public static GameObjectInfo DemiHuman(FileType type, ushort demiHumanId, ushort bodyId, EquipSlot slot = EquipSlot.Unknown, byte variant = 0) => new() {
FileType = type,
ObjectType = ObjectType.DemiHuman,
PrimaryId = demiHumanId,
SecondaryId = bodyId,
Variant = variant,
EquipSlot = slot,
};
public static GameObjectInfo Map(FileType type, byte c1, byte c2, byte c3, byte c4, byte variant, byte suffix = 0) => new() {
FileType = type,
ObjectType = ObjectType.Map,
MapC1 = c1,
MapC2 = c2,
MapC3 = c3,
MapC4 = c4,
MapSuffix = suffix,
Variant = variant,
};
public static GameObjectInfo Icon(FileType type, uint iconId, bool hq, bool hr, ClientLanguage lang = ClientLanguage.English) => new() {
FileType = type,
ObjectType = ObjectType.Icon,
IconId = iconId,
IconHqHr = (byte) (hq ? hr ? 3 : 1 : hr ? 2 : 0),
Language = lang,
};
[FieldOffset(0)]
public readonly ulong Identifier;
[FieldOffset(0)]
public FileType FileType;
[FieldOffset(1)]
public ObjectType ObjectType;
[FieldOffset(2)]
public ushort PrimaryId; // Equipment, Weapon, Customization, Monster, DemiHuman
[FieldOffset(2)]
public uint IconId; // Icon
[FieldOffset(2)]
public byte MapC1; // Map
[FieldOffset(3)]
public byte MapC2; // Map
[FieldOffset(4)]
public ushort SecondaryId; // Weapon, Monster, Demihuman
[FieldOffset(4)]
public byte MapC3; // Map
[FieldOffset(4)]
private byte _genderRaceByte; // Equipment, Customization
public GenderRace GenderRace {
get => Names.GenderRaceFromByte(this._genderRaceByte);
set => this._genderRaceByte = value.ToByte();
}
[FieldOffset(5)]
public BodySlot BodySlot; // Customization
[FieldOffset(5)]
public byte MapC4; // Map
[FieldOffset(6)]
public byte Variant; // Equipment, Weapon, Customization, Map, Monster, Demihuman
[FieldOffset(6)]
public byte IconHqHr; // Icon
[FieldOffset(7)]
public EquipSlot EquipSlot; // Equipment, Demihuman
[FieldOffset(7)]
public CustomizationType CustomizationType; // Customization
[FieldOffset(7)]
public ClientLanguage Language; // Icon
[FieldOffset(7)]
public byte MapSuffix;
public override int GetHashCode() => this.Identifier.GetHashCode();
public int CompareTo(object? r) => this.Identifier.CompareTo(r);
}