-
Notifications
You must be signed in to change notification settings - Fork 7
SQL conversion #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
SQL conversion #18
Changes from all commits
cdb52a4
f57e158
49d536e
4cf5e8b
bd19b6a
c4fbab8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,8 +150,8 @@ function BMButtonHandlers.RenderButtonIcon(Button, cursorScreenPos, size) | |
|
|
||
| local draw_list = ImGui.GetWindowDrawList() | ||
|
|
||
| local iconId = Button.Icon | ||
| local iconType = Button.IconType | ||
| local iconId = Button.Icon or -1 | ||
| local iconType = Button.IconType or '' | ||
|
|
||
| if Button.IconLua and Button.IconLua:len() > 0 then | ||
| local success | ||
|
|
@@ -164,10 +164,11 @@ function BMButtonHandlers.RenderButtonIcon(Button, cursorScreenPos, size) | |
| end | ||
|
|
||
| local renderIconAnim = animItems | ||
| if iconType == nil or iconType == "Spell" then | ||
|
|
||
| if iconType == "Spell" then | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is likely broken as nil is a valid case. which will now be either nil or '' with your changes... |
||
| animSpellIcons:SetTextureCell(tonumber(iconId) or 0) | ||
| renderIconAnim = animSpellIcons | ||
| else | ||
| elseif iconType == "Item" then | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could do if iconType == "Item" else ... assume spell |
||
| animItems:SetTextureCell(tonumber(iconId) or 0) | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,11 @@ BMButtonEditor.tmpButton = nil | |
|
|
||
| BMButtonEditor.selectedTimerType = 1 | ||
| BMButtonEditor.selectedUpdateRate = 1 | ||
|
|
||
| -- ---@diagnostic disable-next-line:undefined-field | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's not add comments back into the branch. |
||
| -- BMButtonEditor.textEditor = ImGui.TextEditor.new("##TextEditor") | ||
| -- BMButtonEditor.textEditor:SetSyntax('lua') | ||
| -- ---@diagnostic disable-next-line:undefined-global | ||
| -- BMButtonEditor.textEditor.windowFlags = bit32.bor(TextEditorWindowFlags.ShowLineNumbers, TextEditorWindowFlags.WrapText, TextEditorWindowFlags.ShowIndicators) | ||
| function BMButtonEditor:RenderEditButtonPopup() | ||
| if not self.editButtonPopupOpen then | ||
| picker:SetClosed() | ||
|
|
@@ -71,7 +75,7 @@ function BMButtonEditor:RenderEditButtonPopup() | |
| elseif attachmentType == "social" then | ||
| self.tmpButton.Label = buttonText | ||
| if cursorIndex + 1 > 120 then | ||
| self.tmpButton.Cmd = string.format("/alt act %d", cursorIndex - 120) | ||
| self.tmpButton.Cmd = string.format("/alt act %d", cursorIndex) | ||
| self.tmpButton.Icon = nil | ||
| self.tmpButton.Cooldown = buttonText | ||
| self.tmpButton.TimerType = "AA" | ||
|
|
@@ -81,8 +85,7 @@ function BMButtonEditor:RenderEditButtonPopup() | |
| for i = 0, 4 do | ||
| local cmd = mq.TLO.Social(cursorIndex + 1).Cmd(i)() or "" | ||
| if cmd:len() > 0 then | ||
| self.tmpButton.Cmd = string.format("%s%s%s", self.tmpButton.Cmd, | ||
| self.tmpButton.Cmd:len() > 0 and "\n" or "", cmd) | ||
| self.tmpButton.Cmd = string.format("%s%s%s", self.tmpButton.Cmd, self.tmpButton.Cmd:len() > 0 and "\n" or "", cmd) | ||
| end | ||
| end | ||
| end | ||
|
|
@@ -108,8 +111,9 @@ function BMButtonEditor:RenderEditButtonPopup() | |
| ButtonKey -- add the button key for this button set index | ||
| BMSettings:GetSettings().Buttons[ButtonKey] = btnUtils.shallowcopy(self.tmpButton) -- store the tmp button into the settings table | ||
| BMSettings:GetSettings().Buttons[ButtonKey].Unassigned = nil -- clear the unassigned flag | ||
|
|
||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateButtonDB(btnUtils.shallowcopy(self.tmpButton), ButtonKey) | ||
| BMSettings:updateSetDB(self.editButtonSet, self.editButtonIndex, ButtonKey) | ||
| self.editButtonUIChanged = false | ||
| else | ||
| btnUtils.Output("\arSave failed. Button Label cannot be empty.") | ||
|
|
@@ -140,6 +144,8 @@ function BMButtonEditor:RenderEditButtonPopup() | |
| BMSettings:GetSettings().Buttons[ButtonKey].Unassigned = nil -- clear the unassigned flag | ||
|
|
||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateButtonDB(btnUtils.shallowcopy(self.tmpButton), ButtonKey) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cant all the DB updates be handle from SaveSettings? How do you know when to call updatebutton/updateset/etc? That should ideally be abstracted away as much as possible. |
||
| BMSettings:updateSetDB(self.editButtonSet, self.editButtonIndex, ButtonKey) | ||
| self.editButtonUIChanged = false | ||
| else | ||
| btnUtils.Output("\arSave failed. Button Label cannot be empty.") | ||
|
|
@@ -152,6 +158,7 @@ end | |
|
|
||
| function BMButtonEditor:CloseEditPopup() | ||
| picker:SetClosed() | ||
| -- self.textEditor:Clear() | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's not add comments back into the branch. |
||
| self.editButtonPopupOpen = false | ||
| self.editButtonIndex = 0 | ||
| self.editButtonSet = "" | ||
|
|
@@ -163,6 +170,7 @@ function BMButtonEditor:OpenEditPopup(Set, Index) | |
| self.editButtonSet = Set | ||
| self.selectedTimerType = 1 | ||
| self.selectedUpdateRate = 1 | ||
|
|
||
| local button = BMSettings:GetButtonBySetIndex(Set, Index) | ||
| self.tmpButton = btnUtils.shallowcopy(button) | ||
|
|
||
|
|
@@ -180,6 +188,7 @@ function BMButtonEditor:OpenEditPopup(Set, Index) | |
| end | ||
| end | ||
| end | ||
| -- self.textEditor:Clear() | ||
| end | ||
|
|
||
| function BMButtonEditor:CreateButtonFromCursor(Set, Index) | ||
|
|
@@ -201,14 +210,12 @@ function BMButtonEditor:RenderButtonEditUI(renderButton, enableShare, enableEdit | |
|
|
||
| local colorChanged = false | ||
| -- color pickers | ||
| colorChanged = btnUtils.RenderColorPicker(string.format("##ButtonColorPicker1_%s", renderButton.Label), 'Button', | ||
| renderButton, | ||
| colorChanged = btnUtils.RenderColorPicker(string.format("##ButtonColorPicker1_%s", renderButton.Label), 'Button', renderButton, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These seem like non-changes polluting the PR. Can you get rid of them please? |
||
| 'ButtonColorRGB') | ||
| self.editButtonUIChanged = self.editButtonUIChanged or colorChanged | ||
|
|
||
| ImGui.SameLine() | ||
| colorChanged = btnUtils.RenderColorPicker(string.format("##TextColorPicker1_%s", renderButton.Label), 'Text', | ||
| renderButton, 'TextColorRGB') | ||
| colorChanged = btnUtils.RenderColorPicker(string.format("##TextColorPicker1_%s", renderButton.Label), 'Text', renderButton, 'TextColorRGB') | ||
| self.editButtonUIChanged = self.editButtonUIChanged or colorChanged | ||
|
|
||
| ImGui.SameLine() | ||
|
|
@@ -265,8 +272,7 @@ function BMButtonEditor:RenderButtonEditUI(renderButton, enableShare, enableEdit | |
| btnUtils.Tooltip( | ||
| "Dynamically override the IconID with this Lua function. \nNote: This MUST return number, string : IconId, IconType") | ||
|
|
||
| self.selectedUpdateRate, _ = ImGui.Combo("Update Rate", self.selectedUpdateRate, | ||
| function(idx) return BMSettings.Constants.UpdateRates[idx].Display end, | ||
| self.selectedUpdateRate, _ = ImGui.Combo("Update Rate", self.selectedUpdateRate, function(idx) return BMSettings.Constants.UpdateRates[idx].Display end, | ||
| #BMSettings.Constants.UpdateRates) | ||
| renderButton.UpdateRate = BMSettings.Constants.UpdateRates[self.selectedUpdateRate].Value | ||
| self.editButtonUIChanged = self.editButtonUIChanged or textChanged | ||
|
|
@@ -284,6 +290,13 @@ function BMButtonEditor:RenderButtonEditUI(renderButton, enableShare, enableEdit | |
| ImGui.PushFont(ImGui.ConsoleFont) | ||
| renderButton.Cmd, textChanged = ImGui.InputTextMultiline("##_Cmd_Edit", renderButton.Cmd or "", | ||
| ImVec2(ImGui.GetWindowWidth() * 0.98, editHeight), ImGuiInputTextFlags.AllowTabInput) | ||
| -- self.textEditor:Render(ImVec2(ImGui.GetWindowWidth() * 0.98, editHeight)) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's not add comments back into the branch. |
||
| -- local textContents = self.textEditor.text ~= '' and self.textEditor.text or (renderButton.Cmd and renderButton.Cmd or "") | ||
| -- self.textEditor:LoadContents(textContents) | ||
| -- if self.textEditor.text ~= renderButton.Cmd then | ||
| -- textChanged = true | ||
| -- renderButton.Cmd = self.textEditor.text | ||
| -- end | ||
| ImGui.PopFont() | ||
| self.editButtonUIChanged = self.editButtonUIChanged or textChanged | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,7 @@ function BMHotbarClass.new(id, createFresh) | |
| newBMHotbar.newY = 500 | ||
|
|
||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
|
|
||
| BMSettings:GetCharConfig().Windows[id].Sets = BMSettings:GetCharConfig().Windows[id].Sets or {} | ||
|
|
@@ -79,6 +80,7 @@ function BMHotbarClass:ToggleVisible() | |
| BMSettings:GetCharacterWindow(self.id).Visible = not BMSettings:GetCharacterWindow(self.id).Visible | ||
| self.openGUI = BMSettings:GetCharacterWindow(self.id).Visible | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
|
|
||
| function BMHotbarClass:IsVisible() | ||
|
|
@@ -247,6 +249,7 @@ function BMHotbarClass:RenderTabs() | |
| --ImGuiWindowFlags.NoMove | ||
| BMSettings:GetCharacterWindow(self.id).Locked = not BMSettings:GetCharacterWindow(self.id).Locked | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
|
|
||
| ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (iconPadding)) | ||
|
|
@@ -277,6 +280,7 @@ function BMHotbarClass:RenderTabs() | |
| --ImGuiWindowFlags.NoMove | ||
| BMSettings:GetCharacterWindow(self.id).Locked = not BMSettings:GetCharacterWindow(self.id).Locked | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
|
|
||
| ImGui.SameLine() | ||
|
|
@@ -380,6 +384,7 @@ function BMHotbarClass:RenderTabContextMenu() | |
| if ImGui.MenuItem(k) then | ||
| table.insert(BMSettings:GetCharacterWindowSets(self.id), k) | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| break | ||
| end | ||
| end | ||
|
|
@@ -392,6 +397,7 @@ function BMHotbarClass:RenderTabContextMenu() | |
| if ImGui.MenuItem(v) then | ||
| table.remove(BMSettings:GetCharConfig().Windows[self.id].Sets, i) | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| break | ||
| end | ||
| end | ||
|
|
@@ -413,6 +419,8 @@ function BMHotbarClass:RenderTabContextMenu() | |
| end | ||
| BMSettings:GetSettings().Sets[k] = nil | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:deleteSetFromDB(k) | ||
| BMSettings:deleteSetFromCharacterDB(BMSettings.CharConfig, k) | ||
| break | ||
| end | ||
| end | ||
|
|
@@ -439,6 +447,7 @@ function BMHotbarClass:RenderTabContextMenu() | |
| end | ||
| BMSettings:GetSettings().Buttons[buttonData.id] = nil | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:deleteButtonFromDB(buttonData.id) | ||
| break | ||
| end | ||
| end | ||
|
|
@@ -458,6 +467,7 @@ function BMHotbarClass:RenderTabContextMenu() | |
| BMSettings:GetCharacterWindow(self.id).ButtonSize = i | ||
| self.buttonSizeDirty = true | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| break | ||
| end | ||
| end | ||
|
|
@@ -489,6 +499,7 @@ function BMHotbarClass:RenderTabContextMenu() | |
| if ImGui.MenuItem(v.label, nil, checked) then | ||
| BMSettings:GetCharacterWindow(self.id).Font = v.size | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| break | ||
| end | ||
| end | ||
|
|
@@ -500,12 +511,15 @@ function BMHotbarClass:RenderTabContextMenu() | |
| if ImGui.MenuItem("Default", nil, checked) then | ||
| BMSettings:GetCharacterWindow(self.id).Theme = nil | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
| for n, _ in pairs(themes) do | ||
| checked = (BMSettings:GetCharacterWindow(self.id).Theme or "") == n | ||
| if ImGui.MenuItem(n, nil, checked) then | ||
| BMSettings:GetCharacterWindow(self.id).Theme = n | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
|
|
||
| break | ||
| end | ||
| end | ||
|
|
@@ -514,6 +528,8 @@ function BMHotbarClass:RenderTabContextMenu() | |
| if ImGui.MenuItem(n, nil, checked) then | ||
| BMSettings:GetCharacterWindow(self.id).Theme = n | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
|
|
||
| break | ||
| end | ||
| end | ||
|
|
@@ -548,7 +564,9 @@ function BMHotbarClass:RenderTabContextMenu() | |
| table.sort(charList, function(a, b) return a.key < b.key end) | ||
| for _, value in ipairs(charList) do | ||
| if ImGui.MenuItem(value.displayName) then | ||
| CopyLocalSet(value.key) | ||
| -- CopyLocalSet(value.key) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's not add comments back into the branch. Also is there a reason this was moved to the other coroutine? I am not against it but just curious why this was done. |
||
| BMCopy = true | ||
| BMCopyKey = value.key | ||
| end | ||
| end | ||
| ImGui.EndMenu() | ||
|
|
@@ -561,26 +579,31 @@ function BMHotbarClass:RenderTabContextMenu() | |
| BMSettings:GetCharacterWindow(self.id).HideTitleBar = not BMSettings:GetCharacterWindow(self.id) | ||
| .HideTitleBar | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why doesnt SaveSettings do updateCharacterDB? |
||
| end | ||
| if ImGui.MenuItem((BMSettings:GetCharacterWindow(self.id).CompactMode and "Normal" or "Compact") .. " Mode") then | ||
| BMSettings:GetCharacterWindow(self.id).CompactMode = not BMSettings:GetCharacterWindow(self.id) | ||
| .CompactMode | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
| if ImGui.MenuItem((BMSettings:GetCharacterWindow(self.id).AdvTooltips and "Disable" or "Enable") .. " Advanced Tooltips") then | ||
| BMSettings:GetCharacterWindow(self.id).AdvTooltips = not BMSettings:GetCharacterWindow(self.id) | ||
| .AdvTooltips | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
| if ImGui.MenuItem((BMSettings:GetCharacterWindow(self.id).HideScrollbar and "Show" or "Hide") .. " Scrollbar") then | ||
| BMSettings:GetCharacterWindow(self.id).HideScrollbar = not BMSettings:GetCharacterWindow(self.id) | ||
| .HideScrollbar | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
| if ImGui.MenuItem((BMSettings:GetCharacterWindow(self.id).ShowSearch and "Disable" or "Enable") .. " Search") then | ||
| BMSettings:GetCharacterWindow(self.id).ShowSearch = not BMSettings:GetCharacterWindow(self.id) | ||
| .ShowSearch | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
| local fps_scale = { | ||
| { | ||
|
|
@@ -607,6 +630,8 @@ function BMHotbarClass:RenderTabContextMenu() | |
| if ImGui.MenuItem(v.label, nil, checked) then | ||
| BMSettings:GetCharacterWindow(self.id).FPS = v.fps | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
|
|
||
| break | ||
| end | ||
| end | ||
|
|
@@ -751,6 +776,7 @@ function BMHotbarClass:RenderContextMenu(Set, Index, buttonID) | |
| if ImGui.MenuItem(BMButtonHandlers.ResolveButtonLabel(value, true)) then | ||
| BMSettings:GetSettings().Sets[Set][Index] = key | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:deleteButtonFromSetDB(Set, Index) | ||
| break | ||
| end | ||
| end | ||
|
|
@@ -771,6 +797,7 @@ function BMHotbarClass:RenderContextMenu(Set, Index, buttonID) | |
| if ImGui.MenuItem("Unassign") then | ||
| BMSettings:GetSettings().Sets[Set][Index] = nil | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:deleteButtonFromSetDB(Set, Index) | ||
| end | ||
| if ImGui.MenuItem(Icons.MD_SHARE) then | ||
| BMButtonHandlers.ExportButtonToClipBoard(button) | ||
|
|
@@ -842,6 +869,7 @@ function BMHotbarClass:RenderButtons(Set, searchText) | |
| BMSettings:GetSettings().Sets[Set][ButtonIndex], | ||
| BMSettings:GetSettings().Sets[Set][num] | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:convertConfigToDB('sets') | ||
| end | ||
| ImGui.EndDragDropTarget() | ||
| end | ||
|
|
@@ -955,6 +983,8 @@ function BMHotbarClass:RenderCreateTab() | |
| table.insert(BMSettings:GetCharConfig().Windows[self.id].Sets, self.newSetName) | ||
| BMSettings:GetSettings().Sets[self.newSetName] = {} | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| BMSettings:updateSetDB(self.newSetName, 1, '') | ||
| else | ||
| btnUtils.Output("\arError Saving Set: A set with this name already exists!\ax") | ||
| end | ||
|
|
@@ -990,6 +1020,7 @@ function BMHotbarClass:GiveTime() | |
| if not BMSettings:GetCharacterWindow(self.id).FPS then | ||
| BMSettings:GetCharacterWindow(self.id).FPS = 0 | ||
| BMSettings:SaveSettings(true) | ||
| BMSettings:updateCharacterDB(BMSettings.CharConfig, BMSettings:GetCharConfig()) | ||
| end | ||
|
|
||
| local fps = BMSettings:GetCharacterWindow(self.id).FPS / 10 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change existing behavior (nil iconType means something) so please make sure this doesn't break existing stuff.