summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/PTC/Process/Process_RpcC2G_UseItem.cs
blob: 3c07ed1d88ba78bc512467b2cf877ef5b5815214 (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
using System;
using System.Reflection;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class Process_RpcC2G_UseItem
	{
		public static void OnReply(UseItemArg oArg, UseItemRes oRes)
		{
			bool flag = oRes.ErrorCode == ErrorCode.ERR_INVALID_REQUEST;
			if (flag)
			{
				XEquipCreateDocument.Doc.IsCreating = false;
				string fullName = MethodBase.GetCurrentMethod().ReflectedType.FullName;
				XSingleton<UiUtility>.singleton.OnGetInvalidRequest(fullName);
			}
			else
			{
				bool flag2 = oRes.ErrorCode == ErrorCode.ERR_SUCCESS;
				if (flag2)
				{
					XSingleton<XTutorialHelper>.singleton.UseItem = true;
					bool flag3 = oArg.OpType == 7u;
					if (flag3)
					{
						bool flag4 = DlgBase<ItemSystemDlg, TabDlgBehaviour>.singleton.IsVisible();
						if (flag4)
						{
							DlgBase<ItemSystemDlg, TabDlgBehaviour>.singleton.PlayUseItemEffect(true);
						}
						ItemBuffTable.RowData itembuffDataByID = XHomeCookAndPartyDocument.Doc.GetItembuffDataByID(oArg.itemID);
						bool flag5 = itembuffDataByID != null;
						if (flag5)
						{
							BuffTable.RowData buffData = XSingleton<XBuffTemplateManager>.singleton.GetBuffData((int)itembuffDataByID.Buffs[0, 0], (int)itembuffDataByID.Buffs[0, 1]);
							bool flag6 = buffData != null;
							if (flag6)
							{
								double num = Math.Round((double)(buffData.BuffDuration / 3600f), 1);
								string text = string.Format(XSingleton<XStringTable>.singleton.GetString("FoodBuffTip"), itembuffDataByID.Name, buffData.BuffName, num);
								XSingleton<UiUtility>.singleton.ShowSystemTip(text, "fece00");
							}
						}
					}
					else
					{
						bool flag7 = oArg.OpType == 12u;
						if (flag7)
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FASHION_STORAGE_SUCCESS"), "fece00");
						}
						else
						{
							bool flag8 = oArg.itemID > 0u;
							if (flag8)
							{
								ItemList.RowData itemConf = XBagDocument.GetItemConf((int)oArg.itemID);
								bool flag9 = (int)itemConf.ItemType == XFastEnumIntEqualityComparer<ItemType>.ToInt(ItemType.Tarja);
								if (flag9)
								{
									XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("USE_ITEM_SUCCESS_TARJA"), "fece00");
								}
							}
						}
					}
					bool flag10 = oRes.expand != null;
					if (flag10)
					{
						XBagDocument.BagDoc.SetBagExpandData(oRes.expand, true);
					}
				}
				bool flag11 = ItemUseMgr.GetItemUseValue(ItemUse.Composite) == oArg.OpType;
				if (flag11)
				{
					XEquipCreateDocument.Doc.OnReqCreateEquipSet(oArg, oRes);
				}
				else
				{
					XCharacterItemDocument specificDocument = XDocuments.GetSpecificDocument<XCharacterItemDocument>(XCharacterItemDocument.uuID);
					specificDocument.OnUseItem(oArg, oRes);
					ArtifactBagDocument.Doc.OnUseItem(oArg, oRes);
					bool flag12 = oRes.ErrorCode > ErrorCode.ERR_SUCCESS;
					if (flag12)
					{
						XSingleton<UiUtility>.singleton.ShowSystemTip(oRes.ErrorCode, "fece00");
					}
				}
			}
		}

		public static void OnTimeout(UseItemArg oArg)
		{
		}
	}
}