-
Notifications
You must be signed in to change notification settings - Fork 0
Gear Template Profile Filter
This page documents two profile-template persistence bugs in the buy-gear system: the save filter's undefined upgrade variable, and the load/import guard that accepts six-field rows before reading backpack data. It is a focused implementation note for the rows in Feature status and the gear atlas.
All mission paths are relative to Missions/[55-2hc]warfarev2_073v48co.chernarus/.
flowchart TD
InitClient["Client/Init/Init_Client.sqf"] --> CompileGear["Compile gear UI helpers"]
InitClient --> ProfileGate["OA version gate compiles SaveTemplateProfile"]
ProfileVars["Client/Init/Init_ProfileVariables.sqf"] --> ProfileGear["Client/Init/Init_ProfileGear.sqf"]
ProfileGear --> MissionTemplates["WFBE_%SIDE_Template in missionNamespace"]
BuyGear["GUI_BuyGearMenu.sqf"] --> AddTemplate["Client_UI_Gear_AddTemplate.sqf"]
AddTemplate --> MissionTemplates
BuyGear --> SaveNeeded["_need_save when template changes"]
SaveNeeded --> SaveProfile["Client_UI_Gear_SaveTemplateProfile.sqf"]
SaveProfile --> ProfileNamespace["profileNamespace WFBE_PERSISTENT_%SIDE_GEAR_TEMPLATE"]
| Source | Evidence |
|---|---|
Client/Init/Init_Client.sqf:116-126 |
Compiles gear UI helpers including add/delete/fill/template functions. |
Client/Init/Init_Client.sqf:169-172 |
Under the OA version gate, compiles WFBE_CL_FNC_UI_Gear_SaveTemplateProfile and runs profile variable loading. |
Client/Init/Init_ProfileVariables.sqf:37-42 |
Reads WFBE_PERSISTENT_%SIDE_GEAR_TEMPLATE from profileNamespace and validates through Init_ProfileGear.sqf. |
Client/Init/Init_ProfileGear.sqf:17,25 |
Accepts stored rows with count _x >= 6, then reads _x select 6 as backpack data. |
Client/Init/Init_ProfileGear.sqf:25-136 |
Re-validates stored profile templates for shape, side membership, price and max upgrade before replacing mission templates. |
Client/Functions/Client_UI_Gear_AddTemplate.sqf:15,37,83,110,136-148 |
Builds _u_upgrade as the maximum required upgrade in the new template, then appends the template and sets _need_save = true. |
Client/GUI/GUI_BuyGearMenu.sqf:509 |
Spawns WFBE_CL_FNC_UI_Gear_SaveTemplateProfile after the dialog closes when _need_save is true. |
Client/Functions/Client_UI_Gear_SaveTemplateProfile.sqf:17-19 |
Privates and sets _template_upgrade = _x select 3. |
Client/Functions/Client_UI_Gear_SaveTemplateProfile.sqf:33,52,75 |
Uses _u_upgrade, which is not private or assigned in this function. |
Client/Functions/Client_UI_Gear_SaveTemplateProfile.sqf:94-95 |
Writes the filtered array to profileNamespace and calls saveProfileNamespace. |
Client/Functions/Client_UI_Gear_FillTemplates.sqf:15-22 |
The visible template list only adds templates whose stored upgrade level is at or below current WFBE_UP_GEAR. |
Client_UI_Gear_SaveTemplateProfile.sqf intends to filter templates so only side-valid and currently unlocked items are saved to the player's profile. The function has a correctly named _template_upgrade value, but the three per-item upgrade checks reference _u_upgrade instead:
if ((_get select 3) > _upgrade_barracks && _u_upgrade > _upgrade_gear) then {_can_save = false};_u_upgrade exists in Client_UI_Gear_AddTemplate.sqf, where it is the computed max upgrade for a newly created template. It does not exist in Client_UI_Gear_SaveTemplateProfile.sqf.
Separate creation-gate nuance: Client_UI_Gear_AddTemplate.sqf:135-136 accepts a new template when the computed requirement is below either current Barracks upgrade or current Gear upgrade:
if (_u_upgrade <= (_upgrades select WFBE_UP_BARRACKS) || _u_upgrade <= (_upgrades select WFBE_UP_GEAR)) then {That may be intentional because some infantry equipment gates are Barracks-led while others are Gear-led. It still needs owner confirmation before profile/template cleanup: Client_UI_Gear_FillTemplates.sqf:15-22 later hides visible templates above current WFBE_UP_GEAR only, and Client_UI_Gear_SaveTemplateProfile.sqf has its own undefined _u_upgrade filter bug. If the intended rule is "unlocked by either relevant tech lane," keep the OR and document which item classes use which lane. If the intended rule is "both infantry tech and gear tech must support it," change AddTemplate, FillTemplates and SaveTemplateProfile together.
Practical impact:
- The save pass can hit an undefined-variable script error when a template item's upgrade exceeds the current barracks upgrade and the expression evaluates the second operand.
- Even when no error is hit, saved-template upgrade filtering cannot be trusted as written because the intended second comparison reads the wrong variable.
-
Init_ProfileGear.sqfstill validates profile templates on load, so this is mainly a persistence/filter correctness bug, not proof that the live buy-gear UI lets locked gear equip by itself. -
Client_UI_Gear_FillTemplates.sqfintentionally hides templates above the current gear upgrade instead of showing them as locked. This can make valid saved templates look missing until the side upgrades gear again. - The broader gear/EASA/service authority issue remains separate: purchases and effects are still client-authoritative legacy flows, covered by Server authority migration map and Gear/loadout/EASA atlas.
| Option | Shape | Tradeoff |
|---|---|---|
| Use item upgrade directly | Replace _u_upgrade > _upgrade_gear with (_get select 3) > _upgrade_gear in all three checks. |
Most local and easiest to reason about: reject each item if its own upgrade exceeds both barracks and gear. |
| Use template max upgrade | Replace _u_upgrade with _template_upgrade. |
Matches the already-read template field, but rejects based on the template max when checking each item. This is close to AddTemplate behavior. |
| Recompute local max | Initialize _u_upgrade = _template_upgrade or recompute max before per-item checks. |
More churn than needed unless the owner wants to normalize stale profile data during save. |
Recommended first patch:
if ((_get select 3) > _upgrade_barracks && (_get select 3) > _upgrade_gear) then {_can_save = false};Apply that replacement at the weapon, magazine and backpack-content checks. Keep Init_ProfileGear.sqf load validation unchanged unless a smoke test proves it filters too aggressively or too loosely.
Client/Init/Init_ProfileGear.sqf has a separate profile-load compatibility bug. It accepts any stored template row with at least six fields, then reads field 6 as backpack data:
if (count _x >= 6) then {
...
_magazines = _x select 5;
_backpack = _x select 6;Arrays are zero-indexed, so a six-field legacy row has valid indexes 0..5; reading index 6 is one past the end. Maintained Vanilla Takistan carries the same :17/:25 shape. Patch this in the same profile-template pass as the save filter, but keep the behavior choice explicit:
| Option | Shape | Tradeoff |
|---|---|---|
| Require current seven-field rows | Change the guard to if (count _x >= 7) then { ... }. |
Smallest correctness patch; drops old six-field rows instead of trying to repair them. |
| Preserve legacy six-field rows | If count _x == 6, inject _backpack = [] or normalize the row before validation. |
More compatible for old profiles, but needs smoke for both old and current row shapes. |
Validation for this paired fix:
-
Init_ProfileGear.sqfnever reads_x select 6unless the row has at least seven fields, or it intentionally supplies an empty backpack default for six-field rows. - Current seven-field templates still load and recalculate price/upgrade fields.
- Old six-field profile rows either fail closed without an RPT out-of-range error or load with an explicit empty backpack default.
- Maintained Vanilla receives the same profile-load fix after propagation.
Source checks:
-
Client_UI_Gear_SaveTemplateProfile.sqfhas no_u_upgradereference. - The function still writes
WFBE_PERSISTENT_%SIDE_GEAR_TEMPLATE. -
Client_UI_Gear_AddTemplate.sqfstill computes and stores template max upgrade in field 3. -
Init_ProfileGear.sqfstill recalculates stored profile price and max upgrade on load. -
Init_ProfileGear.sqfno longer accepts six-field rows and then reads index 6 without a compatibility default. - AddTemplate, FillTemplates and SaveTemplateProfile all use the same intended Barracks/Gear lane rule after the owner decision.
Arma smoke:
- Create a gear template with currently allowed gear; close the menu and confirm it persists after restart/rejoin.
- Try to save a template containing gear above both barracks and gear upgrade levels; confirm it is not written and no RPT undefined-variable error appears.
- Upgrade barracks/gear and confirm the same template becomes saveable when the relevant level is unlocked.
- Confirm templates still disappear from the visible list when
Client_UI_Gear_FillTemplates.sqffilters them above currentWFBE_UP_GEAR. - Decide whether hidden higher-upgrade templates should remain invisible or appear as locked rows so players understand they were not deleted.
Generated mission:
- Patch source Chernarus first.
- Propagate Vanilla Takistan with
Tools/LoadoutManagerfrom a checkout whose ancestor folder is literally nameda2waspwarfare. - Do not hand-edit divergent/stubbed
Modded_Missionsunless the owner picks a maintenance model.
- This is a correctness and persistence bug in profile-template filtering.
- The import-bound issue is a paired profile persistence bug, not proof that live gear purchase authority is hardened or broken in a new way.
- It is not the same as full gear purchase authority. Do not claim public-server gear hardening after this patch.
- Keep this page paired with Gear/loadout/EASA atlas, Client UI systems atlas and Feature status.
Previous: Gear/loadout/EASA atlas | Next: UI IDD collision repair
Main map: Home | Agent file: agent-feature-status.jsonl | Backlog: agent-hardening-backlog.jsonl
Home | Agent Guide | Current live state | Release 1.2.2 (B91) | Quickstart | Progress | Lifecycle wait-chain | Join/disconnect | Parameters/build | Assets/config | SQF atlas | PV index | Modules | Support/specials | Commander/HQ | Commander vote/reassign | Construction/CoIn | Construction cleanup | WDDM compositions | Factory/purchase | Upgrades/research | Towns/camps/capture | Victory/endgame | Markers/cleanup | Server runtime | AI runtime/HC | AI commander audit | HC delegation | Town AI safety | Commander reassignment | Resistance supply | Player UI workflow | UI atlas | Respawn/death | Gear template filter | Vehicle cargo loop | Service guards | UI IDD repair | UI design inspiration | WASP overlay | Feature status | Source propagation | release readiness | Tooling readiness | Integration trust | AntiStack DB | Owner decisions | Shelved registry | Abandoned feature revival | Hardening roadmap | PVF dispatch | Server authority | ICBM authority | Attack-wave authority | Telemetry families | AICOM V2 cutover | Consumer port map | Testing workflow | Server ops | Web tools | Ecosystem repos | Arma 2 OA refs | A2 traps | OA compatibility audit | Coverage ledger | Navigation inventory | Pruning ledger | Knowledge roadmap | Agent context | Collab protocol | Worklog | Audit archive 2026-07 | Briefing reference | Utes invasion concept
- Shelved AICOM concepts - revivable someday ideas (owner-shelved 2026-07-03)
Docs rule: source-backed claims only; Arma 2 OA scripting docs only; gameplay edits start in Missions/[55-2hc]warfarev2_073v48co.chernarus.
- Getting started
- Status and coordination
- Agent context
- Agent collaboration protocol
- Agent worklog
- Agent worklog archive
- Progress dashboard
- PR cleanup and integration lab
- Shelved PR #169: gear price double-count
- Shelved PR #194: Chernarus no-trees
- Coordination board
- Codebase coverage ledger
- Bottleneck removal queue
- Current source status
- Wiki mirror reconciliation
- Navigation inventory
- Registers
- Agent orchestration
- Architecture
- Architecture overview
- Mission entrypoints and lifecycle
- Lifecycle wait chain
- Player join/disconnect and AntiStack lifecycle
- Mission parameters/localization/build inputs
- Stringtable localization key-family catalog
- Source inventory
- Content structure and maps
- Assets/config/localization/parameters
- Mission start parameters index
- Code and networking
- Gameplay systems
- Core systems index
- Gameplay systems atlas
- Commander/HQ lifecycle atlas
- Economy, towns and supply
- Economy system reference
- Balance asymmetries
- Anti-stack skill-balance mechanic
- Empty-side supply income stagnation
- Towns, camps and capture atlas
- Victory and endgame atlas
- Victory conditions reference
- Territorial victory reference
- Marker cleanup and restoration
- Marker loop engine and registries
- Map marker families content catalog
- Marker subsystem function reference
- Client marker FSM updater map
- Support specials and tactical modules
- SCUD TEL tactical munitions
- Naval HVT objectives (carriers/SCUD)
- SCUD saturation strike mechanic
- Takistan airfield FPV drone design
- Construction and CoIn systems
- Structure damage reduction & friendly-fire
- Construction logic list cleanup
- Flak tower & WDDM anchor compositions
- Resistance supply scaffold
- GUER Insurgents faction overview
- GUER Insurgents branch audit
- GUER insurgent player economy
- GUER Commissar Panel
- GUER air-defense loop (Ka-137/Mi-24)
- Upgrades and research atlas
- Supply mission architecture
- Supply mission authority cleanup
- Current supply helicopters PR1
- Respawn and death-loop lifecycle
- Vehicle theft economy pitch
- GUER tunnel network pitch
- Content, reference and catalogs
- Faction unit/vehicle roster catalog
- Auxiliary/SF/civilian unit catalog
- Gear store loadout route catalog
- Upgrade research (cross-faction)
- Gear store price and upgrade catalog
- Gear store catalog (complete, per faction)
- Defense structures catalog
- Artillery reference per faction
- AI squad team templates catalog
- Town AI lifecycle reference
- Town AI group composition catalog
- Class-skill system reference
- Player skill abilities reference
- Default gear template content catalog
- Chernarus map content reference
- Takistan map content reference
- Takistan features
- Takistan parity reference
- Takistan oilfields objective reference
- IRS IR-smoke countermeasure
- Arty module special munitions
- Zeta cargo sling-load reference
- Spawn primitive function reference
- Kill and score pipeline
- Waypoint helper function reference
- Position and proximity function reference
- Side/team state function reference
- Player AI watchdog and recovery
- AICOM stuck-recovery v2
- LoadoutManager data-model contributor guide
- Discord status bot setup and reference
- GLOBALGAMESTATS extension reference
- New player quickstart (player guide)
- Optional client mods (player guide)
- Earning funds and score (player guide)
- Vehicle service and logistics (player guide)
- Commander's handbook (player guide)
- Tactical support menu
- Paradrop player experience
- Supply missions (player guide)
- In-game briefing & Diary field manual
- Playable maps catalog
- Faction root variables reference
- Faction base structures catalog
- Counter-battery radar system
- Bank, Reserve and Artillery Radar structures
- Map ruleset model and object config
- Countermeasures module reference
- Vehicle countermeasure (flares/spoofing)
- UAV terminal and spotter system
- Artillery firing function reference
- Service Point pricing model
- Medic redeployment truck (forward spawn)
- Side-patrol runtime and convoy mechanics
- Day/night cycle and weather system
- Config lookup helper reference
- CIPHER sort utilities reference
- Modded maps status and content
- BattlEye filter setup and OA taxonomy
- Player squad/group join protocol
- AutoFlip vehicle recovery
- Engine stealth fuel toggle
- Valhalla vehicle climbing-assist
- Missile and ordnance Fired-EH reference
- Vehicle equip and rearm reference
- Array and collection utilities
- Server composition spawner reference
- Upgrade queue server loop
- Map boundaries and off-map enforcement
- Namespace/profile/diagnostic utilities
- Group bool getVariable A2-OA trap
- Vehicle weapon balance init
- View distance auto-throttle
- Camp & respawn-camp getters
- Performance audit writer
- Site clearance (bulldozer)
- Factory queue cancel & refund
- AI commander tunable constants
- Experimental feature-flag constants
- Flag system quick reference
- Mission tunable constants catalog
- Gear parsing & cargo capacity
- Structure dressing function
- Paradrop delivery functions
- ICBM nuke client VFX & radiation
- Server HandleSpecial router
- LocalizeMessage chat router
- Gear buy-menu render & price functions
- Server broadcast & telemetry loops
- Per-unit client init pipeline
- Vehicle marking & texture pipeline
- Defense category & budget
- Legacy AI order primitives
- Commander-team driver
- AICOM command verbs
- AICOM behavior fix taxonomy
- AI commander wildcard deck reference
- AICOM aircraft and airfield system
- Static-defense manning
- End-of-game stats screen
- AI commander execution loop
- Deployable bipod / weapon resting
- Town-economy getters
- Server-init deadspawn & airfield probe
- GUER VBIED detonate action
- Resource income-tick engine
- AI commander treasury accessors
- PVF send-helper contracts
- AICOM logging & AICOMSTAT telemetry
- AICOMSTAT v2 event census
- WASPSCALE v2 telemetry
- WASPSCALE v2-ext coverage audit
- Telemetry families reference
- Group lifecycle & entity reaping
- Batch AI spawner orchestrator
- Client funds/income HUD readout
- Server group GC & cap warning
- Town runtime tuning constants
- Client input/hotkey handler
- WASP base-repair system
- WASP DropRPG launcher/ordnance
- CoIn construction-interface client engine
- Town-capture garrison & airfield rebuild
- Map-control & minimap templates
- Client FPS & state telemetry
- Client service-proximity getters
- Airfield-exclusive roster & unit hints
- Unit-camera spectator system
- Town-garrison patrol/defense worker
- RequestTeamUpdate squad-discipline
- Arma2Warfare GPT assistant
- LoadoutManager build configs & defines
- GLOBALGAMESTATS extension logging
- Discord bot instrumented logging
- Eden/Everon & Taviana map content
- Cruise missile strike asset
- AI / HC
- AI headless and performance
- AI mods and pathfinding reference
- Headless client scaling and topology
- AI runtime/HC loop map
- Headless client init and stat loop
- HC delegation target selection
- Player AI caps and role balance
- Old WarfareBE FPS comparison
- AI commander autonomy audit
- Upstream BE 2073 AICOM delta
- Parent 2.073 divergence audit
- AI commander capture & fun plan
- AI commander B69 improvement roadmap
- AI commander B69 implementation sketches
- AICOM V2 cutover status
- Headless delegation and failover
- Commander reassignment call shape
- GUER Director living-resistance pitch
- Quality and operations
- Foundation perf findings & Tier-3 dead-ends
- Dead/stale code register
- Commander vote/reassignment
- Attack-wave authority
- Server runtime and operations
- Server ops runbook
- JIP enrollment & client data delivery (b74.2 lessons)
- Server gameplay runtime atlas
- PerformanceAuditAnalyzer
- Performance opportunity sweep
- Documentation plan
- Knowledge platform roadmap
- Wiki quality audit
- Wiki pruning and relevance ledger
- Audit findings queue (2026-06-03)
- Deep review findings
- Client UI / server-loop perf findings
- Performance gain simulation
- Self-host testing field notes
- Cleanup and work lanes
- Hardening and authority
- UI / player workflows
- Client UI, HUD and menus
- UI HUD and dialogs
- Player UI workflow map
- Client UI systems atlas
- UI IDD collision repair
- UI control class library reference
- UI theme palette and style macros
- UI design inspiration 2026-07
- Available-actions client gate FSM
- Gear/loadout/EASA atlas
- Gear template profile filter
- Vehicle cargo equip loop bounds
- Factory and purchase systems atlas
- Service menu affordability guards
- WASP overlay
- Class-skill system reference
- Skin selector and class swap
- Earplugs audio toggle
- Mission audio catalog
- HQ radio knowledge-base catalog
- QoL trio player hints
- Player vehicle/travel actions
- Tooling / release / integrations
- Tools and build workflow
- Warfare web tools
- Ecosystem & companion repos
- Zargabad tooling parity
- July 2026 release readiness
- Operator monitor and CPU affinity tools
- Tooling release readiness audit
- Source fix propagation queue
- Agent release readiness ledger
- Release source intake map
- Testing/debugging/release workflow
- Current RPT release gate
- RPT telemetry consumer port map
- External integrations
- Integration trust boundary audit
- AntiStack database extension audit
- Community & Dev
- Community & Dev
- Miksuu upstream wiki import / archive index
- Upstream changelog feature leads
- Developer history and upstream lessons
- Upstream Miksuu commit intel
- Upstream mining ledger
- Archive script mining v2
- Upstream BE 2073 AICOM delta
- Parent 2.073 divergence audit
- PR8 and Drone upstream lesson match
- Development lessons learned
- External research reports
- Audit archive 2026-07
- Briefing reference
- Utes invasion concept
- Miksuu archive: Home
- Miksuu archive: Welcome
- Miksuu archive: Big announcements
- Miksuu archive: Changelog
- Miksuu archive: Development process
- Miksuu archive: Discord bot
- Miksuu archive: Gameplay videos
- Miksuu archive: LoadoutManager
- Miksuu archive: Chernarus script architecture
- Base-game visual catalogs
- Compatibility and references
- HC upstream history and lessons
- Player stats branch audit
- BuyMenu EASA QoL branch audit
- Perf quick wins branch audit
- Commander positions branch audit
- Zargabad branch audit
- Quad AI Commander concept
- Arma 2 OA external reference guide
- Base-game config & image reference
- Arma 2 OA compatibility audit
- Arma 2 OA agent traps reference
- Arma 2 OA command versions
- Wiki source consistency
- External Arma 2 OA reference index