[c12599] Add support for condition_id to spell_area table

This commit is contained in:
Schmoozerd 2013-05-31 11:09:41 +01:00 committed by Antz
parent 4f86b168c0
commit 15bb475d40
10 changed files with 111 additions and 138 deletions

View file

@ -1425,7 +1425,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) DEFAULT NULL, `version` varchar(120) DEFAULT NULL,
`creature_ai_version` varchar(120) DEFAULT NULL, `creature_ai_version` varchar(120) DEFAULT NULL,
`cache_id` int(10) DEFAULT '0', `cache_id` int(10) DEFAULT '0',
`required_c12594_01_mangos_spell_template` bit(1) default NULL `required_c12601_01_mangos_spell_area` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@ -1435,7 +1435,7 @@ CREATE TABLE `db_version` (
LOCK TABLES `db_version` WRITE; LOCK TABLES `db_version` WRITE;
/*!40000 ALTER TABLE `db_version` DISABLE KEYS */; /*!40000 ALTER TABLE `db_version` DISABLE KEYS */;
INSERT INTO `db_version` (`version`, `creature_ai_version`, `cache_id`, `required_c12594_01_mangos_spell_template`) VALUES INSERT INTO `db_version` (`version`, `creature_ai_version`, `cache_id`, `required_c12601_01_mangos_spell_area`) VALUES
('Mangos default database.','Creature EventAI not provided.',0,NULL); ('Mangos default database.','Creature EventAI not provided.',0,NULL);
/*!40000 ALTER TABLE `db_version` ENABLE KEYS */; /*!40000 ALTER TABLE `db_version` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@ -20962,16 +20962,17 @@ DROP TABLE IF EXISTS `spell_area`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `spell_area` ( CREATE TABLE `spell_area` (
`spell` mediumint(8) unsigned NOT NULL DEFAULT '0', `spell` mediumint(8) unsigned NOT NULL default '0',
`area` mediumint(8) unsigned NOT NULL DEFAULT '0', `area` mediumint(8) unsigned NOT NULL default '0',
`quest_start` mediumint(8) unsigned NOT NULL DEFAULT '0', `quest_start` mediumint(8) unsigned NOT NULL default '0',
`quest_start_active` tinyint(1) unsigned NOT NULL DEFAULT '0', `quest_start_active` tinyint(1) unsigned NOT NULL default '0',
`quest_end` mediumint(8) unsigned NOT NULL DEFAULT '0', `quest_end` mediumint(8) unsigned NOT NULL default '0',
`aura_spell` mediumint(8) NOT NULL DEFAULT '0', `condition_id` mediumint(8) unsigned NOT NULL default '0',
`racemask` mediumint(8) unsigned NOT NULL DEFAULT '0', `aura_spell` mediumint(8) NOT NULL default '0',
`gender` tinyint(1) unsigned NOT NULL DEFAULT '2', `racemask` mediumint(8) unsigned NOT NULL default '0',
`autocast` tinyint(1) unsigned NOT NULL DEFAULT '0', `gender` tinyint(1) unsigned NOT NULL default '2',
PRIMARY KEY (`spell`,`area`,`quest_start`,`quest_start_active`,`aura_spell`,`racemask`,`gender`) `autocast` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`spell`,`area`,`quest_start`,`quest_start_active`,`aura_spell`,`racemask`,`gender`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;

View file

@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_c12594_01_mangos_spell_template required_c12601_01_mangos_spell_area bit;
ALTER TABLE spell_area ADD COLUMN `condition_id` mediumint(8) unsigned NOT NULL default '0' AFTER quest_end;

View file

@ -7825,7 +7825,8 @@ char const* conditionSourceToStr[] =
"gossip menu option", "gossip menu option",
"event AI", "event AI",
"hardcoded", "hardcoded",
"vendor's item check" "vendor's item check",
"spell_area check"
}; };
// Checks if player meets the condition // Checks if player meets the condition

View file

@ -416,6 +416,7 @@ enum ConditionSource // From where was th
CONDITION_FROM_EVENTAI = 4, // Used to check EventAI Event "On Receive Emote" CONDITION_FROM_EVENTAI = 4, // Used to check EventAI Event "On Receive Emote"
CONDITION_FROM_HARDCODED = 5, // Used to check a hardcoded event - not actually a condition CONDITION_FROM_HARDCODED = 5, // Used to check a hardcoded event - not actually a condition
CONDITION_FROM_VENDOR = 6, // Used to check a condition from a vendor CONDITION_FROM_VENDOR = 6, // Used to check a condition from a vendor
CONDITION_FROM_SPELL_AREA = 7, // Used to check a condition from spell_area table
}; };
class PlayerCondition class PlayerCondition

View file

@ -13758,17 +13758,20 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
AdjustQuestReqItemCount(pQuest, questStatusData); AdjustQuestReqItemCount(pQuest, questStatusData);
// Some spells applied at quest activation // Some spells applied at quest activation
SpellAreaForQuestMapBounds saBounds = sSpellMgr.GetSpellAreaForQuestMapBounds(quest_id, true); uint32 zone, area;
if (saBounds.first != saBounds.second) GetZoneAndAreaId(zone, area);
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
if (area != zone)
{ {
uint32 zone, area; saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area);
GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area)) itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
if (!HasAura(itr->second->spellId, EFFECT_INDEX_0))
CastSpell(this, itr->second->spellId, true);
} }
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
UpdateForQuestWorldObjects(); UpdateForQuestWorldObjects();
} }
@ -13983,32 +13986,22 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver,
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, pQuest->GetQuestId()); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, pQuest->GetQuestId());
uint32 zone = 0;
uint32 area = 0;
// remove auras from spells with quest reward state limitations // remove auras from spells with quest reward state limitations
SpellAreaForQuestMapBounds saEndBounds = sSpellMgr.GetSpellAreaForQuestEndMapBounds(quest_id);
if (saEndBounds.first != saEndBounds.second)
{
GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saEndBounds.first; itr != saEndBounds.second; ++itr)
if (!itr->second->IsFitToRequirements(this, zone, area))
RemoveAurasDueToSpell(itr->second->spellId);
}
// Some spells applied at quest reward // Some spells applied at quest reward
SpellAreaForQuestMapBounds saBounds = sSpellMgr.GetSpellAreaForQuestMapBounds(quest_id, false); uint32 zone, area;
if (saBounds.first != saBounds.second) GetZoneAndAreaId(zone, area);
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
if (area != zone)
{ {
if (!zone || !area) saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area);
GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area)) itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
if (!HasAura(itr->second->spellId, EFFECT_INDEX_0))
CastSpell(this, itr->second->spellId, true);
} }
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
} }
void Player::FailQuest(uint32 questId) void Player::FailQuest(uint32 questId)
@ -21328,9 +21321,7 @@ void Player::UpdateZoneDependentAuras()
// Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update // Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_zoneUpdateId); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_zoneUpdateId);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if (itr->second->autocast && itr->second->IsFitToRequirements(this, m_zoneUpdateId, 0)) itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, 0, true);
if (!HasAura(itr->second->spellId, EFFECT_INDEX_0))
CastSpell(this, itr->second->spellId, true);
} }
void Player::UpdateAreaDependentAuras() void Player::UpdateAreaDependentAuras()
@ -21351,9 +21342,7 @@ void Player::UpdateAreaDependentAuras()
// some auras applied at subzone enter // some auras applied at subzone enter
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_areaUpdateId); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_areaUpdateId);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if (itr->second->autocast && itr->second->IsFitToRequirements(this, m_zoneUpdateId, m_areaUpdateId)) itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, m_areaUpdateId, true);
if (!HasAura(itr->second->spellId, EFFECT_INDEX_0))
CastSpell(this, itr->second->spellId, true);
} }
struct UpdateZoneDependentPetsHelper struct UpdateZoneDependentPetsHelper

View file

@ -3368,7 +3368,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
return; return;
} }
if (GetEffIndex() == EFFECT_INDEX_0 && target->GetTypeId() == TYPEID_PLAYER) if (target->GetTypeId() == TYPEID_PLAYER)
{ {
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId());
if (saBounds.first != saBounds.second) if (saBounds.first != saBounds.second)
@ -3377,17 +3377,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
target->GetZoneAndAreaId(zone, area); target->GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{ itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false);
// some auras remove at aura remove
if (!itr->second->IsFitToRequirements((Player*)target, zone, area))
target->RemoveAurasDueToSpell(itr->second->spellId);
// some auras applied at aura apply
else if (itr->second->autocast)
{
if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0))
target->CastSpell(target, itr->second->spellId, true);
}
}
} }
} }
@ -8770,7 +8760,7 @@ void Aura::HandlePhase(bool apply, bool Real)
target->SetPhaseMask(apply ? GetMiscValue() : uint32(PHASEMASK_NORMAL), true); target->SetPhaseMask(apply ? GetMiscValue() : uint32(PHASEMASK_NORMAL), true);
// no-phase is also phase state so same code for apply and remove // no-phase is also phase state so same code for apply and remove
if (GetEffIndex() == EFFECT_INDEX_0 && target->GetTypeId() == TYPEID_PLAYER) if (target->GetTypeId() == TYPEID_PLAYER)
{ {
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId());
if (saBounds.first != saBounds.second) if (saBounds.first != saBounds.second)
@ -8779,17 +8769,7 @@ void Aura::HandlePhase(bool apply, bool Real)
target->GetZoneAndAreaId(zone, area); target->GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{ itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false);
// some auras remove at aura remove
if (!itr->second->IsFitToRequirements((Player*)target, zone, area))
target->RemoveAurasDueToSpell(itr->second->spellId);
// some auras applied at aura apply
else if (itr->second->autocast)
{
if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0))
target->CastSpell(target, itr->second->spellId, true);
}
}
} }
} }
} }

View file

@ -3845,15 +3845,12 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
void SpellMgr::LoadSpellAreas() void SpellMgr::LoadSpellAreas()
{ {
mSpellAreaMap.clear(); // need for reload case mSpellAreaMap.clear(); // need for reload case
mSpellAreaForQuestMap.clear();
mSpellAreaForActiveQuestMap.clear();
mSpellAreaForQuestEndMap.clear();
mSpellAreaForAuraMap.clear(); mSpellAreaForAuraMap.clear();
uint32 count = 0; uint32 count = 0;
// 0 1 2 3 4 5 6 7 8 // 0 1 2 3 4 5 6 7 8 9
QueryResult* result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area"); QueryResult* result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, condition_id, aura_spell, racemask, gender, autocast FROM spell_area");
if (!result) if (!result)
{ {
@ -3881,10 +3878,11 @@ void SpellMgr::LoadSpellAreas()
spellArea.questStart = fields[2].GetUInt32(); spellArea.questStart = fields[2].GetUInt32();
spellArea.questStartCanActive = fields[3].GetBool(); spellArea.questStartCanActive = fields[3].GetBool();
spellArea.questEnd = fields[4].GetUInt32(); spellArea.questEnd = fields[4].GetUInt32();
spellArea.auraSpell = fields[5].GetInt32(); spellArea.conditionId = fields[5].GetUInt16();
spellArea.raceMask = fields[6].GetUInt32(); spellArea.auraSpell = fields[6].GetInt32();
spellArea.gender = Gender(fields[7].GetUInt8()); spellArea.raceMask = fields[7].GetUInt32();
spellArea.autocast = fields[8].GetBool(); spellArea.gender = Gender(fields[8].GetUInt8());
spellArea.autocast = fields[9].GetBool();
if (!sSpellStore.LookupEntry(spell)) if (!sSpellStore.LookupEntry(spell))
{ {
@ -3928,6 +3926,13 @@ void SpellMgr::LoadSpellAreas()
continue; continue;
} }
if (spellArea.conditionId && !sConditionStorage.LookupEntry<PlayerCondition>(spellArea.conditionId))
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong conditionId (%u) requirement", spell, spellArea.conditionId);
continue;
}
else if (!spellArea.conditionId)
{
if (spellArea.questStart && !sObjectMgr.GetQuestTemplate(spellArea.questStart)) if (spellArea.questStart && !sObjectMgr.GetQuestTemplate(spellArea.questStart))
{ {
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart); sLog.outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart);
@ -3949,6 +3954,19 @@ void SpellMgr::LoadSpellAreas()
} }
} }
if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE) == 0)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask);
continue;
}
if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender);
continue;
}
}
if (spellArea.auraSpell) if (spellArea.auraSpell)
{ {
SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(spellArea.auraSpell)); SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(spellArea.auraSpell));
@ -4017,37 +4035,12 @@ void SpellMgr::LoadSpellAreas()
} }
} }
if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE) == 0)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask);
continue;
}
if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender);
continue;
}
SpellArea const* sa = &mSpellAreaMap.insert(SpellAreaMap::value_type(spell, spellArea))->second; SpellArea const* sa = &mSpellAreaMap.insert(SpellAreaMap::value_type(spell, spellArea))->second;
// for search by current zone/subzone at zone/subzone change // for search by current zone/subzone at zone/subzone change
if (spellArea.areaId) if (spellArea.areaId)
mSpellAreaForAreaMap.insert(SpellAreaForAreaMap::value_type(spellArea.areaId, sa)); mSpellAreaForAreaMap.insert(SpellAreaForAreaMap::value_type(spellArea.areaId, sa));
// for search at quest start/reward
if (spellArea.questStart)
{
if (spellArea.questStartCanActive)
mSpellAreaForActiveQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart, sa));
else
mSpellAreaForQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart, sa));
}
// for search at quest start/reward
if (spellArea.questEnd)
mSpellAreaForQuestEndMap.insert(SpellAreaForQuestMap::value_type(spellArea.questEnd, sa));
// for search at aura apply // for search at aura apply
if (spellArea.auraSpell) if (spellArea.auraSpell)
mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell), sa)); mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell), sa));
@ -4716,6 +4709,13 @@ DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const
{ {
if (conditionId)
{
if (!player || !sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), NULL, CONDITION_FROM_SPELL_AREA))
return false;
}
else // This block will be removed
{
if (gender != GENDER_NONE) if (gender != GENDER_NONE)
{ {
// not in expected gender // not in expected gender
@ -4730,13 +4730,6 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false; return false;
} }
if (areaId)
{
// not in expected zone
if (newZone != areaId && newArea != areaId)
return false;
}
if (questStart) if (questStart)
{ {
// not in expected required quest state // not in expected required quest state
@ -4750,6 +4743,14 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
if (!player || player->GetQuestRewardStatus(questEnd)) if (!player || player->GetQuestRewardStatus(questEnd))
return false; return false;
} }
}
if (areaId)
{
// not in expected zone
if (newZone != areaId && newArea != areaId)
return false;
}
if (auraSpell) if (auraSpell)
{ {
@ -4758,15 +4759,28 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false; return false;
if (auraSpell > 0) if (auraSpell > 0)
// have expected aura // have expected aura
return player->HasAura(auraSpell, EFFECT_INDEX_0); return player->HasAura(auraSpell);
else else
// not have expected aura // not have expected aura
return !player->HasAura(-auraSpell, EFFECT_INDEX_0); return !player->HasAura(-auraSpell);
} }
return true; return true;
} }
void SpellArea::ApplyOrRemoveSpellIfCan(Player* player, uint32 newZone, uint32 newArea, bool onlyApply) const
{
MANGOS_ASSERT(player);
if (IsFitToRequirements(player, newZone, newArea))
{
if (autocast && !player->HasAura(spellId))
player->CastSpell(player, spellId, true);
}
else if (!onlyApply && player->HasAura(spellId))
player->RemoveAurasDueToSpell(spellId);
}
SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty, bool isRaid) SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty, bool isRaid)
{ {
SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(id); SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(id);

View file

@ -846,6 +846,7 @@ struct SpellArea
uint32 areaId; // zone/subzone/or 0 is not limited to zone uint32 areaId; // zone/subzone/or 0 is not limited to zone
uint32 questStart; // quest start (quest must be active or rewarded for spell apply) uint32 questStart; // quest start (quest must be active or rewarded for spell apply)
uint32 questEnd; // quest end (quest don't must be rewarded for spell apply) uint32 questEnd; // quest end (quest don't must be rewarded for spell apply)
uint16 conditionId; // conditionId - will replace questStart, questEnd, raceMask, gender and questStartCanActive
int32 auraSpell; // spell aura must be applied for spell apply )if possitive) and it don't must be applied in other case int32 auraSpell; // spell aura must be applied for spell apply )if possitive) and it don't must be applied in other case
uint32 raceMask; // can be applied only to races uint32 raceMask; // can be applied only to races
Gender gender; // can be applied only to gender Gender gender; // can be applied only to gender
@ -854,14 +855,13 @@ struct SpellArea
// helpers // helpers
bool IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const; bool IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const;
void ApplyOrRemoveSpellIfCan(Player* player, uint32 newZone, uint32 newArea, bool onlyApply) const;
}; };
typedef std::multimap<uint32, SpellArea> SpellAreaMap; typedef std::multimap<uint32 /*applySpellId*/, SpellArea> SpellAreaMap;
typedef std::multimap<uint32, SpellArea const*> SpellAreaForQuestMap; typedef std::multimap<uint32 /*auraSpellId*/, SpellArea const*> SpellAreaForAuraMap;
typedef std::multimap<uint32, SpellArea const*> SpellAreaForAuraMap; typedef std::multimap<uint32 /*areaOrZoneId*/, SpellArea const*> SpellAreaForAreaMap;
typedef std::multimap<uint32, SpellArea const*> SpellAreaForAreaMap;
typedef std::pair<SpellAreaMap::const_iterator, SpellAreaMap::const_iterator> SpellAreaMapBounds; typedef std::pair<SpellAreaMap::const_iterator, SpellAreaMap::const_iterator> SpellAreaMapBounds;
typedef std::pair<SpellAreaForQuestMap::const_iterator, SpellAreaForQuestMap::const_iterator> SpellAreaForQuestMapBounds;
typedef std::pair<SpellAreaForAuraMap::const_iterator, SpellAreaForAuraMap::const_iterator> SpellAreaForAuraMapBounds; typedef std::pair<SpellAreaForAuraMap::const_iterator, SpellAreaForAuraMap::const_iterator> SpellAreaForAuraMapBounds;
typedef std::pair<SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator> SpellAreaForAreaMapBounds; typedef std::pair<SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator> SpellAreaForAreaMapBounds;
@ -1203,19 +1203,6 @@ class SpellMgr
return mSpellAreaMap.equal_range(spell_id); return mSpellAreaMap.equal_range(spell_id);
} }
SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const
{
if (active)
return mSpellAreaForActiveQuestMap.equal_range(quest_id);
else
return mSpellAreaForQuestMap.equal_range(quest_id);
}
SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const
{
return mSpellAreaForQuestEndMap.equal_range(quest_id);
}
SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const
{ {
return mSpellAreaForAuraMap.equal_range(spell_id); return mSpellAreaForAuraMap.equal_range(spell_id);
@ -1270,9 +1257,6 @@ class SpellMgr
PetLevelupSpellMap mPetLevelupSpellMap; PetLevelupSpellMap mPetLevelupSpellMap;
PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry
SpellAreaMap mSpellAreaMap; SpellAreaMap mSpellAreaMap;
SpellAreaForQuestMap mSpellAreaForQuestMap;
SpellAreaForQuestMap mSpellAreaForActiveQuestMap;
SpellAreaForQuestMap mSpellAreaForQuestEndMap;
SpellAreaForAuraMap mSpellAreaForAuraMap; SpellAreaForAuraMap mSpellAreaForAuraMap;
SpellAreaForAreaMap mSpellAreaForAreaMap; SpellAreaForAreaMap mSpellAreaForAreaMap;
}; };

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12598" #define REVISION_NR "12599"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_12447_02_characters_calendar_invites" #define REVISION_DB_CHARACTERS "required_12447_02_characters_calendar_invites"
#define REVISION_DB_MANGOS "required_c12594_01_mangos_spell_template" #define REVISION_DB_MANGOS "required_c12601_01_mangos_spell_area"
#define REVISION_DB_REALMD "required_c12484_02_realmd_account_access" #define REVISION_DB_REALMD "required_c12484_02_realmd_account_access"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__