Skip to content

Commit c3be3b7

Browse files
committed
Update to Shagu design
1 parent 975ecbe commit c3be3b7

20 files changed

+86810
-432
lines changed

ClassicCodex.toc

+23-9
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,34 @@
55
## Notes: Classic Codex
66
## Author: Pgarneau
77
## Version: 0.0.1
8+
## SavedVariablesPerCharacter: CodexConfig, CodexHistory
9+
10+
# Libraries
811
lib\LibStub\LibStub.lua
912
lib\CallbackHandler-1.0\CallbackHandler-1.0.xml
1013
lib\HereBeDragons\HereBeDragons-2.0.lua
1114
lib\HereBeDragons\HereBeDragons-Pins-2.0.lua
12-
core.lua
13-
quest.lua
14-
map.lua
15-
db.lua
15+
16+
# Database
1617
db\init.lua
1718
db\items.lua
18-
db\itemNames.lua
19+
db\units.lua
1920
db\objects.lua
20-
db\objectNames.lua
2121
db\quests.lua
22-
db\questNames.lua
23-
db\units.lua
24-
db\unitNames.lua
22+
23+
# Database enUS
24+
db\enUS\items.lua
25+
db\enUS\units.lua
26+
db\enUS\objects.lua
27+
db\enUS\quests.lua
28+
29+
ui.lua
30+
config.lua
31+
command.lua
32+
database.lua
33+
map.lua
34+
quest.lua
35+
# core.lua
36+
# quest.lua
37+
# map.lua
38+
# db.lua

command.lua

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
SLASH_CODEX1 = "/codex"
2+
SlashCmdList["CODEX"] = function(input, editBox)
3+
local params = {}
4+
local meta = {["addon"] = "CODEX"}
5+
6+
if (input == "" or input == nil) then
7+
DEFAULT_CHAT_FRAME:AddMessage("Tu suces")
8+
return
9+
end
10+
11+
local commandList = {}
12+
local command
13+
14+
for command in string.gmatch(input, "[^ ]+") do
15+
table.insert(commandList, command)
16+
end
17+
18+
local arg1, arg2 = commandList[1], ""
19+
20+
if arg1 == "config" then
21+
if codexConfig then codexConfig:Show() end
22+
return
23+
end
24+
end

config.lua

