players can now equip items up to the highest level they have been
Some checks are pending
nopch-build / ubuntu-22.04-clang-15-nopch (push) Waiting to run
nopch-build / ubuntu-24.04-clang-18-nopch (push) Waiting to run
nopch-build / ubuntu-24.04-gcc-14-nopch (push) Waiting to run
pch-build / ubuntu-22.04-clang-15-pch (push) Waiting to run
pch-build / ubuntu-24.04-clang-18-pch (push) Waiting to run
nopch-module-build / ubuntu-24.04-clang-18-nopch-modules (push) Waiting to run
Dashboard CI / Test Bash Scripts (push) Waiting to run
Dashboard CI / Test Bash Scripts-1 (push) Waiting to run
Dashboard CI / Build and Integration Test (push) Waiting to run
Dashboard CI / Build and Integration Test-1 (push) Waiting to run
docker-build / build-containers (push) Waiting to run
import-pending / import-pending (push) Waiting to run
macos-build / macos-14 (push) Waiting to run
tools / ubuntu-24.04-clang-18 (push) Waiting to run
windows-build / windows-latest (push) Waiting to run
Some checks are pending
nopch-build / ubuntu-22.04-clang-15-nopch (push) Waiting to run
nopch-build / ubuntu-24.04-clang-18-nopch (push) Waiting to run
nopch-build / ubuntu-24.04-gcc-14-nopch (push) Waiting to run
pch-build / ubuntu-22.04-clang-15-pch (push) Waiting to run
pch-build / ubuntu-24.04-clang-18-pch (push) Waiting to run
nopch-module-build / ubuntu-24.04-clang-18-nopch-modules (push) Waiting to run
Dashboard CI / Test Bash Scripts (push) Waiting to run
Dashboard CI / Test Bash Scripts-1 (push) Waiting to run
Dashboard CI / Build and Integration Test (push) Waiting to run
Dashboard CI / Build and Integration Test-1 (push) Waiting to run
docker-build / build-containers (push) Waiting to run
import-pending / import-pending (push) Waiting to run
macos-build / macos-14 (push) Waiting to run
tools / ubuntu-24.04-clang-18 (push) Waiting to run
windows-build / windows-latest (push) Waiting to run
This commit is contained in:
parent
4e1eaea0b4
commit
e2a773f82a
3 changed files with 35 additions and 1 deletions
4
data/sql/updates/db_characters/2026_05_16_00.sql
Normal file
4
data/sql/updates/db_characters/2026_05_16_00.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- DB update 2026_05_15_00 -> 2026_05_16_00
|
||||
--
|
||||
ALTER TABLE characters
|
||||
ADD COLUMN max_level_earned TINYINT(3) UNSIGNED NOT NULL DEFAULT 1;
|
||||
|
|
@ -2474,6 +2474,16 @@ void Player::GiveLevel(uint8 level)
|
|||
|
||||
SetLevel(level);
|
||||
|
||||
// Set max level earned
|
||||
CharacterDatabase.Execute(
|
||||
"UPDATE characters "
|
||||
"SET max_level_earned = GREATEST(max_level_earned, {}, {})"
|
||||
"WHERE guid = {}",
|
||||
oldLevel,
|
||||
level,
|
||||
GetGUID().GetCounter()
|
||||
);
|
||||
|
||||
UpdateSkillsForLevel();
|
||||
|
||||
// save base values (bonuses already included in stored stats
|
||||
|
|
|
|||
|
|
@ -2385,7 +2385,27 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
|
|||
return EQUIP_ERR_NO_REQUIRED_PROFICIENCY;
|
||||
}
|
||||
|
||||
if (GetLevel() < proto->RequiredLevel)
|
||||
QueryResult levelQuery = CharacterDatabase.Query(
|
||||
"SELECT max_level_earned FROM characters "
|
||||
"WHERE guid = {}",
|
||||
GetGUID().GetCounter()
|
||||
);
|
||||
|
||||
uint8 maxLevelEarned = 0;
|
||||
|
||||
if (levelQuery)
|
||||
{
|
||||
maxLevelEarned = levelQuery->Fetch()[0].Get<uint8>();
|
||||
}
|
||||
|
||||
uint8 currentLevel = GetLevel();
|
||||
|
||||
if (maxLevelEarned < currentLevel)
|
||||
{
|
||||
maxLevelEarned = currentLevel;
|
||||
}
|
||||
|
||||
if (maxLevelEarned < proto->RequiredLevel)
|
||||
{
|
||||
return EQUIP_ERR_CANT_EQUIP_LEVEL_I;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue