diff --git a/openfut-adapter-fifa17/src/fut/catalog.rs b/openfut-adapter-fifa17/src/fut/catalog.rs index 9c9363d..081b86a 100644 --- a/openfut-adapter-fifa17/src/fut/catalog.rs +++ b/openfut-adapter-fifa17/src/fut/catalog.rs @@ -27,6 +27,9 @@ pub struct Fifa17CardIdentity { pub asset_id: u32, pub version: u8, pub resource_id: u32, + /// FIFA wire `rareflag` (rare/special card TYPE). Carried so specials render + /// as specials; observed metadata, not a guessed label. + pub rareflag: i64, } /// The FIFA 17 numeric namespace policy for owned-item wire ids. @@ -108,6 +111,14 @@ struct RawCard { asset_id: u32, #[serde(default)] version: u8, + /// Absent in a base-only catalog → default 1 (rare), preserving prior wire + /// behaviour; the production catalog carries the observed value. + #[serde(default = "default_rareflag")] + rareflag: i64, +} + +fn default_rareflag() -> i64 { + 1 } /// A loaded, validated FIFA 17 card-definition identity catalog. @@ -153,6 +164,7 @@ impl Fifa17CardCatalog { asset_id: rc.asset_id, version: rc.version, resource_id, + rareflag: rc.rareflag, }, ); } diff --git a/openfut-adapter-fifa17/src/fut/club_response.rs b/openfut-adapter-fifa17/src/fut/club_response.rs index 311ac4f..b85f6d4 100644 --- a/openfut-adapter-fifa17/src/fut/club_response.rs +++ b/openfut-adapter-fifa17/src/fut/club_response.rs @@ -89,6 +89,7 @@ mod tests { item_id: 100000001, asset_id: 20801, resource_id: 20801, + rareflag: 1, }, )])); let items = vec![item( @@ -157,6 +158,7 @@ mod tests { item_id: 100000002, asset_id: 158023, resource_id: 158023, + rareflag: 1, }, )])); // Synthetic club "Northgate United" has no FIFA team id. diff --git a/openfut-adapter-fifa17/src/fut/item.rs b/openfut-adapter-fifa17/src/fut/item.rs index 5c1fdf5..bd5f34c 100644 --- a/openfut-adapter-fifa17/src/fut/item.rs +++ b/openfut-adapter-fifa17/src/fut/item.rs @@ -59,6 +59,10 @@ pub struct Fifa17Identity { /// `resourceId`/`definitionId`, kept DISTINCT from `asset_id` so a versioned /// (special) card never collapses onto its base on the wire. pub resource_id: u32, + /// FIFA wire `rareflag` — the card's rare/special TYPE (e.g. 3=inform, + /// 21..=24 = special programmes). Drives the client's special-card art; + /// carried from the catalog, never hardcoded, so specials render as specials. + pub rareflag: i64, } /// Supplies the FIFA numeric identity for a Core item. Returning `None` means @@ -119,7 +123,7 @@ pub fn shape_item( "definitionId": id.resource_id, "cardsubtypeid": 0, "itemType": "player", - "rareflag": 1, + "rareflag": id.rareflag, "rating": item.rating, "preferredPosition": item.position, "nation": nation_id, @@ -172,6 +176,7 @@ mod tests { item_id: 100000001, asset_id: 20801, resource_id: 20801, + rareflag: 1, }, &ent, ); @@ -204,6 +209,7 @@ mod tests { item_id: 100000030, asset_id: 101490, resource_id: 101490, + rareflag: 1, }, &ent, ); @@ -213,6 +219,7 @@ mod tests { item_id: 100000031, asset_id: 101490, resource_id: 101490, + rareflag: 1, }, &ent, ); @@ -240,12 +247,20 @@ mod tests { item_id: 100000384, asset_id: 176580, resource_id: 117617092, + rareflag: 3, }, &ent, ); - assert_eq!(it["resourceId"], 117617092, "versioned resource id on the wire"); + assert_eq!( + it["resourceId"], 117617092, + "versioned resource id on the wire" + ); assert_eq!(it["definitionId"], 117617092); assert_eq!(it["assetId"], 176580, "base asset id preserved"); assert_eq!(it["cardassetid"], 176580); + assert_eq!( + it["rareflag"], 3, + "special rareflag carried, not hardcoded 1" + ); } } diff --git a/openfut-adapter-fifa17/src/fut/squad_projection.rs b/openfut-adapter-fifa17/src/fut/squad_projection.rs index 568796c..f45da7a 100644 --- a/openfut-adapter-fifa17/src/fut/squad_projection.rs +++ b/openfut-adapter-fifa17/src/fut/squad_projection.rs @@ -288,6 +288,7 @@ mod tests { item_id: 100000042, asset_id: 20801, resource_id: 20801, + rareflag: 1, }, )])); let input = one_slot_input(&owned, SquadExtInput::Fresh(fresh_ext())); @@ -361,6 +362,7 @@ mod tests { item_id: 100000030, asset_id: 101490, resource_id: 101490, + rareflag: 1, }, ), ( @@ -369,6 +371,7 @@ mod tests { item_id: 100000031, asset_id: 101490, resource_id: 101490, + rareflag: 1, }, ), ])); diff --git a/openfut-adapter-fifa17/tests/squad_projection.rs b/openfut-adapter-fifa17/tests/squad_projection.rs index c9904ed..d818b2f 100644 --- a/openfut-adapter-fifa17/tests/squad_projection.rs +++ b/openfut-adapter-fifa17/tests/squad_projection.rs @@ -111,6 +111,7 @@ fn oracle_tables() -> (HashMap, TableIdentity) { item_id: wire as u32, asset_id: asset, resource_id: asset, + rareflag: 1, }, ); } diff --git a/openfut-import-fifa17/src/lib.rs b/openfut-import-fifa17/src/lib.rs index ff8064a..97ac2d2 100644 --- a/openfut-import-fifa17/src/lib.rs +++ b/openfut-import-fifa17/src/lib.rs @@ -280,6 +280,10 @@ pub struct ObservedDefinition { /// pace, shooting, passing, dribbling, defending, physical (index 0..=5). pub attrs: [i64; 6], pub rarity: &'static str, + /// Observed FIFA wire `rareflag` (the card's rare/special TYPE, e.g. 3=inform, + /// 21..=24 = special programmes). Carried verbatim from the profile — the raw + /// integer, never a guessed marketing label — so specials render as specials. + pub rareflag: i64, /// Wire ids of the owned copies of this exact resourceId (preserved). pub wire_ids: Vec, } @@ -508,6 +512,7 @@ pub fn plan_definitions( team_id, attrs: attrs6.unwrap(), rarity: tier(rating), + rareflag: f.rareflag.unwrap_or(1), wire_ids, }); } @@ -899,12 +904,12 @@ pub fn emit_content( let content_pack = content_dir.join("fifa17-production-cards.json"); write_json_pretty(&content_pack, &defs)?; - // ---- PUBLIC: host identity catalog {card_id: {asset_id, version}} ---- + // ---- PUBLIC: host identity catalog {card_id: {asset_id, version, rareflag}} ---- let mut cards = serde_json::Map::new(); for d in &report.definitions.supported { cards.insert( d.card_id.clone(), - serde_json::json!({ "asset_id": d.asset_id, "version": d.version }), + serde_json::json!({ "asset_id": d.asset_id, "version": d.version, "rareflag": d.rareflag }), ); } let catalog = serde_json::json!({ diff --git a/openfut-utas-host/src/lib.rs b/openfut-utas-host/src/lib.rs index 758c72d..5b9e5b2 100644 --- a/openfut-utas-host/src/lib.rs +++ b/openfut-utas-host/src/lib.rs @@ -552,6 +552,7 @@ impl ItemIdentityResolver for Fifa17IdentityResolver { item_id: wire as u32, asset_id: ident.asset_id, resource_id: ident.resource_id, + rareflag: ident.rareflag, }) } }