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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
using System;
using System.Collections.Generic;
namespace XUtliPoolLib
{
public class XMeshPartList
{
public static byte NormalPart = 1;
public static byte OnePart = 3;
public static byte CutoutPart = 7;
public static byte ReplacePart = 8;
public static byte ReplaceTex = 16;
public static byte ShareTex = 32;
public string[] partSuffix = new string[9];
public string[] proPrefix = null;
public string sharedPrefix = null;
public Dictionary<uint, byte> meshPartsInfo = null;
public Dictionary<uint, string> replaceMeshPartsInfo = null;
public Dictionary<uint, string> replaceTexPartsInfo = null;
public static byte ConvertType(byte type)
{
byte result;
if (type != 1)
{
if (type != 3)
{
if (type != 7)
{
result = 3;
}
else
{
result = 7;
}
}
else
{
result = 3;
}
}
else
{
result = 3;
}
return result;
}
public bool GetMeshInfo(string location, int professionType, int part, string srcDir, out byte partType, ref string meshLocation, ref string texLocation)
{
partType = 0;
uint key = XSingleton<XCommon>.singleton.XHash(location);
bool flag = this.meshPartsInfo.TryGetValue(key, out partType);
bool result;
if (flag)
{
bool flag2 = partType > XMeshPartList.CutoutPart;
if (flag2)
{
bool flag3 = (partType & XMeshPartList.ReplacePart) > 0;
if (flag3)
{
partType &= (byte)~XMeshPartList.ReplacePart;
bool flag4 = this.replaceMeshPartsInfo.TryGetValue(key, out meshLocation);
if (flag4)
{
string text = this.proPrefix[professionType];
string arg = this.partSuffix[part];
meshLocation = string.Format("Equipments/{0}/{1}{2}", meshLocation, text, arg);
key = XSingleton<XCommon>.singleton.XHash(meshLocation);
}
}
bool flag5 = (partType & XMeshPartList.ReplaceTex) > 0;
if (flag5)
{
partType &= (byte) ~XMeshPartList.ReplaceTex;
bool flag6 = this.replaceTexPartsInfo.TryGetValue(key, out texLocation);
if (flag6)
{
bool flag7 = texLocation.StartsWith("/");
if (flag7)
{
bool flag8 = string.IsNullOrEmpty(srcDir);
if (flag8)
{
texLocation = null;
}
else
{
bool flag9 = srcDir.StartsWith("/");
if (flag9)
{
texLocation = string.Format("Equipments{0}{1}", srcDir, texLocation);
}
else
{
texLocation = string.Format("Equipments/{0}{1}", srcDir, texLocation);
}
}
}
else
{
texLocation = string.Format("Equipments/Player/{0}", texLocation);
}
}
}
else
{
bool flag10 = (partType & XMeshPartList.ShareTex) > 0;
if (flag10)
{
partType &= (byte) ~XMeshPartList.ShareTex;
bool flag11 = this.proPrefix != null && professionType < this.proPrefix.Length;
if (flag11)
{
string text = this.proPrefix[professionType];
texLocation = location.Replace(text, this.sharedPrefix);
}
}
}
}
result = true;
}
else
{
result = false;
}
return result;
}
public void Load()
{
bool flag = this.meshPartsInfo != null;
if (flag)
{
this.meshPartsInfo.Clear();
}
bool flag2 = this.replaceMeshPartsInfo != null;
if (flag2)
{
this.replaceMeshPartsInfo.Clear();
}
XBinaryReader xbinaryReader = XSingleton<XResourceLoaderMgr>.singleton.ReadBinary("Equipments/equipmentInfo", ".bytes", true, true);
bool flag3 = xbinaryReader != null;
if (flag3)
{
try
{
int num = xbinaryReader.ReadInt32();
this.proPrefix = new string[num];
for (int i = 0; i < num; i++)
{
this.proPrefix[i] = xbinaryReader.ReadString(-1);
}
int num2 = xbinaryReader.ReadInt32();
for (int j = 0; j < num2; j++)
{
bool flag4 = j < this.partSuffix.Length;
if (flag4)
{
this.partSuffix[j] = xbinaryReader.ReadString(-1);
}
}
this.sharedPrefix = xbinaryReader.ReadString(-1);
int num3 = xbinaryReader.ReadInt32();
string[] array = new string[num3];
for (int k = 0; k < num3; k++)
{
array[k] = xbinaryReader.ReadString(-1);
}
int num4 = xbinaryReader.ReadInt32();
bool flag5 = this.meshPartsInfo == null;
if (flag5)
{
this.meshPartsInfo = new Dictionary<uint, byte>(num4);
}
for (int l = 0; l < num4; l++)
{
uint key = xbinaryReader.ReadUInt32();
byte value = xbinaryReader.ReadByte();
this.meshPartsInfo[key] = value;
}
num4 = xbinaryReader.ReadInt32();
bool flag6 = this.replaceMeshPartsInfo == null;
if (flag6)
{
this.replaceMeshPartsInfo = new Dictionary<uint, string>(num4);
}
for (int m = 0; m < num4; m++)
{
uint key2 = xbinaryReader.ReadUInt32();
ushort num5 = xbinaryReader.ReadUInt16();
string value2 = array[(int)num5];
this.replaceMeshPartsInfo[key2] = value2;
}
num4 = xbinaryReader.ReadInt32();
bool flag7 = this.replaceTexPartsInfo == null;
if (flag7)
{
this.replaceTexPartsInfo = new Dictionary<uint, string>(num4);
}
for (int n = 0; n < num4; n++)
{
uint key3 = xbinaryReader.ReadUInt32();
ushort num6 = xbinaryReader.ReadUInt16();
string value3 = array[(int)num6];
this.replaceTexPartsInfo[key3] = value3;
}
}
catch (Exception ex)
{
XSingleton<XDebug>.singleton.AddErrorLog(ex.Message, null, null, null, null, null);
}
}
XSingleton<XResourceLoaderMgr>.singleton.ClearBinary(xbinaryReader, true);
}
}
}
|