ManaPlus
Public Member Functions
TmwAthena::PartyHandler Class Reference

#include <partyhandler.h>

Inheritance diagram for TmwAthena::PartyHandler:
Ea::PartyHandler Net::PartyHandler

Public Member Functions

 PartyHandler ()
 
 ~PartyHandler ()
 
void create (const std::string &name) const
 
void invite (const std::string &name) const
 
void inviteResponse (const int partyId, const bool accept) const
 
void leave () const
 
void kick (const Being *const being) const
 
void kick (const std::string &name) const
 
void chat (const std::string &text) const
 
void setShareExperience (const PartyShareT share) const
 
void setShareItems (const PartyShareT share) const
 
void changeLeader (const std::string &name) const
 
void allowInvite (const bool allow) const
 
void setShareAutoItems (const PartyShareT share) const
 
PartyShareT getShareAutoItems () const
 
- Public Member Functions inherited from Ea::PartyHandler
 PartyHandler ()
 
void join (const int partyId) const
 
PartyShareT getShareExperience () const
 
PartyShareT getShareItems () const
 
void clear () const
 
ChatTabgetTab () const
 
- Public Member Functions inherited from Net::PartyHandler
 PartyHandler ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Ea::PartyHandler
static void reload ()
 

Detailed Description

Definition at line 31 of file partyhandler.h.

Constructor & Destructor Documentation

◆ PartyHandler()

TmwAthena::PartyHandler::PartyHandler ( )

Definition at line 43 of file partyhandler.cpp.

43  :
45 {
46  partyHandler = this;
47 }
Net::PartyHandler * partyHandler
Definition: net.cpp:94

References partyHandler.

◆ ~PartyHandler()

TmwAthena::PartyHandler::~PartyHandler ( )
virtual

Reimplemented from Ea::PartyHandler.

Definition at line 49 of file partyhandler.cpp.

50 {
51  partyHandler = nullptr;
52 }

References partyHandler.

Member Function Documentation

◆ allowInvite()

void TmwAthena::PartyHandler::allowInvite ( const bool  allow) const
virtual

Implements Net::PartyHandler.

Definition at line 150 of file partyhandler.cpp.

151 {
152 }

◆ changeLeader()

void TmwAthena::PartyHandler::changeLeader ( const std::string &  name) const
virtual

Implements Net::PartyHandler.

Definition at line 146 of file partyhandler.cpp.

147 {
148 }

◆ chat()

void TmwAthena::PartyHandler::chat ( const std::string &  text) const
virtual

Implements Net::PartyHandler.

Definition at line 117 of file partyhandler.cpp.

118 {
119  createOutPacket(CMSG_PARTY_MESSAGE);
120  outMsg.writeInt16(CAST_S16(text.length() + 4), "len");
121  outMsg.writeString(text, CAST_S32(text.length()), "text");
122 }
#define CAST_S16
Definition: cast.h:28
#define CAST_S32
Definition: cast.h:30
#define createOutPacket(name)
Definition: messageout.h:37

References CAST_S16, CAST_S32, and createOutPacket.

◆ create()

void TmwAthena::PartyHandler::create ( const std::string &  name) const
virtual

Implements Net::PartyHandler.

Definition at line 54 of file partyhandler.cpp.

55 {
56  createOutPacket(CMSG_PARTY_CREATE);
57  outMsg.writeString(name.substr(0, 23), 24, "party name");
58 }

References createOutPacket.

◆ getShareAutoItems()

PartyShareT TmwAthena::PartyHandler::getShareAutoItems ( ) const
virtual

Implements Net::PartyHandler.

Definition at line 154 of file partyhandler.cpp.

155 {
157 }
@ NOT_POSSIBLE
Definition: partyshare.h:34

References PartyShare::NOT_POSSIBLE.

◆ invite()

void TmwAthena::PartyHandler::invite ( const std::string &  name) const
virtual

Implements Net::PartyHandler.

Definition at line 60 of file partyhandler.cpp.

61 {
62  if (actorManager == nullptr)
63  return;
64 
65  const Being *const being = actorManager->findBeingByName(
66  name, ActorType::Player);
67  if (being != nullptr)
68  {
69  createOutPacket(CMSG_PARTY_INVITE);
70  outMsg.writeBeingId(being->getId(), "account id");
71  }
72 }
ActorManager * actorManager
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
BeingId getId() const
Definition: actorsprite.h:64
Definition: being.h:96

