ManaPlus
Public Member Functions
EAthena::GuildHandler Class Reference

#include <guildhandler.h>

Inheritance diagram for EAthena::GuildHandler:
Net::GuildHandler

Public Member Functions

 GuildHandler ()
 
 ~GuildHandler ()
 
void clear () const
 
ChatTabgetTab () const
 
void create (const std::string &name) const
 
void invite (const std::string &name) const
 
void invite (const Being *const being) const
 
void inviteResponse (const int guildId, const bool response) const
 
void leave (const int guildId) const
 
void kick (const GuildMember *const member, const std::string &reason) const
 
void chat (const std::string &text) const
 
void memberList () const
 
void info () const
 
void changeMemberPostion (const GuildMember *const member, const int level) const
 
void changeNotice (const int guildId, const std::string &msg1, const std::string &msg2) const
 
void checkMaster () const
 
void requestAlliance (const Being *const being) const
 
void requestAllianceResponse (const int beingId, const bool accept) const
 
void endAlliance (const int guildId, const int flag) const
 
void changePostionInfo (const int posId, const int mode, const int ranking, const int payRate, const std::string &name) const
 
void requestOpposition (const Being *const being) const
 
void breakGuild (const std::string &name) const
 
void changeEmblem (std::string emblem) const
 
void requestEmblem (const int guildId) const
 
- Public Member Functions inherited from Net::GuildHandler
 GuildHandler ()
 

Detailed Description

Definition at line 33 of file guildhandler.h.

Constructor & Destructor Documentation

◆ GuildHandler()

EAthena::GuildHandler::GuildHandler ( )

Definition at line 47 of file guildhandler.cpp.

47  :
49 {
50  guildHandler = this;
52 }
Net::GuildHandler * guildHandler
Definition: net.cpp:92

References guildHandler, and EAthena::GuildRecv::showBasicInfo.

◆ ~GuildHandler()

EAthena::GuildHandler::~GuildHandler ( )
virtual

Reimplemented from Net::GuildHandler.

Definition at line 54 of file guildhandler.cpp.

55 {
57  guildHandler = nullptr;
58  taGuild = nullptr;
59 }
#define delete2(var)
Definition: delete2.h:25
GuildTab * guildTab
Guild * taGuild
Definition: guildhandler.h:99

References delete2, guildHandler, guildTab, and EAthena::taGuild.

Member Function Documentation

◆ breakGuild()

void EAthena::GuildHandler::breakGuild ( const std::string &  name) const
virtual

Implements Net::GuildHandler.

Definition at line 270 of file guildhandler.cpp.

271 {
272  createOutPacket(CMSG_GUILD_BREAK);
273  outMsg.writeString(name, 40, "name");
274 }
#define createOutPacket(name)
Definition: messageout.h:37

References createOutPacket.

◆ changeEmblem()

void EAthena::GuildHandler::changeEmblem ( std::string  emblem) const
virtual

Implements Net::GuildHandler.

Definition at line 276 of file guildhandler.cpp.

277 {
278  createOutPacket(CMSG_GUILD_CHANGE_EMBLEM);
279  if (emblem.size() > 200)
280  emblem = emblem.substr(0, 200);
281  const int sz = CAST_S32(emblem.size());
282  outMsg.writeInt16(CAST_S16(sz + 4), "len");
283  outMsg.writeString(emblem, sz, "emblem");
284 }
#define CAST_S16
Definition: cast.h:28
#define CAST_S32
Definition: cast.h:30

References CAST_S16, CAST_S32, and createOutPacket.

◆ changeMemberPostion()

void EAthena::GuildHandler::changeMemberPostion ( const GuildMember *const  member,
const int  level 
) const
virtual

Implements Net::GuildHandler.

Definition at line 191 of file guildhandler.cpp.

193 {
194  if ((member == nullptr) || (member->getGuild() == nullptr))
195  return;
196 
197  createOutPacket(CMSG_GUILD_CHANGE_MEMBER_POS);
198  outMsg.writeInt16(16, "len");
199  outMsg.writeBeingId(member->getID(), "account id");
200  outMsg.writeInt32(member->getCharId(), "char id");
201  outMsg.writeInt32(level, "pos");
202 }
int getCharId() const
Definition: avatar.h:156
BeingId getID() const
Definition: avatar.h:150
const Guild * getGuild() const
Definition: guild.h:44

References createOutPacket, Avatar::getCharId(), GuildMember::getGuild(), and Avatar::getID().

◆ changeNotice()

void EAthena::GuildHandler::changeNotice ( const int  guildId,
const std::string &  msg1,
const std::string &  msg2 
) const
virtual

Implements Net::GuildHandler.

Definition at line 204 of file guildhandler.cpp.

207 {
208  createOutPacket(CMSG_GUILD_CHANGE_NOTICE);
209  outMsg.writeInt32(guildId, "guild id");
210  outMsg.writeString(msg1, 60, "msg1");
211  outMsg.writeString(msg2, 120, "msg2");
212 }
bool msg2(InputEvent &event)
Definition: chat.cpp:41

References createOutPacket, and Actions::msg2().

◆ changePostionInfo()

