|
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 |
local STORE_WEAPON_GROUP = 1local STORE_HEAVY_ARMOR_GROUP = 2local STORE_MEDIUM_ARMOR_GROUP = 3local STORE_LIGHT_ARMOR_GROUP = 4local STORE_JEWELRY_GROUP = 5local STORE_SUPPLIES_GROUP = 6local STORE_MATERIALS_GROUP = 7local STORE_QUICKSLOTS_GROUP = 8local STORE_COLLECTIBLE_GROUP = 9local STORE_QUEST_ITEMS_GROUP = 10local STORE_ANTIQUITY_LEADS_GROUP = 11local STORE_OTHER_GROUP = 12---------------------Utility functions------------------- if itemData.entryType == STORE_ENTRY_TYPE_COLLECTIBLE then return STORE_COLLECTIBLE_GROUP elseif itemData.entryType == STORE_ENTRY_TYPE_QUEST_ITEM then return STORE_QUEST_ITEMS_GROUP elseif itemData.entryType == STORE_ENTRY_TYPE_ANTIQUITY_LEAD then return STORE_ANTIQUITY_LEADS_GROUP elseif itemData.equipType == EQUIP_TYPE_RING or itemData.equipType== EQUIP_TYPE_NECK then return STORE_JEWELRY_GROUP elseif itemData.itemType == ITEMTYPE_WEAPON or itemData.displayFilter == ITEMFILTERTYPE_WEAPONS then return STORE_WEAPON_GROUP elseif itemData.itemType == ITEMTYPE_ARMOR or itemData.displayFilter == ITEMFILTERTYPE_ARMOR then local armorType if itemData.bagId and itemData.slotIndex then else end if armorType == ARMORTYPE_HEAVY then return STORE_HEAVY_ARMOR_GROUP elseif armorType == ARMORTYPE_MEDIUM then return STORE_MEDIUM_ARMOR_GROUP elseif armorType == ARMORTYPE_LIGHT then return STORE_LIGHT_ARMOR_GROUP end return STORE_SUPPLIES_GROUP return STORE_MATERIALS_GROUP return STORE_QUICKSLOTS_GROUP end return STORE_OTHER_GROUPend if itemData.storeGroup == STORE_COLLECTIBLE_GROUP then elseif itemData.storeGroup == STORE_QUEST_ITEMS_GROUP then elseif itemData.storeGroup == STORE_ANTIQUITY_LEADS_GROUP then else endend if traitType == ITEM_TRAIT_TYPE_WEAPON_ORNATE or traitType == ITEM_TRAIT_TYPE_ARMOR_ORNATE or traitType == ITEM_TRAIT_TYPE_JEWELRY_ORNATE then else endendlocal DEFAULT_SORT_KEYS ={ bestGamepadItemCategoryName = { tiebreaker = "name" }, requiredLevel = { tiebreaker = "requiredChampionPoints", isNumeric = true }, requiredChampionPoints = { tiebreaker = "iconFile", isNumeric = true }, iconFile = { tiebreaker = "uniqueId" }, uniqueId = { isId64 = true }, customSortOrder = { tiebreaker = "bestGamepadItemCategoryName", isNumeric = true },} return ZO_TableOrderingFunction(data1, data2, "bestGamepadItemCategoryName", DEFAULT_SORT_KEYS, ZO_SORT_ORDER_UP)end return ZO_TableOrderingFunction(data1, data2, "customSortOrder", DEFAULT_SORT_KEYS, ZO_SORT_ORDER_UP)endlocal BUY_ITEMS_SORT_KEYS ={ meetsRequirementsToBuy = { tiebreaker = "bestGamepadItemCategoryName", tieBreakerSortOrder = ZO_SORT_ORDER_UP, isNumeric = true }, bestGamepadItemCategoryName = { tiebreaker = "name" }, meetsRequirementsToEquip = { tiebreaker = "icon", isNumeric = true }, slotIndex = { isId64 = true },}local BUY_ITEMS_SORT_KEYS_VALUE ={ meetsRequirementsToBuy = { tiebreaker = "bestGamepadItemCategoryName", tieBreakerSortOrder = ZO_SORT_ORDER_UP, isNumeric = true }, bestGamepadItemCategoryName = { tiebreaker = "stackBuyPrice" }, stackBuyPrice = { tiebreaker = "stackBuyPriceCurrency1" , isNumeric = true}, stackBuyPriceCurrency1 = { tiebreaker = "stackBuyPriceCurrency2", isNumeric = true }, stackBuyPriceCurrency2 = { tiebreaker = "name", isNumeric = true }, meetsRequirementsToEquip = { tiebreaker = "icon", isNumeric = true }, slotIndex = { isId64 = true },} local keys = BUY_ITEMS_SORT_KEYS if defaultSortField == STORE_DEFAULT_SORT_FIELD_VALUE then keys = BUY_ITEMS_SORT_KEYS_VALUE endendlocal BUYBACK_ITEMS_SORT_KEYS ={ bestGamepadItemCategoryName = { tiebreaker = "name" }, meetsRequirementsToBuy = { tiebreaker = "meetsRequirementsToEquip", isNumeric = true }, meetsRequirementsToEquip = { tiebreaker = "icon", isNumeric = true }, slotIndex = { isId64 = true },} return ZO_TableOrderingFunction(data1, data2, "bestGamepadItemCategoryName", BUYBACK_ITEMS_SORT_KEYS, ZO_SORT_ORDER_UP)endlocal REPAIR_ITEMS_SORT_KEYS ={ repairCost = { tiebreaker = "condition", isNumeric = true }, condition = { tiebreaker = "displayQuality", isNumeric = true }, displayQuality = { tiebreaker = "quality" }, -- quality is deprecated, included here for addon backwards compatibility quality = { tiebreaker = "stackCount" }, stackCount = { tiebreaker = "slotIndex" }, slotIndex = { isId64 = true },}end --- Gamepad versions have extra data / differently named values in templates itemData.stackCount = itemData.stack itemData.sellPrice = itemData.price if itemData.sellPrice == 0 then itemData.sellPrice = itemData.stackBuyPriceCurrency1 end itemData.selectedNameColor = ZO_SELECTED_TEXT itemData.unselectedNameColor = ZO_DISABLED_TEXT if not itemData.meetsRequirementsToBuy and ZO_StoreManager_DoesBuyStoreFailureLockEntry(itemData.buyStoreFailure) then itemData.locked = true end end return itemsend local unequippedItems = {} --- Setup sort filter if itemData.bagId ~= BAG_WORN and not itemData.stolen and not itemData.isPlayerLocked and searchContext and TEXT_SEARCH_MANAGER:IsDataInSearchTextResults(searchContext, BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT, itemData.bagId, itemData.slotIndex) then itemData.isEquipped = false itemData.meetsRequirementsToBuy = true itemData.meetsRequirementsToEquip = itemData.meetsUsageRequirements itemData.customSortOrder = itemData.sellInformationSortOrder end end return unequippedItemsend local unequippedItems = {} --- Setup sort filter if not itemData.stolen and not itemData.isPlayerLocked and searchContext and TEXT_SEARCH_MANAGER:IsDataInSearchTextResults(searchContext, BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT, itemData.bagId, itemData.slotIndex) then itemData.isEquipped = false itemData.meetsRequirementsToBuy = true itemData.meetsRequirementsToEquip = itemData.meetsUsageRequirements itemData.customSortOrder = itemData.sellInformationSortOrder end end return unequippedItemsend local items = {} if searchContext and TEXT_SEARCH_MANAGER:IsDataInSearchTextResults(searchContext, BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT, BAG_BUYBACK, entryIndex) then local icon, name, stackCount, price, functionalQuality, meetsRequirementsToEquip, displayQuality = GetBuybackItemInfo(entryIndex) if stackCount > 0 then local totalPrice = price * stackCount local buybackData = { slotIndex = entryIndex, stackCount = stackCount, price = price, sellPrice = totalPrice, functionalQuality = functionalQuality, displayQuality = displayQuality, -- self.quality is deprecated, included here for addon backwards compatibility quality = displayQuality, meetsRequirementsToBuy = true, meetsRequirementsToEquip = meetsRequirementsToEquip, stackBuyPrice = totalPrice, itemLink = itemLink, itemType = itemType, equipType = equipType, traitInformation = traitInformation, sellInformation = sellInformation, } end end end return itemsend if searchContext and TEXT_SEARCH_MANAGER:IsDataInSearchTextResults(searchContext, BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT, bagId, slotIndex) then if stackCount > 0 then if repairCost > 0 then damagedItem.condition = condition damagedItem.repairCost = repairCost damagedItem.isEquippedInCurrentCategory = damagedItem.bagId == BAG_WORN end end end end endend local items = {} return itemsend-- optFilterFunction is an optional additional check to make when gathering all the stolen items-- ... are bag ids to get items from local isStolen = itemData.stolen else return isStolen end end local unequippedItems = {} --- Setup sort filter itemData.isEquipped = false itemData.meetsRequirementsToBuy = true itemData.meetsRequirementsToEquip = itemData.meetsUsageRequirements end return unequippedItemsend return itemData.sellPrice > 0end return IsStolenItemSellable(itemData) and searchContext and TEXT_SEARCH_MANAGER:IsDataInSearchTextResults(searchContext, BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT, itemData.bagId, itemData.slotIndex) end -- can't sell stolen things from BAG_WORN so just check BACKPACKend return searchContext and TEXT_SEARCH_MANAGER:IsDataInSearchTextResults(searchContext, BACKGROUND_LIST_FILTER_TARGET_BAG_SLOT, itemData.bagId, itemData.slotIndex) endendlocal TRAIN_ORDER = { RIDING_TRAIN_SPEED, RIDING_TRAIN_STAMINA, RIDING_TRAIN_CARRYING_CAPACITY } local items = {} for i = 1, #TRAIN_ORDER do local trainingType = TRAIN_ORDER[i] local extraData = { trainingType = trainingType, bonus = bonus, maxBonus = maxBonus, isSkillTrainable = canBeTrained and (bonus < maxBonus), } local itemData = { iconFile = STABLE_TRAINING_TEXTURES_GAMEPAD[trainingType], ignoreStoreVisualInit = true, } end return itemsend--When using the ItemSortFunc, you'll want to ensure that your updateFunc provides an itemData.bestGamepadItemCategoryName--Typically bestGamepadItemCategoryName is acquired like so:--e.g.: itemData.storeGroup = GetItemStoreGroup(itemData, IS_STORE_ITEM)-- itemData.bestGamepadItemCategoryName = GetBestItemCategoryDescription(itemData)local MODE_TO_UPDATE_FUNC = { }-- These functions are appropriated by ZO_GamepadStoreListComponent without inheriting.function ZO_GamepadStoreList:Initialize(control, mode, setupFunction, overrideTemplate, overrideHeaderTemplateSetupFunction)end-- These functions are appropriated by ZO_GamepadStoreListComponent without inheriting.endlocal function VendorEntryHeaderTemplateSetup(control, data, selected, selectedDuringRebuild, enabled, activated)endfunction ZO_GamepadStoreList:SetMode(mode, setupFunction, overrideTemplate, overrideHeaderTemplateSetupFunction, templatePrefix, headerPrefix) local headerTemplateSetupFunction = overrideHeaderTemplateSetupFunction or VendorEntryHeaderTemplateSetup local DEFAULT_EQUALITY_FUNCTION = nil self:AddDataTemplate(self.template, setupFunction, ZO_GamepadMenuEntryTemplateParametricListFunction, DEFAULT_EQUALITY_FUNCTION, templatePrefix) self:AddDataTemplateWithHeader(self.template, setupFunction, ZO_GamepadMenuEntryTemplateParametricListFunction, DEFAULT_EQUALITY_FUNCTION, "ZO_GamepadMenuEntryHeaderTemplate", headerTemplateSetupFunction, headerPrefix)end-- These functions are appropriated by ZO_GamepadStoreListComponent without inheriting. local currentBestCategoryName = nil --This is only used by stables if stableTrainingData then entry.trainingData = stableTrainingData --Force the narration text here so we don't try to narrate the progress bar local MIN_BONUS = 0 else local narrations = {} ZO_AppendNarration(narrations, ZO_GetSharedGamepadEntryDefaultNarrationText(entryData, entryControl)) ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_ITEM_CONDITION_PERCENT, entryData.condition))) end end return narrations end end if not itemData.ignoreStoreVisualInit then end if itemData.locked then end if itemData.bestGamepadItemCategoryName and itemData.bestGamepadItemCategoryName ~= currentBestCategoryName then currentBestCategoryName = itemData.bestGamepadItemCategoryName else end endend-- These functions are appropriated by ZO_GamepadStoreListComponent without inheriting. endend |