From 43a94b4643729e60670207ed74a63f5736629fa2 Mon Sep 17 00:00:00 2001
From: Andy Newjack <andynewjack@protonmail.com>
Date: Sun, 22 Mar 2020 22:17:52 -0300
Subject: [PATCH] guildcard send/recv

---
 src/character/guildcard.rs |  4 ++--
 src/packet/messages.rs     | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/character/guildcard.rs b/src/character/guildcard.rs
index 6c456c9..054ad0c 100644
--- a/src/character/guildcard.rs
+++ b/src/character/guildcard.rs
@@ -69,7 +69,7 @@ pub struct GuildCard {
     pub language: u8,
     pub section_id: u8,
     pub class: u8,
-    pub paddding: u32,
+    pub padding: u32,
     pub comment: [u16; 0x58],
 }
 
@@ -85,7 +85,7 @@ impl Default for GuildCard {
             language: 0,
             section_id: 0,
             class: 0,
-            paddding: 0,
+            padding: 0,
             comment: [0; 0x58],
         }
     }
diff --git a/src/packet/messages.rs b/src/packet/messages.rs
index 278fe13..68ec3b6 100644
--- a/src/packet/messages.rs
+++ b/src/packet/messages.rs
@@ -199,6 +199,23 @@ pub struct PlayerTrapActivate {
 
 }
 
+#[pso_message(0x06)]
+pub struct GuildcardSend {
+
+}
+
+#[pso_message(0x06)]
+pub struct GuildcardRecv {
+    guildcard: u32,
+    name: [u16; 0x18],
+    team: [u16; 0x10],
+    desc: [u16; 0x58],
+    one: u8,
+    language: u8,
+    section_id: u8,
+    class: u8,
+}
+
 
 #[derive(Debug, Clone, PartialEq)]
 pub enum GameMessage {
@@ -232,6 +249,8 @@ pub enum GameMessage {
     PlayerBlockedDamage(PlayerBlockedDamage),
     PlayerTrapSet(PlayerTrapSet),
     PlayerTrapActivate(PlayerTrapActivate),
+    GuildcardSend(GuildcardSend),
+    GuildcardRecv(GuildcardRecv),
 }
 
 impl PSOPacketData for GameMessage {
@@ -272,6 +291,8 @@ impl PSOPacketData for GameMessage {
             PlayerBlockedDamage::CMD => Ok(GameMessage::PlayerBlockedDamage(PlayerBlockedDamage::from_bytes(&mut cur)?)),
             PlayerTrapSet::CMD => Ok(GameMessage::PlayerTrapSet(PlayerTrapSet::from_bytes(&mut cur)?)),
             PlayerTrapActivate::CMD => Ok(GameMessage::PlayerTrapActivate(PlayerTrapActivate::from_bytes(&mut cur)?)),
+            GuildcardSend::CMD => Ok(GameMessage::GuildcardSend(GuildcardSend::from_bytes(&mut cur)?)),
+            GuildcardRecv::CMD => Ok(GameMessage::GuildcardRecv(GuildcardRecv::from_bytes(&mut cur)?)),
             _ => Err(PacketParseError::UnknownMessage(byte[0],
                                                       {
                                                           let mut b = vec![0; len[0] as usize * 4];
@@ -313,6 +334,8 @@ impl PSOPacketData for GameMessage {
             GameMessage::PlayerTrapSet(data) => data.as_bytes(),
             GameMessage::PlayerTrapActivate(data) => data.as_bytes(),
             GameMessage::PlayerChangedFloor(data) => data.as_bytes(),
+            GameMessage::GuildcardSend(data) => data.as_bytes(),
+            GameMessage::GuildcardRecv(data) => data.as_bytes(),
         }
     }
 }