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 |
-- layers for the various elements on the market product tiles
-- controls are layered to ensure correct display order
-- Background layer
ZO_MARKET_TILE_BACKGROUND_LEVEL = 1
ZO_MARKET_TILE_OVERLAY_LEVEL = 9
-- Text/Content layer
ZO_MARKET_TILE_BORDER_LEVEL = 10
ZO_MARKET_TILE_TEXT_LEVEL = 11
ZO_MARKET_TILE_ABOVE_TEXT_LEVEL = 12
-- Top layer
ZO_MARKET_TILE_HIGHLIGHT_LEVEL = 20
-- icons should be on top of the highlight
ZO_MARKET_TILE_ICON_FRAME_LEVEL = 21
ZO_MARKET_TILE_ICON_IMAGE_LEVEL = 22
ZO_MARKET_PRODUCT_PURCHASED_DESATURATION = 1
ZO_MARKET_PRODUCT_NOT_PURCHASED_DESATURATION = 0
ZO_FEATURED_PRESENTATION_INDEX = nil
ZO_INVALID_PRESENTATION_INDEX = - 1
--account for the fade that we add to the sides of the callout
ZO_MARKET_PRODUCT_CALLOUT_X_OFFSET = 5
do
end
end
end
end
do
local MARKET_PRODUCT_COLOR_MAP_UNFOCUSED =
{
[ MARKET_PRODUCT_PURCHASE_STATE_NOT_PURCHASED ] = ZO_MARKET_DIMMED_COLOR ,
[ MARKET_PRODUCT_PURCHASE_STATE_PURCHASED ] = ZO_MARKET_PRODUCT_PURCHASED_DIMMED_COLOR ,
[ MARKET_PRODUCT_PURCHASE_STATE_INSTANT_UNLOCK_COMPLETE ] = ZO_MARKET_PRODUCT_PURCHASED_DIMMED_COLOR ,
[ MARKET_PRODUCT_PURCHASE_STATE_INSTANT_UNLOCK_INELIGIBLE ] = ZO_MARKET_PRODUCT_INELIGIBLE_DIMMED_COLOR ,
}
local MARKET_PRODUCT_COLOR_MAP_FOCUSED =
{
[ MARKET_PRODUCT_PURCHASE_STATE_NOT_PURCHASED ] = ZO_MARKET_SELECTED_COLOR ,
[ MARKET_PRODUCT_PURCHASE_STATE_PURCHASED ] = ZO_MARKET_PRODUCT_PURCHASED_COLOR ,
[ MARKET_PRODUCT_PURCHASE_STATE_INSTANT_UNLOCK_COMPLETE ] = ZO_MARKET_PRODUCT_PURCHASED_COLOR ,
[ MARKET_PRODUCT_PURCHASE_STATE_INSTANT_UNLOCK_INELIGIBLE ] = ZO_MARKET_PRODUCT_INELIGIBLE_COLOR ,
}
local colorLookup = isFocused and MARKET_PRODUCT_COLOR_MAP_FOCUSED or MARKET_PRODUCT_COLOR_MAP_UNFOCUSED
end
end
--
--[[ MarketProductBase ]] --
--
return marketProduct
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
return false
end
end
end
end
end
end
end
end
if collectibleType == COLLECTIBLE_CATEGORY_TYPE_HOUSE then
return true
end
end
return false
end
end
end
local allCollectiblesOwned = false
if productType == MARKET_PRODUCT_TYPE_COLLECTIBLE then
local collectibleId , _ , name , type , description , owned , isPlaceholder = GetMarketProductCollectibleInfo ( self : GetId ( ) )
if not isPlaceholder then
allCollectiblesOwned = owned
end
elseif productType == MARKET_PRODUCT_TYPE_BUNDLE then
-- Show bundles that have all their collectibles unlocked as collected
allCollectiblesOwned = CouldAcquireMarketProduct ( self . marketProductId ) == MARKET_PURCHASE_RESULT_COLLECTIBLE_ALREADY
end
return allCollectiblesOwned
end
return isPurchased and ZO_MARKET_PRODUCT_PURCHASED_DESATURATION or ZO_MARKET_PRODUCT_NOT_PURCHASED_DESATURATION
end
return remainingTime > 0 and remainingTime <= ZO_ONE_MONTH_IN_SECONDS
end
end
do
local TEXT_CALLOUT_BACKGROUND_ALPHA = 0.9
end
end
do
local FOCUSED = true
local INHERIT_ICON_COLOR = true
local CURRENCY_ICON_SIZE = "100%"
local PRODUCT_LISTINGS_FOR_HOUSE_TEMPLATE_STRIDE = 2
function ZO_MarketProductBase : LayoutCostAndText ( description , currencyType , cost , hasDiscount , costAfterDiscount , discountPercent , isNew )
local hideCallouts = true
local isFree = cost == 0 or costAfterDiscount == 0
local showCallouts = canBePurchased or isPromo or ( isHouseCollectible and self . purchaseState == MARKET_PRODUCT_PURCHASE_STATE_NOT_PURCHASED )
-- setup the callouts for new, on sale, and LTO
if showCallouts then
-- house collectibles and promos don't show onSale
local onSale = discountPercent > 0 and not ( isHouseCollectible or isPromo )
local hasHouseOnSale = false
local houseMinDiscountPercent = nil
local houseMaxDiscountPercent = nil
if isHouseCollectible then
for index = 1 , numHouseTemplates do
local marketProductListings = { GetActiveMarketProductListingsForHouseTemplate ( houseTemplateId , MARKET_DISPLAY_GROUP_CROWN_STORE ) }
--There could be multiple listings per template, one for each currency type.
for i = 1 , # marketProductListings , PRODUCT_LISTINGS_FOR_HOUSE_TEMPLATE_STRIDE do
local houseTemplateMarketProductId = marketProductListings [ i ]
local presentationIndex = marketProductListings [ i + 1 ]
local currencyType , cost , hasDiscount , costAfterDiscount , discountPercent = GetMarketProductPricingByPresentation ( houseTemplateMarketProductId , presentationIndex )
if hasDiscount then
hasHouseOnSale = true
if not houseMinDiscountPercent or discountPercent < houseMinDiscountPercent then
houseMinDiscountPercent = discountPercent
end
if not houseMaxDiscountPercent or discountPercent > houseMaxDiscountPercent then
houseMaxDiscountPercent = discountPercent
end
else
houseMinDiscountPercent = 0
end
end
end
end
-- only show limited time callouts if there is actually a limited amount of time left and it's 1 month or less
hideCallouts = false
elseif onSale or hasHouseOnSale then
hideCallouts = false
if onSale then
elseif hasHouseOnSale then
-- for now, we'll just show a generic SALE tag, but in the future we may want to show the exact percents
end
elseif isNew then
hideCallouts = false
end
end
-- layout the price labels
if canBePurchased then
local hidePricingInfo = isFree or hasHouseOnSale
-- setup the cost
end
if not hidePricingInfo then
local currencyIcon = ZO_Currency_GetPlatformFormattedCurrencyIcon ( ZO_Currency_MarketCurrencyToUICurrency ( currencyType ) , CURRENCY_ICON_SIZE , INHERIT_ICON_COLOR )
local currencyString = string . format ( "%s %s" , ZO_CommaDelimitNumber ( costAfterDiscount ) , currencyIcon )
else
ZO_MarketClasses_Shared_ApplyTextColorToLabelByState ( self . purchaseLabelControl , FOCUSED , self . purchaseState )
end
else
if isPromo then
elseif self . purchaseState == MARKET_PRODUCT_PURCHASE_STATE_NOT_PURCHASED and isHouseCollectible then
else
end
ZO_MarketClasses_Shared_ApplyTextColorToLabelByState ( self . purchaseLabelControl , FOCUSED , self . purchaseState )
end
-- Call IsControlHidden instead of IsHidden because our parent control is likely hidden currently
-- and we need to set the anchors based on whether the purchase label will be showing when we show the parent
if showingPurchaseLabel then
self . textCallout : SetAnchor ( BOTTOMLEFT , self . purchaseLabelControl , TOPLEFT , ZO_MARKET_PRODUCT_CALLOUT_X_OFFSET , self . textCalloutYOffset )
self . textCallout : SetAnchor ( BOTTOMLEFT , self . previousCost , TOPLEFT , ZO_MARKET_PRODUCT_CALLOUT_X_OFFSET - 2 , self . textCalloutYOffset ) -- x offset to account for strikethrough
else
self . textCallout : SetAnchor ( BOTTOMLEFT , self . cost , TOPLEFT , ZO_MARKET_PRODUCT_CALLOUT_X_OFFSET , self . textCalloutYOffset )
end
if isBundle then
-- hide the label if the result is 0 or 1 (which means either an empty bundle or what should be a single product...)
if numBundledProducts > 1 then
else
end
else
end
end
end
-- if there is no time left remaining then the MarketProduct is not limited time
-- because when a limited time product reaches 0 it is removed form the store
if remainingTime > 0 then
if remainingTime >= ZO_ONE_DAY_IN_SECONDS then
self . textCallout : SetText ( zo_strformat ( SI_TIME_DURATION_LEFT , ZO_FormatTime ( remainingTime , TIME_FORMAT_STYLE_SHOW_LARGEST_UNIT_DESCRIPTIVE , TIME_FORMAT_PRECISION_SECONDS ) ) )
else
self . textCallout : SetText ( zo_strformat ( SI_TIME_DURATION_LEFT , ZO_FormatTimeLargestTwo ( remainingTime , TIME_FORMAT_STYLE_DESCRIPTIVE_MINIMAL ) ) )
end
end
end
end
end
if marketProductId ~= nil then
end
local currencyType , cost , hasDiscount , costAfterDiscount , discountPercent = self : GetMarketProductPricingByPresentation ( )
self : LayoutCostAndText ( description , currencyType , cost , hasDiscount , costAfterDiscount , discountPercent , isNew )
end
end
end
end
if productId > 0 then
end
end
self . highlightAnimation = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "MarketProductHighlightAnimation" , self . highlight )
end
if hidden then
else
end
end
end
end
end
end
-- MarketProduct Preview functions
--Houses are special because as far as C is concerned they aren't previewable, but Lua allows for a roundabout preview with jumping to the house
return CanPreviewMarketProduct ( self . marketProductId ) or ZO_Market_Shared . GetMarketProductPreviewType ( self ) == ZO_MARKET_PREVIEW_TYPE_HOUSE
end
end
end
-- virtual functions
-- to be overridden
end
-- to be overridden
end
-- to be overridden, default behavior
return false
end
-- to be overridden
end
end
--
--[[ MarketBlankProductBase ]] --
--
-- Used to fill the market grid with blank entries, which could be potentially selectable
end
return true
end
return false
end
return nil -- Blank tiles have no background
end
end |