parse player stats
This commit is contained in:
parent
1b9f9bbc7d
commit
dbbfe0b3ea
|
@ -259,6 +259,22 @@ namespace Otc
|
||||||
SpriteNoMask = 255
|
SpriteNoMask = 255
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Statistic {
|
||||||
|
Health,
|
||||||
|
MaxHealth,
|
||||||
|
FreeCapacity,
|
||||||
|
Experience,
|
||||||
|
Level,
|
||||||
|
LevelPercent,
|
||||||
|
Mana,
|
||||||
|
MaxMana,
|
||||||
|
MagicLevel,
|
||||||
|
MagicLevelPercent,
|
||||||
|
Soul,
|
||||||
|
Stamina,
|
||||||
|
LastStatistic
|
||||||
|
};
|
||||||
|
|
||||||
enum Skill {
|
enum Skill {
|
||||||
Fist = 0,
|
Fist = 0,
|
||||||
Club,
|
Club,
|
||||||
|
|
|
@ -39,6 +39,9 @@ public:
|
||||||
void setSkill(Otc::Skill skill, Otc::SkillType skillType, int value) { m_skills[skill][skillType] = value; }
|
void setSkill(Otc::Skill skill, Otc::SkillType skillType, int value) { m_skills[skill][skillType] = value; }
|
||||||
int getSkill(Otc::Skill skill, Otc::SkillType skillType) { return m_skills[skill][skillType]; }
|
int getSkill(Otc::Skill skill, Otc::SkillType skillType) { return m_skills[skill][skillType]; }
|
||||||
|
|
||||||
|
void setStatistic(Otc::Statistic statistic, double value) { m_statistics[statistic] = value; }
|
||||||
|
uint32 getStatistic(Otc::Statistic statistic) { return m_statistics[statistic]; }
|
||||||
|
|
||||||
void walk(Otc::Direction direction);
|
void walk(Otc::Direction direction);
|
||||||
|
|
||||||
LocalPlayerPtr asLocalPlayer() { return std::static_pointer_cast<LocalPlayer>(shared_from_this()); }
|
LocalPlayerPtr asLocalPlayer() { return std::static_pointer_cast<LocalPlayer>(shared_from_this()); }
|
||||||
|
@ -48,6 +51,7 @@ private:
|
||||||
bool m_canReportBugs;
|
bool m_canReportBugs;
|
||||||
|
|
||||||
int m_skills[Otc::LastSkill][Otc::LastSkillType];
|
int m_skills[Otc::LastSkill][Otc::LastSkillType];
|
||||||
|
double m_statistics[Otc::LastStatistic];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -629,18 +629,18 @@ void ProtocolGame::parseHouseTextWindow(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parsePlayerStats(InputMessage& msg)
|
void ProtocolGame::parsePlayerStats(InputMessage& msg)
|
||||||
{
|
{
|
||||||
msg.getU16(); // health
|
m_localPlayer->setStatistic(Otc::Health, msg.getU16());
|
||||||
msg.getU16(); // max health
|
m_localPlayer->setStatistic(Otc::MaxHealth, msg.getU16());
|
||||||
msg.getU32(); // free capacity
|
m_localPlayer->setStatistic(Otc::FreeCapacity, msg.getU32());
|
||||||
msg.getU32(); // experience
|
m_localPlayer->setStatistic(Otc::Experience, msg.getU32());
|
||||||
msg.getU16(); // level
|
m_localPlayer->setStatistic(Otc::Level, msg.getU16());
|
||||||
msg.getU8(); // level percent
|
m_localPlayer->setStatistic(Otc::LevelPercent, msg.getU8());
|
||||||
msg.getU16(); // mana
|
m_localPlayer->setStatistic(Otc::Mana, msg.getU16());
|
||||||
msg.getU16(); // max mana
|
m_localPlayer->setStatistic(Otc::MaxMana, msg.getU16());
|
||||||
msg.getU8(); // magic level
|
m_localPlayer->setStatistic(Otc::MagicLevel, msg.getU8());
|
||||||
msg.getU8(); // magic level percent
|
m_localPlayer->setStatistic(Otc::MagicLevelPercent, msg.getU8());
|
||||||
msg.getU8(); // soul
|
m_localPlayer->setStatistic(Otc::Soul, msg.getU8());
|
||||||
msg.getU16(); // stamina
|
m_localPlayer->setStatistic(Otc::Stamina, msg.getU16());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parsePlayerSkills(InputMessage& msg)
|
void ProtocolGame::parsePlayerSkills(InputMessage& msg)
|
||||||
|
|
Loading…
Reference in New Issue