ManaPlus
Public Member Functions
TmwAthena::PlayerHandler Class Reference

#include <playerhandler.h>

Inheritance diagram for TmwAthena::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 requestOnlineList () const
 
void updateStatus (const uint8_t status) 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()

TmwAthena::PlayerHandler::PlayerHandler ( )

Definition at line 52 of file playerhandler.cpp.

52  :
54 {
55  playerHandler = this;
56 }
Net::PlayerHandler * playerHandler
Definition: net.cpp:96

References playerHandler.

◆ ~PlayerHandler()

TmwAthena::PlayerHandler::~PlayerHandler ( )
virtual

Reimplemented from Net::PlayerHandler.

Definition at line 58 of file playerhandler.cpp.

59 {
60  playerHandler = nullptr;
61 }

References playerHandler.

Member Function Documentation

◆ attack()

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

Implements Net::PlayerHandler.

Definition at line 63 of file playerhandler.cpp.

65 {
66  createOutPacket(CMSG_PLAYER_CHANGE_ACT);
67  outMsg.writeBeingId(id, "target id");
68  if (keep == Keep_true)
69  outMsg.writeInt8(7, "action");
70  else
71  outMsg.writeInt8(0, "action");
72 }
const bool Keep_true
Definition: keep.h:30
#define createOutPacket(name)
Definition: messageout.h:37

References createOutPacket, and Keep_true.

◆ changeAction()

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

Implements Net::PlayerHandler.

Definition at line 131 of file playerhandler.cpp.

132 {
133  char type;
134  switch (action)
135  {
136  case BeingAction::SIT:
137  type = 2;
138  break;
139  case BeingAction::STAND:
141  type = 3;
142  break;
143  default:
144  case BeingAction::MOVE:
145  case BeingAction::ATTACK:
146  case BeingAction::DEAD:
147  case BeingAction::HURT:
148  case BeingAction::SPAWN:
149  case BeingAction::CAST:
150  return;
151  }
152 
153  createOutPacket(CMSG_PLAYER_CHANGE_ACT);
154  outMsg.writeInt32(0, "unused");
155  outMsg.writeInt8(type, "action");
156 }

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

◆ changeCart()

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

Implements Net::PlayerHandler.

Definition at line 173 of file playerhandler.cpp.

174 {
175 }

◆ closeStyleWindow()

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

Implements Net::PlayerHandler.

Definition at line 516 of file playerhandler.cpp.

517 {
518 }

◆ doriDori()

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

Implements Net::PlayerHandler.

Definition at line 193 of file playerhandler.cpp.

194 {
195 }

◆ emote()

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

Implements Net::PlayerHandler.

Definition at line 79 of file playerhandler.cpp.

80 {
81  createOutPacket(CMSG_PLAYER_EMOTE);
82  outMsg.writeInt8(emoteId, "emote id");
83 }

References createOutPacket.

◆ explosionSpirits()

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

Implements Net::PlayerHandler.

Definition at line 197 of file playerhandler.cpp.

198 {
199 }

◆ increaseAttribute()

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

Implements Net::PlayerHandler.

Definition at line 85 of file playerhandler.cpp.

87 {
88  if (attr >= Attributes::PLAYER_STR && attr <= Attributes::PLAYER_LUK)
89  {
90  createOutPacket(CMSG_STAT_UPDATE_REQUEST);
91  outMsg.writeInt16(CAST_S16(attr), "attribute id");
92  outMsg.writeInt8(1, "increment");
93  }
94 }
#define CAST_S16
Definition: cast.h:28

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

◆ increaseSkill()

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

Implements Net::PlayerHandler.

Definition at line 96 of file playerhandler.cpp.

97 {
99  return;
100 
101  createOutPacket(CMSG_SKILL_LEVELUP_REQUEST);
102  outMsg.writeInt16(skillId, "skill id");
103 }
@ 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 TmwAthena::PlayerHandler::pickUp ( const FloorItem *const  floorItem) const
virtual

Implements Net::PlayerHandler.

Definition at line 105 of file playerhandler.cpp.

106 {
107  if (floorItem == nullptr)
108  return;
109 
110  createOutPacket(CMSG_ITEM_PICKUP);
111  outMsg.writeBeingId(floorItem->getId(), "object id");
113 }
BeingId getId() const
Definition: actorsprite.h:64
static void pushPickup(const BeingId floorId)

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

