ManaPlus
Public Member Functions
EAthena::PetHandler Class Reference

#include <pethandler.h>

Inheritance diagram for EAthena::PetHandler:
Net::PetHandler

Public Member Functions

 PetHandler ()
 
 ~PetHandler ()
 
void move (const int x, const int y) const
 
void emote (const uint8_t emoteId)
 
void catchPet (const Being *const being) const
 
void sendPetMessage (const int data) const
 
void setName (const std::string &name) const
 
void requestStatus () const
 
void feed () const
 
void dropLoot () const
 
void returnToEgg () const
 
void unequip () const
 
void setDirection (const unsigned char type) const
 
void evolution (const Item *const item) const
 
- Public Member Functions inherited from Net::PetHandler
 PetHandler ()
 

Detailed Description

Definition at line 30 of file pethandler.h.

Constructor & Destructor Documentation

◆ PetHandler()

EAthena::PetHandler::PetHandler ( )

Definition at line 40 of file pethandler.cpp.

41 {
42  petHandler = this;
43 }
Net::PetHandler * petHandler
Definition: net.cpp:95

References petHandler.

◆ ~PetHandler()

EAthena::PetHandler::~PetHandler ( )
virtual

Reimplemented from Net::PetHandler.

Definition at line 45 of file pethandler.cpp.

46 {
47  petHandler = nullptr;
48 }

References petHandler.

Member Function Documentation

◆ catchPet()

void EAthena::PetHandler::catchPet ( const Being *const  being) const
virtual

Implements Net::PetHandler.

Definition at line 67 of file pethandler.cpp.

68 {
69  if (being == nullptr)
70  return;
71 
72  createOutPacket(CMSG_PET_CATCH);
73  outMsg.writeBeingId(being->getId(), "monster id");
74 }
BeingId getId() const
Definition: actorsprite.h:64
#define createOutPacket(name)
Definition: messageout.h:37

References createOutPacket, and ActorSprite::getId().

◆ dropLoot()

void EAthena::PetHandler::dropLoot ( ) const
virtual

Implements Net::PetHandler.

Definition at line 100 of file pethandler.cpp.

101 {
102  createOutPacket(CMSG_PET_MENU_ACTION);
103  outMsg.writeInt8(2, "action"); // performance
104 }

References createOutPacket.

◆ emote()

void EAthena::PetHandler::emote ( const uint8_t  emoteId)
virtual

Implements Net::PetHandler.

Definition at line 61 of file pethandler.cpp.

62 {
63  createOutPacket(CMSG_PET_EMOTE);
64  outMsg.writeInt8(emoteId, "emote id");
65 }

References createOutPacket.

◆ evolution()

void EAthena::PetHandler::evolution ( const Item *const  item) const
virtual

Implements Net::PetHandler.

Definition at line 131 of file pethandler.cpp.

132 {
133  if (packetVersion < 20140122 ||
134  item == nullptr)
135  {
136  return;
137  }
138  createOutPacket(CMSG_PET_EVOLUTION);
139  outMsg.writeItemId(item->getId(), "egg id");
140 }
int getId() const
Definition: item.h:81
int packetVersion
Definition: client.cpp:125

References createOutPacket, Item::getId(), and packetVersion.

◆ feed()

void EAthena::PetHandler::feed ( ) const
virtual

Implements Net::PetHandler.

Definition at line 94 of file pethandler.cpp.

95 {
96  createOutPacket(CMSG_PET_MENU_ACTION);
97  outMsg.writeInt8(1, "action");
98 }

References createOutPacket.

◆ move()

void EAthena::PetHandler::move ( const int  x,
const int  y 
) const
virtual

Implements Net::PetHandler.

Definition at line 50 of file pethandler.cpp.

52 {
54  return;
55  createOutPacket(CMSG_PET_MOVE_TO);
56  outMsg.writeInt32(0, "pet id");
57  outMsg.writeInt16(CAST_S16(x), "x");
58  outMsg.writeInt16(CAST_S16(y), "y");
59 }
#define CAST_S16
Definition: cast.h:28
virtual bool haveMovePet() const =0
Net::ServerFeatures * serverFeatures
Definition: net.cpp:101

References CAST_S16, createOutPacket, Net::ServerFeatures::haveMovePet(), serverFeatures, x, and y.

◆ requestStatus()

void EAthena::PetHandler::requestStatus ( ) const
virtual

Implements Net::PetHandler.

Definition at line 88 of file pethandler.cpp.

89 {
90  createOutPacket(CMSG_PET_MENU_ACTION);
91  outMsg.writeInt8(0, "action");
92 }

References createOutPacket.

◆ returnToEgg()

void EAthena::PetHandler::returnToEgg ( ) const
virtual

Implements Net::PetHandler.

Definition at line 106 of file pethandler.cpp.

107 {
108  createOutPacket(CMSG_PET_MENU_ACTION);
109  outMsg.writeInt8(3, "action");
110  PlayerInfo::setPet(nullptr);
111 }
void setPet(PetInfo *const info)
Definition: playerinfo.cpp:554

References createOutPacket, and PlayerInfo::setPet().

◆ sendPetMessage()

void EAthena::PetHandler::sendPetMessage ( const int  data) const
virtual

Implements Net::PetHandler.

Definition at line 76 of file pethandler.cpp.

77 {
78  createOutPacket(CMSG_PET_SEND_MESSAGE);
79  outMsg.writeInt32(data, "param");
80 }
uint32_t data

References createOutPacket, and data.

◆ setDirection()

void EAthena::PetHandler::setDirection ( const unsigned char  type) const
virtual

Implements Net::PetHandler.

Definition at line 119 of file pethandler.cpp.

120 {
121  if (!serverFeatures->haveMovePet())
122  return;
123  createOutPacket(CMSG_PET_DIRECTION);
124  outMsg.writeInt32(0, "pet id");
125  outMsg.writeInt8(0, "head direction");
126  outMsg.writeInt8(0, "unused");
127  outMsg.writeInt8(MessageOut::toServerDirection(type),
128  "pet direction");
129 }
static unsigned char toServerDirection(unsigned char direction) A_CONST
Definition: messageout.cpp:253

References createOutPacket, Net::ServerFeatures::haveMovePet(), serverFeatures, and Net::MessageOut::toServerDirection().

◆ setName()

void EAthena::PetHandler::setName ( const std::string &  name) const
virtual

Implements Net::PetHandler.

Definition at line 82 of file pethandler.cpp.

83 {
84  createOutPacket(CMSG_PET_SET_NAME);
85  outMsg.writeString(name, 24, "name");
86 }

References createOutPacket.

◆ unequip()

void EAthena::PetHandler::unequip ( ) const
virtual

Implements Net::PetHandler.

Definition at line 113 of file pethandler.cpp.

114 {
115  createOutPacket(CMSG_PET_MENU_ACTION);
116  outMsg.writeInt8(4, "action");
117 }

References createOutPacket.


The documentation for this class was generated from the following files: