summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XEmblemItem.cs
blob: 79339b7b3a7ebee23471db07d6690d20f07ed235 (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 XUtliPoolLib;

namespace XMainClient
{
	internal class XEmblemItem : XAttrItem
	{
		public bool bIsSkillEmblem
		{
			get
			{
				EmblemBasic.RowData emblemConf = XBagDocument.GetEmblemConf(this.itemID);
				bool flag = emblemConf == null;
				bool result;
				if (flag)
				{
					XSingleton<XDebug>.singleton.AddErrorLog(string.Format("EmblemBasic not find this itemid = {0}", this.itemID), null, null, null, null, null);
					result = false;
				}
				else
				{
					result = (emblemConf.EmblemType > 1000);
				}
				return result;
			}
		}

		public override bool Treasure
		{
			get
			{
				return this.smeltingInfo.Attrs.Count > 2 || this.emblemInfo.thirdslot > 0u;
			}
		}

		public override bool bHasPPT
		{
			get
			{
				return true;
			}
		}

		public XEmblemInfo emblemInfo = default(XEmblemInfo);

		public XSmeltingInfo smeltingInfo = default(XSmeltingInfo);

		public override void Init()
		{
			base.Init();
			this.smeltingInfo.Init();
			this.emblemInfo.Init();
		}

		public override void Recycle()
		{
			base.Recycle();
			XDataPool<XEmblemItem>.Recycle(this);
		}

		public override string ToPPTString(XAttributes attributes = null)
		{
			string result = string.Empty;
			bool bIsSkillEmblem = this.bIsSkillEmblem;
			if (bIsSkillEmblem)
			{
				SkillEmblem.RowData emblemSkillConf = XEmblemDocument.GetEmblemSkillConf((uint)this.itemID);
				bool flag = emblemSkillConf == null;
				if (flag)
				{
					result = "SKILL EMBLEM.";
				}
				else
				{
					result = emblemSkillConf.SkillPPT.ToString();
				}
			}
			else
			{
				bool flag2 = this.emblemInfo.thirdslot == 1u || this.emblemInfo.thirdslot == 10u;
				if (flag2)
				{
					int num;
					int endIndex;
					XEquipCreateDocument.GetEmblemAttrDataByID((uint)this.itemID, out num, out endIndex);
					bool flag3 = num >= 0;
					if (flag3)
					{
						bool flag4 = this.emblemInfo.thirdslot == 1u;
						uint num2;
						uint num3;
						if (flag4)
						{
							uint ppt = this.GetPPT(attributes);
							XEquipCreateDocument.GetRandomPPT(num, endIndex, out num2, out num3);
							num2 += ppt;
							num3 += ppt;
						}
						else
						{
							XEquipCreateDocument.GetPPT(num, endIndex, true, true, out num2, out num3);
						}
						result = string.Format("{0} - {1}", num2, num3);
					}
				}
				else
				{
					result = this.GetPPT(attributes).ToString();
				}
			}
			return result;
		}
	}
}