[Mapper] Map FIFA 23 Objectives and SBC Endpoints #3

Open
opened 2026-06-26 05:05:38 +00:00 by funman300 · 0 comments
Owner

Overview

Add mapper entries in src/mapper.rs and response shapers in src/shaper.rs for the Objectives and SBC endpoints that EA uses in FIFA 23 FUT.

EA → Core Endpoint Table

EA Endpoint Core Endpoint Notes
GET /ut/game/fut/user/dynamicobjectives GET /objectives Weekly/daily objective list
POST /ut/game/fut/user/dynamicobjectives/{id}/milestones/{m}/claim POST /objectives/:id/claim Claim reward
GET /ut/game/fut/sbs/challenges GET /sbc SBC list
POST /ut/game/fut/sbs/challenges/{id}/sets/{setId}/trade POST /sbc Submit SBC trade
GET /ut/game/fut/sbs/challenges/{id} GET /sbc/:id Single SBC detail

Implementation Steps

1. Add objectives routes to src/mapper.rs

In the map_request function:

// List objectives
("GET", path) if path.starts_with("/ut/game/fut/user/dynamicobjectives")
    && !path.contains("milestones") => {
    Some(MappedRoute { core_path: "/objectives".into(), method: Method::GET })
}
// Claim objective reward
("POST", path) if path.contains("/dynamicobjectives/") && path.contains("/claim") => {
    // Extract objective ID between "dynamicobjectives/" and "/milestones"
    let obj_id = extract_segment_between(path, "dynamicobjectives/", "/milestones");
    Some(MappedRoute { core_path: format!("/objectives/{}/claim", obj_id), method: Method::POST })
}

2. Add SBC routes to src/mapper.rs

// SBC list
("GET", "/ut/game/fut/sbs/challenges") => {
    Some(MappedRoute { core_path: "/sbc".into(), method: Method::GET })
}
// Submit SBC
("POST", path) if path.contains("/sbs/challenges/") && path.contains("/trade") => {
    Some(MappedRoute { core_path: "/sbc".into(), method: Method::POST })
}
// Single SBC
("GET", path) if path.starts_with("/ut/game/fut/sbs/challenges/") => {
    let sbc_id = path.trim_start_matches("/ut/game/fut/sbs/challenges/");
    Some(MappedRoute { core_path: format!("/sbc/{}", sbc_id), method: Method::GET })
}

3. Add response shaping in src/shaper.rs

Objectives — shape Core's response into the EA envelope:

pub fn shape_objectives(core_resp: serde_json::Value) -> serde_json::Value {
    json!({
        "challenges": core_resp["objectives"],
        "version": 1
    })
}

SBC list:

pub fn shape_sbc_list(core_resp: serde_json::Value) -> serde_json::Value {
    json!({
        "SBCSetSummary": {
            "challenges": core_resp["sbcs"]
        }
    })
}

SBC claim:

pub fn shape_sbc_submit(core_resp: serde_json::Value) -> serde_json::Value {
    json!({ "SBCTrade": { "tradeId": 0, "tradeState": "active" } })
}

4. Register shapers in src/proxy.rs

Add the new endpoint paths to the shaper dispatch table alongside the existing auth/squad/pack entries.

5. Add mapper unit tests

In tests/mapper_tests.rs (or existing mapper test file):

  • map_request("GET", "/ut/game/fut/user/dynamicobjectives")GET /objectives
  • map_request("POST", "/ut/game/fut/user/dynamicobjectives/obj_1/milestones/1/claim")POST /objectives/obj_1/claim
  • map_request("GET", "/ut/game/fut/sbs/challenges")GET /sbc
  • map_request("POST", "/ut/game/fut/sbs/challenges/sbc_1/sets/1/trade")POST /sbc
  • map_request("GET", "/ut/game/fut/sbs/challenges/sbc_1")GET /sbc/sbc_1

6. Add shaper unit tests

  • shape_objectives(core_json) → result has challenges key
  • shape_sbc_list(core_json) → result has SBCSetSummary.challenges key

Acceptance Criteria

  • All objectives EA routes are mapped
  • All SBC EA routes are mapped
  • Response shapers produce valid EA-format envelopes
  • All new unit tests pass
  • cargo clippy -- -D warnings passes
