mirror of
https://github.com/arcan1s/ffxivbis.git
synced 2025-12-10 15:33:40 +00:00
bump dependencies
This commit is contained in:
@ -16,12 +16,12 @@ import java.time.Instant
|
||||
|
||||
trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol {
|
||||
|
||||
private def enumFormat[E <: Enumeration](enum: E): RootJsonFormat[E#Value] =
|
||||
private def enumFormat[E <: Enumeration](enumeration: E): RootJsonFormat[E#Value] =
|
||||
new RootJsonFormat[E#Value] {
|
||||
override def write(obj: E#Value): JsValue = obj.toString.toJson
|
||||
override def read(json: JsValue): E#Value = json match {
|
||||
case JsNumber(value) => enum(value.toInt)
|
||||
case JsString(name) => enum.withName(name)
|
||||
case JsNumber(value) => enumeration(value.toInt)
|
||||
case JsString(name) => enumeration.withName(name)
|
||||
case other => deserializationError(s"String or number expected, got $other")
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,6 +75,8 @@ trait XivApi extends RequestExecutor {
|
||||
|
||||
object XivApi {
|
||||
|
||||
private val defaultShop = JsObject("IsUnique" -> JsNumber(1), "StackSize" -> JsNumber(999))
|
||||
|
||||
private def parseXivapiJsonToShop(
|
||||
js: JsObject
|
||||
)(implicit executionContext: ExecutionContext): Future[Map[Long, (String, Long)]] = {
|
||||
@ -128,7 +130,7 @@ object XivApi {
|
||||
if (index == "crafted" && shopId == -1L) PieceType.Crafted
|
||||
else
|
||||
Try(shopMap(shopId).fields(s"ItemCost$index").asJsObject)
|
||||
.getOrElse(throw new Exception(s"${shopMap(shopId).fields(s"ItemCost$index")}, $index"))
|
||||
.getOrElse(defaultShop)
|
||||
.getFields("IsUnique", "StackSize") match {
|
||||
case Seq(JsNumber(isUnique), JsNumber(stackSize)) =>
|
||||
if (isUnique == 1 || stackSize.toLong != 999) PieceType.Tome // either upgraded gear or tomes found
|
||||
|
||||
Reference in New Issue
Block a user