Skip to content

Commit

Permalink
Add support for WOT 1.16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rajesh-rahul committed Apr 19, 2022
1 parent c4ca9b0 commit 0ced336
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 4 deletions.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions datfile_parser/src/cli/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ pub fn write_battle(battle: Battle, path: &str) {
#[test]
fn datfile_parser_test() {
let parser = DatFileParser::new();
let battles = parse_dir(Path::new("input_files"), &parser).unwrap();
// battles.append(&mut parse_dir(Path::new("input_files/other"), &parser).unwrap());

let mut battles = parse_dir(Path::new("input_files"), &parser).unwrap();
battles.append(&mut parse_dir(Path::new("input_files/other"), &parser).unwrap());
battles.append(&mut parse_dir(Path::new("input_files/WOT_1_16_1"), &parser).unwrap());
battles.iter().for_each(|battle| {
assert!(serde_json::to_string_pretty(battle).is_ok());
});
Expand Down
2 changes: 2 additions & 0 deletions datfile_parser/src/lib/battle_results/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl Default for BattleResultsManager {
}
}
impl BattleResultsManager {
// TODO: Too much to change when a new gamemode is added
pub fn new() -> Self {
let mut fields_collection = HashMap::new();

Expand All @@ -28,6 +29,7 @@ impl BattleResultsManager {
fields_collection.insert(ArenaBonusType::BattleRoyaleSolo,Collection::new(ArenaBonusType::BattleRoyaleSolo),);
fields_collection.insert(ArenaBonusType::MapsTraining,Collection::new(ArenaBonusType::MapsTraining),);
fields_collection.insert(ArenaBonusType::EpicBattle,Collection::new(ArenaBonusType::EpicBattle),);
fields_collection.insert(ArenaBonusType::Rts,Collection::new(ArenaBonusType::Rts),);
fields_collection.insert(ArenaBonusType::Unknown,Collection::new(ArenaBonusType::Unknown),);

fields_collection.iter_mut().for_each(|item| {
Expand Down
1 change: 1 addition & 0 deletions standard_format/src/account_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct AccountSelf {
crystal: i32,
player_rank: i32,
gold_bank_gain: i32,
replay_url: String,

// Steel Hunter?
max_achieved_br_title: serde_json::Value,
Expand Down
1 change: 1 addition & 0 deletions standard_format/src/vehicle_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct VehicleAll {
destructibles_num_destroyed: i32,
destructibles_damage_dealt: i32,
destructibles_hits: i32,
destructible_deaths: serde_json::Value,
num_defended: i32,
type_comp_descr: i32,
account_dbid: u64,
Expand Down
1 change: 1 addition & 0 deletions standard_format/src/vehicle_self.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub struct VehicleSelf {
destructibles_num_destroyed: i32,
destructibles_damage_dealt: i32,
destructibles_hits: i32,
destructible_deaths: serde_json::Value,
num_defended: i32,
account_dbid: u64,
type_comp_descr: i32,
Expand Down
5 changes: 5 additions & 0 deletions wot_constants/src/arena_bonus_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ pub enum ArenaBonusType {
WeekendBrawl = 36,
Mapbox = 37,
MapsTraining = 38,

/// `Rts` is the Art of Strategy Gameode
Rts = 39,
Rts1x1 = 40,
RtsBootcamp = 41
}
22 changes: 22 additions & 0 deletions wot_constants/src/battle_results/battle_result_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,26 @@ pub const RANKED: &[Field] = &[
];


pub const RTS: &[Field] = &[
Field { name: "teamXP", default: FieldDefault::Int(0), combined_string: "teamXP<type 'int'>0<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
Field { name: "isCommander", default: FieldDefault::Bool(false), combined_string: "isCommander<type 'bool'>False<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
Field { name: "rtsVehicles", default: FieldDefault::List, combined_string: "rtsVehicles<type 'list'>[]<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
Field { name: "rts1x7TokensGain", default: FieldDefault::Int(0), combined_string: "rts1x7TokensGain<type 'int'>0<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
Field { name: "rts1x1TokensGain", default: FieldDefault::Int(0), combined_string: "rts1x1TokensGain<type 'int'>0<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
Field { name: "rts1x7TokensWithdraw", default: FieldDefault::Int(0), combined_string: "rts1x7TokensWithdraw<type 'int'>0<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
Field { name: "rts1x1TokensWithdraw", default: FieldDefault::Int(0), combined_string: "rts1x1TokensWithdraw<type 'int'>0<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
Field { name: "supplyDamageDealt", default: FieldDefault::Int(0), combined_string: "supplyDamageDealt<type 'int'>0<type 'NoneType'>sum", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "damageReceivedFromSupply", default: FieldDefault::Int(0), combined_string: "damageReceivedFromSupply<type 'int'>0<type 'NoneType'>sum", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "rtsEventPoints", default: FieldDefault::Int(0), combined_string: "rtsEventPoints<type 'int'>0<type 'NoneType'>sum", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "rtsLeaderPoints", default: FieldDefault::Int(0), combined_string: "rtsLeaderPoints<type 'int'>0<type 'NoneType'>sum", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "spottedSupplies", default: FieldDefault::Int(0), combined_string: "spottedSupplies<type 'int'>0<type 'NoneType'>sum", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "damagedSupplies", default: FieldDefault::Set, combined_string: "damagedSupplies<type 'set'>set([])<type 'NoneType'>joinSets", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "killedSupplies", default: FieldDefault::Int(0), combined_string: "killedSupplies<type 'int'>0<type 'NoneType'>sum", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "damagedTanks", default: FieldDefault::Set, combined_string: "damagedTanks<type 'set'>set([])<type 'NoneType'>joinSets", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "rtsOrdersCount", default: FieldDefault::Int(0), combined_string: "rtsOrdersCount<type 'int'>0<type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::Server },
];


pub const ALL_TYPES: &[Field] = &[
Field { name: "health", default: FieldDefault::Int(0), combined_string: "health<type 'int'>0<type 'NoneType'>skip", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "maxHealth", default: FieldDefault::Int(0), combined_string: "maxHealth<type 'int'>0<type 'NoneType'>skip", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Expand Down Expand Up @@ -136,6 +156,7 @@ pub const ALL_TYPES: &[Field] = &[
Field { name: "destructiblesNumDestroyed", default: FieldDefault::Int(0), combined_string: "destructiblesNumDestroyed<type 'int'>0<type 'NoneType'>sum", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "destructiblesDamageDealt", default: FieldDefault::Int(0), combined_string: "destructiblesDamageDealt<type 'int'>0<type 'NoneType'>sum", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "destructiblesHits", default: FieldDefault::Int(0), combined_string: "destructiblesHits<type 'int'>0<type 'NoneType'>sum", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "destructibleDeaths", default: FieldDefault::List, combined_string: "destructibleDeaths<type 'list'>[]<type 'NoneType'>extend", version: 3, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "numDefended", default: FieldDefault::Int(0), combined_string: "numDefended<type 'int'>0<type 'NoneType'>sum", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "accountDBID", default: FieldDefault::Int(0), combined_string: "accountDBID<type 'int'>0<type 'NoneType'>any", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Field { name: "typeCompDescr", default: FieldDefault::Int(0), combined_string: "typeCompDescr<type 'int'>0<type 'NoneType'>skip", version: 0, max_version: 0, field_type: FieldType::VehicleAll },
Expand Down Expand Up @@ -456,4 +477,5 @@ pub const ALL_TYPES: &[Field] = &[
Field { name: "setupsIndexes", default: FieldDefault::Dict, combined_string: "setupsIndexes<type 'dict'>{}<type 'NoneType'>any", version: 0, max_version: 0, field_type: FieldType::VehicleSelf },
Field { name: "startAmmo", default: FieldDefault::List, combined_string: "startAmmo<type 'list'>[]<type 'NoneType'>skip", version: 0, max_version: 0, field_type: FieldType::Server },
Field { name: "initialVehicleAmmo", default: FieldDefault::List, combined_string: "initialVehicleAmmo<type 'list'>[]<type 'NoneType'>skip", version: 0, max_version: 0, field_type: FieldType::Server },
Field { name: "replayURL", default: FieldDefault::Str, combined_string: "replayURL<type 'str'><type 'NoneType'>skip", version: 3, max_version: 0, field_type: FieldType::AccountSelf },
];
5 changes: 4 additions & 1 deletion wot_constants/src/battle_results/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use unpickler::PickleValue;

use crate::ArenaBonusType;

pub use battle_result_fields::{RANDOM_ARENA, RANKED, FRONTLINE, BATTLE_ROYALE, MAPS_TRAINING, ALL_TYPES};
pub use battle_result_fields::{RANDOM_ARENA, RANKED, FRONTLINE, BATTLE_ROYALE, MAPS_TRAINING, RTS, ALL_TYPES, };

#[derive(Clone)]
/// A data structure that holds information about a field found in battle results.
Expand Down Expand Up @@ -102,6 +102,9 @@ impl ArenaBonusType {
ArenaBonusType::BattleRoyaleSolo => Some(BATTLE_ROYALE),
ArenaBonusType::BattleRoyaleSquad => Some(BATTLE_ROYALE),
ArenaBonusType::MapsTraining => Some(MAPS_TRAINING),
ArenaBonusType::Rts => Some(RTS),
ArenaBonusType::Rts1x1 => Some(RTS),
ArenaBonusType::RtsBootcamp => Some(RTS),
_ => None
}
}
Expand Down

0 comments on commit 0ced336

Please sign in to comment.