ManaPlus
Functions | Variables
EAthena::GuildRecv Namespace Reference

Functions

void processGuildCreateResponse (Net::MessageIn &msg)
 
void processGuildMasterOrMember (Net::MessageIn &msg)
 
void processGuildBasicInfo (Net::MessageIn &msg)
 
void processGuildAlianceInfo (Net::MessageIn &msg)
 
void processGuildMemberList (Net::MessageIn &msg)
 
void processGuildPosNameList (Net::MessageIn &msg)
 
void processGuildPosInfoList (Net::MessageIn &msg)
 
void processGuildPositionChanged (Net::MessageIn &msg)
 
void processGuildMemberPosChange (Net::MessageIn &msg)
 
void processGuildEmblemData (Net::MessageIn &msg)
 
void processGuildSkillInfo (Net::MessageIn &msg)
 
void processGuildNotice (Net::MessageIn &msg)
 
void processGuildInvite (Net::MessageIn &msg)
 
void processGuildInviteAck (Net::MessageIn &msg)
 
void processGuildLeave (Net::MessageIn &msg)
 
void processGuildLeave2 (Net::MessageIn &msg)
 
void processGuildMessage (Net::MessageIn &msg)
 
void processGuildReqAlliance (Net::MessageIn &msg)
 
void processGuildReqAllianceAck (Net::MessageIn &msg)
 
void processGuildDelAlliance (Net::MessageIn &msg)
 
void processGuildOppositionAck (Net::MessageIn &msg)
 
void processGuildBroken (Net::MessageIn &msg)
 
void processGuildExpulsionContinue (const std::string &nick)
 
void processGuildUpdateCoords (Net::MessageIn &msg)
 
void processGuildPositionInfo (Net::MessageIn &msg)
 
void processGuildMemberLogin (Net::MessageIn &msg)
 
void processGuildExpulsion (Net::MessageIn &msg)
 
void processGuildExpulsion2 (Net::MessageIn &msg)
 
void processGuildExpulsionList1 (Net::MessageIn &msg)
 
void processGuildExpulsionList2 (Net::MessageIn &msg)
 
void processGuildExpulsionList3 (Net::MessageIn &msg)
 
void processGuildEmblem (Net::MessageIn &msg)
 
void processOnlineInfo (Net::MessageIn &msg)
 
void processGuildSetPosition (Net::MessageIn &msg)
 

Variables

bool showBasicInfo = false
 

Function Documentation

◆ processGuildAlianceInfo()

void EAthena::GuildRecv::processGuildAlianceInfo ( Net::MessageIn msg)

Definition at line 189 of file guildrecv.cpp.

190 {
191  const int length = msg.readInt16("len");
192  if (length < 4)
193  return;
194  const int count = (length - 4) / 32;
195 
196  for (int i = 0; i < count; i++)
197  {
198  msg.readInt32("opposition");
199  msg.readInt32("guild id");
200  msg.readString(24, "guild name");
201  }
202 }
bool msg(InputEvent &event)
Definition: chat.cpp:39

References Actions::msg().

◆ processGuildBasicInfo()

void EAthena::GuildRecv::processGuildBasicInfo ( Net::MessageIn msg)

Definition at line 99 of file guildrecv.cpp.

