ManaPlus
Functions
TmwAthena::PlayerRecv Namespace Reference

Functions

void processPlayerStatUpdate5 (Net::MessageIn &msg)
 
void processWalkResponse (Net::MessageIn &msg)
 
void processOnlineList (Net::MessageIn &msg)
 

Function Documentation

◆ processOnlineList()

void TmwAthena::PlayerRecv::processOnlineList ( Net::MessageIn msg)

Definition at line 197 of file playerrecv.cpp.

198 {
199  if (whoIsOnline == nullptr)
200  return;
201 
202  BLOCK_START("PlayerRecv::processOnlineList")
203  const int count = (msg.readInt16("len") - 4) / 31;
204  STD_VECTOR<OnlinePlayer*> arr;
205 
206  if (count == 0)
207  {
208  if (whoIsOnline != nullptr)
209  whoIsOnline->loadList(arr);
210  BLOCK_END("PlayerRecv::processOnlineList")
211  return;
212  }
213 
214  for (int f = 0; f < count; f ++)
215  {
216  const BeingId beingId = msg.readBeingId("account id");
217  const std::string name = msg.readString(24, "name");
218  const unsigned char level = msg.readUInt8("level");
219  const unsigned char group = msg.readUInt8("group");
220  GenderT gender = Being::intToGender(msg.readUInt8("gender"));
221 
222  if (!config.getBoolValue("showgender"))
223  gender = Gender::UNSPECIFIED;
224  arr.push_back(new OnlinePlayer(name,
225  CAST_U8(255), level, gender, 0, group));
226  if (actorManager)
227  actorManager->updateNameId(name, beingId);
228  }
229 
230  if (whoIsOnline != nullptr)
231  whoIsOnline->loadList(arr);
232  BLOCK_END("PlayerRecv::processOnlineList")
233 }
ActorManager * actorManager
int BeingId
Definition: beingid.h:30
#define CAST_U8
Definition: cast.h:27
void updateNameId(const std::string &name, const BeingId beingId)
static GenderT intToGender(const uint8_t sex) A_CONST
Definition: being.h:941
bool getBoolValue(const std::string &key) const
void loadList(const std::vector< OnlinePlayer * > &list)
Configuration config
Gender ::T GenderT
Definition: gender.h:35
if(!vert) return
bool msg(InputEvent &event)
Definition: chat.cpp:39
@ UNSPECIFIED
Definition: gender.h:33
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79
#define STD_VECTOR
Definition: vector.h:30
WhoIsOnline * whoIsOnline
Definition: whoisonline.cpp:82

References actorManager, BLOCK_END, BLOCK_START, CAST_U8, config, Configuration::getBoolValue(), Being::intToGender(), WhoIsOnline::loadList(), Actions::msg(), Gender::UNSPECIFIED, ActorManager::updateNameId(), and whoIsOnline.

◆ processPlayerStatUpdate5()

void TmwAthena::PlayerRecv::processPlayerStatUpdate5 ( Net::MessageIn msg)

Definition at line 46 of file playerrecv.cpp.

