Open sean-abbott opened 10 months ago
Also I tried
fn main() {
let report = r#"
Defeat in the [Domination] Abandoned factory mission!
Destruction of ground vehicles and fleets 2 3630 SL 280 RP
3:17 Challenger Panther D 1210 + (PA)605 = 1815 SL 70 + (PA)70 = 140 RP
3:58 Challenger T-34-85 (D-5T) 1210 + (PA)605 = 1815 SL 70 + (PA)70 = 140 RP
Critical damage to the enemy 3 546 SL 44 RP
3:17 Challenger Panther D 121 + (PA)61 = 182 SL 7 + (PA)7 = 14 RP
3:24 Challenger T-34-85 (D-5T) 121 + (PA)61 = 182 SL 7 + (PA)7 = 14 RP
4:29 Challenger IS-2() 121 + (PA)61 = 182 SL 8 + (PA)8 = 16 RP
Damage to the enemy 7 653 SL 56 RP
3:17 Challenger Panther D 61 + (PA)31 = 92 SL 4 + (PA)4 = 8 RP
3:24 Challenger T-34-85 (D-5T) 61 + (PA)31 = 92 SL 4 + (PA)4 = 8 RP
3:58 Challenger T-34-85 (D-5T) 61 + (PA)31 = 92 SL 4 + (PA)4 = 8 RP
4:29 Challenger IS-2() 61 + (PA)31 = 92 SL 4 + (PA)4 = 8 RP
4:37 Challenger IS-2() 61 + (PA)31 = 92 SL 4 + (PA)4 = 8 RP
4:46 Challenger IS-2() 61 + (PA)31 = 92 SL 4 + (PA)4 = 8 RP
6:59 Comet I T-34-85 (D-5T) 67 + (PA)34 = 101 SL 4 + (PA)4 = 8 RP
Activity Time 2 1588 SL 154 RP
7:14 Challenger 770 + (PA)770 = 1540 SL 75 + (PA)75 = 150 RP
7:14 Comet I 24 + (PA)24 = 48 SL 2 + (PA)2 = 4 RP
Time Played 3 672 RP
Brigand B 1 26% 0:57 21 + (PA)21 = 42 RP
Challenger 90% 4:02 305 + (PA)305 = 610 RP
Comet I 34% 0:20 10 + (PA)10 = 20 RP
Reward for participating in the mission 1284 SL
Earned: 7701 SL, 1206 CRP
Activity: 76%
Damaged Vehicles: Challenger, Comet I, Brigand B 1
Automatic repair of all vehicles: -1403 SL
Automatic purchasing of ammo and "Crew Replenishment": -380 SL
Researched unit:
Lancaster B Mk I: 42 RP
Caernarvon: 464 RP
Researching progress:
Brigand B 1 - Fuselage repair: 42 RP
Challenger - Engine: 1132 RP
Comet I - Shot SV Mk.1: 32 RP
Session: 213c07800070d52
Total: 5918 SL, 1206 CRP, 1712 RP
"#;
let battle_report = wt_battle_report::from_str(report).unwrap();
println!("{:#?}", battle_report);
}
But I get
thread 'main' panicked at src/main.rs:52:60:
called `Result::unwrap()` on an `Err` value: Error { message: "0: at line 1, in Tag:\n\n^\n\n1: at line 1, in Alt:\n\n^\n\n2: at line 1, in first line:\n\n^\n\n" }
(I also get this when I set this up as a loop that'll listen to pasted input)
And I'm not good enough at rust to dig in and figure out what's happening.
Looks like it's reading an extra chacter in a serious of new lines? but I can't ind it.
Hello,
I apologize for the delayed response. It's been some time since I last engaged with this project, primarily because I haven't played War Thunder in several months and currently have no plans to do so. However, I'm still open to maintaining the parser if it's needed.
Regarding your issue, please try deleting the initial empty line. The parser is designed to interpret the first character as the start of the report (Defeat in the [Domination] Abandoned factory mission!
).
If you need further assistance, feel free to reach out to me on Discord at chronophylos
.
Sent a friend request since I don't use discord much and couldn't figure out how to DM absent you being in my friends list.
Are you using this for anything?
I've started building something similar in python, but my goal is to have it running in the command line.
My plan is: I paste in the report, hit enter. It parses the report, and writes out the results to a sqlite database. Over time, I'll be able to use the database to ask questions like "what lineup have I gotten the most kills of heavy tanks with"
Currently I have the loop and am parsing the first line. :-) Obviously you're much further along.
I haven't written much rust, but if we can get to similar goals might be more fun to work together.