summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/GuildFarmland.cs
blob: 77242a8be251acf962ffe84eac5880456ba63570 (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
using System;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient
{
	internal class GuildFarmland : Farmland
	{
		public override int BreakLevel
		{
			get
			{
				bool flag = this.m_breakLevel == -1;
				if (flag)
				{
					this.m_breakLevel = 0;
					SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("BreakFarmlandLevel_Guild", true);
					for (int i = 0; i < (int)sequenceList.Count; i++)
					{
						bool flag2 = (long)sequenceList[i, 0] == (long)((ulong)this.m_farmlandId);
						if (flag2)
						{
							this.m_breakLevel = sequenceList[i, 1];
							break;
						}
					}
				}
				return this.m_breakLevel;
			}
		}

		protected override Vector3 BoardRotation
		{
			get
			{
				return new Vector3(-90f, 30f, 0f);
			}
		}

		public GuildFarmland(uint farmlandId) : base(farmlandId)
		{
		}

		protected override void SetPerfab()
		{
			base.DestroyPerfab();
			bool flag = !base.IsLock || base.Doc.HomeType != HomeTypeEnum.GuildHome;
			if (!flag)
			{
				XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(base.NpcId);
				bool flag2 = npc == null;
				if (!flag2)
				{
					string text = "";
					XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
					bool flag3 = specificDocument.bInGuild && (long)this.BreakLevel > (long)((ulong)specificDocument.Level);
					if (flag3)
					{
						text = XSingleton<XGlobalConfig>.singleton.GetValue("FarmBoardPath1");
					}
					bool flag4 = string.IsNullOrEmpty(text);
					if (!flag4)
					{
						this.m_boardGo = XSingleton<XResourceLoaderMgr>.singleton.CreateFromPrefab(text, npc.EngineObject.Position, Quaternion.identity, true, false);
						bool flag5 = this.m_boardGo != null;
						if (flag5)
						{
							this.m_boardGo.transform.localEulerAngles = this.BoardRotation;
						}
						base.SetPerfab();
					}
				}
			}
		}
	}
}