ManaPlus
Functions
Ea::SkillRecv Namespace Reference

Functions

void processPlayerSkillUp (Net::MessageIn &msg)
 

Function Documentation

◆ processPlayerSkillUp()

void Ea::SkillRecv::processPlayerSkillUp ( Net::MessageIn msg)

Definition at line 37 of file skillrecv.cpp.

38 {
39  const int skillId = msg.readInt16("skill id");
40  const int level = msg.readInt16("skill level");
41  const int sp = msg.readInt16("sp");
42  const int range = msg.readInt16("range");
43  const Modifiable up = fromBool(msg.readUInt8("up flag"), Modifiable);
44 
45  if (skillDialog != nullptr && PlayerInfo::getSkillLevel(skillId) != level)
46  skillDialog->playUpdateEffect(skillId);
47  PlayerInfo::setSkillLevel(skillId, level);
48  if (skillDialog != nullptr)
49  {
50  if (!skillDialog->updateSkill(skillId, range,
51  up, SkillType::Unknown, sp))
52  {
54  skillId, "", level,
55  range, up, SkillType::Unknown, sp);
56  }
57  }
58 }
#define fromBool(val, name)
Definition: booldefines.h:49
bool updateSkill(const int id, const int range, const Modifiable modifiable, const SkillType::SkillType type, const int sp)
void playUpdateEffect(const int id) const
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)
bool Modifiable
Definition: modifiable.h:30
bool msg(InputEvent &event)
Definition: chat.cpp:39
int getSkillLevel(const int id)
Definition: playerinfo.cpp:120
void setSkillLevel(const int id, const int value)
Definition: playerinfo.cpp:128
SkillDialog * skillDialog
Definition: skilldialog.cpp:66

References SkillDialog::addSkill(), fromBool, PlayerInfo::getSkillLevel(), Actions::msg(), SkillOwner::Player, SkillDialog::playUpdateEffect(), PlayerInfo::setSkillLevel(), skillDialog, SkillType::Unknown, and SkillDialog::updateSkill().