◆ removeOption()

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

Implements Net::PlayerHandler.

Definition at line 169 of file playerhandler.cpp.

170 {
171 }

◆ requestOnlineList()

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

Implements Net::PlayerHandler.

Definition at line 164 of file playerhandler.cpp.

165 {
166  createOutPacket(CMSG_ONLINE_LIST);
167 }

References createOutPacket.

◆ requestPvpInfo()

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

Implements Net::PlayerHandler.

Definition at line 201 of file playerhandler.cpp.

202 {
203 }

◆ respawn()

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

Implements Net::PlayerHandler.

Definition at line 158 of file playerhandler.cpp.

159 {
160  createOutPacket(CMSG_PLAYER_RESTART);
161  outMsg.writeInt8(0, "action");
162 }

References createOutPacket.

◆ revive()

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

Implements Net::PlayerHandler.

Definition at line 205 of file playerhandler.cpp.

206 {
207 }

◆ selectStyle()

void TmwAthena::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 502 of file playerhandler.cpp.

509 {
510 }

◆ setConfigOption()

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

Implements Net::PlayerHandler.

Definition at line 214 of file playerhandler.cpp.

216 {
217 }

◆ setDestination()

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

Implements Net::PlayerHandler.

Definition at line 122 of file playerhandler.cpp.

124 {
125  createOutPacket(CMSG_PLAYER_CHANGE_DEST);
126  outMsg.writeCoordinates(CAST_U16(x),
127  CAST_U16(y),
128  CAST_U8(direction), "destination");
129 }
#define CAST_U16
Definition: cast.h:29
#define CAST_U8
Definition: cast.h:27

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

◆ setDirection()

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

Implements Net::PlayerHandler.

Definition at line 115 of file playerhandler.cpp.

116 {
117  createOutPacket(CMSG_PLAYER_CHANGE_DIR);
118  outMsg.writeInt16(0, "unused");
119  outMsg.writeInt8(direction, "direction");
120 }

References createOutPacket.

◆ setMemo()

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

Implements Net::PlayerHandler.

Definition at line 177 of file playerhandler.cpp.

178 {
179 }

◆ setShortcut()

void TmwAthena::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 185 of file playerhandler.cpp.

190 {
191 }

◆ setStat()

void TmwAthena::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 224 of file playerhandler.cpp.