References actorManager, createOutPacket, ActorManager::findBeingByName(), ActorSprite::getId(), and ActorType::Player.

◆ inviteResponse()

void TmwAthena::PartyHandler::inviteResponse ( const int  partyId,
const bool  accept 
) const
virtual

Implements Net::PartyHandler.

Definition at line 74 of file partyhandler.cpp.

76 {
77  if (localPlayer != nullptr)
78  {
79  createOutPacket(CMSG_PARTY_INVITED);
80  outMsg.writeBeingId(localPlayer->getId(), "account id");
81  outMsg.writeInt32(accept ? 1 : 0, "accept");
82  }
83 }
LocalPlayer * localPlayer
TcpNet::Socket accept(const TcpNet::Socket sock)
Definition: sdltcpnet.cpp:198

References TcpNet::accept(), createOutPacket, ActorSprite::getId(), and localPlayer.

◆ kick() [1/2]

void TmwAthena::PartyHandler::kick ( const Being *const  being) const
virtual

Implements Net::PartyHandler.

Definition at line 90 of file partyhandler.cpp.

91 {
92  if (being != nullptr)
93  {
94  createOutPacket(CMSG_PARTY_KICK);
95  outMsg.writeBeingId(being->getId(), "account id");
96  outMsg.writeString("", 24, "unused");
97  }
98 }

References createOutPacket, and ActorSprite::getId().

◆ kick() [2/2]

void TmwAthena::PartyHandler::kick ( const std::string &  name) const
virtual

Implements Net::PartyHandler.

Definition at line 100 of file partyhandler.cpp.

101 {
102  if (Ea::taParty == nullptr)
103  return;
104 
105  const PartyMember *const m = Ea::taParty->getMember(name);
106  if (m == nullptr)
107  {
109  return;
110  }
111 
112  createOutPacket(CMSG_PARTY_KICK);
113  outMsg.writeBeingId(m->getID(), "member id");
114  outMsg.writeString(name, 24, "unused");
115 }
BeingId getID() const
Definition: avatar.h:150
PartyMember * getMember(const BeingId id) const
Definition: party.cpp:99
Party * taParty
Definition: partyrecv.cpp:48
void notify(const unsigned int message)
@ PARTY_USER_NOT_IN_PARTY
Definition: notifytypes.h:83

References createOutPacket, Avatar::getID(), Party::getMember(), NotifyManager::notify(), NotifyTypes::PARTY_USER_NOT_IN_PARTY, and Ea::taParty.

◆ leave()

void TmwAthena::PartyHandler::leave ( ) const
virtual

Implements Net::PartyHandler.

Definition at line 85 of file partyhandler.cpp.

86 {
87  createOutPacket(CMSG_PARTY_LEAVE);
88 }

References createOutPacket.

◆ setShareAutoItems()

void TmwAthena::PartyHandler::setShareAutoItems ( const PartyShareT  share) const
virtual

Implements Net::PartyHandler.

Definition at line 159 of file partyhandler.cpp.

160 {
161 }

◆ setShareExperience()

void TmwAthena::PartyHandler::setShareExperience ( const PartyShareT  share) const
virtual

Implements Net::PartyHandler.

Definition at line 124 of file partyhandler.cpp.

125 {
126  if (share == PartyShare::NOT_POSSIBLE)
127  return;
128 
129  createOutPacket(CMSG_PARTY_SETTINGS);
130  outMsg.writeInt16(CAST_S16(share), "share exp");
131  outMsg.writeInt16(CAST_S16(Ea::PartyRecv::mShareItems),
132  "share items");
133 }
PartyShareT mShareItems
Definition: partyrecv.cpp:53

References CAST_S16, createOutPacket, Ea::PartyRecv::mShareItems, and PartyShare::NOT_POSSIBLE.

◆ setShareItems()

void TmwAthena::PartyHandler::setShareItems ( const PartyShareT  share) const
virtual

Implements Net::PartyHandler.

Definition at line 135 of file partyhandler.cpp.

136 {
137  if (share == PartyShare::NOT_POSSIBLE)
138  return;
139 
140  createOutPacket(CMSG_PARTY_SETTINGS);
141  outMsg.writeInt16(CAST_S16(Ea::PartyRecv::mShareExp),
142  "share exp");
143  outMsg.writeInt16(CAST_S16(share), "share items");
144 }
PartyShareT mShareExp
Definition: partyrecv.cpp:52

References CAST_S16, createOutPacket, Ea::PartyRecv::mShareExp, and PartyShare::NOT_POSSIBLE.


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