-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFastQuestResult.lua
More file actions
158 lines (129 loc) · 8.08 KB
/
FastQuestResult.lua
File metadata and controls
158 lines (129 loc) · 8.08 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
local Constants = _G.require("Constants/Constants");
local find_type_definition = Constants.find_type_definition;
local hook = Constants.hook;
local to_int64 = Constants.to_int64;
local get_hook_storage = Constants.get_hook_storage;
local get_IDInt_method = Constants.get_IDInt_method;
local get_InputPriority_method = Constants.get_InputPriority_method;
local GenericList_get_Count_method = Constants.GenericList_get_Count_method;
local GenericList_get_Item_method = Constants.GenericList_get_Item_method;
local requestCallTrigger_method = Constants.requestCallTrigger_method;
local getThisPtr = Constants.getThisPtr;
local skipOriginal = Constants.skipOriginal;
local ZERO_float_ptr = Constants.ZERO_float_ptr;
--<< GUI070000 Fix Quest Result >>--
local UI070000 = Constants.GUIID_type_def:get_field("UI070000"):get_data(nil); -- static
local isItemRequiredForWishlist_method = find_type_definition("app.WishlistUtil"):get_method("isItemRequiredForWishlist(app.ItemDef.ID)");
local GUIPartsReward_type_def = find_type_definition("app.cGUIPartsReward");
local get__Info_method = GUIPartsReward_type_def:get_method("get__Info");
local set__WaitControlTime_method = GUIPartsReward_type_def:get_method("set__WaitControlTime(System.Single)");
local receiveAll_method = GUIPartsReward_type_def:get_method("receiveAll");
local GUIPartsReward_InputCtrl_field = GUIPartsReward_type_def:get_field("_InputCtrl");
local ItemGridParts_field = GUIPartsReward_type_def:get_field("_ItemGridParts");
local get_Owner_method = GUIPartsReward_type_def:get_parent_type():get_method("get_Owner");
local GUIPartsRewardInfo_get_RewardItems_method = get__Info_method:get_return_type():get_method("get_RewardItems");
local GUIRewardItems_type_def = find_type_definition("app.cGUIRewardItems");
local get_ItemInfoSize_method = GUIRewardItems_type_def:get_method("get_ItemInfoSize");
local getItemInfo_method = GUIRewardItems_type_def:get_method("getItemInfo(System.Int32)");
local get_ItemId_method = Constants.get_ItemId_method;
local GUIItemGridPartsFluent_type_def = find_type_definition("app.cGUIItemGridPartsFluent");
local get_SelectItem_method = GUIItemGridPartsFluent_type_def:get_method("get_SelectItem");
local get__PanelNewMark_method = GUIItemGridPartsFluent_type_def:get_parent_type():get_parent_type():get_method("get__PanelNewMark");
local get_Enabled_method = Constants.get_Enabled_method;
local get_ActualVisible_method = Constants.get_ActualVisible_method;
local GUI070001_type_def = find_type_definition("app.GUI070001");
local get_IsViewMode_method = GUI070001_type_def:get_method("get_IsViewMode");
local skipAnimation_method = GUI070001_type_def:get_method("skipAnimation");
local function hasNewItem(ItemGridParts, isFix)
if isFix then
for i = 0, GenericList_get_Count_method:call(ItemGridParts) - 1 do
local GUIItemGridPartsFluent = GenericList_get_Item_method:call(ItemGridParts, i);
if get_Enabled_method:call(get_SelectItem_method:call(GUIItemGridPartsFluent)) and get_ActualVisible_method:call(get__PanelNewMark_method:call(GUIItemGridPartsFluent)) then
return true;
end
end
else
for i = 0, GenericList_get_Count_method:call(ItemGridParts) - 1 do
if get_ActualVisible_method:call(get__PanelNewMark_method:call(GenericList_get_Item_method:call(ItemGridParts, i))) then
return true;
end
end
end
return false;
end
local function hasWishItem(RewardItems_list)
for i = 0, GenericList_get_Count_method:call(RewardItems_list) - 1 do
local RewardItems = GenericList_get_Item_method:call(RewardItems_list, i);
for j = 0, get_ItemInfoSize_method:call(RewardItems) - 1 do
if isItemRequiredForWishlist_method:call(nil, get_ItemId_method:call(getItemInfo_method:call(RewardItems, j))) then
return true;
end
end
end
return false;
end
-- args[5] = isViewMode;
-- args[6] = isRandomAmuletJudge;
local isFixQuestResult = nil;
hook(GUIPartsReward_type_def:get_method("start(app.cGUIPartsRewardInfo, app.cGUIPartsReward.MODE, System.Boolean, System.Boolean)"), function(args)
if (to_int64(args[5]) & 1) == 0 then
local this_ptr = args[2];
if get_IDInt_method:call(get_Owner_method:call(this_ptr)) == UI070000 then
local storage = get_hook_storage();
storage.this_ptr = this_ptr;
storage.isRandomAmuletJudge = to_int64(args[6]) & 1;
isFixQuestResult = true;
end
end
end, function()
if isFixQuestResult then
isFixQuestResult = nil;
local storage = get_hook_storage();
local this_ptr = storage.this_ptr;
set__WaitControlTime_method:call(this_ptr, 0.0);
if storage.isRandomAmuletJudge == 0 and get_InputPriority_method:call(GUIPartsReward_InputCtrl_field:get_data(this_ptr)) == 0 and hasNewItem(ItemGridParts_field:get_data(this_ptr), true) == false and hasWishItem(GUIPartsRewardInfo_get_RewardItems_method:call(get__Info_method:call(this_ptr))) == false then
receiveAll_method:call(this_ptr);
end
end
end);
hook(GUI070001_type_def:get_method("onOpen"), getThisPtr, function()
local this_ptr = get_hook_storage().this_ptr;
if get_IsViewMode_method:call(this_ptr) == false then
skipAnimation_method:call(this_ptr);
end
end);
--<< GUI020100 Seamless Quest Result >>--
local GUI020100_type_def = find_type_definition("app.GUI020100");
local get__PartsQuestRewardItem_method = GUI020100_type_def:get_method("get__PartsQuestRewardItem");
local GUI020100_InputCtrl_field = GUI020100_type_def:get_field("_InputCtrl");
local GUI020100PanelQuestRewardItem_type_def = get__PartsQuestRewardItem_method:get_return_type();
local get__PartsQuestRewardItems_method = GUI020100PanelQuestRewardItem_type_def:get_method("get__PartsQuestRewardItems");
local GUIPartsRewardItems_type_def = get__PartsQuestRewardItems_method:get_return_type();
local GUIPartsRewardItems_get_RewardItems_method = GUIPartsRewardItems_type_def:get_method("get_RewardItems");
local GUIPartsRewardItems_ItemGridParts_field = GUIPartsRewardItems_type_def:get_field("_ItemGridParts");
local get_FixControl_method = GUI020100PanelQuestRewardItem_type_def:get_parent_type():get_parent_type():get_method("get_FixControl");
local finish_method = get_FixControl_method:get_return_type():get_method("finish");
local terminateQuestResult_method = Constants.GUIManager_type_def:get_method("terminateQuestResult");
local JUST_TIMING_SHORTCUT = Constants.GUIFunc_TYPE_type_def:get_field("JUST_TIMING_SHORTCUT"):get_data(nil);
hook(GUI020100_type_def:get_method("toQuestReward"), getThisPtr, function()
local this_ptr = get_hook_storage().this_ptr;
local GUI020100PanelQuestRewardItem = get__PartsQuestRewardItem_method:call(this_ptr);
local GUIPartsRewardItems = get__PartsQuestRewardItems_method:call(GUI020100PanelQuestRewardItem);
if hasNewItem(GUIPartsRewardItems_ItemGridParts_field:get_data(GUIPartsRewardItems), false) or hasWishItem(GUIPartsRewardItems_get_RewardItems_method:call(GUIPartsRewardItems)) then
requestCallTrigger_method:call(GUI020100_InputCtrl_field:get_data(this_ptr), JUST_TIMING_SHORTCUT);
else
finish_method:call(get_FixControl_method:call(GUI020100PanelQuestRewardItem));
end
end);
hook(GUI020100_type_def:get_method("toQuestJudge"), getThisPtr, function()
finish_method:call(get_FixControl_method:call(get__PartsQuestRewardItem_method:call(get_hook_storage().this_ptr)));
end);
hook(GUI020100_type_def:get_method("toRandomAmuletJudge"), getThisPtr, function()
requestCallTrigger_method:call(GUI020100_InputCtrl_field:get_data(get_hook_storage().this_ptr), JUST_TIMING_SHORTCUT);
end);
hook(find_type_definition("app.cGUI020100PanelQuestResultList"):get_method("start"), nil, function()
terminateQuestResult_method:call(Constants.GUIManager);
end);
hook(find_type_definition("app.cGUIQuestResultInfo"):get_method("getSeamlesResultListDispTime"), skipOriginal, function()
return ZERO_float_ptr;
end);