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
|
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XCarnivalDocument : XDocComponent
{
public override uint ID
{
get
{
return XCarnivalDocument.uuID;
}
}
public static SuperActivity activityTable
{
get
{
return XTempActivityDocument.SuperActivityTable;
}
}
public static SuperActivityTask activityListTable
{
get
{
return XTempActivityDocument.SuperActivityTaskTable;
}
}
public static SuperActivityTime activityTimeTable
{
get
{
return XTempActivityDocument.SuperActivityTimeTable;
}
}
public SpActivity allServerActivity
{
get
{
return XTempActivityDocument.Doc.ActivityRecord;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XCarnivalDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
public int currBelong;
public int currType;
public const int currActID = 1;
public int pointItemID = 33;
public uint activityCloseDay = 7u;
public uint claimCloseDay = 14u;
public uint needPoint = 100u;
public uint openDay = 8u;
public float rate = 1f;
private int _curActID = -1;
public List<SpActivity> carnivalServerActivity = new List<SpActivity>();
private List<SpActivityNode> currCarnivals = new List<SpActivityNode>();
private List<SpActivityNode> tmp = new List<SpActivityNode>();
public static void Execute(OnLoadedCallback callback = null)
{
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
public override void OnEnterSceneFinally()
{
base.OnEnterSceneFinally();
for (int i = 0; i < XCarnivalDocument.activityTimeTable.Table.Length; i++)
{
bool flag = XCarnivalDocument.activityTimeTable.Table[i].actid == 1u;
if (flag)
{
this.activityCloseDay = XCarnivalDocument.activityTimeTable.Table[i].duration;
this.claimCloseDay = XCarnivalDocument.activityTimeTable.Table[i].duration + XCarnivalDocument.activityTimeTable.Table[i].rewardtime;
this.needPoint = XCarnivalDocument.activityTimeTable.Table[i].needpoint;
this.rate = XCarnivalDocument.activityTimeTable.Table[i].rate;
this.pointItemID = (int)XCarnivalDocument.activityTimeTable.Table[i].pointid;
}
}
bool flag2 = this.allServerActivity != null;
if (flag2)
{
for (int j = 0; j < this.allServerActivity.spActivity.Count; j++)
{
bool flag3 = this.allServerActivity.spActivity[j].actid == 1u;
if (flag3)
{
bool getBigPrize = this.allServerActivity.spActivity[j].getBigPrize;
XSingleton<XAttributeMgr>.singleton.XPlayerData.CarnivalClaimed = getBigPrize;
break;
}
}
}
else
{
XSingleton<XDebug>.singleton.AddLog("allserver: " + (this.allServerActivity == null).ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
}
DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.RefreshHallRedp();
}
public List<SpActivityNode> GetCurrList()
{
this.currCarnivals = this.GetTabList(this.currBelong, this.currType);
return this.currCarnivals;
}
public List<SpActivityNode> GetTabList(int belong, int type)
{
this.tmp.Clear();
int num = XSingleton<XAttributeMgr>.singleton.BackFlowLevel();
SuperActivityTask.RowData[] table = XCarnivalDocument.activityListTable.Table;
uint[] taskListWithLevel = XTempActivityDocument.Doc.GetTaskListWithLevel(num);
bool flag = taskListWithLevel == null;
List<SpActivityNode> result;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("OpenSeverActivity config error with level " + num, null, null, null, null, null);
result = this.tmp;
}
else
{
for (int i = 0; i < table.Length; i++)
{
bool flag2 = (ulong)table[i].belong == (ulong)((long)belong) && (ulong)table[i].type == (ulong)((long)type) && table[i].actid == 1u;
if (flag2)
{
bool flag3 = false;
for (int j = 0; j < taskListWithLevel.Length; j++)
{
bool flag4 = taskListWithLevel[j] == table[i].taskid;
if (flag4)
{
flag3 = true;
break;
}
}
bool flag5 = flag3;
if (flag5)
{
SpActivityNode spActivityNode = new SpActivityNode();
spActivityNode.row = table[i];
this.SetState(ref spActivityNode);
this.tmp.Add(spActivityNode);
}
}
}
result = this.tmp;
}
return result;
}
public void SetState(ref SpActivityNode node)
{
bool flag = false;
bool flag2 = this.allServerActivity != null;
if (flag2)
{
for (int i = 0; i < this.allServerActivity.spActivity.Count; i++)
{
bool flag3 = this.allServerActivity.spActivity[i].actid == 1u;
if (flag3)
{
List<SpActivityTask> task = this.allServerActivity.spActivity[i].task;
for (int j = 0; j < task.Count; j++)
{
bool flag4 = task[j].taskid == node.row.taskid;
if (flag4)
{
flag = true;
node.state = task[j].state;
node.progress = task[j].progress;
break;
}
}
break;
}
}
}
bool flag5 = !flag;
if (flag5)
{
node.state = 0u;
node.progress = 0u;
}
}
public SuperActivity.RowData GetSuperActivity(int belong)
{
SuperActivity.RowData[] table = XCarnivalDocument.activityTable.Table;
for (int i = 0; i < table.Length; i++)
{
bool flag = (ulong)table[i].belong == (ulong)((long)belong) && table[i].actid == 1u;
if (flag)
{
return table[i];
}
}
return null;
}
public SuperActivityTask.RowData GetSuperActivityTask(uint taskid)
{
for (int i = 0; i < XCarnivalDocument.activityListTable.Table.Length; i++)
{
bool flag = XCarnivalDocument.activityListTable.Table[i].taskid == taskid;
if (flag)
{
return XCarnivalDocument.activityListTable.Table[i];
}
}
return null;
}
public bool IsOpen(int belong)
{
SuperActivity.RowData superActivity = this.GetSuperActivity(belong);
return this.openDay >= superActivity.offset;
}
public bool IsActivityExpire()
{
return this.openDay >= this.activityCloseDay;
}
public bool IsActivityClosed()
{
return this.openDay >= this.claimCloseDay;
}
public bool HasRwdClaimed(int belong)
{
SuperActivity.RowData superActivity = this.GetSuperActivity(belong);
bool flag = superActivity != null && superActivity.childs != null;
if (flag)
{
int num = superActivity.childs.Length;
for (int i = 0; i < num; i++)
{
bool flag2 = this.HasRwdClaimed(belong, i + 1);
if (flag2)
{
return true;
}
}
}
return false;
}
public bool HasRwdClaimed(int belong, int type)
{
this.GetTabList(belong, type);
for (int i = 0; i < this.tmp.Count; i++)
{
bool flag = this.tmp[i].state == 1u;
if (flag)
{
return true;
}
}
return false;
}
public void UpdateHallPoint(bool show)
{
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.SetSystemRedPointState(XSysDefine.XSys_Carnival, show);
XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_Carnival, true);
}
public void OnSpActivityChange(SpActivityChange data)
{
bool flag = data.actid == 1u;
if (flag)
{
DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.Refresh();
}
}
public void RespInfo(int offday)
{
this.openDay = (uint)offday;
bool flag = DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.IsVisible();
if (flag)
{
bool flag2 = (long)offday > (long)((ulong)this.claimCloseDay);
if (flag2)
{
bool flag3 = DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.IsVisible();
if (flag3)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CarnivalTerminal"), "fece00");
DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.SetVisible(false, true);
}
XPlayerAttributes xplayerAttributes = XSingleton<XEntityMgr>.singleton.Player.Attributes as XPlayerAttributes;
bool flag4 = xplayerAttributes != null;
if (flag4)
{
xplayerAttributes.CloseSystem(67u);
}
}
}
DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.Refresh();
}
public void OnActivityStateChange(uint state)
{
bool flag = state == 1u;
if (flag)
{
XSingleton<XDebug>.singleton.AddLog(XStringDefineProxy.GetString("CarnivalTerminal"), null, null, null, null, null, XDebugColor.XDebug_None);
bool flag2 = DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.IsVisible();
if (flag2)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CarnivalTerminal"), "fece00");
DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.SetVisible(false, true);
}
XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
bool flag3 = xplayerData != null;
if (flag3)
{
xplayerData.CloseSystem(67u);
}
}
}
public void RequestClaim(uint taskid)
{
RpcC2G_GetSpActivityReward rpcC2G_GetSpActivityReward = new RpcC2G_GetSpActivityReward();
rpcC2G_GetSpActivityReward.oArg.taskid = taskid;
rpcC2G_GetSpActivityReward.oArg.actid = 1u;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetSpActivityReward);
}
public void RespClaim(uint taskid)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CarnivalSuccess"), "fece00");
}
public void ExchangePoint()
{
RpcC2G_GetSpActivityBigPrize rpcC2G_GetSpActivityBigPrize = new RpcC2G_GetSpActivityBigPrize();
rpcC2G_GetSpActivityBigPrize.oArg.actid = 1u;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetSpActivityBigPrize);
}
public void RespExchange()
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CarnivalSuccess"), "fece00");
XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
bool flag = xplayerData != null;
if (flag)
{
xplayerData.CarnivalClaimed = true;
}
DlgBase<CarnivalDlg, CarnivalBehavior>.singleton.Refresh();
}
private int GetCurActID()
{
bool flag = this._curActID < 0;
if (flag)
{
this._curActID = 1;
int num = XSingleton<XAttributeMgr>.singleton.BackFlowLevel();
bool flag2 = num >= 0;
if (flag2)
{
SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("BackFlowLevel2ActID", true);
for (int i = 0; i < (int)sequenceList.Count; i++)
{
bool flag3 = sequenceList[i, 0] == num;
if (flag3)
{
this._curActID = sequenceList[i, 1];
break;
}
}
}
}
return this._curActID;
}
}
}
|