From ddb92024dd6851a0565f1f06ed4ac8ea2abf1dd3 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Tue, 20 Mar 2007 18:41:24 +0000 Subject: Removed check for difference between lowest and highest attribute at char creation. Unified order of basic attributes. --- ChangeLog | 7 +++++++ src/account-server/accounthandler.cpp | 11 ----------- src/account-server/dalstorage.cpp | 8 +++++--- src/account-server/dalstoragesql.hpp | 6 +++--- src/defines.h | 7 ------- 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index e28da47d..af736939 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-03-20 Philipp Sehmisch + + * src/account-server/accounthandler.cpp, src/defines.h: Removed check + for difference between lowest and highest attribute at char creation. + * src/account-server/dalstorage.cpp, src/account-server/dalstorage.hpp: + Unified order of basic attributes. + 2007-03-20 Rogier Polak * src/account-server/accounthandler.cpp, src/utils/tokencollector.hpp, diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp index 48a72548..fc61ca72 100644 --- a/src/account-server/accounthandler.cpp +++ b/src/account-server/accounthandler.cpp @@ -565,8 +565,6 @@ AccountHandler::handleCharacterCreateMessage(AccountClient &computer, // We see if the difference between the lowest stat and the highest // isn't too big. - unsigned short lowestAttribute = POINTS_TO_DISTRIBUTES_AT_LVL1; - unsigned short highestAttribute = 0; // start value unsigned int totalAttributes = 0; bool validNonZeroAttributes = true; for (int i = 0; i < NB_BASE_ATTRIBUTES; ++i) @@ -576,10 +574,6 @@ AccountHandler::handleCharacterCreateMessage(AccountClient &computer, // For checking if all stats are at least > 0 if (attributes[i] <= 0) validNonZeroAttributes = false; - if (lowestAttribute > attributes[i]) - lowestAttribute = attributes[i]; - if (highestAttribute < attributes[i]) - highestAttribute = attributes[i]; } if (totalAttributes > POINTS_TO_DISTRIBUTES_AT_LVL1) @@ -590,11 +584,6 @@ AccountHandler::handleCharacterCreateMessage(AccountClient &computer, { reply.writeByte(CREATE_ATTRIBUTES_TOO_LOW); } - else if ((highestAttribute - lowestAttribute) > - (signed) MAX_DIFF_BETWEEN_ATTRIBUTES) - { - reply.writeByte(CREATE_ATTRIBUTES_INVALID_DIFF); - } else if (!validNonZeroAttributes) { reply.writeByte(CREATE_ATTRIBUTES_EQUAL_TO_ZERO); diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp index 4898ed1c..721bb55f 100644 --- a/src/account-server/dalstorage.cpp +++ b/src/account-server/dalstorage.cpp @@ -554,6 +554,8 @@ DALStorage::updateCharacter(CharacterPtr character) << "', " << "agi = '" << character->getBaseAttribute(BASE_ATTR_AGILITY) << "', " + << "dex = '" << character->getBaseAttribute(BASE_ATTR_DEXTERITY) + << "', " << "vit = '" << character->getBaseAttribute(BASE_ATTR_VITALITY) << "', " #if defined(MYSQL_SUPPORT) || defined(POSTGRESQL_SUPPORT) @@ -563,8 +565,7 @@ DALStorage::updateCharacter(CharacterPtr character) #endif << character->getBaseAttribute(BASE_ATTR_INTELLIGENCE) << "', " - << "dex = '" << character->getBaseAttribute(BASE_ATTR_DEXTERITY) - << "', " + << "will = '" << character->getBaseAttribute(BASE_ATTR_WILLPOWER) << "', " << "charisma = '" << character->getBaseAttribute(BASE_ATTR_CHARISMA) @@ -878,9 +879,9 @@ void DALStorage::flush(AccountPtr const &account) << (*it)->getMapId() << ", " << (*it)->getBaseAttribute(BASE_ATTR_STRENGTH) << ", " << (*it)->getBaseAttribute(BASE_ATTR_AGILITY) << ", " + << (*it)->getBaseAttribute(BASE_ATTR_DEXTERITY) << ", " << (*it)->getBaseAttribute(BASE_ATTR_VITALITY) << ", " << (*it)->getBaseAttribute(BASE_ATTR_INTELLIGENCE) << ", " - << (*it)->getBaseAttribute(BASE_ATTR_DEXTERITY) << ", " << (*it)->getBaseAttribute(BASE_ATTR_WILLPOWER) << ", " << (*it)->getBaseAttribute(BASE_ATTR_CHARISMA) << ");"; @@ -900,6 +901,7 @@ void DALStorage::flush(AccountPtr const &account) << " map_id = " << (*it)->getMapId() << ", " << " str = " << (*it)->getBaseAttribute(BASE_ATTR_STRENGTH) << ", " << " agi = " << (*it)->getBaseAttribute(BASE_ATTR_AGILITY) << ", " + << " dex = " << (*it)->getBaseAttribute(BASE_ATTR_DEXTERITY) << ", " << " vit = " << (*it)->getBaseAttribute(BASE_ATTR_VITALITY) << ", " #if defined(MYSQL_SUPPORT) || defined(POSTGRESQL_SUPPORT) << " `int` = " diff --git a/src/account-server/dalstoragesql.hpp b/src/account-server/dalstoragesql.hpp index 1d42467d..c4a433af 100644 --- a/src/account-server/dalstoragesql.hpp +++ b/src/account-server/dalstoragesql.hpp @@ -132,10 +132,10 @@ const std::string SQL_CHARACTERS_TABLE( // attributes "str SMALLINT UNSIGNED NOT NULL," "agi SMALLINT UNSIGNED NOT NULL," + "dex SMALLINT UNSIGNED NOT NULL," "vit SMALLINT UNSIGNED NOT NULL," // note: int must be backquoted as it's a MySQL keyword "`int` SMALLINT UNSIGNED NOT NULL," - "dex SMALLINT UNSIGNED NOT NULL," "will SMALLINT UNSIGNED NOT NULL," "charisma SMALLINT UNSIGNED NOT NULL," "FOREIGN KEY (user_id) REFERENCES tmw_accounts(id)," @@ -158,9 +158,9 @@ const std::string SQL_CHARACTERS_TABLE( // attributes "str INTEGER NOT NULL," "agi INTEGER NOT NULL," + "dex INTEGER NOT NULL," "vit INTEGER NOT NULL," "int INTEGER NOT NULL," - "dex INTEGER NOT NULL," "will INTEGER NOT NULL," "charisma INTEGER NOT NULL," "FOREIGN KEY (user_id) REFERENCES tmw_accounts(id)," @@ -182,9 +182,9 @@ const std::string SQL_CHARACTERS_TABLE( // attributes "str INTEGER NOT NULL," "agi INTEGER NOT NULL," + "dex INTEGER NOT NULL," "vit INTEGER NOT NULL," "int INTEGER NOT NULL," - "dex INTEGER NOT NULL," "will INTEGER NOT NULL," "charisma INTEGER NOT NULL," "FOREIGN KEY (user_id) REFERENCES tmw_accounts(id)," diff --git a/src/defines.h b/src/defines.h index 9394d3c9..dc27c3b4 100644 --- a/src/defines.h +++ b/src/defines.h @@ -76,12 +76,6 @@ enum MAX_HAIRCOLOR_VALUE = 9, MAX_GENDER_VALUE = 2, -/** - * Determines the maximum difference between the largest attribute and the - * smallest one. To ensure that characters do not have disproportionned - * attributes. - */ - MAX_DIFF_BETWEEN_ATTRIBUTES = 5, /** * Points to give to a brand new character */ @@ -235,7 +229,6 @@ enum { CREATE_INVALID_GENDER, CREATE_ATTRIBUTES_TOO_HIGH, CREATE_ATTRIBUTES_TOO_LOW, - CREATE_ATTRIBUTES_INVALID_DIFF, CREATE_ATTRIBUTES_EQUAL_TO_ZERO, CREATE_EXISTS_NAME, CREATE_TOO_MUCH_CHARACTERS -- cgit v1.2.3-70-g09d2