ReplaceItemStatsProfile

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 13:29, 20 October 2026 by QCherry (talk | contribs) (Release 0.1.9 / BUILD264 / Protocol42: availability and download setup; preserve experimental limits)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

replaceItemStatsProfile

AVAILABLE FROM UPDATE 0.1.9
Available from 0.1.9. See the scope and validation notes below.

Replaces the complete item profile owned by this resource.

Syntax

accepted, error, revision = replaceItemStatsProfile(profile)

Parameters

Name Type Required Description
profile table yes Map of item keys to property/value tables, such as getItemStatsProfile() returns.

Returns

Three values: accepted (boolean), error (string; empty on success), revision (decimal string). Check accepted before using the revision. Success means server acceptance, not visual/client completion. A no-op may return the unchanged revision.

Examples

local saved = readResourceData("item_balance")
if saved then
    local profile = fromJSON(saved)
    assert(type(profile) == "table", "Invalid item profile")
    local ok, why = replaceItemStatsProfile(profile)
    assert(ok, why)
end

Notes

  • Available from G1R:MP 0.1.9. This documents the implemented API and its current limits. See Item type stats for scope and remaining in-game validation.
  • Server-side only. Profiles affect every copy of the same type on this server, across dimensions; not individual item instances.
  • Use matching supported client and server builds. Server acceptance and a client application report do not prove the native gameplay effect.
  • Active overrides are owned per item type by the calling resource. Another resource cannot change that owned type. Resource stop removes its overrides.
  • Validation is atomic for the submitted transaction. Unsupported fields, wrong families, invalid/non-finite values, duplicate item/property aliases or ownership conflicts reject it.
  • A numeric 0 is an explicit value where allowed, not reset. Use resetItemStats to remove an override. Profiles are not automatically persisted.
  • Do not expose this setter directly to untrusted remote events. See getItemStatDefinitions and Item stat properties.
  • Omitted old fields/types owned by this resource are reset in the same transaction as new values. Other resources are untouched. An empty table resets all of your resource's overrides.