Parse "Limited Dyeworks" items from Owls
Yay thank you Owls team! I might also try to parse the dates too, the format seems to be "Owls: Limited Dyeworks - Dyeable Thru July 15"
This commit is contained in:
parent
4d24a9577f
commit
26dfe13b0e
2 changed files with 20 additions and 3 deletions
|
@ -217,12 +217,23 @@ class Item < ApplicationRecord
|
|||
nc_trade_value.value_text.include?("Permanent Dyeworks")
|
||||
end
|
||||
|
||||
# Whether this is a Dyeworks item that can be dyed in the NC Mall ~right now,
|
||||
# but only as part of a limited-time event. (Owls tracks this, not us!)
|
||||
def dyeworks_limited?
|
||||
return false if nc_trade_value.nil?
|
||||
nc_trade_value.value_text.include?("Limited Dyeworks")
|
||||
end
|
||||
|
||||
# Whether this is a Dyeworks item that can be dyed in the NC Mall ~right now,
|
||||
# either at any time or as a limited-time event. (Owls tracks this, not us!)
|
||||
def dyeworks_dyeable?
|
||||
dyeworks_permanent? || dyeworks_limited?
|
||||
end
|
||||
|
||||
# Whether this is a Dyeworks item whose base item can currently be purchased
|
||||
# in the NC Mall, then dyed via Dyeworks. (Owls tracks this last part!)
|
||||
def dyeworks_buyable?
|
||||
# TODO: Add support for limited-time Dyeworks items. Does Owls offer this
|
||||
# info too? (At time of writing, there are no active Dyeworks events.)
|
||||
dyeworks_base_buyable? && dyeworks_permanent?
|
||||
dyeworks_base_buyable? && dyeworks_dyeable?
|
||||
end
|
||||
|
||||
DYEWORKS_NAME_PATTERN = %r{
|
||||
|
|
|
@ -80,6 +80,12 @@
|
|||
"Dyeworks items are."
|
||||
}
|
||||
(Permanent)
|
||||
- elsif item.dyeworks_limited?
|
||||
%span.dyeworks-timeframe{
|
||||
title: "This recipe is part of a limited-time Dyeworks " +
|
||||
"event, and is scheduled to be removed from the NC Mall soon."
|
||||
}
|
||||
(Limited-time)
|
||||
|
||||
%button{onclick: "alert('Todo!')"}
|
||||
= cart_icon alt: ""
|
||||
|
|
Loading…
Reference in a new issue