Originally Posted by SDPhantom
Nothing indicates that it's secure code.
|
I might misunderstand secure. I had initially tried putting hard values in the function you posted earlier (works great):
lua Code:
function QuestInfo_Display(template, parentFrame, acceptButton, material)
local lastFrame, shownFrame, bottomShownFrame;
local elementsTable = template.elements;
local bottomShownFrame;
QuestInfoFrame.questLog = template.questLog;
QuestInfoFrame.chooseItems = template.chooseItems;
QuestInfoFrame.tooltip = template.tooltip;
QuestInfoFrame.acceptButton = acceptButton;
if ( QuestInfoFrame.material ~= material ) then
QuestInfoFrame.material = material;
local textColor, titleTextColor = GetMaterialTextColors(material);
-- headers
QuestInfoTitleHeader:SetTextColor(1, 0.85, 0)
QuestInfoDescriptionHeader:SetTextColor(1, 0.85, 0)
QuestInfoObjectivesHeader:SetTextColor(1, 0.85, 0)
QuestInfoRewardsHeader:SetTextColor(1, 0.85, 0)
-- other text
QuestInfoDescriptionText:SetTextColor(1, 1, 1);
QuestInfoObjectivesText:SetTextColor(1, 1, 1);
QuestInfoGroupSize:SetTextColor(1, 1, 1);
QuestInfoRewardText:SetTextColor(1, 1, 1);
-- reward frame text
QuestInfoItemChooseText:SetTextColor(1, 1, 1);
QuestInfoItemReceiveText:SetTextColor(1, 1, 1);
QuestInfoSpellLearnText:SetTextColor(1, 1, 1);
QuestInfoXPFrameReceiveText:SetTextColor(1, 1, 1);
for i = 1, #elementsTable, 3 do
shownFrame, bottomShownFrame = elementsTable[i]();
if ( shownFrame ) then
shownFrame:SetParent(parentFrame);
if ( lastFrame ) then
shownFrame:SetPoint("TOPLEFT", lastFrame, "BOTTOMLEFT", elementsTable[i+1], elementsTable[i+2]);
else
shownFrame:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", elementsTable[i+1], elementsTable[i+2]);
end
lastFrame = bottomShownFrame or shownFrame;
end
end
end
Then tried the Game92's solution (also works):
lua Code:
local QuestInfo_Display = function()
QuestInfoTitleHeader:SetTextColor(1, 0.85, 0)
QuestInfoDescriptionHeader:SetTextColor(1, 0.85, 0)
QuestInfoObjectivesHeader:SetTextColor(1, 0.85, 0)
QuestInfoRewardsHeader:SetTextColor(1, 0.85, 0)
QuestInfoDescriptionText:SetTextColor(1, 1, 1);
QuestInfoObjectivesText:SetTextColor(1, 1, 1);
QuestInfoGroupSize:SetTextColor(1, 1, 1);
QuestInfoRewardText:SetTextColor(1, 1, 1);
QuestInfoItemChooseText:SetTextColor(1, 1, 1);
QuestInfoItemReceiveText:SetTextColor(1, 1, 1);
QuestInfoSpellLearnText:SetTextColor(1, 1, 1);
QuestInfoXPFrameReceiveText:SetTextColor(1, 1, 1);
end
hooksecurefunc("QuestInfo_Display", QuestInfo_Display)
Then changed it to remove QuestInfo_Display which I understood to be protected:
lua Code:
local doit = function()
QuestInfoTitleHeader:SetTextColor(1, 0.85, 0)
QuestInfoDescriptionHeader:SetTextColor(1, 0.85, 0)
QuestInfoObjectivesHeader:SetTextColor(1, 0.85, 0)
QuestInfoRewardsHeader:SetTextColor(1, 0.85, 0)
QuestInfoDescriptionText:SetTextColor(1, 1, 1);
QuestInfoObjectivesText:SetTextColor(1, 1, 1);
QuestInfoGroupSize:SetTextColor(1, 1, 1);
QuestInfoRewardText:SetTextColor(1, 1, 1);
QuestInfoItemChooseText:SetTextColor(1, 1, 1);
QuestInfoItemReceiveText:SetTextColor(1, 1, 1);
QuestInfoSpellLearnText:SetTextColor(1, 1, 1);
QuestInfoXPFrameReceiveText:SetTextColor(1, 1, 1);
end
doit()
This has no effect (I didn't expect it to), but i'm not exactly sure why. The default QuestInfo_Display function is runs. In the hooksecurefunc example do both the hooked and the secure run (which first)?