100 {
101  const int guildId = msg.readInt32("guild id");
102  const int level = msg.readInt32("guild level");
103  const int members = msg.readInt32("connect member");
104  const int maxMembers = msg.readInt32("max member");
105  const int avgLevel = msg.readInt32("average level");
106  const int exp = msg.readInt32("exp");
107  const int nextExp = msg.readInt32("next exp");
108  msg.skip(12, "unused");
109  const int emblem = msg.readInt32("emblem id");
110  std::string name = msg.readString(24, "guild name");
111  std::string castle;
112  std::string master;
113  if (msg.getVersion() >= 20160622)
114  {
115  castle = msg.readString(16, "castles");
116  msg.readInt32("money, unused");
117  msg.readBeingId("leader char id");
118  }
119  else
120  {
121  master = msg.readString(24, "master name");
122  castle = msg.readString(16, "castles");
123  msg.readInt32("money, unused");
124  }
125 
126  if (guildTab != nullptr &&
128  {
129  showBasicInfo = false;
130  // TRANSLATORS: guild info message
131  guildTab->chatLog(strprintf(_("Guild name: %s"),
132  name.c_str()),
136  if (!master.empty())
137  {
138  // TRANSLATORS: guild info message
139  guildTab->chatLog(strprintf(_("Guild master: %s"),
140  master.c_str()),
144  }
145  // TRANSLATORS: guild info message
146  guildTab->chatLog(strprintf(_("Guild level: %d"), level),
150  // TRANSLATORS: guild info message
151  guildTab->chatLog(strprintf(_("Online members: %d"), members),
155  // TRANSLATORS: guild info message
156  guildTab->chatLog(strprintf(_("Max members: %d"), maxMembers),
160  // TRANSLATORS: guild info message
161  guildTab->chatLog(strprintf(_("Average level: %d"), avgLevel),
165  // TRANSLATORS: guild info message
166  guildTab->chatLog(strprintf(_("Guild exp: %d"), exp),
170  // TRANSLATORS: guild info message
171  guildTab->chatLog(strprintf(_("Guild next exp: %d"), nextExp),
175  // TRANSLATORS: guild info message
176  guildTab->chatLog(strprintf(_("Guild castle: %s"), castle.c_str()),
180  }
181 
182  Guild *const g = Guild::getGuild(CAST_S16(guildId));
183  if (g == nullptr)
184  return;
185  g->setName(name);
186  g->setEmblemId(emblem);
187 }
#define CAST_S16
Definition: cast.h:28
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:111
Definition: guild.h:70
void setName(const std::string &name)
Definition: guild.h:79
static Guild * getGuild(const int16_t id)
Definition: guild.cpp:374
void setEmblemId(const int id)
Definition: guild.h:195
GuildTab * guildTab
#define _(s)
Definition: gettext.h:35
const bool IgnoreRecord_false
Definition: ignorerecord.h:30
std::string strprintf(const char *const format,...)
const bool TryRemoveColors_true

References _, ChatMsgType::BY_SERVER, CAST_S16, ChatTab::chatLog(), Guild::getGuild(), guildTab, IgnoreRecord_false, Actions::msg(), Guild::setEmblemId(), Guild::setName(), showBasicInfo, strprintf(), and TryRemoveColors_true.

◆ processGuildBroken()

void EAthena::GuildRecv::processGuildBroken ( Net::MessageIn msg)

Definition at line 619 of file guildrecv.cpp.

620 {
622  msg.readInt32("flag");
623 }
#define UNIMPLEMENTEDPACKET
Definition: logger.h:56

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildCreateResponse()

void EAthena::GuildRecv::processGuildCreateResponse ( Net::MessageIn msg)

Definition at line 61 of file guildrecv.cpp.

62 {
63  const uint8_t flag = msg.readUInt8("flag");
64 
65  switch (flag)
66  {
67  case 0:
68  // Success
70  break;
71 
72  case 1:
73  // Already in a guild
75  break;
76 
77  case 2:
78  // Unable to make (likely name already in use)
80  break;
81 
82  case 3:
83  // Emperium check failed
85  break;
86 
87  default:
88  // Unknown response
90  break;
91  }
92 }
void notify(const unsigned int message)
@ GUILD_EMPERIUM_CHECK_FAILED
Definition: notifytypes.h:45

References NotifyTypes::GUILD_ALREADY, NotifyTypes::GUILD_CREATED, NotifyTypes::GUILD_EMPERIUM_CHECK_FAILED, NotifyTypes::GUILD_ERROR, Actions::msg(), and NotifyManager::notify().

◆ processGuildDelAlliance()

void EAthena::GuildRecv::processGuildDelAlliance ( Net::MessageIn msg)

Definition at line 606 of file guildrecv.cpp.

607 {
609  msg.readInt32("guild id");
610  msg.readInt32("flag");
611 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildEmblem()

void EAthena::GuildRecv::processGuildEmblem ( Net::MessageIn msg)

Definition at line 812 of file guildrecv.cpp.

813 {
815  msg.readBeingId("being id");
816  msg.readInt32("guild id");
817  msg.readInt16("emblem id");
818 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildEmblemData()

void EAthena::GuildRecv::processGuildEmblemData ( Net::MessageIn msg)

Definition at line 357 of file guildrecv.cpp.

358 {
360  const int length = msg.readInt16("len");
361 
362  msg.readInt32("guild id");
363  msg.readInt32("emblem id");
364  if (length < 12)
365  return;
366  msg.skip(length - 12, "emblem data");
367 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildExpulsion()

void EAthena::GuildRecv::processGuildExpulsion ( Net::MessageIn msg)

Definition at line 740 of file guildrecv.cpp.

741 {
742  const std::string nick = msg.readString(24, "name");
743  msg.readString(40, "message");
744 
746 }
void processGuildExpulsionContinue(const std::string &nick)
Definition: guildrecv.cpp:625

References Actions::msg(), and processGuildExpulsionContinue().

◆ processGuildExpulsion2()

void EAthena::GuildRecv::processGuildExpulsion2 ( Net::MessageIn msg)

Definition at line 748 of file guildrecv.cpp.

749 {
750  msg.readString(40, "message");
751  const int charId = msg.readInt32("char id");
752 
753  std::string nick;
754 
755  if (taGuild != nullptr)
756  {
757  const GuildMember *const member = taGuild->getMemberByCharId(charId);
758  if (member != nullptr)
759  {
760  nick = member->getName();
762  }
763  }
764 }
std::string getName() const
Definition: avatar.h:53
GuildMember * getMemberByCharId(const int charId) const
Definition: guild.cpp:173
Guild * taGuild
Definition: guildhandler.h:99

References Guild::getMemberByCharId(), Avatar::getName(), Actions::msg(), processGuildExpulsionContinue(), and EAthena::taGuild.

◆ processGuildExpulsionContinue()

void EAthena::GuildRecv::processGuildExpulsionContinue ( const std::string &  nick)

Definition at line 625 of file guildrecv.cpp.

626 {
627  if (taGuild != nullptr)
628  taGuild->removeMember(nick);
629 
630  if (localPlayer == nullptr)
631  return;
632 
633  if (nick == localPlayer->getName())
634  {
635  if (taGuild != nullptr)
636  {
639  }
642 
643  if ((socialWindow != nullptr) && (taGuild != nullptr))
645  if (actorManager != nullptr)
647  }
648  else
649  {
651  if (actorManager != nullptr)
652  {
653  Being *const b = actorManager->findBeingByName(
654  nick, ActorType::Player);
655 
656  if (b != nullptr)
657  b->clearGuilds();
658  if (taGuild != nullptr)
659  taGuild->removeMember(nick);
660  }
661  }
662 }
ActorManager * actorManager
void updatePlayerColors() const
Being * findBeingByName(const std::string &name, const ActorTypeT type) const
Definition: being.h:96
const std::string & getName() const
Definition: being.h:232
void clearGuilds()
Definition: being.cpp:1289
void clearMembers()
Definition: guild.h:155
void removeMember(const GuildMember *const member)
Definition: guild.cpp:204
void removeFromMembers()
Definition: guild.cpp:273
bool removeTab(Guild *const guild)
#define delete2(var)
Definition: delete2.h:25
LocalPlayer * localPlayer
@ GUILD_USER_KICKED
Definition: notifytypes.h:55
SocialWindow * socialWindow

References actorManager, Being::clearGuilds(), Guild::clearMembers(), delete2, ActorManager::findBeingByName(), Being::getName(), NotifyTypes::GUILD_KICKED, NotifyTypes::GUILD_USER_KICKED, guildTab, localPlayer, NotifyManager::notify(), ActorType::Player, Guild::removeFromMembers(), Guild::removeMember(), SocialWindow::removeTab(), socialWindow, EAthena::taGuild, and ActorManager::updatePlayerColors().

Referenced by processGuildExpulsion(), and processGuildExpulsion2().

◆ processGuildExpulsionList1()

void EAthena::GuildRecv::processGuildExpulsionList1 ( Net::MessageIn msg)

Definition at line 766 of file guildrecv.cpp.

767 {
769  const int length = msg.readInt16("len");
770  if (length < 4)
771  return;
772 
773  const int count = (length - 4) / 88;
774  for (int i = 0; i < count; i++)
775  {
776  msg.readString(24, "char name");
777  msg.readString(24, "account name");
778  msg.readString(40, "message");
779  }
780 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildExpulsionList2()

void EAthena::GuildRecv::processGuildExpulsionList2 ( Net::MessageIn msg)

Definition at line 782 of file guildrecv.cpp.

783 {
785  const int length = msg.readInt16("len");
786  if (length < 4)
787  return;
788 
789  const int count = (length - 4) / 64;
790  for (int i = 0; i < count; i++)
791  {
792  msg.readString(24, "name");
793  msg.readString(40, "message");
794  }
795 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildExpulsionList3()

void EAthena::GuildRecv::processGuildExpulsionList3 ( Net::MessageIn msg)

Definition at line 797 of file guildrecv.cpp.

798 {
800  const int length = msg.readInt16("len");
801  if (length < 4)
802  return;
803 
804  int count = (length - 4) / 44;
805  for (int i = 0; i < count; i++)
806  {
807  msg.readInt32("char id");
808  msg.readString(40, "message");
809  }
810 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildInvite()

void EAthena::GuildRecv::processGuildInvite ( Net::MessageIn msg)

Definition at line 422 of file guildrecv.cpp.

423 {
424  const int guildId = msg.readInt32("guild id");
425 
426  if (socialWindow != nullptr)
427  {
428  const std::string guildName = msg.readString(24, "guild name");
429  socialWindow->showGuildInvite(guildName, guildId, "");
430  }
431  else
432  {
433  msg.readString(24, "guild name");
434  }
435 }
void showGuildInvite(const std::string &guildName, const int guildId, const std::string &inviterName)

References Actions::msg(), SocialWindow::showGuildInvite(), and socialWindow.

◆ processGuildInviteAck()

void EAthena::GuildRecv::processGuildInviteAck ( Net::MessageIn msg)

Definition at line 437 of file guildrecv.cpp.

438 {
439  const uint8_t flag = msg.readUInt8("flag");
440  if (guildTab == nullptr)
441  return;
442 
443  switch (flag)
444  {
445  case 0:
447  break;
448 
449  case 1:
451  break;
452 
453  case 2:
455  break;
456 
457  case 3:
459  break;
460 
461  default:
463  break;
464  }
465 }
@ GUILD_INVITE_FULL
Definition: notifytypes.h:51
@ GUILD_INVITE_FAILED
Definition: notifytypes.h:48
@ GUILD_INVITE_ERROR
Definition: notifytypes.h:52
@ GUILD_INVITE_REJECTED
Definition: notifytypes.h:49
@ GUILD_INVITE_JOINED
Definition: notifytypes.h:50

References NotifyTypes::GUILD_INVITE_ERROR, NotifyTypes::GUILD_INVITE_FAILED, NotifyTypes::GUILD_INVITE_FULL, NotifyTypes::GUILD_INVITE_JOINED, NotifyTypes::GUILD_INVITE_REJECTED, guildTab, Actions::msg(), and NotifyManager::notify().

◆ processGuildLeave()

void EAthena::GuildRecv::processGuildLeave ( Net::MessageIn msg)

Definition at line 467 of file guildrecv.cpp.

468 {
469  const std::string nick = msg.readString(24, "nick");
470  msg.readString(40, "message");
471 
472  if (taGuild != nullptr)
473  taGuild->removeMember(nick);
474 
475  if (localPlayer == nullptr)
476  return;
477 
478  if (nick == localPlayer->getName())
479  {
480  if (taGuild != nullptr)
481  {
485  }
488 
489  if ((socialWindow != nullptr) && (taGuild != nullptr))
491  if (actorManager != nullptr)
493  }
494  else
495  {
497  if (actorManager != nullptr)
498  {
499  Being *const b = actorManager->findBeingByName(
500  nick, ActorType::Player);
501 
502  if (b != nullptr)
503  b->clearGuilds();
504  if (taGuild != nullptr)
505  taGuild->removeMember(nick);
506  }
507  }
508 }
void removeGuild(const int id)
Definition: being.cpp:1248
int16_t getId() const
Definition: guild.h:135

References actorManager, Being::clearGuilds(), Guild::clearMembers(), delete2, ActorManager::findBeingByName(), Guild::getId(), Being::getName(), NotifyTypes::GUILD_LEFT, NotifyTypes::GUILD_USER_LEFT, guildTab, localPlayer, Actions::msg(), NotifyManager::notify(), ActorType::Player, Guild::removeFromMembers(), Being::removeGuild(), Guild::removeMember(), SocialWindow::removeTab(), socialWindow, EAthena::taGuild, and ActorManager::updatePlayerColors().

◆ processGuildLeave2()

void EAthena::GuildRecv::processGuildLeave2 ( Net::MessageIn msg)

Definition at line 510 of file guildrecv.cpp.

511 {
512  const int charId = msg.readInt32("char id");
513  msg.readString(40, "message");
514  std::string nick;
515 
516  if (taGuild != nullptr)
517  {
518  const GuildMember *const member = taGuild->getMemberByCharId(charId);
519  if (member != nullptr)
520  {
521  nick = member->getName();
522  taGuild->removeMember(member);
523  }
524  }
525 
526  if (localPlayer == nullptr)
527  return;
528 
529  if (charId == PlayerInfo::getCharId())
530  {
531  if (taGuild != nullptr)
532  {
536  }
539 
540  if ((socialWindow != nullptr) && (taGuild != nullptr))
542  if (actorManager != nullptr)
544  }
545  else
546  {
548  if (actorManager != nullptr)
549  {
550  Being *const b = actorManager->findBeingByName(
551  nick, ActorType::Player);
552 
553  if (b != nullptr)
554  b->clearGuilds();
555  if (taGuild != nullptr)
556  taGuild->removeMember(nick);
557  }
558  }
559 }
int getCharId()
Definition: playerinfo.cpp:386

References actorManager, Being::clearGuilds(), Guild::clearMembers(), delete2, ActorManager::findBeingByName(), PlayerInfo::getCharId(), Guild::getId(), Guild::getMemberByCharId(), Avatar::getName(), NotifyTypes::GUILD_LEFT, NotifyTypes::GUILD_USER_LEFT, guildTab, localPlayer, Actions::msg(), NotifyManager::notify(), ActorType::Player, Guild::removeFromMembers(), Being::removeGuild(), Guild::removeMember(), SocialWindow::removeTab(), socialWindow, EAthena::taGuild, and ActorManager::updatePlayerColors().

◆ processGuildMasterOrMember()

void EAthena::GuildRecv::processGuildMasterOrMember ( Net::MessageIn msg)

Definition at line 94 of file guildrecv.cpp.

95 {
96  msg.readInt32("type"); // Type (0x57 for member, 0xd7 for master)
97 }

References Actions::msg().

◆ processGuildMemberList()

void EAthena::GuildRecv::processGuildMemberList ( Net::MessageIn msg)

Definition at line 204 of file guildrecv.cpp.

205 {
206  if (actorManager == nullptr)
207  return;
208 
209  const int length = msg.readInt16("len");
210  if (length < 4)
211  return;
212  int guildSize = 0;
213  if (msg.getVersion() >= 20161026)
214  {
215  guildSize = 34;
216  }
217  else
218  {
219  guildSize = 104;
220  }
221 
222  const int count = (length - 4) / guildSize;
223  if (taGuild == nullptr)
224  {
225  logger->log1("!taGuild");
226  return;
227  }
228 
230 
231  int onlineNum = 0;
232  int totalNum = 0;
233  for (int i = 0; i < count; i++)
234  {
235  const BeingId id = msg.readBeingId("account id");
236  const int charId = msg.readInt32("char id");
237  msg.readInt16("hair");
238  msg.readInt16("hair color");
239  const int gender = msg.readInt16("gender");
240  const int race = msg.readInt16("class");
241  const int level = msg.readInt16("level");
242  const int exp = msg.readInt32("exp");
243  const int online = msg.readInt32("online");
244  const int pos = msg.readInt32("position");
245  std::string name;
246  if (msg.getVersion() < 20161026)
247  {
248  msg.skip(50, "unused");
249  name = msg.readString(24, "name");
250  }
251  else
252  {
253  msg.readInt32("last login"); // for now unused
254  name = actorManager->findCharById(charId);
255  if (name.empty())
256  {
258  }
259  }
260 
261  GuildMember *const m = taGuild->addMember(id, charId, name);
262  if (m != nullptr)
263  {
264  m->setOnline(online != 0);
265  m->setID(id);
266  m->setCharId(charId);
267  m->setGender(Being::intToGender(CAST_U8(gender)));
268  m->setLevel(level);
269  m->setExp(exp);
270  m->setPos(pos);
271  m->setRace(race);
272  Being *const being = actorManager->findBeingByName(
273  name, ActorType::Player);
274  if (being != nullptr)
275  {
276  being->setGuildName(taGuild->getName());
277  if (being->getLevel() != level)
278  {
279  being->setLevel(level);
280  being->updateName();
281  }
282  }
283  if (online != 0)
284  onlineNum ++;
285  totalNum ++;
286  }
287  }
288  taGuild->sort();
291  if (socialWindow != nullptr)
292  socialWindow->updateGuildCounter(onlineNum, totalNum);
293 }
Net::BeingHandler * beingHandler
Definition: net.cpp:99
int BeingId
Definition: beingid.h:30
#define CAST_U8
Definition: cast.h:27
std::string findCharById(const int32_t id)
void updatePlayerGuild() const
void setOnline(const bool online)
Definition: avatar.h:87
void setGender(const GenderT g)
Definition: avatar.h:165
void setExp(const int n)
Definition: avatar.h:147
void setLevel(const int level)
Definition: avatar.h:117
void setID(const BeingId id)
Definition: avatar.h:153
void setCharId(const int id)
Definition: avatar.h:159
void setRace(const int r)
Definition: avatar.h:171
void setGuildName(const std::string &name)
Definition: being.cpp:1196
virtual int getLevel() const
Definition: being.h:604
static GenderT intToGender(const uint8_t sex) A_CONST
Definition: being.h:941
void updateName()
Definition: being.cpp:3425
void setLevel(const int n)
Definition: being.h:601
void setPos(const int pos)
Definition: guild.h:50
void sort()
Definition: guild.cpp:393
GuildMember * addMember(const BeingId accountId, const int charId, const std::string &name)
Definition: guild.cpp:112
const std::string & getName() const
Definition: guild.h:128
void log1(const char *const log_text)
Definition: logger.cpp:238
virtual void requestNameByCharId(const int id) const =0
void updateGuildCounter(const int online, const int total)
Logger * logger
Definition: logger.cpp:89

References actorManager, Guild::addMember(), beingHandler, CAST_U8, Guild::clearMembers(), ActorManager::findBeingByName(), ActorManager::findCharById(), Being::getLevel(), Guild::getName(), Being::intToGender(), Logger::log1(), logger, Actions::msg(), ActorType::Player, Net::BeingHandler::requestNameByCharId(), Avatar::setCharId(), Avatar::setExp(), Avatar::setGender(), Being::setGuildName(), Avatar::setID(), Avatar::setLevel(), Being::setLevel(), Avatar::setOnline(), GuildMember::setPos(), Avatar::setRace(), socialWindow, Guild::sort(), EAthena::taGuild, SocialWindow::updateGuildCounter(), Being::updateName(), ActorManager::updatePlayerColors(), and ActorManager::updatePlayerGuild().

◆ processGuildMemberLogin()

void EAthena::GuildRecv::processGuildMemberLogin ( Net::MessageIn msg)

Definition at line 715 of file guildrecv.cpp.

716 {
717  const BeingId accountId = msg.readBeingId("account id");
718  const int charId = msg.readInt32("char id");
719  const int online = msg.readInt32("flag");
720  const GenderT gender = Being::intToGender(CAST_U8(
721  msg.readInt16("sex")));
722  msg.readInt16("hair");
723  msg.readInt16("hair color");
724  if (taGuild != nullptr)
725  {
726  GuildMember *const m = taGuild->getMember(accountId, charId);
727  if (m != nullptr)
728  {
729  m->setOnline(online != 0);
730  if (online != 0)
731  m->setGender(gender);
732  if (guildTab != nullptr)
733  guildTab->showOnline(m->getName(), fromBool(online, Online));
734  if (socialWindow != nullptr)
736  }
737  }
738 }
#define fromBool(val, name)
Definition: booldefines.h:49
void showOnline(const std::string &nick, const Online online)
Definition: chattab.cpp:547
GuildMember * getMember(const BeingId id) const
Definition: guild.cpp:140
Gender ::T GenderT
Definition: gender.h:35
bool Online
Definition: online.h:30

References CAST_U8, fromBool, Guild::getMember(), Avatar::getName(), guildTab, Being::intToGender(), Actions::msg(), Avatar::setGender(), Avatar::setOnline(), ChatTab::showOnline(), socialWindow, EAthena::taGuild, and SocialWindow::updateGuildCounter().

◆ processGuildMemberPosChange()

void EAthena::GuildRecv::processGuildMemberPosChange ( Net::MessageIn msg)

Definition at line 343 of file guildrecv.cpp.

344 {
345  msg.readInt16("len");
346  const BeingId accountId = msg.readBeingId("account id");
347  const int charId = msg.readInt32("char id");
348  const int pos = msg.readInt32("position");
349  if (taGuild != nullptr)
350  {
351  GuildMember *const m = taGuild->getMember(accountId, charId);
352  if (m != nullptr)
353  m->setPos(pos);
354  }
355 }

References Guild::getMember(), Actions::msg(), GuildMember::setPos(), and EAthena::taGuild.

◆ processGuildMessage()

void EAthena::GuildRecv::processGuildMessage ( Net::MessageIn msg)

Definition at line 561 of file guildrecv.cpp.

562 {
563  const int msgLength = msg.readInt16("len") - 4;
564 
565  if (msgLength <= 0)
566  return;
567  if (guildTab != nullptr)
568  {
569  std::string chatMsg = msg.readString(msgLength, "message");
570  const size_t pos = chatMsg.find(" : ", 0);
571  if (pos != std::string::npos)
572  {
573  const std::string sender_name = chatMsg.substr(0, pos);
574  chatMsg.erase(0, pos + 3);
575  trim(chatMsg);
576  guildTab->chatLog(sender_name, chatMsg);
577  }
578  else
579  {
580  guildTab->chatLog(chatMsg,
584  }
585  }
586  else
587  {
588  DEBUGLOGSTR("invisible guild?");
589  msg.readString(msgLength, "message");
590  }
591 }
#define DEBUGLOGSTR(str)
Definition: logger.h:45
std::string trim(std::string const &str)

References ChatMsgType::BY_SERVER, ChatTab::chatLog(), DEBUGLOGSTR, guildTab, IgnoreRecord_false, Actions::msg(), Catch::trim(), and TryRemoveColors_true.

◆ processGuildNotice()

void EAthena::GuildRecv::processGuildNotice ( Net::MessageIn msg)

Definition at line 400 of file guildrecv.cpp.

401 {
402  if (guildTab != nullptr)
403  {
404  const std::string msg1 = msg.readString(60, "msg1");
405  const std::string msg2 = msg.readString(120, "msg2");
406  guildTab->chatLog(msg1,
414  }
415  else
416  {
417  msg.readString(60, "msg1");
418  msg.readString(120, "msg2");
419  }
420 }
bool msg2(InputEvent &event)
Definition: chat.cpp:41

References ChatMsgType::BY_SERVER, ChatTab::chatLog(), guildTab, IgnoreRecord_false, Actions::msg(), Actions::msg2(), and TryRemoveColors_true.

◆ processGuildOppositionAck()

void EAthena::GuildRecv::processGuildOppositionAck ( Net::MessageIn msg)

Definition at line 613 of file guildrecv.cpp.

614 {
616  msg.readUInt8("flag");
617 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildPosInfoList()

void EAthena::GuildRecv::processGuildPosInfoList ( Net::MessageIn msg)

Definition at line 316 of file guildrecv.cpp.

317 {
318  const int length = msg.readInt16("len");
319  if (length < 4)
320  return;
321  const int count = (length - 4) / 16;
322 
323  for (int i = 0; i < count; i++)
324  {
325  msg.readInt32("id");
326  msg.readInt32("mode");
327  msg.readInt32("same id");
328  msg.readInt32("exp mode");
329  }
330 }

References Actions::msg().

◆ processGuildPositionChanged()

void EAthena::GuildRecv::processGuildPositionChanged ( Net::MessageIn msg)

Definition at line 332 of file guildrecv.cpp.

333 {
335  msg.readInt16("len");
336  msg.readInt32("id");
337  msg.readInt32("mode");
338  msg.readInt32("same ip");
339  msg.readInt32("exp mode");
340  msg.readString(24, "name");
341 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildPositionInfo()

void EAthena::GuildRecv::processGuildPositionInfo ( Net::MessageIn msg)

Definition at line 680 of file guildrecv.cpp.

681 {
682  const int guildId = msg.readInt32("guild id");
683  const int emblem = msg.readInt32("elblem id");
685  static_cast<GuildPositionFlags::Type>(msg.readInt32("mode")));
686  msg.readUInt8("guild master");
687  msg.readInt32("unused");
688  std::string guildName = msg.readString(24, "guild name");
689 
690  Guild *const g = Guild::getGuild(CAST_S16(guildId));
691  if (g == nullptr)
692  return;
693 
694  g->setName(guildName);
695  g->setEmblemId(emblem);
696  if (taGuild == nullptr)
697  taGuild = g;
698  if ((guildTab == nullptr) && (chatWindow != nullptr))
699  {
701  if (config.getBoolValue("showChatHistory"))
702  guildTab->loadFromLogFile("#Guild");
703  if (localPlayer != nullptr)
706  }
707 
708  if (localPlayer != nullptr)
709  {
710  localPlayer->setGuild(g);
712  }
713 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:94
void addGuild(Guild *const guild)
Definition: being.cpp:1237
void setGuild(Guild *const guild)
Definition: being.cpp:1354
void loadFromLogFile(const std::string &name)
Definition: chattab.cpp:510
bool getBoolValue(const std::string &key) const
virtual void memberList() const =0
Configuration config
Net::GuildHandler * guildHandler
Definition: net.cpp:92
void setGuildPositionFlags(const GuildPositionFlags::Type pos)
Definition: playerinfo.cpp:648

References Being::addGuild(), CAST_S16, chatWindow, config, Configuration::getBoolValue(), Guild::getGuild(), Guild::getName(), guildHandler, guildTab, ChatTab::loadFromLogFile(), localPlayer, Net::GuildHandler::memberList(), Actions::msg(), Guild::setEmblemId(), Being::setGuild(), Being::setGuildName(), PlayerInfo::setGuildPositionFlags(), Guild::setName(), and EAthena::taGuild.

◆ processGuildPosNameList()

void EAthena::GuildRecv::processGuildPosNameList ( Net::MessageIn msg)

Definition at line 295 of file guildrecv.cpp.

296 {
297  if (taGuild == nullptr)
298  {
299  logger->log1("!taGuild");
300  return;
301  }
302 
303  const int length = msg.readInt16("len");
304  if (length < 4)
305  return;
306  const int count = (length - 4) / 28;
307 
308  for (int i = 0; i < count; i++)
309  {
310  const int id = msg.readInt32("position id");
311  const std::string name = msg.readString(24, "position name");
312  taGuild->addPos(id, name);
313  }
314 }
void addPos(const int id, const std::string &name)
Definition: guild.cpp:369

References Guild::addPos(), Logger::log1(), logger, Actions::msg(), and EAthena::taGuild.

◆ processGuildReqAlliance()

void EAthena::GuildRecv::processGuildReqAlliance ( Net::MessageIn msg)

Definition at line 593 of file guildrecv.cpp.

594 {
596  msg.readInt32("id");
597  msg.readString(24, "name");
598 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildReqAllianceAck()

void EAthena::GuildRecv::processGuildReqAllianceAck ( Net::MessageIn msg)

Definition at line 600 of file guildrecv.cpp.

601 {
603  msg.readInt32("flag");
604 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processGuildSetPosition()

void EAthena::GuildRecv::processGuildSetPosition ( Net::MessageIn msg)

Definition at line 829 of file guildrecv.cpp.

830 {
831  const int positionLen = msg.readInt16("len") - 8;
832  const BeingId beingId = msg.readBeingId("being id");
833  std::string position;
834  if (positionLen > 0)
835  {
836  position = msg.readString(positionLen, "position");
837  }
838  Being *const dstBeing = actorManager->findBeing(beingId);
839  if (dstBeing != nullptr)
840  {
841  dstBeing->setGuildPos(position);
842  dstBeing->addToCache();
843  }
844 }
Being * findBeing(const BeingId id) const
void setGuildPos(const std::string &pos)
Definition: being.cpp:1233
void addToCache() const
Definition: being.cpp:3513

References actorManager, Being::addToCache(), ActorManager::findBeing(), Actions::msg(), and Being::setGuildPos().

◆ processGuildSkillInfo()

void EAthena::GuildRecv::processGuildSkillInfo ( Net::MessageIn msg)

Definition at line 369 of file guildrecv.cpp.

370 {
371  const int count = (msg.readInt16("len") - 6) / 37;
372  msg.readInt16("skill points");
373 
374  if (skillDialog != nullptr)
376  for (int i = 0; i < count; i++)
377  {
378  const int skillId = msg.readInt16("skill id");
379  const SkillType::SkillType inf = static_cast<SkillType::SkillType>(
380  msg.readInt32("inf"));
381  const int level = msg.readInt16("skill level");
382  const int sp = msg.readInt16("sp");
383  const int range = msg.readInt16("range");
384  const std::string name = msg.readString(24, "skill name");
385  const Modifiable up = fromBool(msg.readUInt8("up flag"), Modifiable);
386  PlayerInfo::setSkillLevel(skillId, level);
387  if (skillDialog != nullptr)
388  {
389  if (!skillDialog->updateSkill(skillId, range, up, inf, sp))
390  {
392  skillId, name, level, range, up, inf, sp);
393  }
394  }
395  }
396  if (skillDialog != nullptr)
398 }
bool updateSkill(const int id, const int range, const Modifiable modifiable, const SkillType::SkillType type, const int sp)
void updateModels()
void addSkill(const SkillOwner::Type owner, const int id, const std::string &name, const int level, const int range, const Modifiable modifiable, const SkillType::SkillType type, const int sp)
void hideSkills(const SkillOwner::Type owner)
bool Modifiable
Definition: modifiable.h:30
void setSkillLevel(const int id, const int value)
Definition: playerinfo.cpp:128
SkillDialog * skillDialog
Definition: skilldialog.cpp:66

References SkillDialog::addSkill(), fromBool, SkillOwner::Guild, SkillDialog::hideSkills(), Actions::msg(), PlayerInfo::setSkillLevel(), skillDialog, SkillDialog::updateModels(), and SkillDialog::updateSkill().

◆ processGuildUpdateCoords()

void EAthena::GuildRecv::processGuildUpdateCoords ( Net::MessageIn msg)

Definition at line 664 of file guildrecv.cpp.

665 {
666  const BeingId id = msg.readBeingId("account id");
667  const int x = msg.readInt16("x");
668  const int y = msg.readInt16("y");
669  if (taGuild != nullptr)
670  {
671  GuildMember *const m = taGuild->getMember(id);
672  if (m != nullptr)
673  {
674  m->setX(x);
675  m->setY(y);
676  }
677  }
678 }
void setY(const int y)
Definition: avatar.h:135
void setX(const int x)
Definition: avatar.h:129

References Guild::getMember(), Actions::msg(), Avatar::setX(), Avatar::setY(), EAthena::taGuild, x, and y.

◆ processOnlineInfo()

void EAthena::GuildRecv::processOnlineInfo ( Net::MessageIn msg)

Definition at line 820 of file guildrecv.cpp.

821 {
822  // look like unused packet
824  msg.readBeingId("being id");
825  msg.readInt32("char id");
826  msg.readInt32("online");
827 }

References Actions::msg(), and UNIMPLEMENTEDPACKET.

Variable Documentation

◆ showBasicInfo

bool EAthena::GuildRecv::showBasicInfo = false