Skip to content

fix(vendor): a shop listing with zero stock is unlimited - #218

Open
davidc-smith wants to merge 1 commit into
eriknihlen:mainfrom
davidc-smith:fix/vendor-unlimited-stock
Open

davidc-smith wants to merge 1 commit into
eriknihlen:mainfrom
davidc-smith:fix/vendor-unlimited-stock

Conversation

@davidc-smith

Copy link
Copy Markdown
Contributor

What this changes

A vendor can open with an empty item list even though it has stock. ACE sends each listing's stock exactly as the content authored it. Much ACE world content authors shop rows with a stack size of 0 rather than -1, and ACE sends that 0 unchanged. The vendor window treated only a negative stock as unlimited, so it read 0 as sold out and hid the row. A vendor whose rows are all 0 showed nothing.

The ApproachVendor wiring now records any stock of 0 or below as -1 (unlimited) when it builds VendorShopItem. That one change fixes:

  • the vendor window, which hid zero-stock rows (VendorUiController.AvailableShopQuantity)
  • component auto-fill, which limited a zero-stock row to nothing and reported every component as short (VendorComponentFill.TryFindStock)
  • plugins, which saw a stock of 0 through the automation surface

VendorApproach still reports the stock exactly as it came over the wire. A new test, RuntimeVendorLifecycleTests.ApproachVendorEvent_ZeroStockListing_IsUnlimited, dispatches listings with stock 0, -1 and 3 and checks they come out as -1, -1 and 3.

How it was tested

Live, on the Infinite Leaftide ACE server: before the fix, the vendor Aydra the Redistributor opened with an empty item list. With the fix, his inventory is visible.

Original behavior

ACE (Vendor.LoadInventoryItem) keeps the create-list row's stack size and only turns a missing value into -1. When a player buys one of those standard items, ACE never checks that stack size, so 0 and -1 both mean the vendor never runs out. Items a player has sold to the vendor carry their real stack size, which is always at least 1, so a real count is never 0. ACE world content that uses 0 stocks normally for players on the retail client.

Checklist

  • dotnet build AcDream.slnx -c Release is green
  • The portable test filter passes locally (see CONTRIBUTING.md)
  • One topic per PR
  • No code copied from ACEmulator, ACViewer, or holtburger
  • No comments describing the original client's internals

https://claude.ai/code/session_01T9gYq4uZVPNw3DPW9cnpE9

ACE sends a shop create-list row's authored stack size unchanged, and
world content authors many of those rows as 0 rather than -1. ACE never
limits a create-list item, but the vendor window only treated a negative
stock as unlimited, so it hid every zero-stock row and the vendor looked
empty. Component auto-fill also capped those rows at nothing.

The ApproachVendor wiring now records any non-positive stock as -1.

Claude-Session: https://claude.ai/code/session_01T9gYq4uZVPNw3DPW9cnpE9

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant