ManaPlus
Public Member Functions
EAthena::PlayerHandler Class Reference

#include <playerhandler.h>

Inheritance diagram for EAthena::PlayerHandler:
Ea::PlayerHandler Net::PlayerHandler

Public Member Functions

 PlayerHandler ()
 
 ~PlayerHandler ()
 
void attack (const BeingId id, const Keep keep) const
 
void stopAttack () const
 
void emote (const uint8_t emoteId) const
 
void increaseAttribute (const AttributesT attr, const int amount) const
 
void increaseSkill (const uint16_t skillId) const
 
void pickUp (const FloorItem *const floorItem) const
 
void setDirection (const unsigned char direction) const
 
void setDestination (const int x, const int y, const int direction) const
 
void changeAction (const BeingActionT &action) const
 
void updateStatus (const uint8_t status) const
 
void requestOnlineList () const
 
void respawn () const
 
void setShortcut (const int idx, const int tab, const uint8_t type, const int id, const int level) const
 
void shortcutShiftRow (const int row, const int tab) const
 
void removeOption () const
 
void changeCart (const int type) const
 
void setMemo () const
 
void doriDori () const
 
void explosionSpirits () const
 
void requestPvpInfo () const
 
void revive () const
 
void setConfigOption (const int id, const int data) const
 
void selectStyle (const int headColor, const int headStyle, const int bodyColor, const int topStyle, const int middleStyle, const int bottomStyle, const int bodyStyle) const
 
void setStat (Net::MessageIn &msg, const int type, const int64_t base, const int mod, const Notify notify) const
 
void setTitle (const int titleId) const
 
void closeStyleWindow () const
 
- Public Member Functions inherited from Ea::PlayerHandler
 PlayerHandler ()
 
void ignorePlayer (const std::string &player, const bool ignore) const
 
void ignoreAll (const bool ignore) const
 
bool canUseMagic () const
 
int getDefaultWalkSpeed () const
 
- Public Member Functions inherited from Net::PlayerHandler
 PlayerHandler ()
 

Detailed Description

Definition at line 32 of file playerhandler.h.

Constructor & Destructor Documentation

◆ PlayerHandler()

EAthena::PlayerHandler::PlayerHandler ( )

Definition at line 58 of file playerhandler.cpp.

