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
|
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class AuctionHouseDocument : XDocComponent
{
public override uint ID
{
get
{
return AuctionHouseDocument.uuID;
}
}
public GuildAuctReward GuildAuctRewardReader
{
get
{
return AuctionHouseDocument._guildAuctRewardReader;
}
}
public List<GASaleItem> ItemList
{
get
{
return this._itemList;
}
}
public List<GASaleHistory> HistoryList
{
get
{
return this._historyList;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("AuctionHouseDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
public List<int> GuildActID = new List<int>();
public GuildAuctReqType DataState;
private static GuildAuctReward _guildAuctRewardReader = new GuildAuctReward();
private List<GASaleItem> _itemList = new List<GASaleItem>();
private List<GASaleHistory> _historyList = new List<GASaleHistory>();
public uint MySpoils = 0u;
public int LastReq = 0;
public int ReqTime;
public int GuildSaleTime;
public int PublicityTime;
public bool ResetScrollView = false;
public static void Execute(OnLoadedCallback callback = null)
{
AuctionHouseDocument.AsyncLoader.AddTask("Table/GuildAuctReward", AuctionHouseDocument._guildAuctRewardReader, false);
AuctionHouseDocument.AsyncLoader.Execute(callback);
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this.GuildSaleTime = XSingleton<XGlobalConfig>.singleton.GetInt("GuildAuctGuildSaleTime");
this.PublicityTime = XSingleton<XGlobalConfig>.singleton.GetInt("GuildAuctGuildItemPublicityTime");
}
public void QueryGuildTypeList(int type)
{
RpcC2M_GuildAuctReqAll rpcC2M_GuildAuctReqAll = new RpcC2M_GuildAuctReqAll();
rpcC2M_GuildAuctReqAll.oArg.reqtype = GuildAuctReqType.GART_ACT_TYPE;
rpcC2M_GuildAuctReqAll.oArg.acttype = type;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GuildAuctReqAll);
}
public void QueryWorldTypeList(int type)
{
RpcC2M_GuildAuctReqAll rpcC2M_GuildAuctReqAll = new RpcC2M_GuildAuctReqAll();
rpcC2M_GuildAuctReqAll.oArg.reqtype = GuildAuctReqType.GART_ITEM_TYPE;
rpcC2M_GuildAuctReqAll.oArg.itemtype = type;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GuildAuctReqAll);
}
public void QueryAuctionItem(ulong uid, uint curPrice, int actType)
{
RpcC2M_GuildAuctReqAll rpcC2M_GuildAuctReqAll = new RpcC2M_GuildAuctReqAll();
rpcC2M_GuildAuctReqAll.oArg.reqtype = GuildAuctReqType.GART_BUY_AUCT;
rpcC2M_GuildAuctReqAll.oArg.uid = uid;
rpcC2M_GuildAuctReqAll.oArg.curauctprice = curPrice;
rpcC2M_GuildAuctReqAll.oArg.acttype = actType;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GuildAuctReqAll);
}
public void QueryBuyItem(ulong uid, int actType)
{
RpcC2M_GuildAuctReqAll rpcC2M_GuildAuctReqAll = new RpcC2M_GuildAuctReqAll();
rpcC2M_GuildAuctReqAll.oArg.reqtype = GuildAuctReqType.GART_BUY_NOW;
rpcC2M_GuildAuctReqAll.oArg.uid = uid;
rpcC2M_GuildAuctReqAll.oArg.acttype = actType;
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GuildAuctReqAll);
}
public void QueryAuctionHistory(bool guild)
{
RpcC2M_GuildAuctReqAll rpcC2M_GuildAuctReqAll = new RpcC2M_GuildAuctReqAll();
if (guild)
{
rpcC2M_GuildAuctReqAll.oArg.reqtype = GuildAuctReqType.GART_AUCT_GUILD_HISTORY;
}
else
{
rpcC2M_GuildAuctReqAll.oArg.reqtype = GuildAuctReqType.GART_AUCT_WORLD_HISTORY;
}
XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GuildAuctReqAll);
}
public void OnServerReturn(GuildAuctReqArg arg, GuildAuctReqRes data)
{
switch (arg.reqtype)
{
case GuildAuctReqType.GART_ACT_TYPE:
case GuildAuctReqType.GART_ITEM_TYPE:
{
this.MySpoils = data.profit;
this._itemList.Clear();
this.ReqTime = -1;
for (int i = 0; i < data.saleitems.Count; i++)
{
bool flag = !data.saleitems[i].display;
if (!flag)
{
bool flag2 = this.ReqTime == -1 || (ulong)data.saleitems[i].lefttime < (ulong)((long)this.ReqTime);
if (flag2)
{
this.ReqTime = (int)data.saleitems[i].lefttime;
}
else
{
int num = this.PublicityTime - this.GuildSaleTime + (int)data.saleitems[i].lefttime;
bool flag3 = arg.reqtype == GuildAuctReqType.GART_ACT_TYPE && num > 0 && num < this.ReqTime;
if (flag3)
{
this.ReqTime = num;
}
}
GASaleItem gasaleItem = new GASaleItem();
gasaleItem.uid = data.saleitems[i].uid;
gasaleItem.acttype = data.saleitems[i].acttype;
gasaleItem.itemid = data.saleitems[i].itemid;
gasaleItem.auctroleid = data.saleitems[i].auctroleid;
gasaleItem.curauctprice = data.saleitems[i].curauctprice;
gasaleItem.maxprice = data.saleitems[i].maxprice;
gasaleItem.lefttime = data.saleitems[i].lefttime;
this._itemList.Add(gasaleItem);
}
}
bool flag4 = this.ReqTime != -1 && this.ReqTime < 2;
if (flag4)
{
this.ReqTime = 2;
}
bool flag5 = arg.reqtype == GuildAuctReqType.GART_ACT_TYPE;
if (flag5)
{
bool flag6 = arg.acttype == 0;
if (flag6)
{
this.GuildActID.Clear();
HashSet<int> hashSet = HashPool<int>.Get();
for (int j = 0; j < data.saleitems.Count; j++)
{
bool flag7 = !hashSet.Contains(data.saleitems[j].acttype);
if (flag7)
{
hashSet.Add(data.saleitems[j].acttype);
this.GuildActID.Add(data.saleitems[j].acttype);
}
}
HashPool<int>.Release(hashSet);
}
}
break;
}
case GuildAuctReqType.GART_BUY_AUCT:
case GuildAuctReqType.GART_BUY_NOW:
this.MySpoils = data.profit;
for (int k = 0; k < this._itemList.Count; k++)
{
bool flag8 = this._itemList[k].uid == arg.uid;
if (flag8)
{
bool flag9 = arg.reqtype == GuildAuctReqType.GART_BUY_AUCT;
if (flag9)
{
bool flag10 = data.errorcode == ErrorCode.ERR_SUCCESS;
if (flag10)
{
this._itemList[k].curauctprice = data.curauctprice;
this._itemList[k].auctroleid = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
}
else
{
bool flag11 = data.errorcode == ErrorCode.ERR_AUCT_ITEMSALED;
if (flag11)
{
this._itemList.RemoveAt(k);
}
else
{
bool flag12 = data.errorcode == ErrorCode.ERR_AUCT_PRICECHAGE;
if (flag12)
{
this._itemList[k].curauctprice = data.curauctprice;
}
}
}
}
else
{
bool flag13 = data.errorcode == ErrorCode.ERR_SUCCESS;
if (flag13)
{
this._itemList.RemoveAt(k);
}
else
{
bool flag14 = data.errorcode == ErrorCode.ERR_AUCT_ITEMSALED;
if (flag14)
{
this._itemList.RemoveAt(k);
}
}
}
}
}
break;
case GuildAuctReqType.GART_AUCT_GUILD_HISTORY:
case GuildAuctReqType.GART_AUCT_WORLD_HISTORY:
this._historyList.Clear();
for (int l = 0; l < data.salehistorys.Count; l++)
{
GASaleHistory gasaleHistory = new GASaleHistory();
gasaleHistory.acttype = data.salehistorys[l].acttype;
gasaleHistory.saletime = data.salehistorys[l].saletime;
gasaleHistory.itemid = data.salehistorys[l].itemid;
gasaleHistory.saleprice = data.salehistorys[l].saleprice;
gasaleHistory.auctresult = data.salehistorys[l].auctresult;
this._historyList.Add(gasaleHistory);
}
this._historyList.Sort(new Comparison<GASaleHistory>(this.Compare));
break;
}
this.DataState = arg.reqtype;
bool flag15 = DlgBase<AuctionView, AuctionBehaviour>.singleton.IsVisible();
if (flag15)
{
DlgBase<AuctionView, AuctionBehaviour>.singleton.RefreshData();
}
}
public void QueryRefreshUI()
{
bool flag = DlgBase<AuctionView, AuctionBehaviour>.singleton.IsVisible();
if (flag)
{
bool flag2 = this.LastReq < 100;
if (flag2)
{
this.QueryGuildTypeList(this.LastReq);
}
else
{
this.QueryWorldTypeList(this.LastReq - 100);
}
}
}
public void QueryRefreshGuildUI(int actType)
{
bool flag = !DlgBase<AuctionView, AuctionBehaviour>.singleton.IsVisible();
if (!flag)
{
bool flag2 = this.LastReq == actType || this.LastReq == 0;
if (flag2)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("AuctionHouseTimeFreshTips"), "fece00");
this.QueryRefreshUI();
}
}
}
public List<GuildAuctReward.RowData> GetGuildAuctReward(AuctionActType actType)
{
List<GuildAuctReward.RowData> list = new List<GuildAuctReward.RowData>();
for (int i = 0; i < AuctionHouseDocument._guildAuctRewardReader.Table.Length; i++)
{
GuildAuctReward.RowData rowData = AuctionHouseDocument._guildAuctRewardReader.Table[i];
bool flag = (AuctionActType)rowData.ActType == actType;
if (flag)
{
list.Add(rowData);
}
}
return list;
}
private int Compare(GASaleHistory x, GASaleHistory y)
{
return (int)(y.saletime - x.saletime);
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
this.QueryRefreshUI();
}
}
}
|