47 {
48  BLOCK_START("PlayerRecv::processPlayerStatUpdate5")
50  msg.readInt16("char points"),
51  Notify_true);
52 
53  unsigned int val = msg.readUInt8("str");
55  if (statusWindow != nullptr)
56  {
58  msg.readUInt8("str cost"));
59  }
60  else
61  {
62  msg.readUInt8("str cost");
63  }
64 
65  val = msg.readUInt8("agi");
67  if (statusWindow != nullptr)
68  {
70  msg.readUInt8("agi cost"));
71  }
72  else
73  {
74  msg.readUInt8("agi cost");
75  }
76 
77  val = msg.readUInt8("vit");
79  if (statusWindow != nullptr)
80  {
82  msg.readUInt8("vit cost"));
83  }
84  else
85  {
86  msg.readUInt8("vit cost");
87  }
88 
89  val = msg.readUInt8("int");
91  if (statusWindow != nullptr)
92  {
94  msg.readUInt8("int cost"));
95  }
96  else
97  {
98  msg.readUInt8("int cost");
99  }
100 
101  val = msg.readUInt8("dex");
103  if (statusWindow != nullptr)
104  {
106  msg.readUInt8("dex cost"));
107  }
108  else
109  {
110  msg.readUInt8("dex cost");
111  }
112 
113  val = msg.readUInt8("luk");
115  if (statusWindow != nullptr)
116  {
118  msg.readUInt8("luk cost"));
119  }
120  else
121  {
122  msg.readUInt8("luk cost");
123  }
124 
126  msg.readInt16("atk"),
127  Notify_false);
129  msg.readInt16("atk+"),
130  Notify_true);
132 
133  val = msg.readInt16("matk");
135 
136  val = msg.readInt16("matk+");
138  val,
139  Notify_true);
140 
142  msg.readInt16("def"),
143  Notify_false);
145  msg.readInt16("def+"),
146  Notify_true);
147 
149  msg.readInt16("mdef"),
150  Notify_false);
152  msg.readInt16("mdef+"),
153  Notify_true);
154 
156  msg.readInt16("hit"),
157  Notify_true);
158 
160  msg.readInt16("flee"),
161  Notify_false);
163  msg.readInt16("flee+"),
164  Notify_true);
165 
167  msg.readInt16("crit"),
168  Notify_true);
169 
171  msg.readInt16("manner"),
172  Notify_true);
173  msg.readInt16("unused?");
174  BLOCK_END("PlayerRecv::processPlayerStatUpdate5")
175 }
void setPointsNeeded(const AttributesT id, const int needed)
@ PLAYER_CHAR_POINTS
Definition: attributes.h:49
@ PLAYER_MANNER
Definition: attributes.h:56
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
const bool Notify_false
Definition: notify.h:30
const bool Notify_true
Definition: notify.h:30
StatusWindow * statusWindow

References BLOCK_END, BLOCK_START, Actions::msg(), Notify_false, Notify_true, Attributes::PLAYER_AGI, Attributes::PLAYER_ATK, Attributes::PLAYER_CHAR_POINTS, Attributes::PLAYER_CRIT, Attributes::PLAYER_DEF, Attributes::PLAYER_DEX, Attributes::PLAYER_FLEE, Attributes::PLAYER_HIT, Attributes::PLAYER_INT, Attributes::PLAYER_LUK, Attributes::PLAYER_MANNER, Attributes::PLAYER_MATK, Attributes::PLAYER_MDEF, Attributes::PLAYER_STR, Attributes::PLAYER_VIT, PlayerInfo::setAttribute(), StatusWindow::setPointsNeeded(), PlayerInfo::setStatBase(), PlayerInfo::setStatMod(), statusWindow, and PlayerInfo::updateAttrs().

◆ processWalkResponse()

void TmwAthena::PlayerRecv::processWalkResponse ( Net::MessageIn msg)

Definition at line 177 of file playerrecv.cpp.

178 {
179  BLOCK_START("PlayerRecv::processWalkResponse")
180  /*
181  * This client assumes that all walk messages succeed,
182  * and that the server will send a correction notice
183  * otherwise.
184  */
185  uint16_t srcX;
186  uint16_t srcY;
187  uint16_t dstX;
188  uint16_t dstY;
189  msg.readInt32("tick");
190  msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path");
191  msg.readUInt8("unused");
192  if (localPlayer != nullptr)
193  localPlayer->setRealPos(dstX, dstY);
194  BLOCK_END("PlayerRecv::processWalkResponse")
195 }
LocalPlayer * localPlayer
bool move(InputEvent &event)
Definition: commands.cpp:44
void processWalkResponse(Net::MessageIn &msg)
Definition: playerrecv.cpp:275

References BLOCK_END, BLOCK_START, localPlayer, Actions::msg(), and LocalPlayer::setRealPos().