summaryrefslogtreecommitdiff
path: root/src/account-server
diff options
context:
space:
mode:
Diffstat (limited to 'src/account-server')
-rw-r--r--src/account-server/accounthandler.cpp1
-rw-r--r--src/account-server/character.cpp1
-rw-r--r--src/account-server/character.h26
-rw-r--r--src/account-server/serverhandler.cpp16
-rw-r--r--src/account-server/storage.cpp130
-rw-r--r--src/account-server/storage.h19
6 files changed, 7 insertions, 186 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index 2656d210..87cb2b46 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -280,7 +280,6 @@ void AccountHandler::sendCharacterData(AccountClient &client,
charInfo.writeInt8(ch.getGender());
charInfo.writeInt8(ch.getHairStyle());
charInfo.writeInt8(ch.getHairColor());
- charInfo.writeInt16(ch.getLevel());
charInfo.writeInt16(ch.getCharacterPoints());
charInfo.writeInt16(ch.getCorrectionPoints());
diff --git a/src/account-server/character.cpp b/src/account-server/character.cpp
index 19d679df..3fc3ed19 100644
--- a/src/account-server/character.cpp
+++ b/src/account-server/character.cpp
@@ -32,7 +32,6 @@ CharacterData::CharacterData(const std::string &name, int id):
mGender(0),
mHairStyle(0),
mHairColor(0),
- mLevel(0),
mCharacterPoints(0),
mCorrectionPoints(0),
mAccountLevel(0)
diff --git a/src/account-server/character.h b/src/account-server/character.h
index 53443c4b..58e32dad 100644
--- a/src/account-server/character.h
+++ b/src/account-server/character.h
@@ -156,12 +156,6 @@ class CharacterData
void setAccountLevel(int l, bool force = false)
{ if (force) mAccountLevel = l; }
- /**
- * Gets the level of the character.
- */
- int getLevel() const { return mLevel; }
- void setLevel(int level) { mLevel = level; }
-
/** Sets the value of a base attribute of the character. */
void setAttribute(unsigned id, double value)
{ mAttributes[id].base = value; }
@@ -172,24 +166,6 @@ class CharacterData
const AttributeMap &getAttributes() const
{ return mAttributes; }
- int getSkillSize() const
- { return mExperience.size(); }
-
- const std::map<int, int>::const_iterator getSkillBegin() const
- { return mExperience.begin(); }
-
- const std::map<int, int>::const_iterator getSkillEnd() const
- { return mExperience.end(); }
-
- int getExperience(int skill) const
- { return mExperience.find(skill)->second; }
-
- void setExperience(int skill, int value)
- { mExperience[skill] = value; }
-
- void receiveExperience(int skill, int value)
- { mExperience[skill] += value; }
-
/**
* Get / Set a status effects
*/
@@ -300,7 +276,6 @@ class CharacterData
Account *mAccount; //!< Account owning the character.
Point mPos; //!< Position the being is at.
AttributeMap mAttributes; //!< Attributes.
- std::map<int, int> mExperience; //!< Skill Experience.
std::map<int, Status> mStatusEffects; //!< Status Effects
std::map<int, int> mKillCount; //!< Kill Count
AbilityMap mAbilities;
@@ -308,7 +283,6 @@ class CharacterData
unsigned char mGender; //!< Gender of the being.
unsigned char mHairStyle; //!< Hair style of the being.
unsigned char mHairColor; //!< Hair color of the being.
- short mLevel; //!< Level of the being.
short mCharacterPoints; //!< Unused character points.
short mCorrectionPoints; //!< Unused correction points.
unsigned char mAccountLevel; //!< Level of the associated account.
diff --git a/src/account-server/serverhandler.cpp b/src/account-server/serverhandler.cpp
index 1ba3c03d..19c32fda 100644
--- a/src/account-server/serverhandler.cpp
+++ b/src/account-server/serverhandler.cpp
@@ -414,13 +414,6 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg)
storage->banCharacter(id, duration);
} break;
- case GAMSG_CHANGE_PLAYER_LEVEL:
- {
- int id = msg.readInt32();
- int level = msg.readInt16();
- storage->setPlayerLevel(id, level);
- } break;
-
case GAMSG_CHANGE_ACCOUNT_LEVEL:
{
int id = msg.readInt32();
@@ -693,15 +686,6 @@ void GameServerHandler::syncDatabase(MessageIn &msg)
storage->updateAttribute(charId, attrId, base, mod);
} break;
- case SYNC_CHARACTER_SKILL:
- {
- LOG_DEBUG("received SYNC_CHARACTER_SKILL");
- int charId = msg.readInt32();
- int skillId = msg.readInt8();
- int skillValue = msg.readInt32();
- storage->updateExperience(charId, skillId, skillValue);
- } break;
-
case SYNC_ONLINE_STATUS:
{
LOG_DEBUG("received SYNC_ONLINE_STATUS");
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp
index 965024a0..2ddb2e08 100644
--- a/src/account-server/storage.cpp
+++ b/src/account-server/storage.cpp
@@ -75,7 +75,6 @@ static const char *DB_VERSION_PARAMETER = "database_version";
static const char *ACCOUNTS_TBL_NAME = "mana_accounts";
static const char *CHARACTERS_TBL_NAME = "mana_characters";
static const char *CHAR_ATTR_TBL_NAME = "mana_char_attr";
-static const char *CHAR_SKILLS_TBL_NAME = "mana_char_skills";
static const char *CHAR_STATUS_EFFECTS_TBL_NAME = "mana_char_status_effects";
static const char *CHAR_KILL_COUNT_TBL_NAME = "mana_char_kill_stats";
static const char *CHAR_ABILITIES_TBL_NAME = "mana_char_abilities";
@@ -363,13 +362,12 @@ CharacterData *Storage::getCharacterBySQL(Account *owner)
character->setGender(toUshort(charInfo(0, 3)));
character->setHairStyle(toUshort(charInfo(0, 4)));
character->setHairColor(toUshort(charInfo(0, 5)));
- character->setLevel(toUshort(charInfo(0, 6)));
- character->setCharacterPoints(toUshort(charInfo(0, 7)));
- character->setCorrectionPoints(toUshort(charInfo(0, 8)));
- Point pos(toInt(charInfo(0, 9)), toInt(charInfo(0, 10)));
+ character->setCharacterPoints(toUshort(charInfo(0, 6)));
+ character->setCorrectionPoints(toUshort(charInfo(0, 7)));
+ Point pos(toInt(charInfo(0, 8)), toInt(charInfo(0, 9)));
character->setPosition(pos);
- int mapId = toUint(charInfo(0, 11));
+ int mapId = toUint(charInfo(0, 10));
if (mapId > 0)
{
character->setMapId(mapId);
@@ -381,7 +379,7 @@ CharacterData *Storage::getCharacterBySQL(Account *owner)
character->setMapId(Configuration::getValue("char_defaultMap", 1));
}
- character->setCharacterSlot(toUint(charInfo(0, 12)));
+ character->setCharacterSlot(toUint(charInfo(0, 11)));
// Fill the account-related fields. Last step, as it may require a new
// SQL query.
@@ -422,25 +420,6 @@ CharacterData *Storage::getCharacterBySQL(Account *owner)
s.clear();
s.str("");
- // 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 nRows = skillInfo.rows();
- for (unsigned row = 0; row < nRows; ++row)
- {
- unsigned id = toUint(skillInfo(row, 0));
- character->setExperience(id, toInt(skillInfo(row, 1)));
- }
- }
-
- s.clear();
- s.str("");
-
// Load the status effects
s << "select status_id, status_time FROM "
<< CHAR_STATUS_EFFECTS_TBL_NAME
@@ -723,7 +702,6 @@ bool Storage::updateCharacter(CharacterData *character)
<< "gender = '" << character->getGender() << "', "
<< "hair_style = '" << character->getHairStyle() << "', "
<< "hair_color = '" << character->getHairColor() << "', "
- << "level = '" << character->getLevel() << "', "
<< "char_pts = '" << character->getCharacterPoints() << "', "
<< "correct_pts = '"<< character->getCorrectionPoints() << "', "
<< "x = '" << character->getPosition().x << "', "
@@ -754,23 +732,6 @@ bool Storage::updateCharacter(CharacterData *character)
"SQL query failure: ", e);
}
- // Character's skills
- try
- {
- std::map<int, int>::const_iterator skill_it;
- for (skill_it = character->mExperience.begin();
- skill_it != character->mExperience.end(); skill_it++)
- {
- updateExperience(character->getDatabaseID(),
- skill_it->first, skill_it->second);
- }
- }
- catch (const dal::DbSqlQueryExecFailure& e)
- {
- utils::throwError("(DALStorage::updateCharacter #3) "
- "SQL query failure: ", e);
- }
-
// Character's kill count
try
{
@@ -1022,14 +983,13 @@ void Storage::flush(Account *account)
sqlInsertCharactersTable
<< "insert into " << CHARACTERS_TBL_NAME
<< " (user_id, name, gender, hair_style, hair_color,"
- << " level, char_pts, correct_pts,"
+ << " char_pts, correct_pts,"
<< " x, y, map_id, slot) values ("
<< account->getID() << ", \""
<< character->getName() << "\", "
<< character->getGender() << ", "
<< (int)character->getHairStyle() << ", "
<< (int)character->getHairColor() << ", "
- << (int)character->getLevel() << ", "
<< (int)character->getCharacterPoints() << ", "
<< (int)character->getCorrectionPoints() << ", "
<< character->getPosition().x << ", "
@@ -1053,15 +1013,6 @@ void Storage::flush(Account *account)
attr_it->second.base,
attr_it->second.modified);
}
-
- // Update the characters skill
- std::map<int, int>::const_iterator skill_it;
- for (skill_it = character->mExperience.begin();
- skill_it != character->mExperience.end(); skill_it++)
- {
- updateExperience(character->getDatabaseID(),
- skill_it->first, skill_it->second);
- }
}
}
@@ -1173,51 +1124,6 @@ void Storage::updateCharacterPoints(int charId,
}
}
-void Storage::updateExperience(int charId, int skillId, int skillValue)
-{
- try
- {
- std::ostringstream sql;
- // If experience has decreased to 0 we don't store it anymore,
- // since it's the default behaviour.
- if (skillValue == 0)
- {
- sql << "DELETE FROM " << CHAR_SKILLS_TBL_NAME
- << " WHERE char_id = " << charId
- << " AND skill_id = " << skillId;
- mDb->execSql(sql.str());
- return;
- }
-
- // Try to update the skill
- sql.clear();
- sql.str("");
- sql << "UPDATE " << CHAR_SKILLS_TBL_NAME
- << " SET skill_exp = " << skillValue
- << " WHERE char_id = " << charId
- << " AND skill_id = " << skillId;
- mDb->execSql(sql.str());
-
- // Check if the update has modified a row
- if (mDb->getModifiedRows() > 0)
- return;
-
- sql.clear();
- sql.str("");
- sql << "INSERT INTO " << CHAR_SKILLS_TBL_NAME << " "
- << "(char_id, skill_id, skill_exp) VALUES ( "
- << charId << ", "
- << skillId << ", "
- << skillValue << ")";
- mDb->execSql(sql.str());
- }
- catch (const dal::DbSqlQueryExecFailure &e)
- {
- utils::throwError("(DALStorage::updateExperience) SQL query failure: ",
- e);
- }
-}
-
void Storage::updateAttribute(int charId, unsigned attrId,
double base, double mod)
{
@@ -1795,13 +1701,6 @@ void Storage::delCharacter(int charId) const
<< " WHERE owner_id = '" << charId << "';";
mDb->execSql(sql.str());
- // Delete the skills of the character
- sql.clear();
- sql.str("");
- sql << "DELETE FROM " << CHAR_SKILLS_TBL_NAME
- << " WHERE char_id = '" << charId << "';";
- mDb->execSql(sql.str());
-
// Delete from the quests table
sql.clear();
sql.str("");
@@ -1886,23 +1785,6 @@ void Storage::setAccountLevel(int id, int level)
}
}
-void Storage::setPlayerLevel(int id, int level)
-{
- try
- {
- std::ostringstream sql;
- sql << "update " << CHARACTERS_TBL_NAME
- << " set level = " << level
- << " where id = " << id << ";";
- mDb->execSql(sql.str());
- }
- catch (const dal::DbSqlQueryExecFailure &e)
- {
- utils::throwError("(DALStorage::setPlayerLevel) SQL query failure: ",
- e);
- }
-}
-
void Storage::storeLetter(Letter *letter)
{
try
diff --git a/src/account-server/storage.h b/src/account-server/storage.h
index fbc4cd8c..7acc78e6 100644
--- a/src/account-server/storage.h
+++ b/src/account-server/storage.h
@@ -135,15 +135,6 @@ class Storage
int charPoints, int corrPoints);
/**
- * Write a modification message about character skills to the database.
- *
- * @param CharId ID of the character
- * @param SkillId ID of the skill
- * @param SkillValue new skill points
- */
- void updateExperience(int charId, int skillId, int skillValue);
-
- /**
* Write a modification message about character attributes
* to the database.
*
@@ -156,7 +147,7 @@ class Storage
double base, double mod);
/**
- * Write a modification message about character skills to the database.
+ * Write a modification message about kill counts to the database.
*
* @param CharId ID of the character
* @param monsterId ID of the monster type
@@ -384,14 +375,6 @@ class Storage
void setAccountLevel(int id, int level);
/**
- * Set the level on a character.
- *
- * @param id The id of the character
- * @param level The level to set for the character
- */
- void setPlayerLevel(int id, int level);
-
- /**
* Store letter.
*
* @param letter The letter to store