void EAthena::GuildHandler::changePostionInfo ( const int  posId,
const int  mode,
const int  ranking,
const int  payRate,
const std::string &  name 
) const
virtual

Implements Net::GuildHandler.

Definition at line 246 of file guildhandler.cpp.

251 {
252  createOutPacket(CMSG_GUILD_CHANGE_POS_INFO);
253  outMsg.writeInt16(44, "len");
254  outMsg.writeInt32(posId, "position id");
255  outMsg.writeInt32(mode, "mode");
256  outMsg.writeInt32(ranking, "ranking");
257  outMsg.writeInt32(payRate, "pay rate");
258  outMsg.writeString(name, 24, "name");
259 }

References createOutPacket.

◆ chat()

void EAthena::GuildHandler::chat ( const std::string &  text) const
virtual

Implements Net::GuildHandler.

Definition at line 145 of file guildhandler.cpp.

146 {
147  if (localPlayer == nullptr)
148  return;
149 
150  const std::string str = std::string(localPlayer->getName()).append(
151  " : ").append(text);
152  createOutPacket(CMSG_GUILD_MESSAGE);
153  if (packetVersion >= 20151001)
154  {
155  outMsg.writeInt16(CAST_U16(str.size() + 4), "len");
156  outMsg.writeString(str, CAST_S32(str.length()), "message");
157  }
158  else
159  {
160  outMsg.writeInt16(CAST_U16(str.size() + 4 + 1), "len");
161  outMsg.writeString(str, CAST_S32(str.length()), "message");
162  outMsg.writeInt8(0, "zero byte");
163  }
164 }
#define CAST_U16
Definition: cast.h:29
const std::string & getName() const
Definition: being.h:232
int packetVersion
Definition: client.cpp:125
LocalPlayer * localPlayer

References CAST_S32, CAST_U16, createOutPacket, Being::getName(), localPlayer, and packetVersion.

◆ checkMaster()

void EAthena::GuildHandler::checkMaster ( ) const
virtual

Implements Net::GuildHandler.

Definition at line 214 of file guildhandler.cpp.

215 {
216  createOutPacket(CMSG_GUILD_CHECK_MASTER);
217 }

References createOutPacket.

◆ clear()

void EAthena::GuildHandler::clear ( ) const
virtual

Implements Net::GuildHandler.

Definition at line 61 of file guildhandler.cpp.

62 {
63  taGuild = nullptr;
64 }

References EAthena::taGuild.

◆ create()

void EAthena::GuildHandler::create ( const std::string &  name) const
virtual

Implements Net::GuildHandler.

Definition at line 71 of file guildhandler.cpp.

72 {
73  createOutPacket(CMSG_GUILD_CREATE);
74  outMsg.writeInt32(0, "unused");
75  outMsg.writeString(name, 24, "guild name");
76 }

References createOutPacket.

◆ endAlliance()

void EAthena::GuildHandler::endAlliance ( const int  guildId,
const int  flag 
) const
virtual

Implements Net::GuildHandler.

Definition at line 238 of file guildhandler.cpp.

240 {
241  createOutPacket(CMSG_GUILD_ALLIANCE_DELETE);
242  outMsg.writeInt32(guildId, "guild id");
243  outMsg.writeInt32(flag, "flag");
244 }

References createOutPacket.

◆ getTab()

ChatTab * EAthena::GuildHandler::getTab ( ) const
virtual

Implements Net::GuildHandler.

Definition at line 66 of file guildhandler.cpp.

67 {
68  return guildTab;
69 }

References guildTab.

◆ info()

void EAthena::GuildHandler::info ( ) const
virtual

Implements Net::GuildHandler.

Definition at line 178 of file guildhandler.cpp.

179 {
180  // 0 = basic info + alliance info
181  // 1 = position name list + member list
182  // 2 = position name list + position info list
183  // 3 = skill info
184  // 4 = expulsion list
185 
187  createOutPacket(CMSG_GUILD_REQUEST_INFO);
188  outMsg.writeInt32(0, "action"); // Request basic info
189 }

References createOutPacket, and EAthena::GuildRecv::showBasicInfo.

◆ invite() [1/2]

void EAthena::GuildHandler::invite ( const Being *const  being) const
virtual

Implements Net::GuildHandler.

Definition at line 99 of file guildhandler.cpp.

100 {
101  if (being == nullptr)
102  return;
103 
104  createOutPacket(CMSG_GUILD_INVITE);
105  outMsg.writeBeingId(being->getId(), "account id");
106  outMsg.writeInt32(0, "unused");
107  outMsg.writeInt32(0, "unused");
108 }
BeingId getId() const
Definition: actorsprite.h:64

References createOutPacket, and ActorSprite::getId().

◆ invite() [2/2]

void EAthena::GuildHandler::invite ( const std::string &  name) const
virtual

Implements Net::GuildHandler.

Definition at line 78 of file guildhandler.cpp.

