Skip to content

Commit

Permalink
Add QpartPart step option command
Browse files Browse the repository at this point in the history
  • Loading branch information
Neogeekmo committed Jul 20, 2024
1 parent 8eacccf commit f20e4d0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
19 changes: 19 additions & 0 deletions Commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,25 @@ function AprRC.command:SlashCmd(input)
end
return
elseif inputText == "qpartpart" then
AprRC.QuestObjectiveSelector:Show({
title = "Qpartpart quest list",
statusText = "Click on an objective to create a Qpartpart ",
questList = AprRC.QuestObjectiveSelector:GetQuestList(),
onClick = function(questID, objectiveID)
AprRC.questionDialog:CreateEditBoxPopupWithCallback("Text Trigger for Qpart Part", function(text)
local step = {
TrigText = text,
QpartPart = { [questID] = { objectiveID } }
}
AprRC:SetStepCoord(step)
AprRC:NewStep(step)
print("|cff00bfffQpartPart - [" ..
C_QuestLog.GetTitleForQuestID(questID) .. "] - " .. objectiveID .. "|r Added")
print("|cff00bfffTrigText - " .. text .. "|r Added")
end)
end
})
return
elseif inputText == "zonetrigger" then
local currentStep = AprRC:GetLastStep()
local y, x = UnitPosition("player")
Expand Down
8 changes: 4 additions & 4 deletions Event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function AprRC.event.functions.spell(event, unitTarget, castGUID, spellID)
key = "UseDalaHS"
elseif spellID == APR.garrisonHSSpellID then
key = "UseGarrisonHS"
elseif AprRC:Contains(APR.hearthStoneSpellID, spellID) then
elseif tContains(APR.hearthStoneSpellID, spellID) then
key = "UseHS"
elseif spellID == 126389 then
local currentStep = AprRC:GetLastStep()
Expand Down Expand Up @@ -239,11 +239,11 @@ local function SetGossipOptionID(self)
local gossipInfo = self:GetData().info
local gossipIcon = gossipInfo.icon
local gossipOptionID = gossipInfo.gossipOptionID
if gossipIcon == 132053 and not AprRC:Contains({ 51901, 51902 }, gossipOptionID) then --bubble icon and not chromie select timeline
if gossipIcon == 132053 and not tContains({ 51901, 51902 }, gossipOptionID) then --bubble icon and not chromie select timeline
if not AprRC:IsCurrentStepFarAway() then
local currentStep = AprRC:GetLastStep()
if AprRC:HasStepOption("GossipOptionIDs") then
if not AprRC:Contains(currentStep["GossipOptionIDs"], gossipOptionID) then
if not tContains(currentStep["GossipOptionIDs"], gossipOptionID) then
tinsert(currentStep["GossipOptionIDs"], gossipOptionID)
end
else
Expand Down Expand Up @@ -356,7 +356,7 @@ function AprRC.event.functions.fly(event, ...)
currentStep.NodeID = taxiNodeId

--Boat
if AprRC:Contains(boatsNodeID, AprRC.CurrentTaxiNode) then
if tContains(boatsNodeID, AprRC.CurrentTaxiNode) then
currentStep.Boat = 1
end

Expand Down
2 changes: 0 additions & 2 deletions frames/CommandsBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ local FRAME_HEIGHT = 35
---------------------------------------------------------------------------------------
--------------------------------- CommandBar Frames -----------------------------------
---------------------------------------------------------------------------------------

print('OUIIIIIIIIIIIIIIIIIIIII')
local CommandBarFrame = CreateFrame("Frame", "CommandBarFrame", UIParent, "BackdropTemplate")
CommandBarFrame:SetSize(FRAME_WIDTH, FRAME_HEIGHT)
CommandBarFrame:SetFrameStrata("MEDIUM")
Expand Down
18 changes: 2 additions & 16 deletions helper/Utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ function AprRC:Error(errorMessage, data)
end
end

--- Contain data in list
---@param list array list
---@param x object object to check if in the list
---@return true|false Boolean
function AprRC:Contains(list, x)
if list then
for _, v in pairs(list) do
if v == x then
return true
end
end
end
return false
end

function AprRC:DeepCompare(t1, t2)
if t1 == t2 then return true end
if type(t1) ~= "table" or type(t2) ~= "table" then return false end
Expand Down Expand Up @@ -160,6 +145,7 @@ function AprRC:RouteToString(tbl, level)
local indent = string.rep(" ", level)
local str = "{\n"
local itemIndent = string.rep(" ", level + 1)
local qpartTableLis = { "Fillers", "Qpart", "QpartPart", "Button", "SpellButton" }

local keys = {}
for k in pairs(tbl) do
Expand All @@ -176,7 +162,7 @@ function AprRC:RouteToString(tbl, level)
str = str .. itemIndent .. keyStr .. "{}" .. ",\n"
else
local valueStr
if k == "Qpart" or k == "Fillers" or k == "Button" or k == "SpellButton" then
if tContains(qpartTableLis, k) then
valueStr = qpartTableToString(v, level + 1, k)
else
valueStr = self:RouteToString(v, level + 1)
Expand Down

0 comments on commit f20e4d0

Please sign in to comment.