diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2005-09-17 00:10:50 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2005-09-17 00:10:50 +0000 |
commit | e454dcd9bc48c884215bb8144f43a10960b5f713 (patch) | |
tree | 95b62bff7a51d2325ce0bf9dfc93bc481a19738f /src/gui | |
parent | 17cab02d4f5e2137ab77bac40884982c6d3651ea (diff) | |
download | mana-e454dcd9bc48c884215bb8144f43a10960b5f713.tar.gz mana-e454dcd9bc48c884215bb8144f43a10960b5f713.tar.bz2 mana-e454dcd9bc48c884215bb8144f43a10960b5f713.tar.xz mana-e454dcd9bc48c884215bb8144f43a10960b5f713.zip |
Now the values shown by derived stats in status win are got from the server. Still, when Equipping/unequipping, you have to warp to get these values updated. Does somebody has an idea how to request an update of these values when equipping/unequipping ?
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/char_select.cpp | 26 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 18 | ||||
-rw-r--r-- | src/gui/ministatus.cpp | 8 | ||||
-rw-r--r-- | src/gui/skill.cpp | 18 | ||||
-rw-r--r-- | src/gui/status.cpp | 31 | ||||
-rw-r--r-- | src/gui/status.h | 3 |
6 files changed, 53 insertions, 51 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index e86c5d5a..44165707 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -158,8 +158,8 @@ void CharSelectDialog::setPlayerInfo(PLAYER_INFO *pi) std::stringstream nameCaption, levelCaption, jobCaption, moneyCaption; nameCaption << pi->name; - levelCaption << "Lvl: " << pi->lv; - jobCaption << "Job Lvl: " << pi->job_lv; + levelCaption << "Lvl: " << pi->lvl; + jobCaption << "Job Lvl: " << pi->jobLvl; moneyCaption << "Gold: " << pi->gp; nameLabel->setCaption(nameCaption.str()); @@ -170,8 +170,8 @@ void CharSelectDialog::setPlayerInfo(PLAYER_INFO *pi) delCharButton->setEnabled(true); selectButton->setEnabled(true); - playerBox->hairStyle = pi->hair_style - 1; - playerBox->hairColor = pi->hair_color - 1; + playerBox->hairStyle = pi->hairStyle - 1; + playerBox->hairColor = pi->hairColor - 1; playerBox->showPlayer = true; } else { @@ -430,28 +430,28 @@ void CharCreateDialog::serverCharCreate() char_info[0]->id = msg.readLong(); char_info[0]->xp = msg.readLong(); char_info[0]->gp = msg.readLong(); - char_info[0]->job_xp = msg.readLong(); - char_info[0]->job_lv = msg.readLong(); + char_info[0]->jobXp = msg.readLong(); + char_info[0]->jobLvl = msg.readLong(); msg.skip(8); // unknown msg.readLong(); // option msg.readLong(); // karma msg.readLong(); // manner msg.skip(2); // unknown char_info[0]->hp = msg.readShort(); - char_info[0]->max_hp = msg.readShort(); - char_info[0]->sp = msg.readShort(); - char_info[0]->max_sp = msg.readShort(); + char_info[0]->maxHp = msg.readShort(); + char_info[0]->mp = msg.readShort(); + char_info[0]->maxMp = msg.readShort(); msg.readShort(); // speed msg.readShort(); // class - char_info[0]->hair_style = msg.readShort(); + char_info[0]->hairStyle = msg.readShort(); char_info[0]->weapon = msg.readShort(); - char_info[0]->lv = msg.readShort(); + char_info[0]->lvl = msg.readShort(); msg.readShort(); // skill point msg.readShort(); // head bottom msg.readShort(); // shield msg.readShort(); // head option top msg.readShort(); // head option mid - char_info[0]->hair_color = msg.readShort(); + char_info[0]->hairColor = msg.readShort(); msg.readShort(); // unknown char_info[0]->name = msg.readString(24); char_info[0]->STR = msg.readByte(); @@ -460,7 +460,7 @@ void CharCreateDialog::serverCharCreate() char_info[0]->INT = msg.readByte(); char_info[0]->DEX = msg.readByte(); char_info[0]->LUK = msg.readByte(); - msg.readByte(); // character number + char_info[0]->characterNumber = msg.readByte(); // character number msg.readByte(); // unknown n_character = 1; diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 79269a2e..4da8db84 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -179,28 +179,28 @@ void server_char_server(int serverIndex) char_info[i]->id = msg.readLong(); char_info[i]->xp = msg.readLong(); char_info[i]->gp = msg.readLong(); - char_info[i]->job_xp = msg.readLong(); - char_info[i]->job_lv = msg.readLong(); + char_info[i]->jobXp = msg.readLong(); + char_info[i]->jobLvl = msg.readLong(); msg.skip(8); // unknown msg.readLong(); // option msg.readLong(); // karma msg.readLong(); // manner msg.skip(2); // unknown char_info[i]->hp = msg.readShort(); - char_info[i]->max_hp = msg.readShort(); - char_info[i]->sp = msg.readShort(); - char_info[i]->max_sp = msg.readShort(); + char_info[i]->maxHp = msg.readShort(); + char_info[i]->mp = msg.readShort(); + char_info[i]->maxMp = msg.readShort(); msg.readShort(); // speed msg.readShort(); // class - char_info[i]->hair_style = msg.readShort(); + char_info[i]->hairStyle = msg.readShort(); char_info[i]->weapon = msg.readShort(); - char_info[i]->lv = msg.readShort(); + char_info[i]->lvl = msg.readShort(); msg.readShort(); // skill point msg.readShort(); // head bottom msg.readShort(); // shield msg.readShort(); // head option top msg.readShort(); // head option mid - char_info[i]->hair_color = msg.readShort(); + char_info[i]->hairColor = msg.readShort(); msg.readShort(); // unknown char_info[i]->name = msg.readString(24); char_info[i]->STR = msg.readByte(); @@ -209,7 +209,7 @@ void server_char_server(int serverIndex) char_info[i]->INT = msg.readByte(); char_info[i]->DEX = msg.readByte(); char_info[i]->LUK = msg.readByte(); - msg.readByte(); // character number + char_info[i]->characterNumber = msg.readByte(); // character number msg.readByte(); // unknown } diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 7318ba74..2d834949 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -61,13 +61,13 @@ MiniStatusWindow::~MiniStatusWindow() void MiniStatusWindow::update() { // HP Bar coloration - if (player_info->hp < int(player_info->max_hp / 3)) + if (player_info->hp < int(player_info->maxHp / 3)) { hpBar->setColor(223, 32, 32); // Red } else { - if (player_info->hp < int((player_info->max_hp / 3) * 2)) + if (player_info->hp < int((player_info->maxHp / 3) * 2)) { hpBar->setColor(230, 171, 34); // Orange } @@ -77,8 +77,8 @@ void MiniStatusWindow::update() } } - hpBar->setProgress((float)player_info->hp / (float)player_info->max_hp); - // mpBar->setProgress((float)player_info->mp / (float)player_info->max_mp); + hpBar->setProgress((float)player_info->hp / (float)player_info->maxHp); + // mpBar->setProgress((float)player_info->mp / (float)player_info->maxMp); } void MiniStatusWindow::draw(gcn::Graphics *graphics) diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 0e641768..a82b5c6a 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -122,7 +122,7 @@ void SkillDialog::action(const std::string& eventId) { // Increment skill int selectedSkill = skillListBox->getSelected(); - if (player_info->skill_point > 0 && selectedSkill >= 0) + if (player_info->skillPoint > 0 && selectedSkill >= 0) { writeWord(0, 0x0112); writeWord(2, skillList[selectedSkill]->id); @@ -166,8 +166,8 @@ std::string SkillDialog::getElementAt(int i) char tmp[128]; sprintf(tmp, "%s Lv: %i Sp: %i", skill_db[skillList[i]->id], - skillList[i]->lv, - skillList[i]->sp); + skillList[i]->lvl, + skillList[i]->mp); return tmp; } return ""; @@ -183,22 +183,22 @@ bool SkillDialog::hasSkill(int id) return false; } -void SkillDialog::addSkill(int id, int lv, int sp) +void SkillDialog::addSkill(int id, int lvl, int mp) { printf("%i\n", id); SKILL *tmp = new SKILL(); tmp->id = id; - tmp->lv = lv; - tmp->sp = sp; + tmp->lvl = lvl; + tmp->mp = mp; skillList.push_back(tmp); } -void SkillDialog::setSkill(int id, int lv, int sp) +void SkillDialog::setSkill(int id, int lvl, int mp) { for (unsigned int i = 0; i < skillList.size(); i++) { if (skillList[i]->id == id) { - skillList[i]->lv = lv; - skillList[i]->sp = sp; + skillList[i]->lvl = lvl; + skillList[i]->mp = mp; } } } diff --git a/src/gui/status.cpp b/src/gui/status.cpp index 152e3ff3..9bdb95a6 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -249,7 +249,7 @@ void StatusWindow::update() // Status Part // ----------- updateText.str(""); - updateText << "Level: " << player_info->lv; + updateText << "Level: " << player_info->lvl; lvlLabel->setCaption(updateText.str()); lvlLabel->adjustSize(); @@ -259,17 +259,17 @@ void StatusWindow::update() gpLabel->adjustSize(); updateText.str(""); - updateText << "Job: " << player_info->job_lv; + updateText << "Job: " << player_info->jobLvl; jobXpLabel->setCaption(updateText.str()); jobXpLabel->adjustSize(); updateText.str(""); - updateText << player_info->hp << "/" << player_info->max_hp; + updateText << player_info->hp << "/" << player_info->maxHp; hpValueLabel->setCaption(updateText.str()); hpValueLabel->adjustSize(); updateText.str(""); - updateText << player_info->sp << "/" << player_info->max_sp; + updateText << player_info->mp << "/" << player_info->maxMp; mpValueLabel->setCaption(updateText.str()); mpValueLabel->adjustSize(); @@ -279,18 +279,18 @@ void StatusWindow::update() xpValueLabel->adjustSize(); updateText.str(""); - updateText << (int)player_info->job_xp << "/" << (int)player_info->jobXpForNextLevel; + updateText << (int)player_info->jobXp << "/" << (int)player_info->jobXpForNextLevel; jobValueLabel->setCaption(updateText.str()); jobValueLabel->adjustSize(); // HP Bar coloration - if (player_info->hp < int(player_info->max_hp / 3)) + if (player_info->hp < int(player_info->maxHp / 3)) { hpBar->setColor(223, 32, 32); // Red } else { - if (player_info->hp < int((player_info->max_hp / 3) * 2)) + if (player_info->hp < int((player_info->maxHp / 3) * 2)) { hpBar->setColor(230, 171, 34); // Orange } @@ -300,12 +300,13 @@ void StatusWindow::update() } } - hpBar->setProgress((float)player_info->hp / (float)player_info->max_hp); + hpBar->setProgress((float)player_info->hp / (float)player_info->maxHp); + // mpBar->setProgress((float)player_info->mp / (float)player_info->maxMp); xpBar->setProgress( (float)player_info->xp / (float)player_info->xpForNextLevel); jobXpBar->setProgress( - (float)player_info->job_xp / (float)player_info->jobXpForNextLevel); + (float)player_info->jobXp / (float)player_info->jobXpForNextLevel); // Stats Part // ---------- @@ -362,37 +363,37 @@ void StatusWindow::update() // Attack TODO: Count equipped Weapons and items attack bonuses updateText.str(""); - updateText << (10 + (int)player_info->STR); + updateText << int(player_info->ATK + player_info->ATKBonus); statsAttackPoints->setCaption(updateText.str()); statsAttackPoints->adjustSize(); // Defense TODO: Count equipped Armors and items defense bonuses updateText.str(""); - updateText << (int)player_info->VIT; + updateText << int(player_info->DEF + player_info->DEFBonus); statsDefensePoints->setCaption(updateText.str()); statsDefensePoints->adjustSize(); // Magic Attack TODO: Count equipped items M.Attack bonuses updateText.str(""); - updateText << (10 + (int)player_info->INT); + updateText << int(player_info->MATK + player_info->MATKBonus); statsMagicAttackPoints->setCaption(updateText.str()); statsMagicAttackPoints->adjustSize(); // Magic Defense TODO: Count equipped items M.Defense bonuses updateText.str(""); - updateText << (int)player_info->AGI; + updateText << int(player_info->MDEF + player_info->MDEFBonus); statsMagicDefensePoints->setCaption(updateText.str()); statsMagicDefensePoints->adjustSize(); // Accuracy % updateText.str(""); - updateText << (50 + (int)player_info->DEX + (int)player_info->AGI); + updateText << (int)player_info->HIT; statsAccuracyPoints->setCaption(updateText.str()); statsAccuracyPoints->adjustSize(); // Evasion % updateText.str(""); - updateText << (((int)player_info->DEX / 2) + (int)player_info->AGI); + updateText << (int)player_info->FLEE; statsEvadePoints->setCaption(updateText.str()); statsEvadePoints->adjustSize(); diff --git a/src/gui/status.h b/src/gui/status.h index 3d9165af..1c5ed7ff 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -62,12 +62,13 @@ class StatusWindow : public Window, public gcn::ActionListener { */ void draw(gcn::Graphics *graphics); - private: /** * Updates this dialog with values from PLAYER_INFO *char_info */ void update(); + private: + /** * Status Part */ |