fifa17-recon: transfer market sell/list flow (stateful, tested)
Complete the market loop (browse + buy + sell). POST auctionhouse (FutISStart)
lists an owned club item -> profile.listings + returns {id:tradeId}. tradePile
builds a validated auction record per listing from the owned item + prices
(freeze-safe, same 0x18013e410 shape). DELETE trade/{id} removes the listing.
fut_store gains list_for_sale/listings/remove_listing (tradeId space 900500000+).
test_market_buy.py extended with sell/delist checks (temp profile, no real-save
mutation): list -> tradePile shows it with prices -> delist empties it. All pass.
Read-only contract suite still 311/311. Functional (FIFA's exact sell params)
pending live test; freeze-safe by construction.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PN5bmpDVQR1aXgefyWAt7o
This commit is contained in:
@@ -165,6 +165,28 @@ class Store:
|
||||
out["players"] = players
|
||||
return out
|
||||
|
||||
# ---- transfer-market listings (user's own sale pile) -------------------
|
||||
def list_for_sale(self, item_id, start, buynow):
|
||||
with _LOCK:
|
||||
p = self.load()
|
||||
p.setdefault("listings", [])
|
||||
p["listings"] = [l for l in p["listings"] if l.get("itemId") != item_id]
|
||||
tid = 900500000 + p.get("nextListingSeq", 0)
|
||||
p["nextListingSeq"] = p.get("nextListingSeq", 0) + 1
|
||||
p["listings"].append({"tradeId": tid, "itemId": item_id,
|
||||
"startingBid": start, "buyNowPrice": buynow})
|
||||
self._save()
|
||||
return tid
|
||||
|
||||
def listings(self):
|
||||
return self.load().get("listings", [])
|
||||
|
||||
def remove_listing(self, tid):
|
||||
with _LOCK:
|
||||
p = self.load()
|
||||
p["listings"] = [l for l in p.get("listings", []) if l.get("tradeId") != tid]
|
||||
self._save()
|
||||
|
||||
def new_item_id(self):
|
||||
with _LOCK:
|
||||
p = self.load(); i = p["nextItemId"]; p["nextItemId"] += 1; self._save()
|
||||
|
||||
Reference in New Issue
Block a user