This commit is contained in:
Henrique 2011-11-03 20:14:56 -02:00
parent b216b00a32
commit 667ff41ad9
3 changed files with 20 additions and 7 deletions

View File

@ -26,7 +26,7 @@ function Skills.create()
skillPanel:addChild(levelLabel) skillPanel:addChild(levelLabel)
levelLabel:setStyle('SkillLevelLabel') levelLabel:setStyle('SkillLevelLabel')
levelLabel:setId('skillLevelId' .. i) levelLabel:setId('skillLevelId' .. i)
levelLabel:setText('10') levelLabel:setText('0')
local percentPanel = UIWidget.create() local percentPanel = UIWidget.create()
skillPanel:addChild(percentPanel) skillPanel:addChild(percentPanel)
@ -42,8 +42,13 @@ end
-- hooked events -- hooked events
function Game.setSkill(id, level, percent) function Game.setSkill(id, level, percent)
local skillPanel = skillWindow:getChildById('skillPanel') local skillPanel = skillWindow:getChildById('skillPanel')
local levelLabel = skillPanel:getChildById('skillLevel' .. id)
local levelLabel = skillPanel:getChildById('skillLevelId' .. (id + 1))
levelLabel:setText(level)
--local percentLabel = skillPanel:getChildById('skillLevelId' .. id)
--levelLabel:setText(percent)
end end
connect(Game, { onLogin = Skills.create, connect(Game, { onLogin = Skills.create,
onLogout = Skills.destroy }) onLogout = Skills.destroy })

View File

@ -40,7 +40,7 @@ public:
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; } void setStatistic(Otc::Statistic statistic, double value) { m_statistics[statistic] = value; }
uint32 getStatistic(Otc::Statistic statistic) { return m_statistics[statistic]; } double getStatistic(Otc::Statistic statistic) { return m_statistics[statistic]; }
void walk(Otc::Direction direction); void walk(Otc::Direction direction);

View File

@ -645,9 +645,17 @@ void ProtocolGame::parsePlayerStats(InputMessage& msg)
void ProtocolGame::parsePlayerSkills(InputMessage& msg) void ProtocolGame::parsePlayerSkills(InputMessage& msg)
{ {
for(int skill = 0; skill < Otc::LastSkill; skill++) for(int skill = 0; skill < Otc::LastSkill; skill++) {
for(int skillType = 0; skillType < Otc::LastSkillType; skillType++) int values[Otc::LastSkillType];
m_localPlayer->setSkill((Otc::Skill)skill, (Otc::SkillType)skillType, msg.getU8()); for(int skillType = 0; skillType < Otc::LastSkillType; skillType++) {
values[skillType] = msg.getU8();
m_localPlayer->setSkill((Otc::Skill)skill, (Otc::SkillType)skillType, values[skillType]);
}
g_dispatcher.addEvent([=] {
g_lua.callGlobalField("Game", "setSkill", skill, values[Otc::SkillLevel], values[Otc::SkillPercent]);
});
}
} }
void ProtocolGame::parsePlayerIcons(InputMessage& msg) void ProtocolGame::parsePlayerIcons(InputMessage& msg)