parse player stats

This commit is contained in:
Henrique 2011-11-03 17:26:53 -02:00
parent 1b9f9bbc7d
commit dbbfe0b3ea
3 changed files with 32 additions and 12 deletions

View File

@ -259,6 +259,22 @@ namespace Otc
SpriteNoMask = 255
};
enum Statistic {
Health,
MaxHealth,
FreeCapacity,
Experience,
Level,
LevelPercent,
Mana,
MaxMana,
MagicLevel,
MagicLevelPercent,
Soul,
Stamina,
LastStatistic
};
enum Skill {
Fist = 0,
Club,

View File

@ -39,6 +39,9 @@ public:
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]; }
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);
LocalPlayerPtr asLocalPlayer() { return std::static_pointer_cast<LocalPlayer>(shared_from_this()); }
@ -48,6 +51,7 @@ private:
bool m_canReportBugs;
int m_skills[Otc::LastSkill][Otc::LastSkillType];
double m_statistics[Otc::LastStatistic];
};
#endif

View File

@ -629,18 +629,18 @@ void ProtocolGame::parseHouseTextWindow(InputMessage& msg)
void ProtocolGame::parsePlayerStats(InputMessage& msg)
{
msg.getU16(); // health
msg.getU16(); // max health
msg.getU32(); // free capacity
msg.getU32(); // experience
msg.getU16(); // level
msg.getU8(); // level percent
msg.getU16(); // mana
msg.getU16(); // max mana
msg.getU8(); // magic level
msg.getU8(); // magic level percent
msg.getU8(); // soul
msg.getU16(); // stamina
m_localPlayer->setStatistic(Otc::Health, msg.getU16());
m_localPlayer->setStatistic(Otc::MaxHealth, msg.getU16());
m_localPlayer->setStatistic(Otc::FreeCapacity, msg.getU32());
m_localPlayer->setStatistic(Otc::Experience, msg.getU32());
m_localPlayer->setStatistic(Otc::Level, msg.getU16());
m_localPlayer->setStatistic(Otc::LevelPercent, msg.getU8());
m_localPlayer->setStatistic(Otc::Mana, msg.getU16());
m_localPlayer->setStatistic(Otc::MaxMana, msg.getU16());
m_localPlayer->setStatistic(Otc::MagicLevel, msg.getU8());
m_localPlayer->setStatistic(Otc::MagicLevelPercent, msg.getU8());
m_localPlayer->setStatistic(Otc::Soul, msg.getU8());
m_localPlayer->setStatistic(Otc::Stamina, msg.getU16());
}
void ProtocolGame::parsePlayerSkills(InputMessage& msg)