79 {
80  if (actorManager == nullptr)
81  return;
82 
83  const Being *const being = actorManager->findBeingByName(
84  name, ActorType::Player);
85  if (being != nullptr)
86  {
87  createOutPacket(CMSG_GUILD_INVITE);
88  outMsg.writeBeingId(being->getId(), "account id");
89  outMsg.writeInt32(0, "unused");
90  outMsg.writeInt32(0, "unused");
91  }
92  else if (packetVersion >= 20120418)
93  {
94  createOutPacket(CMSG_GUILD_INVITE2);
95  outMsg.writeString(name, 24, "name");
96  }
97 }
ActorManager * actorManager
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
Definition: being.h:96

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

◆ inviteResponse()

void EAthena::GuildHandler::inviteResponse ( const int  guildId,
const bool  response 
) const
virtual

Implements Net::GuildHandler.

Definition at line 110 of file guildhandler.cpp.

112 {
113  createOutPacket(CMSG_GUILD_INVITE_REPLY);
114  outMsg.writeInt32(guildId, "guild id");
115  outMsg.writeInt8(static_cast<int8_t>(response), "response");
116  outMsg.writeInt8(0, "unused");
117  outMsg.writeInt16(0, "unused");
118 }

References createOutPacket.

◆ kick()

void EAthena::GuildHandler::kick ( const GuildMember *const  member,
const std::string &  reason 
) const
virtual

Implements Net::GuildHandler.

Definition at line 132 of file guildhandler.cpp.

134 {
135  if ((member == nullptr) || (member->getGuild() == nullptr))
136  return;
137 
138  createOutPacket(CMSG_GUILD_EXPULSION);
139  outMsg.writeInt32(member->getGuild()->getId(), "guild id");
140  outMsg.writeBeingId(member->getID(), "account id");
141  outMsg.writeInt32(member->getCharId(), "char id");
142  outMsg.writeString(reason, 40, "message");
143 }
int16_t getId() const
Definition: guild.h:135

References createOutPacket.

◆ leave()

void EAthena::GuildHandler::leave ( const int  guildId) const
virtual

Implements Net::GuildHandler.

Definition at line 120 of file guildhandler.cpp.

121 {
122  if (localPlayer == nullptr)
123  return;
124 
125  createOutPacket(CMSG_GUILD_LEAVE);
126  outMsg.writeInt32(guildId, "guild id");
127  outMsg.writeBeingId(localPlayer->getId(), "account id");
128  outMsg.writeInt32(PlayerInfo::getCharId(), "char id");
129  outMsg.writeString("", 40, "message");
130 }
int getCharId()
Definition: playerinfo.cpp:386

References createOutPacket, PlayerInfo::getCharId(), ActorSprite::getId(), and localPlayer.

◆ memberList()

void EAthena::GuildHandler::memberList ( ) const
virtual

Implements Net::GuildHandler.

Definition at line 166 of file guildhandler.cpp.

167 {
168  // 0 = basic info + alliance info
169  // 1 = position name list + member list
170  // 2 = position name list + position info list
171  // 3 = skill info
172  // 4 = expulsion list
173 
174  createOutPacket(CMSG_GUILD_REQUEST_INFO);
175  outMsg.writeInt32(1, "action"); // Request member list
176 }

References createOutPacket.

◆ requestAlliance()

void EAthena::GuildHandler::requestAlliance ( const Being *const  being) const
virtual

Implements Net::GuildHandler.

Definition at line 219 of file guildhandler.cpp.

220 {
221  if (being == nullptr)
222  return;
223 
224  createOutPacket(CMSG_GUILD_ALLIANCE_REQUEST);
225  outMsg.writeBeingId(being->getId(), "account id");
226  outMsg.writeInt32(0, "inviter account id");
227  outMsg.writeInt32(0, "inviter char id");
228 }

References createOutPacket, and ActorSprite::getId().

◆ requestAllianceResponse()

void EAthena::GuildHandler::requestAllianceResponse ( const int  beingId,
const bool  accept 
) const
virtual

Implements Net::GuildHandler.

Definition at line 230 of file guildhandler.cpp.

232 {
233  createOutPacket(CMSG_GUILD_ALLIANCE_REPLY);
234  outMsg.writeInt32(beingId, "account id");
235  outMsg.writeInt32(static_cast<int32_t>(accept), "accept flag");
236 }
TcpNet::Socket accept(const TcpNet::Socket sock)
Definition: sdltcpnet.cpp:198

References TcpNet::accept(), and createOutPacket.

◆ requestEmblem()

void EAthena::GuildHandler::requestEmblem ( const int  guildId) const
virtual

Implements Net::GuildHandler.

Definition at line 286 of file guildhandler.cpp.

287 {
288  createOutPacket(CMSG_GUILD_REQUEST_EMBLEM);
289  outMsg.writeInt32(guildId, "guild id");
290 }

References createOutPacket.

◆ requestOpposition()

void EAthena::GuildHandler::requestOpposition ( const Being *const  being) const
virtual

Implements Net::GuildHandler.

Definition at line 261 of file guildhandler.cpp.

262 {
263  if (being == nullptr)
264  return;
265 
266  createOutPacket(CMSG_GUILD_OPPOSITION);
267  outMsg.writeBeingId(being->getId(), "account id");
268 }

References createOutPacket, and ActorSprite::getId().


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