58  :
60 {
61  playerHandler = this;
62 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:96

References playerHandler.

◆ ~PlayerHandler()

EAthena::PlayerHandler::~PlayerHandler ( )
virtual

Reimplemented from Net::PlayerHandler.

Definition at line 64 of file playerhandler.cpp.

65 {
66  playerHandler = nullptr;
67 }

References playerHandler.

Member Function Documentation

◆ attack()

void EAthena::PlayerHandler::attack ( const BeingId  id,
const Keep  keep 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 69 of file playerhandler.cpp.

71 {
72  createOutPacket(CMSG_PLAYER_CHANGE_ACT);
73  outMsg.writeBeingId(id, "target id");
74  if (keep == Keep_true)
75  outMsg.writeInt8(7, "action");
76  else
77  outMsg.writeInt8(0, "action");
78 }
const bool Keep_true
Definition: keep.h:30
#define createOutPacket(name)
Definition: messageout.h:37

References createOutPacket, and Keep_true.

◆ changeAction()

void EAthena::PlayerHandler::changeAction ( const BeingActionT action) const
virtual

Implements Net::PlayerHandler.

Definition at line 407 of file playerhandler.cpp.

408 {
409  unsigned char type;
410  switch (action)
411  {
412  case BeingAction::SIT:
413  type = 2;
414  break;
415  case BeingAction::STAND:
417  type = 3;
418  break;
419  default:
420  case BeingAction::MOVE:
421  case BeingAction::ATTACK:
422  case BeingAction::DEAD:
423  case BeingAction::HURT:
424  case BeingAction::SPAWN:
425  case BeingAction::CAST:
426  return;
427  }
428 
429  createOutPacket(CMSG_PLAYER_CHANGE_ACT);
430  outMsg.writeInt32(0, "unused");
431  outMsg.writeInt8(type, "action");
432 }

References BeingAction::ATTACK, BeingAction::CAST, createOutPacket, BeingAction::DEAD, BeingAction::HURT, BeingAction::MOVE, BeingAction::PRESTAND, BeingAction::SIT, BeingAction::SPAWN, and BeingAction::STAND.

◆ changeCart()

void EAthena::PlayerHandler::changeCart ( const int  type) const
virtual

Implements Net::PlayerHandler.

Definition at line 491 of file playerhandler.cpp.

492 {
493  createOutPacket(CMSG_CHANGE_CART);
494  outMsg.writeInt16(CAST_S16(type), "type");
495 }
#define CAST_S16
Definition: cast.h:28

References CAST_S16, and createOutPacket.

◆ closeStyleWindow()

void EAthena::PlayerHandler::closeStyleWindow ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 854 of file playerhandler.cpp.

855 {
856  if (packetVersion < 20151104)
857  return;
858  createOutPacket(CMSG_PLAYER_STYLE_CLOSE);
859 }
int packetVersion
Definition: client.cpp:125

References createOutPacket, and packetVersion.

◆ doriDori()

void EAthena::PlayerHandler::doriDori ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 502 of file playerhandler.cpp.

503 {
504  createOutPacket(CMSG_DORI_DORI);
505 }

References createOutPacket.

◆ emote()

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

Implements Net::PlayerHandler.

Definition at line 85 of file playerhandler.cpp.

86 {
87  createOutPacket(CMSG_PLAYER_EMOTE);
88  outMsg.writeInt8(emoteId, "emote id");
89 }

References createOutPacket.

◆ explosionSpirits()

void EAthena::PlayerHandler::explosionSpirits ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 507 of file playerhandler.cpp.

508 {
509  createOutPacket(CMSG_EXPLOSION_SPIRITS);
510 }

References createOutPacket.

◆ increaseAttribute()

void EAthena::PlayerHandler::increaseAttribute ( const AttributesT  attr,
const int  amount 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 91 of file playerhandler.cpp.

93 {
94  if (attr >= Attributes::PLAYER_STR && attr <= Attributes::PLAYER_LUK)
95  {
96  createOutPacket(CMSG_STAT_UPDATE_REQUEST);
97  outMsg.writeInt16(CAST_S16(attr), "attribute id");
98  outMsg.writeInt8(CAST_S8(amount), "increase");
99  }
100 }
#define CAST_S8
Definition: cast.h:26

References CAST_S16, CAST_S8, createOutPacket, Attributes::PLAYER_LUK, and Attributes::PLAYER_STR.

◆ increaseSkill()

void EAthena::PlayerHandler::increaseSkill ( const uint16_t  skillId) const
virtual

Implements Net::PlayerHandler.

Definition at line 102 of file playerhandler.cpp.

103 {
105  return;
106 
107  createOutPacket(CMSG_SKILL_LEVELUP_REQUEST);
108  outMsg.writeInt16(skillId, "skill id");
109 }
@ PLAYER_SKILL_POINTS
Definition: attributes.h:48
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:102

References createOutPacket, PlayerInfo::getAttribute(), and Attributes::PLAYER_SKILL_POINTS.

◆ pickUp()

void EAthena::PlayerHandler::pickUp ( const FloorItem *const  floorItem) const
virtual

Implements Net::PlayerHandler.

Definition at line 111 of file playerhandler.cpp.

112 {
113  if (floorItem == nullptr)
114  return;
115 
116  createOutPacket(CMSG_ITEM_PICKUP);
117  const BeingId id = floorItem->getId();
118  if (packetVersion >= 20101124)
119  {
120  outMsg.writeBeingId(id, "object id");
121  }
122  else if (packetVersion >= 20080827)
123  {
124  outMsg.writeInt32(0, "unused");
125  outMsg.writeInt8(0, "unused");
126  outMsg.writeBeingId(id, "object id");
127  }
128  else if (packetVersion >= 20070212)
129  {
130  outMsg.writeInt32(0, "unused");
131  outMsg.writeBeingId(id, "object id");
132  }
133  else if (packetVersion >= 20070108)
134  {
135  outMsg.writeInt32(0, "unused");
136  outMsg.writeInt8(0, "unused");
137  outMsg.writeBeingId(id, "object id");
138  }
139  else if (packetVersion >= 20050719)
140  {
141  outMsg.writeInt32(0, "unused");
142  outMsg.writeInt16(0, "unused");
143  outMsg.writeInt8(0, "unused");
144  outMsg.writeBeingId(id, "object id");
145  }
146  else if (packetVersion >= 20050718)
147  {
148  outMsg.writeInt8(0, "unused");
149  outMsg.writeBeingId(id, "object id");
150  }
151  else if (packetVersion >= 20050628)
152  {
153  outMsg.writeInt32(0, "unused");
154  outMsg.writeInt8(0, "unused");
155  outMsg.writeBeingId(id, "object id");
156  }
157  else if (packetVersion >= 20050509)
158  {
159  outMsg.writeInt16(0, "unused");
160  outMsg.writeBeingId(id, "object id");
161  }
162  else if (packetVersion >= 20050110)
163  {
164  outMsg.writeInt16(0, "unused");
165  outMsg.writeInt8(0, "unused");
166  outMsg.writeBeingId(id, "object id");
167  }
168  else if (packetVersion >= 20041129)
169  {
170  outMsg.writeInt8(0, "unused");
171  outMsg.writeBeingId(id, "object id");
172  }
173  else if (packetVersion >= 20041025)
174  {
175  outMsg.writeInt16(0, "unused");
176  outMsg.writeInt8(0, "unused");
177  outMsg.writeBeingId(id, "object id");
178  }
179  else if (packetVersion >= 20041005)
180  {
181  outMsg.writeInt32(0, "unused");
182  outMsg.writeBeingId(id, "object id");
183  }
184  else if (packetVersion >= 20040920)
185  {
186  outMsg.writeInt32(0, "unused");
187  outMsg.writeInt32(0, "unused");
188  outMsg.writeBeingId(id, "object id");
189  }
190  else if (packetVersion >= 20040906)
191  {
192  outMsg.writeInt32(0, "unused");
193  outMsg.writeInt8(0, "unused");
194  outMsg.writeBeingId(id, "object id");
195  }
196  else if (packetVersion >= 20040809)
197  {
198  outMsg.writeInt32(0, "unused");
199  outMsg.writeInt16(0, "unused");
200  outMsg.writeInt8(0, "unused");
201  outMsg.writeBeingId(id, "object id");
202  }
203  else if (packetVersion >= 20040713)
204  {
205  outMsg.writeInt32(0, "unused");
206  outMsg.writeBeingId(id, "object id");
207  }
208  else
209  {
210  outMsg.writeBeingId(id, "object id");
211  }
212 
214 }
int BeingId
Definition: beingid.h:30
BeingId getId() const
Definition: actorsprite.h:64
static void pushPickup(const BeingId floorId)

References createOutPacket, ActorSprite::getId(), packetVersion, and Ea::InventoryHandler::pushPickup().

◆ removeOption()

void EAthena::PlayerHandler::removeOption ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 486 of file playerhandler.cpp.

487 {
488  createOutPacket(CMSG_REMOVE_OPTION);
489 }

References createOutPacket.

◆ requestOnlineList()

void EAthena::PlayerHandler::requestOnlineList ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 440 of file playerhandler.cpp.

441 {
442  createOutPacket(CMSG_ONLINE_LIST);
443 }

References createOutPacket.

◆ requestPvpInfo()

void EAthena::PlayerHandler::requestPvpInfo ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 512 of file playerhandler.cpp.

513 {
514  createOutPacket(CMSG_PVP_INFO);
515  outMsg.writeInt32(0, "char id");
516  outMsg.writeInt32(0, "account id");
517 }

References createOutPacket.

◆ respawn()

void EAthena::PlayerHandler::respawn ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 434 of file playerhandler.cpp.

435 {
436  createOutPacket(CMSG_PLAYER_RESTART);
437  outMsg.writeInt8(0, "action");
438 }

References createOutPacket.

◆ revive()

void EAthena::PlayerHandler::revive ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 519 of file playerhandler.cpp.

520 {
521  createOutPacket(CMSG_PLAYER_AUTO_REVIVE);
522 }

References createOutPacket.

◆ selectStyle()

void EAthena::PlayerHandler::selectStyle ( const int  headColor,
const int  headStyle,
const int  bodyColor,
const int  topStyle,
const int  middleStyle,
const int  bottomStyle,
const int  bodyStyle 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 811 of file playerhandler.cpp.

818 {
819  if (packetVersion < 20151104)
820  return;
821  if (packetVersionMain >= 20180516 ||
822  packetVersionRe >= 20180516 ||
823  packetVersionZero >= 20180523)
824  {
825  createOutPacket(CMSG_PLAYER_SELECT_STYLE2);
826  outMsg.writeInt16(CAST_S16(headColor), "head color");
827  outMsg.writeInt16(CAST_S16(headStyle), "head style");
828  outMsg.writeInt16(CAST_S16(bodyColor), "body color");
829  outMsg.writeInt16(CAST_S16(topStyle), "top style");
830  outMsg.writeInt16(CAST_S16(middleStyle), "middle style");
831  outMsg.writeInt16(CAST_S16(bottomStyle), "bottom style");
832  outMsg.writeInt16(CAST_S16(bodyStyle), "body style");
833  }
834  else
835  {
836  createOutPacket(CMSG_PLAYER_SELECT_STYLE);
837  outMsg.writeInt16(CAST_S16(headColor), "head color");
838  outMsg.writeInt16(CAST_S16(headStyle), "head style");
839  outMsg.writeInt16(CAST_S16(bodyColor), "body color");
840  outMsg.writeInt16(CAST_S16(topStyle), "top style");
841  outMsg.writeInt16(CAST_S16(middleStyle), "middle style");
842  outMsg.writeInt16(CAST_S16(bottomStyle), "bottom style");
843  }
844 }
int packetVersionRe
Definition: client.cpp:127
int packetVersionMain
Definition: client.cpp:126
int packetVersionZero
Definition: client.cpp:128

References CAST_S16, createOutPacket, packetVersion, packetVersionMain, packetVersionRe, and packetVersionZero.

◆ setConfigOption()

void EAthena::PlayerHandler::setConfigOption ( const int  id,
const int  data 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 524 of file playerhandler.cpp.

526 {
527  createOutPacket(CMSG_SET_CONFIG_OPTION);
528  outMsg.writeInt32(id, "config option");
529  outMsg.writeInt32(data, "config data");
530 }
uint32_t data

References createOutPacket, and data.

◆ setDestination()

void EAthena::PlayerHandler::setDestination ( const int  x,
const int  y,
const int  direction 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 396 of file playerhandler.cpp.

398 {
399  createOutPacket(CMSG_PLAYER_CHANGE_DEST);
400  if (packetVersion >= 20080827 && packetVersion < 20101124)
401  outMsg.writeInt32(0, "unused");
402  outMsg.writeCoordinates(CAST_U16(x),
403  CAST_U16(y),
404  CAST_U8(direction), "destination");
405 }
#define CAST_U16
Definition: cast.h:29
#define CAST_U8
Definition: cast.h:27

References CAST_U16, CAST_U8, createOutPacket, packetVersion, x, and y.

◆ setDirection()

void EAthena::PlayerHandler::setDirection ( const unsigned char  direction) const
virtual

Implements Net::PlayerHandler.

Definition at line 216 of file playerhandler.cpp.

217 {
218  createOutPacket(CMSG_PLAYER_CHANGE_DIR);
219  if (packetVersion >= 20101124)
220  {
221  outMsg.writeInt8(0, "head direction");
222  outMsg.writeInt8(0, "unused");
223  outMsg.writeInt8(MessageOut::toServerDirection(direction),
224  "player direction");
225  }
226  else if (packetVersion >= 20080827)
227  {
228  outMsg.writeInt16(0, "unused");
229  outMsg.writeInt8(0, "head direction");
230  outMsg.writeInt32(0, "unused");
231  outMsg.writeInt8(MessageOut::toServerDirection(direction),
232  "player direction");
233  }
234  else if (packetVersion >= 20070212)
235  {
236  outMsg.writeInt32(0, "unused");
237  outMsg.writeInt16(0, "unused");
238  outMsg.writeInt8(0, "head direction");
239  outMsg.writeInt16(0, "unused");
240  outMsg.writeInt8(MessageOut::toServerDirection(direction),
241  "player direction");
242  }
243  else if (packetVersion >= 20070108)
244  {
245  outMsg.writeInt32(0, "unused");
246  outMsg.writeInt32(0, "unused");
247  outMsg.writeInt8(0, "head direction");
248  outMsg.writeInt16(0, "unused");
249  outMsg.writeInt8(MessageOut::toServerDirection(direction),
250  "player direction");
251  }
252  else if (packetVersion >= 20060327)
253  {
254  outMsg.writeInt32(0, "unused");
255  outMsg.writeInt8(0, "unused");
256  outMsg.writeInt8(0, "head direction");
257  outMsg.writeInt8(0, "unused");
258  outMsg.writeInt16(0, "unused");
259  outMsg.writeInt8(MessageOut::toServerDirection(direction),
260  "player direction");
261  }
262  else if (packetVersion >= 20050719)
263  {
264  outMsg.writeInt32(0, "unused");
265  outMsg.writeInt16(0, "unused");
266  outMsg.writeInt8(0, "head direction");
267  outMsg.writeInt8(0, "unused");
268  outMsg.writeInt32(0, "unused");
269  outMsg.writeInt16(0, "unused");
270  outMsg.writeInt8(MessageOut::toServerDirection(direction),
271  "player direction");
272  }
273  else if (packetVersion >= 20050718)
274  {
275  outMsg.writeInt32(0, "unused");
276  outMsg.writeInt8(0, "head direction");
277  outMsg.writeInt8(0, "unused");
278  outMsg.writeInt16(0, "unused");
279  outMsg.writeInt8(MessageOut::toServerDirection(direction),
280  "player direction");
281  }
282  else if (packetVersion >= 20050628)
283  {
284  outMsg.writeInt32(0, "unused");
285  outMsg.writeInt16(0, "unused");
286  outMsg.writeInt8(0, "head direction");
287  outMsg.writeInt8(0, "unused");
288  outMsg.writeInt32(0, "unused");
289  outMsg.writeInt16(0, "unused");
290  outMsg.writeInt8(MessageOut::toServerDirection(direction),
291  "player direction");
292  }
293  else if (packetVersion >= 20050509)
294  {
295  outMsg.writeInt8(0, "unused");
296  outMsg.writeInt32(0, "unused");
297  outMsg.writeInt16(0, "unused");
298  outMsg.writeInt8(0, "head direction");
299  outMsg.writeInt8(0, "unused");
300  outMsg.writeInt16(0, "unused");
301  outMsg.writeInt8(MessageOut::toServerDirection(direction),
302  "player direction");
303  }
304  else if (packetVersion >= 20050110)
305  {
306  outMsg.writeInt32(0, "unused");
307  outMsg.writeInt32(0, "unused");
308  outMsg.writeInt16(0, "unused");
309  outMsg.writeInt8(0, "head direction");
310  outMsg.writeInt8(0, "unused");
311  outMsg.writeInt32(0, "unused");
312  outMsg.writeInt32(0, "unused");
313  outMsg.writeInt8(MessageOut::toServerDirection(direction),
314  "player direction");
315  }
316  else if (packetVersion >= 20041129)
317  {
318  outMsg.writeInt8(0, "unused");
319  outMsg.writeInt8(0, "head direction");
320  outMsg.writeInt8(0, "unused");
321  outMsg.writeInt16(0, "unused");
322  outMsg.writeInt8(MessageOut::toServerDirection(direction),
323  "player direction");
324  }
325  else if (packetVersion >= 20041025)
326  {
327  outMsg.writeInt32(0, "unused");
328  outMsg.writeInt8(0, "head direction");
329  outMsg.writeInt8(0, "unused");
330  outMsg.writeInt32(0, "unused");
331  outMsg.writeInt16(0, "unused");
332  outMsg.writeInt8(MessageOut::toServerDirection(direction),
333  "player direction");
334  }
335  else if (packetVersion >= 20041005)
336  {
337  outMsg.writeInt16(0, "unused");
338  outMsg.writeInt8(0, "unused");
339  outMsg.writeInt8(0, "head direction");
340  outMsg.writeInt32(0, "unused");
341  outMsg.writeInt16(0, "unused");
342  outMsg.writeInt8(MessageOut::toServerDirection(direction),
343  "player direction");
344  }
345  else if (packetVersion >= 20040920)
346  {
347  outMsg.writeInt32(0, "unused");
348  outMsg.writeInt16(0, "unused");
349  outMsg.writeInt8(0, "head direction");
350  outMsg.writeInt32(0, "unused");
351  outMsg.writeInt32(0, "unused");
352  outMsg.writeInt8(MessageOut::toServerDirection(direction),
353  "player direction");
354  }
355  else if (packetVersion >= 20040906)
356  {
357  outMsg.writeInt16(0, "unused");
358  outMsg.writeInt8(0, "head direction");
359  outMsg.writeInt16(0, "unused");
360  outMsg.writeInt16(0, "unused");
361  outMsg.writeInt8(MessageOut::toServerDirection(direction),
362  "player direction");
363  }
364  else if (packetVersion >= 20040809)
365  {
366  outMsg.writeInt16(0, "unused");
367  outMsg.writeInt16(0, "unused");
368  outMsg.writeInt8(0, "unused");
369  outMsg.writeInt8(0, "head direction");
370  outMsg.writeInt16(0, "unused");
371  outMsg.writeInt8(0, "unused");
372  outMsg.writeInt8(MessageOut::toServerDirection(direction),
373  "player direction");
374  }
375  else if (packetVersion >= 20040713)
376  {
377  outMsg.writeInt8(0, "unused");
378  outMsg.writeInt8(0, "unused");
379  outMsg.writeInt8(0, "unused");
380  outMsg.writeInt8(0, "head direction");
381  outMsg.writeInt16(0, "unused");
382  outMsg.writeInt16(0, "unused");
383  outMsg.writeInt16(0, "unused");
384  outMsg.writeInt8(MessageOut::toServerDirection(direction),
385  "player direction");
386  }
387  else
388  {
389  outMsg.writeInt8(0, "head direction");
390  outMsg.writeInt8(0, "unused");
391  outMsg.writeInt8(MessageOut::toServerDirection(direction),
392  "player direction");
393  }
394 }
static unsigned char toServerDirection(unsigned char direction) A_CONST
Definition: messageout.cpp:253

References createOutPacket, packetVersion, and Net::MessageOut::toServerDirection().

◆ setMemo()

void EAthena::PlayerHandler::setMemo ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 497 of file playerhandler.cpp.

498 {
499  createOutPacket(CMSG_PLAYER_SET_MEMO);
500 }

References createOutPacket.

◆ setShortcut()

void EAthena::PlayerHandler::setShortcut ( const int  idx,
const int  tab,
const uint8_t  type,
const int  id,
const int  level 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 452 of file playerhandler.cpp.

457 {
458  createOutPacket(CMSG_SET_SHORTCUTS);
459  if (packetVersionMain >= 20190522 ||
460  packetVersionRe >= 20190508 ||
461  packetVersionZero >= 20190605)
462  {
463  outMsg.writeInt16(CAST_S16(tab), "tab");
464  }
465  outMsg.writeInt16(CAST_S16(idx), "index");
466  outMsg.writeInt8(CAST_S8(type), "type");
467  outMsg.writeInt32(id, "id");
468  outMsg.writeInt16(CAST_S16(level), "level");
469 }

References CAST_S16, CAST_S8, createOutPacket, packetVersionMain, packetVersionRe, and packetVersionZero.

◆ setStat()

void EAthena::PlayerHandler::setStat ( Net::MessageIn msg,
const int  type,
const int64_t  base,
const int  mod,
const Notify  notify 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 537 of file playerhandler.cpp.

542 {
543  switch (type)
544  {
545  case Sp::SPEED:
548  CAST_S32(base),
549  Notify_true);
551  0,
552  Notify_true);
553  break;
554  case Sp::BASEEXP:
556  base,
557  Notify_true);
558  break;
559  case Sp::JOBEXP:
561  base,
562  Notify_true);
563  break;
564  case Sp::KARMA:
566  CAST_S32(base),
567  Notify_true);
569  0,
570  Notify_true);
571  break;
572  case Sp::MANNER:
574  CAST_S32(base),
575  Notify_true);
577  0,
578  Notify_true);
579  break;
580  case Sp::HP:
582  base,
583  Notify_true);
584  if (localPlayer->isInParty() && (Party::getParty(1) != nullptr))
585  {
586  PartyMember *const m = Party::getParty(1)
588  if (m != nullptr)
589  {
590  m->setHp(CAST_S32(base));
593  }
594  }
595  break;
596  case Sp::MAXHP:
598  base,
599  Notify_true);
600 
601  if (localPlayer->isInParty() && (Party::getParty(1) != nullptr))
602  {
603  PartyMember *const m = Party::getParty(1)->getMember(
604  localPlayer->getId());
605  if (m != nullptr)
606  {
608  m->setMaxHp(CAST_S32(base));
609  }
610  }
611  break;
612  case Sp::SP:
614  base,
615  Notify_true);
616  break;
617  case Sp::MAXSP:
619  base,
620  Notify_true);
621  break;
622  case Sp::STATUSPOINT:
624  base,
625  Notify_true);
626  break;
627  case Sp::BASELEVEL:
629  base,
630  Notify_true);
631  if (localPlayer != nullptr)
632  {
635  }
636  break;
637  case Sp::SKILLPOINT:
639  base,
640  Notify_true);
641  if (skillDialog != nullptr)
642  skillDialog->update();
643  break;
644  case Sp::STR:
646  break;
647  case Sp::AGI:
649  break;
650  case Sp::VIT:
652  break;
653  case Sp::INT:
655  break;
656  case Sp::DEX:
658  break;
659  case Sp::LUK:
661  break;
662  case Sp::ZENY:
663  {
664  const int oldMoney = PlayerInfo::getAttribute(Attributes::MONEY);
665  const int newMoney = CAST_S32(base);
666  if (newMoney > oldMoney)
667  {
669  UnitsDb::formatCurrency(newMoney - oldMoney));
670  }
671  else if (newMoney < oldMoney)
672  {
674  UnitsDb::formatCurrency(oldMoney - newMoney).c_str());
675  }
676 
678  newMoney,
679  Notify_true);
680  break;
681  }
682  case Sp::NEXTBASEEXP:
684  base,
685  Notify_true);
686  break;
687  case Sp::NEXTJOBEXP:
689  base,
690  Notify_true);
691  break;
692  case Sp::WEIGHT:
694  base,
695  Notify_true);
696  break;
697  case Sp::MAXWEIGHT:
699  base,
700  Notify_true);
701  break;
702  case Sp::USTR:
704  CAST_S32(base));
705  break;
706  case Sp::UAGI:
708  CAST_S32(base));
709  break;
710  case Sp::UVIT:
712  CAST_S32(base));
713  break;
714  case Sp::UINT:
716  CAST_S32(base));
717  break;
718  case Sp::UDEX:
720  CAST_S32(base));
721  break;
722  case Sp::ULUK:
724  CAST_S32(base));
725  break;
726 
727  case Sp::ATK1:
729  CAST_S32(base),
730  Notify_true);
732  break;
733  case Sp::ATK2:
735  CAST_S32(base),
736  Notify_true);
738  break;
739  case Sp::MATK1:
741  CAST_S32(base),
742  Notify_true);
743  break;
744  case Sp::MATK2:
746  CAST_S32(base),
747  Notify_true);
748  break;
749  case Sp::DEF1:
751  CAST_S32(base),
752  Notify_true);
753  break;
754  case Sp::DEF2:
756  CAST_S32(base),
757  Notify_true);
758  break;
759  case Sp::MDEF1:
761  CAST_S32(base),
762  Notify_true);
763  break;
764  case Sp::MDEF2:
766  CAST_S32(base),
767  Notify_true);
768  break;
769  case Sp::HIT:
771  CAST_S32(base),
772  Notify_true);
773  break;
774  case Sp::FLEE1:
776  CAST_S32(base),
777  Notify_true);
778  break;
779  case Sp::FLEE2:
781  CAST_S32(base),
782  Notify_true);
783  break;
784  case Sp::CRITICAL:
786  CAST_S32(base),
787  Notify_true);
788  break;
789  case Sp::ASPD:
792  CAST_S32(base),
793  Notify_true);
795  0,
796  Notify_true);
798  break;
799  case Sp::JOBLEVEL:
801  base,
802  Notify_true);
803  break;
804 
805  default:
807  break;
808  }
809 }
#define CAST_S32
Definition: cast.h:30
void setMaxHp(const int maxHp)
Definition: avatar.h:99
void setHp(const int hp)
Definition: avatar.h:93
void setAttackSpeed(const int speed)
Definition: being.h:464
void updateName()
Definition: being.cpp:3425
void setLevel(const int n)
Definition: being.h:601
void setWalkSpeed(const int speed)
Definition: being.h:452
bool isInParty() const
Definition: being.h:321
PartyMember * getMember(const BeingId id) const
Definition: party.cpp:99
static Party * getParty(const int16_t id)
Definition: party.cpp:313
std::string update(const int id)
void setPointsNeeded(const AttributesT id, const int needed)
#define setStatComplex(stat)
LocalPlayer * localPlayer
#define UNIMPLEMENTEDPACKETFIELD(field)
Definition: logger.h:59
@ PLAYER_CHAR_POINTS
Definition: attributes.h:49
@ PLAYER_EXP_NEEDED
Definition: attributes.h:37
@ TOTAL_WEIGHT
Definition: attributes.h:39
@ PLAYER_MAX_MP
Definition: attributes.h:35
@ PLAYER_BASE_LEVEL
Definition: attributes.h:31
@ PLAYER_KARMA
Definition: attributes.h:55
@ PLAYER_JOB_EXP
Definition: attributes.h:66
@ PLAYER_JOB_LEVEL
Definition: attributes.h:41
@ PLAYER_WALK_SPEED
Definition: attributes.h:53
@ PLAYER_MANNER
Definition: attributes.h:56
@ PLAYER_MAX_HP
Definition: attributes.h:33
@ PLAYER_JOB_EXP_NEEDED
Definition: attributes.h:67
@ PLAYER_ATTACK_DELAY
Definition: attributes.h:51
void notify(const unsigned int message)
void setStatMod(const AttributesT id, const int value, const Notify notify)
Definition: playerinfo.cpp:159
void setAttribute(const AttributesT id, const int64_t value, const Notify notify)
Definition: playerinfo.cpp:110
void updateAttrs()
Definition: playerinfo.cpp:420
void setStatBase(const AttributesT id, const int value, const Notify notify)
Definition: playerinfo.cpp:143
@ NEXTJOBEXP
Definition: sp.h:54
@ STATUSPOINT
Definition: sp.h:40
@ SPEED
Definition: sp.h:31
@ MAXSP
Definition: sp.h:39
@ DEF1
Definition: sp.h:76
@ MATK1
Definition: sp.h:74
@ CRITICAL
Definition: sp.h:83
@ FLEE2
Definition: sp.h:82
@ ATK2
Definition: sp.h:73
@ UAGI
Definition: sp.h:64
@ LUK
Definition: sp.h:49
@ ASPD
Definition: sp.h:84
@ MDEF1
Definition: sp.h:78
@ MAXWEIGHT
Definition: sp.h:56
@ ATK1
Definition: sp.h:72
@ NEXTBASEEXP
Definition: sp.h:53
@ JOBLEVEL
Definition: sp.h:86
@ DEX
Definition: sp.h:48
@ SP
Definition: sp.h:38
@ KARMA
Definition: sp.h:34
@ FLEE1
Definition: sp.h:81
@ USTR
Definition: sp.h:63
@ BASEEXP
Definition: sp.h:32
@ AGI
Definition: sp.h:45
@ ZENY
Definition: sp.h:51
@ HIT
Definition: sp.h:80
@ MANNER
Definition: sp.h:35
@ ULUK
Definition: sp.h:68
@ VIT
Definition: sp.h:46
@ WEIGHT
Definition: sp.h:55
@ DEF2
Definition: sp.h:77
@ HP
Definition: sp.h:36
@ INT
Definition: sp.h:47
@ JOBEXP
Definition: sp.h:33
@ STR
Definition: sp.h:44
@ UDEX
Definition: sp.h:67
@ UVIT
Definition: sp.h:65
@ UINT
Definition: sp.h:66
@ SKILLPOINT
Definition: sp.h:43
@ BASELEVEL
Definition: sp.h:42
@ MDEF2
Definition: sp.h:79
@ MATK2
Definition: sp.h:75
@ MAXHP
Definition: sp.h:37
std::string formatCurrency(const int value)
Definition: unitsdb.cpp:324
const bool Notify_true
Definition: notify.h:30
SkillDialog * skillDialog
Definition: skilldialog.cpp:66
StatusWindow * statusWindow

