From 93ed08e886494b10af33a71efe2df7b9e6cdbce3 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 10 Aug 2009 13:08:02 +0400 Subject: [PATCH] [8343] Extand level allowed range for item use to upper values if it end at max player level. Also add DEFAULT_MAX_LEVEL define for store current used client expection about max player level. For example for current supported this is 80. --- src/game/DBCEnums.h | 5 +++++ src/game/Player.cpp | 16 ++++++++++++---- src/game/World.cpp | 4 ++-- src/realmd/AuthCodes.h | 4 ++++ src/shared/revision_nr.h | 2 +- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index 20b28c1d4..c6f57559c 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -19,6 +19,11 @@ #ifndef DBCENUMS_H #define DBCENUMS_H +// Client expected level limitation, like as used in DBC item max levels for "until max player level" +// use as default max player level, must be fit max level for used client +// also see MAX_LEVEL and STRONG_MAX_LEVEL define +#define DEFAULT_MAX_LEVEL 80 + // client supported max level for player/pets/etc. Avoid overflow or client stability affected. // also see GT_MAX_LEVEL define #define MAX_LEVEL 100 diff --git a/src/game/Player.cpp b/src/game/Player.cpp index edc2aae3d..e83b25766 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6508,13 +6508,20 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply) void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool apply, bool only_level_scale /*= false*/) { - if(slot >= INVENTORY_SLOT_BAG_END || !proto) + if (slot >= INVENTORY_SLOT_BAG_END || !proto) return; ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL; - ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : NULL; + if (only_level_scale && !ssd) + return; - if(only_level_scale && !(ssd && ssv)) + // req. check at equip, but allow use for extended range if range limit max level, set proper level + uint32 ssd_level = getLevel(); + if (ssd && ssd_level > ssd->MaxLevel) + ssd_level = ssd->MaxLevel; + + ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : NULL; + if (only_level_scale && !ssv) return; for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i) @@ -9784,7 +9791,8 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo } ScalingStatDistributionEntry const *ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0; - if (ssd && ssd->MaxLevel < getLevel()) + // check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items) + if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < getLevel()) return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; uint8 eslot = FindEquipSlot( pProto, slot, swap ); diff --git a/src/game/World.cpp b/src/game/World.cpp index d8a5ab67d..6b6a337d0 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -673,12 +673,12 @@ void World::LoadConfigSettings(bool reload) if(reload) { - uint32 val = sConfig.GetIntDefault("MaxPlayerLevel", 80); + uint32 val = sConfig.GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if(val!=m_configs[CONFIG_MAX_PLAYER_LEVEL]) sLog.outError("MaxPlayerLevel option can't be changed at mangosd.conf reload, using current value (%u).",m_configs[CONFIG_MAX_PLAYER_LEVEL]); } else - m_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfig.GetIntDefault("MaxPlayerLevel", 80); + m_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfig.GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if(m_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL) { diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index 1940ecd93..04c0fc3de 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -70,4 +70,8 @@ enum LoginResult #define EXPECTED_MANGOS_CLIENT_BUILD {9947, 0} +// At update excepted builds please update if need define DEFAULT_MAX_LEVEL +// in DBCEnum.h to default max player level expected by build +// and alos in mangosd.conf.in + #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 03bda0f9b..9f68200c0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8342" + #define REVISION_NR "8343" #endif // __REVISION_NR_H__