manavortex / FurnitureCatalogue

FurnitureCatalogue
4 stars 9 forks source link

LibPrice compatibility #58

Open DakJaniels opened 1 year ago

DakJaniels commented 1 year ago

Was it an intended to change how FurC's constants are accessed? LibPrice is throwing errors now, This is how LibPrice currently uses FurC,

  local func_table = {
    [FURC_CRAFTING] = self.From_FurC_Crafting           --  3
  , [FURC_VENDOR] = self.From_FurC_AchievementVendor  --  6
  , [FURC_PVP] = self.From_FurC_PVP                --  7
  , [FURC_CROWN] = self.From_FurC_Crown              --  8
  , [FURC_LUXURY] = self.From_FurC_Luxury             -- 10
  , [FURC_ROLIS] = self.From_FurC_Rolis              -- 12
  , [FURC_DROP] = self.From_FurC_Misc               -- 14
  , [FURC_JUSTICE] = self.From_FurC_Misc               -- 15

    -- These tables never have per-item price data.
  , [FURC_RUMOUR] = self.From_FurC_NoPrice            --  9
  , [FURC_FESTIVAL_DROP] = self.From_FurC_NoPrice            -- 18
  }

Changing that table to this fixes the errors,

local func_table = {
   [FurC.Constants.ItemSources.NONE] = self.From_FurC_NoPrice -- 1
  ,[FurC.Constants.ItemSources.FAVE] = self.From_FurC_NoPrice -- 2
  ,[FurC.Constants.ItemSources.CRAFTING] = self.From_FurC_Crafting -- 3
  ,[FurC.Constants.ItemSources.CRAFTING_KNOWN] = self.From_FurC_Crafting -- 4
  ,[FurC.Constants.ItemSources.CRAFTING_UNKNOWN] = self.From_FurC_Crafting -- 5
  ,[FurC.Constants.ItemSources.VENDOR] = self.From_FurC_AchievementVendor -- 6
  ,[FurC.Constants.ItemSources.PVP] = self.From_FurC_PVP -- 7
  ,[FurC.Constants.ItemSources.WRIT_VENDOR] = self.From_FurC_Rolis -- 8
  ,[FurC.Constants.ItemSources.CROWN] = self.From_FurC_Crown -- 9
  ,[FurC.Constants.ItemSources.RUMOUR] = self.From_FurC_NoPrice -- 10
  ,[FurC.Constants.ItemSources.LUXURY] = self.From_FurC_Luxury -- 11
  ,[FurC.Constants.ItemSources.OTHER] = self.From_FurC_Misc  -- 12
  ,[FurC.Constants.ItemSources.ROLIS] = self.From_FurC_Rolis -- 13
  ,[FurC.Constants.ItemSources.DROP] = self.From_FurC_Misc  -- 14
  ,[FurC.Constants.ItemSources.JUSTICE] = self.From_FurC_Misc  -- 15
  ,[FurC.Constants.ItemSources.FISHING] = self.From_FurC_Misc  -- 16
  ,[FurC.Constants.ItemSources.GUILDSTORE] = self.From_FurC_NoPrice -- 17
  ,[FurC.Constants.ItemSources.FESTIVAL_DROP] = self.From_FurC_NoPrice -- 18
}

I guess i'm asking if LibPrice needs to be updated or if its on yall's end.

wookiefriseur commented 1 year ago

I see, I can put the old ones back in as fallback and will deprecate them only once we have some kind of API for that. Sorry about the incompatibility. Will push an update soon and it should work as before for you.

Ok, tested it quickly with /script d(LibPrice.Price(LibPrice.FURC, "|H1:item:115285:3:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h")) and it seems to work. Will push.

Sharlikran commented 1 year ago

Whatever the new format is just let me know.

wookiefriseur commented 1 year ago

The old one works again.

Regarding the API Let me know of any API wishes you might have and I will try to implement them 🙂