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

namespace XMainClient
{
	internal class XGuildMember : XGuildMemberBasicInfo, IComparable<XGuildMember>
	{
		public uint contribution;

		public bool canSend;

		public uint taskLuck;

		public uint taskScore;

		public bool canRefresh;

		public FetchState fetchState;

		public void Set(GuildMemberData data)
		{
			this.uid = data.roleid;
			this.name = data.name;
			this.position = (GuildPosition)data.position;
			this.ppt = data.ppt;
			this.contribution = data.contribute;
			this.level = data.level;
			this.profession = XFastEnumIntEqualityComparer<RoleType>.ToInt(data.profession);
			this.time = (int)data.lastlogin;
			this.vip = data.vip;
			this.paymemberid = data.paymemberid;
			this.isOnline = data.isonline;
			this.liveness = data.activity;
			this.taskLuck = data.task_luck;
			this.taskScore = data.task_score;
			this.canRefresh = data.can_refresh;
			bool flag = data.lastlogin == 0u;
			if (flag)
			{
				this.time = XGuildMemberBasicInfo.ONLINE_TIME;
			}
			this.titleID = data.title;
			this.canSend = (((ulong)data.flag & (ulong)((long)XFastEnumIntEqualityComparer<GuildMemberFlag>.ToInt(GuildMemberFlag.SEND_FATIGUE))) > 0UL);
			bool flag2 = ((ulong)data.flag & (ulong)((long)XFastEnumIntEqualityComparer<GuildMemberFlag>.ToInt(GuildMemberFlag.RECV_FATIGUE))) > 0UL;
			if (flag2)
			{
				this.fetchState = FetchState.FS_CAN_FETCH;
			}
			else
			{
				bool flag3 = ((ulong)data.flag & (ulong)((long)XFastEnumIntEqualityComparer<GuildMemberFlag>.ToInt(GuildMemberFlag.RECVED_FATIGUE))) > 0UL;
				if (flag3)
				{
					this.fetchState = FetchState.FS_FETCHED;
				}
				else
				{
					this.fetchState = FetchState.FS_CANNOT_FETCH;
				}
			}
		}

		public int CompareTo(XGuildMember other)
		{
			bool flag = XGuildMemberBasicInfo.playerID != 0UL && this.uid != other.uid;
			if (flag)
			{
				bool flag2 = this.uid == XGuildMemberBasicInfo.playerID;
				if (flag2)
				{
					return -1;
				}
				bool flag3 = other.uid == XGuildMemberBasicInfo.playerID;
				if (flag3)
				{
					return 1;
				}
			}
			int num = 0;
			GuildMemberSortType sortType = XGuildMemberBasicInfo.sortType;
			if (sortType != GuildMemberSortType.GMST_CONTRIBUTION)
			{
				if (sortType == GuildMemberSortType.GMST_TASKSCORE)
				{
					bool flag4 = this.canRefresh ^ other.canRefresh;
					if (flag4)
					{
						num = (this.canRefresh ? -1 : 1);
					}
					else
					{
						num = (int)(this.taskScore - other.taskScore);
					}
				}
			}
			else
			{
				num = this.contribution.CompareTo(other.contribution);
			}
			bool flag5 = num == 0;
			int result;
			if (flag5)
			{
				result = base.CompareTo(other);
			}
			else
			{
				result = num * XGuildMemberBasicInfo.dir;
			}
			return result;
		}
	}
}