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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XGuildGrowthDocument : XDocComponent
{
public override uint ID
{
get
{
return XGuildGrowthDocument.uuID;
}
}
public GuildZiCai GuildZiCaiTableReader
{
get
{
return XGuildGrowthDocument._guildZiCaiTable;
}
}
public List<XGuildGrowthDocument.GuildGrowthBuffData> BuffList
{
get
{
return XGuildGrowthDocument._buffList;
}
}
public List<XGuildGrowthDocument.GuildGrowthRankData> RankList
{
get
{
return this._rankList;
}
}
public List<XGuildGrowthDocument.GuildCrowthRecordData> RecordList
{
get
{
return this._recordList;
}
}
public XGuildGrowthDocument.GuildGrowthRankData MyData
{
get
{
return this._myData;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XGuildGrowthDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static GuildHall _guildHallTable = new GuildHall();
private static GuildZiCai _guildZiCaiTable = new GuildZiCai();
private static Dictionary<uint, GuildHall.RowData> _buffDict = new Dictionary<uint, GuildHall.RowData>();
private static readonly uint INTERVALNUM = 10000u;
public bool LevelUpEnable = false;
public bool AutoFindNpc = false;
private static List<XGuildGrowthDocument.GuildGrowthBuffData> _buffList = new List<XGuildGrowthDocument.GuildGrowthBuffData>();
private List<XGuildGrowthDocument.GuildGrowthRankData> _rankList = new List<XGuildGrowthDocument.GuildGrowthRankData>();
private List<XGuildGrowthDocument.GuildCrowthRecordData> _recordList = new List<XGuildGrowthDocument.GuildCrowthRecordData>();
private XGuildGrowthDocument.GuildGrowthRankData _myData;
public int MyRank;
public uint WeekHallPoint;
public uint WeekSchoolPoint;
public uint WeekHuntTimes;
public uint WeekDonateTimes;
public uint ResourcesPoint;
public uint TechnologyPoint;
public uint ResDeltaPoint = 0u;
public uint TecDeltaPoint = 0u;
public class GuildGrowthBuffData
{
public uint BuffID;
public uint BuffLevel;
public uint BuffMaxLevel;
public bool Enable;
public GuildGrowthBuffData(uint id, uint level, uint maxLevel, bool enable)
{
this.BuffID = id;
this.BuffLevel = level;
this.BuffMaxLevel = maxLevel;
this.Enable = enable;
}
}
public class GuildGrowthRankData
{
public string Name;
public ulong Uid;
public uint HallPoint;
public uint SchoolPoint;
public GuildGrowthRankData(string name, ulong uid, uint hallPoint, uint schoolPoint)
{
this.Name = name;
this.Uid = uid;
this.HallPoint = hallPoint;
this.SchoolPoint = schoolPoint;
}
}
public class GuildCrowthRecordData
{
public string Name;
public uint ItemID;
public uint Time;
public GuildCrowthRecordData(string name, uint itemID, uint time)
{
this.Name = name;
this.ItemID = itemID;
this.Time = time;
}
}
public void SetPoint(uint resources, uint technology)
{
this.ResourcesPoint = resources;
this.TechnologyPoint = technology;
bool flag = DlgBase<XGuildGrowthBuffView, XGuildGrowthBuffBehavior>.singleton.IsVisible();
if (flag)
{
DlgBase<XGuildGrowthBuffView, XGuildGrowthBuffBehavior>.singleton.RefreshList(false);
}
bool flag2 = DlgBase<XGuildGrowthLabView, XGuildGrowthLabBehavior>.singleton.IsVisible();
if (flag2)
{
DlgBase<XGuildGrowthLabView, XGuildGrowthLabBehavior>.singleton.RefreshList(false);
}
}
public void CheckShowItemGet(uint resDelta, uint tecDelta)
{
this.ResDeltaPoint += resDelta;
this.TecDeltaPoint += tecDelta;
this.ShowDeltaPointGet();
}
public void ShowDeltaPointGet()
{
bool flag = XSingleton<XGame>.singleton.CurrentStage.Stage != EXStage.Hall;
if (!flag)
{
bool flag2 = this.ResDeltaPoint > 0u;
if (flag2)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetReplaceString("GuildGrowthResDelta", new object[0]), this.ResDeltaPoint), "fece00");
this.ResDeltaPoint = 0u;
}
bool flag3 = this.TecDeltaPoint > 0u;
if (flag3)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetReplaceString("GuildGrowthTecDelta", new object[0]), this.TecDeltaPoint), "fece00");
this.TecDeltaPoint = 0u;
}
}
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
public override void OnEnterScene()
{
base.OnEnterScene();
}
public override void OnEnterSceneFinally()
{
base.OnEnterSceneFinally();
bool autoFindNpc = this.AutoFindNpc;
if (autoFindNpc)
{
this.AutoFindNpc = false;
bool flag = XSingleton<XScene>.singleton.SceneID == 4u;
if (flag)
{
this.FindNpc();
}
}
this.ShowDeltaPointGet();
}
public void FindNpc()
{
XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(19u);
bool flag = npc == null;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("Can't find guild build npc.", null, null, null, null, null);
}
else
{
XSingleton<XInput>.singleton.LastNpc = npc;
}
}
public static void Execute(OnLoadedCallback callback = null)
{
XGuildGrowthDocument.AsyncLoader.AddTask("Table/GuildHall", XGuildGrowthDocument._guildHallTable, false);
XGuildGrowthDocument.AsyncLoader.AddTask("Table/GuildZiCai", XGuildGrowthDocument._guildZiCaiTable, false);
XGuildGrowthDocument.AsyncLoader.Execute(callback);
}
public static void OnTableLoaded()
{
uint num = 0u;
for (int i = 0; i < XGuildGrowthDocument._guildHallTable.Table.Length; i++)
{
bool flag = XGuildGrowthDocument._guildHallTable.Table[i].skillid > num;
if (flag)
{
num = XGuildGrowthDocument._guildHallTable.Table[i].skillid;
}
}
XGuildGrowthDocument._buffList.Clear();
for (uint num2 = 0u; num2 <= num; num2 += 1u)
{
XGuildGrowthDocument._buffList.Add(new XGuildGrowthDocument.GuildGrowthBuffData(num2, 0u, 0u, false));
}
XGuildGrowthDocument._buffDict.Clear();
for (int j = 0; j < XGuildGrowthDocument._guildHallTable.Table.Length; j++)
{
GuildHall.RowData rowData = XGuildGrowthDocument._guildHallTable.Table[j];
bool flag2 = rowData.level > XGuildGrowthDocument._buffList[(int)rowData.skillid].BuffMaxLevel;
if (flag2)
{
XGuildGrowthDocument._buffList[(int)rowData.skillid].BuffMaxLevel = rowData.level;
}
XGuildGrowthDocument._buffDict.Add(rowData.skillid * XGuildGrowthDocument.INTERVALNUM + rowData.level, rowData);
}
}
public GuildHall.RowData GetData(uint skillID, uint skillLevel)
{
uint key = skillID * XGuildGrowthDocument.INTERVALNUM + skillLevel;
GuildHall.RowData result = null;
bool flag = !XGuildGrowthDocument._buffDict.TryGetValue(key, out result);
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("Can't find guild growth data for guildhall.txt, id = ", skillID.ToString() + " level = ", skillLevel.ToString(), null, null, null);
}
return result;
}
public void QueryBuffList()
{
RpcC2M_GuildHallGetBuffList rpc = new RpcC2M_GuildHallGetBuffList();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void OnBuffListReply(GuildHallGetBuffList_M2C oRes)
{
this.LevelUpEnable = oRes.enableUpdate;
for (int i = 0; i < XGuildGrowthDocument._buffList.Count; i++)
{
XGuildGrowthDocument._buffList[i].BuffLevel = 0u;
XGuildGrowthDocument._buffList[i].Enable = false;
}
for (int j = 0; j < oRes.bufflist.Count; j++)
{
XGuildGrowthDocument._buffList[(int)oRes.bufflist[j].buffid].BuffLevel = oRes.bufflist[j].level;
XGuildGrowthDocument._buffList[(int)oRes.bufflist[j].buffid].Enable = oRes.bufflist[j].isenable;
}
bool flag = DlgBase<XGuildGrowthBuffView, XGuildGrowthBuffBehavior>.singleton.IsVisible();
if (flag)
{
DlgBase<XGuildGrowthBuffView, XGuildGrowthBuffBehavior>.singleton.RefreshList(false);
}
bool flag2 = DlgBase<XGuildHallView, XGuildHallBehaviour>.singleton.IsVisible();
if (flag2)
{
DlgBase<XGuildHallView, XGuildHallBehaviour>.singleton.RefreshGrowthBuffList();
}
}
public void QueryGuildHallBuffLevelUp(uint buffid)
{
RpcC2M_GuildHallUpdateBuff rpcC2M_GuildHallUpdateBuff = new RpcC2M_GuildHallUpdateBuff();
rpcC2M_GuildHallUpdateBuff.oArg.buffid = buffid;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GuildHallUpdateBuff);
}
public void OnBuffLevelUpSuccess(GuildHallBuffData data)
{
XGuildGrowthDocument._buffList[(int)data.buffid].BuffLevel = data.level;
XGuildGrowthDocument._buffList[(int)data.buffid].Enable = data.isenable;
bool flag = DlgBase<XGuildGrowthBuffView, XGuildGrowthBuffBehavior>.singleton.IsVisible();
if (flag)
{
DlgBase<XGuildGrowthBuffView, XGuildGrowthBuffBehavior>.singleton.ShowLevelUpFx = (int)data.buffid;
DlgBase<XGuildGrowthBuffView, XGuildGrowthBuffBehavior>.singleton.RefreshList(true);
}
}
public void QueryBuildRank()
{
RpcC2M_GuildSchoolHallGetRankList rpc = new RpcC2M_GuildSchoolHallGetRankList();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void OnBuildRankGet(List<GuildSchoolHallRankData> list, uint hallPoint, uint schoolPoint, uint huntCount, uint donateCount)
{
this.WeekHallPoint = hallPoint;
this.WeekSchoolPoint = schoolPoint;
this.WeekHuntTimes = huntCount;
this.WeekDonateTimes = donateCount;
this._rankList.Clear();
this._myData = null;
for (int i = 0; i < list.Count; i++)
{
this._rankList.Add(new XGuildGrowthDocument.GuildGrowthRankData(list[i].rolename, list[i].roleid, list[i].weeklyhallpoint, list[i].weeklyschoolpoint));
bool flag = list[i].roleid == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
if (flag)
{
this._myData = new XGuildGrowthDocument.GuildGrowthRankData(list[i].rolename, list[i].roleid, list[i].weeklyhallpoint, list[i].weeklyschoolpoint);
}
}
bool flag2 = this._myData == null;
if (flag2)
{
XSingleton<XDebug>.singleton.AddErrorLog("guild growth rank haven't my data.", null, null, null, null, null);
}
else
{
this._rankList.Sort(new Comparison<XGuildGrowthDocument.GuildGrowthRankData>(this.Compare));
for (int j = 0; j < this._rankList.Count; j++)
{
bool flag3 = this._rankList[j].Uid == XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
if (flag3)
{
this.MyRank = j;
break;
}
}
bool flag4 = DlgBase<XGuildGrowthBuildView, XGuildGrowthBuildBehavior>.singleton.IsVisible();
if (flag4)
{
DlgBase<XGuildGrowthBuildView, XGuildGrowthBuildBehavior>.singleton.RefreshRank();
}
bool flag5 = DlgBase<XGuildDonateView, XGuildDonateBehavior>.singleton.IsVisible();
if (flag5)
{
DlgBase<XGuildDonateView, XGuildDonateBehavior>.singleton.RefreshGrowthDonateTimes();
}
}
}
private int Compare(XGuildGrowthDocument.GuildGrowthRankData x, XGuildGrowthDocument.GuildGrowthRankData y)
{
bool flag = x.Uid == y.Uid;
int result;
if (flag)
{
result = 0;
}
else
{
result = (int)(y.HallPoint + y.SchoolPoint - x.HallPoint - x.SchoolPoint);
}
return result;
}
public void QueryGuildGrowthDonate(uint itemid)
{
RpcC2M_GuildZiCaiDonate rpcC2M_GuildZiCaiDonate = new RpcC2M_GuildZiCaiDonate();
rpcC2M_GuildZiCaiDonate.oArg.itemid = itemid;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GuildZiCaiDonate);
}
public void QueryGrowthRecordList()
{
RpcC2M_GuildZiCaiDonateHistory rpc = new RpcC2M_GuildZiCaiDonateHistory();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void OnGrowthRecordListGet(List<GuildZiCaiDonateHistoryData> list)
{
this._recordList.Clear();
for (int i = 0; i < list.Count; i++)
{
this._recordList.Add(new XGuildGrowthDocument.GuildCrowthRecordData(list[i].rolename, list[i].itemid, list[i].time));
}
bool flag = DlgBase<XGuildDonateView, XGuildDonateBehavior>.singleton.IsVisible();
if (flag)
{
DlgBase<XGuildDonateView, XGuildDonateBehavior>.singleton.CheckRecordRefresh();
}
}
}
}
|