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
|
using System;
using KKSG;
using XUtliPoolLib;
namespace XMainClient
{
internal class XPurchaseDocument : XDocComponent
{
public override uint ID
{
get
{
return XPurchaseDocument.uuID;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XPurchaseDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static BuyFatigueTable _BuyFatigureTable = new BuyFatigueTable();
private static BuyGoldTable _BuyGoldTable = new BuyGoldTable();
public XPurchaseInfo myPurchaseInfo = new XPurchaseInfo();
public XPurchaseView PurchaseView;
private static BuyDragonCoin _BuyDragonCoinTable = new BuyDragonCoin();
public static PurchaseInfo _buyInfo = new PurchaseInfo();
public static void Execute(OnLoadedCallback callback = null)
{
XPurchaseDocument.AsyncLoader.AddTask("Table/BuyFatigue", XPurchaseDocument._BuyFatigureTable, false);
XPurchaseDocument.AsyncLoader.AddTask("Table/BuyGold", XPurchaseDocument._BuyGoldTable, false);
XPurchaseDocument.AsyncLoader.AddTask("Table/BuyDragonCoin", XPurchaseDocument._BuyDragonCoinTable, false);
XPurchaseDocument.AsyncLoader.Execute(callback);
}
public void InitPurchaseInfo(BuyGoldFatInfo info)
{
bool flag = info != null;
if (flag)
{
XPurchaseDocument._buyInfo.day = info.day;
XPurchaseDocument._buyInfo.BuyGoldCount = info.BuyGoldCount;
XPurchaseDocument._buyInfo.BuyFatigueCount.Clear();
XPurchaseDocument._buyInfo.BuyDragonCoinCount = info.BuyDragonCount;
foreach (int item in info.BuyFatigueCount)
{
XPurchaseDocument._buyInfo.BuyFatigueCount.Add(item);
}
}
else
{
XPurchaseDocument._buyInfo.BuyGoldCount = 0;
XPurchaseDocument._buyInfo.BuyDragonCoinCount = 0;
XPurchaseDocument._buyInfo.day = 0u;
XPurchaseDocument._buyInfo.BuyFatigueCount.Clear();
}
}
public XPurchaseInfo GetPurchaseInfo(int level, int vip, ItemEnum type)
{
bool flag = type == ItemEnum.GOLD;
if (flag)
{
XRechargeDocument specificDocument = XDocuments.GetSpecificDocument<XRechargeDocument>(XRechargeDocument.uuID);
this.myPurchaseInfo.totalBuyNum = specificDocument.VIPReader.Table[vip].BuyGoldTimes;
int num = XPurchaseDocument._buyInfo.BuyGoldCount;
BuyGoldTable.RowData rowData = XPurchaseDocument._BuyGoldTable.Table[level - 1];
this.myPurchaseInfo.curBuyNum = XPurchaseDocument._buyInfo.BuyGoldCount;
this.myPurchaseInfo.GetCount = (int)rowData.Gold;
this.myPurchaseInfo.fatigue = XPurchaseDocument._buyInfo.BuyFatigueCount;
bool flag2 = rowData.DragonCoinCost != null;
if (flag2)
{
bool flag3 = num >= rowData.DragonCoinCost.Length;
if (flag3)
{
this.myPurchaseInfo.dragoncoinCost = rowData.DragonCoinCost[rowData.DragonCoinCost.Length - 1];
this.myPurchaseInfo.diamondCost = rowData.DiamondCost[rowData.DiamondCost.Length - 1];
}
else
{
this.myPurchaseInfo.dragoncoinCost = rowData.DragonCoinCost[num];
this.myPurchaseInfo.diamondCost = rowData.DiamondCost[num];
}
}
else
{
XSingleton<XDebug>.singleton.AddErrorLog("data.DragonCoinCost null", null, null, null, null, null);
}
}
else
{
bool flag4 = type == ItemEnum.FATIGUE;
if (flag4)
{
XRechargeDocument specificDocument2 = XDocuments.GetSpecificDocument<XRechargeDocument>(XRechargeDocument.uuID);
this.myPurchaseInfo.totalBuyNum = specificDocument2.VIPReader.Table[vip].BuyFatigueTimes;
int num = 0;
for (int i = 0; i < XPurchaseDocument._buyInfo.BuyFatigueCount.Count; i += 2)
{
bool flag5 = XPurchaseDocument._buyInfo.BuyFatigueCount[i] == (int)type;
if (flag5)
{
num = XPurchaseDocument._buyInfo.BuyFatigueCount[i + 1];
}
}
int num2 = 0;
for (int j = 0; j < XPurchaseDocument._BuyFatigureTable.Table.Length; j++)
{
bool flag6 = XPurchaseDocument._BuyFatigureTable.Table[j].FatigueID == (int)type;
if (flag6)
{
num2 = j;
}
}
this.myPurchaseInfo.curBuyNum = num;
this.myPurchaseInfo.GetCount = XPurchaseDocument._BuyFatigureTable.Table[num2].Value;
bool flag7 = XPurchaseDocument._BuyFatigureTable.Table[num2].DragonCoinCost != null;
if (flag7)
{
bool flag8 = num >= XPurchaseDocument._BuyFatigureTable.Table[num2].DragonCoinCost.Length;
if (flag8)
{
this.myPurchaseInfo.dragoncoinCost = XPurchaseDocument._BuyFatigureTable.Table[num2].DragonCoinCost[XPurchaseDocument._BuyFatigureTable.Table[num2].DragonCoinCost.Length - 1];
this.myPurchaseInfo.diamondCost = XPurchaseDocument._BuyFatigureTable.Table[num2].DiamondCost[XPurchaseDocument._BuyFatigureTable.Table[num2].DiamondCost.Length - 1];
}
else
{
this.myPurchaseInfo.dragoncoinCost = XPurchaseDocument._BuyFatigureTable.Table[num2].DragonCoinCost[num];
this.myPurchaseInfo.diamondCost = XPurchaseDocument._BuyFatigureTable.Table[num2].DiamondCost[num];
}
}
else
{
XSingleton<XDebug>.singleton.AddErrorLog("DragonCoinCost null", null, null, null, null, null);
}
}
else
{
bool flag9 = type == ItemEnum.DRAGON_COIN;
if (flag9)
{
XRechargeDocument specificDocument3 = XDocuments.GetSpecificDocument<XRechargeDocument>(XRechargeDocument.uuID);
this.myPurchaseInfo.totalBuyNum = specificDocument3.VIPReader.Table[vip].BuyDragonCoinTimes;
int num = XPurchaseDocument._buyInfo.BuyDragonCoinCount;
BuyDragonCoin.RowData rowData2 = XPurchaseDocument._BuyDragonCoinTable.Table[level - 1];
this.myPurchaseInfo.curBuyNum = XPurchaseDocument._buyInfo.BuyDragonCoinCount;
this.myPurchaseInfo.GetCount = (int)rowData2.DragonCoin;
bool flag10 = rowData2.DiamondCost != null;
if (flag10)
{
bool flag11 = num >= rowData2.DiamondCost.Length;
if (flag11)
{
this.myPurchaseInfo.diamondCost = rowData2.DiamondCost[rowData2.DiamondCost.Length - 1];
}
else
{
this.myPurchaseInfo.diamondCost = rowData2.DiamondCost[num];
}
}
}
}
}
return this.myPurchaseInfo;
}
public void CommonQuickBuy(ItemEnum itemid, ItemEnum useItem, uint count = 1u)
{
RpcC2G_BuyGoldAndFatigue rpcC2G_BuyGoldAndFatigue = new RpcC2G_BuyGoldAndFatigue();
rpcC2G_BuyGoldAndFatigue.oArg.fatigueID = (uint)itemid;
rpcC2G_BuyGoldAndFatigue.oArg.count = count;
bool flag = itemid == ItemEnum.GOLD && useItem == ItemEnum.DIAMOND;
if (flag)
{
rpcC2G_BuyGoldAndFatigue.oArg.type = buyextype.DIAMONE_BUY_GOLD;
}
else
{
bool flag2 = itemid == ItemEnum.GOLD && useItem == ItemEnum.DRAGON_COIN;
if (flag2)
{
rpcC2G_BuyGoldAndFatigue.oArg.type = buyextype.DRAGONCOIN_BUY_GOLD;
}
else
{
bool flag3 = itemid == ItemEnum.FATIGUE && useItem == ItemEnum.DIAMOND;
if (flag3)
{
rpcC2G_BuyGoldAndFatigue.oArg.type = buyextype.DIAMOND_BUY_FATIGUE;
}
else
{
bool flag4 = itemid == ItemEnum.FATIGUE && useItem == ItemEnum.DRAGON_COIN;
if (flag4)
{
rpcC2G_BuyGoldAndFatigue.oArg.type = buyextype.DRAGON_BUY_FATIGUE;
}
else
{
bool flag5 = itemid == ItemEnum.DRAGON_COIN && useItem == ItemEnum.DIAMOND;
if (flag5)
{
rpcC2G_BuyGoldAndFatigue.oArg.type = buyextype.DIAMONE_BUY_DRAGONCOIN;
}
else
{
bool flag6 = itemid == ItemEnum.CHAT_LANNIAO && useItem == ItemEnum.DRAGON_COIN;
if (flag6)
{
rpcC2G_BuyGoldAndFatigue.oArg.type = buyextype.DRAGONCOIN_BUY_BLUEBIRD;
}
}
}
}
}
}
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_BuyGoldAndFatigue);
}
public void CommonQuickBuyRandom(ItemEnum itemid, ItemEnum usrItem, uint count)
{
RpcC2G_BuyGoldAndFatigue rpcC2G_BuyGoldAndFatigue = new RpcC2G_BuyGoldAndFatigue();
rpcC2G_BuyGoldAndFatigue.oArg.fatigueID = (uint)XFastEnumIntEqualityComparer<ItemEnum>.ToInt(itemid);
rpcC2G_BuyGoldAndFatigue.oArg.count = count;
bool flag = itemid == ItemEnum.DRAGON_COIN && usrItem == ItemEnum.DIAMOND;
if (flag)
{
rpcC2G_BuyGoldAndFatigue.oArg.type = buyextype.DIAMOND_EXCHANGE_DRAGONCOIN;
}
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_BuyGoldAndFatigue);
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
}
}
|