From 8e54a3c1cf23a7f572ef297f1f36767d438b3921 Mon Sep 17 00:00:00 2001 From: arrai Date: Sun, 9 Nov 2008 20:36:04 +0100 Subject: [PATCH] [6815] Allowed switching INVTYPE_HOLDABLE items during combat, used correct spells for triggering global cooldown at weapon switch. Original patch provided by mobel/simak --- src/game/ItemPrototype.h | 1 + src/game/Player.cpp | 21 +++++++++++++++++++-- src/game/Player.h | 6 ------ src/game/SharedDefines.h | 2 ++ src/shared/revision_nr.h | 2 +- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 9dd7fd701..6898281a5 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -552,6 +552,7 @@ struct ItemPrototype { case INVTYPE_RELIC: case INVTYPE_SHIELD: + case INVTYPE_HOLDABLE: return true; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index ed5bf471d..dcf3ae2b2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -9942,9 +9942,26 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) if(pProto && isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer == 0) { - m_weaponChangeTimer = DEFAULT_SWITCH_WEAPON; + uint32 cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s; + if (getClass() == CLASS_ROGUE) - m_weaponChangeTimer = ROGUE_SWITCH_WEAPON; + cooldownSpell = SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s; + + SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell); + + if (!spellProto) + sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); + else + { + m_weaponChangeTimer = spellProto->StartRecoveryTime; + + WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); + data << uint64(GetGUID()); + data << uint8(1); + data << uint32(cooldownSpell); + data << uint32(0); + GetSession()->SendPacket(&data); + } } } diff --git a/src/game/Player.h b/src/game/Player.h index 3d19dc5ed..3308c08e2 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -677,12 +677,6 @@ struct ItemPosCount }; typedef std::vector ItemPosCountVec; -enum SwitchWeapon -{ - DEFAULT_SWITCH_WEAPON = 1500, //cooldown in ms - ROGUE_SWITCH_WEAPON = 1000 -}; - enum TradeSlots { TRADE_SLOT_COUNT = 7, diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 817ae8129..907cceb2f 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -1834,6 +1834,8 @@ enum CorpseDynFlags #define SPELL_ID_GENERIC_LEARN 483 #define SPELL_ID_PASSIVE_BATTLE_STANCE 2457 #define SPELL_ID_PASSIVE_RESURRECTION_SICKNESS 15007 +#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s 6119 +#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s 6123 enum WeatherType { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index d4707ab3a..f3f54dc7d 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 "6814" + #define REVISION_NR "6815" #endif // __REVISION_NR_H__