mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Fix clan info not being provided in battle loading screen; fix #132
This commit is contained in:
@@ -21,6 +21,7 @@ pub struct PlayerData {
|
|||||||
pub death_effect: String,
|
pub death_effect: String,
|
||||||
pub player_rank: i32,
|
pub player_rank: i32,
|
||||||
pub weapon_rank: std::collections::HashMap<i32, i32>,
|
pub weapon_rank: std::collections::HashMap<i32, i32>,
|
||||||
|
pub clan_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlayerData {
|
impl PlayerData {
|
||||||
@@ -61,7 +62,7 @@ impl PlayerData {
|
|||||||
val_ty: polariton::serdes::TypePrefix::Int,
|
val_ty: polariton::serdes::TypePrefix::Int,
|
||||||
items: self.weapon_rank.clone().into_iter().map(|(k, v)| (Typed::Int(k), Typed::Int(v))).collect(),
|
items: self.weapon_rank.clone().into_iter().map(|(k, v)| (Typed::Int(k), Typed::Int(v))).collect(),
|
||||||
});
|
});
|
||||||
Typed::HashMap(vec![
|
let mut entries = vec![
|
||||||
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
|
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
|
||||||
(Typed::Str("displayName".into()), Typed::Str(self.display_name.clone().into())),
|
(Typed::Str("displayName".into()), Typed::Str(self.display_name.clone().into())),
|
||||||
(Typed::Str("robotName".into()), Typed::Str(self.robot_name.clone().into())),
|
(Typed::Str("robotName".into()), Typed::Str(self.robot_name.clone().into())),
|
||||||
@@ -83,11 +84,13 @@ impl PlayerData {
|
|||||||
(Typed::Str("playerRank".into()), Typed::Int(self.player_rank)),
|
(Typed::Str("playerRank".into()), Typed::Int(self.player_rank)),
|
||||||
(Typed::Str("weaponRanks".into()), weapon_ranks),
|
(Typed::Str("weaponRanks".into()), weapon_ranks),
|
||||||
(Typed::Str("isAI".into()), Typed::Bool(self.is_ai)),
|
(Typed::Str("isAI".into()), Typed::Bool(self.is_ai)),
|
||||||
// only required if clanName exists
|
];
|
||||||
/*(Typed::Str("clanName".into()), Typed::Str(todo!())),
|
if let Some(clan_name) = &self.clan_name {
|
||||||
(Typed::Str("clanUseCustomAvatar".into()), Typed::Bool(todo!())),
|
entries.push((Typed::Str("clanName".into()), Typed::Str(clan_name.into())));
|
||||||
(Typed::Str("clanDefaultAvatarID".into()), Typed::Int(todo!())),*/
|
entries.push((Typed::Str("clanUseCustomAvatar".into()), Typed::Bool(true)));
|
||||||
].into())
|
entries.push((Typed::Str("clanDefaultAvatarID".into()), Typed::Int(0)));
|
||||||
|
}
|
||||||
|
Typed::HashMap(entries.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -472,6 +472,10 @@ impl UserData {
|
|||||||
} else {
|
} else {
|
||||||
current_slot.total_robot_cpu
|
current_slot.total_robot_cpu
|
||||||
};
|
};
|
||||||
|
let clan_opt = self.db.clan_by_user_id(self.account.id).await.map_err(|e| {
|
||||||
|
log::error!("Failed to retrieve clan for user_id {} (user_player_data): {}", self.account.id, e);
|
||||||
|
polariton_server::operations::SimpleOpError::with_message(DATABASE_ERR, format!("Could not retrieve clan: {}", e))
|
||||||
|
})?;
|
||||||
|
|
||||||
Ok(crate::data::player_data::PlayerData {
|
Ok(crate::data::player_data::PlayerData {
|
||||||
name: user_uuid,
|
name: user_uuid,
|
||||||
@@ -493,6 +497,7 @@ impl UserData {
|
|||||||
death_effect: current_slot.death_animation_id,
|
death_effect: current_slot.death_animation_id,
|
||||||
player_rank: 1, // FIXME
|
player_rank: 1, // FIXME
|
||||||
weapon_rank: weapon_ranks,
|
weapon_rank: weapon_ranks,
|
||||||
|
clan_name: clan_opt.map(|(clan, _member)| clan.name),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,6 +687,7 @@ impl UserData {
|
|||||||
death_effect: enemy_vehicle.death_effect,
|
death_effect: enemy_vehicle.death_effect,
|
||||||
player_rank: 1,
|
player_rank: 1,
|
||||||
weapon_rank: weapon_ranks,
|
weapon_rank: weapon_ranks,
|
||||||
|
clan_name: None,
|
||||||
};
|
};
|
||||||
next_id += 1;
|
next_id += 1;
|
||||||
players.push(enemy);
|
players.push(enemy);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ impl UserData {
|
|||||||
death_effect: vehicle.death_effect,
|
death_effect: vehicle.death_effect,
|
||||||
player_rank: 1,
|
player_rank: 1,
|
||||||
weapon_rank: vehicle.weapon_rank,
|
weapon_rank: vehicle.weapon_rank,
|
||||||
|
clan_name: None,
|
||||||
},
|
},
|
||||||
fake.implementation
|
fake.implementation
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user