summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Equip/EquipAttrData.cs
blob: 4703e1e5c557e9e100dff5df998456b38f3ce42a (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
117
118
119
using System;
using XMainClient.UI;
using XUtliPoolLib;

namespace XMainClient
{
	internal class EquipAttrData
	{
		public uint Slot
		{
			get
			{
				return this.m_slot;
			}
		}

		public uint AttrId
		{
			get
			{
				return this.m_attrId;
			}
		}

		public bool IsCanSmelt
		{
			get
			{
				return this.m_isCanSmelt;
			}
		}

		public uint Prob
		{
			get
			{
				return this.m_prob;
			}
		}

		public EquipAttrRange RangValue
		{
			get
			{
				return this.m_rang;
			}
		}

		private uint m_slot = 0u;

		private uint m_attrId = 0u;

		private uint m_prob = 0u;

		private bool m_isCanSmelt = false;

		private EquipAttrRange m_rang;

		public EquipAttrData(RandomAttributes.RowData row)
		{
			this.m_slot = (uint)row.Slot;
			this.m_attrId = (uint)row.AttrID;
			this.m_prob = (uint)row.Prob;
			this.m_isCanSmelt = (row.CanSmelt == 1);
			this.m_rang = new EquipAttrRange(row.Range);
		}

		public EquipAttrData(ForgeAttributes.RowData row)
		{
			this.m_slot = (uint)row.Slot;
			this.m_attrId = (uint)row.AttrID;
			this.m_prob = (uint)row.Prob;
			this.m_isCanSmelt = (row.CanSmelt == 1);
			this.m_rang = new EquipAttrRange(row.Range);
		}

		public double GetPercentValue(uint attrValue)
		{
			float num = (this.m_rang.D_value == 0f) ? 1f : this.m_rang.D_value;
			bool flag = attrValue < this.m_rang.Max;
			double num2;
			if (flag)
			{
				num2 = (double)((attrValue - this.m_rang.Min) * 100f / num);
			}
			else
			{
				num2 = 100.0;
			}
			return num2 / 100.0;
		}

		public string GetColor(uint attrValue)
		{
			float num = (this.m_rang.D_value == 0f) ? 1f : this.m_rang.D_value;
			bool flag = attrValue != this.m_rang.Max;
			float num2;
			if (flag)
			{
				num2 = (attrValue - this.m_rang.Min) * 100f / num;
			}
			else
			{
				num2 = 100f;
			}
			int quality = EquipAttrDataMgr.MarkList.Count - 1;
			for (int i = 0; i < EquipAttrDataMgr.MarkList.Count; i++)
			{
				bool flag2 = num2 < (float)EquipAttrDataMgr.MarkList[i];
				if (flag2)
				{
					quality = i;
					break;
				}
			}
			return XSingleton<UiUtility>.singleton.GetItemQualityRGB(quality);
		}
	}
}