fix(fifa17): carry observed rareflag so special cards render as specials
shape_item hardcoded rareflag=1, so all 1949 cards shaped as basic rare gold regardless of type; informs/specials lost their card art. The dev fixture is base-only, so this was invisible until the real profile (10 distinct rareflag values) exposed it on .105. rareflag is definition-level FIFA identity metadata OBSERVED from the profile (the raw wire integer, never a guessed marketing label), so it lives in the FIFA catalog like asset_id/version, not in generic Core: - ObservedDefinition.rareflag + emitted into the production catalog entry. - Fifa17CardCatalog RawCard/Fifa17CardIdentity gain rareflag (default 1 when a base-only catalog omits it, preserving prior wire behaviour). - Fifa17Identity.rareflag; host resolver populates it from the catalog. - shape_item emits id.rareflag instead of a hardcoded 1. Verified on the real staged /club: wire rareflag distribution == source exactly (0 per-item mismatches across 1949; e.g. rareflag 3 x591, 24 x302, 21 x256). adapter 111 + host 24 + importer 25 tests green; clippy -D clean. rareflag lives in the host catalog, not Core, so no re-import was needed.
This commit is contained in:
@@ -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,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
),
|
||||
]));
|
||||
|
||||
Reference in New Issue
Block a user