diff options
author | MrSmite <bull@deadmines.cave> | 2014-03-02 18:09:02 -0500 |
---|---|---|
committer | MrSmite <bull@deadmines.cave> | 2014-09-05 15:06:05 -0400 |
commit | 31c00b0ce40b96e486bb47d1c66e627e0f49bd25 (patch) | |
tree | ed1ae7fb5a7fcd39214e7250a80affaac1f0e017 | |
parent | b20b6dedf9b7de13a35f60c6f72f8a80ceed94e6 (diff) |
Allow players to track both herbs and minerals at the same time
Note: The following are client limitations and cannot be coded for:
* The minimap tracking icon will display whichever skill is activated second
* The minimap tracking list will only show a check mark next to the last skill activated (sometimes this
bugs out and doesn't switch the check mark. It has no effect on the actual tracking though).
* The minimap dots are yellow for both resources
-rw-r--r-- | src/server/game/Handlers/SpellHandler.cpp | 20 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 10 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 1 | ||||
-rw-r--r-- | src/server/game/World/World.h | 1 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 14 |
5 files changed, 46 insertions, 0 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 13f79fb88c5..9cce494a522 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -33,6 +33,7 @@ #include "GameObjectAI.h" #include "SpellAuraEffects.h" #include "Player.h" +#include "Config.h" void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets) { @@ -436,6 +437,25 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) // maybe should only remove one buff when there are multiple? _player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL); + + // If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other + if (sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES) && spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES)) + { + Unit::AuraEffectList const& auraEffects = _player->GetAuraEffectsByType(SPELL_AURA_TRACK_RESOURCES); + if (!auraEffects.empty()) + { + // Build list of spell IDs to cancel. Trying to cancel the aura while iterating + // over AuraEffectList caused "incompatible iterator" errors on second pass + std::list<uint32> spellIDs; + + for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); auraEffect++) + spellIDs.push_back((*auraEffect)->GetId()); + + // Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a) + for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); it++) + _player->RemoveOwnedAura(*it, 0, 0, AURA_REMOVE_BY_CANCEL); + } + } } void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 07cfa80f297..5bc2c41b6ce 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -35,6 +35,7 @@ #include "ScriptMgr.h" #include "SpellScript.h" #include "Vehicle.h" +#include "Config.h" AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): _target(target), _base(aura), _removeMode(AURA_REMOVE_NONE), _slot(MAX_AURAS), @@ -1785,6 +1786,15 @@ bool Aura::CanStackWith(Aura const* existingAura) const return true; } + // Check for custom server setting to allow tracking both Herbs and Minerals + // Note: The following are client limitations and cannot be coded for: + // * The minimap tracking icon will display whichever skill is activated second + // * The minimap tracking list will only show a check mark next to the last skill activated + // Sometimes this bugs out and doesn't switch the check mark. It has no effect on the actual tracking though. + // * The minimap dots are yellow for both resources + if (m_spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES) && existingSpellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES)) + return sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES); + // check spell specific stack rules if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo) || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo))) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f9c8c800ca5..750ed5a380e 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1169,6 +1169,7 @@ void World::LoadConfigSettings(bool reload) if (m_int_configs[CONFIG_PVP_TOKEN_COUNT] < 1) m_int_configs[CONFIG_PVP_TOKEN_COUNT] = 1; + m_bool_configs[CONFIG_ALLOW_TRACK_BOTH_RESOURCES] = sConfigMgr->GetBoolDefault("AllowTrackBothResources", false); m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false); m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false); m_bool_configs[CONFIG_SHOW_MUTE_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowMuteInWorld", false); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index b77f8777bdc..d169fa587fe 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -156,6 +156,7 @@ enum WorldBoolConfigs CONFIG_STATS_LIMITS_ENABLE, CONFIG_INSTANCES_RESET_ANNOUNCE, CONFIG_IP_BASED_ACTION_LOGGING, + CONFIG_ALLOW_TRACK_BOTH_RESOURCES, BOOL_CONFIG_VALUE_COUNT }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 9a78d74bb45..ca53e91737b 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2432,6 +2432,20 @@ CharDelete.KeepDays = 30 ################################################################################################### # CUSTOM SERVER OPTIONS # +# AllowTrackBothResources +# Description: Allows players to track herbs and minerals at the same time (if they have the skills) +# Default: 0 (do not allow) +# 1 (allow) +# +# Note: The following are client limitations and cannot be coded for: +# * The minimap tracking icon will display whichever skill is activated second +# * The minimap tracking list will only show a check mark next to the last skill activated (sometimes this +# bugs out and doesn't switch the check mark. It has no effect on the actual tracking though). +# * The minimap dots are yellow for both resources + +AllowTrackBothResources = 0 + +# # PlayerStart.AllReputation # Description: Players will start with most of the high level reputations that are needed # for items, mounts etc. |