Fix Rust formatting
Server integrations / Paper and protocol tests (push) Failing after 20s
Server integrations / fabric / 1.20.1 (push) Failing after 11s
Server integrations / fabric / 1.21.1 (push) Failing after 14s
Server integrations / fabric / 26.1.2 (push) Failing after 17s
Server integrations / fabric / 26.2 (push) Failing after 12s
Server integrations / fabric / 26.3 (push) Failing after 6s
Server integrations / forge / 1.20.1 (push) Failing after 6s
Server integrations / forge / 1.21.1 (push) Failing after 8s
Server integrations / forge / 26.1.2 (push) Failing after 8s
Server integrations / forge / 26.2 (push) Failing after 8s
Server integrations / forge / 26.3 (push) Failing after 7s
CI / Web UIs (type-check + build) (panel/web) (push) Canceled after 0s
CI / Launcher (Windows build check) (push) Canceled after 2m53s
CI / Real installs (Mojang, Fabric, Quilt, Forge, NeoForge) (push) Canceled after 0s
CI / Docker image builds (push) Canceled after 0s
CI / Rust (fmt, clippy, tests) (push) Canceled after 1m22s
CI / Web UIs (type-check + build) (launcher) (push) Canceled after 1m27s
Server integrations / Paper and protocol tests (push) Failing after 20s
Server integrations / fabric / 1.20.1 (push) Failing after 11s
Server integrations / fabric / 1.21.1 (push) Failing after 14s
Server integrations / fabric / 26.1.2 (push) Failing after 17s
Server integrations / fabric / 26.2 (push) Failing after 12s
Server integrations / fabric / 26.3 (push) Failing after 6s
Server integrations / forge / 1.20.1 (push) Failing after 6s
Server integrations / forge / 1.21.1 (push) Failing after 8s
Server integrations / forge / 26.1.2 (push) Failing after 8s
Server integrations / forge / 26.2 (push) Failing after 8s
Server integrations / forge / 26.3 (push) Failing after 7s
CI / Web UIs (type-check + build) (panel/web) (push) Canceled after 0s
CI / Launcher (Windows build check) (push) Canceled after 2m53s
CI / Real installs (Mojang, Fabric, Quilt, Forge, NeoForge) (push) Canceled after 0s
CI / Docker image builds (push) Canceled after 0s
CI / Rust (fmt, clippy, tests) (push) Canceled after 1m22s
CI / Web UIs (type-check + build) (launcher) (push) Canceled after 1m27s
This commit is contained in:
1 parent
ce49447b6e
commit
60edc99780
58 files changed
+3533
-1375
No files matched your search
@@ -29,12 +29,21 @@ async fn plugins_read_players_and_change_progress() {
|
||||
assert_eq!(call("player/info", json!({"uuid": "nope"})).await.0, StatusCode::BAD_REQUEST);
|
||||
|
||||
// Info: levels, balance, guild, quests.
|
||||
sqlx::query("INSERT INTO server_economy (server_id, uuid, username, balance, updated_at) VALUES (?, ?, 'Steve', 321.5, 'now')").bind(sid).bind(&steve).execute(&t.db).await.unwrap();
|
||||
let (_, g) = t.call("POST", "/api/v1/guilds", Some(&tokens[0]), Some(json!({"instance_id": "smp", "name": "Iron", "tag": "IRON"}))).await;
|
||||
sqlx::query("INSERT INTO server_economy (server_id, uuid, username, balance, updated_at) VALUES (?, ?, 'Steve', 321.5, 'now')")
|
||||
.bind(sid)
|
||||
.bind(&steve)
|
||||
.execute(&t.db)
|
||||
.await
|
||||
.unwrap();
|
||||
let (_, g) =
|
||||
t.call("POST", "/api/v1/guilds", Some(&tokens[0]), Some(json!({"instance_id": "smp", "name": "Iron", "tag": "IRON"}))).await;
|
||||
t.call("GET", "/api/v1/quests/my", Some(&tokens[0]), None).await;
|
||||
let (s, info) = call("player/info", json!({"uuid": steve})).await;
|
||||
assert_eq!(s, StatusCode::OK, "{info}");
|
||||
assert_eq!((info["name"].as_str(), info["balance"].as_f64(), info["guild"]["tag"].as_str(), info["guild"]["role"].as_str()), (Some("Steve"), Some(321.5), Some("IRON"), Some("leader")));
|
||||
assert_eq!(
|
||||
(info["name"].as_str(), info["balance"].as_f64(), info["guild"]["tag"].as_str(), info["guild"]["role"].as_str()),
|
||||
(Some("Steve"), Some(321.5), Some("IRON"), Some("leader"))
|
||||
);
|
||||
// Founding a guild unlocks an achievement worth XP, so the player starts above zero.
|
||||
let base = info["global"]["xp"].as_i64().unwrap();
|
||||
assert!(base > 0);
|
||||
@@ -53,21 +62,33 @@ async fn plugins_read_players_and_change_progress() {
|
||||
let (_, r) = call("player/xp", xp("x3", "global", -200)).await;
|
||||
assert_eq!(r["xp"].as_i64(), Some(base + 1000));
|
||||
assert_eq!(call("player/xp", xp("x4", "global", 0)).await.0, StatusCode::BAD_REQUEST);
|
||||
assert_eq!(call("player/xp", json!({"operation_id": "x5", "uuid": "00000000-0000-0000-0000-00000000dead", "amount": 5})).await.0, StatusCode::NOT_FOUND);
|
||||
assert_eq!(
|
||||
call("player/xp", json!({"operation_id": "x5", "uuid": "00000000-0000-0000-0000-00000000dead", "amount": 5})).await.0,
|
||||
StatusCode::NOT_FOUND
|
||||
);
|
||||
let (_, info) = call("player/info", json!({"uuid": steve})).await;
|
||||
assert_eq!((info["global"]["xp"].as_i64(), info["server"]["xp"].as_i64(), info["server"]["level"].as_i64()), (Some(base + 1000), Some(400), Some(2)));
|
||||
assert_eq!(
|
||||
(info["global"]["xp"].as_i64(), info["server"]["xp"].as_i64(), info["server"]["level"].as_i64()),
|
||||
(Some(base + 1000), Some(400), Some(2))
|
||||
);
|
||||
|
||||
// Quest objectives by quest id (complete it), and by action.
|
||||
let (_, quests) = t.call("GET", "/api/v1/quests/my", Some(&tokens[0]), None).await;
|
||||
let quest = quests.as_array().unwrap().iter().find(|q| q["quest"]["period"] == "daily").unwrap()["quest"]["id"].as_str().unwrap().to_string();
|
||||
let quest =
|
||||
quests.as_array().unwrap().iter().find(|q| q["quest"]["period"] == "daily").unwrap()["quest"]["id"].as_str().unwrap().to_string();
|
||||
let (s, r) = call("player/quest-objective", json!({"operation_id": "q1", "uuid": steve, "objective": quest, "amount": 0})).await;
|
||||
assert_eq!((s, r["advanced"].clone()), (StatusCode::OK, json!(true)), "{r}");
|
||||
let (_, quests) = t.call("GET", "/api/v1/quests/my", Some(&tokens[0]), None).await;
|
||||
let done = quests.as_array().unwrap().iter().find(|q| q["quest"]["id"] == quest.as_str()).unwrap();
|
||||
assert_eq!(done["completed"], true);
|
||||
let (_, r) = call("player/quest-objective", json!({"operation_id": "q2", "uuid": steve, "objective": "block_broken:DIAMOND_ORE@minecraft:overworld", "amount": 3})).await;
|
||||
let (_, r) = call(
|
||||
"player/quest-objective",
|
||||
json!({"operation_id": "q2", "uuid": steve, "objective": "block_broken:DIAMOND_ORE@minecraft:overworld", "amount": 3}),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(r["advanced"], true);
|
||||
let (_, r) = call("player/quest-objective", json!({"operation_id": "q3", "uuid": steve, "objective": "nothing:at_all", "amount": 3})).await;
|
||||
let (_, r) =
|
||||
call("player/quest-objective", json!({"operation_id": "q3", "uuid": steve, "objective": "nothing:at_all", "amount": 3})).await;
|
||||
assert_eq!(r["advanced"], false);
|
||||
let (_, info) = call("player/info", json!({"uuid": steve})).await;
|
||||
assert_eq!(info["quests"]["daily"]["completed"], 1);
|
||||
|
||||
Reference in new issue
Block a user