blob: 46335c93d96e70b1b86e1f85aecf6f6d70b1bd9b (
plain)
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
|
using System;
using System.Collections.Generic;
namespace XMainClient
{
internal struct XJadeInfo
{
public uint slotCount
{
get
{
return this._slotCount;
}
}
public uint slots
{
set
{
this._slots = value;
this._slotCount = 0u;
for (uint num = 0u; num < XJadeInfo.slot_max; num += 1u)
{
uint slot = this.GetSlot((int)num);
bool flag = XJadeInfo.SlotExists(slot);
if (flag)
{
this._slotCount += 1u;
}
}
}
}
private static readonly uint slot_mask = 15u;
private static readonly uint slot_step = 4u;
private static readonly uint slot_max = 32u / XJadeInfo.slot_step;
private uint _slots;
private uint _slotCount;
public XJadeItem[] jades;
public static readonly uint SLOT_NOTEXIST = 0u;
public static readonly uint SLOT_NOTOPEN = 15u;
public void Init()
{
bool flag = this.jades == null;
if (flag)
{
this.jades = new XJadeItem[XJadeInfo.slot_max];
}
else
{
int num = 0;
while ((long)num < (long)((ulong)XJadeInfo.slot_max))
{
bool flag2 = this.jades[num] != null;
if (flag2)
{
this.jades[num].Recycle();
this.jades[num] = null;
}
num++;
}
}
this._slotCount = 0u;
this._slots = 0u;
}
public uint GetSlot(int index)
{
return this._slots >> (int)((long)index * (long)((ulong)XJadeInfo.slot_step)) & XJadeInfo.slot_mask;
}
public IEnumerable<uint> AllSlots()
{
uint num;
for (uint i = 0u; i < this._slotCount; i = num)
{
yield return this.GetSlot((int)i);
num = i + 1u;
}
yield break;
}
public static bool SlotExists(uint slot)
{
return slot != XJadeInfo.SLOT_NOTEXIST;
}
public static bool SlotNotOpen(uint slot)
{
return slot == XJadeInfo.SLOT_NOTOPEN;
}
public static bool SlotOpened(uint slot)
{
return XJadeInfo.SlotExists(slot) && !XJadeInfo.SlotNotOpen(slot);
}
public static bool SlotEmpty(int slotIndex, XJadeInfo jadeInfo)
{
return XJadeInfo.SlotOpened(jadeInfo.GetSlot(slotIndex)) && jadeInfo.jades[slotIndex] == null;
}
public static bool SlotHasJade(int slotIndex, XJadeInfo jadeInfo)
{
return XJadeInfo.SlotOpened(jadeInfo.GetSlot(slotIndex)) && jadeInfo.jades[slotIndex] != null;
}
}
}
|