References Sp::AGI, Sp::ASPD, Sp::ATK1, Sp::ATK2, anonymous_namespace{stringutils.cpp}::base, Sp::BASEEXP, Sp::BASELEVEL, CAST_S32, Sp::CRITICAL, Sp::DEF1, Sp::DEF2, Sp::DEX, Sp::FLEE1, Sp::FLEE2, UnitsDb::formatCurrency(), PlayerInfo::getAttribute(), ActorSprite::getId(), Party::getMember(), Party::getParty(), Sp::HIT, Sp::HP, Sp::INT, Being::isInParty(), Sp::JOBEXP, Sp::JOBLEVEL, Sp::KARMA, localPlayer, Sp::LUK, Sp::MANNER, Sp::MATK1, Sp::MATK2, Attributes::MAX_WEIGHT, Sp::MAXHP, Sp::MAXSP, Sp::MAXWEIGHT, Sp::MDEF1, Sp::MDEF2, Attributes::MONEY, NotifyTypes::MONEY_GET, NotifyTypes::MONEY_SPENT, Sp::NEXTBASEEXP, Sp::NEXTJOBEXP, NotifyManager::notify(), Notify_true, Attributes::PLAYER_AGI, Attributes::PLAYER_ATK, Attributes::PLAYER_ATTACK_DELAY, Attributes::PLAYER_BASE_LEVEL, Attributes::PLAYER_CHAR_POINTS, Attributes::PLAYER_CRIT, Attributes::PLAYER_DEF, Attributes::PLAYER_DEX, Attributes::PLAYER_EXP, Attributes::PLAYER_EXP_NEEDED, Attributes::PLAYER_FLEE, Attributes::PLAYER_HIT, Attributes::PLAYER_HP, Attributes::PLAYER_INT, Attributes::PLAYER_JOB_EXP, Attributes::PLAYER_JOB_EXP_NEEDED, Attributes::PLAYER_JOB_LEVEL, Attributes::PLAYER_KARMA, Attributes::PLAYER_LUK, Attributes::PLAYER_MANNER, Attributes::PLAYER_MATK, Attributes::PLAYER_MAX_HP, Attributes::PLAYER_MAX_MP, Attributes::PLAYER_MDEF, Attributes::PLAYER_MP, Attributes::PLAYER_SKILL_POINTS, Attributes::PLAYER_STR, Attributes::PLAYER_VIT, Attributes::PLAYER_WALK_SPEED, Being::setAttackSpeed(), PlayerInfo::setAttribute(), Avatar::setHp(), Being::setLevel(), Avatar::setMaxHp(), StatusWindow::setPointsNeeded(), PlayerInfo::setStatBase(), setStatComplex, PlayerInfo::setStatMod(), Being::setWalkSpeed(), skillDialog, Sp::SKILLPOINT, Sp::SP, Sp::SPEED, Sp::STATUSPOINT, statusWindow, Sp::STR, Attributes::TOTAL_WEIGHT, Sp::UAGI, Sp::UDEX, Sp::UINT, Sp::ULUK, UNIMPLEMENTEDPACKETFIELD, SkillDialog::update(), PlayerInfo::updateAttrs(), Being::updateName(), Sp::USTR, Sp::UVIT, Sp::VIT, Sp::WEIGHT, and Sp::ZENY.

