Skip to content

Commit

Permalink
Add auto DropQuest step
Browse files Browse the repository at this point in the history
  • Loading branch information
Neogeekmo committed May 7, 2024
1 parent 1a8e369 commit fe5069a
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 2 deletions.
49 changes: 48 additions & 1 deletion Event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ AprRC.event = AprRC:NewModule("AprRC-Event")
AprRC.event.framePool = {}
AprRC.event.functions = {}

local targetName, targetID

---------------------------------------------------------------------------------------
------------------------------------- EVENTS ------------------------------------------
---------------------------------------------------------------------------------------
Expand All @@ -25,7 +27,9 @@ local events = {
taxi = { "TAXIMAP_OPENED", "TAXIMAP_CLOSED" },
fly = { "PLAYER_CONTROL_LOST", "PLAYER_CONTROL_GAINED" },
buy = "MERCHANT_SHOW",
qpart = "QUEST_WATCH_UPDATE"
qpart = "QUEST_WATCH_UPDATE",
loot = "CHAT_MSG_LOOT",
target = "PLAYER_TARGET_CHANGED"
-- warMode = "WAR_MODE_STATUS_UPDATE",
-- vehicle = { "UNIT_ENTERING_VEHICLE", "UNIT_EXITING_VEHICLE" },
}
Expand Down Expand Up @@ -115,9 +119,17 @@ end)

function AprRC.event.functions.accept(event, questId)
-- Pickup
if AprRC:HasStepOption("DroppableQuest") then
local currentStep = AprRC:GetLastStep()
currentStep.DropQuest = questId
currentStep.DroppableQuest.Qid = questId
AprRC:saveQuestInfo()
return
end
if AprRC:HasStepOption("ChromiePick") then
local currentStep = AprRC:GetLastStep()
currentStep.PickUp = { questId }
AprRC:saveQuestInfo()
return
end
if not AprRC:IsCurrentStepFarAway() and AprRC:HasStepOption("PickUp") then
Expand Down Expand Up @@ -462,6 +474,41 @@ function AprRC.event.functions.qpart(event, questID)
end)
end

function AprRC.event.functions.loot(event, message, ...)
local itemLink = string.match(message, "|Hitem:.-|h.-|h")

if itemLink then
local itemID, _, _, _, _, classID, _ = C_Item.GetItemInfoInstant(itemLink)
if classID == 12 then -- Quest item
local tooltipScanner = CreateFrame("GameTooltip", "ItemTooltipScanner", nil, "GameTooltipTemplate")
tooltipScanner:SetOwner(WorldFrame, "ANCHOR_NONE")
tooltipScanner:SetItemByID(itemID)

local hasQuestItem = false
for i = 2, tooltipScanner:NumLines() do
local line = _G["ItemTooltipScannerTextLeft" .. i]:GetText() or ""
if line:find(L.DroppableQuestItem) then
hasQuestItem = true
break
end
end
if hasQuestItem then
local step = {}
step.DroppableQuest = { Text = targetName, MobId = targetID }
AprRC:SetStepCoord(step)
AprRC:NewStep(step, 5)
end
end
end
end

function AprRC.event.functions.target(event, ...)
local targetGUID = UnitGUID("target")
if not targetGUID then return end
targetName = UnitName("target")
targetID = select(6, strsplit("-", targetGUID))
end

function AprRC.event.functions.pet(event, ...)
AprRC.record:RefreshFrameAnchor()
end
Expand Down
8 changes: 7 additions & 1 deletion helper/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ function AprRC:GetItemIDFromLink(link)
end

