From 2822bd9efe74131a6f0614f8092db9c990a0e708 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Sat, 14 Jul 2018 01:32:24 +0300
Subject: Add packet CMSG_PET_EVOLUTION 0x09fb.

---
 src/net/eathena/packetsout.inc |  7 +++++++
 src/net/eathena/pethandler.cpp | 15 +++++++++++++++
 src/net/eathena/pethandler.h   |  2 ++
 src/net/pethandler.h           |  4 ++++
 src/net/tmwa/pethandler.cpp    |  5 +++++
 src/net/tmwa/pethandler.h      |  2 ++
 6 files changed, 35 insertions(+)

diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc
index b622b0340..b480c16f4 100644
--- a/src/net/eathena/packetsout.inc
+++ b/src/net/eathena/packetsout.inc
@@ -336,6 +336,7 @@ packet(CMSG_ATTENDANCE_REWARD,            0x0000,   0, nullptr);
 packet(CMSG_MAP_BLOCK_PLAY_CANCEL,        0x0000,   0, nullptr);
 packet(CMSG_PRIVATE_AIRSHIP_REQUEST,      0x0000,   0, nullptr);
 packet(CMSG_PLAYER_SELECT_STYLE,          0x0000,   0, nullptr);
+packet(CMSG_PET_EVOLUTION,                0x0000,   0, nullptr);
 #else
 // 20040713
 if (packetVersion >= 20040713)
@@ -1258,6 +1259,12 @@ if (packetVersion >= 20131230)
     packet(CMSG_MAIL2_SEND_MAIL,          0x09ec,  -1, clif->pRodexSendMail);
 }
 
+// 20140122
+if (packetVersion >= 20140122)
+{
+    packet(CMSG_PET_EVOLUTION,            0x09fb,  -1, clif->pPetEvolution);
+}
+
 // 20140129
 if (packetVersion >= 20140129)
 {
diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp
index 1f492aa31..72243057f 100644
--- a/src/net/eathena/pethandler.cpp
+++ b/src/net/eathena/pethandler.cpp
@@ -27,8 +27,12 @@
 #include "net/eathena/messageout.h"
 #include "net/eathena/protocolout.h"
 
+#include "resources/item/item.h"
+
 #include "debug.h"
 
+extern int packetVersion;
+
 namespace EAthena
 {
 
@@ -123,4 +127,15 @@ void PetHandler::setDirection(const unsigned char type) const
         "pet direction");
 }
 
+void PetHandler::evolution(const Item *const item) const
+{
+    if (packetVersion < 20140122 ||
+        item == nullptr)
+    {
+        return;
+    }
+    createOutPacket(CMSG_PET_EVOLUTION);
+    outMsg.writeInt16(CAST_S16(item->getId()), "egg id");
+}
+
 }  // namespace EAthena
diff --git a/src/net/eathena/pethandler.h b/src/net/eathena/pethandler.h
index 00cc4b7f3..2d73b6524 100644
--- a/src/net/eathena/pethandler.h
+++ b/src/net/eathena/pethandler.h
@@ -57,6 +57,8 @@ class PetHandler final :  public Net::PetHandler
         void unequip() const override final;
 
         void setDirection(const unsigned char type) const override final;
+
+        void evolution(const Item *const item) const override final;
 };
 
 }  // namespace EAthena
diff --git a/src/net/pethandler.h b/src/net/pethandler.h
index 3116d7ba9..ba1502631 100644
--- a/src/net/pethandler.h
+++ b/src/net/pethandler.h
@@ -23,6 +23,8 @@
 
 #include "being/being.h"
 
+class Item;
+
 namespace Net
 {
 
@@ -59,6 +61,8 @@ class PetHandler notfinal
         virtual void unequip() const = 0;
 
         virtual void setDirection(const unsigned char type) const = 0;
+
+        virtual void evolution(const Item *item) const = 0;
 };
 
 }  // namespace Net
diff --git a/src/net/tmwa/pethandler.cpp b/src/net/tmwa/pethandler.cpp
index 4e7577bf9..63a82df9a 100644
--- a/src/net/tmwa/pethandler.cpp
+++ b/src/net/tmwa/pethandler.cpp
@@ -81,4 +81,9 @@ void PetHandler::setDirection(const unsigned char type A_UNUSED) const
 {
 }
 
+void PetHandler::evolution(const Item *item A_UNUSED) const
+{
+}
+
+
 }  // namespace TmwAthena
diff --git a/src/net/tmwa/pethandler.h b/src/net/tmwa/pethandler.h
index 884110932..87d16c023 100644
--- a/src/net/tmwa/pethandler.h
+++ b/src/net/tmwa/pethandler.h
@@ -58,6 +58,8 @@ class PetHandler final : public Net::PetHandler
 
         void setDirection(const unsigned char type) const override final;
 
+        void evolution(const Item *const item) const override final;
+
     protected:
         int mRandCounter;
 };
-- 
cgit v1.2.3-70-g09d2