summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Guild/XGuildSalaryInfo.cs
blob: e8ed5ef7489b0f80aa1ea907dfb0528213954868 (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
using System;
using XUtliPoolLib;

namespace XMainClient
{
	public class XGuildSalaryInfo
	{
		public uint Score
		{
			get
			{
				return this.m_score;
			}
		}

		public uint TotalScore
		{
			get
			{
				return this.m_totalScore;
			}
		}

		public uint Grade
		{
			get
			{
				return this.m_grade;
			}
		}

		public uint Value
		{
			get
			{
				return this.m_value;
			}
		}

		public float Percent
		{
			get
			{
				return this.m_Percent;
			}
		}

		private uint m_score = 0u;

		private uint m_totalScore = 0u;

		private uint m_grade = 0u;

		private uint m_value;

		private float m_Percent = 0f;

		public void Init(uint value, GuildSalaryTable.RowData rowData, uint index)
		{
			this.m_value = value;
			bool flag = rowData == null;
			if (!flag)
			{
				switch (index)
				{
				case 0u:
					this.CalculateScore(ref rowData.NumberTransformation, value);
					break;
				case 1u:
					this.CalculateScore(ref rowData.PrestigeTransformation, value);
					break;
				case 2u:
					this.CalculateScore(ref rowData.ActiveTransformation, value);
					break;
				case 3u:
					this.CalculateScore(ref rowData.EXPTransformation, value);
					break;
				}
				this.CalculateGrade(rowData.GuildReview, this.m_score);
			}
		}

		private void CalculateScore(ref SeqListRef<uint> transformation, uint value)
		{
			uint num = transformation[0, 0];
			uint num2 = transformation[0, 1];
			uint num3 = transformation[1, 0];
			uint num4 = transformation[1, 1];
			this.m_totalScore = num2;
			bool flag = value > num2;
			if (flag)
			{
				value = num2;
			}
			this.m_Percent = value / num2;
			float num5 = this.m_Percent * num4;
			this.m_score = (uint)Math.Floor((double)num5);
		}

		private void CalculateGrade(uint[] scores, uint cur)
		{
			this.m_grade = 1u;
			bool flag = scores != null;
			if (flag)
			{
				for (int i = scores.Length - 1; i >= 0; i--)
				{
					bool flag2 = cur < scores[i];
					if (!flag2)
					{
						break;
					}
					this.m_grade += 1u;
				}
			}
		}
	}
}