aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp2
-rw-r--r--src/game/Spell.cpp3
-rw-r--r--src/game/SpellMgr.cpp43
-rw-r--r--src/game/SpellMgr.h2
-rw-r--r--src/mangosd/Master.cpp1
-rw-r--r--src/shared/revision_nr.h2
6 files changed, 41 insertions, 12 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index e20a4709848..51ae25b3e6c 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -19525,7 +19525,7 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
{
// use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date
- if(GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea)!=0)
+ if(GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,GetBattleGroundId())!=0)
RemoveAura(iter);
else
++iter;
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index c4ed955e450..1f829f763f6 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -3774,7 +3774,8 @@ uint8 Spell::CanCast(bool strict)
return SPELL_FAILED_NOT_IN_ARENA;
// zone check
- if(uint8 res= GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),m_caster->GetZoneId(),m_caster->GetAreaId()))
+ if (uint8 res= GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),m_caster->GetZoneId(),m_caster->GetAreaId(),
+ m_caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)m_caster)->GetBattleGroundId() : 0))
return res;
// not let players cast spells at mount (and let do it to creatures)
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index e03d544c7e4..07f9c781d69 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -26,6 +26,7 @@
#include "World.h"
#include "Chat.h"
#include "Spell.h"
+#include "BattleGroundMgr.h"
bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS];
@@ -2640,7 +2641,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
return true;
}
-uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id)
+uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id, uint32 bgInstanceId)
{
// normal case
if( spellInfo->AreaGroupId > 0)
@@ -2725,27 +2726,40 @@ uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,u
return area_id == 4028 || area_id == 4029 || area_id == 4106 || area_id == 4031 ? 0 : SPELL_FAILED_INCORRECT_AREA;
case 23333: // Warsong Flag
case 23335: // Silverwing Flag
- return map_id == 489 ? 0 : SPELL_FAILED_REQUIRES_AREA;
+ return map_id == 489 && bgInstanceId ? 0 : SPELL_FAILED_REQUIRES_AREA;
case 34976: // Netherstorm Flag
- return map_id == 566 ? 0 : SPELL_FAILED_REQUIRES_AREA;
+ return map_id == 566 && bgInstanceId ? 0 : SPELL_FAILED_REQUIRES_AREA;
case 2584: // Waiting to Resurrect
case 22011: // Spirit Heal Channel
case 22012: // Spirit Heal
case 24171: // Resurrection Impact Visual
case 42792: // Recently Dropped Flag
case 43681: // Inactive
- case 44521: // Preparation
case 44535: // Spirit Heal (mana)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
if(!mapEntry)
return SPELL_FAILED_INCORRECT_AREA;
- return mapEntry->IsBattleGround() ? 0 : SPELL_FAILED_REQUIRES_AREA;
+ return mapEntry->IsBattleGround() && bgInstanceId ? 0 : SPELL_FAILED_REQUIRES_AREA;
+ }
+ case 44521: // Preparation
+ {
+ if(!bgInstanceId)
+ return SPELL_FAILED_REQUIRES_AREA;
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
+ if(!mapEntry)
+ return SPELL_FAILED_INCORRECT_AREA;
+
+ if(!mapEntry->IsBattleGround())
+ return SPELL_FAILED_REQUIRES_AREA;
+
+ BattleGround* bg = sBattleGroundMgr.GetBattleGround(bgInstanceId);
+ return bg && bg->GetStatus()==STATUS_WAIT_JOIN ? 0 : SPELL_FAILED_REQUIRES_AREA;
}
case 32724: // Gold Team (Alliance)
case 32725: // Green Team (Alliance)
- case 32727: // Arena Preparation
case 35774: // Gold Team (Horde)
case 35775: // Green Team (Horde)
{
@@ -2753,7 +2767,22 @@ uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,u
if(!mapEntry)
return SPELL_FAILED_INCORRECT_AREA;
- return mapEntry->IsBattleArena() ? 0 : SPELL_FAILED_REQUIRES_AREA;
+ return mapEntry->IsBattleArena() && bgInstanceId ? 0 : SPELL_FAILED_REQUIRES_AREA;
+ }
+ case 32727: // Arena Preparation
+ {
+ if(!bgInstanceId)
+ return SPELL_FAILED_REQUIRES_AREA;
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
+ if(!mapEntry)
+ return SPELL_FAILED_INCORRECT_AREA;
+
+ if(!mapEntry->IsBattleArena())
+ return SPELL_FAILED_REQUIRES_AREA;
+
+ BattleGround* bg = sBattleGroundMgr.GetBattleGround(bgInstanceId);
+ return bg && bg->GetStatus()==STATUS_WAIT_JOIN ? 0 : SPELL_FAILED_REQUIRES_AREA;
}
}
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 149250b5e72..37a79c6adf6 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -412,7 +412,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI
bool IsAuraAddedBySpell(uint32 auraType, uint32 spellId);
-uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id);
+uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id,uint32 bgInstanceId);
extern bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS];
diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp
index 8d5bdeee4b8..fd5259fa916 100644
--- a/src/mangosd/Master.cpp
+++ b/src/mangosd/Master.cpp
@@ -473,7 +473,6 @@ void Master::clearOnlineAccounts()
"UPDATE account SET online = 0 WHERE online > 0 "
"AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')",realmID);
-
CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0");
}
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index f48b6249d30..28cff7f433b 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 "7252"
+ #define REVISION_NR "7253"
#endif // __REVISION_NR_H__