diff --git a/FurnitureCatalogue.txt b/FurnitureCatalogue.txt index 023dd55..68b9540 100644 --- a/FurnitureCatalogue.txt +++ b/FurnitureCatalogue.txt @@ -1,6 +1,6 @@ ## Title: FurnitureCatalogue ## Author: manavortex -## Version: 2.4.8 +## Version: 2.4.81 ## APIVersion: 100023 ## SavedVariables: FurnitureCatalogue_Settings ## OptionalDependsOn: pChat diff --git a/FurnitureCatalogue_DevUtility/00_startup.lua b/FurnitureCatalogue_DevUtility/00_startup.lua new file mode 100644 index 0000000..092da3c --- /dev/null +++ b/FurnitureCatalogue_DevUtility/00_startup.lua @@ -0,0 +1,64 @@ +local UNITTAG_PLAYER = "player" +local function whoami() + return GetUnitDisplayName(UNITTAG_PLAYER) +end + +local isMana = whoami() == "@manavortex" or whoami() == "@Manorin" +if not isMana then return end + +local control = FurCDevControl +FurCDevUtility = {} +local this = FurCDevUtility +this.name = "FurCDevUtility" +this.control = control +this.textbox = FurCDevControlBox + +local active = string.find(GetWorldName(), "PTS") + +local function set_active(status) + if nil == status then status = not this.active end + this.active = status +end +FurCDevUtility.set_active = set_active + +local function setHidden(status) + if nil == status then status = not control:IsHidden() end + control:SetHidden(status) +end +FurCDevUtility.setHidden = setHidden + +local function clearControl() + control:GetNamedChild("_textbox"):Clear() +end +FurCDevUtility.clearControl = clearControl + + +local activeStr = "active" +local showStr = "show" +local hideStr = "hide" +function slash_cmd(arg1) + + if arg1 == activeStr then + set_active(true) + elseif arg1 == showStr then + setHidden(false) + elseif arg1 == hideStr then + setHidden(true) + else + d("set active") + end +end +SLASH_COMMANDS["/furcdev"] = slash_cmd + +function FurCDevUtility_Initialize(eventCode, addonName) + + if addonName ~= this.name then return end + + this.textbox = FurCDevControlBox + FurCDevControl.InitRightclickMenu() + + EVENT_MANAGER:UnregisterForEvent("FurCDevUtility", EVENT_ADD_ON_LOADED) +end + +EVENT_MANAGER:RegisterForEvent("FurCDevUtility", EVENT_ADD_ON_LOADED, FurCDevUtility_Initialize) + diff --git a/FurnitureCatalogue_DevUtility/ContextMenu.lua b/FurnitureCatalogue_DevUtility/ContextMenu.lua new file mode 100644 index 0000000..05838f8 --- /dev/null +++ b/FurnitureCatalogue_DevUtility/ContextMenu.lua @@ -0,0 +1,156 @@ +FurCDevControl_LinkHandlerBackup_OnLinkMouseUp = nil +local this = FurCDevUtility +local S_ADD_TO_BOX = "Add to textbox" +local S_SET_TO_BOX = "Set textbox to" +this.textbox = this.textbox or FurCDevControlBox +local textbox = this.textbox + +function this.clearTextbox() + this.textbox:Clear() +end + +function this.selectEntireTextbox() + if this.control:IsHidden() then return end + local text = textbox:GetText() or "" + textbox:SetSelection(0, #text) +end + +local defaultDebugString = "[<<1>>] = <<2>>, -- <<3>>" +local debugStringWithPrice = "[<<1>>] = { -- <<3>>\n\titemPrice = <<2>>,\n\t--achievement = 0, \n}," +local function makeOutput(itemLink, control) + if not this.active or not FurC.Find(itemLink) then return end + local itemId = FurC.GetItemId(itemLink) + local price = 0 + control = control or moc() + local debugString = defaultDebugString + if control and control.dataEntry then + local data = control.dataEntry.data or {} + if 0 == data.currencyQuantity1 then + price = data.stackBuyPrice + debugString = debugStringWithPrice + else + price = data.currencyQuantity1 + end + end + return zo_strformat(debugString, itemId, price, GetItemLinkName(itemLink)) +end + +local linebreak = "\n" +local function concatToTextbox(itemLink, control) + local textSoFar = this.textbox:GetText() + local entry = linebreak .. makeOutput(itemLink, control) + this.textbox:SetText(textSoFar .. entry) +end + +local function setTextboxTo(itemLink, control) + this.textbox:Clear() + this.textbox.setText(makeOutput(itemLink, control)) +end + + +local function addMenuItems(itemLink, control) + + recipeArray = recipeArray or FurC.Find(itemLink) + if (nil == recipeArray) then return end + -- ClearMenu() + + AddCustomMenuItem(S_SET_TO_BOX, + function() concatToTextbox(itemLink, control) end, + MENU_ADD_OPTION_LABEL + ) + + AddCustomMenuItem(S_SET_TO_BOX, + function() setTextboxTo(itemLink, control) end, + MENU_ADD_OPTION_LABEL + ) + + +end + +function FurCDevControl_HandleClickEvent(itemLink, button, control) -- button being mouseButton here + if (type(itemLink) == 'string' and #itemLink > 0) then + local handled = LINK_HANDLER:FireCallbacks(LINK_HANDLER.LINK_MOUSE_UP_EVENT, itemLink, button, ZO_LinkHandler_ParseLink(itemLink)) + if (not handled) then + FurCDevControl_LinkHandlerBackup_OnLinkMouseUp(itemLink, button, control) + if (button == 2 and itemLink and #itemLink > 0) then + addMenuItems(itemLink, control) + end + ShowMenu(control) + end + end +end + + +function FurCDevControl_HandleMouseEnter(inventorySlot) + local inventorySlot = moc() + + if nil == inventorySlot or nil == inventorySlot.dataEntry then return end + local data = inventorySlot.dataEntry.data + if nil == data then return end + + local bagId, slotIndex = data.bagId, data.slotIndex + FurC.CurrentLink = GetItemLink(bagId, slotIndex) + if nil == FurC.CurrentLink then return end + +end + + +-- thanks Randactyl for helping me with the handler :) +function FurCDevControl_HandleInventoryContextMenu(control) + + local st = ZO_InventorySlot_GetType(control) + local itemLink = nil + if st == SLOT_TYPE_ITEM + or st == SLOT_TYPE_BANK_ITEM + or st == SLOT_TYPE_GUILD_BANK_ITEM + or st == SLOT_TYPE_TRADING_HOUSE_POST_ITEM then + local bagId, slotId = ZO_Inventory_GetBagAndIndex(control) + itemLink = GetItemLink(bagId, slotId, linkStyle) + end + if st == SLOT_TYPE_TRADING_HOUSE_ITEM_RESULT then + itemLink = GetTradingHouseSearchResultItemLink(ZO_Inventory_GetSlotIndex(control), linkStyle) + end + if st == SLOT_TYPE_TRADING_HOUSE_ITEM_LISTING then + itemLink = GetTradingHouseListingItemLink(ZO_Inventory_GetSlotIndex(control), linkStyle) + end + + local recipeArray = FurC.Find(itemLink) + -- d(recipeArray) + if nil == recipeArray then return end + + zo_callLater(function() + addMenuItems(itemLink, recipeArray) + ShowMenu() + end, 50) + + +end + + +function FurC.OnControlMouseUp(control, button) + + if nil == control then return end + + if button ~= 2 then return end + local itemLink = control.itemLink + + if nil == itemLink then return end + local recipeArray = FurC.Find(itemLink) + if nil == recipeArray then return end + zo_callLater(function() + ItemTooltip:SetHidden(true) + ClearMenu() + addMenuItems(itemLink, recipeArray) + ShowMenu() + end, 50) + +end + +function FurC.InitRightclickMenu() + FurCDevControl_LinkHandlerBackup_OnLinkMouseUp = ZO_LinkHandler_OnLinkMouseUp + ZO_LinkHandler_OnLinkMouseUp = function(itemLink, button, control) FurCDevControl_HandleClickEvent(itemLink, button, control) end + ZO_PreHook('ZO_InventorySlot_OnMouseEnter', FurCDevControl_HandleMouseEnter) + ZO_PreHook('ZO_InventorySlot_ShowContextMenu', function(rowControl) + FurCDevControl_HandleInventoryContextMenu(rowControl) + end) +end diff --git a/FurnitureCatalogue_DevUtility/FurnitureCatalogue_DevUtility.txt b/FurnitureCatalogue_DevUtility/FurnitureCatalogue_DevUtility.txt new file mode 100644 index 0000000..d817da8 --- /dev/null +++ b/FurnitureCatalogue_DevUtility/FurnitureCatalogue_DevUtility.txt @@ -0,0 +1,10 @@ +## Title: FurnitureCatalogue_DevUtility +## Author: manavortex +## Description: This is a utility addon that helps me generate text entries for the data files. It won't even activate if you're not me, so feel free to unload it. +## Version: 1.0.0 +## APIVersion: 100023 +## DependsOn: FurnitureCatalogue + +xml.xml +00_startup.lua +ContextMenu.lua \ No newline at end of file diff --git a/FurnitureCatalogue_DevUtility/xml.xml b/FurnitureCatalogue_DevUtility/xml.xml new file mode 100644 index 0000000..6186ea3 --- /dev/null +++ b/FurnitureCatalogue_DevUtility/xml.xml @@ -0,0 +1,40 @@ +<GuiXml> + <Controls> + <TopLevelControl name="FurCDevControl" clampedToScreen="true" movable="true" mouseEnabled="true" hidden="true" resizeHandleSize="10"> + <Dimensions x="600" y="500"/> + <Anchor point="CENTER" relativeTo="GUI_ROOT" relativePoint="CENTER" offsetX="-125" offsetY="-140" /> + <Controls> + <Backdrop name="$(parent)_BG" inherits="ZO_DefaultBackdrop"><AnchorFill/></Backdrop> + <Button name="$(parent)_hide" inherits="ZO_ButtonBehaviorClickSound" > + <OnClicked>FurCDevUtility.setHidden(true)</OnClicked> + <Dimensions x="40" y="40" /> + <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="10" offsetY="10" /> + <Textures + normal ="/esoui/art/buttons/decline_up.dds" + pressed ="/esoui/art/buttons/decline_down.dds" + mouseOver ="/esoui/art/buttons/decline_over.dds" + /> + </Button> + + <Button name="$(parent)_clear" inherits="ZO_ButtonBehaviorClickSound" > + <OnClicked>FurCDevUtility.clearControl()</OnClicked> + <Dimensions x="40" y="40" /> + <Anchor point="TOPRIGHT" relativeTo="$(parent)" relativePoint="TOPRIGHT" offsetX="-10" offsetY="-10" /> + <Textures + normal ="/esoui/art/help/help_tabicon_feedback_up.dds" + pressed ="/esoui/art/help/help_tabicon_feedback_down.dds " + mouseOver ="/esoui/art/help/help_tabicon_feedback_over.dds" + /> + </Button> + + <EditBox name="$(parent)Box" inherits="ZO_DefaultEditForBackdrop ZO_EditDefaultText" > + <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="50" offsetY="50"/> + <Anchor point="BOTTOMRIGHT" relativeTo="$(parent)" relativePoint="BOTTOMRIGHT" offsetX="50"/> + + <OnFocusGained>FurCDevUtility.selectEntireTextbox()</OnFocusGained> + </EditBox> + + </Controls> + </TopLevelControl> + </Controls> +</GuiXml> \ No newline at end of file diff --git a/FurnitureCatalogue_Export/FurnitureCatalogue_Export.txt b/FurnitureCatalogue_Export/FurnitureCatalogue_Export.txt index 68d8b0a..6a08b2b 100644 --- a/FurnitureCatalogue_Export/FurnitureCatalogue_Export.txt +++ b/FurnitureCatalogue_Export/FurnitureCatalogue_Export.txt @@ -1,7 +1,7 @@ ## Title: FurnitureCatalogue_Export ## Author: manavortex ## Version: 1.0.1 -## APIVersion: 100022 +## APIVersion: 100023 ## SavedVariables: FurnitureCatalogue_Export ## DependsOn: FurnitureCatalogue diff --git a/data/LuxuryFurnisher.lua b/data/LuxuryFurnisher.lua index d9b92e4..16e73be 100644 --- a/data/LuxuryFurnisher.lua +++ b/data/LuxuryFurnisher.lua @@ -2,20 +2,17 @@ FurC.LuxuryFurnisher = FurC.LuxuryFurnisher or {} FurC.LuxuryFurnisher[FURC_ALTMER] = { [134845] = { -- Brotherhood Tapestry, Small - itemPrice = , + itemPrice = 5000, itemDate = "2018-06-02", }, - [120837] = { -- Brotherhood Window, Stained Glass itemPrice = 100000, itemDate = "2018-06-02", }, - [121271] = { -- Brotherhood Tapestry itemPrice = 10000, itemDate = "2018-06-02", }, - [120835] = { -- Brotherhood Candelabra, Table itemPrice = 2500, itemDate = "2018-06-02", diff --git a/startup.lua b/startup.lua index 4f889ea..33291c2 100644 --- a/startup.lua +++ b/startup.lua @@ -1,7 +1,7 @@ FurnitureCatalogue = {} FurnitureCatalogue.name = "FurnitureCatalogue" FurnitureCatalogue.author = "manavortex" -FurnitureCatalogue.version = "2.4.8" +FurnitureCatalogue.version = "2.4.81" FurnitureCatalogue.CharacterName = nil FurnitureCatalogue.settings = {}