diff options
author | Shocker <none@none> | 2010-09-27 02:57:01 +0300 |
---|---|---|
committer | Shocker <none@none> | 2010-09-27 02:57:01 +0300 |
commit | ede2a1c5edd81d46f218dc09d1c3e1e707e44921 (patch) | |
tree | 40bc1ab3239f08daa9d52c53f27c408c96cdcfe9 | |
parent | a9e9a2c8848c22e4a3e3b7bab0caeca25d9ea408 (diff) |
Core/Quests: Make sure itemcount doesn't get to be negative.
Since this is an old issue and probably there are various entries with huge values as itemcounts already, a cleanup must be done before changing structure of character_queststatus which was done in r9be097c482, thus I'll include the SQL cleanup in that revision's .sql file or MySQL will thrown an error regarding out of bounds values
--HG--
branch : trunk
-rw-r--r-- | sql/updates/10084_characters_character_queststatus.sql | 5 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/sql/updates/10084_characters_character_queststatus.sql b/sql/updates/10084_characters_character_queststatus.sql index 9b541553eb2..81ce948598e 100644 --- a/sql/updates/10084_characters_character_queststatus.sql +++ b/sql/updates/10084_characters_character_queststatus.sql @@ -1,3 +1,8 @@ +UPDATE `character_queststatus` SET `itemcount1` = 0 WHERE `itemcount1` > 65535; +UPDATE `character_queststatus` SET `itemcount2` = 0 WHERE `itemcount2` > 65535; +UPDATE `character_queststatus` SET `itemcount3` = 0 WHERE `itemcount3` > 65535; +UPDATE `character_queststatus` SET `itemcount4` = 0 WHERE `itemcount4` > 65535; + ALTER TABLE `character_queststatus` CHANGE `status` `status` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT 0, CHANGE `mobcount1` `mobcount1` SMALLINT( 3 ) UNSIGNED NOT NULL DEFAULT 0, CHANGE `mobcount2` `mobcount2` SMALLINT( 3 ) UNSIGNED NOT NULL DEFAULT 0, diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index dd712e20547..6a36c3b5338 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -15240,7 +15240,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) if (curitemcount < reqitemcount + count) { uint16 remitemcount = curitemcount <= reqitemcount ? count : count + reqitemcount - curitemcount; - q_status.m_itemcount[j] = curitemcount - remitemcount; + q_status.m_itemcount[j] = (curitemcount <= remitemcount) ? 0 : curitemcount - remitemcount; if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED; |