style(adapter-fifa17): apply cargo fmt to fut store/pack/non_economy/club_stats
Pure rustfmt reflow; git diff -w confirms logic byte-identical (PACK_CATALOG values, pack tiers, item_def stubs unchanged). Builds clean. Retained WIP.
This commit is contained in:
@@ -379,7 +379,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn honest_zero_club_items_present() {
|
fn honest_zero_club_items_present() {
|
||||||
let g = global(&club_stats_body(&[player(90, false, None)], ContextField::Nation));
|
let g = global(&club_stats_body(
|
||||||
|
&[player(90, false, None)],
|
||||||
|
ContextField::Nation,
|
||||||
|
));
|
||||||
for atom in [
|
for atom in [
|
||||||
"stadia",
|
"stadia",
|
||||||
"balls",
|
"balls",
|
||||||
@@ -411,7 +414,10 @@ mod tests {
|
|||||||
.filter(|r| r["contextId"] == 3 && r["contextValue"] == 13)
|
.filter(|r| r["contextId"] == 3 && r["contextValue"] == 13)
|
||||||
.collect();
|
.collect();
|
||||||
assert_eq!(league_rows.len(), 6);
|
assert_eq!(league_rows.len(), 6);
|
||||||
let gold = league_rows.iter().find(|r| r["type"] == "playersGold").unwrap();
|
let gold = league_rows
|
||||||
|
.iter()
|
||||||
|
.find(|r| r["type"] == "playersGold")
|
||||||
|
.unwrap();
|
||||||
assert_eq!(gold["typeValue"], 1);
|
assert_eq!(gold["typeValue"], 1);
|
||||||
|
|
||||||
// league screen -> team (teamid) buckets: players/kits/badgeDBid (3 rows).
|
// league screen -> team (teamid) buckets: players/kits/badgeDBid (3 rows).
|
||||||
|
|||||||
@@ -67,12 +67,19 @@ pub fn feature_off_body() -> Value {
|
|||||||
pub fn item_def(resource_id: i64) -> Value {
|
pub fn item_def(resource_id: i64) -> Value {
|
||||||
let asset = resource_id & 0xff_ffff;
|
let asset = resource_id & 0xff_ffff;
|
||||||
// (name, rating, position, nation, leagueId, teamid, [6 attrs])
|
// (name, rating, position, nation, leagueId, teamid, [6 attrs])
|
||||||
let (name, rating, pos, nation, league, team, attrs): (&str, i64, &str, i64, i64, i64, [i64; 6]) =
|
let (name, rating, pos, nation, league, team, attrs): (
|
||||||
if asset == 20801 {
|
&str,
|
||||||
("Ronaldo", 94, "ST", 38, 53, 243, [90, 93, 82, 91, 33, 80])
|
i64,
|
||||||
} else {
|
&str,
|
||||||
("Player", 75, "CM", 0, 0, 0, [70, 70, 70, 70, 70, 70])
|
i64,
|
||||||
};
|
i64,
|
||||||
|
i64,
|
||||||
|
[i64; 6],
|
||||||
|
) = if asset == 20801 {
|
||||||
|
("Ronaldo", 94, "ST", 38, 53, 243, [90, 93, 82, 91, 33, 80])
|
||||||
|
} else {
|
||||||
|
("Player", 75, "CM", 0, 0, 0, [70, 70, 70, 70, 70, 70])
|
||||||
|
};
|
||||||
let attribute_list: Vec<Value> = attrs
|
let attribute_list: Vec<Value> = attrs
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
@@ -365,7 +372,11 @@ pub fn user_mass_info_body(
|
|||||||
pub fn format_utc_datetime(epoch_secs: i64) -> String {
|
pub fn format_utc_datetime(epoch_secs: i64) -> String {
|
||||||
let days = epoch_secs.div_euclid(86_400);
|
let days = epoch_secs.div_euclid(86_400);
|
||||||
let secs_of_day = epoch_secs.rem_euclid(86_400);
|
let secs_of_day = epoch_secs.rem_euclid(86_400);
|
||||||
let (hour, min, sec) = (secs_of_day / 3600, (secs_of_day % 3600) / 60, secs_of_day % 60);
|
let (hour, min, sec) = (
|
||||||
|
secs_of_day / 3600,
|
||||||
|
(secs_of_day % 3600) / 60,
|
||||||
|
secs_of_day % 60,
|
||||||
|
);
|
||||||
// civil_from_days: days is a count of days since 1970-01-01.
|
// civil_from_days: days is a count of days since 1970-01-01.
|
||||||
let z = days + 719_468;
|
let z = days + 719_468;
|
||||||
let era = if z >= 0 { z } else { z - 146_096 } / 146_097;
|
let era = if z >= 0 { z } else { z - 146_096 } / 146_097;
|
||||||
@@ -628,8 +639,14 @@ mod tests {
|
|||||||
});
|
});
|
||||||
let body = user_mass_info_body(squad, 29_859_876, 0, 33_068_179, "Real FUT", "RF", "2016");
|
let body = user_mass_info_body(squad, 29_859_876, 0, 33_068_179, "Real FUT", "RF", "2016");
|
||||||
// Flat top-level envelope.
|
// Flat top-level envelope.
|
||||||
assert_eq!(body["pileSizeClientData"]["entries"][0], json!({"key": 2, "value": 100}));
|
assert_eq!(
|
||||||
assert_eq!(body["pileSizeClientData"]["entries"][1], json!({"key": 4, "value": 50}));
|
body["pileSizeClientData"]["entries"][0],
|
||||||
|
json!({"key": 2, "value": 100})
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
body["pileSizeClientData"]["entries"][1],
|
||||||
|
json!({"key": 4, "value": 50})
|
||||||
|
);
|
||||||
assert_eq!(body["settings"], json!({"configs": []}));
|
assert_eq!(body["settings"], json!({"configs": []}));
|
||||||
assert_eq!(body["userData"], json!({}));
|
assert_eq!(body["userData"], json!({}));
|
||||||
// userInfo economy + club identity.
|
// userInfo economy + club identity.
|
||||||
|
|||||||
@@ -90,14 +90,30 @@ pub fn generate_pack_contents(
|
|||||||
}
|
}
|
||||||
let all: Vec<&GeneratedCandidate> = pool.iter().collect();
|
let all: Vec<&GeneratedCandidate> = pool.iter().collect();
|
||||||
let gold: Vec<&GeneratedCandidate> = pool.iter().filter(|c| c.rating >= 75).collect();
|
let gold: Vec<&GeneratedCandidate> = pool.iter().filter(|c| c.rating >= 75).collect();
|
||||||
let silver: Vec<&GeneratedCandidate> =
|
let silver: Vec<&GeneratedCandidate> = pool
|
||||||
pool.iter().filter(|c| (65..75).contains(&c.rating)).collect();
|
.iter()
|
||||||
|
.filter(|c| (65..75).contains(&c.rating))
|
||||||
|
.collect();
|
||||||
let bronze: Vec<&GeneratedCandidate> = pool.iter().filter(|c| c.rating < 65).collect();
|
let bronze: Vec<&GeneratedCandidate> = pool.iter().filter(|c| c.rating < 65).collect();
|
||||||
|
|
||||||
let mut out = Vec::with_capacity(pack.count() as usize);
|
let mut out = Vec::with_capacity(pack.count() as usize);
|
||||||
draw_tier(&mut out, &gold, &all, pack.n_gold, pack.special_chance, rng);
|
draw_tier(&mut out, &gold, &all, pack.n_gold, pack.special_chance, rng);
|
||||||
draw_tier(&mut out, &silver, &all, pack.n_silver, pack.special_chance, rng);
|
draw_tier(
|
||||||
draw_tier(&mut out, &bronze, &all, pack.n_bronze, pack.special_chance, rng);
|
&mut out,
|
||||||
|
&silver,
|
||||||
|
&all,
|
||||||
|
pack.n_silver,
|
||||||
|
pack.special_chance,
|
||||||
|
rng,
|
||||||
|
);
|
||||||
|
draw_tier(
|
||||||
|
&mut out,
|
||||||
|
&bronze,
|
||||||
|
&all,
|
||||||
|
pack.n_bronze,
|
||||||
|
pack.special_chance,
|
||||||
|
rng,
|
||||||
|
);
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,45 +68,153 @@ impl PackDef {
|
|||||||
/// never purchasable/openable.
|
/// never purchasable/openable.
|
||||||
pub const PACK_CATALOG: &[PackDef] = &[
|
pub const PACK_CATALOG: &[PackDef] = &[
|
||||||
// ── Bronze category ──
|
// ── Bronze category ──
|
||||||
PackDef { id: 1, name: "Bronze Pack", price: 400,
|
PackDef {
|
||||||
n_bronze: 10, n_silver: 2, n_gold: 0, rares: 1, category: "bronze",
|
id: 1,
|
||||||
special_chance: 0.01, owned_only: false },
|
name: "Bronze Pack",
|
||||||
PackDef { id: 2, name: "Premium Bronze Pack", price: 750,
|
price: 400,
|
||||||
n_bronze: 10, n_silver: 2, n_gold: 0, rares: 3, category: "bronze",
|
n_bronze: 10,
|
||||||
special_chance: 0.02, owned_only: false },
|
n_silver: 2,
|
||||||
|
n_gold: 0,
|
||||||
|
rares: 1,
|
||||||
|
category: "bronze",
|
||||||
|
special_chance: 0.01,
|
||||||
|
owned_only: false,
|
||||||
|
},
|
||||||
|
PackDef {
|
||||||
|
id: 2,
|
||||||
|
name: "Premium Bronze Pack",
|
||||||
|
price: 750,
|
||||||
|
n_bronze: 10,
|
||||||
|
n_silver: 2,
|
||||||
|
n_gold: 0,
|
||||||
|
rares: 3,
|
||||||
|
category: "bronze",
|
||||||
|
special_chance: 0.02,
|
||||||
|
owned_only: false,
|
||||||
|
},
|
||||||
// ── Silver category ──
|
// ── Silver category ──
|
||||||
PackDef { id: 3, name: "Silver Pack", price: 2500,
|
PackDef {
|
||||||
n_bronze: 1, n_silver: 11, n_gold: 0, rares: 1, category: "silver",
|
id: 3,
|
||||||
special_chance: 0.015, owned_only: false },
|
name: "Silver Pack",
|
||||||
PackDef { id: 4, name: "Premium Silver Pack", price: 3750,
|
price: 2500,
|
||||||
n_bronze: 1, n_silver: 11, n_gold: 0, rares: 3, category: "silver",
|
n_bronze: 1,
|
||||||
special_chance: 0.03, owned_only: false },
|
n_silver: 11,
|
||||||
|
n_gold: 0,
|
||||||
|
rares: 1,
|
||||||
|
category: "silver",
|
||||||
|
special_chance: 0.015,
|
||||||
|
owned_only: false,
|
||||||
|
},
|
||||||
|
PackDef {
|
||||||
|
id: 4,
|
||||||
|
name: "Premium Silver Pack",
|
||||||
|
price: 3750,
|
||||||
|
n_bronze: 1,
|
||||||
|
n_silver: 11,
|
||||||
|
n_gold: 0,
|
||||||
|
rares: 3,
|
||||||
|
category: "silver",
|
||||||
|
special_chance: 0.03,
|
||||||
|
owned_only: false,
|
||||||
|
},
|
||||||
// ── Gold category ──
|
// ── Gold category ──
|
||||||
PackDef { id: 5, name: "Gold Pack", price: 5000,
|
PackDef {
|
||||||
n_bronze: 0, n_silver: 2, n_gold: 10, rares: 1, category: "gold",
|
id: 5,
|
||||||
special_chance: 0.04, owned_only: false },
|
name: "Gold Pack",
|
||||||
PackDef { id: 6, name: "Premium Gold Pack", price: 7500,
|
price: 5000,
|
||||||
n_bronze: 0, n_silver: 2, n_gold: 10, rares: 3, category: "gold",
|
n_bronze: 0,
|
||||||
special_chance: 0.06, owned_only: false },
|
n_silver: 2,
|
||||||
|
n_gold: 10,
|
||||||
|
rares: 1,
|
||||||
|
category: "gold",
|
||||||
|
special_chance: 0.04,
|
||||||
|
owned_only: false,
|
||||||
|
},
|
||||||
|
PackDef {
|
||||||
|
id: 6,
|
||||||
|
name: "Premium Gold Pack",
|
||||||
|
price: 7500,
|
||||||
|
n_bronze: 0,
|
||||||
|
n_silver: 2,
|
||||||
|
n_gold: 10,
|
||||||
|
rares: 3,
|
||||||
|
category: "gold",
|
||||||
|
special_chance: 0.06,
|
||||||
|
owned_only: false,
|
||||||
|
},
|
||||||
// ── Reward (owned-only; opened from My Packs, never coin-purchasable) ──
|
// ── Reward (owned-only; opened from My Packs, never coin-purchasable) ──
|
||||||
PackDef { id: 70, name: "Reward Gold Pack", price: 0,
|
PackDef {
|
||||||
n_bronze: 0, n_silver: 0, n_gold: 11, rares: 11, category: "gold",
|
id: 70,
|
||||||
special_chance: 1.0, owned_only: true },
|
name: "Reward Gold Pack",
|
||||||
PackDef { id: 71, name: "Bronze Pack", price: 0,
|
price: 0,
|
||||||
n_bronze: 10, n_silver: 2, n_gold: 0, rares: 1, category: "bronze",
|
n_bronze: 0,
|
||||||
special_chance: 0.01, owned_only: true },
|
n_silver: 0,
|
||||||
PackDef { id: 72, name: "Silver Pack", price: 0,
|
n_gold: 11,
|
||||||
n_bronze: 1, n_silver: 11, n_gold: 0, rares: 1, category: "silver",
|
rares: 11,
|
||||||
special_chance: 0.02, owned_only: true },
|
category: "gold",
|
||||||
PackDef { id: 73, name: "Gold Pack", price: 0,
|
special_chance: 1.0,
|
||||||
n_bronze: 0, n_silver: 2, n_gold: 10, rares: 1, category: "gold",
|
owned_only: true,
|
||||||
special_chance: 0.05, owned_only: true },
|
},
|
||||||
PackDef { id: 74, name: "Rare Gold Pack", price: 0,
|
PackDef {
|
||||||
n_bronze: 0, n_silver: 2, n_gold: 10, rares: 3, category: "gold",
|
id: 71,
|
||||||
special_chance: 0.10, owned_only: true },
|
name: "Bronze Pack",
|
||||||
PackDef { id: 75, name: "Icon Pack", price: 0,
|
price: 0,
|
||||||
n_bronze: 0, n_silver: 0, n_gold: 12, rares: 12, category: "gold",
|
n_bronze: 10,
|
||||||
special_chance: 1.0, owned_only: true },
|
n_silver: 2,
|
||||||
|
n_gold: 0,
|
||||||
|
rares: 1,
|
||||||
|
category: "bronze",
|
||||||
|
special_chance: 0.01,
|
||||||
|
owned_only: true,
|
||||||
|
},
|
||||||
|
PackDef {
|
||||||
|
id: 72,
|
||||||
|
name: "Silver Pack",
|
||||||
|
price: 0,
|
||||||
|
n_bronze: 1,
|
||||||
|
n_silver: 11,
|
||||||
|
n_gold: 0,
|
||||||
|
rares: 1,
|
||||||
|
category: "silver",
|
||||||
|
special_chance: 0.02,
|
||||||
|
owned_only: true,
|
||||||
|
},
|
||||||
|
PackDef {
|
||||||
|
id: 73,
|
||||||
|
name: "Gold Pack",
|
||||||
|
price: 0,
|
||||||
|
n_bronze: 0,
|
||||||
|
n_silver: 2,
|
||||||
|
n_gold: 10,
|
||||||
|
rares: 1,
|
||||||
|
category: "gold",
|
||||||
|
special_chance: 0.05,
|
||||||
|
owned_only: true,
|
||||||
|
},
|
||||||
|
PackDef {
|
||||||
|
id: 74,
|
||||||
|
name: "Rare Gold Pack",
|
||||||
|
price: 0,
|
||||||
|
n_bronze: 0,
|
||||||
|
n_silver: 2,
|
||||||
|
n_gold: 10,
|
||||||
|
rares: 3,
|
||||||
|
category: "gold",
|
||||||
|
special_chance: 0.10,
|
||||||
|
owned_only: true,
|
||||||
|
},
|
||||||
|
PackDef {
|
||||||
|
id: 75,
|
||||||
|
name: "Icon Pack",
|
||||||
|
price: 0,
|
||||||
|
n_bronze: 0,
|
||||||
|
n_silver: 0,
|
||||||
|
n_gold: 12,
|
||||||
|
rares: 12,
|
||||||
|
category: "gold",
|
||||||
|
special_chance: 1.0,
|
||||||
|
owned_only: true,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Look up a catalogue pack by id (the 65534 sentinel is never present).
|
/// Look up a catalogue pack by id (the 65534 sentinel is never present).
|
||||||
|
|||||||
Reference in New Issue
Block a user