function AprRC:ExtraLineTextToKey(inputString)
local result = string.gsub(inputString, "_(a|of|the)_", " ")
local result = string.lower(inputString)
result = string.gsub(result, " a ", " ")
result = string.gsub(result, " of ", " ")
result = string.gsub(result, " the ", " ")
result = string.gsub(result, "^a ", "")
result = string.gsub(result, "^of ", "")
result = string.gsub(result, "^the ", "")
result = string.gsub(result, " - ", " ")
result = string.gsub(result, "-", " ")
result = string.gsub(result, "[+='\"`$£€°~^¨<>|#&;,%.:§?!*/(){}%[%]]", "")
Expand Down
1 change: 1 addition & 0 deletions locales/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="deDE", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "Dieser Gegenstand startet eine Quest"
L.Emotes = {
["AGREE"] = { "%1$s stimmt %2$s zu.", "%s stimmt Euch zu.", "Ihr stimmt %s zu.", "%s stimmt zu.", "Ihr stimmt zu." },
["AMAZE"] = { "%1$s wundert sich über %2$s!", "%s wundert sich über Euch!", "Ihr wundert Euch über %s!", "%s wundert sich!", "Ihr wundert Euch!" },
Expand Down
1 change: 1 addition & 0 deletions locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="enUS", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "This Item Begins a Quest"
L.Emotes = {
["AGREE"] = { "%s agrees with %s.", "%s agrees with you.", "You agree with %s.", "%s agrees.", "You agree." },
["AMAZE"] = { "%s is amazed by %s!", "%s is amazed by you!", "You are amazed by %s!", "%s is amazed!", "You are amazed!" },
Expand Down
1 change: 1 addition & 0 deletions locales/esES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="esES", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "Este objeto inicia una misión"
L.Emotes = {
["AGREE"] = { "%s está de acuerdo con %s.", "%s está de acuerdo contigo.", "Estás de acuerdo con %s.", "%s está de acuerdo.", "Estás de acuerdo." },
["AMAZE"] = { "%s muestra su asombro ante %s.", "¡%s muestra su asombro ante ti!", "Muestras tu asombro ante %s.", "%s muestra su asombro.", "Muestras tu asombro." },
Expand Down
1 change: 1 addition & 0 deletions locales/esMX.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="esMX", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "Este objeto inicia una misión"
L.Emotes = {
["AGREE"] = { "%s está de acuerdo con %s.", "%s está de acuerdo contigo.", "Estás de acuerdo con %s.", "%s está de acuerdo.", "Estás de acuerdo." },
["AMAZE"] = { "%s muestra su asombro ante %s.", "¡%s muestra su asombro ante ti!", "Muestras tu asombro ante %s.", "%s muestra su asombro.", "Muestras tu asombro." },
Expand Down
1 change: 1 addition & 0 deletions locales/frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if not L then return end
-- Author: Neogeekmo
--@localization(locale="frFR", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "Cet objet permet de lancer une quête"
L.Emotes = {
["AGREE"] = { "%s est bien d’accord avec %s.", "%s est bien d’accord avec vous.", "Vous êtes bien d’accord avec %s.", "%s est bien d’accord.", "Vous êtes bien d’accord." },
["AMAZE"] = { "%s est stupéfait par %s !", "Vous stupéfiez %s !", "Vous êtes stupéfait par %s !", "%s trouve ça stupéfiant !", "Vous trouvez ça stupéfiant !" },
Expand Down
1 change: 1 addition & 0 deletions locales/itIT.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="itIT", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "Questo oggetto avvia una missione"
L.Emotes = {
["AGREE"] = { "%s è d'accordo con %s.", "%s è d'accordo con te.", "Sei d'accordo con %s.", "%s è d'accordo.", "Sei d'accordo." },
["AMAZE"] = { "%s è senza parole di fronte a %s!", "%s è senza parole di fronte a te!", "Sei senza parole di fronte a %s!", "%s è senza parole!", "Sei senza parole!" },
Expand Down
1 change: 1 addition & 0 deletions locales/koKR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="koKR", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "퀘스트 시작 아이템"
L.Emotes = {
["AGREE"] = { '%s|1이;가; %s의 의견에 동의합니다.', '%s|1이;가; 당신의 의견에 동의합니다.', '당신은 %s의 의견에 동의합니다.', '%s|1이;가; 의견에 동의합니다.', '당신은 의견에 동의합니다.' },
["AMAZE"] = { '%s|1이;가; %s|1을;를; 보고 아연실색합니다!', '%s|1이;가; 당신을 보고 아연실색합니다!', '당신은 %s|1을;를; 보고 아연실색합니다!', '%s|1이;가; 무언가를 보고 아연실색합니다!', '당신은 무언가를 보고 아연실색합니다!' },
Expand Down
1 change: 1 addition & 0 deletions locales/ptBR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="ptBR", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "Esse Item Começa uma Missão"
L.Emotes = {
["AGREE"] = { '%s concorda com %s.', '%s concorda com você.', 'Você concorda com %s.', '%s concorda.', 'Você concorda.' },
["AMAZE"] = { '%s se maravilhou com %s!', '%s se maravilhou com você!', 'Você se maravilhou com %s!', '%s se maravilhou!', 'Você se maravilhou!' },
Expand Down
1 change: 1 addition & 0 deletions locales/ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="ruRU", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "Этот предмет позволяет получить задание"
L.Emotes = {
["AGREE"] = { '%s соглашается с |3-4(%s).', '%s соглашается с вами.', 'Вы соглашаетесь с |3-4(%s).', '%s согласно кивает.', 'Вы соглашаетесь.' },
["AMAZE"] = { '%s восхищается |3-4(%s)!', '%s восхищается вами!', 'Вы восхищены |3-4(%s)!', '%s в восхищении!', 'Вы восхищены!' },
Expand Down
1 change: 1 addition & 0 deletions locales/zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="zhCN", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "本物品开启一项任务"
L.Emotes = {
["AGREE"] = { '%s赞同%s的观点。', '%s赞同你的观点。', '你赞同%s的观点。', '%s表示赞同。', '你表示赞同。' },
["AMAZE"] = { '%s让%s感到很惊奇!', '你让%s感到很惊奇!', '%s让你感到很惊奇!', '%s感到很惊奇!', '你感到很惊奇!' },
Expand Down
1 change: 1 addition & 0 deletions locales/zhTW.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ if not L then return end

--@localization(locale="zhTW", format="lua_additive_table", handle-unlocalized="ignore")@

L.DroppableQuestItem = "本物品开启一项任务"
L.Emotes = {
["AGREE"] = { '%s贊同%s的觀點。', '%s認同你的觀點。', '你贊同%s的觀點。', '%s表示認同。', '你表示認同。' },
["AMAZE"] = { '%s讓%s感到很驚奇!', '你讓%s感到很驚奇!', '%s讓你感到很驚奇!', '%s感到很驚奇!', '你感到很驚奇!' },
Expand Down

0 comments on commit fe5069a

Please sign in to comment.