Browse Source

send better guildcard number

teams
jake 2 years ago
parent
commit
fba46dd0d8
  1. 6
      src/entity/account.rs
  2. 2
      src/ship/packet/builder/mod.rs
  3. 2
      src/ship/packet/handler/communication.rs
  4. 2
      src/ship/packet/handler/direct_message.rs

6
src/entity/account.rs

@ -2,6 +2,8 @@ use serde::{Serialize, Deserialize};
use libpso::character::settings;
use libpso::character::guildcard;
const GUILDCARD_OFFSET: u32 = 2300000;
pub const USERFLAG_NEWCHAR: u32 = 0x00000001;
pub const USERFLAG_DRESSINGROOM: u32 = 0x00000002;
@ -83,6 +85,10 @@ impl UserAccountEntity {
pub fn is_currently_online(&self) -> bool {
self.at_login | self.at_character | self.at_ship
}
pub fn guildcard(&self) -> u32 {
self.id.0 + GUILDCARD_OFFSET
}
}

2
src/ship/packet/builder/mod.rs

@ -15,7 +15,7 @@ use crate::ship::items::inventory::InventoryState;
pub fn player_header(tag: u32, client: &ClientState, area_client: &AreaClient) -> PlayerHeader {
PlayerHeader {
tag,
guildcard: client.user.id.0,
guildcard: client.user.guildcard(),
_unknown1: [0; 5],
client_id: area_client.local_client.id() as u32,
name: libpso::utf8_to_utf16_array!(client.character.name, 16),

2
src/ship/packet/handler/communication.rs

@ -12,7 +12,7 @@ pub async fn player_chat(id: ClientId,
clients: &Clients)
-> Result<Vec<(ClientId, SendShipPacket)>, ShipError> {
let cmsg = clients.with(id, |client| Box::pin(async move {
PlayerChat::new(client.user.id.0, msg.message)
PlayerChat::new(client.user.guildcard(), msg.message)
})).await?;
Ok(client_location.get_all_clients_by_client(id).await.unwrap().into_iter()

2
src/ship/packet/handler/direct_message.rs

@ -60,7 +60,7 @@ pub async fn guildcard_send(id: ClientId,
msg: GameMessage::GuildcardRecv(GuildcardRecv {
client: guildcard_send.client,
target: guildcard_send.target,
guildcard: client.user.id.0,
guildcard: client.user.guildcard(),
name: utf8_to_utf16_array!(client.character.name, 0x18),
team: [0; 0x10], // TODO: teams not yet implemented
desc: utf8_to_utf16_array!(client.character.guildcard.description, 0x58),

Loading…
Cancel
Save