From a5108774672d118f89b9f24e4e846341fd5105fd Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Wed, 18 Apr 2012 19:49:12 +0200 Subject: Fixed handling of skills - Removed possibility of skills getting mixed with attributes - Made the server sending the level of the current skill on exp change (currently the client could calculate it itself, but it allows more flexibillity in future this way) - Fixed reading of skills out of the database (for some reason the status effects were added as skills) ** Needs clientside patch as well (coming soon) ** Reviewed-by: Bertram. --- src/account-server/storage.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/account-server/storage.cpp') diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp index c39bfc5d..353dc8ed 100644 --- a/src/account-server/storage.cpp +++ b/src/account-server/storage.cpp @@ -429,26 +429,26 @@ Character *Storage::getCharacterBySQL(Account *owner) s.clear(); s.str(""); - // Load the skills of the char from CHAR_SKILLS_TBL_NAME - s << "select status_id, status_time FROM " - << CHAR_STATUS_EFFECTS_TBL_NAME + // Load skills. + s << "SELECT skill_id, skill_exp " + << "FROM " << CHAR_SKILLS_TBL_NAME << " WHERE char_id = " << character->getDatabaseID(); const dal::RecordSet &skillInfo = mDb->execSql(s.str()); if (!skillInfo.isEmpty()) { const unsigned int nRows = skillInfo.rows(); - for (unsigned int row = 0; row < nRows; row++) + for (unsigned int row = 0; row < nRows; ++row) { - character->setExperience( - toUint(skillInfo(row, 0)), // Skill Id - toUint(skillInfo(row, 1))); // Experience + unsigned int id = toUint(skillInfo(row, 0)); + character->setExperience(id, toInt(skillInfo(row, 1))); } } - // Load the status effect s.clear(); s.str(""); + + // Load the status effects s << "select status_id, status_time FROM " << CHAR_STATUS_EFFECTS_TBL_NAME << " WHERE char_id = " << character->getDatabaseID(); -- cgit v1.2.3-60-g2f50