## Overview Add mapper entries in `src/mapper.rs` and response shapers in `src/shaper.rs` for the Objectives and SBC endpoints that EA uses in FIFA 23 FUT. ## EA → Core Endpoint Table | EA Endpoint | Core Endpoint | Notes | |-------------|--------------|-------| | `GET /ut/game/fut/user/dynamicobjectives` | `GET /objectives` | Weekly/daily objective list | | `POST /ut/game/fut/user/dynamicobjectives/{id}/milestones/{m}/claim` | `POST /objectives/:id/claim` | Claim reward | | `GET /ut/game/fut/sbs/challenges` | `GET /sbc` | SBC list | | `POST /ut/game/fut/sbs/challenges/{id}/sets/{setId}/trade` | `POST /sbc` | Submit SBC trade | | `GET /ut/game/fut/sbs/challenges/{id}` | `GET /sbc/:id` | Single SBC detail | ## Implementation Steps ### 1. Add objectives routes to `src/mapper.rs` In the `map_request` function: ```rust // List objectives ("GET", path) if path.starts_with("/ut/game/fut/user/dynamicobjectives") && !path.contains("milestones") => { Some(MappedRoute { core_path: "/objectives".into(), method: Method::GET }) } // Claim objective reward ("POST", path) if path.contains("/dynamicobjectives/") && path.contains("/claim") => { // Extract objective ID between "dynamicobjectives/" and "/milestones" let obj_id = extract_segment_between(path, "dynamicobjectives/", "/milestones"); Some(MappedRoute { core_path: format!("/objectives/{}/claim", obj_id), method: Method::POST }) } ``` ### 2. Add SBC routes to `src/mapper.rs` ```rust // SBC list ("GET", "/ut/game/fut/sbs/challenges") => { Some(MappedRoute { core_path: "/sbc".into(), method: Method::GET }) } // Submit SBC ("POST", path) if path.contains("/sbs/challenges/") && path.contains("/trade") => { Some(MappedRoute { core_path: "/sbc".into(), method: Method::POST }) } // Single SBC ("GET", path) if path.starts_with("/ut/game/fut/sbs/challenges/") => { let sbc_id = path.trim_start_matches("/ut/game/fut/sbs/challenges/"); Some(MappedRoute { core_path: format!("/sbc/{}", sbc_id), method: Method::GET }) } ``` ### 3. Add response shaping in `src/shaper.rs` Objectives — shape Core's response into the EA envelope: ```rust pub fn shape_objectives(core_resp: serde_json::Value) -> serde_json::Value { json!({ "challenges": core_resp["objectives"], "version": 1 }) } ``` SBC list: ```rust pub fn shape_sbc_list(core_resp: serde_json::Value) -> serde_json::Value { json!({ "SBCSetSummary": { "challenges": core_resp["sbcs"] } }) } ``` SBC claim: ```rust pub fn shape_sbc_submit(core_resp: serde_json::Value) -> serde_json::Value { json!({ "SBCTrade": { "tradeId": 0, "tradeState": "active" } }) } ``` ### 4. Register shapers in `src/proxy.rs` Add the new endpoint paths to the shaper dispatch table alongside the existing auth/squad/pack entries. ### 5. Add mapper unit tests In `tests/mapper_tests.rs` (or existing mapper test file): - `map_request("GET", "/ut/game/fut/user/dynamicobjectives")` → `GET /objectives` - `map_request("POST", "/ut/game/fut/user/dynamicobjectives/obj_1/milestones/1/claim")` → `POST /objectives/obj_1/claim` - `map_request("GET", "/ut/game/fut/sbs/challenges")` → `GET /sbc` - `map_request("POST", "/ut/game/fut/sbs/challenges/sbc_1/sets/1/trade")` → `POST /sbc` - `map_request("GET", "/ut/game/fut/sbs/challenges/sbc_1")` → `GET /sbc/sbc_1` ### 6. Add shaper unit tests - `shape_objectives(core_json)` → result has `challenges` key - `shape_sbc_list(core_json)` → result has `SBCSetSummary.challenges` key ## Acceptance Criteria - [ ] All objectives EA routes are mapped - [ ] All SBC EA routes are mapped - [ ] Response shapers produce valid EA-format envelopes - [ ] All new unit tests pass - [ ] `cargo clippy -- -D warnings` passes
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/OpenFUT-Bridge#3