Add economy monitoring for dupe and abuse detection - #1148
Open
HarleyGilpin wants to merge 1 commit into
Open
Conversation
Three configurable monitors under economy.monitor.*: - Trade flagging: single trades over a value threshold and repeated large trades between the same account pair within a sliding window - Grand exchange price anomaly detection against market price - Item census: live per-item counts across player inventories, floor and exchange, with periodic snapshots and reconciliation scans of player saves to detect drift All flags are written to the audit log, searchable with ::logs. When database storage is enabled, flags and census snapshots are also persisted to append-only economy_flags and economy_census tables (pruned after economy.monitor.retentionDays) for external reporting. Disabled in test environments and hot-reloadable via ::reload settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds configurable economy monitoring (
economy.monitor.*in game.properties) to catch item duplication and bug abuse, modeled on how Jagex monitors the GE economy:TRADE_FLAG_VALUE) and repeated large trades between the same account pair within a sliding window (TRADE_FLAG_PAIR). Hooks the existingTradeConfirmaccept flow, valuing offers withInventory.calculateValue()before the exchange transaction.ExchangeHistory.marketPrice()beyond a configurable threshold (PRICE_ANOMALY), with a per-item cooldown. Single choke point: a listener list onExchangeHistory.record().slotChanged("*"), skipping_-mirror and shop inventories), floor items (spawn/despawn events) and open GE offers (computed fromOpenOffers). Periodic snapshots are logged (CENSUS) and persisted; an async reconciliation scan over player saves corrects drift (CENSUS_DRIFT) without blocking the game thread.All flags write to the existing
AuditLogTSVs, so::logssearches them. Whenstorage.type=database, flags and census snapshots are additionally buffered and flushed to two new append-only tables (economy_flags,economy_census, auto-created bySchemaUtils.create, pruned aftereconomy.monitor.retentionDays) via new default-bodyStoragemethods,FileStorage/SafeStorageuntouched.Everything is content-space except the engine data classes and
Storagedefault methods; zero overhead when disabled (single cached boolean per inventory event). Disabled in WorldTest; hot-reloadable via::reload settings.Front-end Preview
Flags
Economy Report
Test plan
TradeFlagsTest,PriceAnomalyTest,EconomySinkTestTradeFlagsMonitorTest,PriceAnomalyMonitorTest,ItemCensusTestDatabaseStorageTestengine:test,game:test,database:testgreen;spotlessApplyclean