◆ setTitle()

void EAthena::PlayerHandler::setTitle ( const int  titleId) const
virtual

Implements Net::PlayerHandler.

Definition at line 846 of file playerhandler.cpp.

847 {
848  if (packetVersion < 20140903)
849  return;
850  createOutPacket(CMSG_PLAYER_SET_TITLE);
851  outMsg.writeInt32(titleId, "title");
852 }

References createOutPacket, and packetVersion.

◆ shortcutShiftRow()

void EAthena::PlayerHandler::shortcutShiftRow ( const int  row,
const int  tab 
) const
virtual

Implements Net::PlayerHandler.

Definition at line 471 of file playerhandler.cpp.

473 {
474  if (packetVersion < 20140129)
475  return;
476  createOutPacket(CMSG_SHORTCUTS_ROW_SHIFT);
477  if (packetVersionMain >= 20190522 ||
478  packetVersionRe >= 20190508 ||
479  packetVersionZero >= 20190605)
480  {
481  outMsg.writeInt16(CAST_S16(tab), "tab");
482  }
483  outMsg.writeInt8(CAST_S8(row), "row");
484 }

References CAST_S16, CAST_S8, createOutPacket, packetVersion, packetVersionMain, packetVersionRe, and packetVersionZero.

◆ stopAttack()

void EAthena::PlayerHandler::stopAttack ( ) const
virtual

Implements Net::PlayerHandler.

Definition at line 80 of file playerhandler.cpp.

81 {
82  createOutPacket(CMSG_PLAYER_STOP_ATTACK);
83 }

References createOutPacket.

◆ updateStatus()

void EAthena::PlayerHandler::updateStatus ( const uint8_t  status) const
virtual

Implements Net::PlayerHandler.

Definition at line 445 of file playerhandler.cpp.

446 {
447  createOutPacket(CMSG_SET_STATUS);
448  outMsg.writeInt8(status, "status");
449  outMsg.writeInt8(0, "unused");
450 }

References createOutPacket.


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