229 {
230  switch (type)
231  {
232  case Sp::SPEED:
235  CAST_S32(base),
236  Notify_true);
238  0,
239  Notify_true);
240  break;
241  case Sp::BASEEXP:
243  base,
244  Notify_true);
245  break;
246  case Sp::JOBEXP:
248  base,
249  Notify_true);
250  break;
251  case Sp::KARMA:
253  CAST_S32(base),
254  Notify_true);
256  0,
257  Notify_true);
258  break;
259  case Sp::MANNER:
261  CAST_S32(base),
262  Notify_true);
264  0,
265  Notify_true);
266  break;
267  case Sp::HP:
269  base,
270  Notify_true);
271  if (localPlayer->isInParty() && (Party::getParty(1) != nullptr))
272  {
273  PartyMember *const m = Party::getParty(1)
275  if (m != nullptr)
276  {
277  m->setHp(CAST_S32(base));
280  }
281  }
282  break;
283  case Sp::MAXHP:
285  base,
286  Notify_true);
287 
288  if (localPlayer->isInParty() && (Party::getParty(1) != nullptr))
289  {
290  PartyMember *const m = Party::getParty(1)->getMember(
291  localPlayer->getId());
292  if (m != nullptr)
293  {
295  m->setMaxHp(CAST_S32(base));
296  }
297  }
298  break;
299  case Sp::SP:
301  base,
302  Notify_true);
303  break;
304  case Sp::MAXSP:
306  base,
307  Notify_true);
308  break;
309  case Sp::STATUSPOINT:
311  base,
312  Notify_true);
313  break;
314  case Sp::BASELEVEL:
316  base,
317  Notify_true);
318  if (localPlayer != nullptr)
319  {
322  }
323  break;
324  case Sp::SKILLPOINT:
326  base,
327  Notify_true);
328  if (skillDialog != nullptr)
329  skillDialog->update();
330  break;
331  case Sp::STR:
333  break;
334  case Sp::AGI:
336  break;
337  case Sp::VIT:
339  break;
340  case Sp::INT:
342  break;
343  case Sp::DEX:
345  break;
346  case Sp::LUK:
348  break;
349  case Sp::ZENY:
350  {
351  const int oldMoney = PlayerInfo::getAttribute(Attributes::MONEY);
352  const int newMoney = CAST_S32(base);
353  if (newMoney > oldMoney)
354  {
356  UnitsDb::formatCurrency(newMoney - oldMoney));
357  }
358  else if (newMoney < oldMoney)
359  {
361  UnitsDb::formatCurrency(oldMoney - newMoney).c_str());
362  }
363 
365  newMoney,
366  Notify_true);
367  break;
368  }
369  case Sp::NEXTBASEEXP:
371  base,
372  Notify_true);
373  break;
374  case Sp::JOB_MOD:
376  base,
377  Notify_true);
378  break;
379  case Sp::WEIGHT:
381  base,
382  Notify_true);
383  break;
384  case Sp::MAXWEIGHT:
386  base,
387  Notify_true);
388  break;
389  case Sp::USTR:
391  CAST_S32(base));
392  break;
393  case Sp::UAGI:
395  CAST_S32(base));
396  break;
397  case Sp::UVIT:
399  CAST_S32(base));
400  break;
401  case Sp::UINT:
403  CAST_S32(base));
404  break;
405  case Sp::UDEX:
407  CAST_S32(base));
408  break;
409  case Sp::ULUK:
411  CAST_S32(base));
412  break;
413  case Sp::ATK1:
415  CAST_S32(base),
416  Notify_true);
418  break;
419  case Sp::ATK2:
421  CAST_S32(base),
422  Notify_true);
424  break;
425  case Sp::MATK1:
427  CAST_S32(base),
428  Notify_true);
429  break;
430  case Sp::MATK2:
432  CAST_S32(base),
433  Notify_true);
434  break;
435  case Sp::DEF1:
437  CAST_S32(base),
438  Notify_true);
439  break;
440  case Sp::DEF2:
442  CAST_S32(base),
443  Notify_true);
444  break;
445  case Sp::MDEF1:
447  CAST_S32(base),
448  Notify_true);
449  break;
450  case Sp::MDEF2:
452  CAST_S32(base),
453  Notify_true);
454  break;
455  case Sp::HIT:
457  CAST_S32(base),
458  Notify_true);
459  break;
460  case Sp::FLEE1:
462  CAST_S32(base),
463  Notify_true);
464  break;
465  case Sp::FLEE2:
467  CAST_S32(base),
468  Notify_true);
469  break;
470  case Sp::CRITICAL:
472  CAST_S32(base),
473  Notify_true);
474  break;
475  case Sp::ASPD:
478  CAST_S32(base),
479  Notify_true);
481  0,
482  Notify_true);
484  break;
485  case Sp::JOBLEVEL:
487  base,
488  Notify_true);
489  break;
490  case Sp::GM_LEVEL:
492  break;
493 
494  default:
496  break;
497  }
498 }
#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
void setGroupId(const int id)
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)
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
@ JOB_MOD
Definition: sp.h:53
@ STATUSPOINT
Definition: sp.h:40
@ GM_LEVEL
Definition: sp.h:77
@ 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
#define setStatComplex(stat)

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::GM_LEVEL, Sp::HIT, Sp::HP, Sp::INT, Being::isInParty(), Sp::JOB_MOD, 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, 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(), LocalPlayer::setGroupId(), 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 TmwAthena::PlayerHandler::setTitle ( const int  titleId) const
virtual

Implements Net::PlayerHandler.

Definition at line 512 of file playerhandler.cpp.

513 {
514 }

◆ shortcutShiftRow()

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

Implements Net::PlayerHandler.

Definition at line 209 of file playerhandler.cpp.

211 {
212 }

◆ stopAttack()

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

Implements Net::PlayerHandler.

Definition at line 74 of file playerhandler.cpp.

75 {
76  createOutPacket(CMSG_PLAYER_STOP_ATTACK);
77 }

References createOutPacket.

◆ updateStatus()

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

Implements Net::PlayerHandler.

Definition at line 181 of file playerhandler.cpp.

182 {
183 }

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