Add API to Barter Stand

Thoughts on the further development of Haven & Hearth? Feel free to opine!

Re: Add API to Barter Stand

Postby APXEOLOG » Wed Aug 16, 2023 6:36 pm

maze wrote:>me, repeating every world to remove fking fiber/cloth from market stands so we can have day 1 trading....
fk markets taking months to build. Trading is such a core function that people love- fk hurdling it.

You can start trading from day1, there were plenty of cases like that.
W10 Meme Plot | W9 Mantis Garden | W8 Core | W7 Ofir | W6 the City of Dis | W5 Vitterstad | W4 A.D. | W3 Mirniy
jorb wrote:All your characters will be deleted, and I will level every village any one of them were ever members of.
User avatar
APXEOLOG
 
Posts: 1289
Joined: Fri Apr 23, 2010 7:58 am
Location: Somewhere on Earth

Re: Add API to Barter Stand

Postby noindyfikator » Wed Aug 16, 2023 6:55 pm

Considering our developers engagement into further haven development you ask for years if not decades of development. You will die faster than they will add anything from this thread.
W3-Garden of Metallurgists
W4-A.D.
W5-Vitterstad
W6-Dis
W7-Ofir
W8-Dis
W9-Hive
W10-Dis
W11-The Friend Zone
W12-Kingdom of Ashes
W13-Monke
W14-Alpaca Farm aka Animal Planet
W15-Whatever Bay - The Greatest Siege Defense Victory in Haven History - https://www.youtube.com/watch?v=KhyUveSeZ0Q

♰ FORUM MODERATOR 02.01.2024 - 05.10.2024 ♰
User avatar
noindyfikator
 
Posts: 1274
Joined: Fri Jul 15, 2011 11:10 am

Re: Add API to Barter Stand

Postby Vordt » Wed Dec 27, 2023 2:45 pm

Define the API endpoints and payload that will be used for updating market websites. For example:
POST /api/barter-stand/update
{
"standId": "123",
"items": [
{"itemId": "item1", "quantity": 5},
{"itemId": "item2", "quantity": 10}
]
}
Vordt
 
Posts: 1
Joined: Wed Dec 27, 2023 2:44 pm

Re: Add API to Barter Stand

Postby VDZ » Thu Dec 28, 2023 4:49 am

Vordt wrote:Define the API endpoints and payload that will be used for updating market websites. For example:
POST /api/barter-stand/update
{
"standId": "123",
"items": [
{"itemId": "item1", "quantity": 5},
{"itemId": "item2", "quantity": 10}
]
}

I don't run any market site myself, but I wrote something to parse Whatever Bay's market page and it uses these definitions (for slots; it doesn't care about the stands themselves):
Code: Select all
public class BarterSlot
{
    public int standID = -1;
    public int sellingAmount = -1;
    public int sellingStack = 1;
    public float sellingQuality = -1;
    public string sellingItem = "Unknown";
    public int askingAmount = -1;
    public float askingQuality = -1;
    public string askingItem = "Unknown";
    public string lastUpdate = "Unknown";
}

'Amount' and 'Stack' are different because a stand could offer e.g. '3x Bay Coin' for '8x Bar of Any Metal', and have '15 left' of that '3x Bay Coin'. (Technically those aren't stacks but some other way of combining stuff also used for stuff like seeds and Cave Dust; not sure what other term to use.) 'Last update' is a bot-specific thing, it's when their bot last checked the stand to update the site. Missing from this is the icon, which in their case can change the meaning of the item name (e.g. lead bay coins and gold bay coins are both called just 'Bay Coin'. Rather than a name+icon it would be better for an official API to send an official item identifier which consumers then convert to item names for end-users. The combination of item name, quality and quantity could be turned into its own sub-object instead of being repeated for both buy and sell, but that's a coding style preference thing. (Also, stand ID obviously shouldn't be a sequential int if it were global.)

So ideal would probably be something like this?
Code: Select all
BarterStand
{
string id;
BarterSlot[] slots;
}

BarterSlot
{
BarterItem selling;
int stock;
BarterItem buying;
}

BarterItem
{
string id;
float quality;
int stack;
}

With a GET to /api/barter-stand/{id} getting a JSON of the relevant BarterStandObject (which contains 5 BarterSlots which each contain 2 BarterItems)? (You'd have to get the barter stand's ID by interacting with it in-game.)

There's some fringe information not included here (e.g. star icon, Memories of Pain, ingredients, how many bugs the Bug Collection was made of, etc) but that's not included on Whatever Bay's page either. This is what seems sensible to me, but I wasn't the one making the feature request.
User avatar
VDZ
 
Posts: 2660
Joined: Sun Jul 17, 2011 2:27 am

Previous

Return to Critique & Ideas

Who is online

Users browsing this forum: Trendiction [Bot] and 3 guests