+313
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,313 @@
1+
CodexHistory = {}
2+
codexColors = {}
3+
CodexConfig = {
4+
["trackingmethod"] = 1,
5+
}
6+
7+
-- default config
8+
codexDefaultConfig = {
9+
["trackingMethod"] = 1, -- 1: All Quests 2: Tracked Quests 3: Manual 4: Hide
10+
["allQuestGivers"] = "1", -- Show Available Questgivers
11+
-- ["currentquestgivers"] = "1", -- Show Current Questgiver Nodes
12+
-- ["showlowlevel"] = "0", -- Show Lowlevel Questgiver Nodes
13+
-- ["showhighlevel"] = "1", -- Show Level+3 Questgiver Nodes
14+
-- ["showfestival"] = "1", -- Show Event Questgiver Nodes
15+
-- ["minimapnodes"] = "1", -- Show MiniMap Nodes
16+
-- ["cutoutminimap"] = "1", -- Use Cut-Out Minimap Node Icon
17+
-- ["questlogbuttons"] = "1", -- Show QuestLog Buttons
18+
-- ["worldmapmenu"] = "1", -- Show WorldMap Menu
19+
-- ["minimapbutton"] = "1", -- Show MiniMap Button
20+
-- ["showids"] = "0", -- Show IDs
21+
-- ["colorbyspawn"] = "1", -- Color Map Nodes By Spawn
22+
-- ["questlinks"] = "1", -- Enable Quest Links
23+
-- ["worldmaptransp"] = "1.0", -- WorldMap Node Transparency
24+
-- ["minimaptransp"] = "1.0", -- MiniMap Node Transparency
25+
-- ["mindropchance"] = "0", -- Minimum Drop Chance
26+
}
27+
28+
function setDefaults()
29+
print("hello")
30+
end
31+
32+
function textFactory(parent, value, size)
33+
local text = parent:CreateFontString(nil, "ARTWORK")
34+
text:SetFont("Fonts/FRIZQT__.ttf", size)
35+
text:SetJustifyV("CENTER")
36+
text:SetJustifyH("CENTER")
37+
text:SetText(value)
38+
return text
39+
end
40+
41+
function checkboxFactory(parent, name, description, onClick)
42+
local checkbox = CreateFrame("CheckButton", name, parent, "ChatConfigCheckButtonTemplate")
43+
getglobal(checkbox:GetName() .. "Text"):SetText(name)
44+
checkbox.tooltip = description
45+
checkbox:SetScript("OnClick", function(self)
46+
onClick(self)
47+
end)
48+
checkbox:SetScale(1.1)
49+
return checkbox
50+
end
51+
52+
function editBoxFactory(parent, name, width, height, onEnter)
53+
local editBox = CreateFrame("EditBox", nil, parent)
54+
editBox.title_text = textFactory(editBox, name, 12)
55+
editBox.title_text:SetPoint("TOP", 0, 12)
56+
editBox:SetBackdrop({
57+
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
58+
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
59+
tile = true,
60+
tileSize = 26,
61+
edgeSize = 16,
62+
insets = { left = 4, right = 4, top = 4, bottom = 4}
63+
})
64+
editBox:SetBackdropColor(0,0,0,1)
65+
editBox:SetSize(width, height)
66+
editBox:SetMultiLine(false)
67+
editBox:SetAutoFocus(false)
68+
editBox:SetMaxLetters(6)
69+
editBox:SetJustifyH("CENTER")
70+
editBox:SetJustifyV("CENTER")
71+
editBox:SetFontObject(GameFontNormal)
72+
editBox:SetScript("OnEnterPressed", function(self)
73+
onEnter(self)
74+
self:ClearFocus()
75+
end)
76+
editBox:SetScript("OnEscapePressed", function(self)
77+
self:ClearFocus()
78+
end)
79+
return editBox
80+
end
81+
82+
function allQuestGiversOnClick()
83+
print("bonjour")
84+
end
85+
86+
function createConfigPanel(parent)
87+
local config = CreateFrame("Frame", nil, parent)
88+
local settings = 0
89+
90+
-- Title
91+
config.titleText = textFactory(config, "Configuration", 20)
92+
config.titleText:SetPoint("TOPLEFT", 0, 0)
93+
config.titleText:SetTextColor(1, 0.9, 0, 1)
94+
95+
-- All Quest Givers
96+
config.allQuestGiversCheckbox = checkboxFactory(config, " All Quest Givers", "Display Available Questgivers", allQuestGiversOnClick)
97+
config.allQuestGiversCheckbox:SetPoint("TOPLEFT", 10, -35)
98+
99+
return config
100+
end
101+
102+
codexConfig = CreateFrame("Frame", "codexConfig", UIParent)
103+
codexConfig.name = "Classic Codex"
104+
codexConfig.default = setDefaults
105+
InterfaceOptions_AddCategory(codexConfig)
106+
107+
local scrollFrame = CreateFrame("ScrollFrame", nil, codexConfig)
108+
scrollFrame:SetPoint('TOPLEFT', 5, -5)
109+
scrollFrame:SetPoint('BOTTOMRIGHT', -5, 5)
110+
scrollFrame:EnableMouseWheel(true)
111+
scrollFrame:SetScript('OnMouseWheel', function(self, direction)
112+
if direction == 1 then
113+
scrollValue = math.max(self:GetVerticalScroll() - 50, 1)
114+
self:SetVerticalScroll(scrollValue)
115+
self:GetParent().scrollBar:SetValue(scrollValue)
116+
elseif direction == -1 then
117+
scrollValue = math.min(self:GetVerticalScroll() + 50, 250)
118+
self:SetVerticalScroll(scrollValue)
119+
self:GetParent().scrollBar:SetValue(scrollValue)
120+
end
121+
end)
122+
codexConfig.scrollFrame = scrollFrame
123+
124+
local scrollBar = CreateFrame("Slider", nil, scrollFrame, "UIPanelScrollBarTemplate")
125+
scrollBar:SetPoint("TOPLEFT", codexConfig, "TOPRIGHT", -20, -20)
126+
scrollBar:SetPoint("BOTTOMLEFT", codexConfig, "BOTTOMRIGHT", -20, 20)
127+
scrollBar:SetMinMaxValues(1, 250)
128+
scrollBar:SetValueStep(1)
129+
scrollBar.scrollStep = 1
130+
scrollBar:SetValue(0)
131+
scrollBar:SetWidth(16)
132+
scrollBar:SetScript("OnValueChanged", function (self, value)
133+
self:GetParent():SetVerticalScroll(value)
134+
end)
135+
local scrollBackground = scrollBar:CreateTexture(nil, "BACKGROUND")
136+
scrollBackground:SetAllPoints(scrollBar)
137+
scrollBackground:SetColorTexture(0, 0, 0, 0.6)
138+
codexConfig.scrollBar = scrollBar
139+
140+
local content = CreateFrame("Frame", nil, scrollFrame)
141+
content:SetSize(1, 1)
142+
scrollFrame.content = content
143+
scrollFrame:SetScrollChild(content)
144+
-- Add main panel
145+
content.panel = createConfigPanel(content)
146+
content.panel:SetPoint("TOPLEFT", 10, -10)
147+
content.panel:SetSize(1, 1)
148+
149+
150+
151+
152+
-- codexConfig = CreateFrame("Frame", "codexConfig", UIParent)
153+
-- codexConfig:Hide()
154+
-- codexConfig:SetWidth(280)
155+
-- codexConfig:SetHeight(440)
156+
-- codexConfig:SetPoint("CENTER", 0, 0)
157+
-- codexConfig:SetFrameStrata("TOOLTIP")
158+
-- codexConfig:SetMovable(true)
159+
-- codexConfig:EnableMouse(true)
160+
-- codexConfig:RegisterEvent("ADDON_LOADED")
161+
-- codexConfig:SetScript("OnEvent", function()
162+
-- if arg1 == "ClassicCodex" then
163+
-- codexConfig:LoadConfig()
164+
-- -- codexConfig:MigrateHistory()
165+
166+
-- codexConfig:CreateConfigEntry("allQuestGivers", "Display Available Questgivers", "checkbox")
167+
168+
-- -- if pfBrowserIcon and pfQuest_config["minimapbutton"] == "0" then
169+
-- -- pfBrowserIcon:Hide()
170+
-- -- end
171+
-- end
172+
-- end)
173+
174+
-- codexConfig:SetScript("OnMouseDown", function()
175+
-- codexConfig:StartMoving()
176+
-- end)
177+
178+
-- codexConfig:SetScript("OnMouseUp", function()
179+
-- codexConfig:StopMovingOrSizing()
180+
-- end)
181+
182+
-- codexConfig.vpos = 30
183+
184+
-- CodexUI:CreateBackdrop(codexConfig, nil, 0.75)
185+
-- table.insert(UISpecialFrames, "codexConfig")
186+
187+
-- codexConfig.title = codexConfig:CreateFontString("Status", "LOW", "GameFontNormal")
188+
-- codexConfig.title:SetFontObject(GameFontWhite)
189+
-- codexConfig.title:SetPoint("TOP", codexConfig, "TOP", 0, -8)
190+
-- codexConfig.title:SetJustifyH("LEFT")
191+
-- codexConfig.title:SetFont(CodexUI.defaultFont, 14)
192+
-- codexConfig.title:SetText("|cff33ffccpf|rQuest " .. "Config")
193+
194+
-- codexConfig.close = CreateFrame("Button", "codexConfigClose", codexConfig)
195+
-- codexConfig.close:SetPoint("TOPRIGHT", -5, -5)
196+
-- codexConfig.close:SetHeight(12)
197+
-- codexConfig.close:SetWidth(12)
198+
-- codexConfig.close.texture = codexConfig.close:CreateTexture("pfQuestionDialogCloseTex")
199+
-- codexConfig.close.texture:SetTexture("Interface\\AddOns\\ClassicCodex\\img\\close.tga")
200+
-- codexConfig.close.texture:ClearAllPoints()
201+
-- codexConfig.close.texture:SetAllPoints(codexConfig.close)
202+
-- codexConfig.close.texture:SetVertexColor(1,.25,.25,1)
203+
-- -- pfUI.api.SkinButton(codexConfig.close, 1, .5, .5)
204+
-- -- codexConfig.close:SetScript("OnClick", function()
205+
-- -- this:GetParent():Hide()
206+
-- -- end)
207+
208+
-- -- codexConfig.clean = CreateFrame("Button", "codexConfigReload", codexConfig)
209+
-- -- codexConfig.clean:SetWidth(260)
210+
-- -- codexConfig.clean:SetHeight(30)
211+
-- -- codexConfig.clean:SetPoint("BOTTOM", 0, 10)
212+
-- -- codexConfig.clean:SetScript("OnClick", function()
213+
-- -- ReloadUI()
214+
-- -- end)
215+
-- -- codexConfig.clean.text = codexConfig.clean:CreateFontString("Caption", "LOW", "GameFontWhite")
216+
-- -- codexConfig.clean.text:SetAllPoints(codexConfig.clean)
217+
-- -- codexConfig.clean.text:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
218+
-- -- codexConfig.clean.text:SetText(pfQuest_Loc["Close & Reload"])
219+
-- -- pfUI.api.SkinButton(codexConfig.clean)
220+
221+
-- function codexConfig:LoadConfig()
222+
-- if not CodexConfig then CodexConfig = {} end
223+
224+
-- for key, value in pairs(codexDefaultConfig) do
225+
-- if not CodexConfig[key] then
226+
-- CodexConfig[key] = value
227+
-- end
228+
-- end
229+
-- end
230+
231+
-- function codexConfig:MigrateHistory()
232+
-- -- local match = false
233+
234+
-- -- for entry in pairs(pfQuest_history) do
235+
-- -- if type(entry) == "string" then
236+
-- -- match = true
237+
-- -- for id in pairs(pfDatabase:GetIDByName(entry, "quests")) do
238+
-- -- pfQuest_history[id] = true
239+
-- -- end
240+
-- -- pfQuest_history[entry] = nil
241+
-- -- end
242+
-- -- end
243+
244+
-- -- if match == true then
245+
-- -- DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpf|cffffffffQuest|r: " .. pfQuest_Loc["Quest history migration completed."])
246+
-- -- end
247+
-- end
248+
249+
-- function codexConfig:CreateConfigEntry(config, description, type)
250+
-- -- basic frame
251+
-- local frame = getglobal("codexConfig" .. config) or CreateFrame("Frame", "codexConfig" .. config, codexConfig)
252+
-- frame:SetWidth(280)
253+
-- frame:SetHeight(25)
254+
-- frame:SetPoint("TOP", 0, -codexConfig.vpos)
255+
256+
-- -- caption
257+
-- frame.caption = frame.caption or frame:CreateFontString("Status", "LOW", "GameFontWhite")
258+
-- frame.caption:SetFont("Fonts\\ARIALN.TTF", 12, "OUTLINE")
259+
-- frame.caption:SetPoint("LEFT", 20, 0)
260+
-- frame.caption:SetJustifyH("LEFT")
261+
-- frame.caption:SetText(description)
262+
263+
-- -- checkbox
264+
-- if type == "checkbox" then
265+
-- frame.input = frame.input or CreateFrame("CheckButton", nil, frame, "UICheckButtonTemplate")
266+
-- frame.input:SetNormalTexture("")
267+
-- frame.input:SetPushedTexture("")
268+
-- frame.input:SetHighlightTexture("")
269+
-- CodexUI:CreateBackdrop(frame.input, nil)
270+
271+
-- frame.input:SetWidth(12)
272+
-- frame.input:SetHeight(12)
273+
-- frame.input:SetPoint("RIGHT" , -20, 0)
274+
275+
-- frame.input.config = config
276+
-- if CodexConfig[config] == "1" then
277+
-- frame.input:SetChecked()
278+
-- end
279+
280+
-- frame.input:SetScript("OnClick", function ()
281+
-- if frame.input:GetChecked() then
282+
-- CodexConfig[frame.input.config] = "1"
283+
-- else
284+
-- CodexConfig[frame.input.config] = "0"
285+
-- end
286+
-- end)
287+
288+
-- -- Input field
289+
-- elseif type == "text" then
290+
-- frame.input = frame.input or CreateFrame("EditBox", nil, frame)
291+
-- frame.input:SetTextColor(0.2, 1, 0.8, 1)
292+
-- frame.input:SetJustifyH("RIGHT")
293+
294+
-- frame.input:SetWidth(50)
295+
-- frame.input:SetHeight(20)
296+
-- frame.input:SetPoint("RIGHT", -20, 0)
297+
-- frame.input:SetFontObject(GameFontNormal)
298+
-- frame.input:SetAutoFocus(false)
299+
-- frame.input:SetScript("OnEscapePressed", function()
300+
-- frame.input:ClearFocus()
301+
-- end)
302+
303+
-- frame.input.config = config
304+
-- frame.input:SetText(CodexConfig[config])
305+
306+
-- frame.input:SetScript("OnTextChanged", function()
307+
-- CodexConfig[frame.input.config] = frame.input:GetText()
308+
-- end)
309+
-- end
310+
311+
-- codexConfig.vpos = codexConfig.vpos + 23
312+
-- end
313+

0 commit comments

Comments
 (0)