42 lines
1.4 KiB
Lua
42 lines
1.4 KiB
Lua
-- QUEST_POI_UPDATE QUEST_DETAIL QUEST_COMPLETE QUEST_GREETING QUEST_PROGRESS GOSSIP_SHOW
|
|
function(e)
|
|
if e == "QUEST_POI_UPDATE" then
|
|
CloseGossip()
|
|
elseif e == "QUEST_DETAIL" then
|
|
AcceptQuest()
|
|
elseif e == "QUEST_COMPLETE" then
|
|
if GetNumQuestChoices() <= 1 then
|
|
GetQuestReward(1)
|
|
end
|
|
elseif e == "GOSSIP_SHOW" then
|
|
local quests = GetNumGossipAvailableQuests()
|
|
local completedQuests = GetNumGossipActiveQuests()
|
|
local options = GetNumGossipOptions()
|
|
if completedQuests > 0 and options == 0 then
|
|
for i = 1, completedQuests do
|
|
SelectGossipActiveQuest(i)
|
|
end
|
|
end
|
|
if quests > 0 and options == 0 then
|
|
SelectGossipAvailableQuest(1)
|
|
end
|
|
if options == 1 and quests + completedQuests == 0 then
|
|
SelectGossipOption(1)
|
|
end
|
|
elseif e == "QUEST_GREETING" then
|
|
local quests = GetNumGossipAvailableQuests()
|
|
local completedQuests = GetNumGossipActiveQuests()
|
|
if completedQuests > 0 then
|
|
for i = 1, completedQuests do
|
|
SelectActiveQuest(1)
|
|
end
|
|
end
|
|
if quests > 0 then
|
|
SelectAvailableQuest(1)
|
|
end
|
|
elseif e == "QUEST_PROGRESS" then
|
|
if IsQuestCompletable(i) then
|
|
CompleteQuest()
|
|
end
|
|
end
|
|
end |