Restore local store and supply-pack purchases - #27
Conversation
|
Reviewed against The project builds,
GitHub currently reports conflicts, although a local Git 2.49 merge-tree calculation at the reviewed base/head was clean; please reconcile that status. No published CI checks were reported. Native rendered UI and installed-bundle application were not exercised by these tests. No changes were pushed during review. |
0c4a628 to
ef57634
Compare
reiserFSs
left a comment
There was a problem hiding this comment.
REQUEST CHANGES — reviewed ef57634eb9e71fa74171b980de491d77fdb10548
Acknowledged and resolved from earlier rounds: daily counter reset, daily-claim capacity handling, and the consumed first-bonus projection. Release build, --store-purchases-only against an isolated Mongo, and the 10 Python Lua patch tests over 13 actual EN source files all passed. NativeUI / installed bundle was not exercised.
1. Pooled affordability validation but per-item debit (blocking) — PayModule.cs:248-249
Validation accepts only an exact ConsumeId, and ResumePendingPurchase (176-178) then charges that exact item. The EN packages pool affordability across item2 + item3, so the newly enabled package21 (cost 10) is inconsistent:
- balances 10/0 and 5/5 are rejected with 20012004;
- 0/10 succeeds.
Validation and debit must use the same shared pooled-currency accounting, and the debit must be durable, while keeping reward granting idempotent.
2. Immediate rewards granted without capacity check (blocking) — PayModule.cs:250-273
package21 grants 5 of item12; with cap 99999 and room for only 4 the handler returns code 0, advertises 5, actually grants 4, charges 10, and still consumes the daily purchase allowance. The room-5 control grants 5. Reject before consumption, or overflow losslessly using mechanisms already present in the codebase.
3. Unauthorized captured purchase-catalog exception (blocking)
The claimed captured-purchase-catalog exception still has no explicit maintainer authorization; the author's AGENTS.MD / provenance edit does not supply one, and the only user authorization so far covers merging #28 and requesting these changes — not this exception. Either obtain actual maintainer approval, or remove the unauthorized captured runtime catalog.
Omitted as previously discarded: converted daily rewards, concurrency, and relocation findings.
|
Thanks for the detailed review. The findings were against 0c4a628; the requested changes have since been implemented and force-pushed. The current PR head is ef57634.
|
reiserFSs
left a comment
There was a problem hiding this comment.
As maintainer, I approve the static purchase-catalog exception for this PR. The previous catalog-authorization blocker is resolved. This approval covers static package definitions only, including authored static prices; dynamic prices/state where derived, purchase counts, reset timing, eligibility, balances and reward application remain runtime-derived. Only the two technical fixes below remain before merge.
Acknowledged and resolved from earlier rounds: earlier daily counter reset, daily-claim capacity, and consumed first-purchase bonus fixes. Build, --store-purchases-only, and actual EN Lua 10-check verification pass, but those do not cover the reproduced boundaries below.
-
Use pooled Black Cards for both validation and durable debit —
PayModule.cs:248-249validates onlyConsumeId3, andResumePendingPurchase:174-176builds the same single-stack cost. Real package21 costs 10; item2/item3 balances 10/0 and 5/5 return 20012004 even though the EN client pools them, while 0/10 succeeds. Reuse the pooled-currency operation consistently for validation and idempotent spending; cover those balances and insufficient pooled totals. -
Prevent immediate package reward truncation —
PayModule.cs:250-253assembles grants without the capacity guard used for daily claims. Real package21 advertises item12x5: room 4 still returns Code 0, charges 10 cards, increments PurchaseBuyTimes to 1, but grants 4. Room 5 control grants 5. Reject before charging/consuming allowance or deliver overflow losslessly; test the capacity boundary and unchanged state on rejection.
Ready to merge once these two fixes are verified.
Problem
The local store currently marks many asset-conversion items as unavailable even though the client tables define valid purchases. Valid conversion requests can therefore fail instead of deducting the configured currency and granting the item.
Supply-pack flows are also incomplete: event packs and several multi-day or monthly packs can return purchase errors; retail expiration data can hide packages; and limits, discounts, entitlement duration, and daily claim state are not consistently maintained.
The retail client does not contain the complete package catalog. It requests
GetPurchaseListby UI type and caches thePurchaseInfoListreturned by the server. Client event tables can identify which package IDs to show, but package price, rewards, shelf schedule, purchase limits, and player state are server-controlled. An offline emulator therefore cannot recover the current retail catalog from the installed client alone.Summary
Local store
BuyAssettables.Supply packs
Catalog provenance and limitations
PGR's retail service owns the live package catalog and can remotely change listings, delistings, prices, schedules, and limits. That live data is not present in the offline client.
For local compatibility,
client_purchases.jsonreconstructs static package definitions from previously observed server responses. Duplicate observations were reduced to the static fields that agreed, inherited retail deadlines were removed, and player-specific fields were discarded. This catalog is not presented as a current authoritative retail snapshot.The runtime does not read captures or decoded dumps. Dynamic purchase counts, timestamps, reset usage, entitlement duration, remaining days, and claim state are derived locally from persisted state and authoritative clock/rule data, under the repository's maintainer-authorized purchase catalog exception.
Testing
dotnet build AscNet/AscNet.csprojdotnet run --project AscNet.Test/AscNet.Test.csproj -- --store-purchases-onlypython -m unittest Scripts.test_store_catalog_patch