|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
local ITEM_BUY_CURRENCY_OPTIONS ={ showTooltips = false, font = "ZoFontGameShadow", iconSide = RIGHT,}local DATA_TYPE_STORE_ITEM = 1local STORE_ITEMS = false---------------------Store Manager------------------- local INVENTORY_TYPE_LIST = { INVENTORY_BACKPACK, INVENTORY_VENGEANCE } if newState == SCENE_FRAGMENT_SHOWING then end elseif newState == SCENE_FRAGMENT_HIDING then end end end end) { title = { }, buttons = { [1] = { end, }, [2] = { } } }) return zo_min(zo_max(GetStoreEntryMaxBuyable(entryIndex), 1), MAX_STORE_WINDOW_STACK_QUANTITY) -- always attempt to let one item be bought, just to show the error; ensure that the quantity can't go above 999 end self.buyMultipleSpinner:RegisterCallback("OnValueChanged", function() self:RefreshBuyMultiple() end) ZO_ScrollList_AddDataType(self.list, DATA_TYPE_STORE_ITEM, "ZO_StoreEntrySlot", 52, function(currentControl, data) self:SetUpBuySlot(currentControl, data) end, nil, nil, ZO_InventorySlot_OnPoolReset) end -- We are using shared sort headers from the inventory, but store sorts its entries by value -- differently, so we need to swap out the sort key local typicalHiddenColumns = { ["statusSortOrder"] = true, ["traitInformationSortOrder"] = true, } local gearHiddenColumns = { ["statusSortOrder"] = true, ["traitInformationSortOrder"] = true, } local tabData = { -- Custom data hiddenColumns = hiddenColumns, activeTabText = filterString, -- Menu bar data } return tabData end { CreateNewTabFilterData(ITEMFILTERTYPE_MISCELLANEOUS, "EsoUI/Art/Inventory/inventory_tabIcon_misc_up.dds", "EsoUI/Art/Inventory/inventory_tabIcon_misc_down.dds", "EsoUI/Art/Inventory/inventory_tabIcon_misc_over.dds", typicalHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_FURNISHING, "EsoUI/Art/Crafting/provisioner_indexIcon_furnishings_up.dds", "EsoUI/Art/Crafting/provisioner_indexIcon_furnishings_down.dds", "EsoUI/Art/Crafting/provisioner_indexIcon_furnishings_over.dds", typicalHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_CRAFTING, "EsoUI/Art/Inventory/inventory_tabIcon_crafting_up.dds", "EsoUI/Art/Inventory/inventory_tabIcon_crafting_down.dds", "EsoUI/Art/Inventory/inventory_tabIcon_crafting_over.dds", typicalHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_CONSUMABLE, "EsoUI/Art/Inventory/inventory_tabIcon_consumables_up.dds", "EsoUI/Art/Inventory/inventory_tabIcon_consumables_down.dds", "EsoUI/Art/Inventory/inventory_tabIcon_consumables_over.dds", typicalHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_JEWELRY, "EsoUI/Art/Crafting/jewelry_tabIcon_icon_up.dds", "EsoUI/Art/Crafting/jewelry_tabIcon_down.dds", "EsoUI/Art/Crafting/jewelry_tabIcon_icon_over.dds", gearHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_ARMOR, "EsoUI/Art/Inventory/inventory_tabIcon_armor_up.dds", "EsoUI/Art/Inventory/inventory_tabIcon_armor_down.dds", "EsoUI/Art/Inventory/inventory_tabIcon_armor_over.dds", gearHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_WEAPONS, "EsoUI/Art/Inventory/inventory_tabIcon_weapons_up.dds", "EsoUI/Art/Inventory/inventory_tabIcon_weapons_down.dds", "EsoUI/Art/Inventory/inventory_tabIcon_weapons_over.dds", gearHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_COLLECTIBLE, "EsoUI/Art/MainMenu/menuBar_collections_up.dds", "EsoUI/Art/MainMenu/menuBar_collections_down.dds", "EsoUI/Art/MainMenu/menuBar_collections_over.dds", typicalHiddenColumns), CreateNewTabFilterData(ITEMFILTERTYPE_ALL, "EsoUI/Art/Inventory/inventory_tabIcon_all_up.dds", "EsoUI/Art/Inventory/inventory_tabIcon_all_down.dds", "EsoUI/Art/Inventory/inventory_tabIcon_all_over.dds", typicalHiddenColumns), } local menuBarData = { initialButtonAnchorPoint = RIGHT, buttonTemplate = "ZO_StoreTab", normalSize = 51, downSize = 64, buttonPadding = -15, animationDuration = 180, } end end -- Ensure that all dialogs related to the store also close when interaction ends end end end end end end end if cursorType == MOUSE_CONTENT_INVENTORY_ITEM then end end end if newState == SCENE_SHOWING then -- set search context before calling InitializeStore, since that can add the -- inventory fragment which will set a search context on showing (which is immediate) PLAYER_INVENTORY:SelectAndChangeSort({ INVENTORY_BACKPACK, INVENTORY_VENGEANCE }, ITEMFILTERTYPE_ALL, "sellInformationSortOrder", ZO_SORT_ORDER_UP) elseif newState == SCENE_HIDDEN then local REMOVE_CONTEXT = nil end PLAYER_INVENTORY:SelectAndChangeSort({ INVENTORY_BACKPACK, INVENTORY_VENGEANCE }, ITEMFILTERTYPE_ALL, "statusSortOrder", ZO_SORT_ORDER_DOWN) end end end) endend if defaultSortField == STORE_DEFAULT_SORT_FIELD_NAME then self.sortHeaderGroup:SelectHeaderByKey("name", ZO_SortHeaderGroup.SUPPRESS_CALLBACKS, ZO_SortHeaderGroup.FORCE_RESELECT, ZO_SORT_ORDER_UP) elseif defaultSortField == STORE_DEFAULT_SORT_FIELD_VALUE then self.sortHeaderGroup:SelectHeaderByKey("stackBuyPrice", ZO_SortHeaderGroup.SUPPRESS_CALLBACKS, ZO_SortHeaderGroup.FORCE_RESELECT, ZO_SORT_ORDER_UP) endend else end endend return { } end { { keybind = "UI_SHORTCUT_QUINARY", end, } } --Buy Button "EsoUI/Art/Vendor/vendor_tabIcon_buy_down.dds", "EsoUI/Art/Vendor/vendor_tabIcon_buy_over.dds") --Sell Button "EsoUI/Art/Vendor/vendor_tabIcon_sell_down.dds", "EsoUI/Art/Vendor/vendor_tabIcon_sell_over.dds") --Sell Vengeance Button self.sellVengeanceButtonData = CreateButtonData("EsoUI/Art/Vendor/vendor_tabIcon_sellVengeance_up.dds", "EsoUI/Art/Vendor/vendor_tabIcon_sellVengeance_down.dds", "EsoUI/Art/Vendor/vendor_tabIcon_sellVengeance_over.dds") --Buy Back Button "EsoUI/Art/Vendor/vendor_tabIcon_buyBack_down.dds", "EsoUI/Art/Vendor/vendor_tabIcon_buyBack_over.dds") --Repair Button "EsoUI/Art/Vendor/vendor_tabIcon_repair_down.dds", "EsoUI/Art/Vendor/vendor_tabIcon_repair_over.dds")end end self.modeBar:Add(SI_STORE_MODE_SELL, { INVENTORY_FRAGMENT, BACKPACK_STORE_LAYOUT_FRAGMENT }, self.sellButtonData, self.stackAllButton) self.modeBar:Add(SI_STORE_MODE_SELL_VENGEANCE, { VENGEANCE_INVENTORY_FRAGMENT, BACKPACK_STORE_LAYOUT_FRAGMENT }, self.sellVengeanceButtonData, self.stackAllButton) end endenddo local DONT_COUNT_STOLEN_ITEMS = true { -- Repair All { return zo_strformat(SI_REPAIR_ALL_KEYBIND_TEXT, ZO_Currency_FormatKeyboard(CURT_MONEY, cost, ZO_CURRENCY_FORMAT_WHITE_AMOUNT_ICON)) end return zo_strformat(SI_REPAIR_ALL_KEYBIND_TEXT, ZO_Currency_FormatKeyboard(CURT_MONEY, cost, ZO_CURRENCY_FORMAT_ERROR_AMOUNT_ICON)) end, keybind = "UI_SHORTCUT_SECONDARY", visible = function() return self.windowMode == ZO_STORE_WINDOW_MODE_NORMAL and CanStoreRepair() and GetRepairAllCost() > 0 end, end, }, -- Sell All Junk { keybind = "UI_SHORTCUT_NEGATIVE", return self.windowMode == ZO_STORE_WINDOW_MODE_NORMAL and HasAnyJunk(BAG_BACKPACK, DONT_COUNT_STOLEN_ITEMS) end, end, }, --End Preview { keybind = "UI_SHORTCUT_QUATERNARY", end, end, }, } endend if numUsedSlots < numSlots then self.freeSlotsLabel:SetText(zo_strformat(SI_INVENTORY_BACKPACK_REMAINING_SPACES, numUsedSlots, numSlots)) else self.freeSlotsLabel:SetText(zo_strformat(SI_INVENTORY_BACKPACK_COMPLETELY_FULL, numUsedSlots, numSlots)) end end endend -- Manage hiding columns that show/hide depending on the current filter. If the sort was on a column that becomes hidden -- then the sort needs to pick a new column. Currently this always falls back to the name key. -- User wanted to sort by a column that's gone! -- Fallback to name. end end --Hide inventory capacity for collectibles since they don't take up spaceend for i = 1, #itemData.filterData do return true end end return falseenddo local sortKeys = { stackBuyPrice = { tiebreaker = "stackBuyPriceCurrency1", isNumeric = true }, stackBuyPriceCurrency1 = { tiebreaker = "stackBuyPriceCurrency2", isNumeric = true }, stackBuyPriceCurrency2 = { tiebreaker = "name", isNumeric = true }, sellInformationSortOrder = { tiebreaker = "name", isNumeric = true }, } modifiedSortKeys.meetsRequirementsToBuy = { tiebreaker = self.sortHeaderGroup:GetCurrentSortKey(), tieBreakerSortOrder = self.sortHeaderGroup:GetSortDirection() } return ZO_TableOrderingFunction(entry1.data, entry2.data, "meetsRequirementsToBuy", modifiedSortKeys, ZO_SORT_ORDER_DOWN) end endendend endend local HIDE_GOLD_AMOUNT = 0 -- if showPlayerGold is false then we pass in 0 as the amount to hide the gold display local shownGoldAmount = showPlayerGold and GetCurrencyAmount(CURT_MONEY, GetCurrencyPlayerStoredLocation(CURT_MONEY)) or HIDE_GOLD_AMOUNT ZO_CurrencyControl_SetCurrencyData(self.currencyMoneyDisplay, CURT_MONEY, shownGoldAmount, showPlayerGold) -- We're laying out the player alternate currency labels this way to ensure that we never display more than two labels, even if -- more than two are applicable to this store, and to ensure that they maintain a consistent priority if currencyType ~= CURT_MONEY then local playerHeldCurrencyAmount = GetCurrencyAmount(currencyType, GetCurrencyPlayerStoredLocation(currencyType)) end endend --The last filter added is the farthest left, so to the player it should be "first" local lastFilter if (data.filterType == ITEMFILTERTYPE_ALL and self.showAllFilter) or self.usedFilterTypes[data.filterType] then end end if lastFilter then endend local numUsedStoreFilters = 0 numUsedStoreFilters = numUsedStoreFilters + 1 end end -- We only want to show the all filter if we aren't showing one specific filter -- because then all and the specific filter would have the same contentsend end endend -- Set info about what slot this is, on the top level slot control slotControl.index = slotIndex nameControl:SetColor(GetInterfaceColor(INTERFACE_COLOR_TYPE_ITEM_TOOLTIP, ITEM_TOOLTIP_COLOR_QUEST_ITEM_NAME)) elseif slotControl.isCollectible then else -- data.quality is deprecated, included here for addon backwards compatibility local qualityColor else end end else end local locked = false if not data.meetsRequirementsToBuy and ZO_StoreManager_DoesBuyStoreFailureLockEntry(data.buyStoreFailure) then locked = true end ZO_CurrencyControl_SetCurrencyData(priceControl, CURT_MONEY, data.stackBuyPrice, CURRENCY_DONT_SHOW_ALL, not self:HasEnoughCurrencyToBuyItem(CURT_MONEY, data.stackBuyPrice)) ZO_CurrencyControl_SetCurrencyData(priceControl, currencyType1, data.currencyQuantity1, CURRENCY_DONT_SHOW_ALL, not self:HasEnoughCurrencyToBuyItem(currencyType1, data.stackBuyPriceCurrency1), data.slotIndex, 1) ZO_CurrencyControl_SetCurrencyData(priceControl, currencyType2, data.currencyQuantity2, CURRENCY_DONT_SHOW_ALL, not self:HasEnoughCurrencyToBuyItem(currencyType2, data.stackBuyPriceCurrency2), data.slotIndex, 2)endendend if quantity ~= 0 then end endend local icon, _, stack, price, _, meetsRequirementsToBuy, meetsRequirementsToEquip, _, _, currencyType1, currencyQuantity1, -- Set info about what slot this is, on the top level slot control slotControl.index = entryIndex -- Fill in the rest of the controls. if stack ~= 1 then else end ZO_ItemSlot_SetupUsableAndLockedColor(slotControl, meetsRequirementsToBuy and meetsRequirementsToEquip) local total = quantity * price local type1Total = quantity * currencyQuantity1 local type2Total = quantity * currencyQuantity2 ZO_CurrencyControl_SetCurrencyData(currencyControl, CURT_MONEY, total, CURRENCY_DONT_SHOW_ALL, not self:HasEnoughCurrencyToBuyItem(CURT_MONEY, total)) ZO_CurrencyControl_SetCurrencyData(currencyControl, currencyType1, type1Total, CURRENCY_DONT_SHOW_ALL, not self:HasEnoughCurrencyToBuyItem(currencyType1, type1Total), entryIndex, 1) ZO_CurrencyControl_SetCurrencyData(currencyControl, currencyType2, type2Total, CURRENCY_DONT_SHOW_ALL, not self:HasEnoughCurrencyToBuyItem(currencyType2, type2Total), entryIndex, 2)endend ITEM_PREVIEW_KEYBOARD:ToggleInteractionCameraPreview(FRAME_TARGET_STORE_WINDOW_FRAGMENT, FRAME_PLAYER_ON_SCENE_HIDDEN_FRAGMENT, RIGHT_PANEL_BG_EMPTY_WORLD_ITEM_PREVIEW_OPTIONS_FRAGMENT)end endend--------------------- Global functions------------------- if slotType == SLOT_TYPE_STORE_BUY then local storeEntryIndex = inventorySlot.index return storeEntryIndex end end return nilendend local cursor = MOUSE_CURSOR_DO_NOT_CARE cursor = MOUSE_CURSOR_PREVIEW endendend -- left button for an inventory slot click will only try and drag and drop, but that -- should be handled for us by the OnReceiveDrag handler, so if we left click -- we'll do our custom behavior end else endendendend endend endendend |